mirror of
https://github.com/openjdk/jdk.git
synced 2025-08-26 14:24:46 +02:00
8008555: Debugging code in compiled method sometimes leaks memory
Support for strings that have same life-time as code that uses them. Reviewed-by: kvn, twisti
This commit is contained in:
parent
d824b431de
commit
8f1814d874
16 changed files with 174 additions and 121 deletions
|
@ -1385,13 +1385,13 @@ void MacroAssembler::_verify_oop(Register reg, const char* msg, const char * fil
|
|||
}
|
||||
#endif
|
||||
|
||||
int len = strlen(file) + strlen(msg) + 1 + 4;
|
||||
sprintf(buffer, "%d", line);
|
||||
len += strlen(buffer);
|
||||
sprintf(buffer, " at offset %d ", offset());
|
||||
len += strlen(buffer);
|
||||
char * real_msg = new char[len];
|
||||
sprintf(real_msg, "%s%s(%s:%d)", msg, buffer, file, line);
|
||||
const char* real_msg = NULL;
|
||||
{
|
||||
ResourceMark rm;
|
||||
stringStream ss;
|
||||
ss.print("%s at offset %d (%s:%d)", msg, offset(), file, line);
|
||||
real_msg = code_string(ss.as_string());
|
||||
}
|
||||
|
||||
// Call indirectly to solve generation ordering problem
|
||||
AddressLiteral a(StubRoutines::verify_oop_subroutine_entry_address());
|
||||
|
@ -1423,13 +1423,13 @@ void MacroAssembler::_verify_oop_addr(Address addr, const char* msg, const char
|
|||
// plausibility check for oops
|
||||
if (!VerifyOops) return;
|
||||
|
||||
char buffer[64];
|
||||
sprintf(buffer, "%d", line);
|
||||
int len = strlen(file) + strlen(msg) + 1 + 4 + strlen(buffer);
|
||||
sprintf(buffer, " at SP+%d ", addr.disp());
|
||||
len += strlen(buffer);
|
||||
char * real_msg = new char[len];
|
||||
sprintf(real_msg, "%s at SP+%d (%s:%d)", msg, addr.disp(), file, line);
|
||||
const char* real_msg = NULL;
|
||||
{
|
||||
ResourceMark rm;
|
||||
stringStream ss;
|
||||
ss.print("%s at SP+%d (%s:%d)", msg, addr.disp(), file, line);
|
||||
real_msg = code_string(ss.as_string());
|
||||
}
|
||||
|
||||
// Call indirectly to solve generation ordering problem
|
||||
AddressLiteral a(StubRoutines::verify_oop_subroutine_entry_address());
|
||||
|
@ -1622,9 +1622,13 @@ void MacroAssembler::untested(const char* what) {
|
|||
// in order to run automated test scripts on the VM
|
||||
// Use the flag ShowMessageBoxOnError
|
||||
|
||||
char* b = new char[1024];
|
||||
sprintf(b, "untested: %s", what);
|
||||
|
||||
const char* b = NULL;
|
||||
{
|
||||
ResourceMark rm;
|
||||
stringStream ss;
|
||||
ss.print("untested: %s", what);
|
||||
b = code_string(ss.as_string());
|
||||
}
|
||||
if (ShowMessageBoxOnError) { STOP(b); }
|
||||
else { warn(b); }
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue