src/share/vm/runtime/frame.cpp
Index Unified diffs Context diffs Sdiffs Wdiffs Patch New Old Previous File Next File 7090904 Sdiff src/share/vm/runtime

src/share/vm/runtime/frame.cpp

Print this page




1321   assert(is_interpreted_frame(), "Not an interpreted frame");
1322   // verify that the value is in the right part of the frame
1323   address low_mark  = (address) interpreter_frame_monitor_end();
1324   address high_mark = (address) interpreter_frame_monitor_begin();
1325   address current   = (address) value;
1326 
1327   const int monitor_size = frame::interpreter_frame_monitor_size();
1328   guarantee((high_mark - current) % monitor_size  ==  0         , "Misaligned top of BasicObjectLock*");
1329   guarantee( high_mark > current                                , "Current BasicObjectLock* higher than high_mark");
1330 
1331   guarantee((current - low_mark) % monitor_size  ==  0         , "Misaligned bottom of BasicObjectLock*");
1332   guarantee( current >= low_mark                               , "Current BasicObjectLock* below than low_mark");
1333 }
1334 
1335 
1336 void frame::describe(FrameValues& values, int frame_no) {
1337   if (is_entry_frame() || is_compiled_frame() || is_interpreted_frame() || is_native_frame()) {
1338     // Label values common to most frames
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));



1341     values.describe(-1, fp(), err_msg("fp for #%d", frame_no));
1342   }

1343   if (is_interpreted_frame()) {
1344     methodOop m = interpreter_frame_method();
1345     int bci = interpreter_frame_bci();
1346 
1347     // Label the method and current bci
1348     values.describe(-1, MAX2(sp(), fp()),
1349                     FormatBuffer<1024>("#%d method %s @ %d", frame_no, m->name_and_sig_as_C_string(), bci), 2);
1350     values.describe(-1, MAX2(sp(), fp()),
1351                     err_msg("- %d locals %d max stack", m->max_locals(), m->max_stack()), 1);
1352     if (m->max_locals() > 0) {
1353       intptr_t* l0 = interpreter_frame_local_at(0);
1354       intptr_t* ln = interpreter_frame_local_at(m->max_locals() - 1);
1355       values.describe(-1, MAX2(l0, ln), err_msg("locals for #%d", frame_no), 1);
1356       // Report each local and mark as owned by this frame
1357       for (int l = 0; l < m->max_locals(); l++) {
1358         intptr_t* l0 = interpreter_frame_local_at(l);
1359         values.describe(frame_no, l0, err_msg("local %d", l));
1360       }
1361     }
1362 


1433     if (fv.owner == -1) continue;
1434     if (prev.owner == -1) {
1435       prev = fv;
1436       continue;
1437     }
1438     if (prev.location == fv.location) {
1439       if (fv.owner != prev.owner) {
1440         tty->print_cr("overlapping storage");
1441         tty->print_cr(" " INTPTR_FORMAT ": " INTPTR_FORMAT " %s", prev.location, *prev.location, prev.description);
1442         tty->print_cr(" " INTPTR_FORMAT ": " INTPTR_FORMAT " %s", fv.location, *fv.location, fv.description);
1443         error = true;
1444       }
1445     } else {
1446       prev = fv;
1447     }
1448   }
1449   assert(!error, "invalid layout");
1450 }
1451 
1452 
1453 void FrameValues::print() {
1454   _values.sort(compare);
1455   JavaThread* thread = JavaThread::current();
1456 
1457   // Sometimes values like the fp can be invalid values if the
1458   // register map wasn't updated during the walk.  Trim out values
1459   // that aren't actually in the stack of the thread.
1460   int min_index = 0;
1461   int max_index = _values.length() - 1;
1462   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;
1467   while (!thread->is_in_stack((address)v1)) {
1468     v1 = _values.at(--max_index).location;
1469   }








1470   intptr_t* min = MIN2(v0, v1);
1471   intptr_t* max = MAX2(v0, v1);
1472   intptr_t* cur = max;
1473   intptr_t* last = NULL;
1474   for (int i = max_index; i >= min_index; i--) {
1475     FrameValue fv = _values.at(i);
1476     while (cur > fv.location) {
1477       tty->print_cr(" " INTPTR_FORMAT ": " INTPTR_FORMAT, cur, *cur);
1478       cur--;
1479     }
1480     if (last == fv.location) {
1481       const char* spacer = "          " LP64_ONLY("        ");
1482       tty->print_cr(" %s  %s %s", spacer, spacer, fv.description);
1483     } else {
1484       tty->print_cr(" " INTPTR_FORMAT ": " INTPTR_FORMAT " %s", fv.location, *fv.location, fv.description);
1485       last = fv.location;
1486       cur--;
1487     }
1488   }
1489 }


1321   assert(is_interpreted_frame(), "Not an interpreted frame");
1322   // verify that the value is in the right part of the frame
1323   address low_mark  = (address) interpreter_frame_monitor_end();
1324   address high_mark = (address) interpreter_frame_monitor_begin();
1325   address current   = (address) value;
1326 
1327   const int monitor_size = frame::interpreter_frame_monitor_size();
1328   guarantee((high_mark - current) % monitor_size  ==  0         , "Misaligned top of BasicObjectLock*");
1329   guarantee( high_mark > current                                , "Current BasicObjectLock* higher than high_mark");
1330 
1331   guarantee((current - low_mark) % monitor_size  ==  0         , "Misaligned bottom of BasicObjectLock*");
1332   guarantee( current >= low_mark                               , "Current BasicObjectLock* below than low_mark");
1333 }
1334 
1335 
1336 void frame::describe(FrameValues& values, int frame_no) {
1337   if (is_entry_frame() || is_compiled_frame() || is_interpreted_frame() || is_native_frame()) {
1338     // Label values common to most frames
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));
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     }
1346   }
1347   if (is_interpreted_frame()) {
1348     methodOop m = interpreter_frame_method();
1349     int bci = interpreter_frame_bci();
1350 
1351     // Label the method and current bci
1352     values.describe(-1, MAX2(sp(), fp()),
1353                     FormatBuffer<1024>("#%d method %s @ %d", frame_no, m->name_and_sig_as_C_string(), bci), 2);
1354     values.describe(-1, MAX2(sp(), fp()),
1355                     err_msg("- %d locals %d max stack", m->max_locals(), m->max_stack()), 1);
1356     if (m->max_locals() > 0) {
1357       intptr_t* l0 = interpreter_frame_local_at(0);
1358       intptr_t* ln = interpreter_frame_local_at(m->max_locals() - 1);
1359       values.describe(-1, MAX2(l0, ln), err_msg("locals for #%d", frame_no), 1);
1360       // Report each local and mark as owned by this frame
1361       for (int l = 0; l < m->max_locals(); l++) {
1362         intptr_t* l0 = interpreter_frame_local_at(l);
1363         values.describe(frame_no, l0, err_msg("local %d", l));
1364       }
1365     }
1366 


1437     if (fv.owner == -1) continue;
1438     if (prev.owner == -1) {
1439       prev = fv;
1440       continue;
1441     }
1442     if (prev.location == fv.location) {
1443       if (fv.owner != prev.owner) {
1444         tty->print_cr("overlapping storage");
1445         tty->print_cr(" " INTPTR_FORMAT ": " INTPTR_FORMAT " %s", prev.location, *prev.location, prev.description);
1446         tty->print_cr(" " INTPTR_FORMAT ": " INTPTR_FORMAT " %s", fv.location, *fv.location, fv.description);
1447         error = true;
1448       }
1449     } else {
1450       prev = fv;
1451     }
1452   }
1453   assert(!error, "invalid layout");
1454 }
1455 
1456 
1457 void FrameValues::print(JavaThread* thread) {
1458   _values.sort(compare);

1459 
1460   // Sometimes values like the fp can be invalid values if the
1461   // register map wasn't updated during the walk.  Trim out values
1462   // that aren't actually in the stack of the thread.
1463   int min_index = 0;
1464   int max_index = _values.length() - 1;
1465   intptr_t* v0 = _values.at(min_index).location;
1466   intptr_t* v1 = _values.at(max_index).location;
1467 
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     }
1482   }
1483   intptr_t* min = MIN2(v0, v1);
1484   intptr_t* max = MAX2(v0, v1);
1485   intptr_t* cur = max;
1486   intptr_t* last = NULL;
1487   for (int i = max_index; i >= min_index; i--) {
1488     FrameValue fv = _values.at(i);
1489     while (cur > fv.location) {
1490       tty->print_cr(" " INTPTR_FORMAT ": " INTPTR_FORMAT, cur, *cur);
1491       cur--;
1492     }
1493     if (last == fv.location) {
1494       const char* spacer = "          " LP64_ONLY("        ");
1495       tty->print_cr(" %s  %s %s", spacer, spacer, fv.description);
1496     } else {
1497       tty->print_cr(" " INTPTR_FORMAT ": " INTPTR_FORMAT " %s", fv.location, *fv.location, fv.description);
1498       last = fv.location;
1499       cur--;
1500     }
1501   }
1502 }
src/share/vm/runtime/frame.cpp
Index Unified diffs Context diffs Sdiffs Wdiffs Patch New Old Previous File Next File