34 35 /** ScopeDescs contain the information that makes source-level 36 debugging of nmethods possible; each scopeDesc describes a method 37 activation */ 38 39 public class ScopeDesc { 40 /** NMethod information */ 41 private NMethod code; 42 private Method method; 43 private int bci; 44 private boolean reexecute; 45 /** Decoding offsets */ 46 private int decodeOffset; 47 private int senderDecodeOffset; 48 private int localsDecodeOffset; 49 private int expressionsDecodeOffset; 50 private int monitorsDecodeOffset; 51 /** Scalar replaced bjects pool */ 52 private List objects; // ArrayList<ScopeValue> 53 54 55 public ScopeDesc(NMethod code, int decodeOffset, boolean reexecute) { 56 this.code = code; 57 this.decodeOffset = decodeOffset; 58 this.objects = decodeObjectValues(DebugInformationRecorder.SERIALIZED_NULL); 59 this.reexecute = reexecute; 60 61 // Decode header 62 DebugInfoReadStream stream = streamAt(decodeOffset); 63 64 senderDecodeOffset = stream.readInt(); 65 method = (Method) VM.getVM().getObjectHeap().newOop(stream.readOopHandle()); 66 bci = stream.readBCI(); 67 // Decode offsets for body and sender 68 localsDecodeOffset = stream.readInt(); 69 expressionsDecodeOffset = stream.readInt(); 70 monitorsDecodeOffset = stream.readInt(); 71 } 72 73 public ScopeDesc(NMethod code, int decodeOffset, int objectDecodeOffset, boolean reexecute) { 74 this.code = code; 75 this.decodeOffset = decodeOffset; 76 this.objects = decodeObjectValues(objectDecodeOffset); 77 this.reexecute = reexecute; 78 91 public NMethod getNMethod() { return code; } 92 public Method getMethod() { return method; } 93 public int getBCI() { return bci; } 94 public boolean getReexecute() { return reexecute;} 95 96 /** Returns a List<ScopeValue> */ 97 public List getLocals() { 98 return decodeScopeValues(localsDecodeOffset); 99 } 100 101 /** Returns a List<ScopeValue> */ 102 public List getExpressions() { 103 return decodeScopeValues(expressionsDecodeOffset); 104 } 105 106 /** Returns a List<MonitorValue> */ 107 public List getMonitors() { 108 return decodeMonitorValues(monitorsDecodeOffset); 109 } 110 111 /** Returns a List<MonitorValue> */ 112 public List getObjects() { 113 return objects; 114 } 115 116 /** Stack walking. Returns null if this is the outermost scope. */ 117 public ScopeDesc sender() { 118 if (isTop()) { 119 return null; 120 } 121 122 return new ScopeDesc(code, senderDecodeOffset, false); 123 } 124 125 /** Returns where the scope was decoded */ 126 public int getDecodeOffset() { 127 return decodeOffset; 128 } 129 130 /** Tells whether sender() returns null */ 131 public boolean isTop() { 132 return (senderDecodeOffset == DebugInformationRecorder.SERIALIZED_NULL); 133 } 134 135 public boolean equals(Object arg) { 136 if (arg == null) { 137 return false; 138 } 139 140 if (!(arg instanceof ScopeDesc)) { 141 return false; 142 } | 34 35 /** ScopeDescs contain the information that makes source-level 36 debugging of nmethods possible; each scopeDesc describes a method 37 activation */ 38 39 public class ScopeDesc { 40 /** NMethod information */ 41 private NMethod code; 42 private Method method; 43 private int bci; 44 private boolean reexecute; 45 /** Decoding offsets */ 46 private int decodeOffset; 47 private int senderDecodeOffset; 48 private int localsDecodeOffset; 49 private int expressionsDecodeOffset; 50 private int monitorsDecodeOffset; 51 /** Scalar replaced bjects pool */ 52 private List objects; // ArrayList<ScopeValue> 53 54 private ScopeDesc(NMethod code, int decodeOffset, List objects, boolean reexecute) { 55 this.code = code; 56 this.decodeOffset = decodeOffset; 57 this.objects = objects; 58 this.reexecute = reexecute; 59 60 // Decode header 61 DebugInfoReadStream stream = streamAt(decodeOffset); 62 63 senderDecodeOffset = stream.readInt(); 64 method = (Method) VM.getVM().getObjectHeap().newOop(stream.readOopHandle()); 65 bci = stream.readBCI(); 66 // Decode offsets for body and sender 67 localsDecodeOffset = stream.readInt(); 68 expressionsDecodeOffset = stream.readInt(); 69 monitorsDecodeOffset = stream.readInt(); 70 } 71 72 public ScopeDesc(NMethod code, int decodeOffset, int objectDecodeOffset, boolean reexecute) { 73 this.code = code; 74 this.decodeOffset = decodeOffset; 75 this.objects = decodeObjectValues(objectDecodeOffset); 76 this.reexecute = reexecute; 77 90 public NMethod getNMethod() { return code; } 91 public Method getMethod() { return method; } 92 public int getBCI() { return bci; } 93 public boolean getReexecute() { return reexecute;} 94 95 /** Returns a List<ScopeValue> */ 96 public List getLocals() { 97 return decodeScopeValues(localsDecodeOffset); 98 } 99 100 /** Returns a List<ScopeValue> */ 101 public List getExpressions() { 102 return decodeScopeValues(expressionsDecodeOffset); 103 } 104 105 /** Returns a List<MonitorValue> */ 106 public List getMonitors() { 107 return decodeMonitorValues(monitorsDecodeOffset); 108 } 109 110 /** Returns a List<ObjectValue> */ 111 public List getObjects() { 112 return objects; 113 } 114 115 /** Stack walking. Returns null if this is the outermost scope. */ 116 public ScopeDesc sender() { 117 if (isTop()) { 118 return null; 119 } 120 121 return new ScopeDesc(code, senderDecodeOffset, objects, false); 122 } 123 124 /** Returns where the scope was decoded */ 125 public int getDecodeOffset() { 126 return decodeOffset; 127 } 128 129 /** Tells whether sender() returns null */ 130 public boolean isTop() { 131 return (senderDecodeOffset == DebugInformationRecorder.SERIALIZED_NULL); 132 } 133 134 public boolean equals(Object arg) { 135 if (arg == null) { 136 return false; 137 } 138 139 if (!(arg instanceof ScopeDesc)) { 140 return false; 141 } |