src/share/vm/asm/codeBuffer.cpp
Index Unified diffs Context diffs Sdiffs Patch New Old Previous File Next File hotspot Sdiff src/share/vm/asm

src/share/vm/asm/codeBuffer.cpp

Print this page




 288     if (index() == CodeBuffer::locator_sect(loc)) {
 289       return start() + CodeBuffer::locator_pos(loc);
 290     } else {
 291       return outer()->locator_address(loc);
 292     }
 293   } else {
 294     assert(allocates2(branch_pc), "sanity");
 295     address base = start();
 296     int patch_loc = CodeBuffer::locator(branch_pc - base, index());
 297     L.add_patch_at(outer(), patch_loc);
 298 
 299     // Need to return a pc, doesn't matter what it is since it will be
 300     // replaced during resolution later.
 301     // Don't return NULL or badAddress, since branches shouldn't overflow.
 302     // Don't return base either because that could overflow displacements
 303     // for shorter branches.  It will get checked when bound.
 304     return branch_pc;
 305   }
 306 }
 307 

























 308 void CodeSection::relocate(address at, RelocationHolder const& spec, int format) {
 309   Relocation* reloc = spec.reloc();
 310   relocInfo::relocType rtype = (relocInfo::relocType) reloc->type();
 311   if (rtype == relocInfo::none)  return;
 312 
 313   // The assertion below has been adjusted, to also work for
 314   // relocation for fixup.  Sometimes we want to put relocation
 315   // information for the next instruction, since it will be patched
 316   // with a call.
 317   assert(start() <= at && at <= end()+1,
 318          "cannot relocate data outside code boundaries");
 319 
 320   if (!has_locs()) {
 321     // no space for relocation information provided => code cannot be
 322     // relocated.  Make sure that relocate is only called with rtypes
 323     // that can be ignored for this kind of code.
 324     assert(rtype == relocInfo::none              ||
 325            rtype == relocInfo::runtime_call_type ||
 326            rtype == relocInfo::internal_word_type||
 327            rtype == relocInfo::section_word_type ||




 288     if (index() == CodeBuffer::locator_sect(loc)) {
 289       return start() + CodeBuffer::locator_pos(loc);
 290     } else {
 291       return outer()->locator_address(loc);
 292     }
 293   } else {
 294     assert(allocates2(branch_pc), "sanity");
 295     address base = start();
 296     int patch_loc = CodeBuffer::locator(branch_pc - base, index());
 297     L.add_patch_at(outer(), patch_loc);
 298 
 299     // Need to return a pc, doesn't matter what it is since it will be
 300     // replaced during resolution later.
 301     // Don't return NULL or badAddress, since branches shouldn't overflow.
 302     // Don't return base either because that could overflow displacements
 303     // for shorter branches.  It will get checked when bound.
 304     return branch_pc;
 305   }
 306 }
 307 
 308 void CodeSection::relocate(address at, relocInfo::relocType rtype, int format, jint method_index) {
 309   RelocationHolder rh;
 310   switch (rtype) {
 311     case relocInfo::none: return;
 312     case relocInfo::opt_virtual_call_type: {
 313       rh = opt_virtual_call_Relocation::spec(method_index);
 314       break;
 315     }
 316     case relocInfo::static_call_type: {
 317       rh = static_call_Relocation::spec(method_index);
 318       break;
 319     }
 320     case relocInfo::virtual_call_type: {
 321       assert(method_index == 0, "resolved method overriding is not supported");
 322       rh = Relocation::spec_simple(rtype);
 323       break;
 324     }
 325     default: {
 326       rh = Relocation::spec_simple(rtype);
 327       break;
 328     }
 329   }
 330   relocate(at, rh, format);
 331 }
 332 
 333 void CodeSection::relocate(address at, RelocationHolder const& spec, int format) {
 334   Relocation* reloc = spec.reloc();
 335   relocInfo::relocType rtype = (relocInfo::relocType) reloc->type();
 336   if (rtype == relocInfo::none)  return;
 337 
 338   // The assertion below has been adjusted, to also work for
 339   // relocation for fixup.  Sometimes we want to put relocation
 340   // information for the next instruction, since it will be patched
 341   // with a call.
 342   assert(start() <= at && at <= end()+1,
 343          "cannot relocate data outside code boundaries");
 344 
 345   if (!has_locs()) {
 346     // no space for relocation information provided => code cannot be
 347     // relocated.  Make sure that relocate is only called with rtypes
 348     // that can be ignored for this kind of code.
 349     assert(rtype == relocInfo::none              ||
 350            rtype == relocInfo::runtime_call_type ||
 351            rtype == relocInfo::internal_word_type||
 352            rtype == relocInfo::section_word_type ||


src/share/vm/asm/codeBuffer.cpp
Index Unified diffs Context diffs Sdiffs Patch New Old Previous File Next File