fix JNI invocation for return types of less than 32-bits

This commit is contained in:
Joel Dice 2007-10-24 17:06:12 -06:00
parent 92d61c1ba2
commit 89b22dd3ab
2 changed files with 23 additions and 8 deletions

View File

@ -557,8 +557,26 @@ invokeNative(Thread* t, object method)
switch (returnCode) {
case ByteField:
case BooleanField:
if (DebugRun) {
fprintf(stderr, "result: %"LLD"\n", static_cast<int8_t>(result));
}
pushInt(t, static_cast<int8_t>(result));
break;
case CharField:
if (DebugRun) {
fprintf(stderr, "result: %"LLD"\n", static_cast<uint16_t>(result));
}
pushInt(t, static_cast<uint16_t>(result));
break;
case ShortField:
if (DebugRun) {
fprintf(stderr, "result: %"LLD"\n", static_cast<int16_t>(result));
}
pushInt(t, static_cast<int16_t>(result));
break;
case FloatField:
case IntField:
if (DebugRun) {
@ -577,11 +595,12 @@ invokeNative(Thread* t, object method)
case ObjectField:
if (DebugRun) {
fprintf(stderr, "result: %p at %p\n", result == 0 ? 0 :
fprintf(stderr, "result: %p at %p\n",
static_cast<uintptr_t>(result) == 0 ? 0 :
*reinterpret_cast<object*>(static_cast<uintptr_t>(result)),
reinterpret_cast<object*>(static_cast<uintptr_t>(result)));
}
pushObject(t, result == 0 ? 0 :
pushObject(t, static_cast<uintptr_t>(result) == 0 ? 0 :
*reinterpret_cast<object*>(static_cast<uintptr_t>(result)));
break;

View File

@ -168,18 +168,14 @@ float:
jne double
fstps 8(%ebp)
movl 8(%ebp),%eax
jmp int32
jmp exit
double:
cmpl $DOUBLE_TYPE,%ecx
jne int32
jne exit
fstpl 8(%ebp)
movl 8(%ebp),%eax
movl 12(%ebp),%edx
jmp exit
int32:
movl $0,%edx
exit:
movl %ebp,%esp