Skip to content
This repository has been archived by the owner. It is now read-only.
Permalink
Browse files
8244658: Remove dead code in code cache sweeper
Reviewed-by: mdoerr, kvn
  • Loading branch information
Nils Eliasson committed Jun 3, 2020
1 parent 10874e0 commit 06b49fa3f7d84c5bd8f04d25b76647590dbcd001
@@ -81,40 +81,6 @@ class SweeperRecord {
static int _sweep_index = 0;
static SweeperRecord* _records = NULL;

void NMethodSweeper::report_events(int id, address entry) {
if (_records != NULL) {
for (int i = _sweep_index; i < SweeperLogEntries; i++) {
if (_records[i].uep == entry ||
_records[i].vep == entry ||
_records[i].compile_id == id) {
_records[i].print();
}
}
for (int i = 0; i < _sweep_index; i++) {
if (_records[i].uep == entry ||
_records[i].vep == entry ||
_records[i].compile_id == id) {
_records[i].print();
}
}
}
}

void NMethodSweeper::report_events() {
if (_records != NULL) {
for (int i = _sweep_index; i < SweeperLogEntries; i++) {
// skip empty records
if (_records[i].vep == NULL) continue;
_records[i].print();
}
for (int i = 0; i < _sweep_index; i++) {
// skip empty records
if (_records[i].vep == NULL) continue;
_records[i].print();
}
}
}

void NMethodSweeper::record_sweep(CompiledMethod* nm, int line) {
if (_records != NULL) {
_records[_sweep_index].traversal = _traversals;
@@ -210,44 +176,6 @@ class NMethodMarkingClosure : public HandshakeClosure {
}
};

class NMethodMarkingTask : public AbstractGangTask {
private:
NMethodMarkingClosure* _cl;
public:
NMethodMarkingTask(NMethodMarkingClosure* cl) :
AbstractGangTask("Parallel NMethod Marking"),
_cl(cl) {
Threads::change_thread_claim_token();
}

~NMethodMarkingTask() {
Threads::assert_all_threads_claimed();
}

void work(uint worker_id) {
Threads::possibly_parallel_threads_do(true, _cl);
}
};

/**
* Scans the stacks of all Java threads and marks activations of not-entrant methods.
* No need to synchronize access, since 'mark_active_nmethods' is always executed at a
* safepoint.
*/
void NMethodSweeper::mark_active_nmethods() {
CodeBlobClosure* cl = prepare_mark_active_nmethods();
if (cl != NULL) {
WorkGang* workers = Universe::heap()->get_safepoint_workers();
if (workers != NULL) {
NMethodMarkingClosure tcl(cl);
NMethodMarkingTask task(&tcl);
workers->run_task(&task);
} else {
Threads::nmethods_do(cl);
}
}
}

CodeBlobClosure* NMethodSweeper::prepare_mark_active_nmethods() {
#ifdef ASSERT
assert(Thread::current()->is_Code_cache_sweeper_thread(), "must be executed under CodeCache_lock and in sweeper thread");
@@ -108,11 +108,8 @@ class NMethodSweeper : public AllStatic {
#ifdef ASSERT
// Keep track of sweeper activity in the ring buffer
static void record_sweep(CompiledMethod* nm, int line);
static void report_events(int id, address entry);
static void report_events();
#endif

static void mark_active_nmethods(); // Invoked at the end of each safepoint
static CodeBlobClosure* prepare_mark_active_nmethods();
static CodeBlobClosure* prepare_reset_hotness_counters();
static void sweeper_loop();
@@ -94,10 +94,6 @@ void VM_ClearICs::doit() {
}
}

void VM_MarkActiveNMethods::doit() {
NMethodSweeper::mark_active_nmethods();
}

VM_DeoptimizeFrame::VM_DeoptimizeFrame(JavaThread* thread, intptr_t* id, int reason) {
_thread = thread;
_id = id;
@@ -248,14 +248,6 @@ class VM_GTestExecuteAtSafepoint: public VM_Operation {
VM_GTestExecuteAtSafepoint() {}
};

class VM_MarkActiveNMethods: public VM_Operation {
public:
VM_MarkActiveNMethods() {}
VMOp_Type type() const { return VMOp_MarkActiveNMethods; }
void doit();
bool allow_nested_vm_operations() const { return true; }
};

// Deopt helper that can deoptimize frames in threads other than the
// current thread. Only used through Deoptimization::deoptimize_frame.
class VM_DeoptimizeFrame: public VM_Operation {

0 comments on commit 06b49fa

Please sign in to comment.