comparison 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
comparison
equal deleted inserted replaced
7947:3c327c2b6782 8005:ec0c4951286c
25 package sun.jvm.hotspot.runtime; 25 package sun.jvm.hotspot.runtime;
26 26
27 import java.io.*; 27 import java.io.*;
28 import java.util.*; 28 import java.util.*;
29 import sun.jvm.hotspot.debugger.*; 29 import sun.jvm.hotspot.debugger.*;
30 import sun.jvm.hotspot.oops.*;
30 import sun.jvm.hotspot.types.*; 31 import sun.jvm.hotspot.types.*;
31 32
32 /** <P> ThreadLocalAllocBuffer: a descriptor for thread-local storage 33 /** <P> ThreadLocalAllocBuffer: a descriptor for thread-local storage
33 used by the threads for allocation. </P> 34 used by the threads for allocation. </P>
34 35
60 61
61 public ThreadLocalAllocBuffer(Address addr) { 62 public ThreadLocalAllocBuffer(Address addr) {
62 super(addr); 63 super(addr);
63 } 64 }
64 65
65 public Address start() { return startField.getValue(addr); } 66 public Address start() { return startField.getValue(addr); }
66 public Address end() { return endField.getValue(addr); } 67 public Address end() { return endField.getValue(addr); }
67 public Address top() { return topField.getValue(addr); } 68 public Address top() { return topField.getValue(addr); }
69 public Address hardEnd() { return end().addOffsetTo(alignmentReserve()); }
70
71 private long alignmentReserve() {
72 return Oop.alignObjectSize(endReserve());
73 }
74
75 private long endReserve() {
76 long minFillerArraySize = Array.baseOffsetInBytes(BasicType.T_INT);
77 long reserveForAllocationPrefetch = VM.getVM().getReserveForAllocationPrefetch();
78 long heapWordSize = VM.getVM().getHeapWordSize();
79
80 return Math.max(minFillerArraySize, reserveForAllocationPrefetch * heapWordSize);
81 }
68 82
69 /** Support for iteration over heap -- not sure how this will 83 /** Support for iteration over heap -- not sure how this will
70 interact with GC in reflective system, but necessary for the 84 interact with GC in reflective system, but necessary for the
71 debugging mechanism */ 85 debugging mechanism */
72 public OopHandle startAsOopHandle() { 86 public OopHandle startAsOopHandle() {