comparison agent/src/share/classes/sun/jvm/hotspot/debugger/DebuggerBase.java @ 113:ba764ed4b6f2

6420645: Create a vm that uses compressed oops for up to 32gb heapsizes Summary: Compressed oops in instances, arrays, and headers. Code contributors are coleenp, phh, never, swamyv Reviewed-by: jmasa, kamg, acorn, tbell, kvn, rasbold
author coleenp
date Sun, 13 Apr 2008 17:43:42 -0400
parents a61af66fc99e
children d1605aabd0a1
comparison
equal deleted inserted replaced
110:a49a647afe9a 113:ba764ed4b6f2
35 <P> NOTE that much of the code sharing is achieved by having this 35 <P> NOTE that much of the code sharing is achieved by having this
36 class implement many of the methods in the Win32Debugger and 36 class implement many of the methods in the Win32Debugger and
37 DbxDebugger interfaces. </P> */ 37 DbxDebugger interfaces. </P> */
38 38
39 public abstract class DebuggerBase implements Debugger { 39 public abstract class DebuggerBase implements Debugger {
40
40 // May be set lazily, but must be set before calling any of the read 41 // May be set lazily, but must be set before calling any of the read
41 // routines below 42 // routines below
42 protected MachineDescription machDesc; 43 protected MachineDescription machDesc;
43 protected DebuggerUtilities utils; 44 protected DebuggerUtilities utils;
44 // Java primitive type sizes, set during bootstrapping. Do not call 45 // Java primitive type sizes, set during bootstrapping. Do not call
50 protected long jfloatSize; 51 protected long jfloatSize;
51 protected long jintSize; 52 protected long jintSize;
52 protected long jlongSize; 53 protected long jlongSize;
53 protected long jshortSize; 54 protected long jshortSize;
54 protected boolean javaPrimitiveTypesConfigured; 55 protected boolean javaPrimitiveTypesConfigured;
56 // heap data.
57 protected long oopSize;
58 protected long heapOopSize;
59 protected long heapBase; // heap base for compressed oops.
60 protected long logMinObjAlignmentInBytes; // Used to decode compressed oops.
55 // Should be initialized if desired by calling initCache() 61 // Should be initialized if desired by calling initCache()
56 private PageCache cache; 62 private PageCache cache;
57 63
58 // State for faster accessors that don't allocate memory on each read 64 // State for faster accessors that don't allocate memory on each read
59 private boolean useFastAccessors; 65 private boolean useFastAccessors;
149 (jintSize == 4) && 155 (jintSize == 4) &&
150 (jlongSize == 8) && 156 (jlongSize == 8) &&
151 (jshortSize == 2)); 157 (jshortSize == 2));
152 158
153 javaPrimitiveTypesConfigured = true; 159 javaPrimitiveTypesConfigured = true;
160 }
161
162 public void putHeapConst(long heapBase, long heapOopSize, long logMinObjAlignmentInBytes) {
163 this.heapBase = heapBase;
164 this.heapOopSize = heapOopSize;
165 this.logMinObjAlignmentInBytes = logMinObjAlignmentInBytes;
154 } 166 }
155 167
156 /** May be called by subclasses if desired to initialize the page 168 /** May be called by subclasses if desired to initialize the page
157 cache but may not be overridden */ 169 cache but may not be overridden */
158 protected final void initCache(long pageSize, long maxNumPages) { 170 protected final void initCache(long pageSize, long maxNumPages) {
440 protected long readAddressValue(long address) 452 protected long readAddressValue(long address)
441 throws UnmappedAddressException, UnalignedAddressException { 453 throws UnmappedAddressException, UnalignedAddressException {
442 return readCInteger(address, machDesc.getAddressSize(), true); 454 return readCInteger(address, machDesc.getAddressSize(), true);
443 } 455 }
444 456
457 protected long readCompOopAddressValue(long address)
458 throws UnmappedAddressException, UnalignedAddressException {
459 long value = readCInteger(address, getHeapOopSize(), true);
460 if (value != 0) {
461 // See oop.inline.hpp decode_heap_oop
462 value = (long)(heapBase + (long)(value << logMinObjAlignmentInBytes));
463 }
464 return value;
465 }
466
445 protected void writeAddressValue(long address, long value) 467 protected void writeAddressValue(long address, long value)
446 throws UnmappedAddressException, UnalignedAddressException { 468 throws UnmappedAddressException, UnalignedAddressException {
447 writeCInteger(address, machDesc.getAddressSize(), value); 469 writeCInteger(address, machDesc.getAddressSize(), value);
448 } 470 }
449 471
516 } 538 }
517 539
518 public long getJShortSize() { 540 public long getJShortSize() {
519 return jshortSize; 541 return jshortSize;
520 } 542 }
543
544 public long getHeapOopSize() {
545 return heapOopSize;
546 }
547
548 public long getHeapBase() {
549 return heapBase;
550 }
551 public long getLogMinObjAlignmentInBytes() {
552 return logMinObjAlignmentInBytes;
553 }
521 } 554 }