changeset 3601:3822c5969a8b

better error messages for missing MAXINE env var and exceptions thrown by the compiler
author Lukas Stadler <lukas.stadler@jku.at>
date Tue, 25 Oct 2011 14:44:32 +0200
parents 707bc4847b00
children 400abf575c42 5e9645341ec3
files src/share/vm/graal/graalVMExits.hpp src/share/vm/runtime/arguments.cpp
diffstat 2 files changed, 42 insertions(+), 34 deletions(-) [+]
line wrap: on
line diff
--- a/src/share/vm/graal/graalVMExits.hpp	Thu Oct 20 17:25:50 2011 +0200
+++ b/src/share/vm/graal/graalVMExits.hpp	Tue Oct 25 14:44:32 2011 +0200
@@ -101,10 +101,17 @@
   if (THREAD->has_pending_exception()) {
     Handle exception = PENDING_EXCEPTION;
     CLEAR_PENDING_EXCEPTION;
-    tty->print_cr("%s", message);
-    java_lang_Throwable::print(exception, tty);
-    tty->cr();
-    java_lang_Throwable::print_stack_trace(exception(), tty);
+
+    assert(exception->is_a(SystemDictionary::Throwable_klass()), "Throwable instance expected");
+    JavaValue result(T_VOID);
+    JavaCalls::call_virtual(&result,
+                            exception,
+                            KlassHandle(THREAD,
+                            SystemDictionary::Throwable_klass()),
+                            vmSymbols::printStackTrace_name(),
+                            vmSymbols::void_method_signature(),
+                            THREAD);
+
     vm_abort(dump_core);
   }
 }
--- a/src/share/vm/runtime/arguments.cpp	Thu Oct 20 17:25:50 2011 +0200
+++ b/src/share/vm/runtime/arguments.cpp	Tue Oct 25 14:44:32 2011 +0200
@@ -2024,38 +2024,39 @@
     char maxine_dir[BUFFER_SIZE];
     char temp[BUFFER_SIZE];
     if (!os::getenv("MAXINE", maxine_dir, sizeof(maxine_dir))) {
-	  fatal("Must set MAXINE environment variable to a Maxine project directory.");
+      jio_fprintf(defaultStream::output_stream(), "Error while starting Graal VM: The MAXINE environment variable needs to point to a Maxine repository.\n");
+      vm_exit(0);
     }
     if (PrintVMOptions) tty->print_cr("MAXINE=%s", maxine_dir);
-	SysClassPath scp_compiler(Arguments::get_sysclasspath());
-    sprintf(temp, "%s/com.oracle.max.cri/bin", maxine_dir);
-    scp_compiler.add_prefix(temp);
-    sprintf(temp, "%s/com.oracle.max.criutils/bin", maxine_dir);
-    scp_compiler.add_prefix(temp);
-    sprintf(temp, "%s/com.oracle.max.base/bin", maxine_dir);
-    scp_compiler.add_prefix(temp);
-    sprintf(temp, "%s/com.oracle.max.asmdis/bin", maxine_dir);
-    scp_compiler.add_prefix(temp);
-    sprintf(temp, "%s/com.oracle.max.asm/bin", maxine_dir);
-    scp_compiler.add_prefix(temp);
-    sprintf(temp, "%s/com.oracle.max.graal.graph/bin", maxine_dir);
-    scp_compiler.add_prefix(temp);
-    sprintf(temp, "%s/com.oracle.max.graal.compiler/bin", maxine_dir);
-    scp_compiler.add_prefix(temp);
-    sprintf(temp, "%s/com.oracle.max.graal.nodes/bin", maxine_dir);
-    scp_compiler.add_prefix(temp);
-    sprintf(temp, "%s/com.oracle.max.graal.snippets/bin", maxine_dir);
-    scp_compiler.add_prefix(temp);
-    sprintf(temp, "%s/com.oracle.max.graal.criutils/bin", maxine_dir);
-    scp_compiler.add_prefix(temp);
-    sprintf(temp, "%s/com.oracle.max.graal.extensions/bin", maxine_dir);
-    scp_compiler.add_prefix(temp);
-    sprintf(temp, "%s/com.oracle.max.graal.hotspot/bin", maxine_dir);
-    scp_compiler.add_prefix(temp);
-    sprintf(temp, "%s/com.oracle.max.graal.graphviz/bin", maxine_dir);
-    scp_compiler.add_prefix(temp);
-	scp_compiler.expand_endorsed();
-	Arguments::set_compilerclasspath(scp_compiler.combined_path());
+      SysClassPath scp_compiler(Arguments::get_sysclasspath());
+      sprintf(temp, "%s/com.oracle.max.cri/bin", maxine_dir);
+      scp_compiler.add_prefix(temp);
+      sprintf(temp, "%s/com.oracle.max.criutils/bin", maxine_dir);
+      scp_compiler.add_prefix(temp);
+      sprintf(temp, "%s/com.oracle.max.base/bin", maxine_dir);
+      scp_compiler.add_prefix(temp);
+      sprintf(temp, "%s/com.oracle.max.asmdis/bin", maxine_dir);
+      scp_compiler.add_prefix(temp);
+      sprintf(temp, "%s/com.oracle.max.asm/bin", maxine_dir);
+      scp_compiler.add_prefix(temp);
+      sprintf(temp, "%s/com.oracle.max.graal.graph/bin", maxine_dir);
+      scp_compiler.add_prefix(temp);
+      sprintf(temp, "%s/com.oracle.max.graal.compiler/bin", maxine_dir);
+      scp_compiler.add_prefix(temp);
+      sprintf(temp, "%s/com.oracle.max.graal.nodes/bin", maxine_dir);
+      scp_compiler.add_prefix(temp);
+      sprintf(temp, "%s/com.oracle.max.graal.snippets/bin", maxine_dir);
+      scp_compiler.add_prefix(temp);
+      sprintf(temp, "%s/com.oracle.max.graal.criutils/bin", maxine_dir);
+      scp_compiler.add_prefix(temp);
+      sprintf(temp, "%s/com.oracle.max.graal.extensions/bin", maxine_dir);
+      scp_compiler.add_prefix(temp);
+      sprintf(temp, "%s/com.oracle.max.graal.hotspot/bin", maxine_dir);
+      scp_compiler.add_prefix(temp);
+      sprintf(temp, "%s/com.oracle.max.graal.graphviz/bin", maxine_dir);
+      scp_compiler.add_prefix(temp);
+      scp_compiler.expand_endorsed();
+      Arguments::set_compilerclasspath(scp_compiler.combined_path());
   }
 
   if (AggressiveOpts) {