aboutsummaryrefslogtreecommitdiff
path: root/libjava/prims.cc
diff options
context:
space:
mode:
authorTom Tromey <tromey@cygnus.com>2000-05-31 23:50:37 +0000
committerTom Tromey <tromey@gcc.gnu.org>2000-05-31 23:50:37 +0000
commitc74e2214108d712dc032877cbb60436070cfeafa (patch)
tree4b05280dd0f1b3a4def3323eb6da74ef8279da45 /libjava/prims.cc
parentf1aa7a521a31b60380cf5c2e6913823c8bd18ce5 (diff)
downloadgcc-c74e2214108d712dc032877cbb60436070cfeafa.zip
gcc-c74e2214108d712dc032877cbb60436070cfeafa.tar.gz
gcc-c74e2214108d712dc032877cbb60436070cfeafa.tar.bz2
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
Diffstat (limited to 'libjava/prims.cc')
-rw-r--r--libjava/prims.cc14
1 files changed, 12 insertions, 2 deletions
diff --git a/libjava/prims.cc b/libjava/prims.cc
index 4279b09..3a022f0 100644
--- a/libjava/prims.cc
+++ b/libjava/prims.cc
@@ -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);