From b7abaf7a78571411dea32b8c8d1c2948779c78b8 Mon Sep 17 00:00:00 2001 From: lostdj Date: Fri, 31 Oct 2014 12:22:13 +0300 Subject: [PATCH] interpret.invokeNative(): call native function with a right signature --- src/avian/machine.h | 1 + src/interpret.cpp | 9 ++++++++- 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/src/avian/machine.h b/src/avian/machine.h index d310ac4b88..8caa7ca847 100644 --- a/src/avian/machine.h +++ b/src/avian/machine.h @@ -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) { diff --git a/src/interpret.cpp b/src/interpret.cpp index 4c908fa09a..41960b602f 100644 --- a/src/interpret.cpp +++ b/src/interpret.cpp @@ -641,8 +641,15 @@ unsigned invokeNative(Thread* t, GcMethod* method) marshalArguments( t, RUNTIME_ARRAY_BODY(args) + argOffset, 0, sp, method, true); - result = reinterpret_cast(native->function())( + if(method->returnCode() != VoidField) { + result = reinterpret_cast(native->function())( t, method, RUNTIME_ARRAY_BODY(args)); + } + else { + result = 0; + reinterpret_cast(native->function())( + t, method, RUNTIME_ARRAY_BODY(args)); + } } pushResult(t, method->returnCode(), result, false);