implement NewObjectA, Get<type>MethodA, and GetStatic<type>MethodA

This commit is contained in:
Joel Dice
2012-06-15 17:41:40 -06:00
parent 153b78f479
commit 4512a9a38e
6 changed files with 501 additions and 57 deletions

View File

@ -2758,6 +2758,39 @@ pushArguments(Thread* t, object this_, const char* spec, bool indirectObjects,
}
}
void
pushArguments(Thread* t, object this_, const char* spec,
const jvalue* arguments)
{
if (this_) {
pushObject(t, this_);
}
unsigned index = 0;
for (MethodSpecIterator it(t, spec); it.hasNext();) {
switch (*it.next()) {
case 'L':
case '[': {
jobject v = arguments[index++].l;
pushObject(t, v ? *v : 0);
} break;
case 'J':
case 'D':
pushLong(t, arguments[index++].j);
break;
case 'F': {
pushFloat(t, arguments[index++].d);
} break;
default:
pushInt(t, arguments[index++].i);
break;
}
}
}
void
pushArguments(Thread* t, object this_, const char* spec, object a)
{
@ -3009,6 +3042,30 @@ class MyProcessor: public Processor {
return ::invoke(t, method);
}
virtual object
invokeArray(vm::Thread* vmt, object method, object this_,
const jvalue* arguments)
{
Thread* t = static_cast<Thread*>(vmt);
assert(t, t->state == Thread::ActiveState
or t->state == Thread::ExclusiveState);
assert(t, ((methodFlags(t, method) & ACC_STATIC) == 0) xor (this_ == 0));
if (UNLIKELY(t->sp + methodParameterFootprint(t, method) + 1
> stackSizeInWords(t) / 2))
{
throwNew(t, Machine::StackOverflowErrorType);
}
const char* spec = reinterpret_cast<char*>
(&byteArrayBody(t, methodSpec(t, method), 0));
pushArguments(t, this_, spec, arguments);
return ::invoke(t, method);
}
virtual object
invokeList(vm::Thread* vmt, object method, object this_,
bool indirectObjects, va_list arguments)