src/share/vm/asm/assembler.cpp

Print this page
rev 4202 : 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:


 267   if (val != 0)  return val + offset;
 268   return delayed_value_impl(delayed_value_addr(value_fn), tmp, offset);
 269 }
 270 RegisterOrConstant AbstractAssembler::delayed_value(address(*value_fn)(), Register tmp, int offset) {
 271   intptr_t val = (intptr_t) (*value_fn)();
 272   if (val != 0)  return val + offset;
 273   return delayed_value_impl(delayed_value_addr(value_fn), tmp, offset);
 274 }
 275 intptr_t* AbstractAssembler::delayed_value_addr(int(*value_fn)()) {
 276   DelayedConstant* dcon = DelayedConstant::add(T_INT, (DelayedConstant::value_fn_t) value_fn);
 277   return &dcon->value;
 278 }
 279 intptr_t* AbstractAssembler::delayed_value_addr(address(*value_fn)()) {
 280   DelayedConstant* dcon = DelayedConstant::add(T_ADDRESS, (DelayedConstant::value_fn_t) value_fn);
 281   return &dcon->value;
 282 }
 283 void AbstractAssembler::update_delayed_values() {
 284   DelayedConstant::update_all();
 285 }
 286 
 287 
 288 
 289 
 290 void AbstractAssembler::block_comment(const char* comment) {
 291   if (sect() == CodeBuffer::SECT_INSTS) {
 292     code_section()->outer()->block_comment(offset(), comment);
 293   }







 294 }
 295 
 296 bool MacroAssembler::needs_explicit_null_check(intptr_t offset) {
 297   // Exception handler checks the nmethod's implicit null checks table
 298   // only when this method returns false.
 299 #ifdef _LP64
 300   if (UseCompressedOops && Universe::narrow_oop_base() != NULL) {
 301     assert (Universe::heap() != NULL, "java heap should be initialized");
 302     // The first page after heap_base is unmapped and
 303     // the 'offset' is equal to [heap_base + offset] for
 304     // narrow oop implicit null checks.
 305     uintptr_t base = (uintptr_t)Universe::narrow_oop_base();
 306     if ((uintptr_t)offset >= base) {
 307       // Normalize offset for the next check.
 308       offset = (intptr_t)(pointer_delta((void*)offset, (void*)base, 1));
 309     }
 310   }
 311 #endif
 312   return offset < 0 || os::vm_page_size() <= offset;
 313 }


 267   if (val != 0)  return val + offset;
 268   return delayed_value_impl(delayed_value_addr(value_fn), tmp, offset);
 269 }
 270 RegisterOrConstant AbstractAssembler::delayed_value(address(*value_fn)(), Register tmp, int offset) {
 271   intptr_t val = (intptr_t) (*value_fn)();
 272   if (val != 0)  return val + offset;
 273   return delayed_value_impl(delayed_value_addr(value_fn), tmp, offset);
 274 }
 275 intptr_t* AbstractAssembler::delayed_value_addr(int(*value_fn)()) {
 276   DelayedConstant* dcon = DelayedConstant::add(T_INT, (DelayedConstant::value_fn_t) value_fn);
 277   return &dcon->value;
 278 }
 279 intptr_t* AbstractAssembler::delayed_value_addr(address(*value_fn)()) {
 280   DelayedConstant* dcon = DelayedConstant::add(T_ADDRESS, (DelayedConstant::value_fn_t) value_fn);
 281   return &dcon->value;
 282 }
 283 void AbstractAssembler::update_delayed_values() {
 284   DelayedConstant::update_all();
 285 }
 286 



 287 void AbstractAssembler::block_comment(const char* comment) {
 288   if (sect() == CodeBuffer::SECT_INSTS) {
 289     code_section()->outer()->block_comment(offset(), comment);
 290   }
 291 }
 292 
 293 const char* AbstractAssembler::code_string(const char* str) {
 294   if (sect() == CodeBuffer::SECT_INSTS || sect() == CodeBuffer::SECT_STUBS) {
 295     return code_section()->outer()->code_string(str);
 296   }
 297   return NULL;
 298 }
 299 
 300 bool MacroAssembler::needs_explicit_null_check(intptr_t offset) {
 301   // Exception handler checks the nmethod's implicit null checks table
 302   // only when this method returns false.
 303 #ifdef _LP64
 304   if (UseCompressedOops && Universe::narrow_oop_base() != NULL) {
 305     assert (Universe::heap() != NULL, "java heap should be initialized");
 306     // The first page after heap_base is unmapped and
 307     // the 'offset' is equal to [heap_base + offset] for
 308     // narrow oop implicit null checks.
 309     uintptr_t base = (uintptr_t)Universe::narrow_oop_base();
 310     if ((uintptr_t)offset >= base) {
 311       // Normalize offset for the next check.
 312       offset = (intptr_t)(pointer_delta((void*)offset, (void*)base, 1));
 313     }
 314   }
 315 #endif
 316   return offset < 0 || os::vm_page_size() <= offset;
 317 }