diff options
| author | bryce <bryce@138bc75d-0d04-0410-961f-82ee72b054a4> | 2001-01-08 23:28:56 +0000 |
|---|---|---|
| committer | bryce <bryce@138bc75d-0d04-0410-961f-82ee72b054a4> | 2001-01-08 23:28:56 +0000 |
| commit | 9007522bf97494be0eb119dc7a5daa5207755acf (patch) | |
| tree | be919e8f9daa4b9caa6045e085c18aa82e8c4a09 /libjava/java/lang/Class.h | |
| parent | 1ca75808120df5bb57e654e0dd4c5c097468b56e (diff) | |
| download | ppe42-gcc-9007522bf97494be0eb119dc7a5daa5207755acf.tar.gz ppe42-gcc-9007522bf97494be0eb119dc7a5daa5207755acf.zip | |
In gcc/java:
* class.c (make_class_data): Push initial value for "arrayclass".
* decl.c (init_decl_processing): Add new class field "arrayclass".
In libjava:
* java/lang/Class.h (_Jv_InitClass): Use __builtin_expect.
(_Jv_NewArrayClass): Renamed from _Jv_FindArrayClass.
(_Jv_GetArrayClass): New inline function.
(arrayclass): New field.
* prims.cc (_Jv_NewObjectArray): Use _Jv_GetArrayClass. Don't use
_Jv_GetArrayElementFromElementType.
(_Jv_NewPrimArray): Ditto.
(_Jv_PrimClass constructor): Initialize "depth", "ancestors", and
"idt" for completeness. Initialze "arrayclass" using _Jv_NewArrayClass.
Set Modifier::ABSTRACT.
* java/lang/natClassLoader.cc (_Jv_NewClass): Initialize "arrayclass".
(_Jv_NewArrayClass): Renamed from _Jv_FindArrayClass. Now void.
Now synchronized. Array classes are now referenced from
elementClass->arrayclass. Don't use _Jv_FindClassInCache.
Set array classes' accessibility flags correctly. Optimize so that
all array classes share the same IDT.
* java/lang/reflect/natArray.cc (newInstance): Use _Jv_GetArrayClass.
* java/lang/reflect/natMethod.cc (_Jv_GetTypesFromSignature): Ditto.
* java/lang/natClass.cc (_getFields): Increment offset. Prevent fields
in superclasses from overwriting classes own fields.
(_Jv_IsAssignableFrom): Check for NULL source idt instead of calling
Modifier::isAbstract().
(null_idt): New static field.
(_Jv_PrepareConstantTimeTables): Optimize case where class implements
no interfaces.
(_Jv_IndexOf): Made inline.
* boehm.cc (_Jv_MarkObj): Mark "arrayclass" field.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@38808 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'libjava/java/lang/Class.h')
| -rw-r--r-- | libjava/java/lang/Class.h | 23 |
1 files changed, 17 insertions, 6 deletions
diff --git a/libjava/java/lang/Class.h b/libjava/java/lang/Class.h index edaebb3245a..12e3ed5838f 100644 --- a/libjava/java/lang/Class.h +++ b/libjava/java/lang/Class.h @@ -210,7 +210,7 @@ private: inline friend void _Jv_InitClass (jclass klass) { - if (klass->state == JV_STATE_DONE) + if (__builtin_expect (klass->state == JV_STATE_DONE, true)) return; klass->initializeClass (); } @@ -254,9 +254,9 @@ private: java::lang::ClassLoader *loader); friend jclass _Jv_FindClassInCache (_Jv_Utf8Const *name, java::lang::ClassLoader *loader); - friend jclass _Jv_FindArrayClass (jclass element, - java::lang::ClassLoader *loader, - _Jv_VTable *array_vtable = 0); + friend void _Jv_NewArrayClass (jclass element, + java::lang::ClassLoader *loader, + _Jv_VTable *array_vtable = 0); friend jclass _Jv_NewClass (_Jv_Utf8Const *name, jclass superclass, java::lang::ClassLoader *loader); @@ -268,6 +268,16 @@ private: friend jshort _Jv_AppendPartialITable (jclass, jclass, void **, jshort); friend jshort _Jv_FindIIndex (jclass *, jshort *, jshort); + // Return array class corresponding to element type KLASS, creating it if + // neccessary. + inline friend jclass + _Jv_GetArrayClass (jclass klass, java::lang::ClassLoader *loader) + { + if (__builtin_expect (!klass->arrayclass, false)) + _Jv_NewArrayClass (klass, loader); + return klass->arrayclass; + } + #ifdef INTERPRETER friend jboolean _Jv_IsInterpretedClass (jclass); friend void _Jv_InitField (jobject, jclass, _Jv_Field*); @@ -302,8 +312,7 @@ private: // Class constants. _Jv_Constants constants; // Methods. If this is an array class, then this field holds a - // pointer to the element type. If this is a primitive class, this - // is used to cache a pointer to the appropriate array type. + // pointer to the element type. _Jv_Method *methods; // Number of methods. If this class is primitive, this holds the // character used to represent this type in a signature. @@ -337,6 +346,8 @@ private: jclass *ancestors; // Interface Dispatch Table. _Jv_IDispatchTable *idt; + // Pointer to the class that represents an array of this class. + jclass arrayclass; }; #endif /* __JAVA_LANG_CLASS_H__ */ |

