提交 96f778a3 编写于 作者: S sjohanss

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
上级 0b5ce067
/* /*
* @(#)FreeList.java * @(#)AdaptiveFreeList.java
* *
* 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. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* *
* This code is free software; you can redistribute it and/or modify it * This code is free software; you can redistribute it and/or modify it
...@@ -26,12 +26,17 @@ ...@@ -26,12 +26,17 @@
package sun.jvm.hotspot.memory; package sun.jvm.hotspot.memory;
import java.util.*; import java.util.Observable;
import sun.jvm.hotspot.debugger.*; import java.util.Observer;
import sun.jvm.hotspot.types.*;
import sun.jvm.hotspot.runtime.*;
public class FreeList extends VMObject { 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 { static {
VM.registerVMInitializedObserver(new Observer() { VM.registerVMInitializedObserver(new Observer() {
public void update(Observable o, Object data) { public void update(Observable o, Object data) {
...@@ -41,7 +46,7 @@ public class FreeList extends VMObject { ...@@ -41,7 +46,7 @@ public class FreeList extends VMObject {
} }
private static synchronized void initialize(TypeDataBase db) { private static synchronized void initialize(TypeDataBase db) {
Type type = db.lookupType("FreeList<FreeChunk>"); Type type = db.lookupType("AdaptiveFreeList<FreeChunk>");
sizeField = type.getCIntegerField("_size"); sizeField = type.getCIntegerField("_size");
countField = type.getCIntegerField("_count"); countField = type.getCIntegerField("_count");
headerSize = type.getSize(); headerSize = type.getSize();
...@@ -53,7 +58,7 @@ public class FreeList extends VMObject { ...@@ -53,7 +58,7 @@ public class FreeList extends VMObject {
private static long headerSize; private static long headerSize;
//Constructor //Constructor
public FreeList(Address address) { public AdaptiveFreeList(Address address) {
super(address); super(address);
} }
......
/* /*
* 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. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* *
* This code is free software; you can redistribute it and/or modify it * This code is free software; you can redistribute it and/or modify it
...@@ -24,25 +24,29 @@ ...@@ -24,25 +24,29 @@
package sun.jvm.hotspot.memory; package sun.jvm.hotspot.memory;
import java.io.*; import java.io.PrintStream;
import java.util.*; import java.util.ArrayList;
import sun.jvm.hotspot.debugger.*; import java.util.Iterator;
import sun.jvm.hotspot.oops.*; import java.util.List;
import sun.jvm.hotspot.runtime.*; import java.util.Observable;
import sun.jvm.hotspot.types.*; import java.util.Observer;
import sun.jvm.hotspot.utilities.*;
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 { public class CompactibleFreeListSpace extends CompactibleSpace {
private static AddressField collectorField; 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 indexedFreeListField;
private static AddressField dictionaryField; private static AddressField dictionaryField;
private static long smallLinearAllocBlockFieldOffset; private static long smallLinearAllocBlockFieldOffset;
private static long indexedFreeListSizeOf;
private int heapWordSize; // 4 for 32bit, 8 for 64 bits private int heapWordSize; // 4 for 32bit, 8 for 64 bits
private int IndexSetStart; // for small indexed list private int IndexSetStart; // for small indexed list
...@@ -109,11 +113,11 @@ public class CompactibleFreeListSpace extends CompactibleSpace { ...@@ -109,11 +113,11 @@ public class CompactibleFreeListSpace extends CompactibleSpace {
// small chunks // small chunks
long size = 0; long size = 0;
Address cur = addr.addOffsetTo( indexedFreeListField.getOffset() ); 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) { 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(); size += i*freeList.count();
cur= cur.addOffsetTo(IndexSetStride*FreeList.sizeOf()); cur= cur.addOffsetTo(IndexSetStride*AdaptiveFreeList.sizeOf());
} }
// large block // large block
......
/* /*
* 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. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* *
* This code is free software; you can redistribute it and/or modify it * This code is free software; you can redistribute it and/or modify it
...@@ -41,7 +41,7 @@ ...@@ -41,7 +41,7 @@
nonstatic_field(LinearAllocBlock, _word_size, size_t) \ nonstatic_field(LinearAllocBlock, _word_size, size_t) \
nonstatic_field(AFLBinaryTreeDictionary, _total_size, size_t) \ nonstatic_field(AFLBinaryTreeDictionary, _total_size, size_t) \
nonstatic_field(CompactibleFreeListSpace, _dictionary, AFLBinaryTreeDictionary*) \ nonstatic_field(CompactibleFreeListSpace, _dictionary, AFLBinaryTreeDictionary*) \
nonstatic_field(CompactibleFreeListSpace, _indexedFreeList[0], FreeList<FreeChunk>) \ nonstatic_field(CompactibleFreeListSpace, _indexedFreeList[0], AdaptiveFreeList<FreeChunk>) \
nonstatic_field(CompactibleFreeListSpace, _smallLinearAllocBlock, LinearAllocBlock) nonstatic_field(CompactibleFreeListSpace, _smallLinearAllocBlock, LinearAllocBlock)
......
/* /*
* 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. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* *
* This code is free software; you can redistribute it and/or modify it * This code is free software; you can redistribute it and/or modify it
...@@ -248,7 +248,6 @@ typedef TwoOopHashtable<Klass*, mtClass> KlassTwoOopHashtable; ...@@ -248,7 +248,6 @@ typedef TwoOopHashtable<Klass*, mtClass> KlassTwoOopHashtable;
typedef Hashtable<Klass*, mtClass> KlassHashtable; typedef Hashtable<Klass*, mtClass> KlassHashtable;
typedef HashtableEntry<Klass*, mtClass> KlassHashtableEntry; typedef HashtableEntry<Klass*, mtClass> KlassHashtableEntry;
typedef TwoOopHashtable<Symbol*, mtClass> SymbolTwoOopHashtable; typedef TwoOopHashtable<Symbol*, mtClass> SymbolTwoOopHashtable;
typedef BinaryTreeDictionary<Metablock, FreeList<Metablock> > MetablockTreeDictionary;
//-------------------------------------------------------------------------------- //--------------------------------------------------------------------------------
// VM_STRUCTS // VM_STRUCTS
...@@ -1290,11 +1289,8 @@ typedef BinaryTreeDictionary<Metablock, FreeList<Metablock> > MetablockTreeDicti ...@@ -1290,11 +1289,8 @@ typedef BinaryTreeDictionary<Metablock, FreeList<Metablock> > MetablockTreeDicti
volatile_nonstatic_field(FreeChunk, _size, size_t) \ volatile_nonstatic_field(FreeChunk, _size, size_t) \
nonstatic_field(FreeChunk, _next, FreeChunk*) \ nonstatic_field(FreeChunk, _next, FreeChunk*) \
nonstatic_field(FreeChunk, _prev, FreeChunk*) \ nonstatic_field(FreeChunk, _prev, FreeChunk*) \
nonstatic_field(FreeList<FreeChunk>, _size, size_t) \ nonstatic_field(AdaptiveFreeList<FreeChunk>, _size, size_t) \
nonstatic_field(FreeList<Metablock>, _size, size_t) \ nonstatic_field(AdaptiveFreeList<FreeChunk>, _count, ssize_t)
nonstatic_field(FreeList<FreeChunk>, _count, ssize_t) \
nonstatic_field(FreeList<Metablock>, _count, ssize_t) \
nonstatic_field(MetablockTreeDictionary, _total_size, size_t)
//-------------------------------------------------------------------------------- //--------------------------------------------------------------------------------
...@@ -2166,14 +2162,8 @@ typedef BinaryTreeDictionary<Metablock, FreeList<Metablock> > MetablockTreeDicti ...@@ -2166,14 +2162,8 @@ typedef BinaryTreeDictionary<Metablock, FreeList<Metablock> > MetablockTreeDicti
\ \
/* freelist */ \ /* freelist */ \
declare_toplevel_type(FreeChunk*) \ declare_toplevel_type(FreeChunk*) \
declare_toplevel_type(Metablock*) \ declare_toplevel_type(AdaptiveFreeList<FreeChunk>*) \
declare_toplevel_type(FreeBlockDictionary<FreeChunk>*) \ declare_toplevel_type(AdaptiveFreeList<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>)
//-------------------------------------------------------------------------------- //--------------------------------------------------------------------------------
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册