diff options
author | Tom Tromey <tromey@cygnus.com> | 2000-01-05 17:23:34 +0000 |
---|---|---|
committer | Tom Tromey <tromey@gcc.gnu.org> | 2000-01-05 17:23:34 +0000 |
commit | 5dab1948f62612e83c7b6128fe1e1f4fe89bfe0b (patch) | |
tree | 30e3bb54b112b657fa09ac2a74cb664fa19f6867 /libjava/java/lang/reflect/natMethod.cc | |
parent | 95c6cc0ab5c348a6eaa5bb595d44f03d830c3863 (diff) | |
download | gcc-5dab1948f62612e83c7b6128fe1e1f4fe89bfe0b.zip gcc-5dab1948f62612e83c7b6128fe1e1f4fe89bfe0b.tar.gz gcc-5dab1948f62612e83c7b6128fe1e1f4fe89bfe0b.tar.bz2 |
natMethod.cc (get_ffi_type): Test size of jboolean and select correct ffi type on that basis.
* java/lang/reflect/natMethod.cc (get_ffi_type): Test size of
jboolean and select correct ffi type on that basis.
(_Jv_CallNonvirtualMethodA): Handle `void' return type.
Constructor call always has `void' return type.
From-SVN: r31242
Diffstat (limited to 'libjava/java/lang/reflect/natMethod.cc')
-rw-r--r-- | libjava/java/lang/reflect/natMethod.cc | 21 |
1 files changed, 17 insertions, 4 deletions
diff --git a/libjava/java/lang/reflect/natMethod.cc b/libjava/java/lang/reflect/natMethod.cc index 5635b9f..62f0ab9 100644 --- a/libjava/java/lang/reflect/natMethod.cc +++ b/libjava/java/lang/reflect/natMethod.cc @@ -131,8 +131,14 @@ get_ffi_type (jclass klass) r = &ffi_type_double; else if (klass == JvPrimClass (boolean)) { - // FIXME. - r = &ffi_type_sint8; + // On some platforms a bool is a byte, on others an int. + if (sizeof (jboolean) == sizeof (jbyte)) + r = &ffi_type_sint8; + else + { + JvAssert (sizeof (jboolean) == sizeof (jint)); + r = &ffi_type_sint32; + } } else if (klass == JvPrimClass (char)) r = &ffi_type_uint16; @@ -333,7 +339,12 @@ _Jv_CallNonvirtualMethodA (jobject obj, if (needs_this) ++param_count; - ffi_type *rtype = get_ffi_type (return_type); + ffi_type *rtype; + // A constructor itself always returns void. + if (is_constructor || return_type == JvPrimClass (void)) + rtype = &ffi_type_void; + else + rtype = get_ffi_type (return_type); ffi_type **argtypes = (ffi_type **) alloca (param_count * sizeof (ffi_type *)); @@ -451,7 +462,9 @@ _Jv_CallNonvirtualMethodA (jobject obj, jobject r; #define VAL(Wrapper, Type) (new Wrapper (* (Type *) &ret_value)) - if (return_type == JvPrimClass (byte)) + if (is_constructor) + r = obj; + else if (return_type == JvPrimClass (byte)) r = VAL (java::lang::Byte, jbyte); else if (return_type == JvPrimClass (short)) r = VAL (java::lang::Short, jshort); |