8234662: Sweeper should keep current nmethod alive before yielding for ICStub refills

Reviewed-by: pliden, stefank
This commit is contained in:
Erik Österlund 2019-12-03 16:13:37 +00:00
parent 03521f465c
commit 22ea33cf7a
2 changed files with 14 additions and 3 deletions

View File

@ -30,6 +30,7 @@
#include "code/codeCache.hpp"
#include "code/icBuffer.hpp"
#include "gc/shared/barrierSet.hpp"
#include "gc/shared/barrierSetNMethod.hpp"
#include "gc/shared/gcBehaviours.hpp"
#include "interpreter/bytecode.inline.hpp"
#include "logging/log.hpp"
@ -556,6 +557,18 @@ void CompiledMethod::cleanup_inline_caches(bool clean_all) {
return;
}
}
BarrierSetNMethod* bs_nm = BarrierSet::barrier_set()->barrier_set_nmethod();
if (bs_nm != NULL) {
// We want to keep an invariant that nmethods found through iterations of a Thread's
// nmethods found in safepoints have gone through an entry barrier and are not armed.
// By calling this nmethod entry barrier from the sweeper, it plays along and acts
// like any other nmethod found on the stack of a thread (fewer surprises).
nmethod* nm = as_nmethod_or_null();
if (nm != NULL) {
bool alive = bs_nm->nmethod_entry_barrier(nm);
assert(alive, "should be alive");
}
}
InlineCacheBuffer::refill_ic_stubs();
}
}

View File

@ -36,10 +36,8 @@ class BarrierSetNMethod: public CHeapObj<mtGC> {
void deoptimize(nmethod* nm, address* return_addr_ptr);
int disarmed_value() const;
protected:
virtual bool nmethod_entry_barrier(nmethod* nm) = 0;
public:
virtual bool nmethod_entry_barrier(nmethod* nm) = 0;
virtual ByteSize thread_disarmed_offset() const = 0;
virtual int* disarmed_value_address() const = 0;