Mercurial > hg > graal-jvmci-8
annotate agent/src/share/classes/sun/jvm/hotspot/runtime/ThreadLocalAllocBuffer.java @ 13431:a4f036ef52e8
8029395: SA: jstack throws WrongTypeException
Summary: SA missed some TLABs
Reviewed-by: dsamersoff, mgerdin, brutisso
author | sla |
---|---|
date | Wed, 04 Dec 2013 14:43:50 +0100 |
parents | ec0c4951286c |
children | de6a9e811145 |
rev | line source |
---|---|
0 | 1 /* |
1552
c18cbe5936b8
6941466: Oracle rebranding changes for Hotspot repositories
trims
parents:
0
diff
changeset
|
2 * Copyright (c) 2000, 2006, Oracle and/or its affiliates. All rights reserved. |
0 | 3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
4 * | |
5 * This code is free software; you can redistribute it and/or modify it | |
6 * under the terms of the GNU General Public License version 2 only, as | |
7 * published by the Free Software Foundation. | |
8 * | |
9 * This code is distributed in the hope that it will be useful, but WITHOUT | |
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | |
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License | |
12 * version 2 for more details (a copy is included in the LICENSE file that | |
13 * accompanied this code). | |
14 * | |
15 * You should have received a copy of the GNU General Public License version | |
16 * 2 along with this work; if not, write to the Free Software Foundation, | |
17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. | |
18 * | |
1552
c18cbe5936b8
6941466: Oracle rebranding changes for Hotspot repositories
trims
parents:
0
diff
changeset
|
19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA |
c18cbe5936b8
6941466: Oracle rebranding changes for Hotspot repositories
trims
parents:
0
diff
changeset
|
20 * or visit www.oracle.com if you need additional information or have any |
c18cbe5936b8
6941466: Oracle rebranding changes for Hotspot repositories
trims
parents:
0
diff
changeset
|
21 * questions. |
0 | 22 * |
23 */ | |
24 | |
25 package sun.jvm.hotspot.runtime; | |
26 | |
27 import java.io.*; | |
28 import java.util.*; | |
29 import sun.jvm.hotspot.debugger.*; | |
8005
ec0c4951286c
8004710: NPG: jmap could throw sun.jvm.hotspot.types.WrongTypeException after PermGen removal
stefank
parents:
1552
diff
changeset
|
30 import sun.jvm.hotspot.oops.*; |
0 | 31 import sun.jvm.hotspot.types.*; |
32 | |
33 /** <P> ThreadLocalAllocBuffer: a descriptor for thread-local storage | |
34 used by the threads for allocation. </P> | |
35 | |
36 <P> It is thread-private at any time, but maybe multiplexed over | |
37 time across multiple threads. </P> */ | |
38 | |
39 public class ThreadLocalAllocBuffer extends VMObject { | |
40 private static AddressField startField; | |
41 private static AddressField topField; | |
42 private static AddressField endField; | |
43 private static CIntegerField desired_sizeField; | |
44 | |
45 static { | |
46 VM.registerVMInitializedObserver(new Observer() { | |
47 public void update(Observable o, Object data) { | |
48 initialize(VM.getVM().getTypeDataBase()); | |
49 } | |
50 }); | |
51 } | |
52 | |
53 private static synchronized void initialize(TypeDataBase db) { | |
54 Type type = db.lookupType("ThreadLocalAllocBuffer"); | |
55 | |
56 startField = type.getAddressField("_start"); | |
57 topField = type.getAddressField("_top"); | |
58 endField = type.getAddressField("_end"); | |
59 desired_sizeField = type.getCIntegerField("_desired_size"); | |
60 } | |
61 | |
62 public ThreadLocalAllocBuffer(Address addr) { | |
63 super(addr); | |
64 } | |
65 | |
8005
ec0c4951286c
8004710: NPG: jmap could throw sun.jvm.hotspot.types.WrongTypeException after PermGen removal
stefank
parents:
1552
diff
changeset
|
66 public Address start() { return startField.getValue(addr); } |
ec0c4951286c
8004710: NPG: jmap could throw sun.jvm.hotspot.types.WrongTypeException after PermGen removal
stefank
parents:
1552
diff
changeset
|
67 public Address end() { return endField.getValue(addr); } |
ec0c4951286c
8004710: NPG: jmap could throw sun.jvm.hotspot.types.WrongTypeException after PermGen removal
stefank
parents:
1552
diff
changeset
|
68 public Address top() { return topField.getValue(addr); } |
ec0c4951286c
8004710: NPG: jmap could throw sun.jvm.hotspot.types.WrongTypeException after PermGen removal
stefank
parents:
1552
diff
changeset
|
69 public Address hardEnd() { return end().addOffsetTo(alignmentReserve()); } |
ec0c4951286c
8004710: NPG: jmap could throw sun.jvm.hotspot.types.WrongTypeException after PermGen removal
stefank
parents:
1552
diff
changeset
|
70 |
ec0c4951286c
8004710: NPG: jmap could throw sun.jvm.hotspot.types.WrongTypeException after PermGen removal
stefank
parents:
1552
diff
changeset
|
71 private long alignmentReserve() { |
ec0c4951286c
8004710: NPG: jmap could throw sun.jvm.hotspot.types.WrongTypeException after PermGen removal
stefank
parents:
1552
diff
changeset
|
72 return Oop.alignObjectSize(endReserve()); |
ec0c4951286c
8004710: NPG: jmap could throw sun.jvm.hotspot.types.WrongTypeException after PermGen removal
stefank
parents:
1552
diff
changeset
|
73 } |
ec0c4951286c
8004710: NPG: jmap could throw sun.jvm.hotspot.types.WrongTypeException after PermGen removal
stefank
parents:
1552
diff
changeset
|
74 |
ec0c4951286c
8004710: NPG: jmap could throw sun.jvm.hotspot.types.WrongTypeException after PermGen removal
stefank
parents:
1552
diff
changeset
|
75 private long endReserve() { |
ec0c4951286c
8004710: NPG: jmap could throw sun.jvm.hotspot.types.WrongTypeException after PermGen removal
stefank
parents:
1552
diff
changeset
|
76 long minFillerArraySize = Array.baseOffsetInBytes(BasicType.T_INT); |
ec0c4951286c
8004710: NPG: jmap could throw sun.jvm.hotspot.types.WrongTypeException after PermGen removal
stefank
parents:
1552
diff
changeset
|
77 long reserveForAllocationPrefetch = VM.getVM().getReserveForAllocationPrefetch(); |
ec0c4951286c
8004710: NPG: jmap could throw sun.jvm.hotspot.types.WrongTypeException after PermGen removal
stefank
parents:
1552
diff
changeset
|
78 long heapWordSize = VM.getVM().getHeapWordSize(); |
ec0c4951286c
8004710: NPG: jmap could throw sun.jvm.hotspot.types.WrongTypeException after PermGen removal
stefank
parents:
1552
diff
changeset
|
79 |
ec0c4951286c
8004710: NPG: jmap could throw sun.jvm.hotspot.types.WrongTypeException after PermGen removal
stefank
parents:
1552
diff
changeset
|
80 return Math.max(minFillerArraySize, reserveForAllocationPrefetch * heapWordSize); |
ec0c4951286c
8004710: NPG: jmap could throw sun.jvm.hotspot.types.WrongTypeException after PermGen removal
stefank
parents:
1552
diff
changeset
|
81 } |
0 | 82 |
83 /** Support for iteration over heap -- not sure how this will | |
84 interact with GC in reflective system, but necessary for the | |
85 debugging mechanism */ | |
86 public OopHandle startAsOopHandle() { | |
87 return startField.getOopHandle(addr); | |
88 } | |
89 | |
90 /** Support for iteration over heap -- not sure how this will | |
91 interact with GC in reflective system, but necessary for the | |
92 debugging mechanism */ | |
93 public OopHandle nextOopHandle(OopHandle handle, long size) { | |
94 return handle.addOffsetToAsOopHandle(size); | |
95 } | |
96 | |
97 // public int size(); // FIXME: must adjust this to be in bytes | |
98 // public int availableSize(); // FIXME: must adjust this to be in bytes | |
99 public void print() { | |
100 printOn(System.out); | |
101 } | |
102 | |
103 public boolean contains(Address p) { | |
104 if (top() == null) { | |
105 return false; | |
106 } | |
107 return (start().lessThanOrEqual(p) && top().greaterThan(p)); | |
108 } | |
109 | |
110 public void printOn(PrintStream tty) { | |
111 tty.println(" [" + start() + "," + | |
13431 | 112 top() + "," + end() + ",{" + hardEnd() + "})"); |
0 | 113 } |
114 } |