8368072: Remove redundant arguments of MarkingNMethodClosure

Reviewed-by: stefank, fandreuzzi
This commit is contained in:
Albert Mingkun Yang 2025-09-22 07:20:00 +00:00
parent 258fcf9f5e
commit f10fbe1fb4
6 changed files with 11 additions and 23 deletions

View File

@ -41,7 +41,7 @@ void G1FullGCMarkTask::work(uint worker_id) {
Ticks start = Ticks::now();
ResourceMark rm;
G1FullGCMarker* marker = collector()->marker(worker_id);
MarkingNMethodClosure code_closure(marker->mark_closure(), !NMethodToOopClosure::FixRelocations, true /* keepalive nmethods */);
MarkingNMethodClosure code_closure(marker->mark_closure());
if (ClassUnloading) {
_root_processor.process_strong_roots(marker->mark_closure(),

View File

@ -1065,9 +1065,7 @@ public:
ParCompactionManager* cm = ParCompactionManager::gc_thread_compaction_manager(_worker_id);
MarkingNMethodClosure mark_and_push_in_blobs(&cm->_mark_and_push_closure,
!NMethodToOopClosure::FixRelocations,
true /* keepalive nmethods */);
MarkingNMethodClosure mark_and_push_in_blobs(&cm->_mark_and_push_closure);
thread->oops_do(&cm->_mark_and_push_closure, &mark_and_push_in_blobs);

View File

@ -485,9 +485,7 @@ void SerialFullGC::phase1_mark(bool clear_all_softrefs) {
{
StrongRootsScope srs(0);
MarkingNMethodClosure mark_code_closure(&follow_root_closure,
!NMethodToOopClosure::FixRelocations,
true);
MarkingNMethodClosure mark_code_closure(&follow_root_closure);
// Start tracing from roots, there are 3 kinds of roots in full-gc.
//

View File

@ -152,7 +152,7 @@ public:
// we risk executing that code cache blob, and crashing.
template <typename T>
void ShenandoahSTWRootScanner::roots_do(T* oops, uint worker_id) {
MarkingNMethodClosure nmethods_cl(oops, !NMethodToOopClosure::FixRelocations, true /*FIXME*/);
MarkingNMethodClosure nmethods_cl(oops);
CLDToOopClosure clds(oops, ClassLoaderData::_claim_strong);
ResourceMark rm;

View File

@ -53,16 +53,10 @@ void MarkingNMethodClosure::do_nmethod(nmethod* nm) {
// Process the oops in the nmethod
nm->oops_do(_cl);
if (_keepalive_nmethods) {
// CodeCache unloading support
nm->mark_as_maybe_on_stack();
// CodeCache unloading support
nm->mark_as_maybe_on_stack();
BarrierSetNMethod* bs_nm = BarrierSet::barrier_set()->barrier_set_nmethod();
bs_nm->disarm(nm);
}
if (_fix_relocations) {
nm->fix_oop_relocations();
}
BarrierSetNMethod* bs_nm = BarrierSet::barrier_set()->barrier_set_nmethod();
bs_nm->disarm(nm);
}
}

View File

@ -255,13 +255,11 @@ class NMethodToOopClosure : public NMethodClosure {
const static bool FixRelocations = true;
};
class MarkingNMethodClosure : public NMethodToOopClosure {
bool _keepalive_nmethods;
class MarkingNMethodClosure : public NMethodClosure {
OopClosure* _cl;
public:
MarkingNMethodClosure(OopClosure* cl, bool fix_relocations, bool keepalive_nmethods) :
NMethodToOopClosure(cl, fix_relocations),
_keepalive_nmethods(keepalive_nmethods) {}
MarkingNMethodClosure(OopClosure* cl) : _cl(cl) {}
// Called for each nmethod.
virtual void do_nmethod(nmethod* nm);