diff options
| author | bryce <bryce@138bc75d-0d04-0410-961f-82ee72b054a4> | 2001-10-23 05:42:03 +0000 |
|---|---|---|
| committer | bryce <bryce@138bc75d-0d04-0410-961f-82ee72b054a4> | 2001-10-23 05:42:03 +0000 |
| commit | 5bac6719fb51efc5ae3ed6e1610ff50043183d05 (patch) | |
| tree | bf8ec1fbae17015b582311573e8b7f51bcecfd33 /libjava | |
| parent | 314f2422942f727134ce2052ad12cfa1efeea167 (diff) | |
| download | ppe42-gcc-5bac6719fb51efc5ae3ed6e1610ff50043183d05.tar.gz ppe42-gcc-5bac6719fb51efc5ae3ed6e1610ff50043183d05.zip | |
* prims.cc (_Jv_Abort): Always print error message using fprintf,
don't try to allocate.
(_Jv_CreateJavaVM): Set gcj::runTimeInitialized.
* include/jvm.h (gcj::runTimeInitialized): New variable declaration.
* java/lang/natClassLoader.cc (_Jv_RegisterClassHookDefault): Handle
duplicate class registration with JvFail if the runtime hasn't been
initialized yet.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@46424 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'libjava')
| -rw-r--r-- | libjava/ChangeLog | 10 | ||||
| -rw-r--r-- | libjava/include/jvm.h | 3 | ||||
| -rw-r--r-- | libjava/java/lang/natClassLoader.cc | 13 | ||||
| -rw-r--r-- | libjava/prims.cc | 13 |
4 files changed, 30 insertions, 9 deletions
diff --git a/libjava/ChangeLog b/libjava/ChangeLog index ba393cc9e69..8cb0dab502a 100644 --- a/libjava/ChangeLog +++ b/libjava/ChangeLog @@ -1,3 +1,13 @@ +2001-10-23 Bryce McKinlay <bryce@waitaki.otago.ac.nz> + + * prims.cc (_Jv_Abort): Always print error message using fprintf, + don't try to allocate. + (_Jv_CreateJavaVM): Set gcj::runTimeInitialized. + * include/jvm.h (gcj::runTimeInitialized): New variable declaration. + * java/lang/natClassLoader.cc (_Jv_RegisterClassHookDefault): Handle + duplicate class registration with JvFail if the runtime hasn't been + initialized yet. + 2001-10-22 Tom Tromey <tromey@redhat.com> * java/util/GregorianCalendar.java (getGregorianChange): Removed diff --git a/libjava/include/jvm.h b/libjava/include/jvm.h index bb54c8b58d8..858d960bf20 100644 --- a/libjava/include/jvm.h +++ b/libjava/include/jvm.h @@ -131,6 +131,9 @@ namespace gcj extern _Jv_Utf8Const *clinit_name; /* "<clinit>" */ extern _Jv_Utf8Const *init_name; /* "<init>" */ extern _Jv_Utf8Const *finit_name; /* "finit$", */ + + /* Set to true by _Jv_CreateJavaVM. */ + extern bool runtimeInitialized; }; /* Type of pointer used as finalizer. */ diff --git a/libjava/java/lang/natClassLoader.cc b/libjava/java/lang/natClassLoader.cc index 3c2679bd8b4..d92a90c8b8c 100644 --- a/libjava/java/lang/natClassLoader.cc +++ b/libjava/java/lang/natClassLoader.cc @@ -14,6 +14,7 @@ details. */ #include <stdlib.h> #include <string.h> +#include <stdio.h> #include <gcj/cni.h> #include <jvm.h> @@ -452,7 +453,17 @@ _Jv_RegisterClassHookDefault (jclass klass) { // If you get this, it means you have the same class in two // different libraries. - throw new java::lang::VirtualMachineError (JvNewStringLatin1 ("class registered twice")); + char *message; + asprintf (&message, "Duplicate class registration: %s", + klass->name->data); + if (! gcj::runtimeInitialized) + JvFail (message); + else + { + java::lang::String *str = JvNewStringLatin1 (message); + free (message); + throw new java::lang::VirtualMachineError (str); + } } check_class = check_class->next; diff --git a/libjava/prims.cc b/libjava/prims.cc index 7b3dd6c6a00..f2f2d6578a2 100644 --- a/libjava/prims.cc +++ b/libjava/prims.cc @@ -299,10 +299,7 @@ _Jv_Abort (const char *, const char *, int, const char *message) "libgcj failure: %s\n in function %s, file %s, line %d\n", message, function, file, line); #else - java::io::PrintStream *err = java::lang::System::err; - err->print(JvNewStringLatin1 ("libgcj failure: ")); - err->println(JvNewStringLatin1 (message)); - err->flush(); + fprintf (stderr, "libgcj failure: %s\n", message); #endif abort (); } @@ -872,6 +869,8 @@ namespace gcj _Jv_Utf8Const *clinit_name; _Jv_Utf8Const *init_name; _Jv_Utf8Const *finit_name; + + bool runtimeInitialized = false; } jint @@ -879,12 +878,10 @@ _Jv_CreateJavaVM (void* /*vm_args*/) { using namespace gcj; - static bool init = false; - - if (init) + if (runtimeInitialized) return -1; - init = true; + runtimeInitialized = true; PROCESS_GCJ_PROPERTIES; |

