8210498: nmethod entry barriers

Reviewed-by: kvn, pliden
This commit is contained in:
Erik Österlund 2018-10-16 13:18:22 +02:00
parent e39c5811b5
commit 0192c14c9b
25 changed files with 699 additions and 4 deletions

View file

@ -29,6 +29,7 @@
#include "code/codeCache.hpp"
#include "compiler/compileBroker.hpp"
#include "compiler/disassembler.hpp"
#include "gc/shared/barrierSetNMethod.hpp"
#include "gc/shared/collectedHeap.hpp"
#include "interpreter/interpreter.hpp"
#include "interpreter/interpreterRuntime.hpp"
@ -1045,6 +1046,13 @@ nmethod* InterpreterRuntime::frequency_counter_overflow(JavaThread* thread, addr
Method* method = last_frame.method();
int bci = method->bci_from(last_frame.bcp());
nm = method->lookup_osr_nmethod_for(bci, CompLevel_none, false);
BarrierSetNMethod* bs_nm = BarrierSet::barrier_set()->barrier_set_nmethod();
if (nm != NULL && bs_nm != NULL) {
// in case the transition passed a safepoint we need to barrier this again
if (!bs_nm->nmethod_osr_entry_barrier(nm)) {
nm = NULL;
}
}
}
if (nm != NULL && thread->is_interp_only_mode()) {
// Normally we never get an nm if is_interp_only_mode() is true, because
@ -1081,6 +1089,13 @@ IRT_ENTRY(nmethod*,
nmethod* osr_nm = CompilationPolicy::policy()->event(method, method, branch_bci, bci, CompLevel_none, NULL, thread);
assert(!HAS_PENDING_EXCEPTION, "Event handler should not throw any exceptions");
BarrierSetNMethod* bs_nm = BarrierSet::barrier_set()->barrier_set_nmethod();
if (osr_nm != NULL && bs_nm != NULL) {
if (!bs_nm->nmethod_osr_entry_barrier(osr_nm)) {
osr_nm = NULL;
}
}
if (osr_nm != NULL) {
// We may need to do on-stack replacement which requires that no
// monitors in the activation are biased because their