Skip to content
Permalink
Browse files

8235696: ZGC: assert(ZNMethod::is_armed(nm) == _should_disarm_nmethod…

…s) failed: Invalid state

Reviewed-by: eosterlund, stefank
  • Loading branch information
pliden committed Dec 12, 2019
1 parent ad5ea72 commit 056b70c4b7b3fc890ba6cf4512cc271b06e2c76a
@@ -32,11 +32,12 @@
class nmethod;

class BarrierSetNMethod: public CHeapObj<mtGC> {
bool supports_entry_barrier(nmethod* nm);
void deoptimize(nmethod* nm, address* return_addr_ptr);
int disarmed_value() const;

public:
bool supports_entry_barrier(nmethod* nm);

virtual bool nmethod_entry_barrier(nmethod* nm) = 0;
virtual ByteSize thread_disarmed_offset() const = 0;
virtual int* disarmed_value_address() const = 0;
@@ -187,6 +187,15 @@ void ZNMethod::flush_nmethod(nmethod* nm) {
delete gc_data(nm);
}

bool ZNMethod::supports_entry_barrier(nmethod* nm) {
BarrierSetNMethod* const bs = BarrierSet::barrier_set()->barrier_set_nmethod();
if (bs != NULL) {
return bs->supports_entry_barrier(nm);
}

return false;
}

bool ZNMethod::is_armed(nmethod* nm) {
BarrierSetNMethod* const bs = BarrierSet::barrier_set()->barrier_set_nmethod();
if (bs != NULL) {
@@ -43,6 +43,8 @@ class ZNMethod : public AllStatic {
static void unregister_nmethod(nmethod* nm);
static void flush_nmethod(nmethod* nm);

static bool supports_entry_barrier(nmethod* nm);

static bool is_armed(nmethod* nm);
static void disarm(nmethod* nm);

@@ -146,14 +146,15 @@ class ZRootsIteratorCodeBlobClosure : public CodeBlobClosure {

public:
ZRootsIteratorCodeBlobClosure(ZRootsIteratorClosure* cl) :
_cl(cl),
_should_disarm_nmethods(cl->should_disarm_nmethods()) {}
_cl(cl),
_should_disarm_nmethods(cl->should_disarm_nmethods()) {}

virtual void do_code_blob(CodeBlob* cb) {
nmethod* const nm = cb->as_nmethod_or_null();
if (nm != NULL && nm->oops_do_try_claim()) {
ZNMethod::nmethod_oops_do(nm, _cl);
assert(ZNMethod::is_armed(nm) == _should_disarm_nmethods, "Invalid state");
assert(!ZNMethod::supports_entry_barrier(nm) ||
ZNMethod::is_armed(nm) == _should_disarm_nmethods, "Invalid state");
if (_should_disarm_nmethods) {
ZNMethod::disarm(nm);
}

0 comments on commit 056b70c

Please sign in to comment.
You can’t perform that action at this time.