comparison src/share/vm/code/nmethod.cpp @ 9023:f94bb5d20e5d

Rename MethodInvalidatedException to InvalidInstalledCodeException (and make it a checked exception). Make sure that a compiled code object can always be directly called without first doing a check on the native method pointer.
author Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
date Thu, 11 Apr 2013 17:36:46 +0200
parents b9a918201d47
children 9a3e25e270a0
comparison
equal deleted inserted replaced
9002:7844a36d0216 9023:f94bb5d20e5d
1304 _method->clear_code(); // Break a cycle 1304 _method->clear_code(); // Break a cycle
1305 } 1305 }
1306 _method = NULL; // Clear the method of this dead nmethod 1306 _method = NULL; // Clear the method of this dead nmethod
1307 } 1307 }
1308 1308
1309 #ifdef GRAAL
1310 if (_graal_installed_code != NULL) {
1311 HotSpotInstalledCode::set_nmethod(_graal_installed_code, 0);
1312 _graal_installed_code = NULL;
1313 }
1314 #endif
1315
1316 // Make the class unloaded - i.e., change state and notify sweeper 1309 // Make the class unloaded - i.e., change state and notify sweeper
1317 assert(SafepointSynchronize::is_at_safepoint(), "must be at safepoint"); 1310 assert(SafepointSynchronize::is_at_safepoint(), "must be at safepoint");
1318 if (is_in_use()) { 1311 if (is_in_use()) {
1319 // Transitioning directly from live to unloaded -- so 1312 // Transitioning directly from live to unloaded -- so
1320 // we need to force a cache clean-up; remember this 1313 // we need to force a cache clean-up; remember this
1392 // another thread already performed this transition so nothing 1385 // another thread already performed this transition so nothing
1393 // to do, but return false to indicate this. 1386 // to do, but return false to indicate this.
1394 return false; 1387 return false;
1395 } 1388 }
1396 1389
1397 #ifdef GRAAL
1398 if (_graal_installed_code != NULL) {
1399 HotSpotInstalledCode::set_nmethod(_graal_installed_code, 0);
1400 _graal_installed_code = NULL;
1401 }
1402 #endif
1403
1404 // The caller can be calling the method statically or through an inline 1390 // The caller can be calling the method statically or through an inline
1405 // cache call. 1391 // cache call.
1406 if (!is_osr_method() && !is_not_entrant()) { 1392 if (!is_osr_method() && !is_not_entrant()) {
1407 NativeJump::patch_verified_entry(entry_point(), verified_entry_point(), 1393 if (_graal_installed_code != NULL && !HotSpotInstalledCode::isDefault(_graal_installed_code)) {
1408 SharedRuntime::get_handle_wrong_method_stub()); 1394 // This was manually installed machine code. Patch entry with stub that throws an exception.
1395 NativeJump::patch_verified_entry(entry_point(), verified_entry_point(),
1396 SharedRuntime::get_deoptimized_installed_code_stub());
1397 } else {
1398 NativeJump::patch_verified_entry(entry_point(), verified_entry_point(),
1399 SharedRuntime::get_handle_wrong_method_stub());
1400 }
1409 } 1401 }
1410 1402
1411 if (is_in_use()) { 1403 if (is_in_use()) {
1412 // It's a true state change, so mark the method as decompiled. 1404 // It's a true state change, so mark the method as decompiled.
1413 // Do it only for transition from alive. 1405 // Do it only for transition from alive.