Commit 5dab1948 by Tom Tromey Committed by Tom Tromey

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
parent 95c6cc0a
2000-01-05 Tom Tromey <tromey@cygnus.com>
* 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.
2000-01-04 Tom Tromey <tromey@cygnus.com> 2000-01-04 Tom Tromey <tromey@cygnus.com>
* java/lang/Class.h (getSignature): Updated. * java/lang/Class.h (getSignature): Updated.
......
...@@ -131,8 +131,14 @@ get_ffi_type (jclass klass) ...@@ -131,8 +131,14 @@ get_ffi_type (jclass klass)
r = &ffi_type_double; r = &ffi_type_double;
else if (klass == JvPrimClass (boolean)) else if (klass == JvPrimClass (boolean))
{ {
// FIXME. // On some platforms a bool is a byte, on others an int.
r = &ffi_type_sint8; if (sizeof (jboolean) == sizeof (jbyte))
r = &ffi_type_sint8;
else
{
JvAssert (sizeof (jboolean) == sizeof (jint));
r = &ffi_type_sint32;
}
} }
else if (klass == JvPrimClass (char)) else if (klass == JvPrimClass (char))
r = &ffi_type_uint16; r = &ffi_type_uint16;
...@@ -333,7 +339,12 @@ _Jv_CallNonvirtualMethodA (jobject obj, ...@@ -333,7 +339,12 @@ _Jv_CallNonvirtualMethodA (jobject obj,
if (needs_this) if (needs_this)
++param_count; ++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 ffi_type **argtypes = (ffi_type **) alloca (param_count
* sizeof (ffi_type *)); * sizeof (ffi_type *));
...@@ -451,7 +462,9 @@ _Jv_CallNonvirtualMethodA (jobject obj, ...@@ -451,7 +462,9 @@ _Jv_CallNonvirtualMethodA (jobject obj,
jobject r; jobject r;
#define VAL(Wrapper, Type) (new Wrapper (* (Type *) &ret_value)) #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); r = VAL (java::lang::Byte, jbyte);
else if (return_type == JvPrimClass (short)) else if (return_type == JvPrimClass (short))
r = VAL (java::lang::Short, jshort); r = VAL (java::lang::Short, jshort);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment