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
This commit is contained in:
parent
5bab9296f5
commit
5bb11b2e20
11 changed files with 174 additions and 94 deletions
|
@ -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__ */
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue