OPT_VERBOSE1,
OPT_NOIEEE,
- OPT_SOFTNULL,
#if defined(ENABLE_STATISTICS)
OPT_TIME,
#if defined(__ALPHA__)
{ "noieee", false, OPT_NOIEEE },
#endif
- { "softnull", false, OPT_SOFTNULL },
#if defined(ENABLE_STATISTICS)
{ "time", false, OPT_TIME },
{ "stat", false, OPT_STAT },
#if defined(ENABLE_VERIFIER)
puts(" -noverify don't verify classfiles");
#endif
- puts(" -softnull use software nullpointer check");
#if defined(ENABLE_STATISTICS)
puts(" -time measure the runtime");
puts(" -stat detailed compiler statistics");
opt_version = false;
opt_exit = false;
- checknull = false;
opt_noieee = false;
opt_heapmaxsize = HEAP_MAXSIZE;
break;
#endif
- case OPT_SOFTNULL:
- checknull = true;
- break;
-
#if defined(ENABLE_STATISTICS)
case OPT_TIME:
opt_getcompilingtime = true;
/* AFTER: threads_preinit */
if (!string_init())
- throw_main_exception_exit();
+ vm_abort("vm_create: string_init failed");
/* AFTER: threads_preinit */
if (!utf8_init())
- throw_main_exception_exit();
+ vm_abort("vm_create: utf8_init failed");
/* AFTER: thread_preinit */
if (!suck_init())
- throw_main_exception_exit();
+ vm_abort("vm_create: suck_init failed");
suck_add_from_property("java.endorsed.dirs");
_Jv_bootclasspath pointer. */
if (!properties_postinit())
- vm_abort("properties_postinit failed");
+ vm_abort("vm_create: properties_postinit failed");
/* initialize the classcache hashtable stuff: lock, hashtable
(must be done _after_ threads_preinit) */
if (!classcache_init())
- throw_main_exception_exit();
+ vm_abort("vm_create: classcache_init failed");
/* initialize the memory subsystem (must be done _after_
threads_preinit) */
if (!memory_init())
- throw_main_exception_exit();
+ vm_abort("vm_create: memory_init failed");
/* initialize the finalizer stuff (must be done _after_
threads_preinit) */
if (!finalizer_init())
- throw_main_exception_exit();
+ vm_abort("vm_create: finalizer_init failed");
/* install architecture dependent signal handlers */
classcache_init) */
if (!loader_init())
- vm_abort("loader_init failed");
+ vm_abort("vm_create: loader_init failed");
if (!linker_init())
- vm_abort("linker_init failed");
+ vm_abort("vm_create: linker_init failed");
if (!native_init())
- throw_main_exception_exit();
+ vm_abort("vm_create: native_init failed");
if (!exceptions_init())
- throw_main_exception_exit();
+ vm_abort("vm_create: exceptions_init failed");
if (!builtin_init())
- throw_main_exception_exit();
+ vm_abort("vm_create: builtin_init failed");
#if defined(ENABLE_JNI)
/* Initialize the JNI subsystem (must be done _before_
(e.g. NewGlobalRef). */
if (!jni_init())
- throw_main_exception_exit();
+ vm_abort("vm_create: jni_init failed");
#endif
#if defined(ENABLE_THREADS)
if (!threads_init())
- throw_main_exception_exit();
+ vm_abort("vm_create: threads_init failed");
#endif
#if defined(ENABLE_PROFILING)
/* initialize profiling */
if (!profile_init())
- throw_main_exception_exit();
+ vm_abort("vm_create: profile_init failed");
#endif
#if defined(ENABLE_THREADS)
/* initialize recompilation */
if (!recompile_init())
- throw_main_exception_exit();
+ vm_abort("vm_create: recompile_init failed");
/* start the signal handler thread */
if (!signal_start_thread())
- throw_main_exception_exit();
+ vm_abort("vm_create: signal_start_thread failed");
/* finally, start the finalizer thread */
if (!finalizer_start_thread())
- throw_main_exception_exit();
+ vm_abort("vm_create: finalizer_start_thread failed");
# if !defined(NDEBUG)
/* start the memory profiling thread */
if (opt_verbosememory)
if (!memory_start_thread())
- throw_main_exception_exit();
+ vm_abort("vm_create: memory_start_thread failed");
# endif
/* start the recompilation thread (must be done before the
profiling thread) */
if (!recompile_start_thread())
- throw_main_exception_exit();
+ vm_abort("vm_create: recompile_start_thread failed");
# if defined(ENABLE_PROFILING)
/* start the profile sampling thread */
/* if (opt_prof) */
/* if (!profile_start_thread()) */
-/* throw_main_exception_exit(); */
+/* exceptions_print_stacktrace(); */
# endif
#endif
status = 0;
- if (opt_jar == true)
+ if (opt_jar == true) {
/* open jar file with java.util.jar.JarFile */
+
mainstring = vm_get_mainclass_from_jar(mainstring);
+ if (mainstring == NULL)
+ vm_exit(1);
+ }
+
/* load the main class */
mainutf = utf_new_char(mainstring);
/* error loading class */
- if ((exceptions_get_exception() != NULL) || (mainclass == NULL))
- throw_main_exception_exit();
+ if ((exceptions_get_exception() != NULL) || (mainclass == NULL)) {
+ exceptions_print_stacktrace();
+ vm_exit(1);
+ }
- if (!link_class(mainclass))
- throw_main_exception_exit();
+ if (!link_class(mainclass)) {
+ exceptions_print_stacktrace();
+ vm_exit(1);
+ }
/* find the `main' method of the main class */
class_java_lang_Object,
false);
- if (*exceptionptr) {
- throw_main_exception_exit();
+ if (exceptions_get_exception()) {
+ exceptions_print_stacktrace();
+ vm_exit(1);
}
/* there is no main method or it isn't static */
utf_new_char("main"),
utf_new_char("([Ljava/lang/String;)V"));
- throw_main_exception_exit();
+ exceptions_print_stacktrace();
+ vm_exit(1);
}
/* build argument array */
/* exception occurred? */
- if (*exceptionptr) {
- throw_main_exception();
+ if (exceptions_get_exception()) {
+ exceptions_print_stacktrace();
status = 1;
}
/* unload the JavaVM */
- vm_destroy(vm);
+ (void) vm_destroy(vm);
/* and exit */
}
#endif
- if (!link_class(class_java_lang_System))
- throw_main_exception_exit();
+ if (!link_class(class_java_lang_System)) {
+ exceptions_print_stacktrace();
+ exit(1);
+ }
/* call java.lang.System.exit(I)V */
class_java_lang_Object,
true);
- if (m == NULL)
- throw_main_exception_exit();
+ if (m == NULL) {
+ exceptions_print_stacktrace();
+ exit(1);
+ }
/* call the exit function with passed exit status */
c = load_class_from_sysloader(utf_new_char("java/util/jar/JarFile"));
- if (c == NULL)
- throw_main_exception_exit();
-
+ if (c == NULL) {
+ exceptions_print_stacktrace();
+ return NULL;
+ }
+
/* create JarFile object */
o = builtin_new(c);
- if (o == NULL)
- throw_main_exception_exit();
-
+ if (o == NULL) {
+ exceptions_print_stacktrace();
+ return NULL;
+ }
m = class_resolveclassmethod(c,
utf_init,
class_java_lang_Object,
true);
- if (m == NULL)
- throw_main_exception_exit();
+ if (m == NULL) {
+ exceptions_print_stacktrace();
+ return NULL;
+ }
s = javastring_new_from_ascii(mainstring);
(void) vm_call_method(m, o, s);
- if (*exceptionptr)
- throw_main_exception_exit();
+ if (exceptions_get_exception()) {
+ exceptions_print_stacktrace();
+ return NULL;
+ }
/* get manifest object */
class_java_lang_Object,
true);
- if (m == NULL)
- throw_main_exception_exit();
+ if (m == NULL) {
+ exceptions_print_stacktrace();
+ return NULL;
+ }
o = vm_call_method(m, o);
if (o == NULL) {
fprintf(stderr, "Could not get manifest from %s (invalid or corrupt jarfile?)\n", mainstring);
- vm_exit(1);
+ return NULL;
}
class_java_lang_Object,
true);
- if (m == NULL)
- throw_main_exception_exit();
+ if (m == NULL) {
+ exceptions_print_stacktrace();
+ return NULL;
+ }
o = vm_call_method(m, o);
if (o == NULL) {
fprintf(stderr, "Could not get main attributes from %s (invalid or corrupt jarfile?)\n", mainstring);
- vm_exit(1);
+ return NULL;
}
class_java_lang_Object,
true);
- if (m == NULL)
- throw_main_exception_exit();
+ if (m == NULL) {
+ exceptions_print_stacktrace();
+ return NULL;
+ }
s = javastring_new_from_ascii("Main-Class");
o = vm_call_method(m, o, s);
- if (o == NULL)
- throw_main_exception_exit();
+ if (o == NULL) {
+ exceptions_print_stacktrace();
+ return NULL;
+ }
return javastring_tochar(o);
}
/* create, load and link the main class */
- if (!(mainclass = load_class_bootstrap(utf_new_char(mainstring))))
- throw_main_exception_exit();
+ mainclass = load_class_bootstrap(utf_new_char(mainstring));
+
+ if (mainclass == NULL)
+ exceptions_print_stacktrace();
if (!link_class(mainclass))
- throw_main_exception_exit();
+ exceptions_print_stacktrace();
if (opt_signature != NULL) {
m = class_resolveclassmethod(mainclass,