changeset 5939:53986bf097ad

8016696: PPC64 (part 4): add relocation for trampoline stubs Summary: A trampoline allows to encode a small branch in the code, even if there is the chance that this branch can not reach all possible code locations. If the relocation finds that a branch is too far for the instruction in the code, it can patch it to jump to the trampoline where is sufficient space for a far branch. Needed on PPC. Reviewed-by: kvn, bdelsart, jrose
author goetz
date Fri, 07 Feb 2014 16:18:07 +0100
parents f2f5a053bd0d
children 33e70139574f
files src/share/vm/code/relocInfo.cpp src/share/vm/code/relocInfo.hpp
diffstat 2 files changed, 11 insertions(+), 5 deletions(-) [+]
line wrap: on
line diff
--- a/src/share/vm/code/relocInfo.cpp	Fri Feb 07 16:07:53 2014 +0100
+++ b/src/share/vm/code/relocInfo.cpp	Fri Feb 07 16:18:07 2014 +0100
@@ -622,7 +622,7 @@
 }
 
 void trampoline_stub_Relocation::pack_data_to(CodeSection* dest ) {
-  short*  p  = (short*) dest->locs_end();
+  short* p = (short*) dest->locs_end();
   CodeSection* insts = dest->outer()->insts();
   normalize_address(_owner, insts);
   p = pack_1_int_to(p,scaled_offset(_owner, insts->start() ));
@@ -1198,6 +1198,12 @@
       tty->print(" | [static_call=" INTPTR_FORMAT "]", r->static_call());
       break;
     }
+  case relocInfo::trampoline_stub_type:
+    {
+      trampoline_stub_Relocation* r = (trampoline_stub_Relocation*) reloc();
+      tty->print(" | [trampoline owner=" INTPTR_FORMAT "]", r->owner());
+      break;
+    }
   }
   tty->cr();
 }
--- a/src/share/vm/code/relocInfo.hpp	Fri Feb 07 16:07:53 2014 +0100
+++ b/src/share/vm/code/relocInfo.hpp	Fri Feb 07 16:18:07 2014 +0100
@@ -268,7 +268,7 @@
     poll_return_type        = 11, // polling instruction for safepoints at return
     breakpoint_type         = 12, // an initialization barrier or safepoint
     trampoline_stub_type    = 13, // stub-entry for trampoline
-    yet_unused_type         = 14, // Still unused
+    yet_unused_type_1       = 14, // Still unused
     data_prefix_tag         = 15, // tag for a prefix (carries data arguments)
     type_mask               = 15  // A mask which selects only the above values
   };
@@ -1118,14 +1118,14 @@
 // is the chance that this branch can not reach all possible code locations.
 // If the relocation finds that a branch is too far for the instruction
 // in the code, it can patch it to jump to the trampoline where is
-// sufficient space for a far branch.  Needed on PPC.
+// sufficient space for a far branch. Needed on PPC.
 class trampoline_stub_Relocation : public Relocation {
   relocInfo::relocType type() { return relocInfo::trampoline_stub_type; }
 
  public:
   static RelocationHolder spec(address static_call) {
     RelocationHolder rh = newHolder();
-    return (new(rh) trampoline_stub_Relocation(static_call));
+    return (new (rh) trampoline_stub_Relocation(static_call));
   }
 
  private:
@@ -1143,7 +1143,7 @@
   // Return the address of the NativeCall that owns the trampoline.
   address owner() { return _owner; }
 
-  void pack_data_to(  CodeSection * dest);
+  void pack_data_to(CodeSection * dest);
   void unpack_data();
 
   // Find the trampoline stub for a call.