natMethod.cc (_Jv_CallAnyMethodA): Define ffi_result union for ffi_call result.
* java/lang/reflect/natMethod.cc (_Jv_CallAnyMethodA): Define ffi_result union for ffi_call result. Cast ffi_result members to jvalue. From-SVN: r50007
This commit is contained in:
parent
02c521f439
commit
a7261b2da0
@ -1,3 +1,9 @@
|
||||
2002-02-24 Jeff Sturm <jsturm@one-point.com>
|
||||
|
||||
* java/lang/reflect/natMethod.cc (_Jv_CallAnyMethodA):
|
||||
Define ffi_result union for ffi_call result. Cast
|
||||
ffi_result members to jvalue.
|
||||
|
||||
2002-02-23 Alexandre Oliva <aoliva@redhat.com>
|
||||
|
||||
* Makefile.in, gcj/Makefile.in, include/Makefile.in: Rebuilt.
|
||||
|
@ -423,9 +423,17 @@ _Jv_CallAnyMethodA (jobject obj,
|
||||
|
||||
Throwable *ex = NULL;
|
||||
|
||||
union
|
||||
{
|
||||
ffi_arg i;
|
||||
jlong l;
|
||||
jfloat f;
|
||||
jdouble d;
|
||||
} ffi_result;
|
||||
|
||||
try
|
||||
{
|
||||
ffi_call (&cif, (void (*)()) meth->ncode, result, values);
|
||||
ffi_call (&cif, (void (*)()) meth->ncode, &ffi_result, values);
|
||||
}
|
||||
catch (Throwable *ex2)
|
||||
{
|
||||
@ -436,6 +444,39 @@ _Jv_CallAnyMethodA (jobject obj,
|
||||
ex = new InvocationTargetException (ex2);
|
||||
}
|
||||
|
||||
// Since ffi_call returns integer values promoted to a word, use
|
||||
// a narrowing conversion for jbyte, jchar, etc. results.
|
||||
// Note that boolean is handled either by the FFI_TYPE_SINT8 or
|
||||
// FFI_TYPE_SINT32 case.
|
||||
switch (rtype->type)
|
||||
{
|
||||
case FFI_TYPE_VOID:
|
||||
break;
|
||||
case FFI_TYPE_SINT8:
|
||||
result->b = (jbyte)ffi_result.i;
|
||||
break;
|
||||
case FFI_TYPE_SINT16:
|
||||
result->s = (jshort)ffi_result.i;
|
||||
break;
|
||||
case FFI_TYPE_UINT16:
|
||||
result->c = (jchar)ffi_result.i;
|
||||
break;
|
||||
case FFI_TYPE_SINT32:
|
||||
result->i = (jint)ffi_result.i;
|
||||
break;
|
||||
case FFI_TYPE_SINT64:
|
||||
result->j = (jlong)ffi_result.l;
|
||||
break;
|
||||
case FFI_TYPE_FLOAT:
|
||||
result->f = (jfloat)ffi_result.f;
|
||||
break;
|
||||
case FFI_TYPE_DOUBLE:
|
||||
result->d = (jdouble)ffi_result.d;
|
||||
break;
|
||||
default:
|
||||
JvFail ("Unknown ffi_call return type");
|
||||
break;
|
||||
}
|
||||
if (is_constructor)
|
||||
result->l = obj;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user