Mercurial > hg > truffle
comparison src/share/vm/runtime/frame.cpp @ 4970:33df1aeaebbf
Merge with http://hg.openjdk.java.net/hsx/hsx24/hotspot/
author | Thomas Wuerthinger <thomas.wuerthinger@oracle.com> |
---|---|
date | Mon, 27 Feb 2012 13:10:13 +0100 |
parents | 84e7d6690293 aa3d708d67c4 |
children | 28577a53d3a7 |
comparison
equal
deleted
inserted
replaced
4703:2cfb7fb2dce7 | 4970:33df1aeaebbf |
---|---|
1 /* | 1 /* |
2 * Copyright (c) 1997, 2011, Oracle and/or its affiliates. All rights reserved. | 2 * Copyright (c) 1997, 2012, Oracle and/or its affiliates. All rights reserved. |
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. | 3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
4 * | 4 * |
5 * This code is free software; you can redistribute it and/or modify it | 5 * This code is free software; you can redistribute it and/or modify it |
6 * under the terms of the GNU General Public License version 2 only, as | 6 * under the terms of the GNU General Public License version 2 only, as |
7 * published by the Free Software Foundation. | 7 * published by the Free Software Foundation. |
568 st->print_cr(")"); | 568 st->print_cr(")"); |
569 st->print("("); | 569 st->print("("); |
570 InterpreterCodelet* desc = Interpreter::codelet_containing(pc()); | 570 InterpreterCodelet* desc = Interpreter::codelet_containing(pc()); |
571 if (desc != NULL) { | 571 if (desc != NULL) { |
572 st->print("~"); | 572 st->print("~"); |
573 desc->print(); | 573 desc->print_on(st); |
574 NOT_PRODUCT(begin = desc->code_begin(); end = desc->code_end();) | 574 NOT_PRODUCT(begin = desc->code_begin(); end = desc->code_end();) |
575 } else { | 575 } else { |
576 st->print("~interpreter"); | 576 st->print("~interpreter"); |
577 } | 577 } |
578 } | 578 } |
1334 } | 1334 } |
1335 return false; | 1335 return false; |
1336 } | 1336 } |
1337 #endif | 1337 #endif |
1338 | 1338 |
1339 | |
1340 #ifdef ASSERT | 1339 #ifdef ASSERT |
1341 void frame::interpreter_frame_verify_monitor(BasicObjectLock* value) const { | 1340 void frame::interpreter_frame_verify_monitor(BasicObjectLock* value) const { |
1342 assert(is_interpreted_frame(), "Not an interpreted frame"); | 1341 assert(is_interpreted_frame(), "Not an interpreted frame"); |
1343 // verify that the value is in the right part of the frame | 1342 // verify that the value is in the right part of the frame |
1344 address low_mark = (address) interpreter_frame_monitor_end(); | 1343 address low_mark = (address) interpreter_frame_monitor_end(); |
1350 guarantee( high_mark > current , "Current BasicObjectLock* higher than high_mark"); | 1349 guarantee( high_mark > current , "Current BasicObjectLock* higher than high_mark"); |
1351 | 1350 |
1352 guarantee((current - low_mark) % monitor_size == 0 , "Misaligned bottom of BasicObjectLock*"); | 1351 guarantee((current - low_mark) % monitor_size == 0 , "Misaligned bottom of BasicObjectLock*"); |
1353 guarantee( current >= low_mark , "Current BasicObjectLock* below than low_mark"); | 1352 guarantee( current >= low_mark , "Current BasicObjectLock* below than low_mark"); |
1354 } | 1353 } |
1355 | 1354 #endif |
1356 | 1355 |
1356 #ifndef PRODUCT | |
1357 void frame::describe(FrameValues& values, int frame_no) { | 1357 void frame::describe(FrameValues& values, int frame_no) { |
1358 // boundaries: sp and the 'real' frame pointer | |
1359 values.describe(-1, sp(), err_msg("sp for #%d", frame_no), 1); | |
1360 intptr_t* frame_pointer = real_fp(); // Note: may differ from fp() | |
1361 | |
1362 // print frame info at the highest boundary | |
1363 intptr_t* info_address = MAX2(sp(), frame_pointer); | |
1364 | |
1365 if (info_address != frame_pointer) { | |
1366 // print frame_pointer explicitly if not marked by the frame info | |
1367 values.describe(-1, frame_pointer, err_msg("frame pointer for #%d", frame_no), 1); | |
1368 } | |
1369 | |
1358 if (is_entry_frame() || is_compiled_frame() || is_interpreted_frame() || is_native_frame()) { | 1370 if (is_entry_frame() || is_compiled_frame() || is_interpreted_frame() || is_native_frame()) { |
1359 // Label values common to most frames | 1371 // Label values common to most frames |
1360 values.describe(-1, unextended_sp(), err_msg("unextended_sp for #%d", frame_no)); | 1372 values.describe(-1, unextended_sp(), err_msg("unextended_sp for #%d", frame_no)); |
1361 values.describe(-1, sp(), err_msg("sp for #%d", frame_no)); | 1373 } |
1362 if (is_compiled_frame()) { | 1374 |
1363 values.describe(-1, sp() + _cb->frame_size(), err_msg("computed fp for #%d", frame_no)); | |
1364 } else { | |
1365 values.describe(-1, fp(), err_msg("fp for #%d", frame_no)); | |
1366 } | |
1367 } | |
1368 if (is_interpreted_frame()) { | 1375 if (is_interpreted_frame()) { |
1369 methodOop m = interpreter_frame_method(); | 1376 methodOop m = interpreter_frame_method(); |
1370 int bci = interpreter_frame_bci(); | 1377 int bci = interpreter_frame_bci(); |
1371 | 1378 |
1372 // Label the method and current bci | 1379 // Label the method and current bci |
1373 values.describe(-1, MAX2(sp(), fp()), | 1380 values.describe(-1, info_address, |
1374 FormatBuffer<1024>("#%d method %s @ %d", frame_no, m->name_and_sig_as_C_string(), bci), 2); | 1381 FormatBuffer<1024>("#%d method %s @ %d", frame_no, m->name_and_sig_as_C_string(), bci), 2); |
1375 values.describe(-1, MAX2(sp(), fp()), | 1382 values.describe(-1, info_address, |
1376 err_msg("- %d locals %d max stack", m->max_locals(), m->max_stack()), 1); | 1383 err_msg("- %d locals %d max stack", m->max_locals(), m->max_stack()), 1); |
1377 if (m->max_locals() > 0) { | 1384 if (m->max_locals() > 0) { |
1378 intptr_t* l0 = interpreter_frame_local_at(0); | 1385 intptr_t* l0 = interpreter_frame_local_at(0); |
1379 intptr_t* ln = interpreter_frame_local_at(m->max_locals() - 1); | 1386 intptr_t* ln = interpreter_frame_local_at(m->max_locals() - 1); |
1380 values.describe(-1, MAX2(l0, ln), err_msg("locals for #%d", frame_no), 1); | 1387 values.describe(-1, MAX2(l0, ln), err_msg("locals for #%d", frame_no), 1); |
1402 values.describe(frame_no, (intptr_t*)interpreter_frame_monitor_begin(), "monitors begin"); | 1409 values.describe(frame_no, (intptr_t*)interpreter_frame_monitor_begin(), "monitors begin"); |
1403 values.describe(frame_no, (intptr_t*)interpreter_frame_monitor_end(), "monitors end"); | 1410 values.describe(frame_no, (intptr_t*)interpreter_frame_monitor_end(), "monitors end"); |
1404 } | 1411 } |
1405 } else if (is_entry_frame()) { | 1412 } else if (is_entry_frame()) { |
1406 // For now just label the frame | 1413 // For now just label the frame |
1407 values.describe(-1, MAX2(sp(), fp()), err_msg("#%d entry frame", frame_no), 2); | 1414 values.describe(-1, info_address, err_msg("#%d entry frame", frame_no), 2); |
1408 } else if (is_compiled_frame()) { | 1415 } else if (is_compiled_frame()) { |
1409 // For now just label the frame | 1416 // For now just label the frame |
1410 nmethod* nm = cb()->as_nmethod_or_null(); | 1417 nmethod* nm = cb()->as_nmethod_or_null(); |
1411 values.describe(-1, MAX2(sp(), fp()), | 1418 values.describe(-1, info_address, |
1412 FormatBuffer<1024>("#%d nmethod " INTPTR_FORMAT " for method %s%s", frame_no, | 1419 FormatBuffer<1024>("#%d nmethod " INTPTR_FORMAT " for method %s%s", frame_no, |
1413 nm, nm->method()->name_and_sig_as_C_string(), | 1420 nm, nm->method()->name_and_sig_as_C_string(), |
1414 is_deoptimized_frame() ? " (deoptimized" : ""), 2); | 1421 (_deopt_state == is_deoptimized) ? |
1422 " (deoptimized)" : | |
1423 ((_deopt_state == unknown) ? " (state unknown)" : "")), | |
1424 2); | |
1415 } else if (is_native_frame()) { | 1425 } else if (is_native_frame()) { |
1416 // For now just label the frame | 1426 // For now just label the frame |
1417 nmethod* nm = cb()->as_nmethod_or_null(); | 1427 nmethod* nm = cb()->as_nmethod_or_null(); |
1418 values.describe(-1, MAX2(sp(), fp()), | 1428 values.describe(-1, info_address, |
1419 FormatBuffer<1024>("#%d nmethod " INTPTR_FORMAT " for native method %s", frame_no, | 1429 FormatBuffer<1024>("#%d nmethod " INTPTR_FORMAT " for native method %s", frame_no, |
1420 nm, nm->method()->name_and_sig_as_C_string()), 2); | 1430 nm, nm->method()->name_and_sig_as_C_string()), 2); |
1421 } | 1431 } else if (is_ricochet_frame()) { |
1432 values.describe(-1, info_address, err_msg("#%d ricochet frame", frame_no), 2); | |
1433 } else { | |
1434 // provide default info if not handled before | |
1435 char *info = (char *) "special frame"; | |
1436 if ((_cb != NULL) && | |
1437 (_cb->name() != NULL)) { | |
1438 info = (char *)_cb->name(); | |
1439 } | |
1440 values.describe(-1, info_address, err_msg("#%d <%s>", frame_no, info), 2); | |
1441 } | |
1442 | |
1443 // platform dependent additional data | |
1422 describe_pd(values, frame_no); | 1444 describe_pd(values, frame_no); |
1423 } | 1445 } |
1424 | 1446 |
1425 #endif | 1447 #endif |
1426 | 1448 |
1433 _fr = thread->last_frame(); | 1455 _fr = thread->last_frame(); |
1434 _is_done = false; | 1456 _is_done = false; |
1435 } | 1457 } |
1436 | 1458 |
1437 | 1459 |
1438 #ifdef ASSERT | 1460 #ifndef PRODUCT |
1439 | 1461 |
1440 void FrameValues::describe(int owner, intptr_t* location, const char* description, int priority) { | 1462 void FrameValues::describe(int owner, intptr_t* location, const char* description, int priority) { |
1441 FrameValue fv; | 1463 FrameValue fv; |
1442 fv.location = location; | 1464 fv.location = location; |
1443 fv.owner = owner; | 1465 fv.owner = owner; |
1446 strcpy(fv.description, description); | 1468 strcpy(fv.description, description); |
1447 _values.append(fv); | 1469 _values.append(fv); |
1448 } | 1470 } |
1449 | 1471 |
1450 | 1472 |
1473 #ifdef ASSERT | |
1451 void FrameValues::validate() { | 1474 void FrameValues::validate() { |
1452 _values.sort(compare); | 1475 _values.sort(compare); |
1453 bool error = false; | 1476 bool error = false; |
1454 FrameValue prev; | 1477 FrameValue prev; |
1455 prev.owner = -1; | 1478 prev.owner = -1; |
1471 prev = fv; | 1494 prev = fv; |
1472 } | 1495 } |
1473 } | 1496 } |
1474 assert(!error, "invalid layout"); | 1497 assert(!error, "invalid layout"); |
1475 } | 1498 } |
1476 | 1499 #endif // ASSERT |
1477 | 1500 |
1478 void FrameValues::print(JavaThread* thread) { | 1501 void FrameValues::print(JavaThread* thread) { |
1479 _values.sort(compare); | 1502 _values.sort(compare); |
1480 | 1503 |
1481 // Sometimes values like the fp can be invalid values if the | 1504 // Sometimes values like the fp can be invalid values if the |
1520 cur--; | 1543 cur--; |
1521 } | 1544 } |
1522 } | 1545 } |
1523 } | 1546 } |
1524 | 1547 |
1525 #endif | 1548 #endif // ndef PRODUCT |