8076452: Remove SharedHeap

Reviewed-by: stefank, sjohanss, david
This commit is contained in:
Bengt Rutisson 2015-04-02 16:08:41 +02:00
parent 7c5c5d80b7
commit d2f816a875
27 changed files with 68 additions and 220 deletions

View file

@ -29,9 +29,9 @@ import java.util.Observable;
import java.util.Observer;
import sun.jvm.hotspot.debugger.Address;
import sun.jvm.hotspot.gc_interface.CollectedHeap;
import sun.jvm.hotspot.gc_interface.CollectedHeapName;
import sun.jvm.hotspot.memory.MemRegion;
import sun.jvm.hotspot.memory.SharedHeap;
import sun.jvm.hotspot.memory.SpaceClosure;
import sun.jvm.hotspot.runtime.VM;
import sun.jvm.hotspot.runtime.VMObjectFactory;
@ -41,7 +41,7 @@ import sun.jvm.hotspot.types.TypeDataBase;
// Mirror class for G1CollectedHeap.
public class G1CollectedHeap extends SharedHeap {
public class G1CollectedHeap extends CollectedHeap {
// HeapRegionManager _hrm;
static private long hrmFieldOffset;
// MemRegion _g1_reserved;

View file

@ -32,7 +32,6 @@ public class CollectedHeapName {
private CollectedHeapName(String name) { this.name = name; }
public static final CollectedHeapName ABSTRACT = new CollectedHeapName("abstract");
public static final CollectedHeapName SHARED_HEAP = new CollectedHeapName("SharedHeap");
public static final CollectedHeapName GEN_COLLECTED_HEAP = new CollectedHeapName("GenCollectedHeap");
public static final CollectedHeapName G1_COLLECTED_HEAP = new CollectedHeapName("G1CollectedHeap");
public static final CollectedHeapName PARALLEL_SCAVENGE_HEAP = new CollectedHeapName("ParallelScavengeHeap");

View file

@ -33,7 +33,7 @@ import sun.jvm.hotspot.runtime.*;
import sun.jvm.hotspot.types.*;
import sun.jvm.hotspot.utilities.*;
public class GenCollectedHeap extends SharedHeap {
public class GenCollectedHeap extends CollectedHeap {
private static CIntegerField nGensField;
private static AddressField youngGenField;
private static AddressField oldGenField;

View file

@ -1,58 +0,0 @@
/*
* Copyright (c) 2002, 2012, 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
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*
*/
package sun.jvm.hotspot.memory;
import java.io.*;
import java.util.*;
import sun.jvm.hotspot.debugger.*;
import sun.jvm.hotspot.gc_interface.*;
import sun.jvm.hotspot.runtime.*;
import sun.jvm.hotspot.types.*;
public abstract class SharedHeap extends CollectedHeap {
private static VirtualConstructor ctor;
static {
VM.registerVMInitializedObserver(new Observer() {
public void update(Observable o, Object data) {
initialize(VM.getVM().getTypeDataBase());
}
});
}
private static synchronized void initialize(TypeDataBase db) {
Type type = db.lookupType("SharedHeap");
ctor = new VirtualConstructor(db);
}
public SharedHeap(Address addr) {
super(addr);
}
public CollectedHeapName kind() {
return CollectedHeapName.SHARED_HEAP;
}
}

View file

@ -81,53 +81,48 @@ public class HeapSummary extends Tool {
System.out.println();
System.out.println("Heap Usage:");
if (heap instanceof SharedHeap) {
SharedHeap sharedHeap = (SharedHeap) heap;
if (sharedHeap instanceof GenCollectedHeap) {
GenCollectedHeap genHeap = (GenCollectedHeap) sharedHeap;
for (int n = 0; n < genHeap.nGens(); n++) {
Generation gen = genHeap.getGen(n);
if (gen instanceof sun.jvm.hotspot.memory.DefNewGeneration) {
System.out.println("New Generation (Eden + 1 Survivor Space):");
printGen(gen);
if (heap instanceof GenCollectedHeap) {
GenCollectedHeap genHeap = (GenCollectedHeap) heap;
for (int n = 0; n < genHeap.nGens(); n++) {
Generation gen = genHeap.getGen(n);
if (gen instanceof sun.jvm.hotspot.memory.DefNewGeneration) {
System.out.println("New Generation (Eden + 1 Survivor Space):");
printGen(gen);
ContiguousSpace eden = ((DefNewGeneration)gen).eden();
System.out.println("Eden Space:");
printSpace(eden);
ContiguousSpace eden = ((DefNewGeneration)gen).eden();
System.out.println("Eden Space:");
printSpace(eden);
ContiguousSpace from = ((DefNewGeneration)gen).from();
System.out.println("From Space:");
printSpace(from);
ContiguousSpace from = ((DefNewGeneration)gen).from();
System.out.println("From Space:");
printSpace(from);
ContiguousSpace to = ((DefNewGeneration)gen).to();
System.out.println("To Space:");
printSpace(to);
} else {
System.out.println(gen.name() + ":");
printGen(gen);
}
ContiguousSpace to = ((DefNewGeneration)gen).to();
System.out.println("To Space:");
printSpace(to);
} else {
System.out.println(gen.name() + ":");
printGen(gen);
}
} else if (sharedHeap instanceof G1CollectedHeap) {
G1CollectedHeap g1h = (G1CollectedHeap) sharedHeap;
G1MonitoringSupport g1mm = g1h.g1mm();
long edenRegionNum = g1mm.edenRegionNum();
long survivorRegionNum = g1mm.survivorRegionNum();
HeapRegionSetBase oldSet = g1h.oldSet();
HeapRegionSetBase humongousSet = g1h.humongousSet();
long oldRegionNum = oldSet.count().length()
+ humongousSet.count().capacity() / HeapRegion.grainBytes();
printG1Space("G1 Heap:", g1h.n_regions(),
g1h.used(), g1h.capacity());
System.out.println("G1 Young Generation:");
printG1Space("Eden Space:", edenRegionNum,
g1mm.edenUsed(), g1mm.edenCommitted());
printG1Space("Survivor Space:", survivorRegionNum,
g1mm.survivorUsed(), g1mm.survivorCommitted());
printG1Space("G1 Old Generation:", oldRegionNum,
g1mm.oldUsed(), g1mm.oldCommitted());
} else {
throw new RuntimeException("unknown SharedHeap type : " + heap.getClass());
}
} else if (heap instanceof G1CollectedHeap) {
G1CollectedHeap g1h = (G1CollectedHeap) heap;
G1MonitoringSupport g1mm = g1h.g1mm();
long edenRegionNum = g1mm.edenRegionNum();
long survivorRegionNum = g1mm.survivorRegionNum();
HeapRegionSetBase oldSet = g1h.oldSet();
HeapRegionSetBase humongousSet = g1h.humongousSet();
long oldRegionNum = oldSet.count().length()
+ humongousSet.count().capacity() / HeapRegion.grainBytes();
printG1Space("G1 Heap:", g1h.n_regions(),
g1h.used(), g1h.capacity());
System.out.println("G1 Young Generation:");
printG1Space("Eden Space:", edenRegionNum,
g1mm.edenUsed(), g1mm.edenCommitted());
printG1Space("Survivor Space:", survivorRegionNum,
g1mm.survivorUsed(), g1mm.survivorCommitted());
printG1Space("G1 Old Generation:", oldRegionNum,
g1mm.oldUsed(), g1mm.oldCommitted());
} else if (heap instanceof ParallelScavengeHeap) {
ParallelScavengeHeap psh = (ParallelScavengeHeap) heap;
PSYoungGen youngGen = psh.youngGen();

View file

@ -25,8 +25,8 @@
#include "precompiled.hpp"
#include "gc_implementation/concurrentMarkSweep/adaptiveFreeList.hpp"
#include "gc_implementation/concurrentMarkSweep/freeChunk.hpp"
#include "gc_interface/collectedHeap.hpp"
#include "memory/freeBlockDictionary.hpp"
#include "memory/sharedHeap.hpp"
#include "runtime/globals.hpp"
#include "runtime/mutex.hpp"
#include "runtime/orderAccess.inline.hpp"

View file

@ -1728,7 +1728,7 @@ void G1CollectedHeap::shrink(size_t shrink_bytes) {
G1CollectedHeap::G1CollectedHeap(G1CollectorPolicy* policy_) :
SharedHeap(),
CollectedHeap(),
_g1_policy(policy_),
_dirty_card_queue_set(false),
_into_cset_dirty_card_queue_set(false),

View file

@ -40,9 +40,9 @@
#include "gc_implementation/g1/heapRegionSet.hpp"
#include "gc_implementation/shared/hSpaceCounters.hpp"
#include "gc_implementation/shared/parGCAllocBuffer.hpp"
#include "gc_interface/collectedHeap.hpp"
#include "memory/barrierSet.hpp"
#include "memory/memRegion.hpp"
#include "memory/sharedHeap.hpp"
#include "utilities/stack.hpp"
// A "G1CollectedHeap" is an implementation of a java heap for HotSpot.
@ -178,7 +178,7 @@ class G1RegionMappingChangedListener : public G1MappingChangedListener {
virtual void on_commit(uint start_idx, size_t num_regions, bool zero_filled);
};
class G1CollectedHeap : public SharedHeap {
class G1CollectedHeap : public CollectedHeap {
friend class VM_CollectForMetadataAllocation;
friend class VM_G1CollectForAllocation;
friend class VM_G1CollectFull;
@ -1011,7 +1011,7 @@ public:
void ref_processing_init();
// Explicitly import set_par_threads into this scope
using SharedHeap::set_par_threads;
using CollectedHeap::set_par_threads;
// Set _n_par_threads according to a policy TBD.
void set_par_threads();

View file

@ -25,8 +25,8 @@
#include "precompiled.hpp"
#include "gc_implementation/g1/g1CollectedHeap.inline.hpp"
#include "gc_implementation/g1/satbQueue.hpp"
#include "gc_interface/collectedHeap.hpp"
#include "memory/allocation.inline.hpp"
#include "memory/sharedHeap.hpp"
#include "oops/oop.inline.hpp"
#include "runtime/mutexLocker.hpp"
#include "runtime/thread.hpp"

View file

@ -70,7 +70,7 @@
\
declare_toplevel_type(G1HeapRegionTable) \
\
declare_type(G1CollectedHeap, SharedHeap) \
declare_type(G1CollectedHeap, CollectedHeap) \
\
declare_type(G1OffsetTableContigSpace, CompactibleSpace) \
declare_type(HeapRegion, G1OffsetTableContigSpace) \

View file

@ -23,10 +23,10 @@
*/
#include "precompiled.hpp"
#include "gc_interface/collectedHeap.hpp"
#include "memory/allocation.inline.hpp"
#include "memory/cardTableModRefBS.hpp"
#include "memory/cardTableRS.hpp"
#include "memory/sharedHeap.hpp"
#include "memory/space.inline.hpp"
#include "memory/universe.hpp"
#include "oops/oop.inline.hpp"

View file

@ -30,7 +30,7 @@
#include "gc_implementation/parallelScavenge/psCompactionManager.hpp"
#include "gc_implementation/shared/collectorCounters.hpp"
#include "gc_implementation/shared/mutableSpace.hpp"
#include "memory/sharedHeap.hpp"
#include "gc_interface/collectedHeap.hpp"
#include "oops/oop.hpp"
class ParallelScavengeHeap;

View file

@ -25,9 +25,9 @@
#include "precompiled.hpp"
#include "gc_implementation/shared/ageTable.hpp"
#include "gc_implementation/shared/gcPolicyCounters.hpp"
#include "gc_interface/collectedHeap.hpp"
#include "memory/collectorPolicy.hpp"
#include "memory/resourceArea.hpp"
#include "memory/sharedHeap.hpp"
#include "runtime/atomic.inline.hpp"
#include "utilities/copy.hpp"

View file

@ -26,7 +26,7 @@
#include "precompiled.hpp"
#include "gc_implementation/shared/mutableNUMASpace.hpp"
#include "gc_implementation/shared/spaceDecorator.hpp"
#include "memory/sharedHeap.hpp"
#include "gc_interface/collectedHeap.hpp"
#include "oops/oop.inline.hpp"
#include "runtime/atomic.inline.hpp"
#include "runtime/thread.inline.hpp"

View file

@ -75,9 +75,8 @@ class GCHeapLog : public EventLogBase<GCMessage> {
//
// CollectedHeap
// SharedHeap
// GenCollectedHeap
// G1CollectedHeap
// GenCollectedHeap
// G1CollectedHeap
// ParallelScavengeHeap
//
class CollectedHeap : public CHeapObj<mtInternal> {

View file

@ -23,11 +23,11 @@
*/
#include "precompiled.hpp"
#include "gc_interface/collectedHeap.hpp"
#include "memory/allocation.inline.hpp"
#include "memory/cardTableModRefBS.inline.hpp"
#include "memory/cardTableRS.hpp"
#include "memory/genCollectedHeap.hpp"
#include "memory/sharedHeap.hpp"
#include "memory/space.hpp"
#include "memory/space.inline.hpp"
#include "memory/universe.hpp"
@ -451,14 +451,13 @@ void CardTableModRefBS::non_clean_card_iterate_possibly_parallel(Space* sp,
// This is an example of where n_par_threads() is used instead
// of workers()->active_workers(). n_par_threads can be set to 0 to
// turn off parallelism. For example when this code is called as
// part of verification and SharedHeap::process_roots() is being
// used, then n_par_threads() may have been set to 0. active_workers
// is not overloaded with the meaning that it is a switch to disable
// parallelism and so keeps the meaning of the number of
// active gc workers. If parallelism has not been shut off by
// setting n_par_threads to 0, then n_par_threads should be
// equal to active_workers. When a different mechanism for shutting
// off parallelism is used, then active_workers can be used in
// part of verification during root processing then n_par_threads()
// may have been set to 0. active_workers is not overloaded with
// the meaning that it is a switch to disable parallelism and so keeps
// the meaning of the number of active gc workers. If parallelism has
// not been shut off by setting n_par_threads to 0, then n_par_threads
// should be equal to active_workers. When a different mechanism for
// shutting off parallelism is used, then active_workers can be used in
// place of n_par_threads.
int n_threads = GenCollectedHeap::heap()->n_par_threads();
bool is_par = n_threads > 0;

View file

@ -23,10 +23,10 @@
*/
#include "precompiled.hpp"
#include "gc_interface/collectedHeap.hpp"
#include "memory/freeBlockDictionary.hpp"
#include "memory/freeList.hpp"
#include "memory/metachunk.hpp"
#include "memory/sharedHeap.hpp"
#include "runtime/globals.hpp"
#include "runtime/mutex.hpp"
#include "runtime/vmThread.hpp"

View file

@ -23,9 +23,9 @@
*/
#include "precompiled.hpp"
#include "gc_interface/collectedHeap.hpp"
#include "memory/gcLocker.inline.hpp"
#include "memory/resourceArea.hpp"
#include "memory/sharedHeap.hpp"
#include "runtime/atomic.inline.hpp"
#include "runtime/thread.inline.hpp"

View file

@ -78,7 +78,7 @@ enum GCH_strong_roots_tasks {
};
GenCollectedHeap::GenCollectedHeap(GenCollectorPolicy *policy) :
SharedHeap(),
CollectedHeap(),
_rem_set(NULL),
_gen_policy(policy),
_process_strong_tasks(new SubTasksDone(GCH_PS_NumElements)),

View file

@ -26,16 +26,16 @@
#define SHARE_VM_MEMORY_GENCOLLECTEDHEAP_HPP
#include "gc_implementation/shared/adaptiveSizePolicy.hpp"
#include "gc_interface/collectedHeap.hpp"
#include "memory/collectorPolicy.hpp"
#include "memory/generation.hpp"
#include "memory/sharedHeap.hpp"
class SubTasksDone;
class FlexibleWorkGang;
// A "GenCollectedHeap" is a SharedHeap that uses generational
// A "GenCollectedHeap" is a CollectedHeap that uses generational
// collection. It has two generations, young and old.
class GenCollectedHeap : public SharedHeap {
class GenCollectedHeap : public CollectedHeap {
friend class GenCollectorPolicy;
friend class Generation;
friend class DefNewGeneration;

View file

@ -31,7 +31,6 @@
#include "memory/genOopClosures.hpp"
#include "memory/genRemSet.hpp"
#include "memory/generation.hpp"
#include "memory/sharedHeap.hpp"
#include "memory/space.hpp"
inline OopsInGenClosure::OopsInGenClosure(Generation* gen) :

View file

@ -151,7 +151,6 @@ class CLDToOopClosure : public CLDClosure {
};
class CLDToKlassAndOopClosure : public CLDClosure {
friend class SharedHeap;
friend class G1CollectedHeap;
protected:
OopClosure* _oop_closure;

View file

@ -1,31 +0,0 @@
/*
* Copyright (c) 2000, 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
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*
*/
#include "precompiled.hpp"
#include "gc_interface/collectedHeap.hpp"
#include "memory/sharedHeap.hpp"
SharedHeap::SharedHeap() :
CollectedHeap()
{}

View file

@ -1,39 +0,0 @@
/*
* Copyright (c) 2000, 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
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*
*/
#ifndef SHARE_VM_MEMORY_SHAREDHEAP_HPP
#define SHARE_VM_MEMORY_SHAREDHEAP_HPP
#include "gc_interface/collectedHeap.hpp"
class SharedHeap : public CollectedHeap {
friend class VMStructs;
protected:
// Full initialization is done in a concrete subtype's "initialize"
// function.
SharedHeap();
};
#endif // SHARE_VM_MEMORY_SHAREDHEAP_HPP

View file

@ -132,7 +132,6 @@
# include "memory/referencePolicy.hpp"
# include "memory/referenceProcessor.hpp"
# include "memory/resourceArea.hpp"
# include "memory/sharedHeap.hpp"
# include "memory/space.hpp"
# include "memory/threadLocalAllocBuffer.hpp"
# include "memory/threadLocalAllocBuffer.inline.hpp"

View file

@ -1501,8 +1501,7 @@ typedef CompactHashtable<Symbol*, char> SymbolCompactHashTable;
/******************************************/ \
\
declare_toplevel_type(CollectedHeap) \
declare_type(SharedHeap, CollectedHeap) \
declare_type(GenCollectedHeap, SharedHeap) \
declare_type(GenCollectedHeap, CollectedHeap) \
declare_toplevel_type(Generation) \
declare_type(DefNewGeneration, Generation) \
declare_type(CardGeneration, Generation) \

View file

@ -340,18 +340,6 @@ class FlexibleWorkGang: public WorkGang {
}
};
// Work gangs in garbage collectors: 2009-06-10
//
// SharedHeap - work gang for stop-the-world parallel collection.
// Used by
// ParNewGeneration
// CMSParRemarkTask
// CMSRefProcTaskExecutor
// G1CollectedHeap
// G1ParFinalCountTask
// ConcurrentMark
// CMSCollector
// A class that acts as a synchronisation barrier. Workers enter
// the barrier and must wait until all other workers have entered
// before any of them may leave.