This is the mail archive of the java-patches@gcc.gnu.org mailing list for the Java project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Patch: natMethod fix



I found this omission (handling of FFI_TYPE_POINTER) while running
rhino.  I've also moved the constructor test above the switch as a
minor optimization.

Ok for branch and trunk?

AG


2002-02-28  Anthony Green  <green@redhat.com>

	* java/lang/reflect/natMethod.cc (result): Add void* element.
	(_Jv_CallAnyMethodA): Handle FFI_TYPE_POINTER arguments.  Move
	constructor test.


Index: libjava/java/lang/reflect/natMethod.cc
===================================================================
RCS file: /cvs/gcc/gcc/libjava/java/lang/reflect/natMethod.cc,v
retrieving revision 1.26
diff -c -r1.26 natMethod.cc
*** natMethod.cc	2002/02/24 17:55:44	1.26
--- natMethod.cc	2002/02/28 15:45:01
***************
*** 426,431 ****
--- 426,432 ----
    union
    {
      ffi_arg i;
+     jobject o;
      jlong l;
      jfloat f;
      jdouble d;
***************
*** 448,484 ****
    // 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;
  
    return ex;
  #else
--- 449,489 ----
    // a narrowing conversion for jbyte, jchar, etc. results.
    // Note that boolean is handled either by the FFI_TYPE_SINT8 or
    // FFI_TYPE_SINT32 case.
    if (is_constructor)
      result->l = obj;
+   else
+     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;
+       case FFI_TYPE_POINTER:
+ 	result->l = (jobject)ffi_result.o;
+ 	break;
+       default:
+ 	JvFail ("Unknown ffi_call return type");
+ 	break;
+       }
  
    return ex;
  #else


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]