--- old/src/hotspot/share/aot/aotCodeHeap.cpp 2019-05-03 10:53:45.961059580 +0200 +++ new/src/hotspot/share/aot/aotCodeHeap.cpp 2019-05-03 10:53:45.498043840 +0200 @@ -36,6 +36,7 @@ #include "jvmci/jvmciRuntime.hpp" #include "memory/allocation.inline.hpp" #include "oops/method.inline.hpp" +#include "runtime/deoptimization.hpp" #include "runtime/handles.inline.hpp" #include "runtime/os.hpp" #include "runtime/safepointVerifiers.hpp" --- old/src/hotspot/share/code/nmethod.hpp 2019-05-03 10:53:47.182101089 +0200 +++ new/src/hotspot/share/code/nmethod.hpp 2019-05-03 10:53:46.718085315 +0200 @@ -119,7 +119,7 @@ // used by jvmti to track if an unload event has been posted for this nmethod. bool _unload_reported; - // Protected by Patching_lock + // Protected by CompiledMethod_lock volatile signed char _state; // {not_installed, in_use, not_entrant, zombie, unloaded} #ifdef ASSERT --- old/src/hotspot/share/gc/z/zBarrierSetNMethod.cpp 2019-05-03 10:53:48.400142495 +0200 +++ new/src/hotspot/share/gc/z/zBarrierSetNMethod.cpp 2019-05-03 10:53:47.929126484 +0200 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2018, 2019, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it --- old/src/hotspot/share/gc/z/zNMethod.cpp 2019-05-03 10:53:49.625184141 +0200 +++ new/src/hotspot/share/gc/z/zNMethod.cpp 2019-05-03 10:53:49.160168332 +0200 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2017, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2017, 2019, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it --- old/src/hotspot/share/jvmci/jvmciEnv.cpp 2019-05-03 10:53:50.867226363 +0200 +++ new/src/hotspot/share/jvmci/jvmciEnv.cpp 2019-05-03 10:53:50.392210215 +0200 @@ -28,6 +28,7 @@ #include "memory/oopFactory.hpp" #include "memory/resourceArea.hpp" #include "oops/typeArrayOop.inline.hpp" +#include "runtime/deoptimization.hpp" #include "runtime/jniHandles.inline.hpp" #include "runtime/javaCalls.hpp" #include "jvmci/jniAccessMark.inline.hpp" @@ -1453,8 +1454,7 @@ // Invalidating the HotSpotNmethod means we want the nmethod // to be deoptimized. nm->mark_for_deoptimization(); - VM_Deoptimize op; - VMThread::execute(&op); + Deoptimization::deoptimize_all_marked(); } // A HotSpotNmethod instance can only reference a single nmethod --- old/src/hotspot/share/oops/markOop.hpp 2019-05-03 10:53:52.112268688 +0200 +++ new/src/hotspot/share/oops/markOop.hpp 2019-05-03 10:53:51.650252982 +0200 @@ -177,15 +177,6 @@ assert(has_bias_pattern(), "should not call this otherwise"); return (JavaThread*) ((intptr_t) (mask_bits(value(), ~(biased_lock_mask_in_place | age_mask_in_place | epoch_mask_in_place)))); } - bool biased_locker_is(JavaThread* thread) const { - if (!has_bias_pattern()) { - return false; - } - // If current thread is not the owner it can be unbiased at anytime. - JavaThread* jt = (JavaThread*) ((intptr_t) (mask_bits(value(), ~(biased_lock_mask_in_place | age_mask_in_place | epoch_mask_in_place)))); - return jt == thread; - } - // Indicates that the mark has the bias bit set but that it has not // yet been biased toward a particular thread bool is_biased_anonymously() const { --- old/src/hotspot/share/oops/method.cpp 2019-05-03 10:53:53.329310061 +0200 +++ new/src/hotspot/share/oops/method.cpp 2019-05-03 10:53:52.864294253 +0200 @@ -101,7 +101,7 @@ // Fix and bury in Method* set_interpreter_entry(NULL); // sets i2i entry and from_int set_adapter_entry(NULL); - Method::unlink_code(this); + Method::clear_code(); // from_c/from_i get set to c2i/i2i if (access_flags.is_native()) { clear_native_function(); @@ -932,7 +932,7 @@ } // Revert to using the interpreter and clear out the nmethod -void Method::locked_unlink_code() { +void Method::clear_code() { // this may be NULL if c2i adapters have not been made yet // Only should happen at allocate time. if (adapter() == NULL) { @@ -947,19 +947,20 @@ } void Method::unlink_code(Method *method, CompiledMethod *compare) { - if (method != NULL) { - MutexLocker ml(CompiledMethod_lock->owned_by_self() ? NULL : CompiledMethod_lock, Mutex::_no_safepoint_check_flag); - if (method->code() != compare && method->from_compiled_entry() != compare->verified_entry_point()) { - return; - } - method->locked_unlink_code(); + if (method == NULL) { + return; + } + MutexLocker ml(CompiledMethod_lock->owned_by_self() ? NULL : CompiledMethod_lock, Mutex::_no_safepoint_check_flag); + if (method->code() == compare || + method->from_compiled_entry() == compare->verified_entry_point()) { + method->clear_code(); } } void Method::unlink_code(Method *method) { if (method != NULL) { MutexLocker ml(CompiledMethod_lock->owned_by_self() ? NULL : CompiledMethod_lock, Mutex::_no_safepoint_check_flag); - method->locked_unlink_code(); + method->clear_code(); } } @@ -1182,7 +1183,7 @@ // Install compiled code. Instantly it can execute. void Method::set_code(const methodHandle& mh, CompiledMethod *code) { - MutexLocker pl(Patching_lock, Mutex::_no_safepoint_check_flag); + MutexLocker pl(CompiledMethod_lock, Mutex::_no_safepoint_check_flag); assert( code, "use clear_code to remove code" ); assert( mh->check_code(), "" ); --- old/src/hotspot/share/oops/method.hpp 2019-05-03 10:53:54.594353066 +0200 +++ new/src/hotspot/share/oops/method.hpp 2019-05-03 10:53:54.128337224 +0200 @@ -468,7 +468,8 @@ static void unlink_code(Method *method); private: - void locked_unlink_code(); + // Either called with CompiledMethod_lock held or from constructor. + void clear_code(); public: static void set_code(const methodHandle& mh, CompiledMethod* code); --- old/src/hotspot/share/runtime/biasedLocking.cpp 2019-05-03 10:53:55.847395663 +0200 +++ new/src/hotspot/share/runtime/biasedLocking.cpp 2019-05-03 10:53:55.381379821 +0200 @@ -627,7 +627,7 @@ // update the heuristics because doing so may cause unwanted bulk // revocations (which are expensive) to occur. markOop mark = obj->mark(); - if (mark->is_biased_anonymously()) { + if (mark->is_biased_anonymously() && !attempt_rebias) { // We are probably trying to revoke the bias of this object due to // an identity hash code computation. Try to revoke the bias // without a safepoint. This is possible if we can successfully @@ -729,7 +729,8 @@ markOop mark = obj->mark(); Klass *k = obj->klass(); markOop prototype_header = k->prototype_header(); - if (mark->biased_locker_is((JavaThread*) THREAD) && + if (mark->has_bias_pattern() && + mark->biased_locker() == ((JavaThread*) THREAD) && prototype_header->bias_epoch() == mark->bias_epoch()) { // A thread is trying to revoke the bias of an object biased // toward it, again likely due to an identity hash code --- old/src/hotspot/share/runtime/mutexLocker.hpp 2019-05-03 10:53:57.108438532 +0200 +++ new/src/hotspot/share/runtime/mutexLocker.hpp 2019-05-03 10:53:56.643422723 +0200 @@ -32,7 +32,7 @@ // Mutexes used in the VM. extern Mutex* Patching_lock; // a lock used to guard code patching of compiled code -extern Mutex* CompiledMethod_lock; +extern Mutex* CompiledMethod_lock; // a lock used to guard a compiled method extern Monitor* SystemDictionary_lock; // a lock on the system dictionary extern Mutex* ProtectionDomainSet_lock; // a lock on the pd_set list in the system dictionary extern Mutex* SharedDictionary_lock; // a lock on the CDS shared dictionary --- old/src/hotspot/share/services/dtraceAttacher.cpp 2019-05-03 10:53:58.323479837 +0200 +++ new/src/hotspot/share/services/dtraceAttacher.cpp 2019-05-03 10:53:57.858464029 +0200 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2006, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2006, 2019, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it