mirror of
https://github.com/openjdk/jdk.git
synced 2025-08-27 06:45:07 +02:00
8153134: Infinite loop in handle_wrong_method in jmod
Use Patching_lock to synchronize access between set_code() and clear_code(). Reviewed-by: kvn, dlong
This commit is contained in:
parent
614320ba5e
commit
4bb6761600
4 changed files with 6 additions and 7 deletions
|
@ -97,7 +97,7 @@ Method::Method(ConstMethod* xconst, AccessFlags access_flags) {
|
|||
// Fix and bury in Method*
|
||||
set_interpreter_entry(NULL); // sets i2i entry and from_int
|
||||
set_adapter_entry(NULL);
|
||||
clear_code(); // from_c/from_i get set to c2i/i2i
|
||||
clear_code(false /* don't need a lock */); // from_c/from_i get set to c2i/i2i
|
||||
|
||||
if (access_flags.is_native()) {
|
||||
clear_native_function();
|
||||
|
@ -907,8 +907,8 @@ void Method::set_not_osr_compilable(int comp_level, bool report, const char* rea
|
|||
}
|
||||
|
||||
// Revert to using the interpreter and clear out the nmethod
|
||||
void Method::clear_code() {
|
||||
|
||||
void Method::clear_code(bool acquire_lock /* = true */) {
|
||||
MutexLockerEx pl(acquire_lock ? Patching_lock : NULL, Mutex::_no_safepoint_check_flag);
|
||||
// this may be NULL if c2i adapters have not been made yet
|
||||
// Only should happen at allocate time.
|
||||
if (adapter() == NULL) {
|
||||
|
@ -1077,6 +1077,7 @@ bool Method::check_code() const {
|
|||
|
||||
// Install compiled code. Instantly it can execute.
|
||||
void Method::set_code(methodHandle mh, CompiledMethod *code) {
|
||||
MutexLockerEx pl(Patching_lock, Mutex::_no_safepoint_check_flag);
|
||||
assert( code, "use clear_code to remove code" );
|
||||
assert( mh->check_code(), "" );
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue