8173338: C2: continuous CallSite relinkage eventually disables compilation for a method

Reviewed-by: jrose, dlong, kvn
This commit is contained in:
Vladimir Ivanov 2017-01-31 01:11:40 +03:00
parent 81e25c58fb
commit 95ff3ccdb4
4 changed files with 19 additions and 3 deletions

View file

@ -1146,6 +1146,14 @@ bool nmethod::make_not_entrant_or_zombie(unsigned int state) {
assert(state == zombie || state == not_entrant, "must be zombie or not_entrant");
assert(!is_zombie(), "should not already be a zombie");
if (_state == state) {
// Avoid taking the lock if already in required state.
// This is safe from races because the state is an end-state,
// which the nmethod cannot back out of once entered.
// No need for fencing either.
return false;
}
// Make sure neither the nmethod nor the method is flushed in case of a safepoint in code below.
nmethodLocker nml(this);
methodHandle the_method(method());