src/share/vm/code/relocInfo.hpp

changeset 6447
53fa76359eb1
parent 5314
7875ea94bea5
child 6461
bdd155477289
     1.1 --- a/src/share/vm/code/relocInfo.hpp	Wed Jul 03 11:50:29 2013 -0700
     1.2 +++ b/src/share/vm/code/relocInfo.hpp	Thu Jul 04 10:51:31 2013 +0200
     1.3 @@ -260,8 +260,8 @@
     1.4      poll_type               = 10, // polling instruction for safepoints
     1.5      poll_return_type        = 11, // polling instruction for safepoints at return
     1.6      metadata_type           = 12, // metadata that used to be oops
     1.7 -    yet_unused_type_1       = 13, // Still unused
     1.8 -    yet_unused_type_2       = 14, // Still unused
     1.9 +    trampoline_stub_type    = 13, // stub-entry for trampoline
    1.10 +    yet_unused_type_1       = 14, // Still unused
    1.11      data_prefix_tag         = 15, // tag for a prefix (carries data arguments)
    1.12      type_mask               = 15  // A mask which selects only the above values
    1.13    };
    1.14 @@ -301,6 +301,7 @@
    1.15      visitor(poll) \
    1.16      visitor(poll_return) \
    1.17      visitor(section_word) \
    1.18 +    visitor(trampoline_stub) \
    1.19  
    1.20  
    1.21   public:
    1.22 @@ -1150,6 +1151,43 @@
    1.23   public:
    1.24  };
    1.25  
    1.26 +// Trampoline Relocations.
    1.27 +// A trampoline allows to encode a small branch in the code, even if there
    1.28 +// is the chance that this branch can not reach all possible code locations.
    1.29 +// If the relocation finds that a branch is too far for the instruction
    1.30 +// in the code, it can patch it to jump to the trampoline where is
    1.31 +// sufficient space for a far branch. Needed on PPC.
    1.32 +class trampoline_stub_Relocation : public Relocation {
    1.33 +  relocInfo::relocType type() { return relocInfo::trampoline_stub_type; }
    1.34 +
    1.35 + public:
    1.36 +  static RelocationHolder spec(address static_call) {
    1.37 +    RelocationHolder rh = newHolder();
    1.38 +    return (new (rh) trampoline_stub_Relocation(static_call));
    1.39 +  }
    1.40 +
    1.41 + private:
    1.42 +  address _owner;    // Address of the NativeCall that owns the trampoline.
    1.43 +
    1.44 +  trampoline_stub_Relocation(address owner) {
    1.45 +    _owner = owner;
    1.46 +  }
    1.47 +
    1.48 +  friend class RelocIterator;
    1.49 +  trampoline_stub_Relocation() { }
    1.50 +
    1.51 + public:
    1.52 +
    1.53 +  // Return the address of the NativeCall that owns the trampoline.
    1.54 +  address owner() { return _owner; }
    1.55 +
    1.56 +  void pack_data_to(CodeSection * dest);
    1.57 +  void unpack_data();
    1.58 +
    1.59 +  // Find the trampoline stub for a call.
    1.60 +  static address get_trampoline_for(address call, nmethod* code);
    1.61 +};
    1.62 +
    1.63  class external_word_Relocation : public DataRelocation {
    1.64    relocInfo::relocType type() { return relocInfo::external_word_type; }
    1.65  

mercurial