comparison agent/src/share/classes/sun/jvm/hotspot/code/ScopeDesc.java @ 818:b109e761e927

6837472: com/sun/jdi/MonitorFrameInfo.java fails with AggressiveOpts in 6u14 Summary: Disable escape analysis when jvmti/debugger is used. Add support for EA ibto SA. Reviewed-by: never
author kvn
date Tue, 09 Jun 2009 16:19:10 -0700
parents a61af66fc99e
children bd02caa94611 9987d9d5eb0e
comparison
equal deleted inserted replaced
793:eacd97c88873 818:b109e761e927
25 package sun.jvm.hotspot.code; 25 package sun.jvm.hotspot.code;
26 26
27 import java.io.*; 27 import java.io.*;
28 import java.util.*; 28 import java.util.*;
29 29
30 import sun.jvm.hotspot.debugger.*;
30 import sun.jvm.hotspot.oops.*; 31 import sun.jvm.hotspot.oops.*;
31 import sun.jvm.hotspot.runtime.*; 32 import sun.jvm.hotspot.runtime.*;
33 import sun.jvm.hotspot.utilities.*;
32 34
33 /** ScopeDescs contain the information that makes source-level 35 /** ScopeDescs contain the information that makes source-level
34 debugging of nmethods possible; each scopeDesc describes a method 36 debugging of nmethods possible; each scopeDesc describes a method
35 activation */ 37 activation */
36 38
43 private int decodeOffset; 45 private int decodeOffset;
44 private int senderDecodeOffset; 46 private int senderDecodeOffset;
45 private int localsDecodeOffset; 47 private int localsDecodeOffset;
46 private int expressionsDecodeOffset; 48 private int expressionsDecodeOffset;
47 private int monitorsDecodeOffset; 49 private int monitorsDecodeOffset;
50 /** Scalar replaced bjects pool */
51 private List objects; // ArrayList<ScopeValue>
52
48 53
49 public ScopeDesc(NMethod code, int decodeOffset) { 54 public ScopeDesc(NMethod code, int decodeOffset) {
50 this.code = code; 55 this.code = code;
51 this.decodeOffset = decodeOffset; 56 this.decodeOffset = decodeOffset;
57 this.objects = decodeObjectValues(DebugInformationRecorder.SERIALIZED_NULL);
52 58
53 // Decode header 59 // Decode header
54 DebugInfoReadStream stream = streamAt(decodeOffset); 60 DebugInfoReadStream stream = streamAt(decodeOffset);
55 61
56 senderDecodeOffset = stream.readInt(); 62 senderDecodeOffset = stream.readInt();
60 localsDecodeOffset = stream.readInt(); 66 localsDecodeOffset = stream.readInt();
61 expressionsDecodeOffset = stream.readInt(); 67 expressionsDecodeOffset = stream.readInt();
62 monitorsDecodeOffset = stream.readInt(); 68 monitorsDecodeOffset = stream.readInt();
63 } 69 }
64 70
71 public ScopeDesc(NMethod code, int decodeOffset, int objectDecodeOffset) {
72 this.code = code;
73 this.decodeOffset = decodeOffset;
74 this.objects = decodeObjectValues(objectDecodeOffset);
75
76 // Decode header
77 DebugInfoReadStream stream = streamAt(decodeOffset);
78
79 senderDecodeOffset = stream.readInt();
80 method = (Method) VM.getVM().getObjectHeap().newOop(stream.readOopHandle());
81 bci = stream.readBCI();
82 // Decode offsets for body and sender
83 localsDecodeOffset = stream.readInt();
84 expressionsDecodeOffset = stream.readInt();
85 monitorsDecodeOffset = stream.readInt();
86 }
87
65 public NMethod getNMethod() { return code; } 88 public NMethod getNMethod() { return code; }
66 public Method getMethod() { return method; } 89 public Method getMethod() { return method; }
67 public int getBCI() { return bci; } 90 public int getBCI() { return bci; }
68 91
69 /** Returns a List&lt;ScopeValue&gt; */ 92 /** Returns a List&lt;ScopeValue&gt; */
77 } 100 }
78 101
79 /** Returns a List&lt;MonitorValue&gt; */ 102 /** Returns a List&lt;MonitorValue&gt; */
80 public List getMonitors() { 103 public List getMonitors() {
81 return decodeMonitorValues(monitorsDecodeOffset); 104 return decodeMonitorValues(monitorsDecodeOffset);
105 }
106
107 /** Returns a List&lt;MonitorValue&gt; */
108 public List getObjects() {
109 return objects;
82 } 110 }
83 111
84 /** Stack walking. Returns null if this is the outermost scope. */ 112 /** Stack walking. Returns null if this is the outermost scope. */
85 public ScopeDesc sender() { 113 public ScopeDesc sender() {
86 if (isTop()) { 114 if (isTop()) {
129 //-------------------------------------------------------------------------------- 157 //--------------------------------------------------------------------------------
130 // Internals only below this point 158 // Internals only below this point
131 // 159 //
132 160
133 private DebugInfoReadStream streamAt(int decodeOffset) { 161 private DebugInfoReadStream streamAt(int decodeOffset) {
134 return new DebugInfoReadStream(code, decodeOffset); 162 return new DebugInfoReadStream(code, decodeOffset, objects);
135 } 163 }
136 164
137 /** Returns a List&lt;ScopeValue&gt; or null if no values were present */ 165 /** Returns a List&lt;ScopeValue&gt; or null if no values were present */
138 private List decodeScopeValues(int decodeOffset) { 166 private List decodeScopeValues(int decodeOffset) {
139 if (decodeOffset == DebugInformationRecorder.SERIALIZED_NULL) { 167 if (decodeOffset == DebugInformationRecorder.SERIALIZED_NULL) {
159 for (int i = 0; i < length; i++) { 187 for (int i = 0; i < length; i++) {
160 res.add(new MonitorValue(stream)); 188 res.add(new MonitorValue(stream));
161 } 189 }
162 return res; 190 return res;
163 } 191 }
192
193 /** Returns a List&lt;ObjectValue&gt; or null if no values were present */
194 private List decodeObjectValues(int decodeOffset) {
195 if (decodeOffset == DebugInformationRecorder.SERIALIZED_NULL) {
196 return null;
197 }
198 List res = new ArrayList();
199 DebugInfoReadStream stream = new DebugInfoReadStream(code, decodeOffset, res);
200 int length = stream.readInt();
201 for (int i = 0; i < length; i++) {
202 // Objects values are pushed to 'res' array during read so that
203 // object's fields could reference it (OBJECT_ID_CODE).
204 ScopeValue.readFrom(stream);
205 // res.add(ScopeValue.readFrom(stream));
206 }
207 Assert.that(res.size() == length, "inconsistent debug information");
208 return res;
209 }
164 } 210 }