Mercurial > hg > graal-jvmci-8
comparison agent/src/share/classes/sun/jvm/hotspot/code/ScopeDesc.java @ 900:9987d9d5eb0e
6833129: specjvm98 fails with NullPointerException in the compiler with -XX:DeoptimizeALot
Summary: developed a reexecute logic for the interpreter to reexecute the bytecode when deopt happens
Reviewed-by: kvn, never, jrose, twisti
author | cfang |
---|---|
date | Fri, 31 Jul 2009 17:12:33 -0700 |
parents | b109e761e927 |
children | 15bbd3f505c0 |
comparison
equal
deleted
inserted
replaced
899:55cb84cd1247 | 900:9987d9d5eb0e |
---|---|
39 public class ScopeDesc { | 39 public class ScopeDesc { |
40 /** NMethod information */ | 40 /** NMethod information */ |
41 private NMethod code; | 41 private NMethod code; |
42 private Method method; | 42 private Method method; |
43 private int bci; | 43 private int bci; |
44 private boolean reexecute; | |
44 /** Decoding offsets */ | 45 /** Decoding offsets */ |
45 private int decodeOffset; | 46 private int decodeOffset; |
46 private int senderDecodeOffset; | 47 private int senderDecodeOffset; |
47 private int localsDecodeOffset; | 48 private int localsDecodeOffset; |
48 private int expressionsDecodeOffset; | 49 private int expressionsDecodeOffset; |
59 // Decode header | 60 // Decode header |
60 DebugInfoReadStream stream = streamAt(decodeOffset); | 61 DebugInfoReadStream stream = streamAt(decodeOffset); |
61 | 62 |
62 senderDecodeOffset = stream.readInt(); | 63 senderDecodeOffset = stream.readInt(); |
63 method = (Method) VM.getVM().getObjectHeap().newOop(stream.readOopHandle()); | 64 method = (Method) VM.getVM().getObjectHeap().newOop(stream.readOopHandle()); |
64 bci = stream.readBCI(); | 65 setBCIAndReexecute(stream.readInt()); |
65 // Decode offsets for body and sender | 66 // Decode offsets for body and sender |
66 localsDecodeOffset = stream.readInt(); | 67 localsDecodeOffset = stream.readInt(); |
67 expressionsDecodeOffset = stream.readInt(); | 68 expressionsDecodeOffset = stream.readInt(); |
68 monitorsDecodeOffset = stream.readInt(); | 69 monitorsDecodeOffset = stream.readInt(); |
69 } | 70 } |
76 // Decode header | 77 // Decode header |
77 DebugInfoReadStream stream = streamAt(decodeOffset); | 78 DebugInfoReadStream stream = streamAt(decodeOffset); |
78 | 79 |
79 senderDecodeOffset = stream.readInt(); | 80 senderDecodeOffset = stream.readInt(); |
80 method = (Method) VM.getVM().getObjectHeap().newOop(stream.readOopHandle()); | 81 method = (Method) VM.getVM().getObjectHeap().newOop(stream.readOopHandle()); |
81 bci = stream.readBCI(); | 82 setBCIAndReexecute(stream.readInt()); |
82 // Decode offsets for body and sender | 83 // Decode offsets for body and sender |
83 localsDecodeOffset = stream.readInt(); | 84 localsDecodeOffset = stream.readInt(); |
84 expressionsDecodeOffset = stream.readInt(); | 85 expressionsDecodeOffset = stream.readInt(); |
85 monitorsDecodeOffset = stream.readInt(); | 86 monitorsDecodeOffset = stream.readInt(); |
86 } | 87 } |
87 | 88 |
88 public NMethod getNMethod() { return code; } | 89 public NMethod getNMethod() { return code; } |
89 public Method getMethod() { return method; } | 90 public Method getMethod() { return method; } |
90 public int getBCI() { return bci; } | 91 public int getBCI() { return bci; } |
92 public boolean getReexecute() {return reexecute;} | |
91 | 93 |
92 /** Returns a List<ScopeValue> */ | 94 /** Returns a List<ScopeValue> */ |
93 public List getLocals() { | 95 public List getLocals() { |
94 return decodeScopeValues(localsDecodeOffset); | 96 return decodeScopeValues(localsDecodeOffset); |
95 } | 97 } |
148 | 150 |
149 public void printValueOn(PrintStream tty) { | 151 public void printValueOn(PrintStream tty) { |
150 tty.print("ScopeDesc for "); | 152 tty.print("ScopeDesc for "); |
151 method.printValueOn(tty); | 153 method.printValueOn(tty); |
152 tty.println(" @bci " + bci); | 154 tty.println(" @bci " + bci); |
155 tty.println(" reexecute: " + reexecute); | |
153 } | 156 } |
154 | 157 |
155 // FIXME: add more accessors | 158 // FIXME: add more accessors |
156 | 159 |
157 //-------------------------------------------------------------------------------- | 160 //-------------------------------------------------------------------------------- |
158 // Internals only below this point | 161 // Internals only below this point |
159 // | 162 // |
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 } | |
160 | 168 |
161 private DebugInfoReadStream streamAt(int decodeOffset) { | 169 private DebugInfoReadStream streamAt(int decodeOffset) { |
162 return new DebugInfoReadStream(code, decodeOffset, objects); | 170 return new DebugInfoReadStream(code, decodeOffset, objects); |
163 } | 171 } |
164 | 172 |