diff options
author | apbianco <apbianco@138bc75d-0d04-0410-961f-82ee72b054a4> | 2001-01-15 08:11:40 +0000 |
---|---|---|
committer | apbianco <apbianco@138bc75d-0d04-0410-961f-82ee72b054a4> | 2001-01-15 08:11:40 +0000 |
commit | 331e4168e90ee0b3d9b905c4ab51d5a8c659a14f (patch) | |
tree | 0f67eae624079d38f268d0277b1b5f7310768fa4 /libjava/prims.cc | |
parent | 6599bf3a0c329e6b77955d670683bf672f1c19df (diff) | |
download | gcc-331e4168e90ee0b3d9b905c4ab51d5a8c659a14f.tar.gz |
2001-01-07 Alexandre Petit-Bianco <apbianco@cygnus.com>
All files with updated copyright.
* prims.cc (class _Jv_PrimClass): Removed.
(init_prim_class): New function.
(DECLARE_PRIM_TYPE): Rewritten. `java::lang::Class' replaces
`_Jv_PrimClass' in primitive type declarations. Assign to the
value returned by `init_prim_class.'
* gcj/array.h: `java::lang::Class' replaces `_Jv_PrimClass' in
primitive type declarations.
(JvPrimClass): Cast to `jclass' removed.
* java/lang/Class.h (Class): New constructor.
(Class): New copy constructor.
(initializePrim): New prototype.
(_Jv_PrimClass): Field removed.
* java/lang/Object.h (struct _JvObjectPrefix): New virtuals
nacd_1 and nacd_2 (for compatibility with the new C++ ABI.)
(class java::lang::Object): `finalize' moved up front.
* java/lang/natClass.cc
(isAssignableFrom): Turned outline.
(isInstance): Likewise.
(isInterface): Likewise, fixed indentation.
(initializePrim): New function.
(New C++ ABI compatibility patch:
http://sources.redhat.com/ml/java-patches/2001-q1/msg00065.html)
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@39032 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'libjava/prims.cc')
-rw-r--r-- | libjava/prims.cc | 66 |
1 files changed, 15 insertions, 51 deletions
diff --git a/libjava/prims.cc b/libjava/prims.cc index c4c7316dfce..415c82ce61d 100644 --- a/libjava/prims.cc +++ b/libjava/prims.cc @@ -1,6 +1,6 @@ // prims.cc - Code for core of runtime environment. -/* Copyright (C) 1998, 1999, 2000 Free Software Foundation +/* Copyright (C) 1998, 1999, 2000, 2001 Free Software Foundation This file is part of libgcj. @@ -510,57 +510,21 @@ _Jv_NewMultiArray (jclass array_type, jint dimensions, ...) -class _Jv_PrimClass : public java::lang::Class +// Initialize Class object for primitive types. The `return' statement +// does the actuall job. +static java::lang::Class +init_prim_class (jobject cname, jbyte sig, jint len, jobject array_vtable) { -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, jobject array_vtable) - { - using namespace java::lang::reflect; - - // We must initialize every field of the class. We do this in - // the same order they are declared in Class.h. - next = NULL; - name = _Jv_makeUtf8Const ((char *) cname, -1); - accflags = Modifier::PUBLIC | Modifier::FINAL | Modifier::ABSTRACT; - superclass = NULL; - constants.size = 0; - constants.tags = NULL; - constants.data = NULL; - methods = NULL; - method_count = sig; - vtable_method_count = 0; - fields = NULL; - size_in_bytes = len; - field_count = 0; - static_field_count = 0; - vtable = JV_PRIMITIVE_VTABLE; - interfaces = NULL; - loader = NULL; - interface_count = 0; - state = JV_STATE_DONE; - thread = NULL; - depth = -1; - ancestors = NULL; - idt = NULL; - - // Note that we have to set `methods' to NULL. - if (sig != 'V') - _Jv_NewArrayClass (this, NULL, (_Jv_VTable *) array_vtable); - else - arrayclass = NULL; - } -}; - -// 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_ArrayVTable _Jv_##NAME##VTable; \ - _Jv_PrimClass _Jv_##NAME##Class((jobject) #NAME, (jbyte) SIG, (jint) LEN, \ - (jobject) &_Jv_##NAME##VTable) + static java::lang::Class iclass; + iclass.initializePrim (cname, sig, len, array_vtable); + return iclass; +} + +#define DECLARE_PRIM_TYPE(NAME, SIG, LEN) \ + _Jv_ArrayVTable _Jv_##NAME##VTable; \ + java::lang::Class _Jv_##NAME##Class = \ + init_prim_class ((jobject) #NAME, (jbyte) SIG, \ + (jint) LEN, (jobject) &_Jv_##NAME##VTable); DECLARE_PRIM_TYPE(byte, 'B', 1); DECLARE_PRIM_TYPE(short, 'S', 2); |