Commit 8a922095 by Tom Tromey Committed by Tom Tromey

natConstructor.cc (newInstance): Use _Jv_CallAnyMethodA.

	* java/lang/reflect/natConstructor.cc (newInstance): Use
	_Jv_CallAnyMethodA.
	* include/jvm.h: Declare _Jv_CallAnyMethodA.
	* java/lang/reflect/natMethod.cc (_Jv_CallAnyMethodA): Renamed
	from _Jv_CallNonvirtualMethodA.  Changed interface; overloaded.
	Include <jni.h>.
	(COPY): Removed.
	(invoke): Use _Jv_CallAnyMethodA.
	(VAL): Redefined.
	* java/lang/Class.h (Class): Declare JvGetFirstStaticField,
	JvNumStaticFields, JvNumMethods, and JvGetFirstMethod as friend
	functions.
	(struct _Jv_Method): Added getNextMethod method.
	(JvNumMethods): New function.
	(JvGetFirstMethod): Likewise.
	* gcj/field.h (JvGetFirstStaticField): New function.
	(JvNumStaticFields): Likewise.
	(getNextField): Renamed from getNextInstanceField.
	(struct _Jv_Field): New method getClass.
	* jni.cc: Wrote many new functions.
	* include/jni.h (JNI_TRUE): Define.
	(JNI_FALSE): Likewise.
	(jobject, jclass, jstring, jarray, jthrowable, jobjectArray,
	jbyteArray, jshortArray, jintArray, jlongArray, jbooleanArray,
	jcharArray, jfloatArray, jdoubleArray): New typedefs.
	(jfieldID, jmethodID): Likewise.
	(JNI_COMMIT, JNI_ABORT): New defines.
	(JNINativeMethod): New struct.
	(struct JNINativeInterface): Correctly declared more entries.
	(class _Jv_JNIEnv): Added `ex' member.
	(JNI_VERSION_1_1): New define.
	(JNI_VERSION_1_2): Likewise.

	* boehm.cc (_Jv_MarkObj): Use getNextField, not
	getNextInstanceField.

From-SVN: r31553
parent 24823dcf
2000-01-21 Tom Tromey <tromey@cygnus.com>
* java/lang/reflect/natConstructor.cc (newInstance): Use
_Jv_CallAnyMethodA.
* include/jvm.h: Declare _Jv_CallAnyMethodA.
* java/lang/reflect/natMethod.cc (_Jv_CallAnyMethodA): Renamed
from _Jv_CallNonvirtualMethodA. Changed interface; overloaded.
Include <jni.h>.
(COPY): Removed.
(invoke): Use _Jv_CallAnyMethodA.
(VAL): Redefined.
* java/lang/Class.h (Class): Declare JvGetFirstStaticField,
JvNumStaticFields, JvNumMethods, and JvGetFirstMethod as friend
functions.
(struct _Jv_Method): Added getNextMethod method.
(JvNumMethods): New function.
(JvGetFirstMethod): Likewise.
* gcj/field.h (JvGetFirstStaticField): New function.
(JvNumStaticFields): Likewise.
(getNextField): Renamed from getNextInstanceField.
(struct _Jv_Field): New method getClass.
* jni.cc: Wrote many new functions.
* include/jni.h (JNI_TRUE): Define.
(JNI_FALSE): Likewise.
(jobject, jclass, jstring, jarray, jthrowable, jobjectArray,
jbyteArray, jshortArray, jintArray, jlongArray, jbooleanArray,
jcharArray, jfloatArray, jdoubleArray): New typedefs.
(jfieldID, jmethodID): Likewise.
(JNI_COMMIT, JNI_ABORT): New defines.
(JNINativeMethod): New struct.
(struct JNINativeInterface): Correctly declared more entries.
(class _Jv_JNIEnv): Added `ex' member.
(JNI_VERSION_1_1): New define.
(JNI_VERSION_1_2): Likewise.
* boehm.cc (_Jv_MarkObj): Use getNextField, not
getNextInstanceField.
2000-01-20 Tom Tromey <tromey@cygnus.com> 2000-01-20 Tom Tromey <tromey@cygnus.com>
* resolve.cc (StringClass): Removed. * resolve.cc (StringClass): Removed.
......
// boehm.cc - interface between libjava and Boehm GC. // boehm.cc - interface between libjava and Boehm GC.
/* Copyright (C) 1998, 1999 Red Hat, Inc. /* Copyright (C) 1998, 1999, 2000 Red Hat, Inc.
This file is part of libgcj. This file is part of libgcj.
...@@ -256,7 +256,7 @@ _Jv_MarkObj (void *addr, void *msp, void *msl, void * /*env*/) ...@@ -256,7 +256,7 @@ _Jv_MarkObj (void *addr, void *msp, void *msl, void * /*env*/)
MAYBE_MARK (w, mark_stack_ptr, mark_stack_limit, MAYBE_MARK (w, mark_stack_ptr, mark_stack_limit,
obj, elabel); obj, elabel);
} }
field = field->getNextInstanceField (); field = field->getNextField ();
} }
klass = klass->getSuperclass(); klass = klass->getSuperclass();
} }
......
// field.h - Header file for fieldID instances. -*- c++ -*- // field.h - Header file for fieldID instances. -*- c++ -*-
/* Copyright (C) 1998, 1999 Red Hat, Inc. /* Copyright (C) 1998, 1999, 2000 Red Hat, Inc.
This file is part of libgcj. This file is part of libgcj.
...@@ -30,7 +30,7 @@ struct _Jv_Field ...@@ -30,7 +30,7 @@ struct _Jv_Field
_Jv_ushort flags; _Jv_ushort flags;
#ifdef COMPACT_FIELDS #ifdef COMPACT_FIELDS
short nameIndex; /* ofsfet in class's name table */ short nameIndex; /* offset in class's name table */
#else #else
_Jv_ushort bsize; /* not really needed ... */ _Jv_ushort bsize; /* not really needed ... */
#endif #endif
...@@ -51,7 +51,7 @@ struct _Jv_Field ...@@ -51,7 +51,7 @@ struct _Jv_Field
jobject getObjectField (jobject obj) jobject getObjectField (jobject obj)
{ return *(jobject *)((char *)obj + getOffset ()); } { return *(jobject *)((char *)obj + getOffset ()); }
jfieldID getNextInstanceField () { return this + 1; } jfieldID getNextField () { return this + 1; }
jboolean isRef () jboolean isRef ()
{ {
...@@ -66,6 +66,12 @@ struct _Jv_Field ...@@ -66,6 +66,12 @@ struct _Jv_Field
} }
} }
jclass getClass ()
{
JvAssert (isResolved ());
return type;
}
// FIXME - may need to mask off internal flags. // FIXME - may need to mask off internal flags.
int getModifiers() { return flags; } int getModifiers() { return flags; }
...@@ -79,6 +85,7 @@ struct _Jv_Field ...@@ -79,6 +85,7 @@ struct _Jv_Field
}; };
#ifdef __cplusplus #ifdef __cplusplus
inline jbyte inline jbyte
_Jv_GetStaticByteField (jclass, _Jv_Field* field) _Jv_GetStaticByteField (jclass, _Jv_Field* field)
{ {
...@@ -151,6 +158,18 @@ JvNumInstanceFields (jclass klass) ...@@ -151,6 +158,18 @@ JvNumInstanceFields (jclass klass)
return klass->field_count - klass->static_field_count; return klass->field_count - klass->static_field_count;
} }
extern inline jfieldID
JvGetFirstStaticField (jclass klass)
{
return &(klass->fields[0]);
}
extern inline jint
JvNumStaticFields (jclass klass)
{
return klass->static_field_count;
}
extern inline jboolean extern inline jboolean
JvFieldIsRef (jfieldID field) JvFieldIsRef (jfieldID field)
{ {
...@@ -164,6 +183,6 @@ JvGetObjectField (jobject obj, _Jv_Field* field) ...@@ -164,6 +183,6 @@ JvGetObjectField (jobject obj, _Jv_Field* field)
} }
#endif /* defined (__GCJ_CNI_H__) */ #endif /* defined (__GCJ_CNI_H__) */
#endif #endif /* __cplusplus */
#endif /* __GCJ_FIELD_H */ #endif /* __GCJ_FIELD_H */
// java-method.h - Header file for methodID instances. -*- c++ -*- // method.h - Header file for methodID instances. -*- c++ -*-
/* Copyright (C) 1999 Red Hat, Inc. /* Copyright (C) 1999, 2000 Red Hat, Inc.
This file is part of libgcj. This file is part of libgcj.
...@@ -11,8 +11,10 @@ details. */ ...@@ -11,8 +11,10 @@ details. */
#ifndef __GCJ_METHOD_H__ #ifndef __GCJ_METHOD_H__
#define __GCJ_METHOD_H__ #define __GCJ_METHOD_H__
#include <java/lang/Class.h>
extern inline jmethodID extern inline jmethodID
_Jv_FromReflectedMethod(java::lang::reflect::Method *method) _Jv_FromReflectedMethod (java::lang::reflect::Method *method)
{ {
return (jmethodID) return (jmethodID)
((char *) method->declaringClass->methods + method->offset); ((char *) method->declaringClass->methods + method->offset);
......
// jvm.h - Header file for private implementation information. -*- c++ -*- // jvm.h - Header file for private implementation information. -*- c++ -*-
/* Copyright (C) 1998, 1999 Red Hat, Inc. /* Copyright (C) 1998, 1999, 2000 Red Hat, Inc.
This file is part of libgcj. This file is part of libgcj.
...@@ -166,9 +166,20 @@ extern void _Jv_GetTypesFromSignature (jmethodID method, ...@@ -166,9 +166,20 @@ extern void _Jv_GetTypesFromSignature (jmethodID method,
jclass declaringClass, jclass declaringClass,
JArray<jclass> **arg_types_out, JArray<jclass> **arg_types_out,
jclass *return_type_out); jclass *return_type_out);
extern jobject _Jv_CallNonvirtualMethodA (jobject, jclass,
jmethodID, jboolean, extern jobject _Jv_CallAnyMethodA (jobject obj, jclass return_type,
JArray<jclass> *, jobjectArray); jmethodID meth, jboolean is_constructor,
JArray<jclass> *parameter_types,
jobjectArray args);
union jvalue;
extern jthrowable _Jv_CallAnyMethodA (jobject obj,
jclass return_type,
jmethodID meth,
jboolean is_constructor,
JArray<jclass> *parameter_types,
jvalue *args,
jvalue *result);
extern jobject _Jv_NewMultiArray (jclass, jint ndims, jint* dims) extern jobject _Jv_NewMultiArray (jclass, jint ndims, jint* dims)
__attribute__((__malloc__)); __attribute__((__malloc__));
......
...@@ -60,6 +60,9 @@ struct _Jv_Method ...@@ -60,6 +60,9 @@ struct _Jv_Method
_Jv_Utf8Const *signature; _Jv_Utf8Const *signature;
unsigned short accflags; unsigned short accflags;
void *ncode; void *ncode;
_Jv_Method *getNextMethod ()
{ return this + 1; }
}; };
#define JV_PRIMITIVE_VTABLE ((_Jv_VTable *) -1) #define JV_PRIMITIVE_VTABLE ((_Jv_VTable *) -1)
...@@ -168,13 +171,19 @@ private: ...@@ -168,13 +171,19 @@ private:
friend jfieldID JvGetFirstInstanceField (jclass); friend jfieldID JvGetFirstInstanceField (jclass);
friend jint JvNumInstanceFields (jclass); friend jint JvNumInstanceFields (jclass);
friend jfieldID JvGetFirstStaticField (jclass);
friend jint JvNumStaticFields (jclass);
friend jobject _Jv_AllocObject (jclass, jint); friend jobject _Jv_AllocObject (jclass, jint);
friend jobjectArray _Jv_NewObjectArray (jsize, jclass, jobject); friend jobjectArray _Jv_NewObjectArray (jsize, jclass, jobject);
friend jobject _Jv_NewPrimArray (jclass, jint); friend jobject _Jv_NewPrimArray (jclass, jint);
friend jobject _Jv_JNI_ToReflectedField (_Jv_JNIEnv *, jclass, jfieldID); friend jobject _Jv_JNI_ToReflectedField (_Jv_JNIEnv *, jclass, jfieldID);
friend jfieldID _Jv_FromReflectedField (java::lang::reflect::Field *); friend jfieldID _Jv_FromReflectedField (java::lang::reflect::Field *);
friend jmethodID _Jv_FromReflectedMethod (java::lang::reflect::Method *); friend jmethodID _Jv_FromReflectedMethod (java::lang::reflect::Method *);
friend jmethodID _Jv_FromReflectedConstructor (java::lang::reflect::Constructor *); friend jmethodID _Jv_FromReflectedConstructor (java::lang::reflect::Constructor *);
friend jint JvNumMethods (jclass);
friend jmethodID JvGetFirstMethod (jclass);
friend class _Jv_PrimClass; friend class _Jv_PrimClass;
...@@ -257,4 +266,17 @@ private: ...@@ -257,4 +266,17 @@ private:
java::lang::Thread *thread; java::lang::Thread *thread;
}; };
extern inline jint
JvNumMethods (jclass klass)
{
return klass->method_count;
}
extern inline jmethodID
JvGetFirstMethod (jclass klass)
{
return &klass->methods[0];
}
#endif /* __JAVA_LANG_CLASS_H__ */ #endif /* __JAVA_LANG_CLASS_H__ */
...@@ -48,6 +48,6 @@ java::lang::reflect::Constructor::newInstance (jobjectArray args) ...@@ -48,6 +48,6 @@ java::lang::reflect::Constructor::newInstance (jobjectArray args)
jmethodID meth = _Jv_FromReflectedConstructor (this); jmethodID meth = _Jv_FromReflectedConstructor (this);
// In the constructor case the return type is the type of the // In the constructor case the return type is the type of the
// constructor. // constructor.
return _Jv_CallNonvirtualMethodA (NULL, declaringClass, meth, true, return _Jv_CallAnyMethodA (NULL, declaringClass, meth, true,
parameter_types, args); parameter_types, args);
} }
...@@ -12,6 +12,7 @@ details. */ ...@@ -12,6 +12,7 @@ details. */
#include <gcj/cni.h> #include <gcj/cni.h>
#include <jvm.h> #include <jvm.h>
#include <jni.h>
#include <java/lang/reflect/Method.h> #include <java/lang/reflect/Method.h>
#include <java/lang/reflect/Constructor.h> #include <java/lang/reflect/Constructor.h>
...@@ -187,8 +188,8 @@ java::lang::reflect::Method::invoke (jobject obj, jobjectArray args) ...@@ -187,8 +188,8 @@ java::lang::reflect::Method::invoke (jobject obj, jobjectArray args)
meth = _Jv_LookupDeclaredMethod (k, meth->name, meth->signature); meth = _Jv_LookupDeclaredMethod (k, meth->name, meth->signature);
} }
return _Jv_CallNonvirtualMethodA (obj, return_type, meth, false, return _Jv_CallAnyMethodA (obj, return_type, meth, false,
parameter_types, args); parameter_types, args);
} }
jint jint
...@@ -311,23 +312,22 @@ _Jv_GetTypesFromSignature (jmethodID method, ...@@ -311,23 +312,22 @@ _Jv_GetTypesFromSignature (jmethodID method,
// functions. It handles both Methods and Constructors, and it can // functions. It handles both Methods and Constructors, and it can
// handle any return type. In the Constructor case, the `obj' // handle any return type. In the Constructor case, the `obj'
// argument is unused and should be NULL; also, the `return_type' is // argument is unused and should be NULL; also, the `return_type' is
// the class that the constructor will construct. // the class that the constructor will construct. RESULT is a pointer
jobject // to a `jvalue' (see jni.h); for a void method this should be NULL.
_Jv_CallNonvirtualMethodA (jobject obj, // This function returns an exception (if one was thrown), or NULL if
jclass return_type, // the call went ok.
jmethodID meth, jthrowable
jboolean is_constructor, _Jv_CallAnyMethodA (jobject obj,
JArray<jclass> *parameter_types, jclass return_type,
jobjectArray args) jmethodID meth,
jboolean is_constructor,
JArray<jclass> *parameter_types,
jvalue *args,
jvalue *result)
{ {
JvAssert (! is_constructor || ! obj); JvAssert (! is_constructor || ! obj);
JvAssert (! is_constructor || ! return_type); JvAssert (! is_constructor || ! return_type);
// FIXME: access checks.
if (parameter_types->length != args->length)
JvThrow (new java::lang::IllegalArgumentException);
// See whether call needs an object as the first argument. A // See whether call needs an object as the first argument. A
// constructor does need a `this' argument, but it is one we create. // constructor does need a `this' argument, but it is one we create.
jboolean needs_this = false; jboolean needs_this = false;
...@@ -349,7 +349,6 @@ _Jv_CallNonvirtualMethodA (jobject obj, ...@@ -349,7 +349,6 @@ _Jv_CallNonvirtualMethodA (jobject obj,
* sizeof (ffi_type *)); * sizeof (ffi_type *));
jclass *paramelts = elements (parameter_types); jclass *paramelts = elements (parameter_types);
jobject *argelts = elements (args);
// FIXME: at some point the compiler is going to add extra arguments // FIXME: at some point the compiler is going to add extra arguments
// to some functions. In particular we are going to do this for // to some functions. In particular we are going to do this for
...@@ -376,22 +375,11 @@ _Jv_CallNonvirtualMethodA (jobject obj, ...@@ -376,22 +375,11 @@ _Jv_CallNonvirtualMethodA (jobject obj,
for (int arg = 0; i < param_count; ++i, ++arg) for (int arg = 0; i < param_count; ++i, ++arg)
{ {
jclass k = argelts[arg] ? argelts[arg]->getClass() : NULL; argtypes[i] = get_ffi_type (paramelts[arg]);
argtypes[i] = get_ffi_type (k);
if (paramelts[arg]->isPrimitive()) if (paramelts[arg]->isPrimitive())
{ size += paramelts[arg]->size();
if (! argelts[arg]
|| ! k
|| ! can_widen (k, paramelts[arg]))
JvThrow (new java::lang::IllegalArgumentException);
size += paramelts[arg]->size();
}
else else
{ size += sizeof (jobject);
if (argelts[arg] && ! paramelts[arg]->isAssignableFrom (k))
JvThrow (new java::lang::IllegalArgumentException);
size += sizeof (jobject);
}
} }
ffi_cif cif; ffi_cif cif;
...@@ -404,89 +392,162 @@ _Jv_CallNonvirtualMethodA (jobject obj, ...@@ -404,89 +392,162 @@ _Jv_CallNonvirtualMethodA (jobject obj,
char *p = (char *) alloca (size); char *p = (char *) alloca (size);
void **values = (void **) alloca (param_count * sizeof (void *)); void **values = (void **) alloca (param_count * sizeof (void *));
#define COPY(Where, What, Type) \
do { \
Type val = (What); \
memcpy ((Where), &val, sizeof (Type)); \
values[i] = (Where); \
Where += sizeof (Type); \
} while (0)
i = 0; i = 0;
if (needs_this) if (needs_this)
{ {
COPY (p, obj, jobject); values[i] = p;
memcpy (p, &obj, sizeof (jobject));
p += sizeof (jobject);
++i; ++i;
} }
for (int arg = 0; i < param_count; ++i, ++arg) for (int arg = 0; i < param_count; ++i, ++arg)
{ {
java::lang::Number *num = (java::lang::Number *) argelts[arg]; int tsize;
if (paramelts[arg] == JvPrimClass (byte)) if (paramelts[arg]->isPrimitive())
COPY (p, num->byteValue(), jbyte); tsize = paramelts[arg]->size();
else if (paramelts[arg] == JvPrimClass (short))
COPY (p, num->shortValue(), jshort);
else if (paramelts[arg] == JvPrimClass (int))
COPY (p, num->intValue(), jint);
else if (paramelts[arg] == JvPrimClass (long))
COPY (p, num->longValue(), jlong);
else if (paramelts[arg] == JvPrimClass (float))
COPY (p, num->floatValue(), jfloat);
else if (paramelts[arg] == JvPrimClass (double))
COPY (p, num->doubleValue(), jdouble);
else if (paramelts[arg] == JvPrimClass (boolean))
COPY (p, ((java::lang::Boolean *) argelts[arg])->booleanValue(),
jboolean);
else if (paramelts[arg] == JvPrimClass (char))
COPY (p, ((java::lang::Character *) argelts[arg])->charValue(), jchar);
else else
{ tsize = sizeof (jobject);
JvAssert (! paramelts[arg]->isPrimitive());
COPY (p, argelts[arg], jobject); // Copy appropriate bits from the jvalue into the ffi array.
} // FIXME: we could do this copying all in one loop, above, by
// over-allocating a bit.
values[i] = p;
memcpy (p, &args[arg], tsize);
p += tsize;
} }
// FIXME: initialize class here. // FIXME: initialize class here.
// Largest possible value. Hopefully it is aligned!
jdouble ret_value;
java::lang::Throwable *ex; java::lang::Throwable *ex;
using namespace java::lang; using namespace java::lang;
using namespace java::lang::reflect; using namespace java::lang::reflect;
ex = Method::hack_trampoline ((gnu::gcj::RawData *) &cif, ex = Method::hack_trampoline ((gnu::gcj::RawData *) &cif,
(gnu::gcj::RawData *) meth->ncode, (gnu::gcj::RawData *) meth->ncode,
(gnu::gcj::RawData *) &ret_value, (gnu::gcj::RawData *) result,
(gnu::gcj::RawData *) values); (gnu::gcj::RawData *) values);
if (ex) if (ex)
JvThrow (new InvocationTargetException (ex)); // FIXME: this is wrong for JNI. But if we just return the
// exception, then the non-JNI cases won't be able to distinguish
// it from exceptions we might generate ourselves. Sigh.
ex = new InvocationTargetException (ex);
if (is_constructor)
result->l = obj;
return ex;
}
// This is another version of _Jv_CallAnyMethodA, but this one does
// more checking and is used by the reflection (and not JNI) code.
jobject
_Jv_CallAnyMethodA (jobject obj,
jclass return_type,
jmethodID meth,
jboolean is_constructor,
JArray<jclass> *parameter_types,
jobjectArray args)
{
// FIXME: access checks.
if (parameter_types->length != args->length)
JvThrow (new java::lang::IllegalArgumentException);
int param_count = parameter_types->length;
jclass *paramelts = elements (parameter_types);
jobject *argelts = elements (args);
jvalue argvals[param_count];
#define COPY(Where, What, Type) \
do { \
Type val = (What); \
memcpy ((Where), &val, sizeof (Type)); \
} while (0)
for (int i = 0; i < param_count; ++i)
{
jclass k = argelts[i] ? argelts[i]->getClass() : NULL;
if (paramelts[i]->isPrimitive())
{
if (! argelts[i]
|| ! k
|| ! can_widen (k, paramelts[i]))
JvThrow (new java::lang::IllegalArgumentException);
}
else
{
if (argelts[i] && ! paramelts[i]->isAssignableFrom (k))
JvThrow (new java::lang::IllegalArgumentException);
}
java::lang::Number *num = (java::lang::Number *) argelts[i];
if (paramelts[i] == JvPrimClass (byte))
COPY (&argvals[i], num->byteValue(), jbyte);
else if (paramelts[i] == JvPrimClass (short))
COPY (&argvals[i], num->shortValue(), jshort);
else if (paramelts[i] == JvPrimClass (int))
COPY (&argvals[i], num->intValue(), jint);
else if (paramelts[i] == JvPrimClass (long))
COPY (&argvals[i], num->longValue(), jlong);
else if (paramelts[i] == JvPrimClass (float))
COPY (&argvals[i], num->floatValue(), jfloat);
else if (paramelts[i] == JvPrimClass (double))
COPY (&argvals[i], num->doubleValue(), jdouble);
else if (paramelts[i] == JvPrimClass (boolean))
COPY (&argvals[i],
((java::lang::Boolean *) argelts[i])->booleanValue(),
jboolean);
else if (paramelts[i] == JvPrimClass (char))
COPY (&argvals[i],
((java::lang::Character *) argelts[i])->charValue(),
jchar);
else
{
JvAssert (! paramelts[i]->isPrimitive());
COPY (&argvals[i], argelts[i], jobject);
}
}
jvalue ret_value;
java::lang::Throwable *ex = _Jv_CallAnyMethodA (obj,
return_type,
meth,
is_constructor,
parameter_types,
argvals,
&ret_value);
if (ex)
JvThrow (ex);
jobject r; jobject r;
#define VAL(Wrapper, Type) (new Wrapper (* (Type *) &ret_value)) #define VAL(Wrapper, Field) (new Wrapper (ret_value.Field))
if (is_constructor) if (is_constructor)
r = obj; r = ret_value.l;
else if (return_type == JvPrimClass (byte)) else if (return_type == JvPrimClass (byte))
r = VAL (java::lang::Byte, jbyte); r = VAL (java::lang::Byte, b);
else if (return_type == JvPrimClass (short)) else if (return_type == JvPrimClass (short))
r = VAL (java::lang::Short, jshort); r = VAL (java::lang::Short, s);
else if (return_type == JvPrimClass (int)) else if (return_type == JvPrimClass (int))
r = VAL (java::lang::Integer, jint); r = VAL (java::lang::Integer, i);
else if (return_type == JvPrimClass (long)) else if (return_type == JvPrimClass (long))
r = VAL (java::lang::Long, jlong); r = VAL (java::lang::Long, j);
else if (return_type == JvPrimClass (float)) else if (return_type == JvPrimClass (float))
r = VAL (java::lang::Float, jfloat); r = VAL (java::lang::Float, f);
else if (return_type == JvPrimClass (double)) else if (return_type == JvPrimClass (double))
r = VAL (java::lang::Double, jdouble); r = VAL (java::lang::Double, d);
else if (return_type == JvPrimClass (boolean)) else if (return_type == JvPrimClass (boolean))
r = VAL (java::lang::Boolean, jboolean); r = VAL (java::lang::Boolean, z);
else if (return_type == JvPrimClass (char)) else if (return_type == JvPrimClass (char))
r = VAL (java::lang::Character, jchar); r = VAL (java::lang::Character, c);
else if (return_type == JvPrimClass (void)) else if (return_type == JvPrimClass (void))
r = NULL; r = NULL;
else else
{ {
JvAssert (return_type == NULL || ! return_type->isPrimitive()); JvAssert (return_type == NULL || ! return_type->isPrimitive());
r = * (Object **) &ret_value; r = ret_value.l;
} }
return r; return r;
......
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