annotate agent/src/share/classes/sun/jvm/hotspot/debugger/DebuggerBase.java @ 196:d1605aabd0a1 jdk7-b30

6719955: Update copyright year Summary: Update copyright year for files that have been modified in 2008 Reviewed-by: ohair, tbell
author xdono
date Wed, 02 Jul 2008 12:55:16 -0700
parents ba764ed4b6f2
children 660978a2a31a
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
0
a61af66fc99e Initial load
duke
parents:
diff changeset
1 /*
196
d1605aabd0a1 6719955: Update copyright year
xdono
parents: 113
diff changeset
2 * Copyright 2001-2008 Sun Microsystems, Inc. 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 *
a61af66fc99e Initial load
duke
parents:
diff changeset
19 * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
a61af66fc99e Initial load
duke
parents:
diff changeset
20 * CA 95054 USA or visit www.sun.com if you need additional information or
a61af66fc99e Initial load
duke
parents:
diff changeset
21 * have any questions.
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;
ba764ed4b6f2 6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents: 0
diff changeset
59 protected long heapBase; // heap base for compressed oops.
ba764ed4b6f2 6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents: 0
diff changeset
60 protected long logMinObjAlignmentInBytes; // Used to decode compressed oops.
0
a61af66fc99e Initial load
duke
parents:
diff changeset
61 // Should be initialized if desired by calling initCache()
a61af66fc99e Initial load
duke
parents:
diff changeset
62 private PageCache cache;
a61af66fc99e Initial load
duke
parents:
diff changeset
63
a61af66fc99e Initial load
duke
parents:
diff changeset
64 // State for faster accessors that don't allocate memory on each read
a61af66fc99e Initial load
duke
parents:
diff changeset
65 private boolean useFastAccessors;
a61af66fc99e Initial load
duke
parents:
diff changeset
66 private boolean bigEndian;
a61af66fc99e Initial load
duke
parents:
diff changeset
67
a61af66fc99e Initial load
duke
parents:
diff changeset
68 // Page-fetching functionality for LRU cache
a61af66fc99e Initial load
duke
parents:
diff changeset
69 class Fetcher implements PageFetcher {
a61af66fc99e Initial load
duke
parents:
diff changeset
70 public Page fetchPage(long pageBaseAddress, long numBytes) {
a61af66fc99e Initial load
duke
parents:
diff changeset
71 // This assumes that if any byte is unmapped, that the entire
a61af66fc99e Initial load
duke
parents:
diff changeset
72 // page is. The common case, however, is that the page is
a61af66fc99e Initial load
duke
parents:
diff changeset
73 // mapped, so we always fetch the entire thing all at once to
a61af66fc99e Initial load
duke
parents:
diff changeset
74 // avoid two round-trip communications per page fetch, even
a61af66fc99e Initial load
duke
parents:
diff changeset
75 // though fetching of unmapped pages will be slow.
a61af66fc99e Initial load
duke
parents:
diff changeset
76 ReadResult res = readBytesFromProcess(pageBaseAddress, numBytes);
a61af66fc99e Initial load
duke
parents:
diff changeset
77 if (res.getData() == null) {
a61af66fc99e Initial load
duke
parents:
diff changeset
78 return new Page(pageBaseAddress, numBytes);
a61af66fc99e Initial load
duke
parents:
diff changeset
79 }
a61af66fc99e Initial load
duke
parents:
diff changeset
80 return new Page(pageBaseAddress, res.getData());
a61af66fc99e Initial load
duke
parents:
diff changeset
81 }
a61af66fc99e Initial load
duke
parents:
diff changeset
82 }
a61af66fc99e Initial load
duke
parents:
diff changeset
83
a61af66fc99e Initial load
duke
parents:
diff changeset
84 protected DebuggerBase() {
a61af66fc99e Initial load
duke
parents:
diff changeset
85 }
a61af66fc99e Initial load
duke
parents:
diff changeset
86
a61af66fc99e Initial load
duke
parents:
diff changeset
87 /** From the JVMDebugger interface. This is the only public method
a61af66fc99e Initial load
duke
parents:
diff changeset
88 of this class. */
a61af66fc99e Initial load
duke
parents:
diff changeset
89 public void configureJavaPrimitiveTypeSizes(long jbooleanSize,
a61af66fc99e Initial load
duke
parents:
diff changeset
90 long jbyteSize,
a61af66fc99e Initial load
duke
parents:
diff changeset
91 long jcharSize,
a61af66fc99e Initial load
duke
parents:
diff changeset
92 long jdoubleSize,
a61af66fc99e Initial load
duke
parents:
diff changeset
93 long jfloatSize,
a61af66fc99e Initial load
duke
parents:
diff changeset
94 long jintSize,
a61af66fc99e Initial load
duke
parents:
diff changeset
95 long jlongSize,
a61af66fc99e Initial load
duke
parents:
diff changeset
96 long jshortSize) {
a61af66fc99e Initial load
duke
parents:
diff changeset
97 this.jbooleanSize = jbooleanSize;
a61af66fc99e Initial load
duke
parents:
diff changeset
98 this.jbyteSize = jbyteSize;
a61af66fc99e Initial load
duke
parents:
diff changeset
99 this.jcharSize = jcharSize;
a61af66fc99e Initial load
duke
parents:
diff changeset
100 this.jdoubleSize = jdoubleSize;
a61af66fc99e Initial load
duke
parents:
diff changeset
101 this.jfloatSize = jfloatSize;
a61af66fc99e Initial load
duke
parents:
diff changeset
102 this.jintSize = jintSize;
a61af66fc99e Initial load
duke
parents:
diff changeset
103 this.jlongSize = jlongSize;
a61af66fc99e Initial load
duke
parents:
diff changeset
104 this.jshortSize = jshortSize;
a61af66fc99e Initial load
duke
parents:
diff changeset
105
a61af66fc99e Initial load
duke
parents:
diff changeset
106 if (jbooleanSize < 1) {
a61af66fc99e Initial load
duke
parents:
diff changeset
107 throw new RuntimeException("jboolean size is too small");
a61af66fc99e Initial load
duke
parents:
diff changeset
108 }
a61af66fc99e Initial load
duke
parents:
diff changeset
109
a61af66fc99e Initial load
duke
parents:
diff changeset
110 if (jbyteSize < 1) {
a61af66fc99e Initial load
duke
parents:
diff changeset
111 throw new RuntimeException("jbyte 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 (jcharSize < 2) {
a61af66fc99e Initial load
duke
parents:
diff changeset
115 throw new RuntimeException("jchar 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 (jdoubleSize < 8) {
a61af66fc99e Initial load
duke
parents:
diff changeset
119 throw new RuntimeException("jdouble 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 (jfloatSize < 4) {
a61af66fc99e Initial load
duke
parents:
diff changeset
123 throw new RuntimeException("jfloat 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 (jintSize < 4) {
a61af66fc99e Initial load
duke
parents:
diff changeset
127 throw new RuntimeException("jint 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 (jlongSize < 8) {
a61af66fc99e Initial load
duke
parents:
diff changeset
131 throw new RuntimeException("jlong 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 (jshortSize < 2) {
a61af66fc99e Initial load
duke
parents:
diff changeset
135 throw new RuntimeException("jshort 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 (jintSize != jfloatSize) {
a61af66fc99e Initial load
duke
parents:
diff changeset
139 // If dataToJFloat were rewritten, this wouldn't be necessary
a61af66fc99e Initial load
duke
parents:
diff changeset
140 throw new RuntimeException("jint size and jfloat size must be equal");
a61af66fc99e Initial load
duke
parents:
diff changeset
141 }
a61af66fc99e Initial load
duke
parents:
diff changeset
142
a61af66fc99e Initial load
duke
parents:
diff changeset
143 if (jlongSize != jdoubleSize) {
a61af66fc99e Initial load
duke
parents:
diff changeset
144 // If dataToJDouble were rewritten, this wouldn't be necessary
a61af66fc99e Initial load
duke
parents:
diff changeset
145 throw new RuntimeException("jlong size and jdouble size must be equal");
a61af66fc99e Initial load
duke
parents:
diff changeset
146 }
a61af66fc99e Initial load
duke
parents:
diff changeset
147
a61af66fc99e Initial load
duke
parents:
diff changeset
148 useFastAccessors =
a61af66fc99e Initial load
duke
parents:
diff changeset
149 ((cache != null) &&
a61af66fc99e Initial load
duke
parents:
diff changeset
150 (jbooleanSize == 1) &&
a61af66fc99e Initial load
duke
parents:
diff changeset
151 (jbyteSize == 1) &&
a61af66fc99e Initial load
duke
parents:
diff changeset
152 (jcharSize == 2) &&
a61af66fc99e Initial load
duke
parents:
diff changeset
153 (jdoubleSize == 8) &&
a61af66fc99e Initial load
duke
parents:
diff changeset
154 (jfloatSize == 4) &&
a61af66fc99e Initial load
duke
parents:
diff changeset
155 (jintSize == 4) &&
a61af66fc99e Initial load
duke
parents:
diff changeset
156 (jlongSize == 8) &&
a61af66fc99e Initial load
duke
parents:
diff changeset
157 (jshortSize == 2));
a61af66fc99e Initial load
duke
parents:
diff changeset
158
a61af66fc99e Initial load
duke
parents:
diff changeset
159 javaPrimitiveTypesConfigured = true;
a61af66fc99e Initial load
duke
parents:
diff changeset
160 }
a61af66fc99e Initial load
duke
parents:
diff changeset
161
113
ba764ed4b6f2 6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents: 0
diff changeset
162 public void putHeapConst(long heapBase, long heapOopSize, long logMinObjAlignmentInBytes) {
ba764ed4b6f2 6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents: 0
diff changeset
163 this.heapBase = heapBase;
ba764ed4b6f2 6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents: 0
diff changeset
164 this.heapOopSize = heapOopSize;
ba764ed4b6f2 6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents: 0
diff changeset
165 this.logMinObjAlignmentInBytes = logMinObjAlignmentInBytes;
ba764ed4b6f2 6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents: 0
diff changeset
166 }
ba764ed4b6f2 6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents: 0
diff changeset
167
0
a61af66fc99e Initial load
duke
parents:
diff changeset
168 /** May be called by subclasses if desired to initialize the page
a61af66fc99e Initial load
duke
parents:
diff changeset
169 cache but may not be overridden */
a61af66fc99e Initial load
duke
parents:
diff changeset
170 protected final void initCache(long pageSize, long maxNumPages) {
a61af66fc99e Initial load
duke
parents:
diff changeset
171 cache = new PageCache(pageSize, maxNumPages, new Fetcher());
a61af66fc99e Initial load
duke
parents:
diff changeset
172 if (machDesc != null) {
a61af66fc99e Initial load
duke
parents:
diff changeset
173 bigEndian = machDesc.isBigEndian();
a61af66fc99e Initial load
duke
parents:
diff changeset
174 }
a61af66fc99e Initial load
duke
parents:
diff changeset
175 }
a61af66fc99e Initial load
duke
parents:
diff changeset
176
a61af66fc99e Initial load
duke
parents:
diff changeset
177 /** May be called by subclasses if needed (if the machine
a61af66fc99e Initial load
duke
parents:
diff changeset
178 description is not available at the time of cache
a61af66fc99e Initial load
duke
parents:
diff changeset
179 initialization, as on Solaris) but may not be overridden */
a61af66fc99e Initial load
duke
parents:
diff changeset
180 protected final void setBigEndian(boolean bigEndian) {
a61af66fc99e Initial load
duke
parents:
diff changeset
181 this.bigEndian = bigEndian;
a61af66fc99e Initial load
duke
parents:
diff changeset
182 }
a61af66fc99e Initial load
duke
parents:
diff changeset
183
a61af66fc99e Initial load
duke
parents:
diff changeset
184 /** May be called by subclasses to clear out the cache but may not
a61af66fc99e Initial load
duke
parents:
diff changeset
185 be overridden. For convenience, this can be called even if the
a61af66fc99e Initial load
duke
parents:
diff changeset
186 cache has not been initialized. */
a61af66fc99e Initial load
duke
parents:
diff changeset
187 protected final void clearCache() {
a61af66fc99e Initial load
duke
parents:
diff changeset
188 if (cache != null) {
a61af66fc99e Initial load
duke
parents:
diff changeset
189 cache.clear();
a61af66fc99e Initial load
duke
parents:
diff changeset
190 }
a61af66fc99e Initial load
duke
parents:
diff changeset
191 }
a61af66fc99e Initial load
duke
parents:
diff changeset
192
a61af66fc99e Initial load
duke
parents:
diff changeset
193 /** May be called by subclasses to disable the cache (for example,
a61af66fc99e Initial load
duke
parents:
diff changeset
194 when the target process has been resumed) but may not be
a61af66fc99e Initial load
duke
parents:
diff changeset
195 overridden. For convenience, this can be called even if the
a61af66fc99e Initial load
duke
parents:
diff changeset
196 cache has not been initialized. */
a61af66fc99e Initial load
duke
parents:
diff changeset
197 protected final void disableCache() {
a61af66fc99e Initial load
duke
parents:
diff changeset
198 if (cache != null) {
a61af66fc99e Initial load
duke
parents:
diff changeset
199 cache.disable();
a61af66fc99e Initial load
duke
parents:
diff changeset
200 }
a61af66fc99e Initial load
duke
parents:
diff changeset
201 }
a61af66fc99e Initial load
duke
parents:
diff changeset
202
a61af66fc99e Initial load
duke
parents:
diff changeset
203 /** May be called by subclasses to re-enable the cache (for example,
a61af66fc99e Initial load
duke
parents:
diff changeset
204 when the target process has been suspended) but may not be
a61af66fc99e Initial load
duke
parents:
diff changeset
205 overridden. For convenience, this can be called even if the
a61af66fc99e Initial load
duke
parents:
diff changeset
206 cache has not been initialized. */
a61af66fc99e Initial load
duke
parents:
diff changeset
207 protected final void enableCache() {
a61af66fc99e Initial load
duke
parents:
diff changeset
208 if (cache != null) {
a61af66fc99e Initial load
duke
parents:
diff changeset
209 cache.enable();
a61af66fc99e Initial load
duke
parents:
diff changeset
210 }
a61af66fc99e Initial load
duke
parents:
diff changeset
211 }
a61af66fc99e Initial load
duke
parents:
diff changeset
212
a61af66fc99e Initial load
duke
parents:
diff changeset
213 /** May be called by subclasses directly but may not be overridden */
a61af66fc99e Initial load
duke
parents:
diff changeset
214 protected final byte[] readBytes(long address, long numBytes)
a61af66fc99e Initial load
duke
parents:
diff changeset
215 throws UnmappedAddressException, DebuggerException {
a61af66fc99e Initial load
duke
parents:
diff changeset
216 if (cache != null) {
a61af66fc99e Initial load
duke
parents:
diff changeset
217 return cache.getData(address, numBytes);
a61af66fc99e Initial load
duke
parents:
diff changeset
218 } else {
a61af66fc99e Initial load
duke
parents:
diff changeset
219 ReadResult res = readBytesFromProcess(address, numBytes);
a61af66fc99e Initial load
duke
parents:
diff changeset
220 if (res.getData() != null) {
a61af66fc99e Initial load
duke
parents:
diff changeset
221 return res.getData();
a61af66fc99e Initial load
duke
parents:
diff changeset
222 }
a61af66fc99e Initial load
duke
parents:
diff changeset
223 throw new UnmappedAddressException(res.getFailureAddress());
a61af66fc99e Initial load
duke
parents:
diff changeset
224 }
a61af66fc99e Initial load
duke
parents:
diff changeset
225 }
a61af66fc99e Initial load
duke
parents:
diff changeset
226
a61af66fc99e Initial load
duke
parents:
diff changeset
227 /** May be called by subclasses directly but may not be overridden */
a61af66fc99e Initial load
duke
parents:
diff changeset
228 protected final void writeBytes(long address, long numBytes, byte[] data)
a61af66fc99e Initial load
duke
parents:
diff changeset
229 throws UnmappedAddressException, DebuggerException {
a61af66fc99e Initial load
duke
parents:
diff changeset
230 if (cache != null) {
a61af66fc99e Initial load
duke
parents:
diff changeset
231 cache.clear(address, numBytes);
a61af66fc99e Initial load
duke
parents:
diff changeset
232 }
a61af66fc99e Initial load
duke
parents:
diff changeset
233 writeBytesToProcess(address, numBytes, data);
a61af66fc99e Initial load
duke
parents:
diff changeset
234 }
a61af66fc99e Initial load
duke
parents:
diff changeset
235
a61af66fc99e Initial load
duke
parents:
diff changeset
236 public boolean readJBoolean(long address)
a61af66fc99e Initial load
duke
parents:
diff changeset
237 throws UnmappedAddressException, UnalignedAddressException {
a61af66fc99e Initial load
duke
parents:
diff changeset
238 checkJavaConfigured();
a61af66fc99e Initial load
duke
parents:
diff changeset
239 utils.checkAlignment(address, jbooleanSize);
a61af66fc99e Initial load
duke
parents:
diff changeset
240 if (useFastAccessors) {
a61af66fc99e Initial load
duke
parents:
diff changeset
241 return (cache.getByte(address) != 0);
a61af66fc99e Initial load
duke
parents:
diff changeset
242 } else {
a61af66fc99e Initial load
duke
parents:
diff changeset
243 byte[] data = readBytes(address, jbooleanSize);
a61af66fc99e Initial load
duke
parents:
diff changeset
244 return utils.dataToJBoolean(data, jbooleanSize);
a61af66fc99e Initial load
duke
parents:
diff changeset
245 }
a61af66fc99e Initial load
duke
parents:
diff changeset
246 }
a61af66fc99e Initial load
duke
parents:
diff changeset
247
a61af66fc99e Initial load
duke
parents:
diff changeset
248 public byte readJByte(long address)
a61af66fc99e Initial load
duke
parents:
diff changeset
249 throws UnmappedAddressException, UnalignedAddressException {
a61af66fc99e Initial load
duke
parents:
diff changeset
250 checkJavaConfigured();
a61af66fc99e Initial load
duke
parents:
diff changeset
251 utils.checkAlignment(address, jbyteSize);
a61af66fc99e Initial load
duke
parents:
diff changeset
252 if (useFastAccessors) {
a61af66fc99e Initial load
duke
parents:
diff changeset
253 return cache.getByte(address);
a61af66fc99e Initial load
duke
parents:
diff changeset
254 } else {
a61af66fc99e Initial load
duke
parents:
diff changeset
255 byte[] data = readBytes(address, jbyteSize);
a61af66fc99e Initial load
duke
parents:
diff changeset
256 return utils.dataToJByte(data, jbyteSize);
a61af66fc99e Initial load
duke
parents:
diff changeset
257 }
a61af66fc99e Initial load
duke
parents:
diff changeset
258 }
a61af66fc99e Initial load
duke
parents:
diff changeset
259
a61af66fc99e Initial load
duke
parents:
diff changeset
260 // NOTE: assumes value does not span pages (may be bad assumption on
a61af66fc99e Initial load
duke
parents:
diff changeset
261 // Solaris/x86; see unalignedAccessesOkay in DbxDebugger hierarchy)
a61af66fc99e Initial load
duke
parents:
diff changeset
262 public char readJChar(long address)
a61af66fc99e Initial load
duke
parents:
diff changeset
263 throws UnmappedAddressException, UnalignedAddressException {
a61af66fc99e Initial load
duke
parents:
diff changeset
264 checkJavaConfigured();
a61af66fc99e Initial load
duke
parents:
diff changeset
265 utils.checkAlignment(address, jcharSize);
a61af66fc99e Initial load
duke
parents:
diff changeset
266 if (useFastAccessors) {
a61af66fc99e Initial load
duke
parents:
diff changeset
267 return cache.getChar(address, bigEndian);
a61af66fc99e Initial load
duke
parents:
diff changeset
268 } else {
a61af66fc99e Initial load
duke
parents:
diff changeset
269 byte[] data = readBytes(address, jcharSize);
a61af66fc99e Initial load
duke
parents:
diff changeset
270 return (char) utils.dataToJChar(data, jcharSize);
a61af66fc99e Initial load
duke
parents:
diff changeset
271 }
a61af66fc99e Initial load
duke
parents:
diff changeset
272 }
a61af66fc99e Initial load
duke
parents:
diff changeset
273
a61af66fc99e Initial load
duke
parents:
diff changeset
274 // NOTE: assumes value does not span pages (may be bad assumption on
a61af66fc99e Initial load
duke
parents:
diff changeset
275 // Solaris/x86; see unalignedAccessesOkay in DbxDebugger hierarchy)
a61af66fc99e Initial load
duke
parents:
diff changeset
276 public double readJDouble(long address)
a61af66fc99e Initial load
duke
parents:
diff changeset
277 throws UnmappedAddressException, UnalignedAddressException {
a61af66fc99e Initial load
duke
parents:
diff changeset
278 checkJavaConfigured();
a61af66fc99e Initial load
duke
parents:
diff changeset
279 utils.checkAlignment(address, jdoubleSize);
a61af66fc99e Initial load
duke
parents:
diff changeset
280 if (useFastAccessors) {
a61af66fc99e Initial load
duke
parents:
diff changeset
281 return cache.getDouble(address, bigEndian);
a61af66fc99e Initial load
duke
parents:
diff changeset
282 } else {
a61af66fc99e Initial load
duke
parents:
diff changeset
283 byte[] data = readBytes(address, jdoubleSize);
a61af66fc99e Initial load
duke
parents:
diff changeset
284 return utils.dataToJDouble(data, jdoubleSize);
a61af66fc99e Initial load
duke
parents:
diff changeset
285 }
a61af66fc99e Initial load
duke
parents:
diff changeset
286 }
a61af66fc99e Initial load
duke
parents:
diff changeset
287
a61af66fc99e Initial load
duke
parents:
diff changeset
288 // NOTE: assumes value does not span pages (may be bad assumption on
a61af66fc99e Initial load
duke
parents:
diff changeset
289 // Solaris/x86; see unalignedAccessesOkay in DbxDebugger hierarchy)
a61af66fc99e Initial load
duke
parents:
diff changeset
290 public float readJFloat(long address)
a61af66fc99e Initial load
duke
parents:
diff changeset
291 throws UnmappedAddressException, UnalignedAddressException {
a61af66fc99e Initial load
duke
parents:
diff changeset
292 checkJavaConfigured();
a61af66fc99e Initial load
duke
parents:
diff changeset
293 utils.checkAlignment(address, jfloatSize);
a61af66fc99e Initial load
duke
parents:
diff changeset
294 if (useFastAccessors) {
a61af66fc99e Initial load
duke
parents:
diff changeset
295 return cache.getFloat(address, bigEndian);
a61af66fc99e Initial load
duke
parents:
diff changeset
296 } else {
a61af66fc99e Initial load
duke
parents:
diff changeset
297 byte[] data = readBytes(address, jfloatSize);
a61af66fc99e Initial load
duke
parents:
diff changeset
298 return utils.dataToJFloat(data, jfloatSize);
a61af66fc99e Initial load
duke
parents:
diff changeset
299 }
a61af66fc99e Initial load
duke
parents:
diff changeset
300 }
a61af66fc99e Initial load
duke
parents:
diff changeset
301
a61af66fc99e Initial load
duke
parents:
diff changeset
302 // NOTE: assumes value does not span pages (may be bad assumption on
a61af66fc99e Initial load
duke
parents:
diff changeset
303 // Solaris/x86; see unalignedAccessesOkay in DbxDebugger hierarchy)
a61af66fc99e Initial load
duke
parents:
diff changeset
304 public int readJInt(long address)
a61af66fc99e Initial load
duke
parents:
diff changeset
305 throws UnmappedAddressException, UnalignedAddressException {
a61af66fc99e Initial load
duke
parents:
diff changeset
306 checkJavaConfigured();
a61af66fc99e Initial load
duke
parents:
diff changeset
307 utils.checkAlignment(address, jintSize);
a61af66fc99e Initial load
duke
parents:
diff changeset
308 if (useFastAccessors) {
a61af66fc99e Initial load
duke
parents:
diff changeset
309 return cache.getInt(address, bigEndian);
a61af66fc99e Initial load
duke
parents:
diff changeset
310 } else {
a61af66fc99e Initial load
duke
parents:
diff changeset
311 byte[] data = readBytes(address, jintSize);
a61af66fc99e Initial load
duke
parents:
diff changeset
312 return utils.dataToJInt(data, jintSize);
a61af66fc99e Initial load
duke
parents:
diff changeset
313 }
a61af66fc99e Initial load
duke
parents:
diff changeset
314 }
a61af66fc99e Initial load
duke
parents:
diff changeset
315
a61af66fc99e Initial load
duke
parents:
diff changeset
316 // NOTE: assumes value does not span pages (may be bad assumption on
a61af66fc99e Initial load
duke
parents:
diff changeset
317 // Solaris/x86; see unalignedAccessesOkay in DbxDebugger hierarchy)
a61af66fc99e Initial load
duke
parents:
diff changeset
318 public long readJLong(long address)
a61af66fc99e Initial load
duke
parents:
diff changeset
319 throws UnmappedAddressException, UnalignedAddressException {
a61af66fc99e Initial load
duke
parents:
diff changeset
320 checkJavaConfigured();
a61af66fc99e Initial load
duke
parents:
diff changeset
321 utils.checkAlignment(address, jlongSize);
a61af66fc99e Initial load
duke
parents:
diff changeset
322 if (useFastAccessors) {
a61af66fc99e Initial load
duke
parents:
diff changeset
323 return cache.getLong(address, bigEndian);
a61af66fc99e Initial load
duke
parents:
diff changeset
324 } else {
a61af66fc99e Initial load
duke
parents:
diff changeset
325 byte[] data = readBytes(address, jlongSize);
a61af66fc99e Initial load
duke
parents:
diff changeset
326 return utils.dataToJLong(data, jlongSize);
a61af66fc99e Initial load
duke
parents:
diff changeset
327 }
a61af66fc99e Initial load
duke
parents:
diff changeset
328 }
a61af66fc99e Initial load
duke
parents:
diff changeset
329
a61af66fc99e Initial load
duke
parents:
diff changeset
330 // NOTE: assumes value does not span pages (may be bad assumption on
a61af66fc99e Initial load
duke
parents:
diff changeset
331 // Solaris/x86; see unalignedAccessesOkay in DbxDebugger hierarchy)
a61af66fc99e Initial load
duke
parents:
diff changeset
332 public short readJShort(long address)
a61af66fc99e Initial load
duke
parents:
diff changeset
333 throws UnmappedAddressException, UnalignedAddressException {
a61af66fc99e Initial load
duke
parents:
diff changeset
334 checkJavaConfigured();
a61af66fc99e Initial load
duke
parents:
diff changeset
335 utils.checkAlignment(address, jshortSize);
a61af66fc99e Initial load
duke
parents:
diff changeset
336 if (useFastAccessors) {
a61af66fc99e Initial load
duke
parents:
diff changeset
337 return cache.getShort(address, bigEndian);
a61af66fc99e Initial load
duke
parents:
diff changeset
338 } else {
a61af66fc99e Initial load
duke
parents:
diff changeset
339 byte[] data = readBytes(address, jshortSize);
a61af66fc99e Initial load
duke
parents:
diff changeset
340 return utils.dataToJShort(data, jshortSize);
a61af66fc99e Initial load
duke
parents:
diff changeset
341 }
a61af66fc99e Initial load
duke
parents:
diff changeset
342 }
a61af66fc99e Initial load
duke
parents:
diff changeset
343
a61af66fc99e Initial load
duke
parents:
diff changeset
344 // NOTE: assumes value does not span pages (may be bad assumption on
a61af66fc99e Initial load
duke
parents:
diff changeset
345 // Solaris/x86; see unalignedAccessesOkay in DbxDebugger hierarchy)
a61af66fc99e Initial load
duke
parents:
diff changeset
346 public long readCInteger(long address, long numBytes, boolean isUnsigned)
a61af66fc99e Initial load
duke
parents:
diff changeset
347 throws UnmappedAddressException, UnalignedAddressException {
a61af66fc99e Initial load
duke
parents:
diff changeset
348 checkConfigured();
a61af66fc99e Initial load
duke
parents:
diff changeset
349 utils.checkAlignment(address, numBytes);
a61af66fc99e Initial load
duke
parents:
diff changeset
350 if (useFastAccessors) {
a61af66fc99e Initial load
duke
parents:
diff changeset
351 if (isUnsigned) {
a61af66fc99e Initial load
duke
parents:
diff changeset
352 switch((int) numBytes) {
a61af66fc99e Initial load
duke
parents:
diff changeset
353 case 1: return cache.getByte(address) & 0xFF;
a61af66fc99e Initial load
duke
parents:
diff changeset
354 case 2: return cache.getShort(address, bigEndian) & 0xFFFF;
a61af66fc99e Initial load
duke
parents:
diff changeset
355 case 4: return cache.getInt(address, bigEndian) & 0xFFFFFFFFL;
a61af66fc99e Initial load
duke
parents:
diff changeset
356 case 8: return cache.getLong(address, bigEndian);
a61af66fc99e Initial load
duke
parents:
diff changeset
357 default: {
a61af66fc99e Initial load
duke
parents:
diff changeset
358 byte[] data = readBytes(address, numBytes);
a61af66fc99e Initial load
duke
parents:
diff changeset
359 return utils.dataToCInteger(data, isUnsigned);
a61af66fc99e Initial load
duke
parents:
diff changeset
360 }
a61af66fc99e Initial load
duke
parents:
diff changeset
361 }
a61af66fc99e Initial load
duke
parents:
diff changeset
362 } else {
a61af66fc99e Initial load
duke
parents:
diff changeset
363 switch((int) numBytes) {
a61af66fc99e Initial load
duke
parents:
diff changeset
364 case 1: return cache.getByte(address);
a61af66fc99e Initial load
duke
parents:
diff changeset
365 case 2: return cache.getShort(address, bigEndian);
a61af66fc99e Initial load
duke
parents:
diff changeset
366 case 4: return cache.getInt(address, bigEndian);
a61af66fc99e Initial load
duke
parents:
diff changeset
367 case 8: return cache.getLong(address, bigEndian);
a61af66fc99e Initial load
duke
parents:
diff changeset
368 default: {
a61af66fc99e Initial load
duke
parents:
diff changeset
369 byte[] data = readBytes(address, numBytes);
a61af66fc99e Initial load
duke
parents:
diff changeset
370 return utils.dataToCInteger(data, isUnsigned);
a61af66fc99e Initial load
duke
parents:
diff changeset
371 }
a61af66fc99e Initial load
duke
parents:
diff changeset
372 }
a61af66fc99e Initial load
duke
parents:
diff changeset
373 }
a61af66fc99e Initial load
duke
parents:
diff changeset
374 } else {
a61af66fc99e Initial load
duke
parents:
diff changeset
375 byte[] data = readBytes(address, numBytes);
a61af66fc99e Initial load
duke
parents:
diff changeset
376 return utils.dataToCInteger(data, isUnsigned);
a61af66fc99e Initial load
duke
parents:
diff changeset
377 }
a61af66fc99e Initial load
duke
parents:
diff changeset
378 }
a61af66fc99e Initial load
duke
parents:
diff changeset
379
a61af66fc99e Initial load
duke
parents:
diff changeset
380 public void writeJBoolean(long address, boolean value)
a61af66fc99e Initial load
duke
parents:
diff changeset
381 throws UnmappedAddressException, UnalignedAddressException {
a61af66fc99e Initial load
duke
parents:
diff changeset
382 checkJavaConfigured();
a61af66fc99e Initial load
duke
parents:
diff changeset
383 utils.checkAlignment(address, jbooleanSize);
a61af66fc99e Initial load
duke
parents:
diff changeset
384 byte[] data = utils.jbooleanToData(value);
a61af66fc99e Initial load
duke
parents:
diff changeset
385 writeBytes(address, jbooleanSize, data);
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 writeJByte(long address, byte 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, jbyteSize);
a61af66fc99e Initial load
duke
parents:
diff changeset
392 byte[] data = utils.jbyteToData(value);
a61af66fc99e Initial load
duke
parents:
diff changeset
393 writeBytes(address, jbyteSize, 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 writeJChar(long address, char 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, jcharSize);
a61af66fc99e Initial load
duke
parents:
diff changeset
400 byte[] data = utils.jcharToData(value);
a61af66fc99e Initial load
duke
parents:
diff changeset
401 writeBytes(address, jcharSize, 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 writeJDouble(long address, double 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, jdoubleSize);
a61af66fc99e Initial load
duke
parents:
diff changeset
408 byte[] data = utils.jdoubleToData(value);
a61af66fc99e Initial load
duke
parents:
diff changeset
409 writeBytes(address, jdoubleSize, 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 writeJFloat(long address, float 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, jfloatSize);
a61af66fc99e Initial load
duke
parents:
diff changeset
416 byte[] data = utils.jfloatToData(value);
a61af66fc99e Initial load
duke
parents:
diff changeset
417 writeBytes(address, jfloatSize, 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 writeJInt(long address, int 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, jintSize);
a61af66fc99e Initial load
duke
parents:
diff changeset
424 byte[] data = utils.jintToData(value);
a61af66fc99e Initial load
duke
parents:
diff changeset
425 writeBytes(address, jintSize, 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 writeJLong(long address, long 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, jlongSize);
a61af66fc99e Initial load
duke
parents:
diff changeset
432 byte[] data = utils.jlongToData(value);
a61af66fc99e Initial load
duke
parents:
diff changeset
433 writeBytes(address, jlongSize, 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 writeJShort(long address, short 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, jshortSize);
a61af66fc99e Initial load
duke
parents:
diff changeset
440 byte[] data = utils.jshortToData(value);
a61af66fc99e Initial load
duke
parents:
diff changeset
441 writeBytes(address, jshortSize, 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 writeCInteger(long address, long numBytes, long value)
a61af66fc99e Initial load
duke
parents:
diff changeset
445 throws UnmappedAddressException, UnalignedAddressException {
a61af66fc99e Initial load
duke
parents:
diff changeset
446 checkConfigured();
a61af66fc99e Initial load
duke
parents:
diff changeset
447 utils.checkAlignment(address, numBytes);
a61af66fc99e Initial load
duke
parents:
diff changeset
448 byte[] data = utils.cIntegerToData(numBytes, value);
a61af66fc99e Initial load
duke
parents:
diff changeset
449 writeBytes(address, numBytes, 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 protected long readAddressValue(long address)
a61af66fc99e Initial load
duke
parents:
diff changeset
453 throws UnmappedAddressException, UnalignedAddressException {
a61af66fc99e Initial load
duke
parents:
diff changeset
454 return readCInteger(address, machDesc.getAddressSize(), true);
a61af66fc99e Initial load
duke
parents:
diff changeset
455 }
a61af66fc99e Initial load
duke
parents:
diff changeset
456
113
ba764ed4b6f2 6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents: 0
diff changeset
457 protected long readCompOopAddressValue(long address)
ba764ed4b6f2 6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents: 0
diff changeset
458 throws UnmappedAddressException, UnalignedAddressException {
ba764ed4b6f2 6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents: 0
diff changeset
459 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
460 if (value != 0) {
ba764ed4b6f2 6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents: 0
diff changeset
461 // See oop.inline.hpp decode_heap_oop
ba764ed4b6f2 6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents: 0
diff changeset
462 value = (long)(heapBase + (long)(value << logMinObjAlignmentInBytes));
ba764ed4b6f2 6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents: 0
diff changeset
463 }
ba764ed4b6f2 6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents: 0
diff changeset
464 return value;
ba764ed4b6f2 6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents: 0
diff changeset
465 }
ba764ed4b6f2 6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents: 0
diff changeset
466
0
a61af66fc99e Initial load
duke
parents:
diff changeset
467 protected void writeAddressValue(long address, long value)
a61af66fc99e Initial load
duke
parents:
diff changeset
468 throws UnmappedAddressException, UnalignedAddressException {
a61af66fc99e Initial load
duke
parents:
diff changeset
469 writeCInteger(address, machDesc.getAddressSize(), value);
a61af66fc99e Initial load
duke
parents:
diff changeset
470 }
a61af66fc99e Initial load
duke
parents:
diff changeset
471
a61af66fc99e Initial load
duke
parents:
diff changeset
472 /** Can be called by subclasses but can not be overridden */
a61af66fc99e Initial load
duke
parents:
diff changeset
473 protected final void checkConfigured() {
a61af66fc99e Initial load
duke
parents:
diff changeset
474 if (machDesc == null) {
a61af66fc99e Initial load
duke
parents:
diff changeset
475 throw new RuntimeException("MachineDescription must have been set by this point");
a61af66fc99e Initial load
duke
parents:
diff changeset
476 }
a61af66fc99e Initial load
duke
parents:
diff changeset
477 if (utils == null) {
a61af66fc99e Initial load
duke
parents:
diff changeset
478 throw new RuntimeException("DebuggerUtilities must have been set by this point");
a61af66fc99e Initial load
duke
parents:
diff changeset
479 }
a61af66fc99e Initial load
duke
parents:
diff changeset
480 }
a61af66fc99e Initial load
duke
parents:
diff changeset
481
a61af66fc99e Initial load
duke
parents:
diff changeset
482 /** Can be called by subclasses but can not be overridden */
a61af66fc99e Initial load
duke
parents:
diff changeset
483 protected final void checkJavaConfigured() {
a61af66fc99e Initial load
duke
parents:
diff changeset
484 checkConfigured();
a61af66fc99e Initial load
duke
parents:
diff changeset
485
a61af66fc99e Initial load
duke
parents:
diff changeset
486 if (!javaPrimitiveTypesConfigured) {
a61af66fc99e Initial load
duke
parents:
diff changeset
487 throw new RuntimeException("Java primitive type sizes have not yet been configured");
a61af66fc99e Initial load
duke
parents:
diff changeset
488 }
a61af66fc99e Initial load
duke
parents:
diff changeset
489 }
a61af66fc99e Initial load
duke
parents:
diff changeset
490
a61af66fc99e Initial load
duke
parents:
diff changeset
491 /** Possibly override page cache size with user-specified property */
a61af66fc99e Initial load
duke
parents:
diff changeset
492 protected int parseCacheNumPagesProperty(int defaultNum) {
a61af66fc99e Initial load
duke
parents:
diff changeset
493 String cacheNumPagesString = System.getProperty("cacheNumPages");
a61af66fc99e Initial load
duke
parents:
diff changeset
494 if (cacheNumPagesString != null) {
a61af66fc99e Initial load
duke
parents:
diff changeset
495 try {
a61af66fc99e Initial load
duke
parents:
diff changeset
496 return Integer.parseInt(cacheNumPagesString);
a61af66fc99e Initial load
duke
parents:
diff changeset
497 } catch (Exception e) {
a61af66fc99e Initial load
duke
parents:
diff changeset
498 System.err.println("Error parsing cacheNumPages property:");
a61af66fc99e Initial load
duke
parents:
diff changeset
499 e.printStackTrace();
a61af66fc99e Initial load
duke
parents:
diff changeset
500 }
a61af66fc99e Initial load
duke
parents:
diff changeset
501 }
a61af66fc99e Initial load
duke
parents:
diff changeset
502 return defaultNum;
a61af66fc99e Initial load
duke
parents:
diff changeset
503 }
a61af66fc99e Initial load
duke
parents:
diff changeset
504
a61af66fc99e Initial load
duke
parents:
diff changeset
505 /** Interim solution for allowing subclasses to write bytes to
a61af66fc99e Initial load
duke
parents:
diff changeset
506 process until we make that functionality available in the basic
a61af66fc99e Initial load
duke
parents:
diff changeset
507 Address interface */
a61af66fc99e Initial load
duke
parents:
diff changeset
508 protected void invalidatePageCache(long startAddress, long numBytes) {
a61af66fc99e Initial load
duke
parents:
diff changeset
509 cache.clear(startAddress, numBytes);
a61af66fc99e Initial load
duke
parents:
diff changeset
510 }
a61af66fc99e Initial load
duke
parents:
diff changeset
511
a61af66fc99e Initial load
duke
parents:
diff changeset
512 public long getJBooleanSize() {
a61af66fc99e Initial load
duke
parents:
diff changeset
513 return jbooleanSize;
a61af66fc99e Initial load
duke
parents:
diff changeset
514 }
a61af66fc99e Initial load
duke
parents:
diff changeset
515
a61af66fc99e Initial load
duke
parents:
diff changeset
516 public long getJByteSize() {
a61af66fc99e Initial load
duke
parents:
diff changeset
517 return jbyteSize;
a61af66fc99e Initial load
duke
parents:
diff changeset
518 }
a61af66fc99e Initial load
duke
parents:
diff changeset
519
a61af66fc99e Initial load
duke
parents:
diff changeset
520 public long getJCharSize() {
a61af66fc99e Initial load
duke
parents:
diff changeset
521 return jcharSize;
a61af66fc99e Initial load
duke
parents:
diff changeset
522 }
a61af66fc99e Initial load
duke
parents:
diff changeset
523
a61af66fc99e Initial load
duke
parents:
diff changeset
524 public long getJDoubleSize() {
a61af66fc99e Initial load
duke
parents:
diff changeset
525 return jdoubleSize;
a61af66fc99e Initial load
duke
parents:
diff changeset
526 }
a61af66fc99e Initial load
duke
parents:
diff changeset
527
a61af66fc99e Initial load
duke
parents:
diff changeset
528 public long getJFloatSize() {
a61af66fc99e Initial load
duke
parents:
diff changeset
529 return jfloatSize;
a61af66fc99e Initial load
duke
parents:
diff changeset
530 }
a61af66fc99e Initial load
duke
parents:
diff changeset
531
a61af66fc99e Initial load
duke
parents:
diff changeset
532 public long getJIntSize() {
a61af66fc99e Initial load
duke
parents:
diff changeset
533 return jintSize;
a61af66fc99e Initial load
duke
parents:
diff changeset
534 }
a61af66fc99e Initial load
duke
parents:
diff changeset
535
a61af66fc99e Initial load
duke
parents:
diff changeset
536 public long getJLongSize() {
a61af66fc99e Initial load
duke
parents:
diff changeset
537 return jlongSize;
a61af66fc99e Initial load
duke
parents:
diff changeset
538 }
a61af66fc99e Initial load
duke
parents:
diff changeset
539
a61af66fc99e Initial load
duke
parents:
diff changeset
540 public long getJShortSize() {
a61af66fc99e Initial load
duke
parents:
diff changeset
541 return jshortSize;
a61af66fc99e Initial load
duke
parents:
diff changeset
542 }
113
ba764ed4b6f2 6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents: 0
diff changeset
543
ba764ed4b6f2 6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents: 0
diff changeset
544 public long getHeapOopSize() {
ba764ed4b6f2 6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents: 0
diff changeset
545 return heapOopSize;
ba764ed4b6f2 6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents: 0
diff changeset
546 }
ba764ed4b6f2 6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents: 0
diff changeset
547
ba764ed4b6f2 6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents: 0
diff changeset
548 public long getHeapBase() {
ba764ed4b6f2 6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents: 0
diff changeset
549 return heapBase;
ba764ed4b6f2 6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents: 0
diff changeset
550 }
ba764ed4b6f2 6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents: 0
diff changeset
551 public long getLogMinObjAlignmentInBytes() {
ba764ed4b6f2 6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents: 0
diff changeset
552 return logMinObjAlignmentInBytes;
ba764ed4b6f2 6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents: 0
diff changeset
553 }
0
a61af66fc99e Initial load
duke
parents:
diff changeset
554 }