7059019: G1: add G1 support to the SA
Summary: Extend the SA to recognize the G1CollectedHeap and implement any code that's needed by our serviceability tools (jmap, jinfo, jstack, etc.) that depend on the SA.
Reviewed-by: never, poonam, johnc
--- a/hotspot/agent/make/Makefile Fri Sep 16 21:35:06 2011 -0700
+++ b/hotspot/agent/make/Makefile Tue Sep 20 09:59:59 2011 -0400
@@ -1,5 +1,5 @@
#
-# Copyright (c) 2000, 2008, Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 2000, 2011, 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
@@ -81,6 +81,7 @@
sun.jvm.hotspot.debugger.windbg.x86 \
sun.jvm.hotspot.debugger.x86 \
sun.jvm.hotspot.gc_implementation \
+sun.jvm.hotspot.gc_implementation.g1 \
sun.jvm.hotspot.gc_implementation.parallelScavenge \
sun.jvm.hotspot.gc_implementation.shared \
sun.jvm.hotspot.gc_interface \
@@ -167,6 +168,9 @@
sun/jvm/hotspot/debugger/windbg/ia64/*.java \
sun/jvm/hotspot/debugger/windbg/x86/*.java \
sun/jvm/hotspot/debugger/x86/*.java \
+sun/jvm/hotspot/gc_implementation/g1/*.java \
+sun/jvm/hotspot/gc_implementation/parallelScavenge/*.java \
+sun/jvm/hotspot/gc_implementation/shared/*.java \
sun/jvm/hotspot/interpreter/*.java \
sun/jvm/hotspot/jdi/*.java \
sun/jvm/hotspot/livejvm/*.java \
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/hotspot/agent/src/share/classes/sun/jvm/hotspot/gc_implementation/g1/G1CollectedHeap.java Tue Sep 20 09:59:59 2011 -0400
@@ -0,0 +1,107 @@
+/*
+ * Copyright (c) 2011, 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.gc_implementation.g1;
+
+import java.util.Iterator;
+import java.util.Observable;
+import java.util.Observer;
+
+import sun.jvm.hotspot.debugger.Address;
+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;
+import sun.jvm.hotspot.types.CIntegerField;
+import sun.jvm.hotspot.types.Type;
+import sun.jvm.hotspot.types.TypeDataBase;
+
+// Mirror class for G1CollectedHeap.
+
+public class G1CollectedHeap extends SharedHeap {
+ // HeapRegionSeq _seq;
+ static private long hrsFieldOffset;
+ // MemRegion _g1_committed;
+ static private long g1CommittedFieldOffset;
+ // size_t _summary_bytes_used;
+ static private CIntegerField summaryBytesUsedField;
+
+ static {
+ VM.registerVMInitializedObserver(new Observer() {
+ public void update(Observable o, Object data) {
+ initialize(VM.getVM().getTypeDataBase());
+ }
+ });
+ }
+
+ static private synchronized void initialize(TypeDataBase db) {
+ Type type = db.lookupType("G1CollectedHeap");
+
+ hrsFieldOffset = type.getField("_hrs").getOffset();
+ g1CommittedFieldOffset = type.getField("_g1_committed").getOffset();
+ summaryBytesUsedField = type.getCIntegerField("_summary_bytes_used");
+ }
+
+ public long capacity() {
+ Address g1CommittedAddr = addr.addOffsetTo(g1CommittedFieldOffset);
+ MemRegion g1_committed = new MemRegion(g1CommittedAddr);
+ return g1_committed.byteSize();
+ }
+
+ public long used() {
+ return summaryBytesUsedField.getValue(addr);
+ }
+
+ public long n_regions() {
+ return hrs().length();
+ }
+
+ private HeapRegionSeq hrs() {
+ Address hrsAddr = addr.addOffsetTo(hrsFieldOffset);
+ return (HeapRegionSeq) VMObjectFactory.newObject(HeapRegionSeq.class,
+ hrsAddr);
+ }
+
+ private Iterator<HeapRegion> heapRegionIterator() {
+ return hrs().heapRegionIterator();
+ }
+
+ public void heapRegionIterate(SpaceClosure scl) {
+ Iterator<HeapRegion> iter = heapRegionIterator();
+ while (iter.hasNext()) {
+ HeapRegion hr = iter.next();
+ scl.doSpace(hr);
+ }
+ }
+
+ public CollectedHeapName kind() {
+ return CollectedHeapName.G1_COLLECTED_HEAP;
+ }
+
+ public G1CollectedHeap(Address addr) {
+ super(addr);
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/hotspot/agent/src/share/classes/sun/jvm/hotspot/gc_implementation/g1/HeapRegion.java Tue Sep 20 09:59:59 2011 -0400
@@ -0,0 +1,66 @@
+/*
+ * Copyright (c) 2011, 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.gc_implementation.g1;
+
+import java.util.Observable;
+import java.util.Observer;
+
+import sun.jvm.hotspot.debugger.Address;
+import sun.jvm.hotspot.memory.ContiguousSpace;
+import sun.jvm.hotspot.runtime.VM;
+import sun.jvm.hotspot.types.CIntegerField;
+import sun.jvm.hotspot.types.Type;
+import sun.jvm.hotspot.types.TypeDataBase;
+
+// Mirror class for HeapRegion. Currently we don't actually include
+// any of its fields but only iterate over it (which we get "for free"
+// as HeapRegion ultimately inherits from ContiguousSpace).
+
+public class HeapRegion extends ContiguousSpace {
+ // static int GrainBytes;
+ static private CIntegerField grainBytesField;
+
+ static {
+ VM.registerVMInitializedObserver(new Observer() {
+ public void update(Observable o, Object data) {
+ initialize(VM.getVM().getTypeDataBase());
+ }
+ });
+ }
+
+ static private synchronized void initialize(TypeDataBase db) {
+ Type type = db.lookupType("HeapRegion");
+
+ grainBytesField = type.getCIntegerField("GrainBytes");
+ }
+
+ static public long grainBytes() {
+ return grainBytesField.getValue();
+ }
+
+ public HeapRegion(Address addr) {
+ super(addr);
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/hotspot/agent/src/share/classes/sun/jvm/hotspot/gc_implementation/g1/HeapRegionSeq.java Tue Sep 20 09:59:59 2011 -0400
@@ -0,0 +1,102 @@
+/*
+ * Copyright (c) 2011, 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.gc_implementation.g1;
+
+import java.util.Iterator;
+import java.util.Observable;
+import java.util.Observer;
+
+import sun.jvm.hotspot.debugger.Address;
+import sun.jvm.hotspot.runtime.VM;
+import sun.jvm.hotspot.runtime.VMObject;
+import sun.jvm.hotspot.runtime.VMObjectFactory;
+import sun.jvm.hotspot.types.AddressField;
+import sun.jvm.hotspot.types.CIntegerField;
+import sun.jvm.hotspot.types.Type;
+import sun.jvm.hotspot.types.TypeDataBase;
+
+// Mirror class for HeapRegionSeq. It's essentially an index -> HeapRegion map.
+
+public class HeapRegionSeq extends VMObject {
+ // HeapRegion** _regions;
+ static private AddressField regionsField;
+ // size_t _length;
+ static private CIntegerField lengthField;
+
+ static {
+ VM.registerVMInitializedObserver(new Observer() {
+ public void update(Observable o, Object data) {
+ initialize(VM.getVM().getTypeDataBase());
+ }
+ });
+ }
+
+ static private synchronized void initialize(TypeDataBase db) {
+ Type type = db.lookupType("HeapRegionSeq");
+
+ regionsField = type.getAddressField("_regions");
+ lengthField = type.getCIntegerField("_length");
+ }
+
+ private HeapRegion at(long index) {
+ Address arrayAddr = regionsField.getValue(addr);
+ // Offset of &_region[index]
+ long offset = index * VM.getVM().getAddressSize();
+ Address regionAddr = arrayAddr.getAddressAt(offset);
+ return (HeapRegion) VMObjectFactory.newObject(HeapRegion.class,
+ regionAddr);
+ }
+
+ public long length() {
+ return lengthField.getValue(addr);
+ }
+
+ private class HeapRegionIterator implements Iterator<HeapRegion> {
+ private long index;
+ private long length;
+
+ @Override
+ public boolean hasNext() { return index < length; }
+
+ @Override
+ public HeapRegion next() { return at(index++); }
+
+ @Override
+ public void remove() { /* not supported */ }
+
+ HeapRegionIterator(Address addr) {
+ index = 0;
+ length = length();
+ }
+ }
+
+ public Iterator<HeapRegion> heapRegionIterator() {
+ return new HeapRegionIterator(addr);
+ }
+
+ public HeapRegionSeq(Address addr) {
+ super(addr);
+ }
+}
--- a/hotspot/agent/src/share/classes/sun/jvm/hotspot/gc_interface/CollectedHeapName.java Fri Sep 16 21:35:06 2011 -0700
+++ b/hotspot/agent/src/share/classes/sun/jvm/hotspot/gc_interface/CollectedHeapName.java Tue Sep 20 09:59:59 2011 -0400
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2000, 2003, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2000, 2011, 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
@@ -34,6 +34,7 @@
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");
public String toString() {
--- a/hotspot/agent/src/share/classes/sun/jvm/hotspot/memory/Universe.java Fri Sep 16 21:35:06 2011 -0700
+++ b/hotspot/agent/src/share/classes/sun/jvm/hotspot/memory/Universe.java Tue Sep 20 09:59:59 2011 -0400
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2000, 2009, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2000, 2011, 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
@@ -28,6 +28,7 @@
import java.util.*;
import sun.jvm.hotspot.debugger.*;
import sun.jvm.hotspot.gc_interface.*;
+import sun.jvm.hotspot.gc_implementation.g1.G1CollectedHeap;
import sun.jvm.hotspot.gc_implementation.parallelScavenge.*;
import sun.jvm.hotspot.oops.*;
import sun.jvm.hotspot.types.*;
@@ -72,6 +73,7 @@
heapConstructor = new VirtualConstructor(db);
heapConstructor.addMapping("GenCollectedHeap", GenCollectedHeap.class);
heapConstructor.addMapping("ParallelScavengeHeap", ParallelScavengeHeap.class);
+ heapConstructor.addMapping("G1CollectedHeap", G1CollectedHeap.class);
mainThreadGroupField = type.getOopField("_main_thread_group");
systemThreadGroupField = type.getOopField("_system_thread_group");
--- a/hotspot/agent/src/share/classes/sun/jvm/hotspot/oops/ObjectHeap.java Fri Sep 16 21:35:06 2011 -0700
+++ b/hotspot/agent/src/share/classes/sun/jvm/hotspot/oops/ObjectHeap.java Tue Sep 20 09:59:59 2011 -0400
@@ -33,6 +33,7 @@
import sun.jvm.hotspot.debugger.*;
import sun.jvm.hotspot.gc_interface.*;
+import sun.jvm.hotspot.gc_implementation.g1.*;
import sun.jvm.hotspot.gc_implementation.parallelScavenge.*;
import sun.jvm.hotspot.memory.*;
import sun.jvm.hotspot.runtime.*;
@@ -514,9 +515,16 @@
private void addPermGenLiveRegions(List output, CollectedHeap heap) {
LiveRegionsCollector lrc = new LiveRegionsCollector(output);
- if (heap instanceof GenCollectedHeap) {
- GenCollectedHeap genHeap = (GenCollectedHeap) heap;
- Generation gen = genHeap.permGen();
+ if (heap instanceof SharedHeap) {
+ if (Assert.ASSERTS_ENABLED) {
+ Assert.that(heap instanceof GenCollectedHeap ||
+ heap instanceof G1CollectedHeap,
+ "Expecting GenCollectedHeap or G1CollectedHeap, " +
+ "but got " + heap.getClass().getName());
+ }
+ // Handles both GenCollectedHeap and G1CollectedHeap
+ SharedHeap sharedHeap = (SharedHeap) heap;
+ Generation gen = sharedHeap.permGen();
gen.spaceIterate(lrc, true);
} else if (heap instanceof ParallelScavengeHeap) {
ParallelScavengeHeap psh = (ParallelScavengeHeap) heap;
@@ -524,8 +532,9 @@
addLiveRegions(permGen.objectSpace().getLiveRegions(), output);
} else {
if (Assert.ASSERTS_ENABLED) {
- Assert.that(false, "Expecting GenCollectedHeap or ParallelScavengeHeap, but got " +
- heap.getClass().getName());
+ Assert.that(false,
+ "Expecting SharedHeap or ParallelScavengeHeap, " +
+ "but got " + heap.getClass().getName());
}
}
}
@@ -588,10 +597,14 @@
addLiveRegions(youngGen.fromSpace().getLiveRegions(), liveRegions);
PSOldGen oldGen = psh.oldGen();
addLiveRegions(oldGen.objectSpace().getLiveRegions(), liveRegions);
+ } else if (heap instanceof G1CollectedHeap) {
+ G1CollectedHeap g1h = (G1CollectedHeap) heap;
+ g1h.heapRegionIterate(lrc);
} else {
if (Assert.ASSERTS_ENABLED) {
- Assert.that(false, "Expecting GenCollectedHeap or ParallelScavengeHeap, but got " +
- heap.getClass().getName());
+ Assert.that(false, "Expecting GenCollectedHeap, G1CollectedHeap, " +
+ "or ParallelScavengeHeap, but got " +
+ heap.getClass().getName());
}
}
--- a/hotspot/agent/src/share/classes/sun/jvm/hotspot/tools/HeapSummary.java Fri Sep 16 21:35:06 2011 -0700
+++ b/hotspot/agent/src/share/classes/sun/jvm/hotspot/tools/HeapSummary.java Tue Sep 20 09:59:59 2011 -0400
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2003, 2008, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 2011, 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
@@ -26,11 +26,11 @@
import java.util.*;
import sun.jvm.hotspot.gc_interface.*;
+import sun.jvm.hotspot.gc_implementation.g1.*;
import sun.jvm.hotspot.gc_implementation.parallelScavenge.*;
import sun.jvm.hotspot.gc_implementation.shared.*;
import sun.jvm.hotspot.memory.*;
import sun.jvm.hotspot.runtime.*;
-import sun.jvm.hotspot.tools.*;
public class HeapSummary extends Tool {
@@ -70,32 +70,50 @@
System.out.println();
System.out.println("Heap Usage:");
- 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);
+ 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);
- 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);
+ }
+ }
+ } else if (sharedHeap instanceof G1CollectedHeap) {
+ G1CollectedHeap g1h = (G1CollectedHeap) sharedHeap;
- ContiguousSpace to = ((DefNewGeneration)gen).to();
- System.out.println("To Space:");
- printSpace(to);
- } else {
- System.out.println(gen.name() + ":");
- printGen(gen);
- }
+ System.out.println("Garbage-First (G1) Heap");
+ long capacityBytes = g1h.capacity();
+ long usedBytes = g1h.used();
+ long freeBytes = capacityBytes - usedBytes;
+ printValMB("region size = ", HeapRegion.grainBytes());
+ printValue("regions = ", g1h.n_regions());
+ printValMB("capacity = ", capacityBytes);
+ printValMB("used = ", usedBytes);
+ printValMB("free = ", freeBytes);
+ System.out.println(alignment + (double) usedBytes * 100.0 / capacityBytes + "% used");
+ } else {
+ throw new RuntimeException("unknown SharedHeap type : " + heap.getClass());
}
- // Perm generation
- Generation permGen = genHeap.permGen();
+ // Perm generation shared by the above
+ Generation permGen = sharedHeap.permGen();
System.out.println("Perm Generation:");
printGen(permGen);
} else if (heap instanceof ParallelScavengeHeap) {
@@ -119,7 +137,7 @@
printValMB("free = ", permFree);
System.out.println(alignment + (double)permGen.used() * 100.0 / permGen.capacity() + "% used");
} else {
- throw new RuntimeException("unknown heap type : " + heap.getClass());
+ throw new RuntimeException("unknown CollectedHeap type : " + heap.getClass());
}
}
@@ -151,6 +169,14 @@
return;
}
+ l = getFlagValue("UseG1GC", flagMap);
+ if (l == 1L) {
+ System.out.print("Garbage-First (G1) GC ");
+ l = getFlagValue("ParallelGCThreads", flagMap);
+ System.out.println("with " + l + " thread(s)");
+ return;
+ }
+
System.out.println("Mark Sweep Compact GC");
}
--- a/hotspot/make/sa.files Fri Sep 16 21:35:06 2011 -0700
+++ b/hotspot/make/sa.files Tue Sep 20 09:59:59 2011 -0400
@@ -1,5 +1,5 @@
#
-# Copyright (c) 2003, 2008, Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 2003, 2011, 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
@@ -79,6 +79,7 @@
$(AGENT_SRC_DIR)/sun/jvm/hotspot/debugger/windbg/ia64/*.java \
$(AGENT_SRC_DIR)/sun/jvm/hotspot/debugger/windbg/x86/*.java \
$(AGENT_SRC_DIR)/sun/jvm/hotspot/debugger/x86/*.java \
+$(AGENT_SRC_DIR)/sun/jvm/hotspot/gc_implementation/g1/*.java \
$(AGENT_SRC_DIR)/sun/jvm/hotspot/gc_implementation/parallelScavenge/*.java \
$(AGENT_SRC_DIR)/sun/jvm/hotspot/gc_implementation/shared/*.java \
$(AGENT_SRC_DIR)/sun/jvm/hotspot/gc_interface/*.java \
--- a/hotspot/src/share/vm/gc_implementation/g1/heapRegionSeq.hpp Fri Sep 16 21:35:06 2011 -0700
+++ b/hotspot/src/share/vm/gc_implementation/g1/heapRegionSeq.hpp Tue Sep 20 09:59:59 2011 -0400
@@ -56,6 +56,7 @@
// and maintain that: _length <= _allocated_length <= _max_length
class HeapRegionSeq: public CHeapObj {
+ friend class VMStructs;
// The array that holds the HeapRegions.
HeapRegion** _regions;
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/hotspot/src/share/vm/gc_implementation/g1/vmStructs_g1.hpp Tue Sep 20 09:59:59 2011 -0400
@@ -0,0 +1,54 @@
+/*
+ * Copyright (c) 2011, 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_GC_IMPLEMENTATION_G1_VMSTRUCTS_G1_HPP
+#define SHARE_VM_GC_IMPLEMENTATION_G1_VMSTRUCTS_G1_HPP
+
+#include "gc_implementation/g1/heapRegion.hpp"
+#include "gc_implementation/g1/heapRegionSeq.inline.hpp"
+#include "gc_implementation/g1/g1CollectedHeap.inline.hpp"
+
+#define VM_STRUCTS_G1(nonstatic_field, static_field) \
+ \
+ static_field(HeapRegion, GrainBytes, int) \
+ \
+ nonstatic_field(HeapRegionSeq, _regions, HeapRegion**) \
+ nonstatic_field(HeapRegionSeq, _length, size_t) \
+ \
+ nonstatic_field(G1CollectedHeap, _hrs, HeapRegionSeq) \
+ nonstatic_field(G1CollectedHeap, _g1_committed, MemRegion) \
+ nonstatic_field(G1CollectedHeap, _summary_bytes_used, size_t) \
+
+
+#define VM_TYPES_G1(declare_type, declare_toplevel_type) \
+ \
+ declare_type(G1CollectedHeap, SharedHeap) \
+ \
+ declare_type(HeapRegion, ContiguousSpace) \
+ declare_toplevel_type(HeapRegionSeq) \
+ \
+ declare_toplevel_type(G1CollectedHeap*) \
+ declare_toplevel_type(HeapRegion*) \
+
+#endif // SHARE_VM_GC_IMPLEMENTATION_G1_VMSTRUCTS_G1_HPP
--- a/hotspot/src/share/vm/runtime/vmStructs.cpp Fri Sep 16 21:35:06 2011 -0700
+++ b/hotspot/src/share/vm/runtime/vmStructs.cpp Tue Sep 20 09:59:59 2011 -0400
@@ -173,6 +173,7 @@
#include "gc_implementation/parallelScavenge/psVirtualspace.hpp"
#include "gc_implementation/parallelScavenge/psYoungGen.hpp"
#include "gc_implementation/parallelScavenge/vmStructs_parallelgc.hpp"
+#include "gc_implementation/g1/vmStructs_g1.hpp"
#endif
#ifdef COMPILER2
#include "opto/addnode.hpp"
@@ -2855,6 +2856,9 @@
VM_STRUCTS_CMS(GENERATE_NONSTATIC_VM_STRUCT_ENTRY, \
GENERATE_NONSTATIC_VM_STRUCT_ENTRY, \
GENERATE_STATIC_VM_STRUCT_ENTRY)
+
+ VM_STRUCTS_G1(GENERATE_NONSTATIC_VM_STRUCT_ENTRY, \
+ GENERATE_STATIC_VM_STRUCT_ENTRY)
#endif // SERIALGC
VM_STRUCTS_CPU(GENERATE_NONSTATIC_VM_STRUCT_ENTRY, \
@@ -2898,6 +2902,9 @@
GENERATE_TOPLEVEL_VM_TYPE_ENTRY)
VM_TYPES_PARNEW(GENERATE_VM_TYPE_ENTRY)
+
+ VM_TYPES_G1(GENERATE_VM_TYPE_ENTRY,
+ GENERATE_TOPLEVEL_VM_TYPE_ENTRY)
#endif // SERIALGC
VM_TYPES_CPU(GENERATE_VM_TYPE_ENTRY,
@@ -2997,6 +3004,9 @@
VM_STRUCTS_CMS(CHECK_NONSTATIC_VM_STRUCT_ENTRY,
CHECK_VOLATILE_NONSTATIC_VM_STRUCT_ENTRY,
CHECK_STATIC_VM_STRUCT_ENTRY);
+
+ VM_STRUCTS_G1(CHECK_NONSTATIC_VM_STRUCT_ENTRY,
+ CHECK_STATIC_VM_STRUCT_ENTRY);
#endif // SERIALGC
VM_STRUCTS_CPU(CHECK_NONSTATIC_VM_STRUCT_ENTRY,
@@ -3037,6 +3047,9 @@
CHECK_SINGLE_ARG_VM_TYPE_NO_OP);
VM_TYPES_PARNEW(CHECK_VM_TYPE_ENTRY)
+
+ VM_TYPES_G1(CHECK_VM_TYPE_ENTRY,
+ CHECK_SINGLE_ARG_VM_TYPE_NO_OP);
#endif // SERIALGC
VM_TYPES_CPU(CHECK_VM_TYPE_ENTRY,
@@ -3102,6 +3115,8 @@
debug_only(VM_STRUCTS_CMS(ENSURE_FIELD_TYPE_PRESENT, \
ENSURE_FIELD_TYPE_PRESENT, \
ENSURE_FIELD_TYPE_PRESENT));
+ debug_only(VM_STRUCTS_G1(ENSURE_FIELD_TYPE_PRESENT, \
+ ENSURE_FIELD_TYPE_PRESENT));
#endif // SERIALGC
debug_only(VM_STRUCTS_CPU(ENSURE_FIELD_TYPE_PRESENT, \
ENSURE_FIELD_TYPE_PRESENT, \