diff options
author | tromey <tromey@138bc75d-0d04-0410-961f-82ee72b054a4> | 2005-05-12 01:27:15 +0000 |
---|---|---|
committer | tromey <tromey@138bc75d-0d04-0410-961f-82ee72b054a4> | 2005-05-12 01:27:15 +0000 |
commit | fffadcfa2f45575f6a4f5d68fb8f7c3ef732d794 (patch) | |
tree | 9f39fff82022b1ead94d585a390edb4a4f526870 /libjava | |
parent | 9508132a0f3d625ed0b5e8fc2f4f65faa18d2160 (diff) | |
download | gcc-fffadcfa2f45575f6a4f5d68fb8f7c3ef732d794.tar.gz |
gcc/java:
* gcj.texi (Code Generation): Document -fbootstrap-classes.
* decl.c (GCJ_BOOTSTRAP_LOADER_ADDITION): New macro.
(parse_version): Use it.
* lang.opt (-fbootstrap-classes): New option.
libjava:
* external/w3c_dom/Makefile.in: Rebuilt.
* external/w3c_dom/Makefile.am (libw3c_gcj_la_GCJFLAGS): Added
-fbootstrap-classes.
* external/sax/Makefile.in: Rebuilt.
* external/sax/Makefile.am (libsax_gcj_la_GCJFLAGS): Added
-fbootstrap-classes.
* java/lang/Class.h (_Jv_CopyClassesToSystemLoader): Declare as
friend.
* java/lang/natVMClassLoader.cc (getSystemClassLoaderInternal):
Call _Jv_CopyClassesToSystemLoader.
* java/lang/natClassLoader.cc (system_class_list): New global.
(_Jv_RegisterClassHookDefault): Handle bootstrap and system
classes differently.
(_Jv_CopyClassesToSystemLoader): New function.
(SYSTEM_LOADER_INITIALIZED): New define.
* include/jvm.h (GCJ_BOOTSTRAP_LOADER_ADDITION): New define.
(_Jv_CheckABIVersion): Use it.
(_Jv_ClassForBootstrapLoader): New function.
* Makefile.in: Rebuilt.
* Makefile.am (AM_GCJFLAGS): Added -fbootstrap-classes.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@99604 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'libjava')
-rw-r--r-- | libjava/ChangeLog | 23 | ||||
-rw-r--r-- | libjava/Makefile.am | 2 | ||||
-rw-r--r-- | libjava/Makefile.in | 2 | ||||
-rw-r--r-- | libjava/external/sax/Makefile.am | 2 | ||||
-rw-r--r-- | libjava/external/sax/Makefile.in | 2 | ||||
-rw-r--r-- | libjava/external/w3c_dom/Makefile.am | 2 | ||||
-rw-r--r-- | libjava/external/w3c_dom/Makefile.in | 2 | ||||
-rw-r--r-- | libjava/include/jvm.h | 15 | ||||
-rw-r--r-- | libjava/java/lang/Class.h | 4 | ||||
-rw-r--r-- | libjava/java/lang/natClassLoader.cc | 43 | ||||
-rw-r--r-- | libjava/java/lang/natVMClassLoader.cc | 1 |
11 files changed, 86 insertions, 12 deletions
diff --git a/libjava/ChangeLog b/libjava/ChangeLog index 1ba485b91b2..9fdb8ade7b3 100644 --- a/libjava/ChangeLog +++ b/libjava/ChangeLog @@ -1,3 +1,26 @@ +2005-05-11 Tom Tromey <tromey@redhat.com> + + * external/w3c_dom/Makefile.in: Rebuilt. + * external/w3c_dom/Makefile.am (libw3c_gcj_la_GCJFLAGS): Added + -fbootstrap-classes. + * external/sax/Makefile.in: Rebuilt. + * external/sax/Makefile.am (libsax_gcj_la_GCJFLAGS): Added + -fbootstrap-classes. + * java/lang/Class.h (_Jv_CopyClassesToSystemLoader): Declare as + friend. + * java/lang/natVMClassLoader.cc (getSystemClassLoaderInternal): + Call _Jv_CopyClassesToSystemLoader. + * java/lang/natClassLoader.cc (system_class_list): New global. + (_Jv_RegisterClassHookDefault): Handle bootstrap and system + classes differently. + (_Jv_CopyClassesToSystemLoader): New function. + (SYSTEM_LOADER_INITIALIZED): New define. + * include/jvm.h (GCJ_BOOTSTRAP_LOADER_ADDITION): New define. + (_Jv_CheckABIVersion): Use it. + (_Jv_ClassForBootstrapLoader): New function. + * Makefile.in: Rebuilt. + * Makefile.am (AM_GCJFLAGS): Added -fbootstrap-classes. + 2005-05-10 Tom Tromey <tromey@redhat.com> * gcj/javaprims.h: Updated. diff --git a/libjava/Makefile.am b/libjava/Makefile.am index 124bfe23a6b..a17f7cce2bf 100644 --- a/libjava/Makefile.am +++ b/libjava/Makefile.am @@ -204,7 +204,7 @@ AM_GCJFLAGS = \ @LIBGCJ_JAVAFLAGS@ \ -fclasspath= -fbootclasspath=$(BOOTCLASSPATH) \ --encoding=UTF-8 \ - -Wno-deprecated + -Wno-deprecated -fbootstrap-classes if USING_GCC AM_CFLAGS = @LIBGCJ_CFLAGS@ $(WARNINGS) diff --git a/libjava/Makefile.in b/libjava/Makefile.in index 966dab73a98..b5c0fdd9e4f 100644 --- a/libjava/Makefile.in +++ b/libjava/Makefile.in @@ -4634,7 +4634,7 @@ AM_GCJFLAGS = \ @LIBGCJ_JAVAFLAGS@ \ -fclasspath= -fbootclasspath=$(BOOTCLASSPATH) \ --encoding=UTF-8 \ - -Wno-deprecated + -Wno-deprecated -fbootstrap-classes @USING_GCC_FALSE@AM_CFLAGS = @LIBGCJ_CFLAGS@ @USING_GCC_TRUE@AM_CFLAGS = @LIBGCJ_CFLAGS@ $(WARNINGS) diff --git a/libjava/external/sax/Makefile.am b/libjava/external/sax/Makefile.am index 2d93a90532f..08b82e5b826 100644 --- a/libjava/external/sax/Makefile.am +++ b/libjava/external/sax/Makefile.am @@ -35,7 +35,7 @@ mostlyclean-local: noinst_LTLIBRARIES = libsax-gcj.la libsax_gcj_la_SOURCES = sax.jar -libsax_gcj_la_GCJFLAGS = -findirect-dispatch $(AM_GCJFLAGS) +libsax_gcj_la_GCJFLAGS = -findirect-dispatch -fbootstrap-classes $(AM_GCJFLAGS) source_files = \ org/xml/sax/SAXNotSupportedException.java \ diff --git a/libjava/external/sax/Makefile.in b/libjava/external/sax/Makefile.in index a89121728dc..76ce4436f66 100644 --- a/libjava/external/sax/Makefile.in +++ b/libjava/external/sax/Makefile.in @@ -314,7 +314,7 @@ AM_GCJFLAGS = \ BUILT_SOURCES = classes.stamp noinst_LTLIBRARIES = libsax-gcj.la libsax_gcj_la_SOURCES = sax.jar -libsax_gcj_la_GCJFLAGS = -findirect-dispatch $(AM_GCJFLAGS) +libsax_gcj_la_GCJFLAGS = -findirect-dispatch -fbootstrap-classes $(AM_GCJFLAGS) source_files = \ org/xml/sax/SAXNotSupportedException.java \ org/xml/sax/helpers/NamespaceSupport.java \ diff --git a/libjava/external/w3c_dom/Makefile.am b/libjava/external/w3c_dom/Makefile.am index b7ec429794c..82f6b76a0b2 100644 --- a/libjava/external/w3c_dom/Makefile.am +++ b/libjava/external/w3c_dom/Makefile.am @@ -35,7 +35,7 @@ mostlyclean-local: noinst_LTLIBRARIES = libw3c-gcj.la libw3c_gcj_la_SOURCES = w3c.jar -libw3c_gcj_la_GCJFLAGS = -findirect-dispatch $(AM_GCJFLAGS) +libw3c_gcj_la_GCJFLAGS = -findirect-dispatch -fbootstrap-classes $(AM_GCJFLAGS) source_files = \ org/w3c/dom/xpath/XPathNamespace.java \ diff --git a/libjava/external/w3c_dom/Makefile.in b/libjava/external/w3c_dom/Makefile.in index e2e445b4327..4f577409863 100644 --- a/libjava/external/w3c_dom/Makefile.in +++ b/libjava/external/w3c_dom/Makefile.in @@ -314,7 +314,7 @@ AM_GCJFLAGS = \ BUILT_SOURCES = classes.stamp noinst_LTLIBRARIES = libw3c-gcj.la libw3c_gcj_la_SOURCES = w3c.jar -libw3c_gcj_la_GCJFLAGS = -findirect-dispatch $(AM_GCJFLAGS) +libw3c_gcj_la_GCJFLAGS = -findirect-dispatch -fbootstrap-classes $(AM_GCJFLAGS) source_files = \ org/w3c/dom/xpath/XPathNamespace.java \ org/w3c/dom/xpath/XPathResult.java \ diff --git a/libjava/include/jvm.h b/libjava/include/jvm.h index 90b61627f3d..6b978f906e4 100644 --- a/libjava/include/jvm.h +++ b/libjava/include/jvm.h @@ -565,6 +565,7 @@ extern void _Jv_RegisterBootstrapPackages (); // This is used to find ABI versions we recognize. #define GCJ_VERSION (__GNUC__ * 10000 + __GNUC_MINOR__ * 10) #define GCJ_BINARYCOMPAT_ADDITION 5 +#define GCJ_BOOTSTRAP_LOADER_ADDITION 1 // At present we know we are compatible with the BC ABI as used in GCC // 4.0. @@ -573,10 +574,18 @@ extern void _Jv_RegisterBootstrapPackages (); inline bool _Jv_CheckABIVersion (unsigned long value) { - // Recognize our defined C++ ABI. + // Recognize our defined C++ ABIs. return (value == GCJ_VERSION - // At the moment this is the only BC ABI we recognize. - || value == GCJ_40_BC_ABI_VERSION); + || value == (GCJ_VERSION + GCJ_BOOTSTRAP_LOADER_ADDITION) + || value == GCJ_40_BC_ABI_VERSION + || value == (GCJ_40_BC_ABI_VERSION + GCJ_BOOTSTRAP_LOADER_ADDITION)); +} + +inline bool +_Jv_ClassForBootstrapLoader (unsigned long value) +{ + return (value == (GCJ_VERSION + GCJ_BOOTSTRAP_LOADER_ADDITION) + || value == (GCJ_40_BC_ABI_VERSION + GCJ_BOOTSTRAP_LOADER_ADDITION)); } // It makes the source cleaner if we simply always define this diff --git a/libjava/java/lang/Class.h b/libjava/java/lang/Class.h index 854856066ed..28721d71daa 100644 --- a/libjava/java/lang/Class.h +++ b/libjava/java/lang/Class.h @@ -236,6 +236,8 @@ jclass _Jv_GetArrayClass (jclass klass, java::lang::ClassLoader *loader); jboolean _Jv_IsInterpretedClass (jclass); +void _Jv_CopyClassesToSystemLoader (java::lang::ClassLoader *); + #ifdef INTERPRETER void _Jv_InitField (jobject, jclass, int); @@ -494,6 +496,8 @@ private: friend void *::_Jv_ResolvePoolEntry (jclass this_class, jint index); + friend void ::_Jv_CopyClassesToSystemLoader (java::lang::ClassLoader *); + // Chain for class pool. This also doubles as the ABI version // number. It is only used for this purpose at class registration // time, and only for precompiled classes. diff --git a/libjava/java/lang/natClassLoader.cc b/libjava/java/lang/natClassLoader.cc index ed43b7aeb8b..2fa3f49ef1b 100644 --- a/libjava/java/lang/natClassLoader.cc +++ b/libjava/java/lang/natClassLoader.cc @@ -52,6 +52,15 @@ details. */ static jclass loaded_classes[HASH_LEN]; +// This records classes which will be registered with the system class +// loader when it is initialized. +static jclass system_class_list; + +// This is used as the value of system_class_list after we have +// initialized the system class loader; it lets us know that we should +// no longer pay attention to the system abi flag. +#define SYSTEM_LOADER_INITIALIZED ((jclass) -1) + // This is the root of a linked list of classes static jclass stack_head; @@ -165,6 +174,22 @@ _Jv_RegisterClasses_Counted (const jclass * classes, size_t count) void _Jv_RegisterClassHookDefault (jclass klass) { + // This is bogus, but there doesn't seem to be a better place to do + // it. + if (! klass->engine) + klass->engine = &_Jv_soleCompiledEngine; + + if (system_class_list != SYSTEM_LOADER_INITIALIZED) + { + unsigned long abi = (unsigned long) klass->next_or_version; + if (! _Jv_ClassForBootstrapLoader (abi)) + { + klass->next_or_version = system_class_list; + system_class_list = klass; + return; + } + } + jint hash = HASH_UTF (klass->name); // If the class is already registered, don't re-register it. @@ -193,9 +218,6 @@ _Jv_RegisterClassHookDefault (jclass klass) } } - // FIXME: this is really bogus! - if (! klass->engine) - klass->engine = &_Jv_soleCompiledEngine; klass->next_or_version = loaded_classes[hash]; loaded_classes[hash] = klass; } @@ -216,6 +238,21 @@ _Jv_RegisterClass (jclass klass) _Jv_RegisterClasses (classes); } +// This is used during initialization to register all compiled-in +// classes that are not part of the core with the system class loader. +void +_Jv_CopyClassesToSystemLoader (java::lang::ClassLoader *loader) +{ + for (jclass klass = system_class_list; + klass; + klass = klass->next_or_version) + { + klass->loader = loader; + loader->loadedClasses->put(klass->name->toString(), klass); + } + system_class_list = SYSTEM_LOADER_INITIALIZED; +} + jclass _Jv_FindClass (_Jv_Utf8Const *name, java::lang::ClassLoader *loader) { diff --git a/libjava/java/lang/natVMClassLoader.cc b/libjava/java/lang/natVMClassLoader.cc index a94bf98eb99..2e7b90da789 100644 --- a/libjava/java/lang/natVMClassLoader.cc +++ b/libjava/java/lang/natVMClassLoader.cc @@ -99,6 +99,7 @@ java::lang::ClassLoader * java::lang::VMClassLoader::getSystemClassLoaderInternal() { _Jv_InitClass (&gnu::gcj::runtime::ExtensionClassLoader::class$); + _Jv_CopyClassesToSystemLoader (gnu::gcj::runtime::ExtensionClassLoader::system_instance); return gnu::gcj::runtime::ExtensionClassLoader::system_instance; } |