src/share/vm/oops/method.cpp

changeset 8717
77d9c9da7188
parent 8664
00cbb581da94
child 8856
ac27a9c85bea
child 9184
fbcbfd2753b5
     1.1 --- a/src/share/vm/oops/method.cpp	Thu Feb 02 00:29:28 2017 +0000
     1.2 +++ b/src/share/vm/oops/method.cpp	Mon Feb 06 23:36:58 2017 +0300
     1.3 @@ -98,7 +98,7 @@
     1.4    // Fix and bury in Method*
     1.5    set_interpreter_entry(NULL); // sets i2i entry and from_int
     1.6    set_adapter_entry(NULL);
     1.7 -  clear_code(); // from_c/from_i get set to c2i/i2i
     1.8 +  clear_code(false /* don't need a lock */); // from_c/from_i get set to c2i/i2i
     1.9  
    1.10    if (access_flags.is_native()) {
    1.11      clear_native_function();
    1.12 @@ -846,8 +846,8 @@
    1.13  }
    1.14  
    1.15  // Revert to using the interpreter and clear out the nmethod
    1.16 -void Method::clear_code() {
    1.17 -
    1.18 +void Method::clear_code(bool acquire_lock /* = true */) {
    1.19 +  MutexLockerEx pl(acquire_lock ? Patching_lock : NULL, Mutex::_no_safepoint_check_flag);
    1.20    // this may be NULL if c2i adapters have not been made yet
    1.21    // Only should happen at allocate time.
    1.22    if (_adapter == NULL) {
    1.23 @@ -975,6 +975,7 @@
    1.24  
    1.25  // Install compiled code.  Instantly it can execute.
    1.26  void Method::set_code(methodHandle mh, nmethod *code) {
    1.27 +  MutexLockerEx pl(Patching_lock, Mutex::_no_safepoint_check_flag);
    1.28    assert( code, "use clear_code to remove code" );
    1.29    assert( mh->check_code(), "" );
    1.30  

mercurial