mirror of
https://github.com/openjdk/jdk.git
synced 2025-08-28 15:24:43 +02:00
8077415: Remove duplicate variables holding the CollectedHeap
Reviewed-by: stefank, kbarrett
This commit is contained in:
parent
beede94977
commit
82de4945ac
8 changed files with 21 additions and 42 deletions
|
@ -410,10 +410,6 @@ bool G1CollectedHeap::is_scavengable(const void* p) {
|
|||
return !hr->is_humongous();
|
||||
}
|
||||
|
||||
// Private class members.
|
||||
|
||||
G1CollectedHeap* G1CollectedHeap::_g1h;
|
||||
|
||||
// Private methods.
|
||||
|
||||
HeapRegion*
|
||||
|
@ -1769,14 +1765,12 @@ G1CollectedHeap::G1CollectedHeap(G1CollectorPolicy* policy_) :
|
|||
_gc_tracer_stw(new (ResourceObj::C_HEAP, mtGC) G1NewTracer()),
|
||||
_gc_tracer_cm(new (ResourceObj::C_HEAP, mtGC) G1OldTracer()) {
|
||||
|
||||
_g1h = this;
|
||||
|
||||
_workers = new FlexibleWorkGang("GC Thread", ParallelGCThreads,
|
||||
/* are_GC_task_threads */true,
|
||||
/* are_ConcurrentGC_threads */false);
|
||||
_workers->initialize_workers();
|
||||
|
||||
_allocator = G1Allocator::create_allocator(_g1h);
|
||||
_allocator = G1Allocator::create_allocator(this);
|
||||
_humongous_object_threshold_in_words = HeapRegion::GrainWords / 2;
|
||||
|
||||
int n_queues = MAX2((int)ParallelGCThreads, 1);
|
||||
|
@ -1939,8 +1933,6 @@ jint G1CollectedHeap::initialize() {
|
|||
|
||||
_bot_shared = new G1BlockOffsetSharedArray(reserved_region(), bot_storage);
|
||||
|
||||
_g1h = this;
|
||||
|
||||
{
|
||||
HeapWord* start = _hrm.reserved().start();
|
||||
HeapWord* end = _hrm.reserved().end();
|
||||
|
@ -3320,9 +3312,10 @@ void G1CollectedHeap::print_all_rsets() {
|
|||
#endif // PRODUCT
|
||||
|
||||
G1CollectedHeap* G1CollectedHeap::heap() {
|
||||
assert(_g1h != NULL, "Uninitialized access to G1CollectedHeap::heap()");
|
||||
assert(_g1h->kind() == CollectedHeap::G1CollectedHeap, "Not a G1 heap");
|
||||
return _g1h;
|
||||
CollectedHeap* heap = Universe::heap();
|
||||
assert(heap != NULL, "Uninitialized access to G1CollectedHeap::heap()");
|
||||
assert(heap->kind() == CollectedHeap::G1CollectedHeap, "Not a G1CollectedHeap");
|
||||
return (G1CollectedHeap*)heap;
|
||||
}
|
||||
|
||||
void G1CollectedHeap::gc_prologue(bool full /* Ignored */) {
|
||||
|
@ -4877,7 +4870,7 @@ void G1CollectedHeap::parallel_cleaning(BoolObjectClosure* is_alive,
|
|||
void G1CollectedHeap::unlink_string_and_symbol_table(BoolObjectClosure* is_alive,
|
||||
bool process_strings, bool process_symbols) {
|
||||
{
|
||||
uint n_workers = _g1h->workers()->active_workers();
|
||||
uint n_workers = workers()->active_workers();
|
||||
G1StringSymbolTableUnlinkTask g1_unlink_task(is_alive, process_strings, process_symbols);
|
||||
set_par_threads(n_workers);
|
||||
workers()->run_task(&g1_unlink_task);
|
||||
|
@ -4909,7 +4902,7 @@ class G1RedirtyLoggedCardsTask : public AbstractGangTask {
|
|||
void G1CollectedHeap::redirty_logged_cards() {
|
||||
double redirty_logged_cards_start = os::elapsedTime();
|
||||
|
||||
uint n_workers = _g1h->workers()->active_workers();
|
||||
uint n_workers = workers()->active_workers();
|
||||
|
||||
G1RedirtyLoggedCardsTask redirty_task(&dirty_card_queue_set());
|
||||
dirty_card_queue_set().reset_for_par_iteration();
|
||||
|
@ -5342,7 +5335,7 @@ void G1CollectedHeap::process_discovered_references(uint no_of_gc_workers) {
|
|||
|
||||
OopClosure* copy_non_heap_cl = &only_copy_non_heap_cl;
|
||||
|
||||
if (_g1h->g1_policy()->during_initial_mark_pause()) {
|
||||
if (g1_policy()->during_initial_mark_pause()) {
|
||||
// We also need to mark copied objects.
|
||||
copy_non_heap_cl = ©_mark_non_heap_cl;
|
||||
}
|
||||
|
@ -6097,12 +6090,12 @@ void G1CollectedHeap::eagerly_reclaim_humongous_regions() {
|
|||
HeapRegionSetCount empty_set;
|
||||
remove_from_old_sets(empty_set, cl.humongous_free_count());
|
||||
|
||||
G1HRPrinter* hr_printer = _g1h->hr_printer();
|
||||
if (hr_printer->is_active()) {
|
||||
G1HRPrinter* hrp = hr_printer();
|
||||
if (hrp->is_active()) {
|
||||
FreeRegionListIterator iter(&local_cleanup_list);
|
||||
while (iter.more_available()) {
|
||||
HeapRegion* hr = iter.get_next();
|
||||
hr_printer->cleanup(hr);
|
||||
hrp->cleanup(hr);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -202,9 +202,6 @@ class G1CollectedHeap : public CollectedHeap {
|
|||
friend class G1CheckCSetFastTableClosure;
|
||||
|
||||
private:
|
||||
// The one and only G1CollectedHeap, so static functions can find it.
|
||||
static G1CollectedHeap* _g1h;
|
||||
|
||||
FlexibleWorkGang* _workers;
|
||||
|
||||
static size_t _humongous_object_threshold_in_words;
|
||||
|
|
|
@ -49,7 +49,6 @@ PSYoungGen* ParallelScavengeHeap::_young_gen = NULL;
|
|||
PSOldGen* ParallelScavengeHeap::_old_gen = NULL;
|
||||
PSAdaptiveSizePolicy* ParallelScavengeHeap::_size_policy = NULL;
|
||||
PSGCAdaptivePolicyCounters* ParallelScavengeHeap::_gc_policy_counters = NULL;
|
||||
ParallelScavengeHeap* ParallelScavengeHeap::_psh = NULL;
|
||||
GCTaskManager* ParallelScavengeHeap::_gc_task_manager = NULL;
|
||||
|
||||
jint ParallelScavengeHeap::initialize() {
|
||||
|
@ -89,7 +88,6 @@ jint ParallelScavengeHeap::initialize() {
|
|||
double max_gc_pause_sec = ((double) MaxGCPauseMillis)/1000.0;
|
||||
double max_gc_minor_pause_sec = ((double) MaxGCMinorPauseMillis)/1000.0;
|
||||
|
||||
_psh = this;
|
||||
_gens = new AdjoiningGenerations(heap_rs, _collector_policy, generation_alignment());
|
||||
|
||||
_old_gen = _gens->old_gen();
|
||||
|
@ -634,9 +632,10 @@ void ParallelScavengeHeap::trace_heap(GCWhen::Type when, const GCTracer* gc_trac
|
|||
}
|
||||
|
||||
ParallelScavengeHeap* ParallelScavengeHeap::heap() {
|
||||
assert(_psh != NULL, "Uninitialized access to ParallelScavengeHeap::heap()");
|
||||
assert(_psh->kind() == CollectedHeap::ParallelScavengeHeap, "not a parallel scavenge heap");
|
||||
return _psh;
|
||||
CollectedHeap* heap = Universe::heap();
|
||||
assert(heap != NULL, "Uninitialized access to ParallelScavengeHeap::heap()");
|
||||
assert(heap->kind() == CollectedHeap::ParallelScavengeHeap, "Not a ParallelScavengeHeap");
|
||||
return (ParallelScavengeHeap*)heap;
|
||||
}
|
||||
|
||||
// Before delegating the resize to the young generation,
|
||||
|
|
|
@ -53,8 +53,6 @@ class ParallelScavengeHeap : public CollectedHeap {
|
|||
static PSAdaptiveSizePolicy* _size_policy;
|
||||
static PSGCAdaptivePolicyCounters* _gc_policy_counters;
|
||||
|
||||
static ParallelScavengeHeap* _psh;
|
||||
|
||||
GenerationSizer* _collector_policy;
|
||||
|
||||
// Collection of generations that are adjacent in the
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright (c) 2007, 2012, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2007, 2015, 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
|
||||
|
@ -61,7 +61,6 @@
|
|||
\
|
||||
static_field(ParallelScavengeHeap, _young_gen, PSYoungGen*) \
|
||||
static_field(ParallelScavengeHeap, _old_gen, PSOldGen*) \
|
||||
static_field(ParallelScavengeHeap, _psh, ParallelScavengeHeap*) \
|
||||
\
|
||||
|
||||
#define VM_TYPES_PARALLELGC(declare_type, \
|
||||
|
|
|
@ -59,7 +59,6 @@
|
|||
#include "gc_implementation/concurrentMarkSweep/vmCMSOperations.hpp"
|
||||
#endif // INCLUDE_ALL_GCS
|
||||
|
||||
GenCollectedHeap* GenCollectedHeap::_gch;
|
||||
NOT_PRODUCT(size_t GenCollectedHeap::_skip_header_HeapWords = 0;)
|
||||
|
||||
// The set of potentially parallel tasks in root scanning.
|
||||
|
@ -127,8 +126,6 @@ jint GenCollectedHeap::initialize() {
|
|||
_rem_set = collector_policy()->create_rem_set(reserved_region());
|
||||
set_barrier_set(rem_set()->bs());
|
||||
|
||||
_gch = this;
|
||||
|
||||
ReservedSpace young_rs = heap_rs.first_part(gen_policy()->young_gen_spec()->max_size(), false, false);
|
||||
_young_gen = gen_policy()->young_gen_spec()->init(young_rs, 0, rem_set());
|
||||
heap_rs = heap_rs.last_part(gen_policy()->young_gen_spec()->max_size());
|
||||
|
@ -1103,9 +1100,10 @@ void GenCollectedHeap::save_marks() {
|
|||
}
|
||||
|
||||
GenCollectedHeap* GenCollectedHeap::heap() {
|
||||
assert(_gch != NULL, "Uninitialized access to GenCollectedHeap::heap()");
|
||||
assert(_gch->kind() == CollectedHeap::GenCollectedHeap, "not a generational heap");
|
||||
return _gch;
|
||||
CollectedHeap* heap = Universe::heap();
|
||||
assert(heap != NULL, "Uninitialized access to GenCollectedHeap::heap()");
|
||||
assert(heap->kind() == CollectedHeap::GenCollectedHeap, "Not a GenCollectedHeap");
|
||||
return (GenCollectedHeap*)heap;
|
||||
}
|
||||
|
||||
void GenCollectedHeap::prepare_for_compaction() {
|
||||
|
|
|
@ -54,11 +54,7 @@ class GenCollectedHeap : public CollectedHeap {
|
|||
public:
|
||||
friend class VM_PopulateDumpSharedSpace;
|
||||
|
||||
protected:
|
||||
// Fields:
|
||||
static GenCollectedHeap* _gch;
|
||||
|
||||
private:
|
||||
private:
|
||||
Generation* _young_gen;
|
||||
Generation* _old_gen;
|
||||
|
||||
|
|
|
@ -555,7 +555,6 @@ typedef CompactHashtable<Symbol*, char> SymbolCompactHashTable;
|
|||
nonstatic_field(GenerationSpec, _init_size, size_t) \
|
||||
nonstatic_field(GenerationSpec, _max_size, size_t) \
|
||||
\
|
||||
static_field(GenCollectedHeap, _gch, GenCollectedHeap*) \
|
||||
nonstatic_field(GenCollectedHeap, _young_gen, Generation*) \
|
||||
nonstatic_field(GenCollectedHeap, _old_gen, Generation*) \
|
||||
\
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue