Mercurial > hg > truffle
diff agent/src/share/classes/sun/jvm/hotspot/runtime/ThreadLocalAllocBuffer.java @ 8005:ec0c4951286c
8004710: NPG: jmap could throw sun.jvm.hotspot.types.WrongTypeException after PermGen removal
Summary: When calculating live object regions, make sure that the alignment reserve, at the end of a TLAB, is excluded.
Reviewed-by: jmasa, brutisso
author | stefank |
---|---|
date | Tue, 29 Jan 2013 10:51:33 +0100 |
parents | c18cbe5936b8 |
children | a4f036ef52e8 |
line wrap: on
line diff
--- a/agent/src/share/classes/sun/jvm/hotspot/runtime/ThreadLocalAllocBuffer.java Thu Jan 03 15:03:27 2013 -0800 +++ b/agent/src/share/classes/sun/jvm/hotspot/runtime/ThreadLocalAllocBuffer.java Tue Jan 29 10:51:33 2013 +0100 @@ -27,6 +27,7 @@ import java.io.*; import java.util.*; import sun.jvm.hotspot.debugger.*; +import sun.jvm.hotspot.oops.*; import sun.jvm.hotspot.types.*; /** <P> ThreadLocalAllocBuffer: a descriptor for thread-local storage @@ -62,9 +63,22 @@ super(addr); } - public Address start() { return startField.getValue(addr); } - public Address end() { return endField.getValue(addr); } - public Address top() { return topField.getValue(addr); } + public Address start() { return startField.getValue(addr); } + public Address end() { return endField.getValue(addr); } + public Address top() { return topField.getValue(addr); } + public Address hardEnd() { return end().addOffsetTo(alignmentReserve()); } + + private long alignmentReserve() { + return Oop.alignObjectSize(endReserve()); + } + + private long endReserve() { + long minFillerArraySize = Array.baseOffsetInBytes(BasicType.T_INT); + long reserveForAllocationPrefetch = VM.getVM().getReserveForAllocationPrefetch(); + long heapWordSize = VM.getVM().getHeapWordSize(); + + return Math.max(minFillerArraySize, reserveForAllocationPrefetch * heapWordSize); + } /** Support for iteration over heap -- not sure how this will interact with GC in reflective system, but necessary for the