diff options
Diffstat (limited to 'libjava/java/lang')
-rw-r--r-- | libjava/java/lang/Class.h | 1 | ||||
-rw-r--r-- | libjava/java/lang/natClassLoader.cc | 20 |
2 files changed, 18 insertions, 3 deletions
diff --git a/libjava/java/lang/Class.h b/libjava/java/lang/Class.h index dfef0a6..9d106c5 100644 --- a/libjava/java/lang/Class.h +++ b/libjava/java/lang/Class.h @@ -298,6 +298,7 @@ private: friend void _Jv_WaitForState (jclass, int); friend void _Jv_RegisterClasses (jclass *classes); + friend void _Jv_RegisterClassHookDefault (jclass klass); friend void _Jv_RegisterInitiatingLoader (jclass,java::lang::ClassLoader*); friend void _Jv_UnregisterClass (jclass); friend jclass _Jv_FindClass (_Jv_Utf8Const *name, diff --git a/libjava/java/lang/natClassLoader.cc b/libjava/java/lang/natClassLoader.cc index f0794c7..890a4a7 100644 --- a/libjava/java/lang/natClassLoader.cc +++ b/libjava/java/lang/natClassLoader.cc @@ -439,9 +439,8 @@ _Jv_RegisterClasses (jclass *classes) for (; *classes; ++classes) { jclass klass = *classes; - jint hash = HASH_UTF (klass->name); - klass->next = loaded_classes[hash]; - loaded_classes[hash] = klass; + + (*_Jv_RegisterClassHook) (klass); // registering a compiled class causes // it to be immediately "prepared". @@ -451,6 +450,21 @@ _Jv_RegisterClasses (jclass *classes) } void +_Jv_RegisterClassHookDefault (jclass klass) +{ + jint hash = HASH_UTF (klass->name); + klass->next = loaded_classes[hash]; + loaded_classes[hash] = klass; +} + +// A pointer to a function that actually registers a class. +// Normally _Jv_RegisterClassHookDefault, but could be some other function +// that registers the class in e.g. a ClassLoader-local table. +// Should synchronize on Class:class$ while setting/restore this variable. + +void (*_Jv_RegisterClassHook) (jclass cl) = _Jv_RegisterClassHookDefault; + +void _Jv_RegisterClass (jclass klass) { jclass classes[2]; |