Mercurial > hg > truffle
comparison src/share/vm/runtime/frame.cpp @ 3360:30d3b13f1938
Merge
author | ysr |
---|---|
date | Thu, 12 May 2011 15:05:22 -0700 |
parents | 2e038ad0c1d0 |
children | 167b70ff3abc |
comparison
equal
deleted
inserted
replaced
3359:7d64aa23eb96 | 3360:30d3b13f1938 |
---|---|
1306 guarantee( high_mark > current , "Current BasicObjectLock* higher than high_mark"); | 1306 guarantee( high_mark > current , "Current BasicObjectLock* higher than high_mark"); |
1307 | 1307 |
1308 guarantee((current - low_mark) % monitor_size == 0 , "Misaligned bottom of BasicObjectLock*"); | 1308 guarantee((current - low_mark) % monitor_size == 0 , "Misaligned bottom of BasicObjectLock*"); |
1309 guarantee( current >= low_mark , "Current BasicObjectLock* below than low_mark"); | 1309 guarantee( current >= low_mark , "Current BasicObjectLock* below than low_mark"); |
1310 } | 1310 } |
1311 | |
1312 | |
1313 void frame::describe(FrameValues& values, int frame_no) { | |
1314 if (is_entry_frame() || is_compiled_frame() || is_interpreted_frame() || is_native_frame()) { | |
1315 // Label values common to most frames | |
1316 values.describe(-1, unextended_sp(), err_msg("unextended_sp for #%d", frame_no)); | |
1317 values.describe(-1, sp(), err_msg("sp for #%d", frame_no)); | |
1318 values.describe(-1, fp(), err_msg("fp for #%d", frame_no)); | |
1319 } | |
1320 if (is_interpreted_frame()) { | |
1321 methodOop m = interpreter_frame_method(); | |
1322 int bci = interpreter_frame_bci(); | |
1323 | |
1324 // Label the method and current bci | |
1325 values.describe(-1, MAX2(sp(), fp()), | |
1326 FormatBuffer<1024>("#%d method %s @ %d", frame_no, m->name_and_sig_as_C_string(), bci), 2); | |
1327 values.describe(-1, MAX2(sp(), fp()), | |
1328 err_msg("- %d locals %d max stack", m->max_locals(), m->max_stack()), 1); | |
1329 if (m->max_locals() > 0) { | |
1330 intptr_t* l0 = interpreter_frame_local_at(0); | |
1331 intptr_t* ln = interpreter_frame_local_at(m->max_locals() - 1); | |
1332 values.describe(-1, MAX2(l0, ln), err_msg("locals for #%d", frame_no), 1); | |
1333 // Report each local and mark as owned by this frame | |
1334 for (int l = 0; l < m->max_locals(); l++) { | |
1335 intptr_t* l0 = interpreter_frame_local_at(l); | |
1336 values.describe(frame_no, l0, err_msg("local %d", l)); | |
1337 } | |
1338 } | |
1339 | |
1340 // Compute the actual expression stack size | |
1341 InterpreterOopMap mask; | |
1342 OopMapCache::compute_one_oop_map(m, bci, &mask); | |
1343 intptr_t* tos = NULL; | |
1344 // Report each stack element and mark as owned by this frame | |
1345 for (int e = 0; e < mask.expression_stack_size(); e++) { | |
1346 tos = MAX2(tos, interpreter_frame_expression_stack_at(e)); | |
1347 values.describe(frame_no, interpreter_frame_expression_stack_at(e), | |
1348 err_msg("stack %d", e)); | |
1349 } | |
1350 if (tos != NULL) { | |
1351 values.describe(-1, tos, err_msg("expression stack for #%d", frame_no), 1); | |
1352 } | |
1353 if (interpreter_frame_monitor_begin() != interpreter_frame_monitor_end()) { | |
1354 values.describe(frame_no, (intptr_t*)interpreter_frame_monitor_begin(), "monitors begin"); | |
1355 values.describe(frame_no, (intptr_t*)interpreter_frame_monitor_end(), "monitors end"); | |
1356 } | |
1357 } else if (is_entry_frame()) { | |
1358 // For now just label the frame | |
1359 values.describe(-1, MAX2(sp(), fp()), err_msg("#%d entry frame", frame_no), 2); | |
1360 } else if (is_compiled_frame()) { | |
1361 // For now just label the frame | |
1362 nmethod* nm = cb()->as_nmethod_or_null(); | |
1363 values.describe(-1, MAX2(sp(), fp()), | |
1364 FormatBuffer<1024>("#%d nmethod " INTPTR_FORMAT " for method %s%s", frame_no, | |
1365 nm, nm->method()->name_and_sig_as_C_string(), | |
1366 is_deoptimized_frame() ? " (deoptimized" : ""), 2); | |
1367 } else if (is_native_frame()) { | |
1368 // For now just label the frame | |
1369 nmethod* nm = cb()->as_nmethod_or_null(); | |
1370 values.describe(-1, MAX2(sp(), fp()), | |
1371 FormatBuffer<1024>("#%d nmethod " INTPTR_FORMAT " for native method %s", frame_no, | |
1372 nm, nm->method()->name_and_sig_as_C_string()), 2); | |
1373 } | |
1374 describe_pd(values, frame_no); | |
1375 } | |
1376 | |
1311 #endif | 1377 #endif |
1312 | 1378 |
1313 | 1379 |
1314 //----------------------------------------------------------------------------------- | 1380 //----------------------------------------------------------------------------------- |
1315 // StackFrameStream implementation | 1381 // StackFrameStream implementation |
1317 StackFrameStream::StackFrameStream(JavaThread *thread, bool update) : _reg_map(thread, update) { | 1383 StackFrameStream::StackFrameStream(JavaThread *thread, bool update) : _reg_map(thread, update) { |
1318 assert(thread->has_last_Java_frame(), "sanity check"); | 1384 assert(thread->has_last_Java_frame(), "sanity check"); |
1319 _fr = thread->last_frame(); | 1385 _fr = thread->last_frame(); |
1320 _is_done = false; | 1386 _is_done = false; |
1321 } | 1387 } |
1388 | |
1389 | |
1390 #ifdef ASSERT | |
1391 | |
1392 void FrameValues::describe(int owner, intptr_t* location, const char* description, int priority) { | |
1393 FrameValue fv; | |
1394 fv.location = location; | |
1395 fv.owner = owner; | |
1396 fv.priority = priority; | |
1397 fv.description = NEW_RESOURCE_ARRAY(char, strlen(description) + 1); | |
1398 strcpy(fv.description, description); | |
1399 _values.append(fv); | |
1400 } | |
1401 | |
1402 | |
1403 bool FrameValues::validate() { | |
1404 _values.sort(compare); | |
1405 bool error = false; | |
1406 FrameValue prev; | |
1407 prev.owner = -1; | |
1408 for (int i = _values.length() - 1; i >= 0; i--) { | |
1409 FrameValue fv = _values.at(i); | |
1410 if (fv.owner == -1) continue; | |
1411 if (prev.owner == -1) { | |
1412 prev = fv; | |
1413 continue; | |
1414 } | |
1415 if (prev.location == fv.location) { | |
1416 if (fv.owner != prev.owner) { | |
1417 tty->print_cr("overlapping storage"); | |
1418 tty->print_cr(" " INTPTR_FORMAT ": " INTPTR_FORMAT " %s", prev.location, *prev.location, prev.description); | |
1419 tty->print_cr(" " INTPTR_FORMAT ": " INTPTR_FORMAT " %s", fv.location, *fv.location, fv.description); | |
1420 error = true; | |
1421 } | |
1422 } else { | |
1423 prev = fv; | |
1424 } | |
1425 } | |
1426 return error; | |
1427 } | |
1428 | |
1429 | |
1430 void FrameValues::print() { | |
1431 _values.sort(compare); | |
1432 intptr_t* v0 = _values.at(0).location; | |
1433 intptr_t* v1 = _values.at(_values.length() - 1).location; | |
1434 intptr_t* min = MIN2(v0, v1); | |
1435 intptr_t* max = MAX2(v0, v1); | |
1436 intptr_t* cur = max; | |
1437 intptr_t* last = NULL; | |
1438 for (int i = _values.length() - 1; i >= 0; i--) { | |
1439 FrameValue fv = _values.at(i); | |
1440 while (cur > fv.location) { | |
1441 tty->print_cr(" " INTPTR_FORMAT ": " INTPTR_FORMAT, cur, *cur); | |
1442 cur--; | |
1443 } | |
1444 if (last == fv.location) { | |
1445 const char* spacer = " " LP64_ONLY(" "); | |
1446 tty->print_cr(" %s %s %s", spacer, spacer, fv.description); | |
1447 } else { | |
1448 tty->print_cr(" " INTPTR_FORMAT ": " INTPTR_FORMAT " %s", fv.location, *fv.location, fv.description); | |
1449 last = fv.location; | |
1450 cur--; | |
1451 } | |
1452 } | |
1453 } | |
1454 | |
1455 #endif |