< prev index next >

src/share/vm/jvmci/jvmciCompiler.cpp

Print this page

        

@@ -55,10 +55,14 @@
   // stop the VM deferring compilation now.
   CompilationPolicy::completed_vm_startup();
 }
 
 void JVMCICompiler::bootstrap() {
+  if (Arguments::mode() == Arguments::_int) {
+    // Nothing to do in -Xint mode
+    return;
+  }
 #ifndef PRODUCT
   // We turn off CompileTheWorld so that compilation requests are not
   // ignored during bootstrap or that JVMCI can be compiled by C1/C2.
   FlagSetting ctwOff(CompileTheWorld, false);
 #endif

@@ -123,34 +127,59 @@
   HandleMark hm;
   ResourceMark rm;
   Handle receiver = JVMCIRuntime::get_HotSpotJVMCIRuntime(CHECK_ABORT);
 
   JavaValue method_result(T_OBJECT);
-  {
     JavaCallArguments args;
     args.push_long((jlong) (address) method());
-    JavaCalls::call_static(&method_result, SystemDictionary::HotSpotResolvedJavaMethodImpl_klass(), vmSymbols::fromMetaspace_name(), vmSymbols::method_fromMetaspace_signature(), &args, CHECK_ABORT);
-  }
+  JavaCalls::call_static(&method_result, SystemDictionary::HotSpotResolvedJavaMethodImpl_klass(),
+                         vmSymbols::fromMetaspace_name(), vmSymbols::method_fromMetaspace_signature(), &args, THREAD);
 
+  if (!HAS_PENDING_EXCEPTION) {
   JavaValue result(T_VOID);
   JavaCallArguments args;
   args.push_oop(receiver);
   args.push_oop((oop)method_result.get_jobject());
   args.push_int(entry_bci);
   args.push_long((jlong) (address) env);
   args.push_int(env->task()->compile_id());
-  JavaCalls::call_special(&result, receiver->klass(), vmSymbols::compileMethod_name(), vmSymbols::compileMethod_signature(), &args, CHECK_ABORT);
+    JavaCalls::call_special(&result, receiver->klass(),
+                            vmSymbols::compileMethod_name(), vmSymbols::compileMethod_signature(), &args, THREAD);
+  }
+
+  // An uncaught exception was thrown during compilation.  Generally these
+  // should be handled by the Java code in some useful way but if they leak
+  // through to here report them instead of dying or silently ignoring them.
+  if (HAS_PENDING_EXCEPTION) {
+    Handle throwable = PENDING_EXCEPTION;
+    CLEAR_PENDING_EXCEPTION;
 
+    JVMCIRuntime::call_printStackTrace(throwable, THREAD);
+    if (HAS_PENDING_EXCEPTION) {
+      CLEAR_PENDING_EXCEPTION;
+    }
+
+    // Something went wrong so disable compilation at this level
+    method->set_not_compilable(CompLevel_full_optimization);
+  } else {
   _methodsCompiled++;
+  }
 }
 
 
 // Compilation entry point for methods
 void JVMCICompiler::compile_method(ciEnv* env, ciMethod* target, int entry_bci, DirectiveSet* directive) {
   ShouldNotReachHere();
 }
 
+bool JVMCICompiler::is_trivial(Method* method) {
+  if (_bootstrapping) {
+    return false;
+  }
+  return JVMCIRuntime::treat_as_trivial(method);
+}
+
 // Print compilation timers and statistics
 void JVMCICompiler::print_timers() {
   print_compilation_timers();
 }
 
< prev index next >