Mercurial > hg > truffle
comparison src/share/vm/opto/callnode.hpp @ 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 | ad8c635e757e |
children | 15bbd3f505c0 |
comparison
equal
deleted
inserted
replaced
899:55cb84cd1247 | 900:9987d9d5eb0e |
---|---|
176 // plus GC roots, for all active calls at some call site in this compilation | 176 // plus GC roots, for all active calls at some call site in this compilation |
177 // unit. (If there is no inlining, then the list has exactly one link.) | 177 // unit. (If there is no inlining, then the list has exactly one link.) |
178 // This provides a way to map the optimized program back into the interpreter, | 178 // This provides a way to map the optimized program back into the interpreter, |
179 // or to let the GC mark the stack. | 179 // or to let the GC mark the stack. |
180 class JVMState : public ResourceObj { | 180 class JVMState : public ResourceObj { |
181 public: | |
182 typedef enum { | |
183 Reexecute_Undefined = -1, // not defined -- will be translated into false later | |
184 Reexecute_False = 0, // false -- do not reexecute | |
185 Reexecute_True = 1 // true -- reexecute the bytecode | |
186 } ReexecuteState; //Reexecute State | |
187 | |
181 private: | 188 private: |
182 JVMState* _caller; // List pointer for forming scope chains | 189 JVMState* _caller; // List pointer for forming scope chains |
183 uint _depth; // One mroe than caller depth, or one. | 190 uint _depth; // One mroe than caller depth, or one. |
184 uint _locoff; // Offset to locals in input edge mapping | 191 uint _locoff; // Offset to locals in input edge mapping |
185 uint _stkoff; // Offset to stack in input edge mapping | 192 uint _stkoff; // Offset to stack in input edge mapping |
186 uint _monoff; // Offset to monitors in input edge mapping | 193 uint _monoff; // Offset to monitors in input edge mapping |
187 uint _scloff; // Offset to fields of scalar objs in input edge mapping | 194 uint _scloff; // Offset to fields of scalar objs in input edge mapping |
188 uint _endoff; // Offset to end of input edge mapping | 195 uint _endoff; // Offset to end of input edge mapping |
189 uint _sp; // Jave Expression Stack Pointer for this state | 196 uint _sp; // Jave Expression Stack Pointer for this state |
190 int _bci; // Byte Code Index of this JVM point | 197 int _bci; // Byte Code Index of this JVM point |
198 ReexecuteState _reexecute; // Whether this bytecode need to be re-executed | |
191 ciMethod* _method; // Method Pointer | 199 ciMethod* _method; // Method Pointer |
192 SafePointNode* _map; // Map node associated with this scope | 200 SafePointNode* _map; // Map node associated with this scope |
193 public: | 201 public: |
194 friend class Compile; | 202 friend class Compile; |
203 friend class PreserveReexecuteState; | |
195 | 204 |
196 // Because JVMState objects live over the entire lifetime of the | 205 // Because JVMState objects live over the entire lifetime of the |
197 // Compile object, they are allocated into the comp_arena, which | 206 // Compile object, they are allocated into the comp_arena, which |
198 // does not get resource marked or reset during the compile process | 207 // does not get resource marked or reset during the compile process |
199 void *operator new( size_t x, Compile* C ) { return C->comp_arena()->Amalloc(x); } | 208 void *operator new( size_t x, Compile* C ) { return C->comp_arena()->Amalloc(x); } |
220 bool is_loc(uint i) const { return i >= _locoff && i < _stkoff; } | 229 bool is_loc(uint i) const { return i >= _locoff && i < _stkoff; } |
221 bool is_stk(uint i) const { return i >= _stkoff && i < _monoff; } | 230 bool is_stk(uint i) const { return i >= _stkoff && i < _monoff; } |
222 bool is_mon(uint i) const { return i >= _monoff && i < _scloff; } | 231 bool is_mon(uint i) const { return i >= _monoff && i < _scloff; } |
223 bool is_scl(uint i) const { return i >= _scloff && i < _endoff; } | 232 bool is_scl(uint i) const { return i >= _scloff && i < _endoff; } |
224 | 233 |
225 uint sp() const { return _sp; } | 234 uint sp() const { return _sp; } |
226 int bci() const { return _bci; } | 235 int bci() const { return _bci; } |
227 bool has_method() const { return _method != NULL; } | 236 bool should_reexecute() const { return _reexecute==Reexecute_True; } |
228 ciMethod* method() const { assert(has_method(), ""); return _method; } | 237 bool is_reexecute_undefined() const { return _reexecute==Reexecute_Undefined; } |
229 JVMState* caller() const { return _caller; } | 238 bool has_method() const { return _method != NULL; } |
230 SafePointNode* map() const { return _map; } | 239 ciMethod* method() const { assert(has_method(), ""); return _method; } |
231 uint depth() const { return _depth; } | 240 JVMState* caller() const { return _caller; } |
232 uint debug_start() const; // returns locoff of root caller | 241 SafePointNode* map() const { return _map; } |
233 uint debug_end() const; // returns endoff of self | 242 uint depth() const { return _depth; } |
234 uint debug_size() const { | 243 uint debug_start() const; // returns locoff of root caller |
244 uint debug_end() const; // returns endoff of self | |
245 uint debug_size() const { | |
235 return loc_size() + sp() + mon_size() + scl_size(); | 246 return loc_size() + sp() + mon_size() + scl_size(); |
236 } | 247 } |
237 uint debug_depth() const; // returns sum of debug_size values at all depths | 248 uint debug_depth() const; // returns sum of debug_size values at all depths |
238 | 249 |
239 // Returns the JVM state at the desired depth (1 == root). | 250 // Returns the JVM state at the desired depth (1 == root). |
265 void set_offsets(uint off) { | 276 void set_offsets(uint off) { |
266 _locoff = _stkoff = _monoff = _scloff = _endoff = off; | 277 _locoff = _stkoff = _monoff = _scloff = _endoff = off; |
267 } | 278 } |
268 void set_map(SafePointNode *map) { _map = map; } | 279 void set_map(SafePointNode *map) { _map = map; } |
269 void set_sp(uint sp) { _sp = sp; } | 280 void set_sp(uint sp) { _sp = sp; } |
270 void set_bci(int bci) { _bci = bci; } | 281 // _reexecute is initialized to "undefined" for a new bci |
282 void set_bci(int bci) {if(_bci != bci)_reexecute=Reexecute_Undefined; _bci = bci; } | |
283 void set_should_reexecute(bool reexec) {_reexecute = reexec ? Reexecute_True : Reexecute_False;} | |
271 | 284 |
272 // Miscellaneous utility functions | 285 // Miscellaneous utility functions |
273 JVMState* clone_deep(Compile* C) const; // recursively clones caller chain | 286 JVMState* clone_deep(Compile* C) const; // recursively clones caller chain |
274 JVMState* clone_shallow(Compile* C) const; // retains uncloned caller | 287 JVMState* clone_shallow(Compile* C) const; // retains uncloned caller |
275 | 288 |