hotspot/src/share/vm/runtime/vframe.hpp
changeset 30305 b92a97e1e9cb
parent 25714 87fa6860b5ae
child 31782 b23b74f8ae8d
equal deleted inserted replaced
30302:ecca632210ef 30305:b92a97e1e9cb
   387   // Range check to detect ridiculous offsets.
   387   // Range check to detect ridiculous offsets.
   388   if (decode_offset == DebugInformationRecorder::serialized_null ||
   388   if (decode_offset == DebugInformationRecorder::serialized_null ||
   389       decode_offset < 0 ||
   389       decode_offset < 0 ||
   390       decode_offset >= nm()->scopes_data_size()) {
   390       decode_offset >= nm()->scopes_data_size()) {
   391     // 6379830 AsyncGetCallTrace sometimes feeds us wild frames.
   391     // 6379830 AsyncGetCallTrace sometimes feeds us wild frames.
   392     // If we attempt to read nmethod::scopes_data at serialized_null (== 0),
   392     // If we read nmethod::scopes_data at serialized_null (== 0)
   393     // or if we read some at other crazy offset,
   393     // or if read some at other invalid offset, invalid values will be decoded.
   394     // we will decode garbage and make wild references into the heap,
   394     // Based on these values, invalid heap locations could be referenced
   395     // leading to crashes in product mode.
   395     // that could lead to crashes in product mode.
   396     // (This isn't airtight, of course, since there are internal
   396     // Therefore, do not use the decode offset if invalid, but fill the frame
   397     // offsets which are also crazy.)
   397     // as it were a native compiled frame (no Java-level assumptions).
   398 #ifdef ASSERT
   398 #ifdef ASSERT
   399     if (WizardMode) {
   399     if (WizardMode) {
   400       tty->print_cr("Error in fill_from_frame: pc_desc for "
   400       tty->print_cr("Error in fill_from_frame: pc_desc for "
   401                     INTPTR_FORMAT " not found or invalid at %d",
   401                     INTPTR_FORMAT " not found or invalid at %d",
   402                     p2i(_frame.pc()), decode_offset);
   402                     p2i(_frame.pc()), decode_offset);
   512 inline void vframeStreamCommon::fill_from_interpreter_frame() {
   512 inline void vframeStreamCommon::fill_from_interpreter_frame() {
   513   Method* method = _frame.interpreter_frame_method();
   513   Method* method = _frame.interpreter_frame_method();
   514   address   bcp    = _frame.interpreter_frame_bcp();
   514   address   bcp    = _frame.interpreter_frame_bcp();
   515   int       bci    = method->validate_bci_from_bcp(bcp);
   515   int       bci    = method->validate_bci_from_bcp(bcp);
   516   // 6379830 AsyncGetCallTrace sometimes feeds us wild frames.
   516   // 6379830 AsyncGetCallTrace sometimes feeds us wild frames.
       
   517   // AsyncGetCallTrace interrupts the VM asynchronously. As a result
       
   518   // it is possible to access an interpreter frame for which
       
   519   // no Java-level information is yet available (e.g., becasue
       
   520   // the frame was being created when the VM interrupted it).
       
   521   // In this scenario, pretend that the interpreter is at the point
       
   522   // of entering the method.
   517   if (bci < 0) {
   523   if (bci < 0) {
   518     found_bad_method_frame();
   524     found_bad_method_frame();
   519     bci = 0;  // pretend it's on the point of entering
   525     bci = 0;
   520   }
   526   }
   521   _mode   = interpreted_mode;
   527   _mode   = interpreted_mode;
   522   _method = method;
   528   _method = method;
   523   _bci    = bci;
   529   _bci    = bci;
   524 }
   530 }