15 * You should have received a copy of the GNU General Public License version 16 * 2 along with this work; if not, write to the Free Software Foundation, 17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 18 * 19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 20 * or visit www.oracle.com if you need additional information or have any 21 * questions. 22 * 23 */ 24 25 #include "precompiled.hpp" 26 #include "code/debugInfoRec.hpp" 27 #include "code/pcDesc.hpp" 28 #include "code/scopeDesc.hpp" 29 #include "memory/resourceArea.hpp" 30 #include "oops/oop.inline.hpp" 31 #include "runtime/handles.inline.hpp" 32 33 PRAGMA_FORMAT_MUTE_WARNINGS_FOR_GCC 34 35 ScopeDesc::ScopeDesc(const nmethod* code, int decode_offset, int obj_decode_offset, bool reexecute, bool return_oop) { 36 _code = code; 37 _decode_offset = decode_offset; 38 _objects = decode_object_values(obj_decode_offset); 39 _reexecute = reexecute; 40 _return_oop = return_oop; 41 decode_body(); 42 } 43 44 ScopeDesc::ScopeDesc(const nmethod* code, int decode_offset, bool reexecute, bool return_oop) { 45 _code = code; 46 _decode_offset = decode_offset; 47 _objects = decode_object_values(DebugInformationRecorder::serialized_null); 48 _reexecute = reexecute; 49 _return_oop = return_oop; 50 decode_body(); 51 } 52 53 54 ScopeDesc::ScopeDesc(const ScopeDesc* parent) { 55 _code = parent->_code; 56 _decode_offset = parent->_sender_decode_offset; 57 _objects = parent->_objects; 58 _reexecute = false; //reexecute only applies to the first scope 59 _return_oop = false; 60 decode_body(); 61 } 62 63 64 void ScopeDesc::decode_body() { 65 if (decode_offset() == DebugInformationRecorder::serialized_null) { 66 // This is a sentinel record, which is only relevant to 67 // approximate queries. Decode a reasonable frame. 68 _sender_decode_offset = DebugInformationRecorder::serialized_null; 69 _method = _code->method(); 70 _bci = InvocationEntryBci; 71 _locals_decode_offset = DebugInformationRecorder::serialized_null; 72 _expressions_decode_offset = DebugInformationRecorder::serialized_null; 73 _monitors_decode_offset = DebugInformationRecorder::serialized_null; 74 } else { 75 // decode header 76 DebugInfoReadStream* stream = stream_at(decode_offset()); 77 78 _sender_decode_offset = stream->read_int(); 210 st->print_cr(" Expression stack"); 211 for (int index = 0; index < l->length(); index++) { 212 st->print(" - @%d: ", index); 213 l->at(index)->print_on(st); 214 st->cr(); 215 } 216 } 217 } 218 // monitors 219 { GrowableArray<MonitorValue*>* l = ((ScopeDesc*) this)->monitors(); 220 if (l != NULL) { 221 st->print_cr(" Monitor stack"); 222 for (int index = 0; index < l->length(); index++) { 223 st->print(" - @%d: ", index); 224 l->at(index)->print_on(st); 225 st->cr(); 226 } 227 } 228 } 229 230 #ifdef COMPILER2 231 if (DoEscapeAnalysis && is_top() && _objects != NULL) { 232 st->print_cr(" Objects"); 233 for (int i = 0; i < _objects->length(); i++) { 234 ObjectValue* sv = (ObjectValue*) _objects->at(i); 235 st->print(" - %d: ", sv->id()); 236 sv->print_fields_on(st); 237 st->cr(); 238 } 239 } 240 #endif // COMPILER2 241 } 242 243 #endif 244 245 void ScopeDesc::verify() { 246 ResourceMark rm; 247 guarantee(method()->is_method(), "type check"); 248 249 // check if we have any illegal elements on the expression stack 250 { GrowableArray<ScopeValue*>* l = expressions(); 251 if (l != NULL) { 252 for (int index = 0; index < l->length(); index++) { 253 //guarantee(!l->at(index)->is_illegal(), "expression element cannot be illegal"); 254 } 255 } 256 } 257 } | 15 * You should have received a copy of the GNU General Public License version 16 * 2 along with this work; if not, write to the Free Software Foundation, 17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 18 * 19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 20 * or visit www.oracle.com if you need additional information or have any 21 * questions. 22 * 23 */ 24 25 #include "precompiled.hpp" 26 #include "code/debugInfoRec.hpp" 27 #include "code/pcDesc.hpp" 28 #include "code/scopeDesc.hpp" 29 #include "memory/resourceArea.hpp" 30 #include "oops/oop.inline.hpp" 31 #include "runtime/handles.inline.hpp" 32 33 PRAGMA_FORMAT_MUTE_WARNINGS_FOR_GCC 34 35 ScopeDesc::ScopeDesc(const nmethod* code, int decode_offset, int obj_decode_offset, bool reexecute, bool rethrow_exception, bool return_oop) { 36 _code = code; 37 _decode_offset = decode_offset; 38 _objects = decode_object_values(obj_decode_offset); 39 _reexecute = reexecute; 40 _rethrow_exception = rethrow_exception; 41 _return_oop = return_oop; 42 decode_body(); 43 } 44 45 ScopeDesc::ScopeDesc(const nmethod* code, int decode_offset, bool reexecute, bool rethrow_exception, bool return_oop) { 46 _code = code; 47 _decode_offset = decode_offset; 48 _objects = decode_object_values(DebugInformationRecorder::serialized_null); 49 _reexecute = reexecute; 50 _rethrow_exception = rethrow_exception; 51 _return_oop = return_oop; 52 decode_body(); 53 } 54 55 56 ScopeDesc::ScopeDesc(const ScopeDesc* parent) { 57 _code = parent->_code; 58 _decode_offset = parent->_sender_decode_offset; 59 _objects = parent->_objects; 60 _reexecute = false; //reexecute only applies to the first scope 61 _rethrow_exception = false; 62 _return_oop = false; 63 decode_body(); 64 } 65 66 67 void ScopeDesc::decode_body() { 68 if (decode_offset() == DebugInformationRecorder::serialized_null) { 69 // This is a sentinel record, which is only relevant to 70 // approximate queries. Decode a reasonable frame. 71 _sender_decode_offset = DebugInformationRecorder::serialized_null; 72 _method = _code->method(); 73 _bci = InvocationEntryBci; 74 _locals_decode_offset = DebugInformationRecorder::serialized_null; 75 _expressions_decode_offset = DebugInformationRecorder::serialized_null; 76 _monitors_decode_offset = DebugInformationRecorder::serialized_null; 77 } else { 78 // decode header 79 DebugInfoReadStream* stream = stream_at(decode_offset()); 80 81 _sender_decode_offset = stream->read_int(); 213 st->print_cr(" Expression stack"); 214 for (int index = 0; index < l->length(); index++) { 215 st->print(" - @%d: ", index); 216 l->at(index)->print_on(st); 217 st->cr(); 218 } 219 } 220 } 221 // monitors 222 { GrowableArray<MonitorValue*>* l = ((ScopeDesc*) this)->monitors(); 223 if (l != NULL) { 224 st->print_cr(" Monitor stack"); 225 for (int index = 0; index < l->length(); index++) { 226 st->print(" - @%d: ", index); 227 l->at(index)->print_on(st); 228 st->cr(); 229 } 230 } 231 } 232 233 #if defined(COMPILER2) || INCLUDE_JVMCI 234 if (NOT_JVMCI(DoEscapeAnalysis &&) is_top() && _objects != NULL) { 235 st->print_cr(" Objects"); 236 for (int i = 0; i < _objects->length(); i++) { 237 ObjectValue* sv = (ObjectValue*) _objects->at(i); 238 st->print(" - %d: ", sv->id()); 239 st->print("%s ", java_lang_Class::as_Klass(sv->klass()->as_ConstantOopReadValue()->value()())->external_name()); 240 sv->print_fields_on(st); 241 st->cr(); 242 } 243 } 244 #endif // COMPILER2 || INCLUDE_JVMCI 245 } 246 247 #endif 248 249 void ScopeDesc::verify() { 250 ResourceMark rm; 251 guarantee(method()->is_method(), "type check"); 252 253 // check if we have any illegal elements on the expression stack 254 { GrowableArray<ScopeValue*>* l = expressions(); 255 if (l != NULL) { 256 for (int index = 0; index < l->length(); index++) { 257 //guarantee(!l->at(index)->is_illegal(), "expression element cannot be illegal"); 258 } 259 } 260 } 261 } |