src/share/vm/gc_implementation/g1/g1CollectedHeap.cpp
Print this page
rev 5920 : 8035406: Improve data structure for Code Cache remembered sets
Summary: Change the code cache remembered sets data structure from a GrowableArray to a chunked list of nmethods. This makes the data structure more amenable to parallelization, and decreases freeing time.
Reviewed-by:
@@ -5902,10 +5902,12 @@
// the collection set. Ideally we would like to do this
// after we have finished the scanning/evacuation of the
// strong code roots for a particular heap region.
migrate_strong_code_roots();
+ purge_code_root_memory();
+
if (g1_policy()->during_initial_mark_pause()) {
// Reset the claim values set during marking the strong code roots
reset_heap_region_claim_values();
}
@@ -6806,10 +6808,17 @@
collection_set_iterate(&cl);
double migration_time_ms = (os::elapsedTime() - migrate_start) * 1000.0;
g1_policy()->phase_times()->record_strong_code_root_migration_time(migration_time_ms);
}
+void G1CollectedHeap::purge_code_root_memory() {
+ double purge_start = os::elapsedTime();
+ G1CodeRootSet::purge_chunks(G1CodeRootsChunkCacheKeepPercent);
+ double purge_time_ms = (os::elapsedTime() - purge_start) * 1000.0;
+ g1_policy()->phase_times()->record_strong_code_root_purge_time(purge_time_ms);
+}
+
// Mark all the code roots that point into regions *not* in the
// collection set.
//
// Note we do not want to use a "marking" CodeBlobToOopClosure while
// walking the the code roots lists of regions not in the collection
@@ -6876,11 +6885,11 @@
HeapRegionRemSet* hrrs = hr->rem_set();
if (hr->continuesHumongous()) {
// Code roots should never be attached to a continuation of a humongous region
assert(hrrs->strong_code_roots_list_length() == 0,
err_msg("code roots should never be attached to continuations of humongous region "HR_FORMAT
- " starting at "HR_FORMAT", but has "INT32_FORMAT,
+ " starting at "HR_FORMAT", but has "SIZE_FORMAT,
HR_FORMAT_PARAMS(hr), HR_FORMAT_PARAMS(hr->humongous_start_region()),
hrrs->strong_code_roots_list_length()));
return false;
}