--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/hotspot/agent/src/share/classes/sun/jvm/hotspot/gc/cms/AdaptiveFreeList.java Tue May 19 09:41:52 2015 +0200
@@ -0,0 +1,77 @@
+/*
+ * @(#)AdaptiveFreeList.java
+ *
+ * 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.
+ *
+ */
+
+package sun.jvm.hotspot.gc.cms;
+
+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.types.CIntegerField;
+import sun.jvm.hotspot.types.Type;
+import sun.jvm.hotspot.types.TypeDataBase;
+
+public class AdaptiveFreeList extends VMObject {
+ 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("AdaptiveFreeList<FreeChunk>");
+ sizeField = type.getCIntegerField("_size");
+ countField = type.getCIntegerField("_count");
+ headerSize = type.getSize();
+ }
+
+ // Fields
+ private static CIntegerField sizeField;
+ private static CIntegerField countField;
+ private static long headerSize;
+
+ //Constructor
+ public AdaptiveFreeList(Address address) {
+ super(address);
+ }
+
+ // Accessors
+ public long size() {
+ return sizeField.getValue(addr);
+ }
+
+ public long count() {
+ return countField.getValue(addr);
+ }
+
+ public static long sizeOf() {
+ return headerSize;
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/hotspot/agent/src/share/classes/sun/jvm/hotspot/gc/cms/CMSBitMap.java Tue May 19 09:41:52 2015 +0200
@@ -0,0 +1,110 @@
+/*
+ * 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
+ * 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.cms;
+
+import java.io.*;
+import java.util.*;
+import sun.jvm.hotspot.debugger.*;
+import sun.jvm.hotspot.memory.*;
+import sun.jvm.hotspot.runtime.*;
+import sun.jvm.hotspot.types.*;
+import sun.jvm.hotspot.utilities.*;
+
+public class CMSBitMap extends VMObject {
+ private static AddressField bmStartWordField;
+ private static CIntegerField bmWordSizeField;
+ private static CIntegerField shifterField;
+ //private static AddressField bmField;
+ private static long virtualSpaceFieldOffset;
+
+ public CMSBitMap(Address addr) {
+ super(addr);
+ }
+
+ 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("CMSBitMap");
+ bmStartWordField = type.getAddressField("_bmStartWord");
+ bmWordSizeField = type.getCIntegerField("_bmWordSize");
+ shifterField = type.getCIntegerField("_shifter");
+ //bmField = type.getAddressField("_bm");
+ virtualSpaceFieldOffset = type.getField("_virtual_space").getOffset();
+ }
+ public void printAll() {
+ System.out.println("bmStartWord(): "+bmStartWord());
+ System.out.println("bmWordSize(): "+bmWordSize());
+ System.out.println("shifter(): "+shifter());
+ }
+
+ public Address bmStartWord() {
+ return bmStartWordField.getValue(addr);
+ }
+ public long bmWordSize() {
+ return bmWordSizeField.getValue(addr);
+ }
+ public long shifter() {
+ return shifterField.getValue(addr);
+ }
+ public VirtualSpace virtualSpace() {
+ return (VirtualSpace) VMObjectFactory.newObject(VirtualSpace.class, addr.addOffsetTo(virtualSpaceFieldOffset));
+ }
+
+ public BitMap bm() {
+ BitMap bitMap = new BitMap((int) (bmWordSize() >> shifter() ));
+ VirtualSpace vs = virtualSpace();
+ bitMap.set_map(vs.low());
+ return bitMap;
+ }
+
+ public Address getNextMarkedWordAddress(Address addr) {
+ Address endWord = bmStartWord().addOffsetTo(bmWordSize());
+ int nextOffset = bm().getNextOneOffset(heapWordToOffset(addr), heapWordToOffset(endWord) );
+ Address nextAddr = offsetToHeapWord(nextOffset);
+ return nextAddr;
+ }
+
+ int heapWordToOffset(Address addr) {
+ int temp = (int)addr.minus(bmStartWord()) / (int) VM.getVM().getAddressSize();
+ int ret_val = temp >> shifter();
+ return ret_val;
+ }
+
+ Address offsetToHeapWord(int offset) {
+ int temp = offset << shifter();
+ return bmStartWord().addOffsetTo(temp*VM.getVM().getAddressSize());
+ }
+
+ boolean isMarked(Address addr) {
+ BitMap bm = bm();
+ return bm.at(heapWordToOffset(addr));
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/hotspot/agent/src/share/classes/sun/jvm/hotspot/gc/cms/CMSCollector.java Tue May 19 09:41:52 2015 +0200
@@ -0,0 +1,74 @@
+/*
+ * 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
+ * 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.cms;
+
+import java.io.*;
+import java.util.*;
+import sun.jvm.hotspot.debugger.*;
+import sun.jvm.hotspot.runtime.*;
+import sun.jvm.hotspot.types.*;
+
+public class CMSCollector extends VMObject {
+ private static long markBitMapFieldOffset;
+
+ public CMSCollector(Address addr) {
+ super(addr);
+ }
+
+ 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("CMSCollector");
+ markBitMapFieldOffset = type.getField("_markBitMap").getOffset();
+ }
+
+ //Accessing mark bitmap
+ public CMSBitMap markBitMap() {
+ return (CMSBitMap) VMObjectFactory.newObject(
+ CMSBitMap.class,
+ addr.addOffsetTo(markBitMapFieldOffset));
+ }
+
+ public long blockSizeUsingPrintezisBits(Address addr) {
+ CMSBitMap markBitMap = markBitMap();
+ long addressSize = VM.getVM().getAddressSize();
+ if ( markBitMap.isMarked(addr) && markBitMap.isMarked(addr.addOffsetTo(1*addressSize)) ) {
+ Address nextOneAddr = markBitMap.getNextMarkedWordAddress(addr.addOffsetTo(2*addressSize));
+ //return size in bytes
+ long size = (nextOneAddr.addOffsetTo(1*addressSize)).minus(addr);
+ return size;
+ } else {
+ //missing Printezis marks
+ return -1;
+ }
+
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/hotspot/agent/src/share/classes/sun/jvm/hotspot/gc/cms/CompactibleFreeListSpace.java Tue May 19 09:41:52 2015 +0200
@@ -0,0 +1,214 @@
+/*
+ * Copyright (c) 2003, 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.
+ *
+ */
+
+package sun.jvm.hotspot.gc.cms;
+
+import java.io.*;
+import java.util.*;
+
+import sun.jvm.hotspot.debugger.*;
+import sun.jvm.hotspot.gc.shared.*;
+import sun.jvm.hotspot.memory.*;
+import sun.jvm.hotspot.oops.*;
+import sun.jvm.hotspot.runtime.*;
+import sun.jvm.hotspot.types.*;
+import sun.jvm.hotspot.utilities.*;
+
+public class CompactibleFreeListSpace extends CompactibleSpace {
+ private static AddressField collectorField;
+ private static AddressField indexedFreeListField;
+ private static AddressField dictionaryField;
+ private static long smallLinearAllocBlockFieldOffset;
+
+ private int heapWordSize; // 4 for 32bit, 8 for 64 bits
+ private int IndexSetStart; // for small indexed list
+ private int IndexSetSize;
+ private int IndexSetStride;
+
+ static {
+ VM.registerVMInitializedObserver(new Observer() {
+ public void update(Observable o, Object data) {
+ initialize(VM.getVM().getTypeDataBase());
+ }
+ });
+ }
+
+ private static synchronized void initialize(TypeDataBase db) {
+ long sizeofFreeChunk = db.lookupType("FreeChunk").getSize();
+ VM vm = VM.getVM();
+ MinChunkSizeInBytes = numQuanta(sizeofFreeChunk, vm.getMinObjAlignmentInBytes()) *
+ vm.getMinObjAlignmentInBytes();
+
+ Type type = db.lookupType("CompactibleFreeListSpace");
+ collectorField = type.getAddressField("_collector");
+ collectorField = type.getAddressField("_collector");
+ dictionaryField = type.getAddressField("_dictionary");
+ indexedFreeListField = type.getAddressField("_indexedFreeList[0]");
+ smallLinearAllocBlockFieldOffset = type.getField("_smallLinearAllocBlock").getOffset();
+ }
+
+ public CompactibleFreeListSpace(Address addr) {
+ super(addr);
+ VM vm = VM.getVM();
+ heapWordSize = vm.getHeapWordSize();
+ IndexSetStart = vm.getMinObjAlignmentInBytes() / heapWordSize;
+ IndexSetStride = IndexSetStart;
+ IndexSetSize = 257;
+ }
+
+ // Accessing block offset table
+ public CMSCollector collector() {
+ return (CMSCollector) VMObjectFactory.newObject(
+ CMSCollector.class,
+ collectorField.getValue(addr));
+ }
+
+ public long free0() {
+ return capacity() - used0();
+ }
+
+ public long used() {
+ return capacity() - free();
+ }
+
+ public long used0() {
+ List regions = getLiveRegions();
+ long usedSize = 0L;
+ for (Iterator itr = regions.iterator(); itr.hasNext();) {
+ MemRegion mr = (MemRegion) itr.next();
+ usedSize += mr.byteSize();
+ }
+ return usedSize;
+ }
+
+ public long free() {
+ // small chunks
+ long size = 0;
+ Address cur = addr.addOffsetTo( indexedFreeListField.getOffset() );
+ cur = cur.addOffsetTo(IndexSetStart*AdaptiveFreeList.sizeOf());
+ for (int i=IndexSetStart; i<IndexSetSize; i += IndexSetStride) {
+ AdaptiveFreeList freeList = (AdaptiveFreeList) VMObjectFactory.newObject(AdaptiveFreeList.class, cur);
+ size += i*freeList.count();
+ cur= cur.addOffsetTo(IndexSetStride*AdaptiveFreeList.sizeOf());
+ }
+
+ // large block
+ AFLBinaryTreeDictionary aflbd = (AFLBinaryTreeDictionary) VMObjectFactory.newObject(AFLBinaryTreeDictionary.class,
+ dictionaryField.getValue(addr));
+ size += aflbd.size();
+
+
+ // linear block in TLAB
+ LinearAllocBlock lab = (LinearAllocBlock) VMObjectFactory.newObject(LinearAllocBlock.class,
+ addr.addOffsetTo(smallLinearAllocBlockFieldOffset));
+ size += lab.word_size();
+
+ return size*heapWordSize;
+ }
+
+ public void printOn(PrintStream tty) {
+ tty.print("free-list-space");
+ tty.print("[ " + bottom() + " , " + end() + " ) ");
+ long cap = capacity();
+ long used_size = used();
+ long free_size = free();
+ int used_perc = (int)((double)used_size/cap*100);
+ tty.print("space capacity = " + cap + " used(" + used_perc + "%)= " + used_size + " ");
+ tty.print("free= " + free_size );
+ tty.print("\n");
+
+ }
+
+ public Address skipBlockSizeUsingPrintezisBits(Address pos) {
+ CMSCollector collector = collector();
+ long size = 0;
+ Address addr = null;
+
+ if (collector != null) {
+ size = collector.blockSizeUsingPrintezisBits(pos);
+ if (size >= 3) {
+ addr = pos.addOffsetTo(adjustObjectSizeInBytes(size));
+ }
+ }
+ return addr;
+ }
+
+ public List/*<MemRegion>*/ getLiveRegions() {
+ List res = new ArrayList(); // List<MemRegion>
+ VM vm = VM.getVM();
+ Debugger dbg = vm.getDebugger();
+ ObjectHeap heap = vm.getObjectHeap();
+ Address cur = bottom();
+ Address regionStart = cur;
+ Address limit = end();
+ final long addressSize = vm.getAddressSize();
+
+ for (; cur.lessThan(limit);) {
+ Address k = cur.getAddressAt(addressSize);
+ if (FreeChunk.indicatesFreeChunk(cur)) {
+ if (! cur.equals(regionStart)) {
+ res.add(new MemRegion(regionStart, cur));
+ }
+ FreeChunk fc = (FreeChunk) VMObjectFactory.newObject(FreeChunk.class, cur);
+ long chunkSize = fc.size();
+ if (Assert.ASSERTS_ENABLED) {
+ Assert.that(chunkSize > 0, "invalid FreeChunk size");
+ }
+ // note that fc.size() gives chunk size in heap words
+ cur = cur.addOffsetTo(chunkSize * addressSize);
+ regionStart = cur;
+ } else if (k != null) {
+ Oop obj = heap.newOop(cur.addOffsetToAsOopHandle(0));
+ long objectSize = obj.getObjectSize();
+ cur = cur.addOffsetTo(adjustObjectSizeInBytes(objectSize));
+ } else {
+ // FIXME: need to do a better job here.
+ // can I use bitMap here?
+ //Find the object size using Printezis bits and skip over
+ long size = collector().blockSizeUsingPrintezisBits(cur);
+ if (size == -1) {
+ break;
+ }
+ cur = cur.addOffsetTo(adjustObjectSizeInBytes(size));
+ }
+ }
+ return res;
+ }
+
+ //-- Internals only below this point
+
+ // Unlike corresponding VM code, we operate on byte size rather than
+ // HeapWord size for convenience.
+
+ private static long numQuanta(long x, long y) {
+ return ((x+y-1)/y);
+ }
+
+ public static long adjustObjectSizeInBytes(long sizeInBytes) {
+ return Oop.alignObjectSize(Math.max(sizeInBytes, MinChunkSizeInBytes));
+ }
+
+ // FIXME: should I read this directly from VM?
+ private static long MinChunkSizeInBytes;
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/hotspot/agent/src/share/classes/sun/jvm/hotspot/gc/cms/ConcurrentMarkSweepGeneration.java Tue May 19 09:41:52 2015 +0200
@@ -0,0 +1,82 @@
+/*
+ * Copyright (c) 2003, 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.
+ *
+ */
+
+package sun.jvm.hotspot.gc.cms;
+
+import java.io.*;
+import java.util.*;
+import sun.jvm.hotspot.debugger.*;
+import sun.jvm.hotspot.gc.shared.*;
+import sun.jvm.hotspot.runtime.*;
+import sun.jvm.hotspot.types.*;
+
+public class ConcurrentMarkSweepGeneration extends CardGeneration {
+ private static AddressField cmsSpaceField;
+
+ public ConcurrentMarkSweepGeneration(Address addr) {
+ super(addr);
+ }
+
+ 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("ConcurrentMarkSweepGeneration");
+ cmsSpaceField = type.getAddressField("_cmsSpace");
+ }
+
+ // Accessing space
+ public CompactibleFreeListSpace cmsSpace() {
+ return (CompactibleFreeListSpace) VMObjectFactory.newObject(
+ CompactibleFreeListSpace.class,
+ cmsSpaceField.getValue(addr));
+ }
+
+ public long capacity() { return cmsSpace().capacity(); }
+ public long used() { return cmsSpace().used(); }
+ public long free() { return cmsSpace().free(); }
+ public long contiguousAvailable() { throw new RuntimeException("not yet implemented"); }
+ public boolean contains(Address p) { return cmsSpace().contains(p); }
+ public void spaceIterate(SpaceClosure blk, boolean usedOnly) {
+ blk.doSpace(cmsSpace());
+ }
+
+ public Generation.Name kind() {
+ return Generation.Name.CONCURRENT_MARK_SWEEP;
+ }
+
+ public String name() {
+ return "concurrent mark-sweep generation";
+ }
+
+ public void printOn(PrintStream tty) {
+ tty.println(name());
+ cmsSpace().printOn(tty);
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/hotspot/agent/src/share/classes/sun/jvm/hotspot/gc/cms/LinearAllocBlock.java Tue May 19 09:41:52 2015 +0200
@@ -0,0 +1,59 @@
+/*
+ * @(#)BinaryTreeDictionary.java
+ * 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.
+ *
+ */
+
+package sun.jvm.hotspot.gc.cms;
+
+import java.util.*;
+import sun.jvm.hotspot.debugger.*;
+import sun.jvm.hotspot.types.*;
+import sun.jvm.hotspot.runtime.*;
+
+public class LinearAllocBlock extends VMObject {
+ 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("LinearAllocBlock");
+ word_sizeField= type.getCIntegerField("_word_size");
+ }
+
+ // Fields
+ private static CIntegerField word_sizeField;
+
+ // Accessors
+ public long word_size() {
+ return word_sizeField.getValue(addr);
+ }
+
+ // Constructor
+ public LinearAllocBlock(Address addr) {
+ super(addr);
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/hotspot/agent/src/share/classes/sun/jvm/hotspot/gc/cms/ParNewGeneration.java Tue May 19 09:41:52 2015 +0200
@@ -0,0 +1,39 @@
+/*
+ * Copyright (c) 2003, 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.
+ *
+ */
+
+package sun.jvm.hotspot.gc.cms;
+
+import sun.jvm.hotspot.debugger.*;
+import sun.jvm.hotspot.gc.serial.*;
+import sun.jvm.hotspot.gc.shared.*;
+
+public class ParNewGeneration extends DefNewGeneration {
+ public ParNewGeneration(Address addr) {
+ super(addr);
+ }
+
+ public Generation.Name kind() {
+ return Generation.Name.PAR_NEW;
+ }
+}
--- a/hotspot/agent/src/share/classes/sun/jvm/hotspot/gc/g1/G1CollectedHeap.java Mon May 18 17:09:47 2015 +0200
+++ b/hotspot/agent/src/share/classes/sun/jvm/hotspot/gc/g1/G1CollectedHeap.java Tue May 19 09:41:52 2015 +0200
@@ -31,8 +31,8 @@
import sun.jvm.hotspot.debugger.Address;
import sun.jvm.hotspot.gc.shared.CollectedHeap;
import sun.jvm.hotspot.gc.shared.CollectedHeapName;
+import sun.jvm.hotspot.gc.shared.SpaceClosure;
import sun.jvm.hotspot.memory.MemRegion;
-import sun.jvm.hotspot.memory.SpaceClosure;
import sun.jvm.hotspot.runtime.VM;
import sun.jvm.hotspot.runtime.VMObjectFactory;
import sun.jvm.hotspot.types.AddressField;
--- a/hotspot/agent/src/share/classes/sun/jvm/hotspot/gc/g1/HeapRegion.java Mon May 18 17:09:47 2015 +0200
+++ b/hotspot/agent/src/share/classes/sun/jvm/hotspot/gc/g1/HeapRegion.java Tue May 19 09:41:52 2015 +0200
@@ -29,7 +29,7 @@
import java.util.Observable;
import java.util.Observer;
import sun.jvm.hotspot.debugger.Address;
-import sun.jvm.hotspot.memory.CompactibleSpace;
+import sun.jvm.hotspot.gc.shared.CompactibleSpace;
import sun.jvm.hotspot.memory.MemRegion;
import sun.jvm.hotspot.runtime.VM;
import sun.jvm.hotspot.types.AddressField;
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/hotspot/agent/src/share/classes/sun/jvm/hotspot/gc/parallel/ImmutableSpace.java Tue May 19 09:41:52 2015 +0200
@@ -0,0 +1,90 @@
+/*
+ * Copyright (c) 2003, 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.
+ *
+ */
+
+package sun.jvm.hotspot.gc.parallel;
+
+import java.io.*;
+import java.util.*;
+
+import sun.jvm.hotspot.debugger.*;
+import sun.jvm.hotspot.memory.*;
+import sun.jvm.hotspot.runtime.*;
+import sun.jvm.hotspot.types.*;
+
+public abstract class ImmutableSpace extends VMObject {
+ 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("ImmutableSpace");
+ bottomField = type.getAddressField("_bottom");
+ endField = type.getAddressField("_end");
+ }
+
+ public ImmutableSpace(Address addr) {
+ super(addr);
+ }
+
+ // Fields
+ private static AddressField bottomField;
+ private static AddressField endField;
+
+ // Accessors
+ public Address bottom() { return bottomField.getValue(addr); }
+ public Address end() { return endField.getValue(addr); }
+
+ /** Returns a subregion of the space containing all the objects in
+ the space. */
+ public MemRegion usedRegion() {
+ return new MemRegion(bottom(), end());
+ }
+
+ /** Support for iteration over heap -- not sure how this will
+ interact with GC in reflective system, but necessary for the
+ debugging mechanism */
+ public OopHandle bottomAsOopHandle() {
+ return bottomField.getOopHandle(addr);
+ }
+
+ /** returns all MemRegions where live objects are */
+ public abstract List/*<MemRegion>*/ getLiveRegions();
+
+ /** Returned value is in bytes */
+ public long capacity() { return end().minus(bottom()); }
+
+ public abstract long used();
+
+ /** Testers */
+ public boolean contains(Address p) {
+ return (bottom().lessThanOrEqual(p) && end().greaterThan(p));
+ }
+
+ public void print() { printOn(System.out); }
+ public abstract void printOn(PrintStream tty);
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/hotspot/agent/src/share/classes/sun/jvm/hotspot/gc/parallel/MutableSpace.java Tue May 19 09:41:52 2015 +0200
@@ -0,0 +1,75 @@
+/*
+ * Copyright (c) 2003, 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.
+ *
+ */
+
+package sun.jvm.hotspot.gc.parallel;
+
+import java.io.*;
+import java.util.*;
+
+import sun.jvm.hotspot.debugger.*;
+import sun.jvm.hotspot.memory.*;
+import sun.jvm.hotspot.runtime.*;
+import sun.jvm.hotspot.types.*;
+
+public class MutableSpace extends ImmutableSpace {
+ 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("MutableSpace");
+ topField = type.getAddressField("_top");
+ }
+
+ public MutableSpace(Address addr) {
+ super(addr);
+ }
+
+ // Fields
+ private static AddressField topField;
+
+ // Accessors
+ public Address top() { return topField.getValue(addr); }
+
+ /** In bytes */
+ public long used() {
+ return top().minus(bottom());
+ }
+
+ /** returns all MemRegions where live objects are */
+ public List/*<MemRegion>*/ getLiveRegions() {
+ List res = new ArrayList();
+ res.add(new MemRegion(bottom(), top()));
+ return res;
+ }
+
+ public void printOn(PrintStream tty) {
+ tty.print(" [" + bottom() + "," +
+ top() + "," + end() + "] ");
+ }
+}
--- a/hotspot/agent/src/share/classes/sun/jvm/hotspot/gc/parallel/PSOldGen.java Mon May 18 17:09:47 2015 +0200
+++ b/hotspot/agent/src/share/classes/sun/jvm/hotspot/gc/parallel/PSOldGen.java Tue May 19 09:41:52 2015 +0200
@@ -28,7 +28,6 @@
import java.util.*;
import sun.jvm.hotspot.debugger.*;
-import sun.jvm.hotspot.gc.shared.*;
import sun.jvm.hotspot.memory.*;
import sun.jvm.hotspot.runtime.*;
import sun.jvm.hotspot.types.*;
--- a/hotspot/agent/src/share/classes/sun/jvm/hotspot/gc/parallel/PSYoungGen.java Mon May 18 17:09:47 2015 +0200
+++ b/hotspot/agent/src/share/classes/sun/jvm/hotspot/gc/parallel/PSYoungGen.java Tue May 19 09:41:52 2015 +0200
@@ -28,7 +28,6 @@
import java.util.*;
import sun.jvm.hotspot.debugger.*;
-import sun.jvm.hotspot.gc.shared.*;
import sun.jvm.hotspot.memory.*;
import sun.jvm.hotspot.runtime.*;
import sun.jvm.hotspot.types.*;
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/hotspot/agent/src/share/classes/sun/jvm/hotspot/gc/serial/DefNewGeneration.java Tue May 19 09:41:52 2015 +0200
@@ -0,0 +1,105 @@
+/*
+ * 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.
+ *
+ */
+
+package sun.jvm.hotspot.gc.serial;
+
+import java.io.*;
+import java.util.*;
+
+import sun.jvm.hotspot.debugger.*;
+import sun.jvm.hotspot.gc.shared.*;
+import sun.jvm.hotspot.runtime.*;
+import sun.jvm.hotspot.types.*;
+
+/** DefNewGeneration is a young generation containing eden, from- and
+ to-space. */
+
+public class DefNewGeneration extends Generation {
+ protected static AddressField edenSpaceField;
+ protected static AddressField fromSpaceField;
+ protected static AddressField toSpaceField;
+
+ 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("DefNewGeneration");
+
+ edenSpaceField = type.getAddressField("_eden_space");
+ fromSpaceField = type.getAddressField("_from_space");
+ toSpaceField = type.getAddressField("_to_space");
+ }
+
+ public DefNewGeneration(Address addr) {
+ super(addr);
+ }
+
+ public Generation.Name kind() {
+ return Generation.Name.DEF_NEW;
+ }
+
+ // Accessing spaces
+ public ContiguousSpace eden() {
+ return (ContiguousSpace) VMObjectFactory.newObject(ContiguousSpace.class, edenSpaceField.getValue(addr));
+ }
+
+ public ContiguousSpace from() {
+ return (ContiguousSpace) VMObjectFactory.newObject(ContiguousSpace.class, fromSpaceField.getValue(addr));
+ }
+
+ public ContiguousSpace to() {
+ return (ContiguousSpace) VMObjectFactory.newObject(ContiguousSpace.class, toSpaceField.getValue(addr));
+ }
+
+ public long capacity() { return eden().capacity() + from().capacity(); /* to() is only used during scavenge */ }
+ public long used() { return eden().used() + from().used(); /* to() is only used during scavenge */ }
+ public long free() { return eden().free() + from().free(); /* to() is only used during scavenge */ }
+ public long contiguousAvailable() { return eden().free(); }
+
+ public String name() {
+ return "default new generation";
+ }
+
+ public void spaceIterate(SpaceClosure blk, boolean usedOnly) {
+ blk.doSpace(eden());
+ blk.doSpace(from());
+ if (!usedOnly) {
+ blk.doSpace(to());
+ }
+ }
+
+ public void printOn(PrintStream tty) {
+ tty.print(" eden");
+ eden().printOn(tty);
+ tty.print("\n from");
+ from().printOn(tty);
+ tty.print("\n to ");
+ to().printOn(tty);
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/hotspot/agent/src/share/classes/sun/jvm/hotspot/gc/serial/TenuredGeneration.java Tue May 19 09:41:52 2015 +0200
@@ -0,0 +1,91 @@
+/*
+ * 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.
+ *
+ */
+
+package sun.jvm.hotspot.gc.serial;
+
+import java.io.*;
+import java.util.*;
+
+import sun.jvm.hotspot.debugger.*;
+import sun.jvm.hotspot.gc.shared.*;
+import sun.jvm.hotspot.runtime.*;
+import sun.jvm.hotspot.types.*;
+
+/** <P> TenuredGeneration models a heap of old objects contained
+ in a single contiguous space. </P>
+
+ <P> Garbage collection is performed using mark-compact. </P> */
+
+public class TenuredGeneration extends CardGeneration {
+ private static AddressField theSpaceField;
+
+ 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("TenuredGeneration");
+
+ theSpaceField = type.getAddressField("_the_space");
+ }
+
+ public TenuredGeneration(Address addr) {
+ super(addr);
+ }
+
+ public ContiguousSpace theSpace() {
+ return (ContiguousSpace) VMObjectFactory.newObject(ContiguousSpace.class, theSpaceField.getValue(addr));
+ }
+
+ public boolean isIn(Address p) {
+ return theSpace().contains(p);
+ }
+
+ /** Space queries */
+ public long capacity() { return theSpace().capacity(); }
+ public long used() { return theSpace().used(); }
+ public long free() { return theSpace().free(); }
+ public long contiguousAvailable() { return theSpace().free() + virtualSpace().uncommittedSize(); }
+
+ public void spaceIterate(SpaceClosure blk, boolean usedOnly) {
+ blk.doSpace(theSpace());
+ }
+
+ public void printOn(PrintStream tty) {
+ tty.print(" old ");
+ theSpace().printOn(tty);
+ }
+
+ public Generation.Name kind() {
+ return Generation.Name.MARK_SWEEP_COMPACT;
+ }
+
+ public String name() {
+ return "tenured generation";
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/hotspot/agent/src/share/classes/sun/jvm/hotspot/gc/shared/CardGeneration.java Tue May 19 09:41:52 2015 +0200
@@ -0,0 +1,40 @@
+/*
+ * 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.
+ *
+ */
+
+package sun.jvm.hotspot.gc.shared;
+
+import sun.jvm.hotspot.debugger.*;
+
+/** Class CardGeneration is a generation that is covered by a card
+ table, and uses a card-size block-offset array to implement
+ block_start. */
+
+public abstract class CardGeneration extends Generation {
+ public CardGeneration(Address addr) {
+ super(addr);
+ }
+
+ // FIXME: not sure what I need to expose from here in order to have
+ // verification similar to that of the old RememberedSet
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/hotspot/agent/src/share/classes/sun/jvm/hotspot/gc/shared/CompactibleSpace.java Tue May 19 09:41:52 2015 +0200
@@ -0,0 +1,64 @@
+/*
+ * 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.
+ *
+ */
+
+package sun.jvm.hotspot.gc.shared;
+
+import java.util.*;
+
+import sun.jvm.hotspot.debugger.*;
+import sun.jvm.hotspot.runtime.*;
+import sun.jvm.hotspot.types.*;
+
+/** A space that supports compaction operations. This is usually, but
+ not necessarily, a space that is normally contiguous. But, for
+ example, a free-list-based space whose normal collection is a
+ mark-sweep without compaction could still support compaction in
+ full GC's. */
+
+public abstract class CompactibleSpace extends Space {
+ private static AddressField compactionTopField;
+
+ 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("CompactibleSpace");
+
+ compactionTopField = type.getAddressField("_compaction_top");
+ }
+
+ public CompactibleSpace(Address addr) {
+ super(addr);
+ }
+
+ /** May be used temporarily during a compaction phase. */
+ public Address compactionTop() {
+ return compactionTopField.getValue(addr);
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/hotspot/agent/src/share/classes/sun/jvm/hotspot/gc/shared/ContiguousSpace.java Tue May 19 09:41:52 2015 +0200
@@ -0,0 +1,98 @@
+/*
+ * 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.
+ *
+ */
+
+package sun.jvm.hotspot.gc.shared;
+
+import java.io.*;
+import java.util.*;
+
+import sun.jvm.hotspot.debugger.*;
+import sun.jvm.hotspot.memory.*;
+import sun.jvm.hotspot.runtime.*;
+import sun.jvm.hotspot.types.*;
+
+public class ContiguousSpace extends CompactibleSpace {
+ private static AddressField topField;
+
+ 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("ContiguousSpace");
+
+ topField = type.getAddressField("_top");
+ }
+
+ public ContiguousSpace(Address addr) {
+ super(addr);
+ }
+
+ public Address top() {
+ return topField.getValue(addr);
+ }
+
+ /** In bytes */
+ public long capacity() {
+ return end().minus(bottom());
+ }
+
+ /** In bytes */
+ public long used() {
+ return top().minus(bottom());
+ }
+
+ /** In bytes */
+ public long free() {
+ return end().minus(top());
+ }
+
+ /** In a contiguous space we have a more obvious bound on what parts
+ contain objects. */
+ public MemRegion usedRegion() {
+ return new MemRegion(bottom(), top());
+ }
+
+ /** Returns regions of Space where live objects live */
+ public List/*<MemRegion>*/ getLiveRegions() {
+ List res = new ArrayList();
+ res.add(new MemRegion(bottom(), top()));
+ return res;
+ }
+
+ /** Testers */
+ public boolean contains(Address p) {
+ return (bottom().lessThanOrEqual(p) && top().greaterThan(p));
+ }
+
+ public void printOn(PrintStream tty) {
+ tty.print(" [" + bottom() + "," +
+ top() + "," + end() + ")");
+ super.printOn(tty);
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/hotspot/agent/src/share/classes/sun/jvm/hotspot/gc/shared/GenCollectedHeap.java Tue May 19 09:41:52 2015 +0200
@@ -0,0 +1,151 @@
+/*
+ * 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.
+ *
+ */
+
+package sun.jvm.hotspot.gc.shared;
+
+import java.io.*;
+import java.util.*;
+
+import sun.jvm.hotspot.debugger.*;
+import sun.jvm.hotspot.runtime.*;
+import sun.jvm.hotspot.types.*;
+import sun.jvm.hotspot.utilities.*;
+
+public class GenCollectedHeap extends CollectedHeap {
+ private static AddressField youngGenField;
+ private static AddressField oldGenField;
+
+ private static AddressField youngGenSpecField;
+ private static AddressField oldGenSpecField;
+
+ private static GenerationFactory genFactory;
+
+ 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("GenCollectedHeap");
+
+ youngGenField = type.getAddressField("_young_gen");
+ oldGenField = type.getAddressField("_old_gen");
+
+ genFactory = new GenerationFactory();
+
+ Type collectorPolicyType = db.lookupType("GenCollectorPolicy");
+ youngGenSpecField = collectorPolicyType.getAddressField("_young_gen_spec");
+ oldGenSpecField = collectorPolicyType.getAddressField("_old_gen_spec");
+ }
+
+ public GenCollectedHeap(Address addr) {
+ super(addr);
+ }
+
+ public int nGens() {
+ return 2; // Young + Old
+ }
+
+ public Generation getGen(int i) {
+ if (Assert.ASSERTS_ENABLED) {
+ Assert.that((i == 0) || (i == 1), "Index " + i +
+ " out of range (should be 0 or 1)");
+ }
+
+ switch (i) {
+ case 0:
+ return genFactory.newObject(youngGenField.getValue(addr));
+ case 1:
+ return genFactory.newObject(oldGenField.getValue(addr));
+ default:
+ // no generation for i, and assertions disabled.
+ return null;
+ }
+ }
+
+ public boolean isIn(Address a) {
+ for (int i = 0; i < nGens(); i++) {
+ Generation gen = getGen(i);
+ if (gen.isIn(a)) {
+ return true;
+ }
+ }
+
+ return false;
+ }
+
+ public long capacity() {
+ long capacity = 0;
+ for (int i = 0; i < nGens(); i++) {
+ capacity += getGen(i).capacity();
+ }
+ return capacity;
+ }
+
+ public long used() {
+ long used = 0;
+ for (int i = 0; i < nGens(); i++) {
+ used += getGen(i).used();
+ }
+ return used;
+ }
+
+ /** Package-private access to GenerationSpecs */
+ GenerationSpec spec(int level) {
+ if (Assert.ASSERTS_ENABLED) {
+ Assert.that((level == 0) || (level == 1), "Index " + level +
+ " out of range (should be 0 or 1)");
+ }
+
+ if ((level != 0) && (level != 1)) {
+ return null;
+ }
+
+ if (level == 0) {
+ return (GenerationSpec)
+ VMObjectFactory.newObject(GenerationSpec.class,
+ youngGenSpecField.getAddress());
+ } else {
+ return (GenerationSpec)
+ VMObjectFactory.newObject(GenerationSpec.class,
+ oldGenSpecField.getAddress());
+ }
+ }
+
+ public CollectedHeapName kind() {
+ return CollectedHeapName.GEN_COLLECTED_HEAP;
+ }
+
+ public void printOn(PrintStream tty) {
+ for (int i = 0; i < nGens(); i++) {
+ tty.print("Gen " + i + ": ");
+ getGen(i).printOn(tty);
+ tty.println("Invocations: " + getGen(i).invocations());
+ tty.println();
+ }
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/hotspot/agent/src/share/classes/sun/jvm/hotspot/gc/shared/Generation.java Tue May 19 09:41:52 2015 +0200
@@ -0,0 +1,215 @@
+/*
+ * 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.
+ *
+ */
+
+package sun.jvm.hotspot.gc.shared;
+
+import java.io.*;
+import java.util.*;
+import sun.jvm.hotspot.debugger.*;
+import sun.jvm.hotspot.memory.*;
+import sun.jvm.hotspot.runtime.*;
+import sun.jvm.hotspot.types.*;
+
+/** <P> The (supported) Generation hierarchy currently looks like this: </P>
+
+ <ul>
+ <li> Generation
+ <ul>
+ <li> CardGeneration
+ <ul>
+ <li> TenuredGeneration
+ </ul>
+ <li> DefNewGeneration
+ </ul>
+ </ul>
+*/
+
+
+public abstract class Generation extends VMObject {
+ private static long reservedFieldOffset;
+ private static long virtualSpaceFieldOffset;
+ private static CIntegerField levelField;
+ protected static final int K = 1024;
+ // Fields for class StatRecord
+ private static Field statRecordField;
+ private static CIntegerField invocationField;
+
+ // constants from Name enum
+ private static int NAME_DEF_NEW;
+ private static int NAME_PAR_NEW;
+ private static int NAME_MARK_SWEEP_COMPACT;
+ private static int NAME_CONCURRENT_MARK_SWEEP;
+ private static int NAME_OTHER;
+
+ 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("Generation");
+
+ reservedFieldOffset = type.getField("_reserved").getOffset();
+ virtualSpaceFieldOffset = type.getField("_virtual_space").getOffset();
+ levelField = type.getCIntegerField("_level");
+ // StatRecord
+ statRecordField = type.getField("_stat_record");
+ type = db.lookupType("Generation::StatRecord");
+ invocationField = type.getCIntegerField("invocations");
+
+ // constants from Generation::Name
+ NAME_DEF_NEW = db.lookupIntConstant("Generation::DefNew").intValue();
+ NAME_PAR_NEW = db.lookupIntConstant("Generation::ParNew").intValue();
+ NAME_MARK_SWEEP_COMPACT = db.lookupIntConstant("Generation::MarkSweepCompact").intValue();
+ NAME_CONCURRENT_MARK_SWEEP = db.lookupIntConstant("Generation::ConcurrentMarkSweep").intValue();
+ NAME_OTHER = db.lookupIntConstant("Generation::Other").intValue();
+ }
+
+ public Generation(Address addr) {
+ super(addr);
+ }
+
+ public static class Name {
+ public static final Name DEF_NEW = new Name("DefNew");
+ public static final Name PAR_NEW = new Name("ParNew");
+ public static final Name MARK_SWEEP_COMPACT = new Name("MarkSweepCompact");
+ public static final Name CONCURRENT_MARK_SWEEP = new Name("ConcurrentMarkSweep");
+ public static final Name OTHER = new Name("Other");
+
+ private Name(String value) {
+ this.value = value;
+ }
+
+ private String value;
+ public String toString() {
+ return value;
+ }
+ }
+
+ public Generation.Name kind() {
+ return Generation.Name.OTHER;
+ }
+
+ static Generation.Name nameForEnum(int value) {
+ if (value == NAME_DEF_NEW) {
+ return Name.DEF_NEW;
+ } else if (value == NAME_PAR_NEW) {
+ return Name.PAR_NEW;
+ } else if (value == NAME_MARK_SWEEP_COMPACT) {
+ return Name.MARK_SWEEP_COMPACT;
+ } else if (value == NAME_CONCURRENT_MARK_SWEEP) {
+ return Name.CONCURRENT_MARK_SWEEP;
+ } else if (value == NAME_OTHER) {
+ return Name.OTHER;
+ } else {
+ throw new RuntimeException("should not reach here");
+ }
+ }
+
+ public GenerationSpec spec() {
+ return ((GenCollectedHeap) VM.getVM().getUniverse().heap()).spec(level());
+ }
+
+ public int level() {
+ return (int) levelField.getValue(addr);
+ }
+
+ public int invocations() {
+ return getStatRecord().getInvocations();
+ }
+
+ /** The maximum number of object bytes the generation can currently
+ hold. */
+ public abstract long capacity();
+
+ /** The number of used bytes in the gen. */
+ public abstract long used();
+
+ /** The number of free bytes in the gen. */
+ public abstract long free();
+
+ /** The largest number of contiguous free words in the generation,
+ including expansion. (VM's version assumes it is called at a
+ safepoint.) */
+ public abstract long contiguousAvailable();
+
+ public MemRegion reserved() {
+ return new MemRegion(addr.addOffsetTo(reservedFieldOffset));
+ }
+
+ /** Returns a region guaranteed to contain all the objects in the
+ generation. */
+ public MemRegion usedRegion() {
+ return reserved();
+ }
+
+ /* Returns "TRUE" iff "p" points into an allocated object in the
+ generation. */
+ public boolean isIn(Address p) {
+ GenerationIsInClosure blk = new GenerationIsInClosure(p);
+ spaceIterate(blk);
+ return (blk.space() != null);
+ }
+
+ /** Returns "TRUE" iff "p" points into the reserved area of the
+ generation. */
+ public boolean isInReserved(Address p) {
+ return reserved().contains(p);
+ }
+
+ protected VirtualSpace virtualSpace() {
+ return (VirtualSpace) VMObjectFactory.newObject(VirtualSpace.class, addr.addOffsetTo(virtualSpaceFieldOffset));
+ }
+
+ public abstract String name();
+
+ /** Equivalent to spaceIterate(blk, false) */
+ public void spaceIterate(SpaceClosure blk) {
+ spaceIterate(blk, false);
+ }
+
+ /** Iteration - do not use for time critical operations */
+ public abstract void spaceIterate(SpaceClosure blk, boolean usedOnly);
+
+ public void print() { printOn(System.out); }
+ public abstract void printOn(PrintStream tty);
+
+ public static class StatRecord extends VMObject {
+ public StatRecord(Address addr) {
+ super(addr);
+ }
+
+ public int getInvocations() {
+ return (int) invocationField.getValue(addr);
+ }
+
+ }
+
+ private StatRecord getStatRecord() {
+ return (StatRecord) VMObjectFactory.newObject(Generation.StatRecord.class, addr.addOffsetTo(statRecordField.getOffset()));
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/hotspot/agent/src/share/classes/sun/jvm/hotspot/gc/shared/GenerationFactory.java Tue May 19 09:41:52 2015 +0200
@@ -0,0 +1,88 @@
+/*
+ * 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.
+ *
+ */
+
+package sun.jvm.hotspot.gc.shared;
+
+import java.util.*;
+
+import sun.jvm.hotspot.debugger.*;
+import sun.jvm.hotspot.gc.cms.*;
+import sun.jvm.hotspot.gc.serial.*;
+import sun.jvm.hotspot.runtime.*;
+import sun.jvm.hotspot.types.*;
+
+/** Factory containing a VirtualConstructor suitable for instantiating
+ wrapper objects for all types of generations */
+
+public class GenerationFactory {
+ 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) {
+ ctor = new VirtualConstructor(db);
+
+ ctor.addMapping("DefNewGeneration", DefNewGeneration.class);
+ ctor.addMapping("ParNewGeneration", ParNewGeneration.class);
+ ctor.addMapping("TenuredGeneration", TenuredGeneration.class);
+ ctor.addMapping("ConcurrentMarkSweepGeneration", ConcurrentMarkSweepGeneration.class);
+ }
+
+ public static Generation newObject(Address addr) {
+ try {
+ return (Generation) ctor.instantiateWrapperFor(addr);
+ } catch (WrongTypeException e) {
+ return new Generation(addr) {
+ public String name() {
+ return "unknown generation type";
+ }
+ public void spaceIterate(SpaceClosure blk, boolean usedOnly) {
+ }
+ public void printOn(java.io.PrintStream tty) {
+ tty.println("unknown subtype of Generation @ " + getAddress() + " (" +
+ virtualSpace().low() + "," + virtualSpace().high() + ")");
+ }
+ public long used() {
+ return 0;
+ }
+ public long free() {
+ return 0;
+ }
+ public long capacity() {
+ return 0;
+ }
+ public long contiguousAvailable() {
+ return 0;
+ }
+
+ };
+ }
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/hotspot/agent/src/share/classes/sun/jvm/hotspot/gc/shared/GenerationIsInClosure.java Tue May 19 09:41:52 2015 +0200
@@ -0,0 +1,48 @@
+/*
+ * 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.
+ *
+ */
+
+package sun.jvm.hotspot.gc.shared;
+
+import sun.jvm.hotspot.debugger.*;
+
+/** Should only be used once */
+
+class GenerationIsInClosure implements SpaceClosure {
+ private Address p;
+ private Space sp;
+
+ GenerationIsInClosure(Address p) {
+ this.p = p;
+ }
+
+ public void doSpace(Space s) {
+ if (s.contains(p)) {
+ sp = s;
+ }
+ }
+
+ Space space() {
+ return sp;
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/hotspot/agent/src/share/classes/sun/jvm/hotspot/gc/shared/GenerationSpec.java Tue May 19 09:41:52 2015 +0200
@@ -0,0 +1,69 @@
+/*
+ * 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.
+ *
+ */
+
+package sun.jvm.hotspot.gc.shared;
+
+import java.util.*;
+
+import sun.jvm.hotspot.debugger.*;
+import sun.jvm.hotspot.runtime.*;
+import sun.jvm.hotspot.types.*;
+
+public class GenerationSpec extends VMObject {
+ private static CIntegerField nameField;
+ private static CIntegerField initSizeField;
+ private static CIntegerField maxSizeField;
+
+ 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("GenerationSpec");
+
+ nameField = type.getCIntegerField("_name");
+ initSizeField = type.getCIntegerField("_init_size");
+ maxSizeField = type.getCIntegerField("_max_size");
+ }
+
+ public GenerationSpec(Address addr) {
+ super(addr);
+ }
+
+ public Generation.Name name() {
+ return Generation.nameForEnum((int)nameField.getValue(addr));
+ }
+
+ public long initSize() {
+ return initSizeField.getValue(addr);
+ }
+
+ public long maxSize() {
+ return maxSizeField.getValue(addr);
+ }
+}
--- a/hotspot/agent/src/share/classes/sun/jvm/hotspot/gc/shared/ImmutableSpace.java Mon May 18 17:09:47 2015 +0200
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,90 +0,0 @@
-/*
- * Copyright (c) 2003, 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.
- *
- */
-
-package sun.jvm.hotspot.gc.shared;
-
-import java.io.*;
-import java.util.*;
-
-import sun.jvm.hotspot.debugger.*;
-import sun.jvm.hotspot.memory.*;
-import sun.jvm.hotspot.runtime.*;
-import sun.jvm.hotspot.types.*;
-
-public abstract class ImmutableSpace extends VMObject {
- 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("ImmutableSpace");
- bottomField = type.getAddressField("_bottom");
- endField = type.getAddressField("_end");
- }
-
- public ImmutableSpace(Address addr) {
- super(addr);
- }
-
- // Fields
- private static AddressField bottomField;
- private static AddressField endField;
-
- // Accessors
- public Address bottom() { return bottomField.getValue(addr); }
- public Address end() { return endField.getValue(addr); }
-
- /** Returns a subregion of the space containing all the objects in
- the space. */
- public MemRegion usedRegion() {
- return new MemRegion(bottom(), end());
- }
-
- /** Support for iteration over heap -- not sure how this will
- interact with GC in reflective system, but necessary for the
- debugging mechanism */
- public OopHandle bottomAsOopHandle() {
- return bottomField.getOopHandle(addr);
- }
-
- /** returns all MemRegions where live objects are */
- public abstract List/*<MemRegion>*/ getLiveRegions();
-
- /** Returned value is in bytes */
- public long capacity() { return end().minus(bottom()); }
-
- public abstract long used();
-
- /** Testers */
- public boolean contains(Address p) {
- return (bottom().lessThanOrEqual(p) && end().greaterThan(p));
- }
-
- public void print() { printOn(System.out); }
- public abstract void printOn(PrintStream tty);
-}
--- a/hotspot/agent/src/share/classes/sun/jvm/hotspot/gc/shared/MutableSpace.java Mon May 18 17:09:47 2015 +0200
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,75 +0,0 @@
-/*
- * Copyright (c) 2003, 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.
- *
- */
-
-package sun.jvm.hotspot.gc.shared;
-
-import java.io.*;
-import java.util.*;
-
-import sun.jvm.hotspot.debugger.*;
-import sun.jvm.hotspot.memory.*;
-import sun.jvm.hotspot.runtime.*;
-import sun.jvm.hotspot.types.*;
-
-public class MutableSpace extends ImmutableSpace {
- 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("MutableSpace");
- topField = type.getAddressField("_top");
- }
-
- public MutableSpace(Address addr) {
- super(addr);
- }
-
- // Fields
- private static AddressField topField;
-
- // Accessors
- public Address top() { return topField.getValue(addr); }
-
- /** In bytes */
- public long used() {
- return top().minus(bottom());
- }
-
- /** returns all MemRegions where live objects are */
- public List/*<MemRegion>*/ getLiveRegions() {
- List res = new ArrayList();
- res.add(new MemRegion(bottom(), top()));
- return res;
- }
-
- public void printOn(PrintStream tty) {
- tty.print(" [" + bottom() + "," +
- top() + "," + end() + "] ");
- }
-}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/hotspot/agent/src/share/classes/sun/jvm/hotspot/gc/shared/OffsetTableContigSpace.java Tue May 19 09:41:52 2015 +0200
@@ -0,0 +1,35 @@
+/*
+ * 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.
+ *
+ */
+
+package sun.jvm.hotspot.gc.shared;
+
+import sun.jvm.hotspot.debugger.*;
+
+/** No additional functionality for now */
+
+public class OffsetTableContigSpace extends ContiguousSpace {
+ public OffsetTableContigSpace(Address addr) {
+ super(addr);
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/hotspot/agent/src/share/classes/sun/jvm/hotspot/gc/shared/Space.java Tue May 19 09:41:52 2015 +0200
@@ -0,0 +1,115 @@
+/*
+ * 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.
+ *
+ */
+
+package sun.jvm.hotspot.gc.shared;
+
+import java.io.*;
+import java.util.*;
+import sun.jvm.hotspot.debugger.*;
+import sun.jvm.hotspot.memory.*;
+import sun.jvm.hotspot.runtime.*;
+import sun.jvm.hotspot.types.*;
+
+/** <P> A Space describes a heap area. Class Space is an abstract base
+ class. </P>
+
+ <P> Space supports allocation, size computation and GC support is
+ provided. </P>
+
+ <P> Invariant: bottom() and end() are on page_size boundaries and: </P>
+
+ <P> bottom() <= top() <= end() </P>
+
+ <P> top() is inclusive and end() is exclusive. </P> */
+
+public abstract class Space extends VMObject {
+ private static AddressField bottomField;
+ private static AddressField endField;
+
+ 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("Space");
+
+ bottomField = type.getAddressField("_bottom");
+ endField = type.getAddressField("_end");
+ }
+
+ public Space(Address addr) {
+ super(addr);
+ }
+
+ public Address bottom() { return bottomField.getValue(addr); }
+ public Address end() { return endField.getValue(addr); }
+
+ /** Returns a subregion of the space containing all the objects in
+ the space. */
+ public MemRegion usedRegion() {
+ return new MemRegion(bottom(), end());
+ }
+
+ /** Support for iteration over heap -- not sure how this will
+ interact with GC in reflective system, but necessary for the
+ debugging mechanism */
+ public OopHandle bottomAsOopHandle() {
+ return bottomField.getOopHandle(addr);
+ }
+
+ /** Support for iteration over heap -- not sure how this will
+ interact with GC in reflective system, but necessary for the
+ debugging mechanism */
+ public OopHandle nextOopHandle(OopHandle handle, long size) {
+ return handle.addOffsetToAsOopHandle(size);
+ }
+
+ /** returns all MemRegions where live objects are */
+ public abstract List/*<MemRegion>*/ getLiveRegions();
+
+ /** Returned value is in bytes */
+ public long capacity() { return end().minus(bottom()); }
+ /** Returned value is in bytes */
+ public abstract long used();
+ /** Returned value is in bytes */
+ public abstract long free();
+
+ /** Testers */
+ public boolean contains(Address p) {
+ return (bottom().lessThanOrEqual(p) && end().greaterThan(p));
+ }
+
+ public void print() { printOn(System.out); }
+ public void printOn(PrintStream tty) {
+ tty.print(" space capacity = ");
+ tty.print(capacity());
+ tty.print(", ");
+ tty.print((double) used() * 100.0/ capacity());
+ tty.print(" used");
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/hotspot/agent/src/share/classes/sun/jvm/hotspot/gc/shared/SpaceClosure.java Tue May 19 09:41:52 2015 +0200
@@ -0,0 +1,29 @@
+/*
+ * 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.
+ *
+ */
+
+package sun.jvm.hotspot.gc.shared;
+
+public interface SpaceClosure {
+ public void doSpace(Space s);
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/hotspot/agent/src/share/classes/sun/jvm/hotspot/gc/shared/TenuredSpace.java Tue May 19 09:41:52 2015 +0200
@@ -0,0 +1,35 @@
+/*
+ * 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.
+ *
+ */
+
+package sun.jvm.hotspot.gc.shared;
+
+import sun.jvm.hotspot.debugger.*;
+
+/** No additional functionality for now */
+
+public class TenuredSpace extends OffsetTableContigSpace {
+ public TenuredSpace(Address addr) {
+ super(addr);
+ }
+}
--- a/hotspot/agent/src/share/classes/sun/jvm/hotspot/memory/AdaptiveFreeList.java Mon May 18 17:09:47 2015 +0200
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,77 +0,0 @@
-/*
- * @(#)AdaptiveFreeList.java
- *
- * Copyright (c) 2000, 2014, 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.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.types.CIntegerField;
-import sun.jvm.hotspot.types.Type;
-import sun.jvm.hotspot.types.TypeDataBase;
-
-public class AdaptiveFreeList extends VMObject {
- 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("AdaptiveFreeList<FreeChunk>");
- sizeField = type.getCIntegerField("_size");
- countField = type.getCIntegerField("_count");
- headerSize = type.getSize();
- }
-
- // Fields
- private static CIntegerField sizeField;
- private static CIntegerField countField;
- private static long headerSize;
-
- //Constructor
- public AdaptiveFreeList(Address address) {
- super(address);
- }
-
- // Accessors
- public long size() {
- return sizeField.getValue(addr);
- }
-
- public long count() {
- return countField.getValue(addr);
- }
-
- public static long sizeOf() {
- return headerSize;
- }
-}
--- a/hotspot/agent/src/share/classes/sun/jvm/hotspot/memory/CMSBitMap.java Mon May 18 17:09:47 2015 +0200
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,109 +0,0 @@
-/*
- * Copyright (c) 2007, 2010, 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.runtime.*;
-import sun.jvm.hotspot.types.*;
-import sun.jvm.hotspot.utilities.*;
-
-public class CMSBitMap extends VMObject {
- private static AddressField bmStartWordField;
- private static CIntegerField bmWordSizeField;
- private static CIntegerField shifterField;
- //private static AddressField bmField;
- private static long virtualSpaceFieldOffset;
-
- public CMSBitMap(Address addr) {
- super(addr);
- }
-
- 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("CMSBitMap");
- bmStartWordField = type.getAddressField("_bmStartWord");
- bmWordSizeField = type.getCIntegerField("_bmWordSize");
- shifterField = type.getCIntegerField("_shifter");
- //bmField = type.getAddressField("_bm");
- virtualSpaceFieldOffset = type.getField("_virtual_space").getOffset();
- }
- public void printAll() {
- System.out.println("bmStartWord(): "+bmStartWord());
- System.out.println("bmWordSize(): "+bmWordSize());
- System.out.println("shifter(): "+shifter());
- }
-
- public Address bmStartWord() {
- return bmStartWordField.getValue(addr);
- }
- public long bmWordSize() {
- return bmWordSizeField.getValue(addr);
- }
- public long shifter() {
- return shifterField.getValue(addr);
- }
- public VirtualSpace virtualSpace() {
- return (VirtualSpace) VMObjectFactory.newObject(VirtualSpace.class, addr.addOffsetTo(virtualSpaceFieldOffset));
- }
-
- public BitMap bm() {
- BitMap bitMap = new BitMap((int) (bmWordSize() >> shifter() ));
- VirtualSpace vs = virtualSpace();
- bitMap.set_map(vs.low());
- return bitMap;
- }
-
- public Address getNextMarkedWordAddress(Address addr) {
- Address endWord = bmStartWord().addOffsetTo(bmWordSize());
- int nextOffset = bm().getNextOneOffset(heapWordToOffset(addr), heapWordToOffset(endWord) );
- Address nextAddr = offsetToHeapWord(nextOffset);
- return nextAddr;
- }
-
- int heapWordToOffset(Address addr) {
- int temp = (int)addr.minus(bmStartWord()) / (int) VM.getVM().getAddressSize();
- int ret_val = temp >> shifter();
- return ret_val;
- }
-
- Address offsetToHeapWord(int offset) {
- int temp = offset << shifter();
- return bmStartWord().addOffsetTo(temp*VM.getVM().getAddressSize());
- }
-
- boolean isMarked(Address addr) {
- BitMap bm = bm();
- return bm.at(heapWordToOffset(addr));
- }
-}
--- a/hotspot/agent/src/share/classes/sun/jvm/hotspot/memory/CMSCollector.java Mon May 18 17:09:47 2015 +0200
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,74 +0,0 @@
-/*
- * Copyright (c) 2007, 2013, 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.runtime.*;
-import sun.jvm.hotspot.types.*;
-
-public class CMSCollector extends VMObject {
- private static long markBitMapFieldOffset;
-
- public CMSCollector(Address addr) {
- super(addr);
- }
-
- 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("CMSCollector");
- markBitMapFieldOffset = type.getField("_markBitMap").getOffset();
- }
-
- //Accessing mark bitmap
- public CMSBitMap markBitMap() {
- return (CMSBitMap) VMObjectFactory.newObject(
- CMSBitMap.class,
- addr.addOffsetTo(markBitMapFieldOffset));
- }
-
- public long blockSizeUsingPrintezisBits(Address addr) {
- CMSBitMap markBitMap = markBitMap();
- long addressSize = VM.getVM().getAddressSize();
- if ( markBitMap.isMarked(addr) && markBitMap.isMarked(addr.addOffsetTo(1*addressSize)) ) {
- Address nextOneAddr = markBitMap.getNextMarkedWordAddress(addr.addOffsetTo(2*addressSize));
- //return size in bytes
- long size = (nextOneAddr.addOffsetTo(1*addressSize)).minus(addr);
- return size;
- } else {
- //missing Printezis marks
- return -1;
- }
-
- }
-}
--- a/hotspot/agent/src/share/classes/sun/jvm/hotspot/memory/CardGeneration.java Mon May 18 17:09:47 2015 +0200
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,40 +0,0 @@
-/*
- * Copyright (c) 2000, 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 sun.jvm.hotspot.debugger.*;
-
-/** Class CardGeneration is a generation that is covered by a card
- table, and uses a card-size block-offset array to implement
- block_start. */
-
-public abstract class CardGeneration extends Generation {
- public CardGeneration(Address addr) {
- super(addr);
- }
-
- // FIXME: not sure what I need to expose from here in order to have
- // verification similar to that of the old RememberedSet
-}
--- a/hotspot/agent/src/share/classes/sun/jvm/hotspot/memory/CompactibleFreeListSpace.java Mon May 18 17:09:47 2015 +0200
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,221 +0,0 @@
-/*
- * Copyright (c) 2003, 2014, 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.PrintStream;
-import java.util.ArrayList;
-import java.util.Iterator;
-import java.util.List;
-import java.util.Observable;
-import java.util.Observer;
-
-import sun.jvm.hotspot.debugger.Address;
-import sun.jvm.hotspot.debugger.Debugger;
-import sun.jvm.hotspot.oops.ObjectHeap;
-import sun.jvm.hotspot.oops.Oop;
-import sun.jvm.hotspot.runtime.VM;
-import sun.jvm.hotspot.runtime.VMObjectFactory;
-import sun.jvm.hotspot.types.AddressField;
-import sun.jvm.hotspot.types.Type;
-import sun.jvm.hotspot.types.TypeDataBase;
-import sun.jvm.hotspot.utilities.Assert;
-
-public class CompactibleFreeListSpace extends CompactibleSpace {
- private static AddressField collectorField;
- private static AddressField indexedFreeListField;
- private static AddressField dictionaryField;
- private static long smallLinearAllocBlockFieldOffset;
-
- private int heapWordSize; // 4 for 32bit, 8 for 64 bits
- private int IndexSetStart; // for small indexed list
- private int IndexSetSize;
- private int IndexSetStride;
-
- static {
- VM.registerVMInitializedObserver(new Observer() {
- public void update(Observable o, Object data) {
- initialize(VM.getVM().getTypeDataBase());
- }
- });
- }
-
- private static synchronized void initialize(TypeDataBase db) {
- long sizeofFreeChunk = db.lookupType("FreeChunk").getSize();
- VM vm = VM.getVM();
- MinChunkSizeInBytes = numQuanta(sizeofFreeChunk, vm.getMinObjAlignmentInBytes()) *
- vm.getMinObjAlignmentInBytes();
-
- Type type = db.lookupType("CompactibleFreeListSpace");
- collectorField = type.getAddressField("_collector");
- collectorField = type.getAddressField("_collector");
- dictionaryField = type.getAddressField("_dictionary");
- indexedFreeListField = type.getAddressField("_indexedFreeList[0]");
- smallLinearAllocBlockFieldOffset = type.getField("_smallLinearAllocBlock").getOffset();
- }
-
- public CompactibleFreeListSpace(Address addr) {
- super(addr);
- VM vm = VM.getVM();
- heapWordSize = vm.getHeapWordSize();
- IndexSetStart = vm.getMinObjAlignmentInBytes() / heapWordSize;
- IndexSetStride = IndexSetStart;
- IndexSetSize = 257;
- }
-
- // Accessing block offset table
- public CMSCollector collector() {
- return (CMSCollector) VMObjectFactory.newObject(
- CMSCollector.class,
- collectorField.getValue(addr));
- }
-
- public long free0() {
- return capacity() - used0();
- }
-
- public long used() {
- return capacity() - free();
- }
-
- public long used0() {
- List regions = getLiveRegions();
- long usedSize = 0L;
- for (Iterator itr = regions.iterator(); itr.hasNext();) {
- MemRegion mr = (MemRegion) itr.next();
- usedSize += mr.byteSize();
- }
- return usedSize;
- }
-
- public long free() {
- // small chunks
- long size = 0;
- Address cur = addr.addOffsetTo( indexedFreeListField.getOffset() );
- cur = cur.addOffsetTo(IndexSetStart*AdaptiveFreeList.sizeOf());
- for (int i=IndexSetStart; i<IndexSetSize; i += IndexSetStride) {
- AdaptiveFreeList freeList = (AdaptiveFreeList) VMObjectFactory.newObject(AdaptiveFreeList.class, cur);
- size += i*freeList.count();
- cur= cur.addOffsetTo(IndexSetStride*AdaptiveFreeList.sizeOf());
- }
-
- // large block
- AFLBinaryTreeDictionary aflbd = (AFLBinaryTreeDictionary) VMObjectFactory.newObject(AFLBinaryTreeDictionary.class,
- dictionaryField.getValue(addr));
- size += aflbd.size();
-
-
- // linear block in TLAB
- LinearAllocBlock lab = (LinearAllocBlock) VMObjectFactory.newObject(LinearAllocBlock.class,
- addr.addOffsetTo(smallLinearAllocBlockFieldOffset));
- size += lab.word_size();
-
- return size*heapWordSize;
- }
-
- public void printOn(PrintStream tty) {
- tty.print("free-list-space");
- tty.print("[ " + bottom() + " , " + end() + " ) ");
- long cap = capacity();
- long used_size = used();
- long free_size = free();
- int used_perc = (int)((double)used_size/cap*100);
- tty.print("space capacity = " + cap + " used(" + used_perc + "%)= " + used_size + " ");
- tty.print("free= " + free_size );
- tty.print("\n");
-
- }
-
- public Address skipBlockSizeUsingPrintezisBits(Address pos) {
- CMSCollector collector = collector();
- long size = 0;
- Address addr = null;
-
- if (collector != null) {
- size = collector.blockSizeUsingPrintezisBits(pos);
- if (size >= 3) {
- addr = pos.addOffsetTo(adjustObjectSizeInBytes(size));
- }
- }
- return addr;
- }
-
- public List/*<MemRegion>*/ getLiveRegions() {
- List res = new ArrayList(); // List<MemRegion>
- VM vm = VM.getVM();
- Debugger dbg = vm.getDebugger();
- ObjectHeap heap = vm.getObjectHeap();
- Address cur = bottom();
- Address regionStart = cur;
- Address limit = end();
- final long addressSize = vm.getAddressSize();
-
- for (; cur.lessThan(limit);) {
- Address k = cur.getAddressAt(addressSize);
- if (FreeChunk.indicatesFreeChunk(cur)) {
- if (! cur.equals(regionStart)) {
- res.add(new MemRegion(regionStart, cur));
- }
- FreeChunk fc = (FreeChunk) VMObjectFactory.newObject(FreeChunk.class, cur);
- long chunkSize = fc.size();
- if (Assert.ASSERTS_ENABLED) {
- Assert.that(chunkSize > 0, "invalid FreeChunk size");
- }
- // note that fc.size() gives chunk size in heap words
- cur = cur.addOffsetTo(chunkSize * addressSize);
- regionStart = cur;
- } else if (k != null) {
- Oop obj = heap.newOop(cur.addOffsetToAsOopHandle(0));
- long objectSize = obj.getObjectSize();
- cur = cur.addOffsetTo(adjustObjectSizeInBytes(objectSize));
- } else {
- // FIXME: need to do a better job here.
- // can I use bitMap here?
- //Find the object size using Printezis bits and skip over
- long size = collector().blockSizeUsingPrintezisBits(cur);
- if (size == -1) {
- break;
- }
- cur = cur.addOffsetTo(adjustObjectSizeInBytes(size));
- }
- }
- return res;
- }
-
- //-- Internals only below this point
-
- // Unlike corresponding VM code, we operate on byte size rather than
- // HeapWord size for convenience.
-
- private static long numQuanta(long x, long y) {
- return ((x+y-1)/y);
- }
-
- public static long adjustObjectSizeInBytes(long sizeInBytes) {
- return Oop.alignObjectSize(Math.max(sizeInBytes, MinChunkSizeInBytes));
- }
-
- // FIXME: should I read this directly from VM?
- private static long MinChunkSizeInBytes;
-}
--- a/hotspot/agent/src/share/classes/sun/jvm/hotspot/memory/CompactibleSpace.java Mon May 18 17:09:47 2015 +0200
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,64 +0,0 @@
-/*
- * Copyright (c) 2000, 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.util.*;
-
-import sun.jvm.hotspot.debugger.*;
-import sun.jvm.hotspot.runtime.*;
-import sun.jvm.hotspot.types.*;
-
-/** A space that supports compaction operations. This is usually, but
- not necessarily, a space that is normally contiguous. But, for
- example, a free-list-based space whose normal collection is a
- mark-sweep without compaction could still support compaction in
- full GC's. */
-
-public abstract class CompactibleSpace extends Space {
- private static AddressField compactionTopField;
-
- 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("CompactibleSpace");
-
- compactionTopField = type.getAddressField("_compaction_top");
- }
-
- public CompactibleSpace(Address addr) {
- super(addr);
- }
-
- /** May be used temporarily during a compaction phase. */
- public Address compactionTop() {
- return compactionTopField.getValue(addr);
- }
-}
--- a/hotspot/agent/src/share/classes/sun/jvm/hotspot/memory/ConcurrentMarkSweepGeneration.java Mon May 18 17:09:47 2015 +0200
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,81 +0,0 @@
-/*
- * Copyright (c) 2003, 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.runtime.*;
-import sun.jvm.hotspot.types.*;
-
-public class ConcurrentMarkSweepGeneration extends CardGeneration {
- private static AddressField cmsSpaceField;
-
- public ConcurrentMarkSweepGeneration(Address addr) {
- super(addr);
- }
-
- 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("ConcurrentMarkSweepGeneration");
- cmsSpaceField = type.getAddressField("_cmsSpace");
- }
-
- // Accessing space
- public CompactibleFreeListSpace cmsSpace() {
- return (CompactibleFreeListSpace) VMObjectFactory.newObject(
- CompactibleFreeListSpace.class,
- cmsSpaceField.getValue(addr));
- }
-
- public long capacity() { return cmsSpace().capacity(); }
- public long used() { return cmsSpace().used(); }
- public long free() { return cmsSpace().free(); }
- public long contiguousAvailable() { throw new RuntimeException("not yet implemented"); }
- public boolean contains(Address p) { return cmsSpace().contains(p); }
- public void spaceIterate(SpaceClosure blk, boolean usedOnly) {
- blk.doSpace(cmsSpace());
- }
-
- public Generation.Name kind() {
- return Generation.Name.CONCURRENT_MARK_SWEEP;
- }
-
- public String name() {
- return "concurrent mark-sweep generation";
- }
-
- public void printOn(PrintStream tty) {
- tty.println(name());
- cmsSpace().printOn(tty);
- }
-}
--- a/hotspot/agent/src/share/classes/sun/jvm/hotspot/memory/ContiguousSpace.java Mon May 18 17:09:47 2015 +0200
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,97 +0,0 @@
-/*
- * Copyright (c) 2000, 2004, 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.runtime.*;
-import sun.jvm.hotspot.types.*;
-
-public class ContiguousSpace extends CompactibleSpace {
- private static AddressField topField;
-
- 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("ContiguousSpace");
-
- topField = type.getAddressField("_top");
- }
-
- public ContiguousSpace(Address addr) {
- super(addr);
- }
-
- public Address top() {
- return topField.getValue(addr);
- }
-
- /** In bytes */
- public long capacity() {
- return end().minus(bottom());
- }
-
- /** In bytes */
- public long used() {
- return top().minus(bottom());
- }
-
- /** In bytes */
- public long free() {
- return end().minus(top());
- }
-
- /** In a contiguous space we have a more obvious bound on what parts
- contain objects. */
- public MemRegion usedRegion() {
- return new MemRegion(bottom(), top());
- }
-
- /** Returns regions of Space where live objects live */
- public List/*<MemRegion>*/ getLiveRegions() {
- List res = new ArrayList();
- res.add(new MemRegion(bottom(), top()));
- return res;
- }
-
- /** Testers */
- public boolean contains(Address p) {
- return (bottom().lessThanOrEqual(p) && top().greaterThan(p));
- }
-
- public void printOn(PrintStream tty) {
- tty.print(" [" + bottom() + "," +
- top() + "," + end() + ")");
- super.printOn(tty);
- }
-}
--- a/hotspot/agent/src/share/classes/sun/jvm/hotspot/memory/DefNewGeneration.java Mon May 18 17:09:47 2015 +0200
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,104 +0,0 @@
-/*
- * Copyright (c) 2000, 2008, 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.runtime.*;
-import sun.jvm.hotspot.types.*;
-
-/** DefNewGeneration is a young generation containing eden, from- and
- to-space. */
-
-public class DefNewGeneration extends Generation {
- protected static AddressField edenSpaceField;
- protected static AddressField fromSpaceField;
- protected static AddressField toSpaceField;
-
- 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("DefNewGeneration");
-
- edenSpaceField = type.getAddressField("_eden_space");
- fromSpaceField = type.getAddressField("_from_space");
- toSpaceField = type.getAddressField("_to_space");
- }
-
- public DefNewGeneration(Address addr) {
- super(addr);
- }
-
- public Generation.Name kind() {
- return Generation.Name.DEF_NEW;
- }
-
- // Accessing spaces
- public ContiguousSpace eden() {
- return (ContiguousSpace) VMObjectFactory.newObject(ContiguousSpace.class, edenSpaceField.getValue(addr));
- }
-
- public ContiguousSpace from() {
- return (ContiguousSpace) VMObjectFactory.newObject(ContiguousSpace.class, fromSpaceField.getValue(addr));
- }
-
- public ContiguousSpace to() {
- return (ContiguousSpace) VMObjectFactory.newObject(ContiguousSpace.class, toSpaceField.getValue(addr));
- }
-
- public long capacity() { return eden().capacity() + from().capacity(); /* to() is only used during scavenge */ }
- public long used() { return eden().used() + from().used(); /* to() is only used during scavenge */ }
- public long free() { return eden().free() + from().free(); /* to() is only used during scavenge */ }
- public long contiguousAvailable() { return eden().free(); }
-
- public String name() {
- return "default new generation";
- }
-
- public void spaceIterate(SpaceClosure blk, boolean usedOnly) {
- blk.doSpace(eden());
- blk.doSpace(from());
- if (!usedOnly) {
- blk.doSpace(to());
- }
- }
-
- public void printOn(PrintStream tty) {
- tty.print(" eden");
- eden().printOn(tty);
- tty.print("\n from");
- from().printOn(tty);
- tty.print("\n to ");
- to().printOn(tty);
- }
-}
--- a/hotspot/agent/src/share/classes/sun/jvm/hotspot/memory/GenCollectedHeap.java Mon May 18 17:09:47 2015 +0200
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,152 +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.
- *
- */
-
-package sun.jvm.hotspot.memory;
-
-import java.io.*;
-import java.util.*;
-
-import sun.jvm.hotspot.debugger.*;
-import sun.jvm.hotspot.gc.shared.*;
-import sun.jvm.hotspot.runtime.*;
-import sun.jvm.hotspot.types.*;
-import sun.jvm.hotspot.utilities.*;
-
-public class GenCollectedHeap extends CollectedHeap {
- private static AddressField youngGenField;
- private static AddressField oldGenField;
-
- private static AddressField youngGenSpecField;
- private static AddressField oldGenSpecField;
-
- private static GenerationFactory genFactory;
-
- 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("GenCollectedHeap");
-
- youngGenField = type.getAddressField("_young_gen");
- oldGenField = type.getAddressField("_old_gen");
-
- genFactory = new GenerationFactory();
-
- Type collectorPolicyType = db.lookupType("GenCollectorPolicy");
- youngGenSpecField = collectorPolicyType.getAddressField("_young_gen_spec");
- oldGenSpecField = collectorPolicyType.getAddressField("_old_gen_spec");
- }
-
- public GenCollectedHeap(Address addr) {
- super(addr);
- }
-
- public int nGens() {
- return 2; // Young + Old
- }
-
- public Generation getGen(int i) {
- if (Assert.ASSERTS_ENABLED) {
- Assert.that((i == 0) || (i == 1), "Index " + i +
- " out of range (should be 0 or 1)");
- }
-
- switch (i) {
- case 0:
- return genFactory.newObject(youngGenField.getValue(addr));
- case 1:
- return genFactory.newObject(oldGenField.getValue(addr));
- default:
- // no generation for i, and assertions disabled.
- return null;
- }
- }
-
- public boolean isIn(Address a) {
- for (int i = 0; i < nGens(); i++) {
- Generation gen = getGen(i);
- if (gen.isIn(a)) {
- return true;
- }
- }
-
- return false;
- }
-
- public long capacity() {
- long capacity = 0;
- for (int i = 0; i < nGens(); i++) {
- capacity += getGen(i).capacity();
- }
- return capacity;
- }
-
- public long used() {
- long used = 0;
- for (int i = 0; i < nGens(); i++) {
- used += getGen(i).used();
- }
- return used;
- }
-
- /** Package-private access to GenerationSpecs */
- GenerationSpec spec(int level) {
- if (Assert.ASSERTS_ENABLED) {
- Assert.that((level == 0) || (level == 1), "Index " + level +
- " out of range (should be 0 or 1)");
- }
-
- if ((level != 0) && (level != 1)) {
- return null;
- }
-
- if (level == 0) {
- return (GenerationSpec)
- VMObjectFactory.newObject(GenerationSpec.class,
- youngGenSpecField.getAddress());
- } else {
- return (GenerationSpec)
- VMObjectFactory.newObject(GenerationSpec.class,
- oldGenSpecField.getAddress());
- }
- }
-
- public CollectedHeapName kind() {
- return CollectedHeapName.GEN_COLLECTED_HEAP;
- }
-
- public void printOn(PrintStream tty) {
- for (int i = 0; i < nGens(); i++) {
- tty.print("Gen " + i + ": ");
- getGen(i).printOn(tty);
- tty.println("Invocations: " + getGen(i).invocations());
- tty.println();
- }
- }
-}
--- a/hotspot/agent/src/share/classes/sun/jvm/hotspot/memory/Generation.java Mon May 18 17:09:47 2015 +0200
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,214 +0,0 @@
-/*
- * Copyright (c) 2000, 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.types.*;
-import sun.jvm.hotspot.runtime.*;
-
-/** <P> The (supported) Generation hierarchy currently looks like this: </P>
-
- <ul>
- <li> Generation
- <ul>
- <li> CardGeneration
- <ul>
- <li> TenuredGeneration
- </ul>
- <li> DefNewGeneration
- </ul>
- </ul>
-*/
-
-
-public abstract class Generation extends VMObject {
- private static long reservedFieldOffset;
- private static long virtualSpaceFieldOffset;
- private static CIntegerField levelField;
- protected static final int K = 1024;
- // Fields for class StatRecord
- private static Field statRecordField;
- private static CIntegerField invocationField;
-
- // constants from Name enum
- private static int NAME_DEF_NEW;
- private static int NAME_PAR_NEW;
- private static int NAME_MARK_SWEEP_COMPACT;
- private static int NAME_CONCURRENT_MARK_SWEEP;
- private static int NAME_OTHER;
-
- 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("Generation");
-
- reservedFieldOffset = type.getField("_reserved").getOffset();
- virtualSpaceFieldOffset = type.getField("_virtual_space").getOffset();
- levelField = type.getCIntegerField("_level");
- // StatRecord
- statRecordField = type.getField("_stat_record");
- type = db.lookupType("Generation::StatRecord");
- invocationField = type.getCIntegerField("invocations");
-
- // constants from Generation::Name
- NAME_DEF_NEW = db.lookupIntConstant("Generation::DefNew").intValue();
- NAME_PAR_NEW = db.lookupIntConstant("Generation::ParNew").intValue();
- NAME_MARK_SWEEP_COMPACT = db.lookupIntConstant("Generation::MarkSweepCompact").intValue();
- NAME_CONCURRENT_MARK_SWEEP = db.lookupIntConstant("Generation::ConcurrentMarkSweep").intValue();
- NAME_OTHER = db.lookupIntConstant("Generation::Other").intValue();
- }
-
- public Generation(Address addr) {
- super(addr);
- }
-
- public static class Name {
- public static final Name DEF_NEW = new Name("DefNew");
- public static final Name PAR_NEW = new Name("ParNew");
- public static final Name MARK_SWEEP_COMPACT = new Name("MarkSweepCompact");
- public static final Name CONCURRENT_MARK_SWEEP = new Name("ConcurrentMarkSweep");
- public static final Name OTHER = new Name("Other");
-
- private Name(String value) {
- this.value = value;
- }
-
- private String value;
- public String toString() {
- return value;
- }
- }
-
- public Generation.Name kind() {
- return Generation.Name.OTHER;
- }
-
- static Generation.Name nameForEnum(int value) {
- if (value == NAME_DEF_NEW) {
- return Name.DEF_NEW;
- } else if (value == NAME_PAR_NEW) {
- return Name.PAR_NEW;
- } else if (value == NAME_MARK_SWEEP_COMPACT) {
- return Name.MARK_SWEEP_COMPACT;
- } else if (value == NAME_CONCURRENT_MARK_SWEEP) {
- return Name.CONCURRENT_MARK_SWEEP;
- } else if (value == NAME_OTHER) {
- return Name.OTHER;
- } else {
- throw new RuntimeException("should not reach here");
- }
- }
-
- public GenerationSpec spec() {
- return ((GenCollectedHeap) VM.getVM().getUniverse().heap()).spec(level());
- }
-
- public int level() {
- return (int) levelField.getValue(addr);
- }
-
- public int invocations() {
- return getStatRecord().getInvocations();
- }
-
- /** The maximum number of object bytes the generation can currently
- hold. */
- public abstract long capacity();
-
- /** The number of used bytes in the gen. */
- public abstract long used();
-
- /** The number of free bytes in the gen. */
- public abstract long free();
-
- /** The largest number of contiguous free words in the generation,
- including expansion. (VM's version assumes it is called at a
- safepoint.) */
- public abstract long contiguousAvailable();
-
- public MemRegion reserved() {
- return new MemRegion(addr.addOffsetTo(reservedFieldOffset));
- }
-
- /** Returns a region guaranteed to contain all the objects in the
- generation. */
- public MemRegion usedRegion() {
- return reserved();
- }
-
- /* Returns "TRUE" iff "p" points into an allocated object in the
- generation. */
- public boolean isIn(Address p) {
- GenerationIsInClosure blk = new GenerationIsInClosure(p);
- spaceIterate(blk);
- return (blk.space() != null);
- }
-
- /** Returns "TRUE" iff "p" points into the reserved area of the
- generation. */
- public boolean isInReserved(Address p) {
- return reserved().contains(p);
- }
-
- protected VirtualSpace virtualSpace() {
- return (VirtualSpace) VMObjectFactory.newObject(VirtualSpace.class, addr.addOffsetTo(virtualSpaceFieldOffset));
- }
-
- public abstract String name();
-
- /** Equivalent to spaceIterate(blk, false) */
- public void spaceIterate(SpaceClosure blk) {
- spaceIterate(blk, false);
- }
-
- /** Iteration - do not use for time critical operations */
- public abstract void spaceIterate(SpaceClosure blk, boolean usedOnly);
-
- public void print() { printOn(System.out); }
- public abstract void printOn(PrintStream tty);
-
- public static class StatRecord extends VMObject {
- public StatRecord(Address addr) {
- super(addr);
- }
-
- public int getInvocations() {
- return (int) invocationField.getValue(addr);
- }
-
- }
-
- private StatRecord getStatRecord() {
- return (StatRecord) VMObjectFactory.newObject(Generation.StatRecord.class, addr.addOffsetTo(statRecordField.getOffset()));
- }
-}
--- a/hotspot/agent/src/share/classes/sun/jvm/hotspot/memory/GenerationFactory.java Mon May 18 17:09:47 2015 +0200
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,86 +0,0 @@
-/*
- * Copyright (c) 2000, 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.util.*;
-
-import sun.jvm.hotspot.debugger.*;
-import sun.jvm.hotspot.runtime.*;
-import sun.jvm.hotspot.types.*;
-
-/** Factory containing a VirtualConstructor suitable for instantiating
- wrapper objects for all types of generations */
-
-public class GenerationFactory {
- 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) {
- ctor = new VirtualConstructor(db);
-
- ctor.addMapping("DefNewGeneration", DefNewGeneration.class);
- ctor.addMapping("ParNewGeneration", ParNewGeneration.class);
- ctor.addMapping("TenuredGeneration", TenuredGeneration.class);
- ctor.addMapping("ConcurrentMarkSweepGeneration", ConcurrentMarkSweepGeneration.class);
- }
-
- public static Generation newObject(Address addr) {
- try {
- return (Generation) ctor.instantiateWrapperFor(addr);
- } catch (WrongTypeException e) {
- return new Generation(addr) {
- public String name() {
- return "unknown generation type";
- }
- public void spaceIterate(SpaceClosure blk, boolean usedOnly) {
- }
- public void printOn(java.io.PrintStream tty) {
- tty.println("unknown subtype of Generation @ " + getAddress() + " (" +
- virtualSpace().low() + "," + virtualSpace().high() + ")");
- }
- public long used() {
- return 0;
- }
- public long free() {
- return 0;
- }
- public long capacity() {
- return 0;
- }
- public long contiguousAvailable() {
- return 0;
- }
-
- };
- }
- }
-}
--- a/hotspot/agent/src/share/classes/sun/jvm/hotspot/memory/GenerationIsInClosure.java Mon May 18 17:09:47 2015 +0200
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,48 +0,0 @@
-/*
- * Copyright (c) 2000, 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 sun.jvm.hotspot.debugger.*;
-
-/** Should only be used once */
-
-class GenerationIsInClosure implements SpaceClosure {
- private Address p;
- private Space sp;
-
- GenerationIsInClosure(Address p) {
- this.p = p;
- }
-
- public void doSpace(Space s) {
- if (s.contains(p)) {
- sp = s;
- }
- }
-
- Space space() {
- return sp;
- }
-}
--- a/hotspot/agent/src/share/classes/sun/jvm/hotspot/memory/GenerationSpec.java Mon May 18 17:09:47 2015 +0200
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,69 +0,0 @@
-/*
- * Copyright (c) 2000, 2003, 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.util.*;
-
-import sun.jvm.hotspot.debugger.*;
-import sun.jvm.hotspot.runtime.*;
-import sun.jvm.hotspot.types.*;
-
-public class GenerationSpec extends VMObject {
- private static CIntegerField nameField;
- private static CIntegerField initSizeField;
- private static CIntegerField maxSizeField;
-
- 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("GenerationSpec");
-
- nameField = type.getCIntegerField("_name");
- initSizeField = type.getCIntegerField("_init_size");
- maxSizeField = type.getCIntegerField("_max_size");
- }
-
- public GenerationSpec(Address addr) {
- super(addr);
- }
-
- public Generation.Name name() {
- return Generation.nameForEnum((int)nameField.getValue(addr));
- }
-
- public long initSize() {
- return initSizeField.getValue(addr);
- }
-
- public long maxSize() {
- return maxSizeField.getValue(addr);
- }
-}
--- a/hotspot/agent/src/share/classes/sun/jvm/hotspot/memory/LinearAllocBlock.java Mon May 18 17:09:47 2015 +0200
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,59 +0,0 @@
-/*
- * @(#)BinaryTreeDictionary.java
- * Copyright (c) 2000, 2008, 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.util.*;
-import sun.jvm.hotspot.debugger.*;
-import sun.jvm.hotspot.types.*;
-import sun.jvm.hotspot.runtime.*;
-
-public class LinearAllocBlock extends VMObject {
- 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("LinearAllocBlock");
- word_sizeField= type.getCIntegerField("_word_size");
- }
-
- // Fields
- private static CIntegerField word_sizeField;
-
- // Accessors
- public long word_size() {
- return word_sizeField.getValue(addr);
- }
-
- // Constructor
- public LinearAllocBlock(Address addr) {
- super(addr);
- }
-}
--- a/hotspot/agent/src/share/classes/sun/jvm/hotspot/memory/OffsetTableContigSpace.java Mon May 18 17:09:47 2015 +0200
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,35 +0,0 @@
-/*
- * Copyright (c) 2000, 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 sun.jvm.hotspot.debugger.*;
-
-/** No additional functionality for now */
-
-public class OffsetTableContigSpace extends ContiguousSpace {
- public OffsetTableContigSpace(Address addr) {
- super(addr);
- }
-}
--- a/hotspot/agent/src/share/classes/sun/jvm/hotspot/memory/ParNewGeneration.java Mon May 18 17:09:47 2015 +0200
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,37 +0,0 @@
-/*
- * Copyright (c) 2003, 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 sun.jvm.hotspot.debugger.*;
-
-public class ParNewGeneration extends DefNewGeneration {
- public ParNewGeneration(Address addr) {
- super(addr);
- }
-
- public Generation.Name kind() {
- return Generation.Name.PAR_NEW;
- }
-}
--- a/hotspot/agent/src/share/classes/sun/jvm/hotspot/memory/Space.java Mon May 18 17:09:47 2015 +0200
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,114 +0,0 @@
-/*
- * Copyright (c) 2000, 2003, 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.types.*;
-import sun.jvm.hotspot.runtime.*;
-
-/** <P> A Space describes a heap area. Class Space is an abstract base
- class. </P>
-
- <P> Space supports allocation, size computation and GC support is
- provided. </P>
-
- <P> Invariant: bottom() and end() are on page_size boundaries and: </P>
-
- <P> bottom() <= top() <= end() </P>
-
- <P> top() is inclusive and end() is exclusive. </P> */
-
-public abstract class Space extends VMObject {
- private static AddressField bottomField;
- private static AddressField endField;
-
- 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("Space");
-
- bottomField = type.getAddressField("_bottom");
- endField = type.getAddressField("_end");
- }
-
- public Space(Address addr) {
- super(addr);
- }
-
- public Address bottom() { return bottomField.getValue(addr); }
- public Address end() { return endField.getValue(addr); }
-
- /** Returns a subregion of the space containing all the objects in
- the space. */
- public MemRegion usedRegion() {
- return new MemRegion(bottom(), end());
- }
-
- /** Support for iteration over heap -- not sure how this will
- interact with GC in reflective system, but necessary for the
- debugging mechanism */
- public OopHandle bottomAsOopHandle() {
- return bottomField.getOopHandle(addr);
- }
-
- /** Support for iteration over heap -- not sure how this will
- interact with GC in reflective system, but necessary for the
- debugging mechanism */
- public OopHandle nextOopHandle(OopHandle handle, long size) {
- return handle.addOffsetToAsOopHandle(size);
- }
-
- /** returns all MemRegions where live objects are */
- public abstract List/*<MemRegion>*/ getLiveRegions();
-
- /** Returned value is in bytes */
- public long capacity() { return end().minus(bottom()); }
- /** Returned value is in bytes */
- public abstract long used();
- /** Returned value is in bytes */
- public abstract long free();
-
- /** Testers */
- public boolean contains(Address p) {
- return (bottom().lessThanOrEqual(p) && end().greaterThan(p));
- }
-
- public void print() { printOn(System.out); }
- public void printOn(PrintStream tty) {
- tty.print(" space capacity = ");
- tty.print(capacity());
- tty.print(", ");
- tty.print((double) used() * 100.0/ capacity());
- tty.print(" used");
- }
-}
--- a/hotspot/agent/src/share/classes/sun/jvm/hotspot/memory/SpaceClosure.java Mon May 18 17:09:47 2015 +0200
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,29 +0,0 @@
-/*
- * Copyright (c) 2000, 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;
-
-public interface SpaceClosure {
- public void doSpace(Space s);
-}
--- a/hotspot/agent/src/share/classes/sun/jvm/hotspot/memory/TenuredGeneration.java Mon May 18 17:09:47 2015 +0200
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,90 +0,0 @@
-/*
- * Copyright (c) 2000, 2014, 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.runtime.*;
-import sun.jvm.hotspot.types.*;
-
-/** <P> TenuredGeneration models a heap of old objects contained
- in a single contiguous space. </P>
-
- <P> Garbage collection is performed using mark-compact. </P> */
-
-public class TenuredGeneration extends CardGeneration {
- private static AddressField theSpaceField;
-
- 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("TenuredGeneration");
-
- theSpaceField = type.getAddressField("_the_space");
- }
-
- public TenuredGeneration(Address addr) {
- super(addr);
- }
-
- public ContiguousSpace theSpace() {
- return (ContiguousSpace) VMObjectFactory.newObject(ContiguousSpace.class, theSpaceField.getValue(addr));
- }
-
- public boolean isIn(Address p) {
- return theSpace().contains(p);
- }
-
- /** Space queries */
- public long capacity() { return theSpace().capacity(); }
- public long used() { return theSpace().used(); }
- public long free() { return theSpace().free(); }
- public long contiguousAvailable() { return theSpace().free() + virtualSpace().uncommittedSize(); }
-
- public void spaceIterate(SpaceClosure blk, boolean usedOnly) {
- blk.doSpace(theSpace());
- }
-
- public void printOn(PrintStream tty) {
- tty.print(" old ");
- theSpace().printOn(tty);
- }
-
- public Generation.Name kind() {
- return Generation.Name.MARK_SWEEP_COMPACT;
- }
-
- public String name() {
- return "tenured generation";
- }
-}
--- a/hotspot/agent/src/share/classes/sun/jvm/hotspot/memory/TenuredSpace.java Mon May 18 17:09:47 2015 +0200
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,35 +0,0 @@
-/*
- * Copyright (c) 2000, 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 sun.jvm.hotspot.debugger.*;
-
-/** No additional functionality for now */
-
-public class TenuredSpace extends OffsetTableContigSpace {
- public TenuredSpace(Address addr) {
- super(addr);
- }
-}
--- a/hotspot/agent/src/share/classes/sun/jvm/hotspot/oops/ObjectHeap.java Mon May 18 17:09:47 2015 +0200
+++ b/hotspot/agent/src/share/classes/sun/jvm/hotspot/oops/ObjectHeap.java Tue May 19 09:41:52 2015 +0200
@@ -32,6 +32,7 @@
import java.util.*;
import sun.jvm.hotspot.debugger.*;
+import sun.jvm.hotspot.gc.cms.*;
import sun.jvm.hotspot.gc.shared.*;
import sun.jvm.hotspot.gc.g1.*;
import sun.jvm.hotspot.gc.parallel.*;
--- a/hotspot/agent/src/share/classes/sun/jvm/hotspot/tools/HeapSummary.java Mon May 18 17:09:47 2015 +0200
+++ b/hotspot/agent/src/share/classes/sun/jvm/hotspot/tools/HeapSummary.java Tue May 19 09:41:52 2015 +0200
@@ -25,9 +25,9 @@
package sun.jvm.hotspot.tools;
import java.util.*;
-import sun.jvm.hotspot.gc.shared.*;
import sun.jvm.hotspot.gc.g1.*;
import sun.jvm.hotspot.gc.parallel.*;
+import sun.jvm.hotspot.gc.serial.*;
import sun.jvm.hotspot.gc.shared.*;
import sun.jvm.hotspot.debugger.JVMDebugger;
import sun.jvm.hotspot.memory.*;
@@ -85,7 +85,7 @@
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) {
+ if (gen instanceof DefNewGeneration) {
System.out.println("New Generation (Eden + 1 Survivor Space):");
printGen(gen);