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:
Tobias Hartmann 2016-03-24 09:09:52 +01:00
parent 9dff846b30
commit ce350e07fa
7 changed files with 10 additions and 40 deletions

View file

@ -249,7 +249,6 @@ public class NMethod extends CodeBlob {
// public int age(); // public int age();
// public boolean isMarkedForDeoptimization(); // public boolean isMarkedForDeoptimization();
// public boolean isMarkedForUnloading(); // public boolean isMarkedForUnloading();
// public boolean isMarkedForReclamation();
// public int level(); // public int level();
// public int version(); // public int version();

View file

@ -530,7 +530,6 @@ const char* nmethod::compile_kind() const {
void nmethod::init_defaults() { void nmethod::init_defaults() {
_state = in_use; _state = in_use;
_unloading_clock = 0; _unloading_clock = 0;
_marked_for_reclamation = 0;
_has_flushed_dependencies = 0; _has_flushed_dependencies = 0;
_has_unsafe_access = 0; _has_unsafe_access = 0;
_has_method_handle_invokes = 0; _has_method_handle_invokes = 0;
@ -1564,8 +1563,6 @@ void nmethod::flush() {
assert(!is_osr_method() || is_unloaded() || is_zombie(), assert(!is_osr_method() || is_unloaded() || is_zombie(),
"osr nmethod must be unloaded or zombie before flushing"); "osr nmethod must be unloaded or zombie before flushing");
assert(is_zombie() || is_osr_method(), "must be a zombie method"); 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 (!is_locked_by_vm(), "locked methods shouldn't be flushed");
assert_locked_or_safepoint(CodeCache_lock); assert_locked_or_safepoint(CodeCache_lock);

View file

@ -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. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* *
* This code is free software; you can redistribute it and/or modify it * 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 // protected by CodeCache_lock
bool _has_flushed_dependencies; // Used for maintenance of dependencies (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 { enum MarkForDeoptimizationStatus {
not_marked, not_marked,
deoptimize, deoptimize,
@ -503,9 +501,6 @@ class nmethod : public CodeBlob {
_has_flushed_dependencies = 1; _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; } bool has_unsafe_access() const { return _has_unsafe_access; }
void set_has_unsafe_access(bool z) { _has_unsafe_access = z; } void set_has_unsafe_access(bool z) { _has_unsafe_access = z; }

View file

@ -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. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* *
* This code is free software; you can redistribute it and/or modify it * 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: volatile int NMethodSweeper::_bytes_changed = 0; // Counts the total nmethod size if the nmethod changed from:
// 1) alive -> not_entrant // 1) alive -> not_entrant
// 2) not_entrant -> zombie // 2) not_entrant -> zombie
// 3) zombie -> marked_for_reclamation
int NMethodSweeper::_hotness_counter_reset_val = 0; int NMethodSweeper::_hotness_counter_reset_val = 0;
long NMethodSweeper::_total_nof_methods_reclaimed = 0; // Accumulated nof methods flushed 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 flushed_count = 0;
int zombified_count = 0; int zombified_count = 0;
int marked_for_reclamation_count = 0;
int flushed_c2_count = 0; int flushed_c2_count = 0;
if (PrintMethodFlushing && Verbose) { if (PrintMethodFlushing && Verbose) {
@ -442,10 +440,6 @@ void NMethodSweeper::sweep_code_cache() {
++flushed_c2_count; ++flushed_c2_count;
} }
break; break;
case MarkedForReclamation:
state_after = "marked for reclamation";
++marked_for_reclamation_count;
break;
case MadeZombie: case MadeZombie:
state_after = "made zombie"; state_after = "made zombie";
++zombified_count; ++zombified_count;
@ -486,7 +480,6 @@ void NMethodSweeper::sweep_code_cache() {
event.set_sweepIndex(_traversals); event.set_sweepIndex(_traversals);
event.set_sweptCount(swept_count); event.set_sweptCount(swept_count);
event.set_flushedCount(flushed_count); event.set_flushedCount(flushed_count);
event.set_markedCount(marked_for_reclamation_count);
event.set_zombifiedCount(zombified_count); event.set_zombifiedCount(zombified_count);
event.commit(); event.commit();
} }
@ -601,23 +594,12 @@ NMethodSweeper::MethodStateChange NMethodSweeper::process_nmethod(nmethod* nm) {
} }
if (nm->is_zombie()) { if (nm->is_zombie()) {
// If it is the first time we see nmethod then we mark it. Otherwise, // All inline caches that referred to this nmethod were cleaned in the
// we reclaim it. When we have seen a zombie method twice, we know that // previous sweeper cycle. Now flush the nmethod from the code cache.
// there are no inline caches that refer to it. assert(!nm->is_locked_by_vm(), "must not flush locked nmethods");
if (nm->is_marked_for_reclamation()) { release_nmethod(nm);
assert(!nm->is_locked_by_vm(), "must not flush locked nmethods"); assert(result == None, "sanity");
release_nmethod(nm); result = Flushed;
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()) { } else if (nm->is_not_entrant()) {
// If there are no current activations of this method on the // If there are no current activations of this method on the
// stack we can safely convert it to a zombie method // stack we can safely convert it to a zombie method

View file

@ -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. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* *
* This code is free software; you can redistribute it and/or modify it * This code is free software; you can redistribute it and/or modify it
@ -60,7 +60,6 @@ class NMethodSweeper : public AllStatic {
enum MethodStateChange { enum MethodStateChange {
None, None,
MadeZombie, MadeZombie,
MarkedForReclamation,
Flushed Flushed
}; };
static long _traversals; // Stack scan count, also sweep ID. 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: static volatile int _bytes_changed; // Counts the total nmethod size if the nmethod changed from:
// 1) alive -> not_entrant // 1) alive -> not_entrant
// 2) not_entrant -> zombie // 2) not_entrant -> zombie
// 3) zombie -> marked_for_reclamation
// Stat counters // Stat counters
static long _total_nof_methods_reclaimed; // Accumulated nof methods flushed static long _total_nof_methods_reclaimed; // Accumulated nof methods flushed
static long _total_nof_c2_methods_reclaimed; // Accumulated nof C2-compiled methods flushed static long _total_nof_c2_methods_reclaimed; // Accumulated nof C2-compiled methods flushed

View file

@ -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="INTEGER" field="sweepIndex" label="Sweep Index" relation="SWEEP_ID"/>
<value type="UINT" field="sweptCount" label="Methods Swept"/> <value type="UINT" field="sweptCount" label="Methods Swept"/>
<value type="UINT" field="flushedCount" label="Methods Flushed"/> <value type="UINT" field="flushedCount" label="Methods Flushed"/>
<value type="UINT" field="markedCount" label="Methods Reclaimed"/>
<value type="UINT" field="zombifiedCount" label="Methods Zombified"/> <value type="UINT" field="zombifiedCount" label="Methods Zombified"/>
</event> </event>

View file

@ -90,7 +90,7 @@ public class ForceNMethodSweepTest extends CompilerWhiteBoxTest {
return usage; return usage;
} }
private void guaranteedSweep() { 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) { for (int i = 0; i < 5; ++i) {
WHITE_BOX.fullGC(); WHITE_BOX.fullGC();
WHITE_BOX.forceNMethodSweep(); WHITE_BOX.forceNMethodSweep();