mirror of
https://github.com/corda/corda.git
synced 2025-01-03 19:54:13 +00:00
implement NewObjectA, Get<type>MethodA, and GetStatic<type>MethodA
This commit is contained in:
parent
153b78f479
commit
4512a9a38e
44
src/common.h
44
src/common.h
@ -562,6 +562,50 @@ struct Object { };
|
||||
|
||||
typedef Object* object;
|
||||
|
||||
typedef uint8_t jboolean;
|
||||
typedef int8_t jbyte;
|
||||
typedef uint16_t jchar;
|
||||
typedef int16_t jshort;
|
||||
typedef int32_t jint;
|
||||
typedef int64_t jlong;
|
||||
typedef float jfloat;
|
||||
typedef double jdouble;
|
||||
|
||||
typedef jint jsize;
|
||||
|
||||
typedef object* jobject;
|
||||
|
||||
typedef jobject jclass;
|
||||
typedef jobject jthrowable;
|
||||
typedef jobject jstring;
|
||||
typedef jobject jweak;
|
||||
|
||||
typedef jobject jarray;
|
||||
typedef jarray jbooleanArray;
|
||||
typedef jarray jbyteArray;
|
||||
typedef jarray jcharArray;
|
||||
typedef jarray jshortArray;
|
||||
typedef jarray jintArray;
|
||||
typedef jarray jlongArray;
|
||||
typedef jarray jfloatArray;
|
||||
typedef jarray jdoubleArray;
|
||||
typedef jarray jobjectArray;
|
||||
|
||||
typedef uintptr_t jfieldID;
|
||||
typedef uintptr_t jmethodID;
|
||||
|
||||
union jvalue {
|
||||
jboolean z;
|
||||
jbyte b;
|
||||
jchar c;
|
||||
jshort s;
|
||||
jint i;
|
||||
jlong j;
|
||||
jfloat f;
|
||||
jdouble d;
|
||||
jobject l;
|
||||
};
|
||||
|
||||
} // namespace vm
|
||||
|
||||
#endif//COMMON_H
|
||||
|
@ -8221,6 +8221,47 @@ class ArgumentList {
|
||||
}
|
||||
}
|
||||
|
||||
ArgumentList(Thread* t, uintptr_t* array, unsigned size, bool* objectMask,
|
||||
object this_, const char* spec, const jvalue* arguments):
|
||||
t(static_cast<MyThread*>(t)),
|
||||
array(array),
|
||||
objectMask(objectMask),
|
||||
size(size),
|
||||
position(0),
|
||||
protector(this)
|
||||
{
|
||||
if (this_) {
|
||||
addObject(this_);
|
||||
}
|
||||
|
||||
unsigned index = 0;
|
||||
for (MethodSpecIterator it(t, spec); it.hasNext();) {
|
||||
switch (*it.next()) {
|
||||
case 'L':
|
||||
case '[': {
|
||||
object* v = arguments[index++].l;
|
||||
addObject(v ? *v : 0);
|
||||
} break;
|
||||
|
||||
case 'J':
|
||||
addLong(arguments[index++].j);
|
||||
break;
|
||||
|
||||
case 'D':
|
||||
addLong(arguments[index++].d);
|
||||
break;
|
||||
|
||||
case 'F':
|
||||
addLong(arguments[index++].f);
|
||||
break;
|
||||
|
||||
default:
|
||||
addLong(arguments[index++].i);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
ArgumentList(Thread* t, uintptr_t* array, unsigned size, bool* objectMask,
|
||||
object this_, const char* spec, object arguments):
|
||||
t(static_cast<MyThread*>(t)),
|
||||
@ -8765,6 +8806,36 @@ class MyProcessor: public Processor {
|
||||
return local::invoke(t, method, &list);
|
||||
}
|
||||
|
||||
virtual object
|
||||
invokeArray(Thread* t, object method, object this_, const jvalue* arguments)
|
||||
{
|
||||
assert(t, t->exception == 0);
|
||||
|
||||
assert(t, t->state == Thread::ActiveState
|
||||
or t->state == Thread::ExclusiveState);
|
||||
|
||||
assert(t, ((methodFlags(t, method) & ACC_STATIC) == 0) xor (this_ == 0));
|
||||
|
||||
method = findMethod(t, method, this_);
|
||||
|
||||
const char* spec = reinterpret_cast<char*>
|
||||
(&byteArrayBody(t, methodSpec(t, method), 0));
|
||||
|
||||
unsigned size = methodParameterFootprint(t, method);
|
||||
THREAD_RUNTIME_ARRAY(t, uintptr_t, array, size);
|
||||
THREAD_RUNTIME_ARRAY(t, bool, objectMask, size);
|
||||
ArgumentList list
|
||||
(t, RUNTIME_ARRAY_BODY(array), size, RUNTIME_ARRAY_BODY(objectMask),
|
||||
this_, spec, arguments);
|
||||
|
||||
PROTECT(t, method);
|
||||
|
||||
compile(static_cast<MyThread*>(t),
|
||||
local::codeAllocator(static_cast<MyThread*>(t)), 0, method);
|
||||
|
||||
return local::invoke(t, method, &list);
|
||||
}
|
||||
|
||||
virtual object
|
||||
invokeList(Thread* t, object method, object this_, bool indirectObjects,
|
||||
va_list arguments)
|
||||
|
@ -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)
|
||||
|
338
src/jnienv.cpp
338
src/jnienv.cpp
@ -631,17 +631,41 @@ NewObject(Thread* t, jclass c, jmethodID m, ...)
|
||||
return r;
|
||||
}
|
||||
|
||||
uint64_t
|
||||
newObjectA(Thread* t, uintptr_t* arguments)
|
||||
{
|
||||
jclass c = reinterpret_cast<jclass>(arguments[0]);
|
||||
jmethodID m = arguments[1];
|
||||
const jvalue* a = reinterpret_cast<const jvalue*>(arguments[2]);
|
||||
|
||||
object o = make(t, jclassVmClass(t, *c));
|
||||
PROTECT(t, o);
|
||||
|
||||
t->m->processor->invokeArray(t, getMethod(t, m), o, a);
|
||||
|
||||
return reinterpret_cast<uint64_t>(makeLocalReference(t, o));
|
||||
}
|
||||
|
||||
jobject JNICALL
|
||||
NewObjectA(Thread* t, jobject o, jmethodID m, const jvalue* a)
|
||||
{
|
||||
uintptr_t arguments[] = { reinterpret_cast<uintptr_t>(o),
|
||||
m,
|
||||
reinterpret_cast<uintptr_t>(a) };
|
||||
|
||||
return reinterpret_cast<jobject>(run(t, newObjectA, arguments));
|
||||
}
|
||||
|
||||
uint64_t
|
||||
callObjectMethodV(Thread* t, uintptr_t* arguments)
|
||||
{
|
||||
jobject o = reinterpret_cast<jclass>(arguments[0]);
|
||||
jobject o = reinterpret_cast<jobject>(arguments[0]);
|
||||
jmethodID m = arguments[1];
|
||||
va_list* a = reinterpret_cast<va_list*>(arguments[2]);
|
||||
|
||||
object method = getMethod(t, m);
|
||||
return reinterpret_cast<uint64_t>
|
||||
(makeLocalReference
|
||||
(t, t->m->processor->invokeList(t, method, *o, true, *a)));
|
||||
(t, t->m->processor->invokeList(t, getMethod(t, m), *o, true, *a)));
|
||||
}
|
||||
|
||||
jobject JNICALL
|
||||
@ -667,15 +691,37 @@ CallObjectMethod(Thread* t, jobject o, jmethodID m, ...)
|
||||
return r;
|
||||
}
|
||||
|
||||
uint64_t
|
||||
callObjectMethodA(Thread* t, uintptr_t* arguments)
|
||||
{
|
||||
jobject o = reinterpret_cast<jobject>(arguments[0]);
|
||||
jmethodID m = arguments[1];
|
||||
const jvalue* a = reinterpret_cast<const jvalue*>(arguments[2]);
|
||||
|
||||
return reinterpret_cast<uint64_t>
|
||||
(makeLocalReference
|
||||
(t, t->m->processor->invokeArray(t, getMethod(t, m), *o, a)));
|
||||
}
|
||||
|
||||
jobject JNICALL
|
||||
CallObjectMethodA(Thread* t, jobject o, jmethodID m, const jvalue* a)
|
||||
{
|
||||
uintptr_t arguments[] = { reinterpret_cast<uintptr_t>(o),
|
||||
m,
|
||||
reinterpret_cast<uintptr_t>(a) };
|
||||
|
||||
return reinterpret_cast<jobject>(run(t, callObjectMethodA, arguments));
|
||||
}
|
||||
|
||||
uint64_t
|
||||
callIntMethodV(Thread* t, uintptr_t* arguments)
|
||||
{
|
||||
jobject o = reinterpret_cast<jclass>(arguments[0]);
|
||||
jobject o = reinterpret_cast<jobject>(arguments[0]);
|
||||
jmethodID m = arguments[1];
|
||||
va_list* a = reinterpret_cast<va_list*>(arguments[2]);
|
||||
|
||||
object method = getMethod(t, m);
|
||||
return intValue(t, t->m->processor->invokeList(t, method, *o, true, *a));
|
||||
return intValue
|
||||
(t, t->m->processor->invokeList(t, getMethod(t, m), *o, true, *a));
|
||||
}
|
||||
|
||||
jboolean JNICALL
|
||||
@ -701,6 +747,27 @@ CallBooleanMethod(Thread* t, jobject o, jmethodID m, ...)
|
||||
return r;
|
||||
}
|
||||
|
||||
uint64_t
|
||||
callIntMethodA(Thread* t, uintptr_t* arguments)
|
||||
{
|
||||
jobject o = reinterpret_cast<jobject>(arguments[0]);
|
||||
jmethodID m = arguments[1];
|
||||
const jvalue* a = reinterpret_cast<const jvalue*>(arguments[2]);
|
||||
|
||||
return intValue
|
||||
(t, t->m->processor->invokeArray(t, getMethod(t, m), *o, a));
|
||||
}
|
||||
|
||||
jboolean JNICALL
|
||||
CallBooleanMethodA(Thread* t, jobject o, jmethodID m, const jvalue* a)
|
||||
{
|
||||
uintptr_t arguments[] = { reinterpret_cast<uintptr_t>(o),
|
||||
m,
|
||||
reinterpret_cast<uintptr_t>(a) };
|
||||
|
||||
return run(t, callIntMethodA, arguments) != 0;
|
||||
}
|
||||
|
||||
jbyte JNICALL
|
||||
CallByteMethodV(Thread* t, jobject o, jmethodID m, va_list a)
|
||||
{
|
||||
@ -724,6 +791,16 @@ CallByteMethod(Thread* t, jobject o, jmethodID m, ...)
|
||||
return r;
|
||||
}
|
||||
|
||||
jbyte JNICALL
|
||||
CallByteMethodA(Thread* t, jobject o, jmethodID m, const jvalue* a)
|
||||
{
|
||||
uintptr_t arguments[] = { reinterpret_cast<uintptr_t>(o),
|
||||
m,
|
||||
reinterpret_cast<uintptr_t>(a) };
|
||||
|
||||
return run(t, callIntMethodA, arguments);
|
||||
}
|
||||
|
||||
jchar JNICALL
|
||||
CallCharMethodV(Thread* t, jobject o, jmethodID m, va_list a)
|
||||
{
|
||||
@ -747,6 +824,16 @@ CallCharMethod(Thread* t, jobject o, jmethodID m, ...)
|
||||
return r;
|
||||
}
|
||||
|
||||
jchar JNICALL
|
||||
CallCharMethodA(Thread* t, jobject o, jmethodID m, const jvalue* a)
|
||||
{
|
||||
uintptr_t arguments[] = { reinterpret_cast<uintptr_t>(o),
|
||||
m,
|
||||
reinterpret_cast<uintptr_t>(a) };
|
||||
|
||||
return run(t, callIntMethodA, arguments);
|
||||
}
|
||||
|
||||
jshort JNICALL
|
||||
CallShortMethodV(Thread* t, jobject o, jmethodID m, va_list a)
|
||||
{
|
||||
@ -770,6 +857,16 @@ CallShortMethod(Thread* t, jobject o, jmethodID m, ...)
|
||||
return r;
|
||||
}
|
||||
|
||||
jshort JNICALL
|
||||
CallShortMethodA(Thread* t, jobject o, jmethodID m, const jvalue* a)
|
||||
{
|
||||
uintptr_t arguments[] = { reinterpret_cast<uintptr_t>(o),
|
||||
m,
|
||||
reinterpret_cast<uintptr_t>(a) };
|
||||
|
||||
return run(t, callIntMethodA, arguments);
|
||||
}
|
||||
|
||||
jint JNICALL
|
||||
CallIntMethodV(Thread* t, jobject o, jmethodID m, va_list a)
|
||||
{
|
||||
@ -793,15 +890,25 @@ CallIntMethod(Thread* t, jobject o, jmethodID m, ...)
|
||||
return r;
|
||||
}
|
||||
|
||||
jint JNICALL
|
||||
CallIntMethodA(Thread* t, jobject o, jmethodID m, const jvalue* a)
|
||||
{
|
||||
uintptr_t arguments[] = { reinterpret_cast<uintptr_t>(o),
|
||||
m,
|
||||
reinterpret_cast<uintptr_t>(a) };
|
||||
|
||||
return run(t, callIntMethodA, arguments);
|
||||
}
|
||||
|
||||
uint64_t
|
||||
callLongMethodV(Thread* t, uintptr_t* arguments)
|
||||
{
|
||||
jobject o = reinterpret_cast<jclass>(arguments[0]);
|
||||
jobject o = reinterpret_cast<jobject>(arguments[0]);
|
||||
jmethodID m = arguments[1];
|
||||
va_list* a = reinterpret_cast<va_list*>(arguments[2]);
|
||||
|
||||
object method = getMethod(t, m);
|
||||
return longValue(t, t->m->processor->invokeList(t, method, *o, true, *a));
|
||||
return longValue
|
||||
(t, t->m->processor->invokeList(t, getMethod(t, m), *o, true, *a));
|
||||
}
|
||||
|
||||
jlong JNICALL
|
||||
@ -827,6 +934,27 @@ CallLongMethod(Thread* t, jobject o, jmethodID m, ...)
|
||||
return r;
|
||||
}
|
||||
|
||||
uint64_t
|
||||
callLongMethodA(Thread* t, uintptr_t* arguments)
|
||||
{
|
||||
jobject o = reinterpret_cast<jobject>(arguments[0]);
|
||||
jmethodID m = arguments[1];
|
||||
const jvalue* a = reinterpret_cast<const jvalue*>(arguments[2]);
|
||||
|
||||
return longValue
|
||||
(t, t->m->processor->invokeArray(t, getMethod(t, m), *o, a));
|
||||
}
|
||||
|
||||
jlong JNICALL
|
||||
CallLongMethodA(Thread* t, jobject o, jmethodID m, const jvalue* a)
|
||||
{
|
||||
uintptr_t arguments[] = { reinterpret_cast<uintptr_t>(o),
|
||||
m,
|
||||
reinterpret_cast<uintptr_t>(a) };
|
||||
|
||||
return run(t, callLongMethodA, arguments);
|
||||
}
|
||||
|
||||
jfloat JNICALL
|
||||
CallFloatMethodV(Thread* t, jobject o, jmethodID m, va_list a)
|
||||
{
|
||||
@ -850,6 +978,16 @@ CallFloatMethod(Thread* t, jobject o, jmethodID m, ...)
|
||||
return r;
|
||||
}
|
||||
|
||||
jfloat JNICALL
|
||||
CallFloatMethodA(Thread* t, jobject o, jmethodID m, const jvalue* a)
|
||||
{
|
||||
uintptr_t arguments[] = { reinterpret_cast<uintptr_t>(o),
|
||||
m,
|
||||
reinterpret_cast<uintptr_t>(a) };
|
||||
|
||||
return bitsToFloat(run(t, callIntMethodA, arguments));
|
||||
}
|
||||
|
||||
jdouble JNICALL
|
||||
CallDoubleMethodV(Thread* t, jobject o, jmethodID m, va_list a)
|
||||
{
|
||||
@ -873,15 +1011,24 @@ CallDoubleMethod(Thread* t, jobject o, jmethodID m, ...)
|
||||
return r;
|
||||
}
|
||||
|
||||
jdouble JNICALL
|
||||
CallDoubleMethodA(Thread* t, jobject o, jmethodID m, const jvalue* a)
|
||||
{
|
||||
uintptr_t arguments[] = { reinterpret_cast<uintptr_t>(o),
|
||||
m,
|
||||
reinterpret_cast<uintptr_t>(a) };
|
||||
|
||||
return bitsToDouble(run(t, callLongMethodA, arguments));
|
||||
}
|
||||
|
||||
uint64_t
|
||||
callVoidMethodV(Thread* t, uintptr_t* arguments)
|
||||
{
|
||||
jobject o = reinterpret_cast<jclass>(arguments[0]);
|
||||
jobject o = reinterpret_cast<jobject>(arguments[0]);
|
||||
jmethodID m = arguments[1];
|
||||
va_list* a = reinterpret_cast<va_list*>(arguments[2]);
|
||||
|
||||
object method = getMethod(t, m);
|
||||
t->m->processor->invokeList(t, method, *o, true, *a);
|
||||
t->m->processor->invokeList(t, getMethod(t, m), *o, true, *a);
|
||||
|
||||
return 0;
|
||||
}
|
||||
@ -907,6 +1054,28 @@ CallVoidMethod(Thread* t, jobject o, jmethodID m, ...)
|
||||
va_end(a);
|
||||
}
|
||||
|
||||
uint64_t
|
||||
callVoidMethodA(Thread* t, uintptr_t* arguments)
|
||||
{
|
||||
jobject o = reinterpret_cast<jobject>(arguments[0]);
|
||||
jmethodID m = arguments[1];
|
||||
const jvalue* a = reinterpret_cast<const jvalue*>(arguments[2]);
|
||||
|
||||
t->m->processor->invokeArray(t, getMethod(t, m), *o, a);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
void JNICALL
|
||||
CallVoidMethodA(Thread* t, jobject o, jmethodID m, const jvalue* a)
|
||||
{
|
||||
uintptr_t arguments[] = { reinterpret_cast<uintptr_t>(o),
|
||||
m,
|
||||
reinterpret_cast<uintptr_t>(a) };
|
||||
|
||||
run(t, callVoidMethodA, arguments);
|
||||
}
|
||||
|
||||
object
|
||||
getStaticMethod(Thread* t, jmethodID m)
|
||||
{
|
||||
@ -951,6 +1120,25 @@ CallStaticObjectMethod(Thread* t, jclass c, jmethodID m, ...)
|
||||
return r;
|
||||
}
|
||||
|
||||
uint64_t
|
||||
callStaticObjectMethodA(Thread* t, uintptr_t* arguments)
|
||||
{
|
||||
jmethodID m = arguments[0];
|
||||
const jvalue* a = reinterpret_cast<const jvalue*>(arguments[1]);
|
||||
|
||||
return reinterpret_cast<uint64_t>
|
||||
(makeLocalReference
|
||||
(t, t->m->processor->invokeArray(t, getStaticMethod(t, m), 0, a)));
|
||||
}
|
||||
|
||||
jobject JNICALL
|
||||
CallStaticObjectMethodA(Thread* t, jclass, jmethodID m, const jvalue* a)
|
||||
{
|
||||
uintptr_t arguments[] = { m, reinterpret_cast<uintptr_t>(a) };
|
||||
|
||||
return reinterpret_cast<jobject>(run(t, callStaticObjectMethodA, arguments));
|
||||
}
|
||||
|
||||
uint64_t
|
||||
callStaticIntMethodV(Thread* t, uintptr_t* arguments)
|
||||
{
|
||||
@ -982,6 +1170,24 @@ CallStaticBooleanMethod(Thread* t, jclass c, jmethodID m, ...)
|
||||
return r;
|
||||
}
|
||||
|
||||
uint64_t
|
||||
callStaticIntMethodA(Thread* t, uintptr_t* arguments)
|
||||
{
|
||||
jmethodID m = arguments[0];
|
||||
const jvalue* a = reinterpret_cast<const jvalue*>(arguments[1]);
|
||||
|
||||
return intValue
|
||||
(t, t->m->processor->invokeArray(t, getStaticMethod(t, m), 0, a));
|
||||
}
|
||||
|
||||
jboolean JNICALL
|
||||
CallStaticBooleanMethodA(Thread* t, jclass, jmethodID m, const jvalue* a)
|
||||
{
|
||||
uintptr_t arguments[] = { m, reinterpret_cast<uintptr_t>(a) };
|
||||
|
||||
return run(t, callStaticIntMethodA, arguments) != 0;
|
||||
}
|
||||
|
||||
jbyte JNICALL
|
||||
CallStaticByteMethodV(Thread* t, jclass, jmethodID m, va_list a)
|
||||
{
|
||||
@ -1003,6 +1209,14 @@ CallStaticByteMethod(Thread* t, jclass c, jmethodID m, ...)
|
||||
return r;
|
||||
}
|
||||
|
||||
jbyte JNICALL
|
||||
CallStaticByteMethodA(Thread* t, jclass, jmethodID m, const jvalue* a)
|
||||
{
|
||||
uintptr_t arguments[] = { m, reinterpret_cast<uintptr_t>(a) };
|
||||
|
||||
return run(t, callStaticIntMethodA, arguments);
|
||||
}
|
||||
|
||||
jchar JNICALL
|
||||
CallStaticCharMethodV(Thread* t, jclass, jmethodID m, va_list a)
|
||||
{
|
||||
@ -1024,6 +1238,14 @@ CallStaticCharMethod(Thread* t, jclass c, jmethodID m, ...)
|
||||
return r;
|
||||
}
|
||||
|
||||
jchar JNICALL
|
||||
CallStaticCharMethodA(Thread* t, jclass, jmethodID m, const jvalue* a)
|
||||
{
|
||||
uintptr_t arguments[] = { m, reinterpret_cast<uintptr_t>(a) };
|
||||
|
||||
return run(t, callStaticIntMethodA, arguments);
|
||||
}
|
||||
|
||||
jshort JNICALL
|
||||
CallStaticShortMethodV(Thread* t, jclass, jmethodID m, va_list a)
|
||||
{
|
||||
@ -1045,6 +1267,14 @@ CallStaticShortMethod(Thread* t, jclass c, jmethodID m, ...)
|
||||
return r;
|
||||
}
|
||||
|
||||
jshort JNICALL
|
||||
CallStaticShortMethodA(Thread* t, jclass, jmethodID m, const jvalue* a)
|
||||
{
|
||||
uintptr_t arguments[] = { m, reinterpret_cast<uintptr_t>(a) };
|
||||
|
||||
return run(t, callStaticIntMethodA, arguments);
|
||||
}
|
||||
|
||||
jint JNICALL
|
||||
CallStaticIntMethodV(Thread* t, jclass, jmethodID m, va_list a)
|
||||
{
|
||||
@ -1066,6 +1296,14 @@ CallStaticIntMethod(Thread* t, jclass c, jmethodID m, ...)
|
||||
return r;
|
||||
}
|
||||
|
||||
jint JNICALL
|
||||
CallStaticIntMethodA(Thread* t, jclass, jmethodID m, const jvalue* a)
|
||||
{
|
||||
uintptr_t arguments[] = { m, reinterpret_cast<uintptr_t>(a) };
|
||||
|
||||
return run(t, callStaticIntMethodA, arguments);
|
||||
}
|
||||
|
||||
uint64_t
|
||||
callStaticLongMethodV(Thread* t, uintptr_t* arguments)
|
||||
{
|
||||
@ -1097,6 +1335,24 @@ CallStaticLongMethod(Thread* t, jclass c, jmethodID m, ...)
|
||||
return r;
|
||||
}
|
||||
|
||||
uint64_t
|
||||
callStaticLongMethodA(Thread* t, uintptr_t* arguments)
|
||||
{
|
||||
jmethodID m = arguments[0];
|
||||
const jvalue* a = reinterpret_cast<const jvalue*>(arguments[1]);
|
||||
|
||||
return longValue
|
||||
(t, t->m->processor->invokeArray(t, getStaticMethod(t, m), 0, a));
|
||||
}
|
||||
|
||||
jlong JNICALL
|
||||
CallStaticLongMethodA(Thread* t, jclass, jmethodID m, const jvalue* a)
|
||||
{
|
||||
uintptr_t arguments[] = { m, reinterpret_cast<uintptr_t>(a) };
|
||||
|
||||
return run(t, callStaticLongMethodA, arguments);
|
||||
}
|
||||
|
||||
jfloat JNICALL
|
||||
CallStaticFloatMethodV(Thread* t, jclass, jmethodID m, va_list a)
|
||||
{
|
||||
@ -1118,6 +1374,14 @@ CallStaticFloatMethod(Thread* t, jclass c, jmethodID m, ...)
|
||||
return r;
|
||||
}
|
||||
|
||||
jfloat JNICALL
|
||||
CallStaticFloatMethodA(Thread* t, jclass, jmethodID m, const jvalue* a)
|
||||
{
|
||||
uintptr_t arguments[] = { m, reinterpret_cast<uintptr_t>(a) };
|
||||
|
||||
return bitsToFloat(run(t, callStaticIntMethodA, arguments));
|
||||
}
|
||||
|
||||
jdouble JNICALL
|
||||
CallStaticDoubleMethodV(Thread* t, jclass, jmethodID m, va_list a)
|
||||
{
|
||||
@ -1139,6 +1403,14 @@ CallStaticDoubleMethod(Thread* t, jclass c, jmethodID m, ...)
|
||||
return r;
|
||||
}
|
||||
|
||||
jdouble JNICALL
|
||||
CallStaticDoubleMethodA(Thread* t, jclass, jmethodID m, const jvalue* a)
|
||||
{
|
||||
uintptr_t arguments[] = { m, reinterpret_cast<uintptr_t>(a) };
|
||||
|
||||
return bitsToDouble(run(t, callStaticLongMethodA, arguments));
|
||||
}
|
||||
|
||||
uint64_t
|
||||
callStaticVoidMethodV(Thread* t, uintptr_t* arguments)
|
||||
{
|
||||
@ -1169,6 +1441,25 @@ CallStaticVoidMethod(Thread* t, jclass c, jmethodID m, ...)
|
||||
va_end(a);
|
||||
}
|
||||
|
||||
uint64_t
|
||||
callStaticVoidMethodA(Thread* t, uintptr_t* arguments)
|
||||
{
|
||||
jmethodID m = arguments[0];
|
||||
const jvalue* a = reinterpret_cast<const jvalue*>(arguments[1]);
|
||||
|
||||
t->m->processor->invokeArray(t, getStaticMethod(t, m), 0, a);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
void JNICALL
|
||||
CallStaticVoidMethodA(Thread* t, jclass, jmethodID m, const jvalue* a)
|
||||
{
|
||||
uintptr_t arguments[] = { m, reinterpret_cast<uintptr_t>(a) };
|
||||
|
||||
run(t, callStaticVoidMethodA, arguments);
|
||||
}
|
||||
|
||||
jint
|
||||
fieldID(Thread* t, object field)
|
||||
{
|
||||
@ -3105,47 +3396,68 @@ populateJNITables(JavaVMVTable* vmTable, JNIEnvVTable* envTable)
|
||||
envTable->GetFieldID = local::GetFieldID;
|
||||
envTable->GetMethodID = local::GetMethodID;
|
||||
envTable->GetStaticMethodID = local::GetStaticMethodID;
|
||||
envTable->NewObject = local::NewObject;
|
||||
envTable->NewObjectV = local::NewObjectV;
|
||||
envTable->NewObjectA = local::NewObjectA;
|
||||
envTable->NewObject = local::NewObject;
|
||||
envTable->CallObjectMethodV = local::CallObjectMethodV;
|
||||
envTable->CallObjectMethodA = local::CallObjectMethodA;
|
||||
envTable->CallObjectMethod = local::CallObjectMethod;
|
||||
envTable->CallBooleanMethodV = local::CallBooleanMethodV;
|
||||
envTable->CallBooleanMethodA = local::CallBooleanMethodA;
|
||||
envTable->CallBooleanMethod = local::CallBooleanMethod;
|
||||
envTable->CallByteMethodV = local::CallByteMethodV;
|
||||
envTable->CallByteMethodA = local::CallByteMethodA;
|
||||
envTable->CallByteMethod = local::CallByteMethod;
|
||||
envTable->CallCharMethodV = local::CallCharMethodV;
|
||||
envTable->CallCharMethodA = local::CallCharMethodA;
|
||||
envTable->CallCharMethod = local::CallCharMethod;
|
||||
envTable->CallShortMethodV = local::CallShortMethodV;
|
||||
envTable->CallShortMethodA = local::CallShortMethodA;
|
||||
envTable->CallShortMethod = local::CallShortMethod;
|
||||
envTable->CallIntMethodV = local::CallIntMethodV;
|
||||
envTable->CallIntMethodA = local::CallIntMethodA;
|
||||
envTable->CallIntMethod = local::CallIntMethod;
|
||||
envTable->CallLongMethodV = local::CallLongMethodV;
|
||||
envTable->CallLongMethodA = local::CallLongMethodA;
|
||||
envTable->CallLongMethod = local::CallLongMethod;
|
||||
envTable->CallFloatMethodV = local::CallFloatMethodV;
|
||||
envTable->CallFloatMethodA = local::CallFloatMethodA;
|
||||
envTable->CallFloatMethod = local::CallFloatMethod;
|
||||
envTable->CallDoubleMethodV = local::CallDoubleMethodV;
|
||||
envTable->CallDoubleMethodA = local::CallDoubleMethodA;
|
||||
envTable->CallDoubleMethod = local::CallDoubleMethod;
|
||||
envTable->CallVoidMethodV = local::CallVoidMethodV;
|
||||
envTable->CallVoidMethodA = local::CallVoidMethodA;
|
||||
envTable->CallVoidMethod = local::CallVoidMethod;
|
||||
envTable->CallStaticObjectMethodV = local::CallStaticObjectMethodV;
|
||||
envTable->CallStaticObjectMethodA = local::CallStaticObjectMethodA;
|
||||
envTable->CallStaticObjectMethod = local::CallStaticObjectMethod;
|
||||
envTable->CallStaticBooleanMethodV = local::CallStaticBooleanMethodV;
|
||||
envTable->CallStaticBooleanMethodA = local::CallStaticBooleanMethodA;
|
||||
envTable->CallStaticBooleanMethod = local::CallStaticBooleanMethod;
|
||||
envTable->CallStaticByteMethodV = local::CallStaticByteMethodV;
|
||||
envTable->CallStaticByteMethodA = local::CallStaticByteMethodA;
|
||||
envTable->CallStaticByteMethod = local::CallStaticByteMethod;
|
||||
envTable->CallStaticCharMethodV = local::CallStaticCharMethodV;
|
||||
envTable->CallStaticCharMethodA = local::CallStaticCharMethodA;
|
||||
envTable->CallStaticCharMethod = local::CallStaticCharMethod;
|
||||
envTable->CallStaticShortMethodV = local::CallStaticShortMethodV;
|
||||
envTable->CallStaticShortMethodA = local::CallStaticShortMethodA;
|
||||
envTable->CallStaticShortMethod = local::CallStaticShortMethod;
|
||||
envTable->CallStaticIntMethodV = local::CallStaticIntMethodV;
|
||||
envTable->CallStaticIntMethodA = local::CallStaticIntMethodA;
|
||||
envTable->CallStaticIntMethod = local::CallStaticIntMethod;
|
||||
envTable->CallStaticLongMethodV = local::CallStaticLongMethodV;
|
||||
envTable->CallStaticLongMethodA = local::CallStaticLongMethodA;
|
||||
envTable->CallStaticLongMethod = local::CallStaticLongMethod;
|
||||
envTable->CallStaticFloatMethodV = local::CallStaticFloatMethodV;
|
||||
envTable->CallStaticFloatMethodA = local::CallStaticFloatMethodA;
|
||||
envTable->CallStaticFloatMethod = local::CallStaticFloatMethod;
|
||||
envTable->CallStaticDoubleMethodV = local::CallStaticDoubleMethodV;
|
||||
envTable->CallStaticDoubleMethodA = local::CallStaticDoubleMethodA;
|
||||
envTable->CallStaticDoubleMethod = local::CallStaticDoubleMethod;
|
||||
envTable->CallStaticVoidMethodV = local::CallStaticVoidMethodV;
|
||||
envTable->CallStaticVoidMethodA = local::CallStaticVoidMethodA;
|
||||
envTable->CallStaticVoidMethod = local::CallStaticVoidMethod;
|
||||
envTable->GetStaticFieldID = local::GetStaticFieldID;
|
||||
envTable->GetObjectField = local::GetObjectField;
|
||||
|
@ -167,50 +167,6 @@ const unsigned ConstructorFlag = 1 << 1;
|
||||
typedef Machine JavaVM;
|
||||
typedef Thread JNIEnv;
|
||||
|
||||
typedef uint8_t jboolean;
|
||||
typedef int8_t jbyte;
|
||||
typedef uint16_t jchar;
|
||||
typedef int16_t jshort;
|
||||
typedef int32_t jint;
|
||||
typedef int64_t jlong;
|
||||
typedef float jfloat;
|
||||
typedef double jdouble;
|
||||
|
||||
typedef jint jsize;
|
||||
|
||||
typedef object* jobject;
|
||||
|
||||
typedef jobject jclass;
|
||||
typedef jobject jthrowable;
|
||||
typedef jobject jstring;
|
||||
typedef jobject jweak;
|
||||
|
||||
typedef jobject jarray;
|
||||
typedef jarray jbooleanArray;
|
||||
typedef jarray jbyteArray;
|
||||
typedef jarray jcharArray;
|
||||
typedef jarray jshortArray;
|
||||
typedef jarray jintArray;
|
||||
typedef jarray jlongArray;
|
||||
typedef jarray jfloatArray;
|
||||
typedef jarray jdoubleArray;
|
||||
typedef jarray jobjectArray;
|
||||
|
||||
typedef uintptr_t jfieldID;
|
||||
typedef uintptr_t jmethodID;
|
||||
|
||||
union jvalue {
|
||||
jboolean z;
|
||||
jbyte b;
|
||||
jchar c;
|
||||
jshort s;
|
||||
jint i;
|
||||
jlong j;
|
||||
jfloat f;
|
||||
jdouble d;
|
||||
jobject l;
|
||||
};
|
||||
|
||||
struct JNINativeMethod {
|
||||
char* name;
|
||||
char* signature;
|
||||
|
@ -106,6 +106,10 @@ class Processor {
|
||||
virtual object
|
||||
invokeArray(Thread* t, object method, object this_, object arguments) = 0;
|
||||
|
||||
virtual object
|
||||
invokeArray(Thread* t, object method, object this_, const jvalue* arguments)
|
||||
= 0;
|
||||
|
||||
virtual object
|
||||
invokeList(Thread* t, object method, object this_, bool indirectObjects,
|
||||
va_list arguments) = 0;
|
||||
|
Loading…
Reference in New Issue
Block a user