annotate agent/src/share/classes/sun/jvm/hotspot/debugger/DebuggerBase.java @ 17736:58fc1b1523dc

8034079: G1: Refactor the HeapRegionSet hierarchy Reviewed-by: tschatzl, pliden
author brutisso
date Fri, 14 Mar 2014 10:15:46 +0100
parents 8e47bac5643a
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
0
a61af66fc99e Initial load
duke
parents:
diff changeset
1 /*
1552
c18cbe5936b8 6941466: Oracle rebranding changes for Hotspot repositories
trims
parents: 844
diff changeset
2 * Copyright (c) 2001, 2009, Oracle and/or its affiliates. All rights reserved.
0
a61af66fc99e Initial load
duke
parents:
diff changeset
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
a61af66fc99e Initial load
duke
parents:
diff changeset
4 *
a61af66fc99e Initial load
duke
parents:
diff changeset
5 * This code is free software; you can redistribute it and/or modify it
a61af66fc99e Initial load
duke
parents:
diff changeset
6 * under the terms of the GNU General Public License version 2 only, as
a61af66fc99e Initial load
duke
parents:
diff changeset
7 * published by the Free Software Foundation.
a61af66fc99e Initial load
duke
parents:
diff changeset
8 *
a61af66fc99e Initial load
duke
parents:
diff changeset
9 * This code is distributed in the hope that it will be useful, but WITHOUT
a61af66fc99e Initial load
duke
parents:
diff changeset
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
a61af66fc99e Initial load
duke
parents:
diff changeset
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
a61af66fc99e Initial load
duke
parents:
diff changeset
12 * version 2 for more details (a copy is included in the LICENSE file that
a61af66fc99e Initial load
duke
parents:
diff changeset
13 * accompanied this code).
a61af66fc99e Initial load
duke
parents:
diff changeset
14 *
a61af66fc99e Initial load
duke
parents:
diff changeset
15 * You should have received a copy of the GNU General Public License version
a61af66fc99e Initial load
duke
parents:
diff changeset
16 * 2 along with this work; if not, write to the Free Software Foundation,
a61af66fc99e Initial load
duke
parents:
diff changeset
17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
a61af66fc99e Initial load
duke
parents:
diff changeset
18 *
1552
c18cbe5936b8 6941466: Oracle rebranding changes for Hotspot repositories
trims
parents: 844
diff changeset
19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
c18cbe5936b8 6941466: Oracle rebranding changes for Hotspot repositories
trims
parents: 844
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: 844
diff changeset
21 * questions.
0
a61af66fc99e Initial load
duke
parents:
diff changeset
22 *
a61af66fc99e Initial load
duke
parents:
diff changeset
23 */
a61af66fc99e Initial load
duke
parents:
diff changeset
24
a61af66fc99e Initial load
duke
parents:
diff changeset
25 package sun.jvm.hotspot.debugger;
a61af66fc99e Initial load
duke
parents:
diff changeset
26
a61af66fc99e Initial load
duke
parents:
diff changeset
27 /** <P> DebuggerBase is a recommended base class for debugger
a61af66fc99e Initial load
duke
parents:
diff changeset
28 implementations. It can use a PageCache to cache data from the
a61af66fc99e Initial load
duke
parents:
diff changeset
29 target process. Note that this class would not be suitable if the
a61af66fc99e Initial load
duke
parents:
diff changeset
30 system were used to reflect upon itself; it would never be safe to
a61af66fc99e Initial load
duke
parents:
diff changeset
31 store the value in an OopHandle in anything but an OopHandle.
a61af66fc99e Initial load
duke
parents:
diff changeset
32 However, it provides a fair amount of code sharing to the current
a61af66fc99e Initial load
duke
parents:
diff changeset
33 dbx and win32 implementations. </P>
a61af66fc99e Initial load
duke
parents:
diff changeset
34
a61af66fc99e Initial load
duke
parents:
diff changeset
35 <P> NOTE that much of the code sharing is achieved by having this
a61af66fc99e Initial load
duke
parents:
diff changeset
36 class implement many of the methods in the Win32Debugger and
a61af66fc99e Initial load
duke
parents:
diff changeset
37 DbxDebugger interfaces. </P> */
a61af66fc99e Initial load
duke
parents:
diff changeset
38
a61af66fc99e Initial load
duke
parents:
diff changeset
39 public abstract class DebuggerBase implements Debugger {
113
ba764ed4b6f2 6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents: 0
diff changeset
40
0
a61af66fc99e Initial load
duke
parents:
diff changeset
41 // May be set lazily, but must be set before calling any of the read
a61af66fc99e Initial load
duke
parents:
diff changeset
42 // routines below
a61af66fc99e Initial load
duke
parents:
diff changeset
43 protected MachineDescription machDesc;
a61af66fc99e Initial load
duke
parents:
diff changeset
44 protected DebuggerUtilities utils;
a61af66fc99e Initial load
duke
parents:
diff changeset
45 // Java primitive type sizes, set during bootstrapping. Do not call
a61af66fc99e Initial load
duke
parents:
diff changeset
46 // any of the Java read routines until these are set up.
a61af66fc99e Initial load
duke
parents:
diff changeset
47 protected long jbooleanSize;
a61af66fc99e Initial load
duke
parents:
diff changeset
48 protected long jbyteSize;
a61af66fc99e Initial load
duke
parents:
diff changeset
49 protected long jcharSize;
a61af66fc99e Initial load
duke
parents:
diff changeset
50 protected long jdoubleSize;
a61af66fc99e Initial load
duke
parents:
diff changeset
51 protected long jfloatSize;
a61af66fc99e Initial load
duke
parents:
diff changeset
52 protected long jintSize;
a61af66fc99e Initial load
duke
parents:
diff changeset
53 protected long jlongSize;
a61af66fc99e Initial load
duke
parents:
diff changeset
54 protected long jshortSize;
a61af66fc99e Initial load
duke
parents:
diff changeset
55 protected boolean javaPrimitiveTypesConfigured;
113
ba764ed4b6f2 6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents: 0
diff changeset
56 // heap data.
ba764ed4b6f2 6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents: 0
diff changeset
57 protected long oopSize;
ba764ed4b6f2 6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents: 0
diff changeset
58 protected long heapOopSize;
642
660978a2a31a 6791178: Specialize for zero as the compressed oop vm heap base
kvn
parents: 196
diff changeset
59 protected long narrowOopBase; // heap base for compressed oops.
660978a2a31a 6791178: Specialize for zero as the compressed oop vm heap base
kvn
parents: 196
diff changeset
60 protected int narrowOopShift; // shift to decode compressed oops.
6848
8e47bac5643a 7054512: Compress class pointers after perm gen removal
roland
parents: 1552
diff changeset
61 // class metadata space
8e47bac5643a 7054512: Compress class pointers after perm gen removal
roland
parents: 1552
diff changeset
62 protected long klassPtrSize;
8e47bac5643a 7054512: Compress class pointers after perm gen removal
roland
parents: 1552
diff changeset
63 protected long narrowKlassBase; // heap base for compressed klass ptrs.
8e47bac5643a 7054512: Compress class pointers after perm gen removal
roland
parents: 1552
diff changeset
64 protected int narrowKlassShift; // shift to decode compressed klass ptrs.
0
a61af66fc99e Initial load
duke
parents:
diff changeset
65 // Should be initialized if desired by calling initCache()
a61af66fc99e Initial load
duke
parents:
diff changeset
66 private PageCache cache;
a61af66fc99e Initial load
duke
parents:
diff changeset
67
a61af66fc99e Initial load
duke
parents:
diff changeset
68 // State for faster accessors that don't allocate memory on each read
a61af66fc99e Initial load
duke
parents:
diff changeset
69 private boolean useFastAccessors;
a61af66fc99e Initial load
duke
parents:
diff changeset
70 private boolean bigEndian;
a61af66fc99e Initial load
duke
parents:
diff changeset
71
a61af66fc99e Initial load
duke
parents:
diff changeset
72 // Page-fetching functionality for LRU cache
a61af66fc99e Initial load
duke
parents:
diff changeset
73 class Fetcher implements PageFetcher {
a61af66fc99e Initial load
duke
parents:
diff changeset
74 public Page fetchPage(long pageBaseAddress, long numBytes) {
a61af66fc99e Initial load
duke
parents:
diff changeset
75 // This assumes that if any byte is unmapped, that the entire
a61af66fc99e Initial load
duke
parents:
diff changeset
76 // page is. The common case, however, is that the page is
a61af66fc99e Initial load
duke
parents:
diff changeset
77 // mapped, so we always fetch the entire thing all at once to
a61af66fc99e Initial load
duke
parents:
diff changeset
78 // avoid two round-trip communications per page fetch, even
a61af66fc99e Initial load
duke
parents:
diff changeset
79 // though fetching of unmapped pages will be slow.
a61af66fc99e Initial load
duke
parents:
diff changeset
80 ReadResult res = readBytesFromProcess(pageBaseAddress, numBytes);
a61af66fc99e Initial load
duke
parents:
diff changeset
81 if (res.getData() == null) {
a61af66fc99e Initial load
duke
parents:
diff changeset
82 return new Page(pageBaseAddress, numBytes);
a61af66fc99e Initial load
duke
parents:
diff changeset
83 }
a61af66fc99e Initial load
duke
parents:
diff changeset
84 return new Page(pageBaseAddress, res.getData());
a61af66fc99e Initial load
duke
parents:
diff changeset
85 }
a61af66fc99e Initial load
duke
parents:
diff changeset
86 }
a61af66fc99e Initial load
duke
parents:
diff changeset
87
a61af66fc99e Initial load
duke
parents:
diff changeset
88 protected DebuggerBase() {
a61af66fc99e Initial load
duke
parents:
diff changeset
89 }
a61af66fc99e Initial load
duke
parents:
diff changeset
90
a61af66fc99e Initial load
duke
parents:
diff changeset
91 /** From the JVMDebugger interface. This is the only public method
a61af66fc99e Initial load
duke
parents:
diff changeset
92 of this class. */
a61af66fc99e Initial load
duke
parents:
diff changeset
93 public void configureJavaPrimitiveTypeSizes(long jbooleanSize,
a61af66fc99e Initial load
duke
parents:
diff changeset
94 long jbyteSize,
a61af66fc99e Initial load
duke
parents:
diff changeset
95 long jcharSize,
a61af66fc99e Initial load
duke
parents:
diff changeset
96 long jdoubleSize,
a61af66fc99e Initial load
duke
parents:
diff changeset
97 long jfloatSize,
a61af66fc99e Initial load
duke
parents:
diff changeset
98 long jintSize,
a61af66fc99e Initial load
duke
parents:
diff changeset
99 long jlongSize,
a61af66fc99e Initial load
duke
parents:
diff changeset
100 long jshortSize) {
a61af66fc99e Initial load
duke
parents:
diff changeset
101 this.jbooleanSize = jbooleanSize;
a61af66fc99e Initial load
duke
parents:
diff changeset
102 this.jbyteSize = jbyteSize;
a61af66fc99e Initial load
duke
parents:
diff changeset
103 this.jcharSize = jcharSize;
a61af66fc99e Initial load
duke
parents:
diff changeset
104 this.jdoubleSize = jdoubleSize;
a61af66fc99e Initial load
duke
parents:
diff changeset
105 this.jfloatSize = jfloatSize;
a61af66fc99e Initial load
duke
parents:
diff changeset
106 this.jintSize = jintSize;
a61af66fc99e Initial load
duke
parents:
diff changeset
107 this.jlongSize = jlongSize;
a61af66fc99e Initial load
duke
parents:
diff changeset
108 this.jshortSize = jshortSize;
a61af66fc99e Initial load
duke
parents:
diff changeset
109
a61af66fc99e Initial load
duke
parents:
diff changeset
110 if (jbooleanSize < 1) {
a61af66fc99e Initial load
duke
parents:
diff changeset
111 throw new RuntimeException("jboolean size is too small");
a61af66fc99e Initial load
duke
parents:
diff changeset
112 }
a61af66fc99e Initial load
duke
parents:
diff changeset
113
a61af66fc99e Initial load
duke
parents:
diff changeset
114 if (jbyteSize < 1) {
a61af66fc99e Initial load
duke
parents:
diff changeset
115 throw new RuntimeException("jbyte size is too small");
a61af66fc99e Initial load
duke
parents:
diff changeset
116 }
a61af66fc99e Initial load
duke
parents:
diff changeset
117
a61af66fc99e Initial load
duke
parents:
diff changeset
118 if (jcharSize < 2) {
a61af66fc99e Initial load
duke
parents:
diff changeset
119 throw new RuntimeException("jchar size is too small");
a61af66fc99e Initial load
duke
parents:
diff changeset
120 }
a61af66fc99e Initial load
duke
parents:
diff changeset
121
a61af66fc99e Initial load
duke
parents:
diff changeset
122 if (jdoubleSize < 8) {
a61af66fc99e Initial load
duke
parents:
diff changeset
123 throw new RuntimeException("jdouble size is too small");
a61af66fc99e Initial load
duke
parents:
diff changeset
124 }
a61af66fc99e Initial load
duke
parents:
diff changeset
125
a61af66fc99e Initial load
duke
parents:
diff changeset
126 if (jfloatSize < 4) {
a61af66fc99e Initial load
duke
parents:
diff changeset
127 throw new RuntimeException("jfloat size is too small");
a61af66fc99e Initial load
duke
parents:
diff changeset
128 }
a61af66fc99e Initial load
duke
parents:
diff changeset
129
a61af66fc99e Initial load
duke
parents:
diff changeset
130 if (jintSize < 4) {
a61af66fc99e Initial load
duke
parents:
diff changeset
131 throw new RuntimeException("jint size is too small");
a61af66fc99e Initial load
duke
parents:
diff changeset
132 }
a61af66fc99e Initial load
duke
parents:
diff changeset
133
a61af66fc99e Initial load
duke
parents:
diff changeset
134 if (jlongSize < 8) {
a61af66fc99e Initial load
duke
parents:
diff changeset
135 throw new RuntimeException("jlong size is too small");
a61af66fc99e Initial load
duke
parents:
diff changeset
136 }
a61af66fc99e Initial load
duke
parents:
diff changeset
137
a61af66fc99e Initial load
duke
parents:
diff changeset
138 if (jshortSize < 2) {
a61af66fc99e Initial load
duke
parents:
diff changeset
139 throw new RuntimeException("jshort size is too small");
a61af66fc99e Initial load
duke
parents:
diff changeset
140 }
a61af66fc99e Initial load
duke
parents:
diff changeset
141
a61af66fc99e Initial load
duke
parents:
diff changeset
142 if (jintSize != jfloatSize) {
a61af66fc99e Initial load
duke
parents:
diff changeset
143 // If dataToJFloat were rewritten, this wouldn't be necessary
a61af66fc99e Initial load
duke
parents:
diff changeset
144 throw new RuntimeException("jint size and jfloat size must be equal");
a61af66fc99e Initial load
duke
parents:
diff changeset
145 }
a61af66fc99e Initial load
duke
parents:
diff changeset
146
a61af66fc99e Initial load
duke
parents:
diff changeset
147 if (jlongSize != jdoubleSize) {
a61af66fc99e Initial load
duke
parents:
diff changeset
148 // If dataToJDouble were rewritten, this wouldn't be necessary
a61af66fc99e Initial load
duke
parents:
diff changeset
149 throw new RuntimeException("jlong size and jdouble size must be equal");
a61af66fc99e Initial load
duke
parents:
diff changeset
150 }
a61af66fc99e Initial load
duke
parents:
diff changeset
151
a61af66fc99e Initial load
duke
parents:
diff changeset
152 useFastAccessors =
a61af66fc99e Initial load
duke
parents:
diff changeset
153 ((cache != null) &&
a61af66fc99e Initial load
duke
parents:
diff changeset
154 (jbooleanSize == 1) &&
a61af66fc99e Initial load
duke
parents:
diff changeset
155 (jbyteSize == 1) &&
a61af66fc99e Initial load
duke
parents:
diff changeset
156 (jcharSize == 2) &&
a61af66fc99e Initial load
duke
parents:
diff changeset
157 (jdoubleSize == 8) &&
a61af66fc99e Initial load
duke
parents:
diff changeset
158 (jfloatSize == 4) &&
a61af66fc99e Initial load
duke
parents:
diff changeset
159 (jintSize == 4) &&
a61af66fc99e Initial load
duke
parents:
diff changeset
160 (jlongSize == 8) &&
a61af66fc99e Initial load
duke
parents:
diff changeset
161 (jshortSize == 2));
a61af66fc99e Initial load
duke
parents:
diff changeset
162
a61af66fc99e Initial load
duke
parents:
diff changeset
163 javaPrimitiveTypesConfigured = true;
a61af66fc99e Initial load
duke
parents:
diff changeset
164 }
a61af66fc99e Initial load
duke
parents:
diff changeset
165
6848
8e47bac5643a 7054512: Compress class pointers after perm gen removal
roland
parents: 1552
diff changeset
166 public void putHeapConst(long heapOopSize, long klassPtrSize, long narrowOopBase, int narrowOopShift,
8e47bac5643a 7054512: Compress class pointers after perm gen removal
roland
parents: 1552
diff changeset
167 long narrowKlassBase, int narrowKlassShift) {
113
ba764ed4b6f2 6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents: 0
diff changeset
168 this.heapOopSize = heapOopSize;
6848
8e47bac5643a 7054512: Compress class pointers after perm gen removal
roland
parents: 1552
diff changeset
169 this.klassPtrSize = klassPtrSize;
642
660978a2a31a 6791178: Specialize for zero as the compressed oop vm heap base
kvn
parents: 196
diff changeset
170 this.narrowOopBase = narrowOopBase;
660978a2a31a 6791178: Specialize for zero as the compressed oop vm heap base
kvn
parents: 196
diff changeset
171 this.narrowOopShift = narrowOopShift;
6848
8e47bac5643a 7054512: Compress class pointers after perm gen removal
roland
parents: 1552
diff changeset
172 this.narrowKlassBase = narrowKlassBase;
8e47bac5643a 7054512: Compress class pointers after perm gen removal
roland
parents: 1552
diff changeset
173 this.narrowKlassShift = narrowKlassShift;
113
ba764ed4b6f2 6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents: 0
diff changeset
174 }
ba764ed4b6f2 6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents: 0
diff changeset
175
0
a61af66fc99e Initial load
duke
parents:
diff changeset
176 /** May be called by subclasses if desired to initialize the page
a61af66fc99e Initial load
duke
parents:
diff changeset
177 cache but may not be overridden */
a61af66fc99e Initial load
duke
parents:
diff changeset
178 protected final void initCache(long pageSize, long maxNumPages) {
a61af66fc99e Initial load
duke
parents:
diff changeset
179 cache = new PageCache(pageSize, maxNumPages, new Fetcher());
a61af66fc99e Initial load
duke
parents:
diff changeset
180 if (machDesc != null) {
a61af66fc99e Initial load
duke
parents:
diff changeset
181 bigEndian = machDesc.isBigEndian();
a61af66fc99e Initial load
duke
parents:
diff changeset
182 }
a61af66fc99e Initial load
duke
parents:
diff changeset
183 }
a61af66fc99e Initial load
duke
parents:
diff changeset
184
a61af66fc99e Initial load
duke
parents:
diff changeset
185 /** May be called by subclasses if needed (if the machine
a61af66fc99e Initial load
duke
parents:
diff changeset
186 description is not available at the time of cache
a61af66fc99e Initial load
duke
parents:
diff changeset
187 initialization, as on Solaris) but may not be overridden */
a61af66fc99e Initial load
duke
parents:
diff changeset
188 protected final void setBigEndian(boolean bigEndian) {
a61af66fc99e Initial load
duke
parents:
diff changeset
189 this.bigEndian = bigEndian;
a61af66fc99e Initial load
duke
parents:
diff changeset
190 }
a61af66fc99e Initial load
duke
parents:
diff changeset
191
a61af66fc99e Initial load
duke
parents:
diff changeset
192 /** May be called by subclasses to clear out the cache but may not
a61af66fc99e Initial load
duke
parents:
diff changeset
193 be overridden. For convenience, this can be called even if the
a61af66fc99e Initial load
duke
parents:
diff changeset
194 cache has not been initialized. */
a61af66fc99e Initial load
duke
parents:
diff changeset
195 protected final void clearCache() {
a61af66fc99e Initial load
duke
parents:
diff changeset
196 if (cache != null) {
a61af66fc99e Initial load
duke
parents:
diff changeset
197 cache.clear();
a61af66fc99e Initial load
duke
parents:
diff changeset
198 }
a61af66fc99e Initial load
duke
parents:
diff changeset
199 }
a61af66fc99e Initial load
duke
parents:
diff changeset
200
a61af66fc99e Initial load
duke
parents:
diff changeset
201 /** May be called by subclasses to disable the cache (for example,
a61af66fc99e Initial load
duke
parents:
diff changeset
202 when the target process has been resumed) but may not be
a61af66fc99e Initial load
duke
parents:
diff changeset
203 overridden. For convenience, this can be called even if the
a61af66fc99e Initial load
duke
parents:
diff changeset
204 cache has not been initialized. */
a61af66fc99e Initial load
duke
parents:
diff changeset
205 protected final void disableCache() {
a61af66fc99e Initial load
duke
parents:
diff changeset
206 if (cache != null) {
a61af66fc99e Initial load
duke
parents:
diff changeset
207 cache.disable();
a61af66fc99e Initial load
duke
parents:
diff changeset
208 }
a61af66fc99e Initial load
duke
parents:
diff changeset
209 }
a61af66fc99e Initial load
duke
parents:
diff changeset
210
a61af66fc99e Initial load
duke
parents:
diff changeset
211 /** May be called by subclasses to re-enable the cache (for example,
a61af66fc99e Initial load
duke
parents:
diff changeset
212 when the target process has been suspended) but may not be
a61af66fc99e Initial load
duke
parents:
diff changeset
213 overridden. For convenience, this can be called even if the
a61af66fc99e Initial load
duke
parents:
diff changeset
214 cache has not been initialized. */
a61af66fc99e Initial load
duke
parents:
diff changeset
215 protected final void enableCache() {
a61af66fc99e Initial load
duke
parents:
diff changeset
216 if (cache != null) {
a61af66fc99e Initial load
duke
parents:
diff changeset
217 cache.enable();
a61af66fc99e Initial load
duke
parents:
diff changeset
218 }
a61af66fc99e Initial load
duke
parents:
diff changeset
219 }
a61af66fc99e Initial load
duke
parents:
diff changeset
220
a61af66fc99e Initial load
duke
parents:
diff changeset
221 /** May be called by subclasses directly but may not be overridden */
a61af66fc99e Initial load
duke
parents:
diff changeset
222 protected final byte[] readBytes(long address, long numBytes)
a61af66fc99e Initial load
duke
parents:
diff changeset
223 throws UnmappedAddressException, DebuggerException {
a61af66fc99e Initial load
duke
parents:
diff changeset
224 if (cache != null) {
a61af66fc99e Initial load
duke
parents:
diff changeset
225 return cache.getData(address, numBytes);
a61af66fc99e Initial load
duke
parents:
diff changeset
226 } else {
a61af66fc99e Initial load
duke
parents:
diff changeset
227 ReadResult res = readBytesFromProcess(address, numBytes);
a61af66fc99e Initial load
duke
parents:
diff changeset
228 if (res.getData() != null) {
a61af66fc99e Initial load
duke
parents:
diff changeset
229 return res.getData();
a61af66fc99e Initial load
duke
parents:
diff changeset
230 }
a61af66fc99e Initial load
duke
parents:
diff changeset
231 throw new UnmappedAddressException(res.getFailureAddress());
a61af66fc99e Initial load
duke
parents:
diff changeset
232 }
a61af66fc99e Initial load
duke
parents:
diff changeset
233 }
a61af66fc99e Initial load
duke
parents:
diff changeset
234
a61af66fc99e Initial load
duke
parents:
diff changeset
235 /** May be called by subclasses directly but may not be overridden */
a61af66fc99e Initial load
duke
parents:
diff changeset
236 protected final void writeBytes(long address, long numBytes, byte[] data)
a61af66fc99e Initial load
duke
parents:
diff changeset
237 throws UnmappedAddressException, DebuggerException {
a61af66fc99e Initial load
duke
parents:
diff changeset
238 if (cache != null) {
a61af66fc99e Initial load
duke
parents:
diff changeset
239 cache.clear(address, numBytes);
a61af66fc99e Initial load
duke
parents:
diff changeset
240 }
a61af66fc99e Initial load
duke
parents:
diff changeset
241 writeBytesToProcess(address, numBytes, data);
a61af66fc99e Initial load
duke
parents:
diff changeset
242 }
a61af66fc99e Initial load
duke
parents:
diff changeset
243
a61af66fc99e Initial load
duke
parents:
diff changeset
244 public boolean readJBoolean(long address)
a61af66fc99e Initial load
duke
parents:
diff changeset
245 throws UnmappedAddressException, UnalignedAddressException {
a61af66fc99e Initial load
duke
parents:
diff changeset
246 checkJavaConfigured();
a61af66fc99e Initial load
duke
parents:
diff changeset
247 utils.checkAlignment(address, jbooleanSize);
a61af66fc99e Initial load
duke
parents:
diff changeset
248 if (useFastAccessors) {
a61af66fc99e Initial load
duke
parents:
diff changeset
249 return (cache.getByte(address) != 0);
a61af66fc99e Initial load
duke
parents:
diff changeset
250 } else {
a61af66fc99e Initial load
duke
parents:
diff changeset
251 byte[] data = readBytes(address, jbooleanSize);
a61af66fc99e Initial load
duke
parents:
diff changeset
252 return utils.dataToJBoolean(data, jbooleanSize);
a61af66fc99e Initial load
duke
parents:
diff changeset
253 }
a61af66fc99e Initial load
duke
parents:
diff changeset
254 }
a61af66fc99e Initial load
duke
parents:
diff changeset
255
a61af66fc99e Initial load
duke
parents:
diff changeset
256 public byte readJByte(long address)
a61af66fc99e Initial load
duke
parents:
diff changeset
257 throws UnmappedAddressException, UnalignedAddressException {
a61af66fc99e Initial load
duke
parents:
diff changeset
258 checkJavaConfigured();
a61af66fc99e Initial load
duke
parents:
diff changeset
259 utils.checkAlignment(address, jbyteSize);
a61af66fc99e Initial load
duke
parents:
diff changeset
260 if (useFastAccessors) {
a61af66fc99e Initial load
duke
parents:
diff changeset
261 return cache.getByte(address);
a61af66fc99e Initial load
duke
parents:
diff changeset
262 } else {
a61af66fc99e Initial load
duke
parents:
diff changeset
263 byte[] data = readBytes(address, jbyteSize);
a61af66fc99e Initial load
duke
parents:
diff changeset
264 return utils.dataToJByte(data, jbyteSize);
a61af66fc99e Initial load
duke
parents:
diff changeset
265 }
a61af66fc99e Initial load
duke
parents:
diff changeset
266 }
a61af66fc99e Initial load
duke
parents:
diff changeset
267
a61af66fc99e Initial load
duke
parents:
diff changeset
268 // NOTE: assumes value does not span pages (may be bad assumption on
a61af66fc99e Initial load
duke
parents:
diff changeset
269 // Solaris/x86; see unalignedAccessesOkay in DbxDebugger hierarchy)
a61af66fc99e Initial load
duke
parents:
diff changeset
270 public char readJChar(long address)
a61af66fc99e Initial load
duke
parents:
diff changeset
271 throws UnmappedAddressException, UnalignedAddressException {
a61af66fc99e Initial load
duke
parents:
diff changeset
272 checkJavaConfigured();
a61af66fc99e Initial load
duke
parents:
diff changeset
273 utils.checkAlignment(address, jcharSize);
a61af66fc99e Initial load
duke
parents:
diff changeset
274 if (useFastAccessors) {
a61af66fc99e Initial load
duke
parents:
diff changeset
275 return cache.getChar(address, bigEndian);
a61af66fc99e Initial load
duke
parents:
diff changeset
276 } else {
a61af66fc99e Initial load
duke
parents:
diff changeset
277 byte[] data = readBytes(address, jcharSize);
a61af66fc99e Initial load
duke
parents:
diff changeset
278 return (char) utils.dataToJChar(data, jcharSize);
a61af66fc99e Initial load
duke
parents:
diff changeset
279 }
a61af66fc99e Initial load
duke
parents:
diff changeset
280 }
a61af66fc99e Initial load
duke
parents:
diff changeset
281
a61af66fc99e Initial load
duke
parents:
diff changeset
282 // NOTE: assumes value does not span pages (may be bad assumption on
a61af66fc99e Initial load
duke
parents:
diff changeset
283 // Solaris/x86; see unalignedAccessesOkay in DbxDebugger hierarchy)
a61af66fc99e Initial load
duke
parents:
diff changeset
284 public double readJDouble(long address)
a61af66fc99e Initial load
duke
parents:
diff changeset
285 throws UnmappedAddressException, UnalignedAddressException {
a61af66fc99e Initial load
duke
parents:
diff changeset
286 checkJavaConfigured();
a61af66fc99e Initial load
duke
parents:
diff changeset
287 utils.checkAlignment(address, jdoubleSize);
a61af66fc99e Initial load
duke
parents:
diff changeset
288 if (useFastAccessors) {
a61af66fc99e Initial load
duke
parents:
diff changeset
289 return cache.getDouble(address, bigEndian);
a61af66fc99e Initial load
duke
parents:
diff changeset
290 } else {
a61af66fc99e Initial load
duke
parents:
diff changeset
291 byte[] data = readBytes(address, jdoubleSize);
a61af66fc99e Initial load
duke
parents:
diff changeset
292 return utils.dataToJDouble(data, jdoubleSize);
a61af66fc99e Initial load
duke
parents:
diff changeset
293 }
a61af66fc99e Initial load
duke
parents:
diff changeset
294 }
a61af66fc99e Initial load
duke
parents:
diff changeset
295
a61af66fc99e Initial load
duke
parents:
diff changeset
296 // NOTE: assumes value does not span pages (may be bad assumption on
a61af66fc99e Initial load
duke
parents:
diff changeset
297 // Solaris/x86; see unalignedAccessesOkay in DbxDebugger hierarchy)
a61af66fc99e Initial load
duke
parents:
diff changeset
298 public float readJFloat(long address)
a61af66fc99e Initial load
duke
parents:
diff changeset
299 throws UnmappedAddressException, UnalignedAddressException {
a61af66fc99e Initial load
duke
parents:
diff changeset
300 checkJavaConfigured();
a61af66fc99e Initial load
duke
parents:
diff changeset
301 utils.checkAlignment(address, jfloatSize);
a61af66fc99e Initial load
duke
parents:
diff changeset
302 if (useFastAccessors) {
a61af66fc99e Initial load
duke
parents:
diff changeset
303 return cache.getFloat(address, bigEndian);
a61af66fc99e Initial load
duke
parents:
diff changeset
304 } else {
a61af66fc99e Initial load
duke
parents:
diff changeset
305 byte[] data = readBytes(address, jfloatSize);
a61af66fc99e Initial load
duke
parents:
diff changeset
306 return utils.dataToJFloat(data, jfloatSize);
a61af66fc99e Initial load
duke
parents:
diff changeset
307 }
a61af66fc99e Initial load
duke
parents:
diff changeset
308 }
a61af66fc99e Initial load
duke
parents:
diff changeset
309
a61af66fc99e Initial load
duke
parents:
diff changeset
310 // NOTE: assumes value does not span pages (may be bad assumption on
a61af66fc99e Initial load
duke
parents:
diff changeset
311 // Solaris/x86; see unalignedAccessesOkay in DbxDebugger hierarchy)
a61af66fc99e Initial load
duke
parents:
diff changeset
312 public int readJInt(long address)
a61af66fc99e Initial load
duke
parents:
diff changeset
313 throws UnmappedAddressException, UnalignedAddressException {
a61af66fc99e Initial load
duke
parents:
diff changeset
314 checkJavaConfigured();
a61af66fc99e Initial load
duke
parents:
diff changeset
315 utils.checkAlignment(address, jintSize);
a61af66fc99e Initial load
duke
parents:
diff changeset
316 if (useFastAccessors) {
a61af66fc99e Initial load
duke
parents:
diff changeset
317 return cache.getInt(address, bigEndian);
a61af66fc99e Initial load
duke
parents:
diff changeset
318 } else {
a61af66fc99e Initial load
duke
parents:
diff changeset
319 byte[] data = readBytes(address, jintSize);
a61af66fc99e Initial load
duke
parents:
diff changeset
320 return utils.dataToJInt(data, jintSize);
a61af66fc99e Initial load
duke
parents:
diff changeset
321 }
a61af66fc99e Initial load
duke
parents:
diff changeset
322 }
a61af66fc99e Initial load
duke
parents:
diff changeset
323
a61af66fc99e Initial load
duke
parents:
diff changeset
324 // NOTE: assumes value does not span pages (may be bad assumption on
a61af66fc99e Initial load
duke
parents:
diff changeset
325 // Solaris/x86; see unalignedAccessesOkay in DbxDebugger hierarchy)
a61af66fc99e Initial load
duke
parents:
diff changeset
326 public long readJLong(long address)
a61af66fc99e Initial load
duke
parents:
diff changeset
327 throws UnmappedAddressException, UnalignedAddressException {
a61af66fc99e Initial load
duke
parents:
diff changeset
328 checkJavaConfigured();
a61af66fc99e Initial load
duke
parents:
diff changeset
329 utils.checkAlignment(address, jlongSize);
a61af66fc99e Initial load
duke
parents:
diff changeset
330 if (useFastAccessors) {
a61af66fc99e Initial load
duke
parents:
diff changeset
331 return cache.getLong(address, bigEndian);
a61af66fc99e Initial load
duke
parents:
diff changeset
332 } else {
a61af66fc99e Initial load
duke
parents:
diff changeset
333 byte[] data = readBytes(address, jlongSize);
a61af66fc99e Initial load
duke
parents:
diff changeset
334 return utils.dataToJLong(data, jlongSize);
a61af66fc99e Initial load
duke
parents:
diff changeset
335 }
a61af66fc99e Initial load
duke
parents:
diff changeset
336 }
a61af66fc99e Initial load
duke
parents:
diff changeset
337
a61af66fc99e Initial load
duke
parents:
diff changeset
338 // NOTE: assumes value does not span pages (may be bad assumption on
a61af66fc99e Initial load
duke
parents:
diff changeset
339 // Solaris/x86; see unalignedAccessesOkay in DbxDebugger hierarchy)
a61af66fc99e Initial load
duke
parents:
diff changeset
340 public short readJShort(long address)
a61af66fc99e Initial load
duke
parents:
diff changeset
341 throws UnmappedAddressException, UnalignedAddressException {
a61af66fc99e Initial load
duke
parents:
diff changeset
342 checkJavaConfigured();
a61af66fc99e Initial load
duke
parents:
diff changeset
343 utils.checkAlignment(address, jshortSize);
a61af66fc99e Initial load
duke
parents:
diff changeset
344 if (useFastAccessors) {
a61af66fc99e Initial load
duke
parents:
diff changeset
345 return cache.getShort(address, bigEndian);
a61af66fc99e Initial load
duke
parents:
diff changeset
346 } else {
a61af66fc99e Initial load
duke
parents:
diff changeset
347 byte[] data = readBytes(address, jshortSize);
a61af66fc99e Initial load
duke
parents:
diff changeset
348 return utils.dataToJShort(data, jshortSize);
a61af66fc99e Initial load
duke
parents:
diff changeset
349 }
a61af66fc99e Initial load
duke
parents:
diff changeset
350 }
a61af66fc99e Initial load
duke
parents:
diff changeset
351
a61af66fc99e Initial load
duke
parents:
diff changeset
352 // NOTE: assumes value does not span pages (may be bad assumption on
a61af66fc99e Initial load
duke
parents:
diff changeset
353 // Solaris/x86; see unalignedAccessesOkay in DbxDebugger hierarchy)
a61af66fc99e Initial load
duke
parents:
diff changeset
354 public long readCInteger(long address, long numBytes, boolean isUnsigned)
a61af66fc99e Initial load
duke
parents:
diff changeset
355 throws UnmappedAddressException, UnalignedAddressException {
a61af66fc99e Initial load
duke
parents:
diff changeset
356 checkConfigured();
a61af66fc99e Initial load
duke
parents:
diff changeset
357 utils.checkAlignment(address, numBytes);
a61af66fc99e Initial load
duke
parents:
diff changeset
358 if (useFastAccessors) {
a61af66fc99e Initial load
duke
parents:
diff changeset
359 if (isUnsigned) {
a61af66fc99e Initial load
duke
parents:
diff changeset
360 switch((int) numBytes) {
a61af66fc99e Initial load
duke
parents:
diff changeset
361 case 1: return cache.getByte(address) & 0xFF;
a61af66fc99e Initial load
duke
parents:
diff changeset
362 case 2: return cache.getShort(address, bigEndian) & 0xFFFF;
a61af66fc99e Initial load
duke
parents:
diff changeset
363 case 4: return cache.getInt(address, bigEndian) & 0xFFFFFFFFL;
a61af66fc99e Initial load
duke
parents:
diff changeset
364 case 8: return cache.getLong(address, bigEndian);
a61af66fc99e Initial load
duke
parents:
diff changeset
365 default: {
a61af66fc99e Initial load
duke
parents:
diff changeset
366 byte[] data = readBytes(address, numBytes);
a61af66fc99e Initial load
duke
parents:
diff changeset
367 return utils.dataToCInteger(data, isUnsigned);
a61af66fc99e Initial load
duke
parents:
diff changeset
368 }
a61af66fc99e Initial load
duke
parents:
diff changeset
369 }
a61af66fc99e Initial load
duke
parents:
diff changeset
370 } else {
a61af66fc99e Initial load
duke
parents:
diff changeset
371 switch((int) numBytes) {
a61af66fc99e Initial load
duke
parents:
diff changeset
372 case 1: return cache.getByte(address);
a61af66fc99e Initial load
duke
parents:
diff changeset
373 case 2: return cache.getShort(address, bigEndian);
a61af66fc99e Initial load
duke
parents:
diff changeset
374 case 4: return cache.getInt(address, bigEndian);
a61af66fc99e Initial load
duke
parents:
diff changeset
375 case 8: return cache.getLong(address, bigEndian);
a61af66fc99e Initial load
duke
parents:
diff changeset
376 default: {
a61af66fc99e Initial load
duke
parents:
diff changeset
377 byte[] data = readBytes(address, numBytes);
a61af66fc99e Initial load
duke
parents:
diff changeset
378 return utils.dataToCInteger(data, isUnsigned);
a61af66fc99e Initial load
duke
parents:
diff changeset
379 }
a61af66fc99e Initial load
duke
parents:
diff changeset
380 }
a61af66fc99e Initial load
duke
parents:
diff changeset
381 }
a61af66fc99e Initial load
duke
parents:
diff changeset
382 } else {
a61af66fc99e Initial load
duke
parents:
diff changeset
383 byte[] data = readBytes(address, numBytes);
a61af66fc99e Initial load
duke
parents:
diff changeset
384 return utils.dataToCInteger(data, isUnsigned);
a61af66fc99e Initial load
duke
parents:
diff changeset
385 }
a61af66fc99e Initial load
duke
parents:
diff changeset
386 }
a61af66fc99e Initial load
duke
parents:
diff changeset
387
a61af66fc99e Initial load
duke
parents:
diff changeset
388 public void writeJBoolean(long address, boolean value)
a61af66fc99e Initial load
duke
parents:
diff changeset
389 throws UnmappedAddressException, UnalignedAddressException {
a61af66fc99e Initial load
duke
parents:
diff changeset
390 checkJavaConfigured();
a61af66fc99e Initial load
duke
parents:
diff changeset
391 utils.checkAlignment(address, jbooleanSize);
a61af66fc99e Initial load
duke
parents:
diff changeset
392 byte[] data = utils.jbooleanToData(value);
a61af66fc99e Initial load
duke
parents:
diff changeset
393 writeBytes(address, jbooleanSize, data);
a61af66fc99e Initial load
duke
parents:
diff changeset
394 }
a61af66fc99e Initial load
duke
parents:
diff changeset
395
a61af66fc99e Initial load
duke
parents:
diff changeset
396 public void writeJByte(long address, byte value)
a61af66fc99e Initial load
duke
parents:
diff changeset
397 throws UnmappedAddressException, UnalignedAddressException {
a61af66fc99e Initial load
duke
parents:
diff changeset
398 checkJavaConfigured();
a61af66fc99e Initial load
duke
parents:
diff changeset
399 utils.checkAlignment(address, jbyteSize);
a61af66fc99e Initial load
duke
parents:
diff changeset
400 byte[] data = utils.jbyteToData(value);
a61af66fc99e Initial load
duke
parents:
diff changeset
401 writeBytes(address, jbyteSize, data);
a61af66fc99e Initial load
duke
parents:
diff changeset
402 }
a61af66fc99e Initial load
duke
parents:
diff changeset
403
a61af66fc99e Initial load
duke
parents:
diff changeset
404 public void writeJChar(long address, char value)
a61af66fc99e Initial load
duke
parents:
diff changeset
405 throws UnmappedAddressException, UnalignedAddressException {
a61af66fc99e Initial load
duke
parents:
diff changeset
406 checkJavaConfigured();
a61af66fc99e Initial load
duke
parents:
diff changeset
407 utils.checkAlignment(address, jcharSize);
a61af66fc99e Initial load
duke
parents:
diff changeset
408 byte[] data = utils.jcharToData(value);
a61af66fc99e Initial load
duke
parents:
diff changeset
409 writeBytes(address, jcharSize, data);
a61af66fc99e Initial load
duke
parents:
diff changeset
410 }
a61af66fc99e Initial load
duke
parents:
diff changeset
411
a61af66fc99e Initial load
duke
parents:
diff changeset
412 public void writeJDouble(long address, double value)
a61af66fc99e Initial load
duke
parents:
diff changeset
413 throws UnmappedAddressException, UnalignedAddressException {
a61af66fc99e Initial load
duke
parents:
diff changeset
414 checkJavaConfigured();
a61af66fc99e Initial load
duke
parents:
diff changeset
415 utils.checkAlignment(address, jdoubleSize);
a61af66fc99e Initial load
duke
parents:
diff changeset
416 byte[] data = utils.jdoubleToData(value);
a61af66fc99e Initial load
duke
parents:
diff changeset
417 writeBytes(address, jdoubleSize, data);
a61af66fc99e Initial load
duke
parents:
diff changeset
418 }
a61af66fc99e Initial load
duke
parents:
diff changeset
419
a61af66fc99e Initial load
duke
parents:
diff changeset
420 public void writeJFloat(long address, float value)
a61af66fc99e Initial load
duke
parents:
diff changeset
421 throws UnmappedAddressException, UnalignedAddressException {
a61af66fc99e Initial load
duke
parents:
diff changeset
422 checkJavaConfigured();
a61af66fc99e Initial load
duke
parents:
diff changeset
423 utils.checkAlignment(address, jfloatSize);
a61af66fc99e Initial load
duke
parents:
diff changeset
424 byte[] data = utils.jfloatToData(value);
a61af66fc99e Initial load
duke
parents:
diff changeset
425 writeBytes(address, jfloatSize, data);
a61af66fc99e Initial load
duke
parents:
diff changeset
426 }
a61af66fc99e Initial load
duke
parents:
diff changeset
427
a61af66fc99e Initial load
duke
parents:
diff changeset
428 public void writeJInt(long address, int value)
a61af66fc99e Initial load
duke
parents:
diff changeset
429 throws UnmappedAddressException, UnalignedAddressException {
a61af66fc99e Initial load
duke
parents:
diff changeset
430 checkJavaConfigured();
a61af66fc99e Initial load
duke
parents:
diff changeset
431 utils.checkAlignment(address, jintSize);
a61af66fc99e Initial load
duke
parents:
diff changeset
432 byte[] data = utils.jintToData(value);
a61af66fc99e Initial load
duke
parents:
diff changeset
433 writeBytes(address, jintSize, data);
a61af66fc99e Initial load
duke
parents:
diff changeset
434 }
a61af66fc99e Initial load
duke
parents:
diff changeset
435
a61af66fc99e Initial load
duke
parents:
diff changeset
436 public void writeJLong(long address, long value)
a61af66fc99e Initial load
duke
parents:
diff changeset
437 throws UnmappedAddressException, UnalignedAddressException {
a61af66fc99e Initial load
duke
parents:
diff changeset
438 checkJavaConfigured();
a61af66fc99e Initial load
duke
parents:
diff changeset
439 utils.checkAlignment(address, jlongSize);
a61af66fc99e Initial load
duke
parents:
diff changeset
440 byte[] data = utils.jlongToData(value);
a61af66fc99e Initial load
duke
parents:
diff changeset
441 writeBytes(address, jlongSize, data);
a61af66fc99e Initial load
duke
parents:
diff changeset
442 }
a61af66fc99e Initial load
duke
parents:
diff changeset
443
a61af66fc99e Initial load
duke
parents:
diff changeset
444 public void writeJShort(long address, short value)
a61af66fc99e Initial load
duke
parents:
diff changeset
445 throws UnmappedAddressException, UnalignedAddressException {
a61af66fc99e Initial load
duke
parents:
diff changeset
446 checkJavaConfigured();
a61af66fc99e Initial load
duke
parents:
diff changeset
447 utils.checkAlignment(address, jshortSize);
a61af66fc99e Initial load
duke
parents:
diff changeset
448 byte[] data = utils.jshortToData(value);
a61af66fc99e Initial load
duke
parents:
diff changeset
449 writeBytes(address, jshortSize, data);
a61af66fc99e Initial load
duke
parents:
diff changeset
450 }
a61af66fc99e Initial load
duke
parents:
diff changeset
451
a61af66fc99e Initial load
duke
parents:
diff changeset
452 public void writeCInteger(long address, long numBytes, long value)
a61af66fc99e Initial load
duke
parents:
diff changeset
453 throws UnmappedAddressException, UnalignedAddressException {
a61af66fc99e Initial load
duke
parents:
diff changeset
454 checkConfigured();
a61af66fc99e Initial load
duke
parents:
diff changeset
455 utils.checkAlignment(address, numBytes);
a61af66fc99e Initial load
duke
parents:
diff changeset
456 byte[] data = utils.cIntegerToData(numBytes, value);
a61af66fc99e Initial load
duke
parents:
diff changeset
457 writeBytes(address, numBytes, data);
a61af66fc99e Initial load
duke
parents:
diff changeset
458 }
a61af66fc99e Initial load
duke
parents:
diff changeset
459
a61af66fc99e Initial load
duke
parents:
diff changeset
460 protected long readAddressValue(long address)
a61af66fc99e Initial load
duke
parents:
diff changeset
461 throws UnmappedAddressException, UnalignedAddressException {
a61af66fc99e Initial load
duke
parents:
diff changeset
462 return readCInteger(address, machDesc.getAddressSize(), true);
a61af66fc99e Initial load
duke
parents:
diff changeset
463 }
a61af66fc99e Initial load
duke
parents:
diff changeset
464
113
ba764ed4b6f2 6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents: 0
diff changeset
465 protected long readCompOopAddressValue(long address)
ba764ed4b6f2 6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents: 0
diff changeset
466 throws UnmappedAddressException, UnalignedAddressException {
ba764ed4b6f2 6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents: 0
diff changeset
467 long value = readCInteger(address, getHeapOopSize(), true);
ba764ed4b6f2 6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents: 0
diff changeset
468 if (value != 0) {
ba764ed4b6f2 6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents: 0
diff changeset
469 // See oop.inline.hpp decode_heap_oop
642
660978a2a31a 6791178: Specialize for zero as the compressed oop vm heap base
kvn
parents: 196
diff changeset
470 value = (long)(narrowOopBase + (long)(value << narrowOopShift));
113
ba764ed4b6f2 6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents: 0
diff changeset
471 }
ba764ed4b6f2 6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents: 0
diff changeset
472 return value;
ba764ed4b6f2 6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents: 0
diff changeset
473 }
ba764ed4b6f2 6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents: 0
diff changeset
474
6848
8e47bac5643a 7054512: Compress class pointers after perm gen removal
roland
parents: 1552
diff changeset
475 protected long readCompKlassAddressValue(long address)
8e47bac5643a 7054512: Compress class pointers after perm gen removal
roland
parents: 1552
diff changeset
476 throws UnmappedAddressException, UnalignedAddressException {
8e47bac5643a 7054512: Compress class pointers after perm gen removal
roland
parents: 1552
diff changeset
477 long value = readCInteger(address, getKlassPtrSize(), true);
8e47bac5643a 7054512: Compress class pointers after perm gen removal
roland
parents: 1552
diff changeset
478 if (value != 0) {
8e47bac5643a 7054512: Compress class pointers after perm gen removal
roland
parents: 1552
diff changeset
479 value = (long)(narrowKlassBase + (long)(value << narrowKlassShift));
8e47bac5643a 7054512: Compress class pointers after perm gen removal
roland
parents: 1552
diff changeset
480 }
8e47bac5643a 7054512: Compress class pointers after perm gen removal
roland
parents: 1552
diff changeset
481 return value;
8e47bac5643a 7054512: Compress class pointers after perm gen removal
roland
parents: 1552
diff changeset
482 }
8e47bac5643a 7054512: Compress class pointers after perm gen removal
roland
parents: 1552
diff changeset
483
0
a61af66fc99e Initial load
duke
parents:
diff changeset
484 protected void writeAddressValue(long address, long value)
a61af66fc99e Initial load
duke
parents:
diff changeset
485 throws UnmappedAddressException, UnalignedAddressException {
a61af66fc99e Initial load
duke
parents:
diff changeset
486 writeCInteger(address, machDesc.getAddressSize(), value);
a61af66fc99e Initial load
duke
parents:
diff changeset
487 }
a61af66fc99e Initial load
duke
parents:
diff changeset
488
a61af66fc99e Initial load
duke
parents:
diff changeset
489 /** Can be called by subclasses but can not be overridden */
a61af66fc99e Initial load
duke
parents:
diff changeset
490 protected final void checkConfigured() {
a61af66fc99e Initial load
duke
parents:
diff changeset
491 if (machDesc == null) {
a61af66fc99e Initial load
duke
parents:
diff changeset
492 throw new RuntimeException("MachineDescription must have been set by this point");
a61af66fc99e Initial load
duke
parents:
diff changeset
493 }
a61af66fc99e Initial load
duke
parents:
diff changeset
494 if (utils == null) {
a61af66fc99e Initial load
duke
parents:
diff changeset
495 throw new RuntimeException("DebuggerUtilities must have been set by this point");
a61af66fc99e Initial load
duke
parents:
diff changeset
496 }
a61af66fc99e Initial load
duke
parents:
diff changeset
497 }
a61af66fc99e Initial load
duke
parents:
diff changeset
498
a61af66fc99e Initial load
duke
parents:
diff changeset
499 /** Can be called by subclasses but can not be overridden */
a61af66fc99e Initial load
duke
parents:
diff changeset
500 protected final void checkJavaConfigured() {
a61af66fc99e Initial load
duke
parents:
diff changeset
501 checkConfigured();
a61af66fc99e Initial load
duke
parents:
diff changeset
502
a61af66fc99e Initial load
duke
parents:
diff changeset
503 if (!javaPrimitiveTypesConfigured) {
a61af66fc99e Initial load
duke
parents:
diff changeset
504 throw new RuntimeException("Java primitive type sizes have not yet been configured");
a61af66fc99e Initial load
duke
parents:
diff changeset
505 }
a61af66fc99e Initial load
duke
parents:
diff changeset
506 }
a61af66fc99e Initial load
duke
parents:
diff changeset
507
a61af66fc99e Initial load
duke
parents:
diff changeset
508 /** Possibly override page cache size with user-specified property */
a61af66fc99e Initial load
duke
parents:
diff changeset
509 protected int parseCacheNumPagesProperty(int defaultNum) {
a61af66fc99e Initial load
duke
parents:
diff changeset
510 String cacheNumPagesString = System.getProperty("cacheNumPages");
a61af66fc99e Initial load
duke
parents:
diff changeset
511 if (cacheNumPagesString != null) {
a61af66fc99e Initial load
duke
parents:
diff changeset
512 try {
a61af66fc99e Initial load
duke
parents:
diff changeset
513 return Integer.parseInt(cacheNumPagesString);
a61af66fc99e Initial load
duke
parents:
diff changeset
514 } catch (Exception e) {
a61af66fc99e Initial load
duke
parents:
diff changeset
515 System.err.println("Error parsing cacheNumPages property:");
a61af66fc99e Initial load
duke
parents:
diff changeset
516 e.printStackTrace();
a61af66fc99e Initial load
duke
parents:
diff changeset
517 }
a61af66fc99e Initial load
duke
parents:
diff changeset
518 }
a61af66fc99e Initial load
duke
parents:
diff changeset
519 return defaultNum;
a61af66fc99e Initial load
duke
parents:
diff changeset
520 }
a61af66fc99e Initial load
duke
parents:
diff changeset
521
a61af66fc99e Initial load
duke
parents:
diff changeset
522 /** Interim solution for allowing subclasses to write bytes to
a61af66fc99e Initial load
duke
parents:
diff changeset
523 process until we make that functionality available in the basic
a61af66fc99e Initial load
duke
parents:
diff changeset
524 Address interface */
a61af66fc99e Initial load
duke
parents:
diff changeset
525 protected void invalidatePageCache(long startAddress, long numBytes) {
a61af66fc99e Initial load
duke
parents:
diff changeset
526 cache.clear(startAddress, numBytes);
a61af66fc99e Initial load
duke
parents:
diff changeset
527 }
a61af66fc99e Initial load
duke
parents:
diff changeset
528
a61af66fc99e Initial load
duke
parents:
diff changeset
529 public long getJBooleanSize() {
a61af66fc99e Initial load
duke
parents:
diff changeset
530 return jbooleanSize;
a61af66fc99e Initial load
duke
parents:
diff changeset
531 }
a61af66fc99e Initial load
duke
parents:
diff changeset
532
a61af66fc99e Initial load
duke
parents:
diff changeset
533 public long getJByteSize() {
a61af66fc99e Initial load
duke
parents:
diff changeset
534 return jbyteSize;
a61af66fc99e Initial load
duke
parents:
diff changeset
535 }
a61af66fc99e Initial load
duke
parents:
diff changeset
536
a61af66fc99e Initial load
duke
parents:
diff changeset
537 public long getJCharSize() {
a61af66fc99e Initial load
duke
parents:
diff changeset
538 return jcharSize;
a61af66fc99e Initial load
duke
parents:
diff changeset
539 }
a61af66fc99e Initial load
duke
parents:
diff changeset
540
a61af66fc99e Initial load
duke
parents:
diff changeset
541 public long getJDoubleSize() {
a61af66fc99e Initial load
duke
parents:
diff changeset
542 return jdoubleSize;
a61af66fc99e Initial load
duke
parents:
diff changeset
543 }
a61af66fc99e Initial load
duke
parents:
diff changeset
544
a61af66fc99e Initial load
duke
parents:
diff changeset
545 public long getJFloatSize() {
a61af66fc99e Initial load
duke
parents:
diff changeset
546 return jfloatSize;
a61af66fc99e Initial load
duke
parents:
diff changeset
547 }
a61af66fc99e Initial load
duke
parents:
diff changeset
548
a61af66fc99e Initial load
duke
parents:
diff changeset
549 public long getJIntSize() {
a61af66fc99e Initial load
duke
parents:
diff changeset
550 return jintSize;
a61af66fc99e Initial load
duke
parents:
diff changeset
551 }
a61af66fc99e Initial load
duke
parents:
diff changeset
552
a61af66fc99e Initial load
duke
parents:
diff changeset
553 public long getJLongSize() {
a61af66fc99e Initial load
duke
parents:
diff changeset
554 return jlongSize;
a61af66fc99e Initial load
duke
parents:
diff changeset
555 }
a61af66fc99e Initial load
duke
parents:
diff changeset
556
a61af66fc99e Initial load
duke
parents:
diff changeset
557 public long getJShortSize() {
a61af66fc99e Initial load
duke
parents:
diff changeset
558 return jshortSize;
a61af66fc99e Initial load
duke
parents:
diff changeset
559 }
113
ba764ed4b6f2 6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents: 0
diff changeset
560
ba764ed4b6f2 6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents: 0
diff changeset
561 public long getHeapOopSize() {
ba764ed4b6f2 6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents: 0
diff changeset
562 return heapOopSize;
ba764ed4b6f2 6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents: 0
diff changeset
563 }
ba764ed4b6f2 6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents: 0
diff changeset
564
642
660978a2a31a 6791178: Specialize for zero as the compressed oop vm heap base
kvn
parents: 196
diff changeset
565 public long getNarrowOopBase() {
660978a2a31a 6791178: Specialize for zero as the compressed oop vm heap base
kvn
parents: 196
diff changeset
566 return narrowOopBase;
113
ba764ed4b6f2 6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents: 0
diff changeset
567 }
642
660978a2a31a 6791178: Specialize for zero as the compressed oop vm heap base
kvn
parents: 196
diff changeset
568 public int getNarrowOopShift() {
660978a2a31a 6791178: Specialize for zero as the compressed oop vm heap base
kvn
parents: 196
diff changeset
569 return narrowOopShift;
113
ba764ed4b6f2 6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents: 0
diff changeset
570 }
6848
8e47bac5643a 7054512: Compress class pointers after perm gen removal
roland
parents: 1552
diff changeset
571
8e47bac5643a 7054512: Compress class pointers after perm gen removal
roland
parents: 1552
diff changeset
572 public long getKlassPtrSize() {
8e47bac5643a 7054512: Compress class pointers after perm gen removal
roland
parents: 1552
diff changeset
573 return klassPtrSize;
8e47bac5643a 7054512: Compress class pointers after perm gen removal
roland
parents: 1552
diff changeset
574 }
8e47bac5643a 7054512: Compress class pointers after perm gen removal
roland
parents: 1552
diff changeset
575
8e47bac5643a 7054512: Compress class pointers after perm gen removal
roland
parents: 1552
diff changeset
576 public long getNarrowKlassBase() {
8e47bac5643a 7054512: Compress class pointers after perm gen removal
roland
parents: 1552
diff changeset
577 return narrowKlassBase;
8e47bac5643a 7054512: Compress class pointers after perm gen removal
roland
parents: 1552
diff changeset
578 }
8e47bac5643a 7054512: Compress class pointers after perm gen removal
roland
parents: 1552
diff changeset
579 public int getNarrowKlassShift() {
8e47bac5643a 7054512: Compress class pointers after perm gen removal
roland
parents: 1552
diff changeset
580 return narrowKlassShift;
8e47bac5643a 7054512: Compress class pointers after perm gen removal
roland
parents: 1552
diff changeset
581 }
0
a61af66fc99e Initial load
duke
parents:
diff changeset
582 }