interpret.invokeNative(): call native function with a right signature

This commit is contained in:
lostdj 2014-10-31 12:22:13 +03:00
parent 331c635814
commit b7abaf7a78
2 changed files with 9 additions and 1 deletions

View File

@ -1441,6 +1441,7 @@ Classpath* makeClasspath(System* system,
const char* embedPrefix);
typedef uint64_t(JNICALL* FastNativeFunction)(Thread*, GcMethod*, uintptr_t*);
typedef void(JNICALL* FastVoidNativeFunction)(Thread*, GcMethod*, uintptr_t*);
inline GcClass* objectClass(Thread*, object o)
{

View File

@ -641,8 +641,15 @@ unsigned invokeNative(Thread* t, GcMethod* method)
marshalArguments(
t, RUNTIME_ARRAY_BODY(args) + argOffset, 0, sp, method, true);
result = reinterpret_cast<FastNativeFunction>(native->function())(
if(method->returnCode() != VoidField) {
result = reinterpret_cast<FastNativeFunction>(native->function())(
t, method, RUNTIME_ARRAY_BODY(args));
}
else {
result = 0;
reinterpret_cast<FastVoidNativeFunction>(native->function())(
t, method, RUNTIME_ARRAY_BODY(args));
}
}
pushResult(t, method->returnCode(), result, false);