diff src/share/vm/graal/graalVMEntries.cpp @ 3618:e82da3a1bbc9

Fix crash in branch prediction if there's no current environment.
author Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
date Sat, 05 Nov 2011 16:14:56 +0100
parents 1692a2f9bfc5
children 75e92277ad05
line wrap: on
line diff
--- a/src/share/vm/graal/graalVMEntries.cpp	Thu Nov 03 05:23:03 2011 +0100
+++ b/src/share/vm/graal/graalVMEntries.cpp	Sat Nov 05 16:14:56 2011 +0100
@@ -333,9 +333,16 @@
   ciMethod* cimethod;
   {
     VM_ENTRY_MARK;
+    assert(hotspot_method != NULL, "must not be null");
     methodOop method = getMethodFromHotSpotMethod(hotspot_method);
+    assert(method != NULL, "method not found");
+    if (CURRENT_ENV == NULL) {
+      return -1;
+    }
+    assert(CURRENT_ENV != NULL, "current environment must be present");
     cimethod = (ciMethod*)CURRENT_ENV->get_object(method);
   }
+  assert(cimethod != NULL, "cimethod not found");
   method_data = cimethod->method_data();
 
   jfloat probability = -1;
@@ -774,6 +781,7 @@
 JNIEXPORT jboolean JNICALL Java_com_oracle_graal_hotspot_VMEntries_RiType_1isInitialized(JNIEnv *, jobject, jobject hotspot_klass) {
   TRACE_graal_3("VMEntries::RiType_isInitialized");
   klassOop klass = java_lang_Class::as_klassOop(HotSpotTypeResolved::javaMirror(hotspot_klass));
+  assert(klass != NULL, "method must not be called for primitive types");
   return instanceKlass::cast(klass)->is_initialized();
 }