8033440: jmap reports unexpected used/free size of concurrent mark-sweep generation
SA used the wrong type for the indexedFreeList in CompactibleFreeListSpace. Reviewed-by: coleenp, dsamersoff
This commit is contained in:
parent
83a8157179
commit
10d4420b08
@ -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;
|
||||
}
|
||||
}
|
@ -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
|
||||
|
@ -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;
|
||||
}
|
||||
}
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2007, 2013, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2007, 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
|
||||
@ -41,7 +41,7 @@
|
||||
nonstatic_field(LinearAllocBlock, _word_size, size_t) \
|
||||
nonstatic_field(AFLBinaryTreeDictionary, _total_size, size_t) \
|
||||
nonstatic_field(CompactibleFreeListSpace, _dictionary, AFLBinaryTreeDictionary*) \
|
||||
nonstatic_field(CompactibleFreeListSpace, _indexedFreeList[0], FreeList<FreeChunk>) \
|
||||
nonstatic_field(CompactibleFreeListSpace, _indexedFreeList[0], AdaptiveFreeList<FreeChunk>) \
|
||||
nonstatic_field(CompactibleFreeListSpace, _smallLinearAllocBlock, LinearAllocBlock)
|
||||
|
||||
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2000, 2013, Oracle and/or its affiliates. All rights reserved.
|
||||
* 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
|
||||
@ -242,7 +242,6 @@ typedef TwoOopHashtable<Klass*, mtClass> KlassTwoOopHashtable;
|
||||
typedef Hashtable<Klass*, mtClass> KlassHashtable;
|
||||
typedef HashtableEntry<Klass*, mtClass> KlassHashtableEntry;
|
||||
typedef TwoOopHashtable<Symbol*, mtClass> SymbolTwoOopHashtable;
|
||||
typedef BinaryTreeDictionary<Metablock, FreeList<Metablock> > MetablockTreeDictionary;
|
||||
|
||||
//--------------------------------------------------------------------------------
|
||||
// VM_STRUCTS
|
||||
@ -1281,11 +1280,8 @@ typedef BinaryTreeDictionary<Metablock, FreeList<Metablock> > MetablockTreeDicti
|
||||
volatile_nonstatic_field(FreeChunk, _size, size_t) \
|
||||
nonstatic_field(FreeChunk, _next, FreeChunk*) \
|
||||
nonstatic_field(FreeChunk, _prev, FreeChunk*) \
|
||||
nonstatic_field(FreeList<FreeChunk>, _size, size_t) \
|
||||
nonstatic_field(FreeList<Metablock>, _size, size_t) \
|
||||
nonstatic_field(FreeList<FreeChunk>, _count, ssize_t) \
|
||||
nonstatic_field(FreeList<Metablock>, _count, ssize_t) \
|
||||
nonstatic_field(MetablockTreeDictionary, _total_size, size_t)
|
||||
nonstatic_field(AdaptiveFreeList<FreeChunk>, _size, size_t) \
|
||||
nonstatic_field(AdaptiveFreeList<FreeChunk>, _count, ssize_t)
|
||||
|
||||
|
||||
//--------------------------------------------------------------------------------
|
||||
@ -2155,14 +2151,8 @@ typedef BinaryTreeDictionary<Metablock, FreeList<Metablock> > MetablockTreeDicti
|
||||
\
|
||||
/* freelist */ \
|
||||
declare_toplevel_type(FreeChunk*) \
|
||||
declare_toplevel_type(Metablock*) \
|
||||
declare_toplevel_type(FreeBlockDictionary<FreeChunk>*) \
|
||||
declare_toplevel_type(FreeList<FreeChunk>*) \
|
||||
declare_toplevel_type(FreeList<FreeChunk>) \
|
||||
declare_toplevel_type(FreeBlockDictionary<Metablock>*) \
|
||||
declare_toplevel_type(FreeList<Metablock>*) \
|
||||
declare_toplevel_type(FreeList<Metablock>) \
|
||||
declare_type(MetablockTreeDictionary, FreeBlockDictionary<Metablock>)
|
||||
declare_toplevel_type(AdaptiveFreeList<FreeChunk>*) \
|
||||
declare_toplevel_type(AdaptiveFreeList<FreeChunk>)
|
||||
|
||||
|
||||
//--------------------------------------------------------------------------------
|
||||
|
Loading…
x
Reference in New Issue
Block a user