aboutsummaryrefslogtreecommitdiff
path: root/libjava/java/lang/Class.h
diff options
context:
space:
mode:
authorBryce McKinlay <bryce@albatross.co.nz>2001-01-08 23:28:56 +0000
committerBryce McKinlay <bryce@gcc.gnu.org>2001-01-08 23:28:56 +0000
commit5bb11b2e20b893361704d444fcf3a02de7f0bc89 (patch)
treebe919e8f9daa4b9caa6045e085c18aa82e8c4a09 /libjava/java/lang/Class.h
parent5bab9296f5a87f0bf7c8785b87d92db9a3b5ecf9 (diff)
downloadgcc-5bb11b2e20b893361704d444fcf3a02de7f0bc89.zip
gcc-5bb11b2e20b893361704d444fcf3a02de7f0bc89.tar.gz
gcc-5bb11b2e20b893361704d444fcf3a02de7f0bc89.tar.bz2
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. From-SVN: r38808
Diffstat (limited to 'libjava/java/lang/Class.h')
-rw-r--r--libjava/java/lang/Class.h23
1 files changed, 17 insertions, 6 deletions
diff --git a/libjava/java/lang/Class.h b/libjava/java/lang/Class.h
index edaebb3..12e3ed5 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__ */