comparison src/share/vm/code/scopeDesc.cpp @ 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 d1605aabd0a1
children 72088be4b386
comparison
equal deleted inserted replaced
899:55cb84cd1247 900:9987d9d5eb0e
44 ScopeDesc::ScopeDesc(const ScopeDesc* parent) { 44 ScopeDesc::ScopeDesc(const ScopeDesc* parent) {
45 _code = parent->_code; 45 _code = parent->_code;
46 _decode_offset = parent->_sender_decode_offset; 46 _decode_offset = parent->_sender_decode_offset;
47 _objects = parent->_objects; 47 _objects = parent->_objects;
48 decode_body(); 48 decode_body();
49 assert(_reexecute == false, "reexecute not allowed");
49 } 50 }
50 51
51 52
52 void ScopeDesc::decode_body() { 53 void ScopeDesc::decode_body() {
53 if (decode_offset() == DebugInformationRecorder::serialized_null) { 54 if (decode_offset() == DebugInformationRecorder::serialized_null) {
54 // This is a sentinel record, which is only relevant to 55 // This is a sentinel record, which is only relevant to
55 // approximate queries. Decode a reasonable frame. 56 // approximate queries. Decode a reasonable frame.
56 _sender_decode_offset = DebugInformationRecorder::serialized_null; 57 _sender_decode_offset = DebugInformationRecorder::serialized_null;
57 _method = methodHandle(_code->method()); 58 _method = methodHandle(_code->method());
58 _bci = InvocationEntryBci; 59 _bci = InvocationEntryBci;
60 _reexecute = false;
59 _locals_decode_offset = DebugInformationRecorder::serialized_null; 61 _locals_decode_offset = DebugInformationRecorder::serialized_null;
60 _expressions_decode_offset = DebugInformationRecorder::serialized_null; 62 _expressions_decode_offset = DebugInformationRecorder::serialized_null;
61 _monitors_decode_offset = DebugInformationRecorder::serialized_null; 63 _monitors_decode_offset = DebugInformationRecorder::serialized_null;
62 } else { 64 } else {
63 // decode header 65 // decode header
64 DebugInfoReadStream* stream = stream_at(decode_offset()); 66 DebugInfoReadStream* stream = stream_at(decode_offset());
65 67
66 _sender_decode_offset = stream->read_int(); 68 _sender_decode_offset = stream->read_int();
67 _method = methodHandle((methodOop) stream->read_oop()); 69 _method = methodHandle((methodOop) stream->read_oop());
68 _bci = stream->read_bci(); 70 _bci = stream->read_bci_and_reexecute(_reexecute);
71
69 // decode offsets for body and sender 72 // decode offsets for body and sender
70 _locals_decode_offset = stream->read_int(); 73 _locals_decode_offset = stream->read_int();
71 _expressions_decode_offset = stream->read_int(); 74 _expressions_decode_offset = stream->read_int();
72 _monitors_decode_offset = stream->read_int(); 75 _monitors_decode_offset = stream->read_int();
73 } 76 }
168 // decode offsets 171 // decode offsets
169 if (WizardMode) { 172 if (WizardMode) {
170 st->print("ScopeDesc[%d]@" PTR_FORMAT " ", _decode_offset, _code->instructions_begin()); 173 st->print("ScopeDesc[%d]@" PTR_FORMAT " ", _decode_offset, _code->instructions_begin());
171 st->print_cr(" offset: %d", _decode_offset); 174 st->print_cr(" offset: %d", _decode_offset);
172 st->print_cr(" bci: %d", bci()); 175 st->print_cr(" bci: %d", bci());
176 st->print_cr(" reexecute: %s", should_reexecute() ? "true" : "false");
173 st->print_cr(" locals: %d", _locals_decode_offset); 177 st->print_cr(" locals: %d", _locals_decode_offset);
174 st->print_cr(" stack: %d", _expressions_decode_offset); 178 st->print_cr(" stack: %d", _expressions_decode_offset);
175 st->print_cr(" monitor: %d", _monitors_decode_offset); 179 st->print_cr(" monitor: %d", _monitors_decode_offset);
176 st->print_cr(" sender: %d", _sender_decode_offset); 180 st->print_cr(" sender: %d", _sender_decode_offset);
177 } 181 }