comparison src/share/vm/runtime/frame.cpp @ 4840:0a10d80352d5

Merge
author brutisso
date Fri, 27 Jan 2012 09:04:57 +0100
parents 5dbed2f542ff
children aa3d708d67c4
comparison
equal deleted inserted replaced
4839:b4ebad3520bb 4840:0a10d80352d5
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.
1313 } 1313 }
1314 return false; 1314 return false;
1315 } 1315 }
1316 #endif 1316 #endif
1317 1317
1318
1319 #ifdef ASSERT 1318 #ifdef ASSERT
1320 void frame::interpreter_frame_verify_monitor(BasicObjectLock* value) const { 1319 void frame::interpreter_frame_verify_monitor(BasicObjectLock* value) const {
1321 assert(is_interpreted_frame(), "Not an interpreted frame"); 1320 assert(is_interpreted_frame(), "Not an interpreted frame");
1322 // verify that the value is in the right part of the frame 1321 // verify that the value is in the right part of the frame
1323 address low_mark = (address) interpreter_frame_monitor_end(); 1322 address low_mark = (address) interpreter_frame_monitor_end();
1329 guarantee( high_mark > current , "Current BasicObjectLock* higher than high_mark"); 1328 guarantee( high_mark > current , "Current BasicObjectLock* higher than high_mark");
1330 1329
1331 guarantee((current - low_mark) % monitor_size == 0 , "Misaligned bottom of BasicObjectLock*"); 1330 guarantee((current - low_mark) % monitor_size == 0 , "Misaligned bottom of BasicObjectLock*");
1332 guarantee( current >= low_mark , "Current BasicObjectLock* below than low_mark"); 1331 guarantee( current >= low_mark , "Current BasicObjectLock* below than low_mark");
1333 } 1332 }
1334 1333 #endif
1335 1334
1335 #ifndef PRODUCT
1336 void frame::describe(FrameValues& values, int frame_no) { 1336 void frame::describe(FrameValues& values, int frame_no) {
1337 // boundaries: sp and the 'real' frame pointer
1338 values.describe(-1, sp(), err_msg("sp for #%d", frame_no), 1);
1339 intptr_t* frame_pointer = real_fp(); // Note: may differ from fp()
1340
1341 // print frame info at the highest boundary
1342 intptr_t* info_address = MAX2(sp(), frame_pointer);
1343
1344 if (info_address != frame_pointer) {
1345 // print frame_pointer explicitly if not marked by the frame info
1346 values.describe(-1, frame_pointer, err_msg("frame pointer for #%d", frame_no), 1);
1347 }
1348
1337 if (is_entry_frame() || is_compiled_frame() || is_interpreted_frame() || is_native_frame()) { 1349 if (is_entry_frame() || is_compiled_frame() || is_interpreted_frame() || is_native_frame()) {
1338 // Label values common to most frames 1350 // Label values common to most frames
1339 values.describe(-1, unextended_sp(), err_msg("unextended_sp for #%d", frame_no)); 1351 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)); 1352 }
1341 if (is_compiled_frame()) { 1353
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()) { 1354 if (is_interpreted_frame()) {
1348 methodOop m = interpreter_frame_method(); 1355 methodOop m = interpreter_frame_method();
1349 int bci = interpreter_frame_bci(); 1356 int bci = interpreter_frame_bci();
1350 1357
1351 // Label the method and current bci 1358 // Label the method and current bci
1352 values.describe(-1, MAX2(sp(), fp()), 1359 values.describe(-1, info_address,
1353 FormatBuffer<1024>("#%d method %s @ %d", frame_no, m->name_and_sig_as_C_string(), bci), 2); 1360 FormatBuffer<1024>("#%d method %s @ %d", frame_no, m->name_and_sig_as_C_string(), bci), 2);
1354 values.describe(-1, MAX2(sp(), fp()), 1361 values.describe(-1, info_address,
1355 err_msg("- %d locals %d max stack", m->max_locals(), m->max_stack()), 1); 1362 err_msg("- %d locals %d max stack", m->max_locals(), m->max_stack()), 1);
1356 if (m->max_locals() > 0) { 1363 if (m->max_locals() > 0) {
1357 intptr_t* l0 = interpreter_frame_local_at(0); 1364 intptr_t* l0 = interpreter_frame_local_at(0);
1358 intptr_t* ln = interpreter_frame_local_at(m->max_locals() - 1); 1365 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); 1366 values.describe(-1, MAX2(l0, ln), err_msg("locals for #%d", frame_no), 1);
1381 values.describe(frame_no, (intptr_t*)interpreter_frame_monitor_begin(), "monitors begin"); 1388 values.describe(frame_no, (intptr_t*)interpreter_frame_monitor_begin(), "monitors begin");
1382 values.describe(frame_no, (intptr_t*)interpreter_frame_monitor_end(), "monitors end"); 1389 values.describe(frame_no, (intptr_t*)interpreter_frame_monitor_end(), "monitors end");
1383 } 1390 }
1384 } else if (is_entry_frame()) { 1391 } else if (is_entry_frame()) {
1385 // For now just label the frame 1392 // For now just label the frame
1386 values.describe(-1, MAX2(sp(), fp()), err_msg("#%d entry frame", frame_no), 2); 1393 values.describe(-1, info_address, err_msg("#%d entry frame", frame_no), 2);
1387 } else if (is_compiled_frame()) { 1394 } else if (is_compiled_frame()) {
1388 // For now just label the frame 1395 // For now just label the frame
1389 nmethod* nm = cb()->as_nmethod_or_null(); 1396 nmethod* nm = cb()->as_nmethod_or_null();
1390 values.describe(-1, MAX2(sp(), fp()), 1397 values.describe(-1, info_address,
1391 FormatBuffer<1024>("#%d nmethod " INTPTR_FORMAT " for method %s%s", frame_no, 1398 FormatBuffer<1024>("#%d nmethod " INTPTR_FORMAT " for method %s%s", frame_no,
1392 nm, nm->method()->name_and_sig_as_C_string(), 1399 nm, nm->method()->name_and_sig_as_C_string(),
1393 is_deoptimized_frame() ? " (deoptimized" : ""), 2); 1400 (_deopt_state == is_deoptimized) ?
1401 " (deoptimized)" :
1402 ((_deopt_state == unknown) ? " (state unknown)" : "")),
1403 2);
1394 } else if (is_native_frame()) { 1404 } else if (is_native_frame()) {
1395 // For now just label the frame 1405 // For now just label the frame
1396 nmethod* nm = cb()->as_nmethod_or_null(); 1406 nmethod* nm = cb()->as_nmethod_or_null();
1397 values.describe(-1, MAX2(sp(), fp()), 1407 values.describe(-1, info_address,
1398 FormatBuffer<1024>("#%d nmethod " INTPTR_FORMAT " for native method %s", frame_no, 1408 FormatBuffer<1024>("#%d nmethod " INTPTR_FORMAT " for native method %s", frame_no,
1399 nm, nm->method()->name_and_sig_as_C_string()), 2); 1409 nm, nm->method()->name_and_sig_as_C_string()), 2);
1400 } 1410 } else if (is_ricochet_frame()) {
1411 values.describe(-1, info_address, err_msg("#%d ricochet frame", frame_no), 2);
1412 } else {
1413 // provide default info if not handled before
1414 char *info = (char *) "special frame";
1415 if ((_cb != NULL) &&
1416 (_cb->name() != NULL)) {
1417 info = (char *)_cb->name();
1418 }
1419 values.describe(-1, info_address, err_msg("#%d <%s>", frame_no, info), 2);
1420 }
1421
1422 // platform dependent additional data
1401 describe_pd(values, frame_no); 1423 describe_pd(values, frame_no);
1402 } 1424 }
1403 1425
1404 #endif 1426 #endif
1405 1427
1412 _fr = thread->last_frame(); 1434 _fr = thread->last_frame();
1413 _is_done = false; 1435 _is_done = false;
1414 } 1436 }
1415 1437
1416 1438
1417 #ifdef ASSERT 1439 #ifndef PRODUCT
1418 1440
1419 void FrameValues::describe(int owner, intptr_t* location, const char* description, int priority) { 1441 void FrameValues::describe(int owner, intptr_t* location, const char* description, int priority) {
1420 FrameValue fv; 1442 FrameValue fv;
1421 fv.location = location; 1443 fv.location = location;
1422 fv.owner = owner; 1444 fv.owner = owner;
1425 strcpy(fv.description, description); 1447 strcpy(fv.description, description);
1426 _values.append(fv); 1448 _values.append(fv);
1427 } 1449 }
1428 1450
1429 1451
1452 #ifdef ASSERT
1430 void FrameValues::validate() { 1453 void FrameValues::validate() {
1431 _values.sort(compare); 1454 _values.sort(compare);
1432 bool error = false; 1455 bool error = false;
1433 FrameValue prev; 1456 FrameValue prev;
1434 prev.owner = -1; 1457 prev.owner = -1;
1450 prev = fv; 1473 prev = fv;
1451 } 1474 }
1452 } 1475 }
1453 assert(!error, "invalid layout"); 1476 assert(!error, "invalid layout");
1454 } 1477 }
1455 1478 #endif // ASSERT
1456 1479
1457 void FrameValues::print(JavaThread* thread) { 1480 void FrameValues::print(JavaThread* thread) {
1458 _values.sort(compare); 1481 _values.sort(compare);
1459 1482
1460 // Sometimes values like the fp can be invalid values if the 1483 // Sometimes values like the fp can be invalid values if the
1499 cur--; 1522 cur--;
1500 } 1523 }
1501 } 1524 }
1502 } 1525 }
1503 1526
1504 #endif 1527 #endif // ndef PRODUCT