hotspot/src/share/vm/runtime/frame.cpp
changeset 10966 0c9ed2dfc6a2
parent 9636 363ca5579aff
child 11486 cdc636532368
equal deleted inserted replaced
10965:0d123ed671cc 10966:0c9ed2dfc6a2
  1336 void frame::describe(FrameValues& values, int frame_no) {
  1336 void frame::describe(FrameValues& values, int frame_no) {
  1337   if (is_entry_frame() || is_compiled_frame() || is_interpreted_frame() || is_native_frame()) {
  1337   if (is_entry_frame() || is_compiled_frame() || is_interpreted_frame() || is_native_frame()) {
  1338     // Label values common to most frames
  1338     // Label values common to most frames
  1339     values.describe(-1, unextended_sp(), err_msg("unextended_sp for #%d", frame_no));
  1339     values.describe(-1, unextended_sp(), err_msg("unextended_sp for #%d", frame_no));
  1340     values.describe(-1, sp(), err_msg("sp for #%d", frame_no));
  1340     values.describe(-1, sp(), err_msg("sp for #%d", frame_no));
  1341     values.describe(-1, fp(), err_msg("fp for #%d", frame_no));
  1341     if (is_compiled_frame()) {
       
  1342       values.describe(-1, sp() + _cb->frame_size(), err_msg("computed fp for #%d", frame_no));
       
  1343     } else {
       
  1344       values.describe(-1, fp(), err_msg("fp for #%d", frame_no));
       
  1345     }
  1342   }
  1346   }
  1343   if (is_interpreted_frame()) {
  1347   if (is_interpreted_frame()) {
  1344     methodOop m = interpreter_frame_method();
  1348     methodOop m = interpreter_frame_method();
  1345     int bci = interpreter_frame_bci();
  1349     int bci = interpreter_frame_bci();
  1346 
  1350 
  1448   }
  1452   }
  1449   assert(!error, "invalid layout");
  1453   assert(!error, "invalid layout");
  1450 }
  1454 }
  1451 
  1455 
  1452 
  1456 
  1453 void FrameValues::print() {
  1457 void FrameValues::print(JavaThread* thread) {
  1454   _values.sort(compare);
  1458   _values.sort(compare);
  1455   JavaThread* thread = JavaThread::current();
       
  1456 
  1459 
  1457   // Sometimes values like the fp can be invalid values if the
  1460   // Sometimes values like the fp can be invalid values if the
  1458   // register map wasn't updated during the walk.  Trim out values
  1461   // register map wasn't updated during the walk.  Trim out values
  1459   // that aren't actually in the stack of the thread.
  1462   // that aren't actually in the stack of the thread.
  1460   int min_index = 0;
  1463   int min_index = 0;
  1461   int max_index = _values.length() - 1;
  1464   int max_index = _values.length() - 1;
  1462   intptr_t* v0 = _values.at(min_index).location;
  1465   intptr_t* v0 = _values.at(min_index).location;
  1463   while (!thread->is_in_stack((address)v0)) {
       
  1464     v0 = _values.at(++min_index).location;
       
  1465   }
       
  1466   intptr_t* v1 = _values.at(max_index).location;
  1466   intptr_t* v1 = _values.at(max_index).location;
  1467   while (!thread->is_in_stack((address)v1)) {
  1467 
  1468     v1 = _values.at(--max_index).location;
  1468   if (thread == Thread::current()) {
       
  1469     while (!thread->is_in_stack((address)v0)) {
       
  1470       v0 = _values.at(++min_index).location;
       
  1471     }
       
  1472     while (!thread->is_in_stack((address)v1)) {
       
  1473       v1 = _values.at(--max_index).location;
       
  1474     }
       
  1475   } else {
       
  1476     while (!thread->on_local_stack((address)v0)) {
       
  1477       v0 = _values.at(++min_index).location;
       
  1478     }
       
  1479     while (!thread->on_local_stack((address)v1)) {
       
  1480       v1 = _values.at(--max_index).location;
       
  1481     }
  1469   }
  1482   }
  1470   intptr_t* min = MIN2(v0, v1);
  1483   intptr_t* min = MIN2(v0, v1);
  1471   intptr_t* max = MAX2(v0, v1);
  1484   intptr_t* max = MAX2(v0, v1);
  1472   intptr_t* cur = max;
  1485   intptr_t* cur = max;
  1473   intptr_t* last = NULL;
  1486   intptr_t* last = NULL;