src/share/vm/code/relocInfo.cpp

changeset 6447
53fa76359eb1
parent 5314
7875ea94bea5
child 6503
a9becfeecd1b
     1.1 --- a/src/share/vm/code/relocInfo.cpp	Wed Jul 03 11:50:29 2013 -0700
     1.2 +++ b/src/share/vm/code/relocInfo.cpp	Thu Jul 04 10:51:31 2013 +0200
     1.3 @@ -582,6 +582,18 @@
     1.4    _static_call = address_from_scaled_offset(unpack_1_int(), base);
     1.5  }
     1.6  
     1.7 +void trampoline_stub_Relocation::pack_data_to(CodeSection* dest ) {
     1.8 +  short* p = (short*) dest->locs_end();
     1.9 +  CodeSection* insts = dest->outer()->insts();
    1.10 +  normalize_address(_owner, insts);
    1.11 +  p = pack_1_int_to(p, scaled_offset(_owner, insts->start()));
    1.12 +  dest->set_locs_end((relocInfo*) p);
    1.13 +}
    1.14 +
    1.15 +void trampoline_stub_Relocation::unpack_data() {
    1.16 +  address base = binding()->section_start(CodeBuffer::SECT_INSTS);
    1.17 +  _owner = address_from_scaled_offset(unpack_1_int(), base);
    1.18 +}
    1.19  
    1.20  void external_word_Relocation::pack_data_to(CodeSection* dest) {
    1.21    short* p = (short*) dest->locs_end();
    1.22 @@ -811,6 +823,25 @@
    1.23    return NULL;
    1.24  }
    1.25  
    1.26 +// Finds the trampoline address for a call. If no trampoline stub is
    1.27 +// found NULL is returned which can be handled by the caller.
    1.28 +address trampoline_stub_Relocation::get_trampoline_for(address call, nmethod* code) {
    1.29 +  // There are no relocations available when the code gets relocated
    1.30 +  // because of CodeBuffer expansion.
    1.31 +  if (code->relocation_size() == 0)
    1.32 +    return NULL;
    1.33 +
    1.34 +  RelocIterator iter(code, call);
    1.35 +  while (iter.next()) {
    1.36 +    if (iter.type() == relocInfo::trampoline_stub_type) {
    1.37 +      if (iter.trampoline_stub_reloc()->owner() == call) {
    1.38 +        return iter.addr();
    1.39 +      }
    1.40 +    }
    1.41 +  }
    1.42 +
    1.43 +  return NULL;
    1.44 +}
    1.45  
    1.46  void static_stub_Relocation::clear_inline_cache() {
    1.47    // Call stub is only used when calling the interpreted code.
    1.48 @@ -975,6 +1006,12 @@
    1.49        tty->print(" | [static_call=" INTPTR_FORMAT "]", r->static_call());
    1.50        break;
    1.51      }
    1.52 +  case relocInfo::trampoline_stub_type:
    1.53 +    {
    1.54 +      trampoline_stub_Relocation* r = (trampoline_stub_Relocation*) reloc();
    1.55 +      tty->print(" | [trampoline owner=" INTPTR_FORMAT "]", r->owner());
    1.56 +      break;
    1.57 +    }
    1.58    }
    1.59    tty->cr();
    1.60  }

mercurial