comparison src/share/vm/prims/jvmtiExport.cpp @ 7469:0c8717a92b2d

8001341: SIGSEGV in methodOopDesc::fast_exception_handler_bci_for(KlassHandle,int,Thread*)+0x3e9. Summary: Use methodHandle. Reviewed-by: coleenp, acorn, twisti, sspitsyn
author jiangli
date Tue, 08 Jan 2013 13:01:19 -0500
parents 80e866b1d053
children 8b46b0196eb0 db9981fd3124
comparison
equal deleted inserted replaced
7468:608b2e8a0063 7469:0c8717a92b2d
1303 1303
1304 bool should_repeat; 1304 bool should_repeat;
1305 vframeStream st(thread); 1305 vframeStream st(thread);
1306 assert(!st.at_end(), "cannot be at end"); 1306 assert(!st.at_end(), "cannot be at end");
1307 Method* current_method = NULL; 1307 Method* current_method = NULL;
1308 // A GC may occur during the Method::fast_exception_handler_bci_for()
1309 // call below if it needs to load the constraint class. Using a
1310 // methodHandle to keep the 'current_method' from being deallocated
1311 // if GC happens.
1312 methodHandle current_mh = methodHandle(thread, current_method);
1308 int current_bci = -1; 1313 int current_bci = -1;
1309 do { 1314 do {
1310 current_method = st.method(); 1315 current_method = st.method();
1316 current_mh = methodHandle(thread, current_method);
1311 current_bci = st.bci(); 1317 current_bci = st.bci();
1312 do { 1318 do {
1313 should_repeat = false; 1319 should_repeat = false;
1314 KlassHandle eh_klass(thread, exception_handle()->klass()); 1320 KlassHandle eh_klass(thread, exception_handle()->klass());
1315 current_bci = current_method->fast_exception_handler_bci_for( 1321 current_bci = Method::fast_exception_handler_bci_for(
1316 eh_klass, current_bci, THREAD); 1322 current_mh, eh_klass, current_bci, THREAD);
1317 if (HAS_PENDING_EXCEPTION) { 1323 if (HAS_PENDING_EXCEPTION) {
1318 exception_handle = Handle(thread, PENDING_EXCEPTION); 1324 exception_handle = Handle(thread, PENDING_EXCEPTION);
1319 CLEAR_PENDING_EXCEPTION; 1325 CLEAR_PENDING_EXCEPTION;
1320 should_repeat = true; 1326 should_repeat = true;
1321 } 1327 }
1326 jmethodID catch_jmethodID; 1332 jmethodID catch_jmethodID;
1327 if (current_bci < 0) { 1333 if (current_bci < 0) {
1328 catch_jmethodID = 0; 1334 catch_jmethodID = 0;
1329 current_bci = 0; 1335 current_bci = 0;
1330 } else { 1336 } else {
1331 catch_jmethodID = jem.to_jmethodID( 1337 catch_jmethodID = jem.to_jmethodID(current_mh);
1332 methodHandle(thread, current_method));
1333 } 1338 }
1334 1339
1335 JvmtiJavaThreadEventTransition jet(thread); 1340 JvmtiJavaThreadEventTransition jet(thread);
1336 jvmtiEventException callback = env->callbacks()->Exception; 1341 jvmtiEventException callback = env->callbacks()->Exception;
1337 if (callback != NULL) { 1342 if (callback != NULL) {