mirror of
https://github.com/openjdk/jdk.git
synced 2025-08-28 15:24:43 +02:00
8136458: Remove "marked for reclamation" nmethod state
Removed "marked for reclamation" nmethod state because only sweeper sets nmethods to zombie. Reviewed-by: kvn, neliasso
This commit is contained in:
parent
9dff846b30
commit
ce350e07fa
7 changed files with 10 additions and 40 deletions
|
@ -249,7 +249,6 @@ public class NMethod extends CodeBlob {
|
|||
// public int age();
|
||||
// public boolean isMarkedForDeoptimization();
|
||||
// public boolean isMarkedForUnloading();
|
||||
// public boolean isMarkedForReclamation();
|
||||
// public int level();
|
||||
// public int version();
|
||||
|
||||
|
|
|
@ -530,7 +530,6 @@ const char* nmethod::compile_kind() const {
|
|||
void nmethod::init_defaults() {
|
||||
_state = in_use;
|
||||
_unloading_clock = 0;
|
||||
_marked_for_reclamation = 0;
|
||||
_has_flushed_dependencies = 0;
|
||||
_has_unsafe_access = 0;
|
||||
_has_method_handle_invokes = 0;
|
||||
|
@ -1564,8 +1563,6 @@ void nmethod::flush() {
|
|||
assert(!is_osr_method() || is_unloaded() || is_zombie(),
|
||||
"osr nmethod must be unloaded or zombie before flushing");
|
||||
assert(is_zombie() || is_osr_method(), "must be a zombie method");
|
||||
assert(is_marked_for_reclamation() || is_osr_method(), "must be marked for reclamation");
|
||||
|
||||
assert (!is_locked_by_vm(), "locked methods shouldn't be flushed");
|
||||
assert_locked_or_safepoint(CodeCache_lock);
|
||||
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright (c) 1997, 2015, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 1997, 2016, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
|
@ -188,8 +188,6 @@ class nmethod : public CodeBlob {
|
|||
// protected by CodeCache_lock
|
||||
bool _has_flushed_dependencies; // Used for maintenance of dependencies (CodeCache_lock)
|
||||
|
||||
bool _marked_for_reclamation; // Used by NMethodSweeper (set only by sweeper)
|
||||
|
||||
enum MarkForDeoptimizationStatus {
|
||||
not_marked,
|
||||
deoptimize,
|
||||
|
@ -503,9 +501,6 @@ class nmethod : public CodeBlob {
|
|||
_has_flushed_dependencies = 1;
|
||||
}
|
||||
|
||||
bool is_marked_for_reclamation() const { return _marked_for_reclamation; }
|
||||
void mark_for_reclamation() { _marked_for_reclamation = 1; }
|
||||
|
||||
bool has_unsafe_access() const { return _has_unsafe_access; }
|
||||
void set_has_unsafe_access(bool z) { _has_unsafe_access = z; }
|
||||
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright (c) 1997, 2014, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 1997, 2016, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
|
@ -146,7 +146,6 @@ volatile bool NMethodSweeper::_force_sweep = false;// Indicates if w
|
|||
volatile int NMethodSweeper::_bytes_changed = 0; // Counts the total nmethod size if the nmethod changed from:
|
||||
// 1) alive -> not_entrant
|
||||
// 2) not_entrant -> zombie
|
||||
// 3) zombie -> marked_for_reclamation
|
||||
int NMethodSweeper::_hotness_counter_reset_val = 0;
|
||||
|
||||
long NMethodSweeper::_total_nof_methods_reclaimed = 0; // Accumulated nof methods flushed
|
||||
|
@ -397,7 +396,6 @@ void NMethodSweeper::sweep_code_cache() {
|
|||
|
||||
int flushed_count = 0;
|
||||
int zombified_count = 0;
|
||||
int marked_for_reclamation_count = 0;
|
||||
int flushed_c2_count = 0;
|
||||
|
||||
if (PrintMethodFlushing && Verbose) {
|
||||
|
@ -442,10 +440,6 @@ void NMethodSweeper::sweep_code_cache() {
|
|||
++flushed_c2_count;
|
||||
}
|
||||
break;
|
||||
case MarkedForReclamation:
|
||||
state_after = "marked for reclamation";
|
||||
++marked_for_reclamation_count;
|
||||
break;
|
||||
case MadeZombie:
|
||||
state_after = "made zombie";
|
||||
++zombified_count;
|
||||
|
@ -486,7 +480,6 @@ void NMethodSweeper::sweep_code_cache() {
|
|||
event.set_sweepIndex(_traversals);
|
||||
event.set_sweptCount(swept_count);
|
||||
event.set_flushedCount(flushed_count);
|
||||
event.set_markedCount(marked_for_reclamation_count);
|
||||
event.set_zombifiedCount(zombified_count);
|
||||
event.commit();
|
||||
}
|
||||
|
@ -601,23 +594,12 @@ NMethodSweeper::MethodStateChange NMethodSweeper::process_nmethod(nmethod* nm) {
|
|||
}
|
||||
|
||||
if (nm->is_zombie()) {
|
||||
// If it is the first time we see nmethod then we mark it. Otherwise,
|
||||
// we reclaim it. When we have seen a zombie method twice, we know that
|
||||
// there are no inline caches that refer to it.
|
||||
if (nm->is_marked_for_reclamation()) {
|
||||
// All inline caches that referred to this nmethod were cleaned in the
|
||||
// previous sweeper cycle. Now flush the nmethod from the code cache.
|
||||
assert(!nm->is_locked_by_vm(), "must not flush locked nmethods");
|
||||
release_nmethod(nm);
|
||||
assert(result == None, "sanity");
|
||||
result = Flushed;
|
||||
} else {
|
||||
nm->mark_for_reclamation();
|
||||
// Keep track of code cache state change
|
||||
_bytes_changed += nm->total_size();
|
||||
SWEEP(nm);
|
||||
assert(result == None, "sanity");
|
||||
result = MarkedForReclamation;
|
||||
assert(nm->is_marked_for_reclamation(), "nmethod must be marked for reclamation");
|
||||
}
|
||||
} else if (nm->is_not_entrant()) {
|
||||
// If there are no current activations of this method on the
|
||||
// stack we can safely convert it to a zombie method
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright (c) 1997, 2014, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 1997, 2016, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
|
@ -60,7 +60,6 @@ class NMethodSweeper : public AllStatic {
|
|||
enum MethodStateChange {
|
||||
None,
|
||||
MadeZombie,
|
||||
MarkedForReclamation,
|
||||
Flushed
|
||||
};
|
||||
static long _traversals; // Stack scan count, also sweep ID.
|
||||
|
@ -76,7 +75,6 @@ class NMethodSweeper : public AllStatic {
|
|||
static volatile int _bytes_changed; // Counts the total nmethod size if the nmethod changed from:
|
||||
// 1) alive -> not_entrant
|
||||
// 2) not_entrant -> zombie
|
||||
// 3) zombie -> marked_for_reclamation
|
||||
// Stat counters
|
||||
static long _total_nof_methods_reclaimed; // Accumulated nof methods flushed
|
||||
static long _total_nof_c2_methods_reclaimed; // Accumulated nof C2-compiled methods flushed
|
||||
|
|
|
@ -550,7 +550,6 @@ Declares a structure type that can be used in other events.
|
|||
<value type="INTEGER" field="sweepIndex" label="Sweep Index" relation="SWEEP_ID"/>
|
||||
<value type="UINT" field="sweptCount" label="Methods Swept"/>
|
||||
<value type="UINT" field="flushedCount" label="Methods Flushed"/>
|
||||
<value type="UINT" field="markedCount" label="Methods Reclaimed"/>
|
||||
<value type="UINT" field="zombifiedCount" label="Methods Zombified"/>
|
||||
</event>
|
||||
|
||||
|
|
|
@ -90,7 +90,7 @@ public class ForceNMethodSweepTest extends CompilerWhiteBoxTest {
|
|||
return usage;
|
||||
}
|
||||
private void guaranteedSweep() {
|
||||
// not entrant -> ++stack_traversal_mark -> zombie -> reclamation -> flushed
|
||||
// not entrant -> ++stack_traversal_mark -> zombie -> flushed
|
||||
for (int i = 0; i < 5; ++i) {
|
||||
WHITE_BOX.fullGC();
|
||||
WHITE_BOX.forceNMethodSweep();
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue