90 /** Flags indicating whether we are attached to a core, C1, or C2 build */
91 private boolean usingClientCompiler;
92 private boolean usingServerCompiler;
93 /** alignment constants */
94 private boolean isLP64;
95 private int bytesPerLong;
96 private int bytesPerWord;
97 private int objectAlignmentInBytes;
98 private int minObjAlignmentInBytes;
99 private int logMinObjAlignmentInBytes;
100 private int heapWordSize;
101 private int heapOopSize;
102 private int klassPtrSize;
103 private int oopSize;
104 /** This is only present in a non-core build */
105 private CodeCache codeCache;
106 /** This is only present in a C1 build */
107 private Runtime1 runtime1;
108 /** These constants come from globalDefinitions.hpp */
109 private int invocationEntryBCI;
110 private int invalidOSREntryBCI;
111 private ReversePtrs revPtrs;
112 private VMRegImpl vmregImpl;
113 private int reserveForAllocationPrefetch;
114
115 // System.getProperties from debuggee VM
116 private Properties sysProps;
117
118 // VM version strings come from Abstract_VM_Version class
119 private String vmRelease;
120 private String vmInternalInfo;
121
122 private Flag[] commandLineFlags;
123 private Map flagsMap;
124
125 private static Type intxType;
126 private static Type uintxType;
127 private static CIntegerType boolType;
128 private Boolean sharingEnabled;
129 private Boolean compressedOopsEnabled;
130 private Boolean compressedKlassPointersEnabled;
278
279 // read VM version info
280 try {
281 Type vmVersion = db.lookupType("Abstract_VM_Version");
282 Address releaseAddr = vmVersion.getAddressField("_s_vm_release").getValue();
283 vmRelease = CStringUtilities.getString(releaseAddr);
284 Address vmInternalInfoAddr = vmVersion.getAddressField("_s_internal_vm_info_string").getValue();
285 vmInternalInfo = CStringUtilities.getString(vmInternalInfoAddr);
286
287 CIntegerType intType = (CIntegerType) db.lookupType("int");
288 CIntegerField reserveForAllocationPrefetchField = vmVersion.getCIntegerField("_reserve_for_allocation_prefetch");
289 reserveForAllocationPrefetch = (int)reserveForAllocationPrefetchField.getCInteger(intType);
290 } catch (Exception exp) {
291 throw new RuntimeException("can't determine target's VM version : " + exp.getMessage());
292 }
293
294 checkVMVersion(vmRelease);
295
296 stackBias = db.lookupIntConstant("STACK_BIAS").intValue();
297 invocationEntryBCI = db.lookupIntConstant("InvocationEntryBci").intValue();
298 invalidOSREntryBCI = db.lookupIntConstant("InvalidOSREntryBci").intValue();
299
300 // We infer the presence of C1 or C2 from a couple of fields we
301 // already have present in the type database
302 {
303 Type type = db.lookupType("Method");
304 if (type.getField("_from_compiled_entry", false, false) == null) {
305 // Neither C1 nor C2 is present
306 usingClientCompiler = false;
307 usingServerCompiler = false;
308 } else {
309 // Determine whether C2 is present
310 if (db.lookupType("Matcher", false) != null) {
311 usingServerCompiler = true;
312 } else {
313 usingClientCompiler = true;
314 }
315 }
316 }
317
318 if (debugger != null) {
714 if (debugger == null) {
715 throw new RuntimeException("Attempt to use debugger in runtime system");
716 }
717 return debugger;
718 }
719
720 /** Indicates whether a given program counter is in Java code. This
721 includes but is not spanned by the interpreter and code cache.
722 Only used in the debugging system, for implementing
723 JavaThread.currentFrameGuess() on x86. */
724 public boolean isJavaPCDbg(Address addr) {
725 // FIXME: this is not a complete enough set: must include areas
726 // like vtable stubs
727 return (getInterpreter().contains(addr) ||
728 getCodeCache().contains(addr));
729 }
730
731 /** FIXME: figure out where to stick this */
732 public int getInvocationEntryBCI() {
733 return invocationEntryBCI;
734 }
735
736 /** FIXME: figure out where to stick this */
737 public int getInvalidOSREntryBCI() {
738 return invalidOSREntryBCI;
739 }
740
741 // FIXME: figure out where to stick this
742 public boolean wizardMode() {
743 return true;
744 }
745
746 public ReversePtrs getRevPtrs() {
747 return revPtrs;
748 }
749
750 public void setRevPtrs(ReversePtrs rp) {
751 revPtrs = rp;
752 }
753
754 // returns null, if not available.
755 public String getVMRelease() {
756 return vmRelease;
757 }
758
|
90 /** Flags indicating whether we are attached to a core, C1, or C2 build */
91 private boolean usingClientCompiler;
92 private boolean usingServerCompiler;
93 /** alignment constants */
94 private boolean isLP64;
95 private int bytesPerLong;
96 private int bytesPerWord;
97 private int objectAlignmentInBytes;
98 private int minObjAlignmentInBytes;
99 private int logMinObjAlignmentInBytes;
100 private int heapWordSize;
101 private int heapOopSize;
102 private int klassPtrSize;
103 private int oopSize;
104 /** This is only present in a non-core build */
105 private CodeCache codeCache;
106 /** This is only present in a C1 build */
107 private Runtime1 runtime1;
108 /** These constants come from globalDefinitions.hpp */
109 private int invocationEntryBCI;
110 private ReversePtrs revPtrs;
111 private VMRegImpl vmregImpl;
112 private int reserveForAllocationPrefetch;
113
114 // System.getProperties from debuggee VM
115 private Properties sysProps;
116
117 // VM version strings come from Abstract_VM_Version class
118 private String vmRelease;
119 private String vmInternalInfo;
120
121 private Flag[] commandLineFlags;
122 private Map flagsMap;
123
124 private static Type intxType;
125 private static Type uintxType;
126 private static CIntegerType boolType;
127 private Boolean sharingEnabled;
128 private Boolean compressedOopsEnabled;
129 private Boolean compressedKlassPointersEnabled;
277
278 // read VM version info
279 try {
280 Type vmVersion = db.lookupType("Abstract_VM_Version");
281 Address releaseAddr = vmVersion.getAddressField("_s_vm_release").getValue();
282 vmRelease = CStringUtilities.getString(releaseAddr);
283 Address vmInternalInfoAddr = vmVersion.getAddressField("_s_internal_vm_info_string").getValue();
284 vmInternalInfo = CStringUtilities.getString(vmInternalInfoAddr);
285
286 CIntegerType intType = (CIntegerType) db.lookupType("int");
287 CIntegerField reserveForAllocationPrefetchField = vmVersion.getCIntegerField("_reserve_for_allocation_prefetch");
288 reserveForAllocationPrefetch = (int)reserveForAllocationPrefetchField.getCInteger(intType);
289 } catch (Exception exp) {
290 throw new RuntimeException("can't determine target's VM version : " + exp.getMessage());
291 }
292
293 checkVMVersion(vmRelease);
294
295 stackBias = db.lookupIntConstant("STACK_BIAS").intValue();
296 invocationEntryBCI = db.lookupIntConstant("InvocationEntryBci").intValue();
297
298 // We infer the presence of C1 or C2 from a couple of fields we
299 // already have present in the type database
300 {
301 Type type = db.lookupType("Method");
302 if (type.getField("_from_compiled_entry", false, false) == null) {
303 // Neither C1 nor C2 is present
304 usingClientCompiler = false;
305 usingServerCompiler = false;
306 } else {
307 // Determine whether C2 is present
308 if (db.lookupType("Matcher", false) != null) {
309 usingServerCompiler = true;
310 } else {
311 usingClientCompiler = true;
312 }
313 }
314 }
315
316 if (debugger != null) {
712 if (debugger == null) {
713 throw new RuntimeException("Attempt to use debugger in runtime system");
714 }
715 return debugger;
716 }
717
718 /** Indicates whether a given program counter is in Java code. This
719 includes but is not spanned by the interpreter and code cache.
720 Only used in the debugging system, for implementing
721 JavaThread.currentFrameGuess() on x86. */
722 public boolean isJavaPCDbg(Address addr) {
723 // FIXME: this is not a complete enough set: must include areas
724 // like vtable stubs
725 return (getInterpreter().contains(addr) ||
726 getCodeCache().contains(addr));
727 }
728
729 /** FIXME: figure out where to stick this */
730 public int getInvocationEntryBCI() {
731 return invocationEntryBCI;
732 }
733
734 // FIXME: figure out where to stick this
735 public boolean wizardMode() {
736 return true;
737 }
738
739 public ReversePtrs getRevPtrs() {
740 return revPtrs;
741 }
742
743 public void setRevPtrs(ReversePtrs rp) {
744 revPtrs = rp;
745 }
746
747 // returns null, if not available.
748 public String getVMRelease() {
749 return vmRelease;
750 }
751
|