Mercurial > hg > truffle
comparison agent/src/share/classes/sun/jvm/hotspot/code/ScopeDesc.java @ 931:72088be4b386
6873116: Modify reexecute implementation to use pcDesc to record the reexecute bit
Summary: use PcDesc to keep record of the reexecute bit instead of using DebugInfoStreams
Reviewed-by: kvn, never, twisti
author | cfang |
---|---|
date | Thu, 20 Aug 2009 12:42:57 -0700 |
parents | 15bbd3f505c0 |
children | 873ec3787992 |
comparison
equal
deleted
inserted
replaced
930:357d4e2eb4dd | 931:72088be4b386 |
---|---|
50 private int monitorsDecodeOffset; | 50 private int monitorsDecodeOffset; |
51 /** Scalar replaced bjects pool */ | 51 /** Scalar replaced bjects pool */ |
52 private List objects; // ArrayList<ScopeValue> | 52 private List objects; // ArrayList<ScopeValue> |
53 | 53 |
54 | 54 |
55 public ScopeDesc(NMethod code, int decodeOffset) { | 55 public ScopeDesc(NMethod code, int decodeOffset, boolean reexecute) { |
56 this.code = code; | 56 this.code = code; |
57 this.decodeOffset = decodeOffset; | 57 this.decodeOffset = decodeOffset; |
58 this.objects = decodeObjectValues(DebugInformationRecorder.SERIALIZED_NULL); | 58 this.objects = decodeObjectValues(DebugInformationRecorder.SERIALIZED_NULL); |
59 this.reexecute = reexecute; | |
59 | 60 |
60 // Decode header | 61 // Decode header |
61 DebugInfoReadStream stream = streamAt(decodeOffset); | 62 DebugInfoReadStream stream = streamAt(decodeOffset); |
62 | 63 |
63 senderDecodeOffset = stream.readInt(); | 64 senderDecodeOffset = stream.readInt(); |
64 method = (Method) VM.getVM().getObjectHeap().newOop(stream.readOopHandle()); | 65 method = (Method) VM.getVM().getObjectHeap().newOop(stream.readOopHandle()); |
65 setBCIAndReexecute(stream.readInt()); | 66 bci = stream.readBCI(); |
66 // Decode offsets for body and sender | 67 // Decode offsets for body and sender |
67 localsDecodeOffset = stream.readInt(); | 68 localsDecodeOffset = stream.readInt(); |
68 expressionsDecodeOffset = stream.readInt(); | 69 expressionsDecodeOffset = stream.readInt(); |
69 monitorsDecodeOffset = stream.readInt(); | 70 monitorsDecodeOffset = stream.readInt(); |
70 } | 71 } |
71 | 72 |
72 public ScopeDesc(NMethod code, int decodeOffset, int objectDecodeOffset) { | 73 public ScopeDesc(NMethod code, int decodeOffset, int objectDecodeOffset, boolean reexecute) { |
73 this.code = code; | 74 this.code = code; |
74 this.decodeOffset = decodeOffset; | 75 this.decodeOffset = decodeOffset; |
75 this.objects = decodeObjectValues(objectDecodeOffset); | 76 this.objects = decodeObjectValues(objectDecodeOffset); |
77 this.reexecute = reexecute; | |
76 | 78 |
77 // Decode header | 79 // Decode header |
78 DebugInfoReadStream stream = streamAt(decodeOffset); | 80 DebugInfoReadStream stream = streamAt(decodeOffset); |
79 | 81 |
80 senderDecodeOffset = stream.readInt(); | 82 senderDecodeOffset = stream.readInt(); |
81 method = (Method) VM.getVM().getObjectHeap().newOop(stream.readOopHandle()); | 83 method = (Method) VM.getVM().getObjectHeap().newOop(stream.readOopHandle()); |
82 setBCIAndReexecute(stream.readInt()); | 84 bci = stream.readBCI(); |
83 // Decode offsets for body and sender | 85 // Decode offsets for body and sender |
84 localsDecodeOffset = stream.readInt(); | 86 localsDecodeOffset = stream.readInt(); |
85 expressionsDecodeOffset = stream.readInt(); | 87 expressionsDecodeOffset = stream.readInt(); |
86 monitorsDecodeOffset = stream.readInt(); | 88 monitorsDecodeOffset = stream.readInt(); |
87 } | 89 } |
88 | 90 |
89 public NMethod getNMethod() { return code; } | 91 public NMethod getNMethod() { return code; } |
90 public Method getMethod() { return method; } | 92 public Method getMethod() { return method; } |
91 public int getBCI() { return bci; } | 93 public int getBCI() { return bci; } |
92 public boolean getReexecute() {return reexecute;} | 94 public boolean getReexecute() { return reexecute;} |
93 | 95 |
94 /** Returns a List<ScopeValue> */ | 96 /** Returns a List<ScopeValue> */ |
95 public List getLocals() { | 97 public List getLocals() { |
96 return decodeScopeValues(localsDecodeOffset); | 98 return decodeScopeValues(localsDecodeOffset); |
97 } | 99 } |
115 public ScopeDesc sender() { | 117 public ScopeDesc sender() { |
116 if (isTop()) { | 118 if (isTop()) { |
117 return null; | 119 return null; |
118 } | 120 } |
119 | 121 |
120 return new ScopeDesc(code, senderDecodeOffset); | 122 return new ScopeDesc(code, senderDecodeOffset, false); |
121 } | 123 } |
122 | 124 |
123 /** Returns where the scope was decoded */ | 125 /** Returns where the scope was decoded */ |
124 public int getDecodeOffset() { | 126 public int getDecodeOffset() { |
125 return decodeOffset; | 127 return decodeOffset; |
149 } | 151 } |
150 | 152 |
151 public void printValueOn(PrintStream tty) { | 153 public void printValueOn(PrintStream tty) { |
152 tty.print("ScopeDesc for "); | 154 tty.print("ScopeDesc for "); |
153 method.printValueOn(tty); | 155 method.printValueOn(tty); |
154 tty.println(" @bci " + bci); | 156 tty.print(" @bci " + bci); |
155 tty.println(" reexecute: " + reexecute); | 157 tty.println(" reexecute=" + reexecute); |
156 } | 158 } |
157 | 159 |
158 // FIXME: add more accessors | 160 // FIXME: add more accessors |
159 | 161 |
160 //-------------------------------------------------------------------------------- | 162 //-------------------------------------------------------------------------------- |
161 // Internals only below this point | 163 // Internals only below this point |
162 // | 164 // |
163 private void setBCIAndReexecute(int combination) { | |
164 int InvocationEntryBci = VM.getVM().getInvocationEntryBCI(); | |
165 bci = (combination >> 1) + InvocationEntryBci; | |
166 reexecute = (combination & 1)==1 ? true : false; | |
167 } | |
168 | |
169 private DebugInfoReadStream streamAt(int decodeOffset) { | 165 private DebugInfoReadStream streamAt(int decodeOffset) { |
170 return new DebugInfoReadStream(code, decodeOffset, objects); | 166 return new DebugInfoReadStream(code, decodeOffset, objects); |
171 } | 167 } |
172 | 168 |
173 /** Returns a List<ScopeValue> or null if no values were present */ | 169 /** Returns a List<ScopeValue> or null if no values were present */ |