changeset 22779:b41377216cf9

JVMCICompiler.compileMethod should always return non-null
author Tom Rodriguez <tom.rodriguez@oracle.com>
date Tue, 19 Jan 2016 13:32:31 -0800
parents 215f448ed1d7
children b4ff1a18d19c
files jvmci/jdk.vm.ci.hotspot/src/jdk/vm/ci/hotspot/HotSpotJVMCIRuntime.java src/share/vm/jvmci/jvmciCompiler.cpp
diffstat 2 files changed, 6 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/jvmci/jdk.vm.ci.hotspot/src/jdk/vm/ci/hotspot/HotSpotJVMCIRuntime.java	Tue Jan 19 11:07:20 2016 -0800
+++ b/jvmci/jdk.vm.ci.hotspot/src/jdk/vm/ci/hotspot/HotSpotJVMCIRuntime.java	Tue Jan 19 13:32:31 2016 -0800
@@ -243,7 +243,9 @@
      */
     @SuppressWarnings({"unused"})
     private CompilationRequestResult compileMethod(HotSpotResolvedJavaMethod method, int entryBCI, long jvmciEnv, int id) {
-        return getCompiler().compileMethod(new HotSpotCompilationRequest(method, entryBCI, jvmciEnv, id));
+        CompilationRequestResult result = getCompiler().compileMethod(new HotSpotCompilationRequest(method, entryBCI, jvmciEnv, id));
+        assert result != null : "compileMethod must always return something";
+        return result;
     }
 
     /**
--- a/src/share/vm/jvmci/jvmciCompiler.cpp	Tue Jan 19 11:07:20 2016 -0800
+++ b/src/share/vm/jvmci/jvmciCompiler.cpp	Tue Jan 19 13:32:31 2016 -0800
@@ -166,7 +166,7 @@
     if (result_object != NULL) {
       oop failure_message = CompilationRequestResult::failureMessage(result_object);
       if (failure_message != NULL) {
-        const char* failure_reason = failure_message != NULL ? java_lang_String::as_utf8_string(failure_message) : "unknown reason";
+        const char* failure_reason = java_lang_String::as_utf8_string(failure_message);
         env->set_failure(failure_reason, CompilationRequestResult::retry(result_object));
       } else {
         if (env->task()->code() == NULL) {
@@ -176,6 +176,8 @@
           _methodsCompiled++;
         }
       }
+    } else {
+      assert(false, "JVMCICompiler.compileMethod should always return non-null");
     }
   }
 }