aboutsummaryrefslogtreecommitdiff
path: root/agent
diff options
context:
space:
mode:
authorsjohanss <none@none>2014-02-17 09:51:37 +0100
committersjohanss <none@none>2014-02-17 09:51:37 +0100
commit766ac090f7852fe2100513b48c9a502c2a163740 (patch)
treede156a34530e3794cf2296a82bc74dc86e0d96d6 /agent
parent9182af13ad5d9c033818c6cdc8ccc90c88b1a02f (diff)
downloadjdk8u_hotspot-766ac090f7852fe2100513b48c9a502c2a163740.tar.gz
8033440: jmap reports unexpected used/free size of concurrent mark-sweep generation
Summary: SA used the wrong type for the indexedFreeList in CompactibleFreeListSpace. Reviewed-by: coleenp, dsamersoff
Diffstat (limited to 'agent')
-rw-r--r--agent/src/share/classes/sun/jvm/hotspot/memory/AdaptiveFreeList.java77
-rw-r--r--agent/src/share/classes/sun/jvm/hotspot/memory/CompactibleFreeListSpace.java38
-rw-r--r--agent/src/share/classes/sun/jvm/hotspot/memory/FreeList.java72
3 files changed, 98 insertions, 89 deletions
diff --git a/agent/src/share/classes/sun/jvm/hotspot/memory/AdaptiveFreeList.java b/agent/src/share/classes/sun/jvm/hotspot/memory/AdaptiveFreeList.java
new file mode 100644
index 000000000..19dca2610
--- /dev/null
+++ b/agent/src/share/classes/sun/jvm/hotspot/memory/AdaptiveFreeList.java
@@ -0,0 +1,77 @@
+/*
+ * @(#)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;
+ }
+}
diff --git a/agent/src/share/classes/sun/jvm/hotspot/memory/CompactibleFreeListSpace.java b/agent/src/share/classes/sun/jvm/hotspot/memory/CompactibleFreeListSpace.java
index 23cb0bcb7..ed26af725 100644
--- a/agent/src/share/classes/sun/jvm/hotspot/memory/CompactibleFreeListSpace.java
+++ b/agent/src/share/classes/sun/jvm/hotspot/memory/CompactibleFreeListSpace.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2003, 2013, Oracle and/or its affiliates. All rights reserved.
+ * 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
@@ -24,25 +24,29 @@
package sun.jvm.hotspot.memory;
-import java.io.*;
-import java.util.*;
-import sun.jvm.hotspot.debugger.*;
-import sun.jvm.hotspot.oops.*;
-import sun.jvm.hotspot.runtime.*;
-import sun.jvm.hotspot.types.*;
-import sun.jvm.hotspot.utilities.*;
+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;
-
- // for free size, three fields
- // FreeBlockDictionary* _dictionary; // ptr to dictionary for large size blocks
- // FreeList _indexedFreeList[IndexSetSize]; // indexed array for small size blocks
- // LinearAllocBlock _smallLinearAllocBlock; // small linear alloc in TLAB
private static AddressField indexedFreeListField;
private static AddressField dictionaryField;
private static long smallLinearAllocBlockFieldOffset;
- private static long indexedFreeListSizeOf;
private int heapWordSize; // 4 for 32bit, 8 for 64 bits
private int IndexSetStart; // for small indexed list
@@ -109,11 +113,11 @@ public class CompactibleFreeListSpace extends CompactibleSpace {
// small chunks
long size = 0;
Address cur = addr.addOffsetTo( indexedFreeListField.getOffset() );
- cur = cur.addOffsetTo(IndexSetStart*FreeList.sizeOf());
+ cur = cur.addOffsetTo(IndexSetStart*AdaptiveFreeList.sizeOf());
for (int i=IndexSetStart; i<IndexSetSize; i += IndexSetStride) {
- FreeList freeList = (FreeList) VMObjectFactory.newObject(FreeList.class, cur);
+ AdaptiveFreeList freeList = (AdaptiveFreeList) VMObjectFactory.newObject(AdaptiveFreeList.class, cur);
size += i*freeList.count();
- cur= cur.addOffsetTo(IndexSetStride*FreeList.sizeOf());
+ cur= cur.addOffsetTo(IndexSetStride*AdaptiveFreeList.sizeOf());
}
// large block
diff --git a/agent/src/share/classes/sun/jvm/hotspot/memory/FreeList.java b/agent/src/share/classes/sun/jvm/hotspot/memory/FreeList.java
deleted file mode 100644
index 2d0024e1d..000000000
--- a/agent/src/share/classes/sun/jvm/hotspot/memory/FreeList.java
+++ /dev/null
@@ -1,72 +0,0 @@
-/*
- * @(#)FreeList.java
- *
- * Copyright (c) 2000, 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.util.*;
-import sun.jvm.hotspot.debugger.*;
-import sun.jvm.hotspot.types.*;
-import sun.jvm.hotspot.runtime.*;
-
-public class FreeList 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("FreeList<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 FreeList(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;
- }
-}