prims.cc (DECLARE_PRIM_TYPE): Define a vtable as well.

* prims.cc (DECLARE_PRIM_TYPE): Define a vtable as well.
	(_Jv_PrimClass): Set `methods' by calling _Jv_FindArrayClass.
	* include/jvm.h (struct _Jv_ArrayVTable): Declare.
	(NUM_OBJECT_METHODS): New define.
	* java/lang/natClassLoader.cc (_Jv_FindArrayClass): Added
	`array_vtable' parameter.  Added assertion.
	* java/lang/Class.h (_Jv_FindArrayClass): Added `array_vtable'
	parameter.

From-SVN: r34312
This commit is contained in:
Tom Tromey 2000-05-31 23:50:37 +00:00 committed by Tom Tromey
parent f1aa7a521a
commit c74e221410
5 changed files with 45 additions and 7 deletions

View file

@ -519,7 +519,7 @@ class _Jv_PrimClass : public java::lang::Class
public:
// FIXME: calling convention is weird. If we use the natural types
// then the compiler will complain because they aren't Java types.
_Jv_PrimClass (jobject cname, jbyte sig, jint len)
_Jv_PrimClass (jobject cname, jbyte sig, jint len, jobject array_vtable)
{
using namespace java::lang::reflect;
@ -545,11 +545,21 @@ public:
interface_count = 0;
state = JV_STATE_NOTHING;
thread = NULL;
// Note that we have to set `methods' to NULL.
if (sig != 'V')
_Jv_FindArrayClass (this, NULL, (_Jv_VTable *) array_vtable);
}
};
// We use this to define both primitive classes and the vtables for
// arrays of primitive classes. The latter are given names so that we
// can refer to them from the compiler, allowing us to construct
// arrays of primitives statically.
#define DECLARE_PRIM_TYPE(NAME, SIG, LEN) \
_Jv_PrimClass _Jv_##NAME##Class((jobject) #NAME, (jbyte) SIG, (jint) LEN)
_Jv_ArrayVTable _Jv_##NAME##VTable; \
_Jv_PrimClass _Jv_##NAME##Class((jobject) #NAME, (jbyte) SIG, (jint) LEN, \
(jobject) &_Jv_##NAME##VTable)
DECLARE_PRIM_TYPE(byte, 'B', 1);
DECLARE_PRIM_TYPE(short, 'S', 2);