8329661: Refactor ScavengableNMethods::verify_unlisted_nmethods
Reviewed-by: stefank, iwalulya
This commit is contained in:
parent
3f4b167c97
commit
18c925cd33
@ -725,17 +725,6 @@ HeapWord* SerialHeap::satisfy_failed_allocation(size_t size, bool is_tlab) {
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
#ifdef ASSERT
|
||||
class AssertNonScavengableClosure: public OopClosure {
|
||||
public:
|
||||
virtual void do_oop(oop* p) {
|
||||
assert(!SerialHeap::heap()->is_in_partial_collection(*p),
|
||||
"Referent should not be scavengable."); }
|
||||
virtual void do_oop(narrowOop* p) { ShouldNotReachHere(); }
|
||||
};
|
||||
static AssertNonScavengableClosure assert_is_non_scavengable_closure;
|
||||
#endif
|
||||
|
||||
void SerialHeap::process_roots(ScanningOption so,
|
||||
OopClosure* strong_roots,
|
||||
CLDClosure* strong_cld_closure,
|
||||
@ -766,10 +755,6 @@ void SerialHeap::process_roots(ScanningOption so,
|
||||
// We scan the entire code cache, since CodeCache::do_unloading is not called.
|
||||
CodeCache::blobs_do(code_roots);
|
||||
}
|
||||
// Verify that the code cache contents are not subject to
|
||||
// movement by a scavenging collection.
|
||||
DEBUG_ONLY(CodeBlobToOopClosure assert_code_is_non_scavengable(&assert_is_non_scavengable_closure, !CodeBlobToOopClosure::FixRelocations));
|
||||
DEBUG_ONLY(ScavengableNMethods::asserted_non_scavengable_nmethods_do(&assert_code_is_non_scavengable));
|
||||
}
|
||||
|
||||
bool SerialHeap::no_allocs_since_save_marks() {
|
||||
@ -869,16 +854,6 @@ bool SerialHeap::is_in(const void* p) const {
|
||||
return _young_gen->is_in(p) || _old_gen->is_in(p);
|
||||
}
|
||||
|
||||
#ifdef ASSERT
|
||||
// Don't implement this by using is_in_young(). This method is used
|
||||
// in some cases to check that is_in_young() is correct.
|
||||
bool SerialHeap::is_in_partial_collection(const void* p) {
|
||||
assert(is_in_reserved(p) || p == nullptr,
|
||||
"Does not work if address is non-null and outside of the heap");
|
||||
return p < _young_gen->reserved().end() && p != nullptr;
|
||||
}
|
||||
#endif
|
||||
|
||||
void SerialHeap::object_iterate(ObjectClosure* cl) {
|
||||
_young_gen->object_iterate(cl);
|
||||
_old_gen->object_iterate(cl);
|
||||
|
@ -178,10 +178,6 @@ public:
|
||||
|
||||
bool requires_barriers(stackChunkOop obj) const override;
|
||||
|
||||
#ifdef ASSERT
|
||||
bool is_in_partial_collection(const void* p);
|
||||
#endif
|
||||
|
||||
// Optimized nmethod scanning support routines
|
||||
void register_nmethod(nmethod* nm) override;
|
||||
void unregister_nmethod(nmethod* nm) override;
|
||||
|
@ -157,7 +157,7 @@ void ScavengableNMethods::nmethods_do_and_prune(CodeBlobToOopClosure* cl) {
|
||||
}
|
||||
|
||||
// Check for stray marks.
|
||||
debug_only(verify_unlisted_nmethods(nullptr));
|
||||
debug_only(verify_nmethods());
|
||||
}
|
||||
|
||||
void ScavengableNMethods::prune_nmethods_not_into_young() {
|
||||
@ -188,7 +188,7 @@ void ScavengableNMethods::prune_unlinked_nmethods() {
|
||||
}
|
||||
|
||||
// Check for stray marks.
|
||||
debug_only(verify_unlisted_nmethods(nullptr));
|
||||
debug_only(verify_nmethods());
|
||||
}
|
||||
|
||||
// Walk the list of methods which might contain oops to the java heap.
|
||||
@ -196,18 +196,6 @@ void ScavengableNMethods::nmethods_do(CodeBlobToOopClosure* cl) {
|
||||
nmethods_do_and_prune(cl);
|
||||
}
|
||||
|
||||
#ifndef PRODUCT
|
||||
void ScavengableNMethods::asserted_non_scavengable_nmethods_do(CodeBlobClosure* cl) {
|
||||
// While we are here, verify the integrity of the list.
|
||||
mark_on_list_nmethods();
|
||||
for (nmethod* cur = _head; cur != nullptr; cur = gc_data(cur).next()) {
|
||||
assert(gc_data(cur).on_list(), "else shouldn't be on this list");
|
||||
gc_data(cur).clear_marked();
|
||||
}
|
||||
verify_unlisted_nmethods(cl);
|
||||
}
|
||||
#endif // PRODUCT
|
||||
|
||||
void ScavengableNMethods::unlist_nmethod(nmethod* nm, nmethod* prev) {
|
||||
assert_locked_or_safepoint(CodeCache_lock);
|
||||
|
||||
@ -239,9 +227,8 @@ void ScavengableNMethods::mark_on_list_nmethods() {
|
||||
}
|
||||
}
|
||||
|
||||
// If the closure is given, run it on the unlisted nmethods.
|
||||
// Also make sure that the effects of mark_on_list_nmethods is gone.
|
||||
void ScavengableNMethods::verify_unlisted_nmethods(CodeBlobClosure* cl) {
|
||||
// Make sure that the effects of mark_on_list_nmethods is gone.
|
||||
void ScavengableNMethods::verify_nmethods() {
|
||||
NMethodIterator iter(NMethodIterator::all_blobs);
|
||||
while(iter.next()) {
|
||||
nmethod* nm = iter.method();
|
||||
@ -250,10 +237,6 @@ void ScavengableNMethods::verify_unlisted_nmethods(CodeBlobClosure* cl) {
|
||||
if (!nm->is_unlinked()) {
|
||||
verify_nmethod(nm);
|
||||
}
|
||||
|
||||
if (cl != nullptr && !gc_data(nm).on_list()) {
|
||||
cl->do_code_blob(nm);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -55,8 +55,6 @@ public:
|
||||
// Remove nmethods that no longer have scavengable oops.
|
||||
static void nmethods_do(CodeBlobToOopClosure* cl);
|
||||
|
||||
static void asserted_non_scavengable_nmethods_do(CodeBlobClosure* cl) PRODUCT_RETURN;
|
||||
|
||||
private:
|
||||
static void nmethods_do_and_prune(CodeBlobToOopClosure* cl);
|
||||
static void unlist_nmethod(nmethod* nm, nmethod* prev);
|
||||
@ -64,7 +62,7 @@ private:
|
||||
static bool has_scavengable_oops(nmethod* nm);
|
||||
|
||||
static void mark_on_list_nmethods() PRODUCT_RETURN;
|
||||
static void verify_unlisted_nmethods(CodeBlobClosure* cl) PRODUCT_RETURN;
|
||||
static void verify_nmethods() PRODUCT_RETURN;
|
||||
};
|
||||
|
||||
#endif // SHARE_GC_SHARED_SCAVENGABLENMETHODS_HPP
|
||||
|
Loading…
Reference in New Issue
Block a user