Mercurial > hg > truffle
comparison src/cpu/sparc/vm/macroAssembler_sparc.cpp @ 8767:a5de0cc2f91c
8008555: Debugging code in compiled method sometimes leaks memory
Summary: support for strings that have same life-time as code that uses them.
Reviewed-by: kvn, twisti
author | roland |
---|---|
date | Mon, 18 Mar 2013 13:19:06 +0100 |
parents | db9981fd3124 |
children | 8d52e305a777 |
comparison
equal
deleted
inserted
replaced
8765:592f9722c72e | 8767:a5de0cc2f91c |
---|---|
1383 snprintf(buffer, sizeof(buffer), "verify_oop at %d", offset()); | 1383 snprintf(buffer, sizeof(buffer), "verify_oop at %d", offset()); |
1384 block_comment(buffer); | 1384 block_comment(buffer); |
1385 } | 1385 } |
1386 #endif | 1386 #endif |
1387 | 1387 |
1388 int len = strlen(file) + strlen(msg) + 1 + 4; | 1388 const char* real_msg = NULL; |
1389 sprintf(buffer, "%d", line); | 1389 { |
1390 len += strlen(buffer); | 1390 ResourceMark rm; |
1391 sprintf(buffer, " at offset %d ", offset()); | 1391 stringStream ss; |
1392 len += strlen(buffer); | 1392 ss.print("%s at offset %d (%s:%d)", msg, offset(), file, line); |
1393 char * real_msg = new char[len]; | 1393 real_msg = code_string(ss.as_string()); |
1394 sprintf(real_msg, "%s%s(%s:%d)", msg, buffer, file, line); | 1394 } |
1395 | 1395 |
1396 // Call indirectly to solve generation ordering problem | 1396 // Call indirectly to solve generation ordering problem |
1397 AddressLiteral a(StubRoutines::verify_oop_subroutine_entry_address()); | 1397 AddressLiteral a(StubRoutines::verify_oop_subroutine_entry_address()); |
1398 | 1398 |
1399 // Make some space on stack above the current register window. | 1399 // Make some space on stack above the current register window. |
1421 | 1421 |
1422 void MacroAssembler::_verify_oop_addr(Address addr, const char* msg, const char * file, int line) { | 1422 void MacroAssembler::_verify_oop_addr(Address addr, const char* msg, const char * file, int line) { |
1423 // plausibility check for oops | 1423 // plausibility check for oops |
1424 if (!VerifyOops) return; | 1424 if (!VerifyOops) return; |
1425 | 1425 |
1426 char buffer[64]; | 1426 const char* real_msg = NULL; |
1427 sprintf(buffer, "%d", line); | 1427 { |
1428 int len = strlen(file) + strlen(msg) + 1 + 4 + strlen(buffer); | 1428 ResourceMark rm; |
1429 sprintf(buffer, " at SP+%d ", addr.disp()); | 1429 stringStream ss; |
1430 len += strlen(buffer); | 1430 ss.print("%s at SP+%d (%s:%d)", msg, addr.disp(), file, line); |
1431 char * real_msg = new char[len]; | 1431 real_msg = code_string(ss.as_string()); |
1432 sprintf(real_msg, "%s at SP+%d (%s:%d)", msg, addr.disp(), file, line); | 1432 } |
1433 | 1433 |
1434 // Call indirectly to solve generation ordering problem | 1434 // Call indirectly to solve generation ordering problem |
1435 AddressLiteral a(StubRoutines::verify_oop_subroutine_entry_address()); | 1435 AddressLiteral a(StubRoutines::verify_oop_subroutine_entry_address()); |
1436 | 1436 |
1437 // Make some space on stack above the current register window. | 1437 // Make some space on stack above the current register window. |
1620 void MacroAssembler::untested(const char* what) { | 1620 void MacroAssembler::untested(const char* what) { |
1621 // We must be able to turn interactive prompting off | 1621 // We must be able to turn interactive prompting off |
1622 // in order to run automated test scripts on the VM | 1622 // in order to run automated test scripts on the VM |
1623 // Use the flag ShowMessageBoxOnError | 1623 // Use the flag ShowMessageBoxOnError |
1624 | 1624 |
1625 char* b = new char[1024]; | 1625 const char* b = NULL; |
1626 sprintf(b, "untested: %s", what); | 1626 { |
1627 | 1627 ResourceMark rm; |
1628 stringStream ss; | |
1629 ss.print("untested: %s", what); | |
1630 b = code_string(ss.as_string()); | |
1631 } | |
1628 if (ShowMessageBoxOnError) { STOP(b); } | 1632 if (ShowMessageBoxOnError) { STOP(b); } |
1629 else { warn(b); } | 1633 else { warn(b); } |
1630 } | 1634 } |
1631 | 1635 |
1632 | 1636 |