comparison 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
comparison
equal deleted inserted replaced
3617:b3176fb1934e 3618:e82da3a1bbc9
331 TRACE_graal_3("VMEntries::RiMethod_typeProfile"); 331 TRACE_graal_3("VMEntries::RiMethod_typeProfile");
332 ciMethodData* method_data; 332 ciMethodData* method_data;
333 ciMethod* cimethod; 333 ciMethod* cimethod;
334 { 334 {
335 VM_ENTRY_MARK; 335 VM_ENTRY_MARK;
336 assert(hotspot_method != NULL, "must not be null");
336 methodOop method = getMethodFromHotSpotMethod(hotspot_method); 337 methodOop method = getMethodFromHotSpotMethod(hotspot_method);
338 assert(method != NULL, "method not found");
339 if (CURRENT_ENV == NULL) {
340 return -1;
341 }
342 assert(CURRENT_ENV != NULL, "current environment must be present");
337 cimethod = (ciMethod*)CURRENT_ENV->get_object(method); 343 cimethod = (ciMethod*)CURRENT_ENV->get_object(method);
338 } 344 }
345 assert(cimethod != NULL, "cimethod not found");
339 method_data = cimethod->method_data(); 346 method_data = cimethod->method_data();
340 347
341 jfloat probability = -1; 348 jfloat probability = -1;
342 349
343 if (method_data == NULL || !method_data->is_mature()) return -1; 350 if (method_data == NULL || !method_data->is_mature()) return -1;
772 779
773 // public bool RiType_isInitialized(HotSpotResolvedType klass); 780 // public bool RiType_isInitialized(HotSpotResolvedType klass);
774 JNIEXPORT jboolean JNICALL Java_com_oracle_graal_hotspot_VMEntries_RiType_1isInitialized(JNIEnv *, jobject, jobject hotspot_klass) { 781 JNIEXPORT jboolean JNICALL Java_com_oracle_graal_hotspot_VMEntries_RiType_1isInitialized(JNIEnv *, jobject, jobject hotspot_klass) {
775 TRACE_graal_3("VMEntries::RiType_isInitialized"); 782 TRACE_graal_3("VMEntries::RiType_isInitialized");
776 klassOop klass = java_lang_Class::as_klassOop(HotSpotTypeResolved::javaMirror(hotspot_klass)); 783 klassOop klass = java_lang_Class::as_klassOop(HotSpotTypeResolved::javaMirror(hotspot_klass));
784 assert(klass != NULL, "method must not be called for primitive types");
777 return instanceKlass::cast(klass)->is_initialized(); 785 return instanceKlass::cast(klass)->is_initialized();
778 } 786 }
779 787
780 // public RiType RiType_arrayOf(HotSpotTypeResolved klass); 788 // public RiType RiType_arrayOf(HotSpotTypeResolved klass);
781 JNIEXPORT jobject JNICALL Java_com_oracle_graal_hotspot_VMEntries_RiType_1arrayOf(JNIEnv *, jobject, jobject klass) { 789 JNIEXPORT jobject JNICALL Java_com_oracle_graal_hotspot_VMEntries_RiType_1arrayOf(JNIEnv *, jobject, jobject klass) {