Skip to content
This repository was archived by the owner on Feb 2, 2023. It is now read-only.
/ jdk13u-dev Public archive

Commit 9bf30f7

Browse files
Ekaterina VergizovaYuri Nesterenko
Ekaterina Vergizova
authored and
Yuri Nesterenko
committedFeb 10, 2021
8234662: Sweeper should keep current nmethod alive before yielding for ICStub refills
Reviewed-by: yan Backport-of: 22ea33c
1 parent a42820a commit 9bf30f7

File tree

2 files changed

+14
-1
lines changed

2 files changed

+14
-1
lines changed
 

‎src/hotspot/share/code/compiledMethod.cpp

+13
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@
3030
#include "code/codeCache.hpp"
3131
#include "code/icBuffer.hpp"
3232
#include "gc/shared/barrierSet.hpp"
33+
#include "gc/shared/barrierSetNMethod.hpp"
3334
#include "gc/shared/gcBehaviours.hpp"
3435
#include "interpreter/bytecode.inline.hpp"
3536
#include "logging/log.hpp"
@@ -535,6 +536,18 @@ void CompiledMethod::cleanup_inline_caches(bool clean_all) {
535536
return;
536537
}
537538
}
539+
BarrierSetNMethod* bs_nm = BarrierSet::barrier_set()->barrier_set_nmethod();
540+
if (bs_nm != NULL) {
541+
// We want to keep an invariant that nmethods found through iterations of a Thread's
542+
// nmethods found in safepoints have gone through an entry barrier and are not armed.
543+
// By calling this nmethod entry barrier from the sweeper, it plays along and acts
544+
// like any other nmethod found on the stack of a thread (fewer surprises).
545+
nmethod* nm = as_nmethod_or_null();
546+
if (nm != NULL) {
547+
bool alive = bs_nm->nmethod_entry_barrier(nm);
548+
assert(alive, "should be alive");
549+
}
550+
}
538551
InlineCacheBuffer::refill_ic_stubs();
539552
}
540553
}

‎src/hotspot/share/gc/shared/barrierSetNMethod.hpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -37,9 +37,9 @@ class BarrierSetNMethod: public CHeapObj<mtGC> {
3737

3838
protected:
3939
virtual int disarmed_value() const;
40-
virtual bool nmethod_entry_barrier(nmethod* nm) = 0;
4140

4241
public:
42+
virtual bool nmethod_entry_barrier(nmethod* nm) = 0;
4343
virtual ByteSize thread_disarmed_offset() const = 0;
4444

4545
static int nmethod_stub_entry_barrier(address* return_address_ptr);

1 commit comments

Comments
 (1)

openjdk-notifier[bot] commented on Feb 10, 2021

@openjdk-notifier[bot]
This repository has been archived.