comparison src/cpu/x86/vm/macroAssembler_x86.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 91a23b11d8dc
children e961c11b85fe
comparison
equal deleted inserted replaced
8765:592f9722c72e 8767:a5de0cc2f91c
4260 4260
4261 void MacroAssembler::verify_oop(Register reg, const char* s) { 4261 void MacroAssembler::verify_oop(Register reg, const char* s) {
4262 if (!VerifyOops) return; 4262 if (!VerifyOops) return;
4263 4263
4264 // Pass register number to verify_oop_subroutine 4264 // Pass register number to verify_oop_subroutine
4265 char* b = new char[strlen(s) + 50]; 4265 const char* b = NULL;
4266 sprintf(b, "verify_oop: %s: %s", reg->name(), s); 4266 {
4267 ResourceMark rm;
4268 stringStream ss;
4269 ss.print("verify_oop: %s: %s", reg->name(), s);
4270 b = code_string(ss.as_string());
4271 }
4267 BLOCK_COMMENT("verify_oop {"); 4272 BLOCK_COMMENT("verify_oop {");
4268 #ifdef _LP64 4273 #ifdef _LP64
4269 push(rscratch1); // save r10, trashed by movptr() 4274 push(rscratch1); // save r10, trashed by movptr()
4270 #endif 4275 #endif
4271 push(rax); // save rax, 4276 push(rax); // save rax,
4295 4300
4296 #ifdef ASSERT 4301 #ifdef ASSERT
4297 { Label L; 4302 { Label L;
4298 testptr(tmp, tmp); 4303 testptr(tmp, tmp);
4299 if (WizardMode) { 4304 if (WizardMode) {
4305 const char* buf = NULL;
4306 {
4307 ResourceMark rm;
4308 stringStream ss;
4309 ss.print("DelayedValue="INTPTR_FORMAT, delayed_value_addr[1]);
4310 buf = code_string(ss.as_string());
4311 }
4300 jcc(Assembler::notZero, L); 4312 jcc(Assembler::notZero, L);
4301 char* buf = new char[40];
4302 sprintf(buf, "DelayedValue="INTPTR_FORMAT, delayed_value_addr[1]);
4303 STOP(buf); 4313 STOP(buf);
4304 } else { 4314 } else {
4305 jccb(Assembler::notZero, L); 4315 jccb(Assembler::notZero, L);
4306 hlt(); 4316 hlt();
4307 } 4317 }
4341 void MacroAssembler::verify_oop_addr(Address addr, const char* s) { 4351 void MacroAssembler::verify_oop_addr(Address addr, const char* s) {
4342 if (!VerifyOops) return; 4352 if (!VerifyOops) return;
4343 4353
4344 // Address adjust(addr.base(), addr.index(), addr.scale(), addr.disp() + BytesPerWord); 4354 // Address adjust(addr.base(), addr.index(), addr.scale(), addr.disp() + BytesPerWord);
4345 // Pass register number to verify_oop_subroutine 4355 // Pass register number to verify_oop_subroutine
4346 char* b = new char[strlen(s) + 50]; 4356 const char* b = NULL;
4347 sprintf(b, "verify_oop_addr: %s", s); 4357 {
4348 4358 ResourceMark rm;
4359 stringStream ss;
4360 ss.print("verify_oop_addr: %s", s);
4361 b = code_string(ss.as_string());
4362 }
4349 #ifdef _LP64 4363 #ifdef _LP64
4350 push(rscratch1); // save r10, trashed by movptr() 4364 push(rscratch1); // save r10, trashed by movptr()
4351 #endif 4365 #endif
4352 push(rax); // save rax, 4366 push(rax); // save rax,
4353 // addr may contain rsp so we will have to adjust it based on the push 4367 // addr may contain rsp so we will have to adjust it based on the push