changeset 13553:d49f00604347

removed poll_Relocation::pollingForm type and associated data field and rely solely on format field of safepoint relocation entries when deciding whether or not to relocate the operand of a safepoint poll instruction
author Doug Simon <doug.simon@oracle.com>
date Wed, 08 Jan 2014 16:57:30 +0100
parents c9daba2a2bac
children 83fd2094ff66 b63357fbe40c
files src/cpu/sparc/vm/c1_LIRAssembler_sparc.cpp src/cpu/sparc/vm/graalCodeInstaller_sparc.hpp src/cpu/x86/vm/assembler_x86.cpp src/cpu/x86/vm/assembler_x86.hpp src/cpu/x86/vm/graalCodeInstaller_x86.hpp src/cpu/x86/vm/relocInfo_x86.cpp src/share/vm/code/relocInfo.cpp src/share/vm/code/relocInfo.hpp
diffstat 8 files changed, 20 insertions(+), 85 deletions(-) [+]
line wrap: on
line diff
--- a/src/cpu/sparc/vm/c1_LIRAssembler_sparc.cpp	Wed Jan 08 16:56:01 2014 +0100
+++ b/src/cpu/sparc/vm/c1_LIRAssembler_sparc.cpp	Wed Jan 08 16:57:30 2014 +0100
@@ -1601,7 +1601,7 @@
   }
 #endif // TIERED
   __ set((intptr_t)os::get_polling_page(), L0);
-  __ relocate(poll_return_Relocation::spec(poll_Relocation::absolute));
+  __ relocate(relocInfo::poll_return_type);
   __ ld_ptr(L0, 0, G0);
   __ ret();
   __ delayed()->restore();
@@ -1613,7 +1613,7 @@
   if (info != NULL) {
     add_debug_info_for_branch(info);
   } else {
-    __ relocate(poll_Relocation::spec(poll_Relocation::absolute));
+    __ relocate(relocInfo::poll_type);
   }
 
   int offset = __ offset();
--- a/src/cpu/sparc/vm/graalCodeInstaller_sparc.hpp	Wed Jan 08 16:56:01 2014 +0100
+++ b/src/cpu/sparc/vm/graalCodeInstaller_sparc.hpp	Wed Jan 08 16:57:30 2014 +0100
@@ -188,13 +188,13 @@
       fatal("unimplemented");
     }
     case MARK_POLL_FAR:
-      _instructions->relocate(pc, poll_Relocation::spec(poll_Relocation::absolute));
+      _instructions->relocate(pc, relocInfo::poll_type);
       break;
     case MARK_POLL_RETURN_NEAR: {
       fatal("unimplemented");
     }
     case MARK_POLL_RETURN_FAR:
-      _instructions->relocate(pc, poll_return_Relocation::spec(poll_Relocation::absolute));
+      _instructions->relocate(pc, relocInfo::poll_return_type);
       break;
     default:
       fatal("invalid mark value");
--- a/src/cpu/x86/vm/assembler_x86.cpp	Wed Jan 08 16:56:01 2014 +0100
+++ b/src/cpu/x86/vm/assembler_x86.cpp	Wed Jan 08 16:57:30 2014 +0100
@@ -81,10 +81,8 @@
     _rspec = runtime_call_Relocation::spec();
     break;
   case relocInfo::poll_type:
-    _rspec = poll_Relocation::spec(Assembler::is_polling_page_far() ? poll_Relocation::absolute : poll_Relocation::pc_relative);
-    break;
   case relocInfo::poll_return_type:
-    _rspec = poll_return_Relocation::spec(Assembler::is_polling_page_far() ? poll_Relocation::absolute : poll_Relocation::pc_relative);
+    _rspec = Relocation::spec_simple(rtype);
     break;
   case relocInfo::none:
     break;
--- a/src/cpu/x86/vm/assembler_x86.hpp	Wed Jan 08 16:56:01 2014 +0100
+++ b/src/cpu/x86/vm/assembler_x86.hpp	Wed Jan 08 16:57:30 2014 +0100
@@ -527,6 +527,9 @@
   enum WhichOperand {
     // input to locate_operand, and format code for relocations
     imm_operand  = 0,            // embedded 32-bit|64-bit immediate operand
+#ifdef GRAAL
+    no_operand   = imm_operand,  // format value for relocations at instructions with no operand
+#endif
     disp32_operand = 1,          // embedded 32-bit displacement or address
     call32_operand = 2,          // embedded 32-bit self-relative displacement
 #ifndef _LP64
--- a/src/cpu/x86/vm/graalCodeInstaller_x86.hpp	Wed Jan 08 16:56:01 2014 +0100
+++ b/src/cpu/x86/vm/graalCodeInstaller_x86.hpp	Wed Jan 08 16:57:30 2014 +0100
@@ -243,19 +243,21 @@
   switch (mark) {
     case MARK_POLL_NEAR: {
       relocate_poll_near(pc);
-      _instructions->relocate(pc, poll_Relocation::spec(poll_Relocation::pc_relative));
+      _instructions->relocate(pc, relocInfo::poll_type, Assembler::disp32_operand);
       break;
     }
     case MARK_POLL_FAR:
-      _instructions->relocate(pc, poll_Relocation::spec(poll_Relocation::absolute));
+      // This is a load from a register so there is no relocatable operand
+      _instructions->relocate(pc, relocInfo::poll_type, Assembler::no_operand);
       break;
     case MARK_POLL_RETURN_NEAR: {
       relocate_poll_near(pc);
-      _instructions->relocate(pc, poll_return_Relocation::spec(poll_Relocation::pc_relative));
+      _instructions->relocate(pc, relocInfo::poll_return_type, Assembler::disp32_operand);
       break;
     }
     case MARK_POLL_RETURN_FAR:
-      _instructions->relocate(pc, poll_return_Relocation::spec(poll_Relocation::absolute));
+      // This is a load from a register so there is no relocatable operand
+      _instructions->relocate(pc, relocInfo::poll_return_type, Assembler::no_operand);
       break;
     default:
       fatal("invalid mark value");
--- a/src/cpu/x86/vm/relocInfo_x86.cpp	Wed Jan 08 16:56:01 2014 +0100
+++ b/src/cpu/x86/vm/relocInfo_x86.cpp	Wed Jan 08 16:57:30 2014 +0100
@@ -179,17 +179,14 @@
 
 void poll_Relocation::fix_relocation_after_move(const CodeBuffer* src, CodeBuffer* dest) {
 #ifdef _LP64
-  if (_form == pc_relative) {
-    typedef Assembler::WhichOperand WhichOperand;
-    WhichOperand which = (WhichOperand) format();
-    // This format is imm but it is really disp32
-    which = Assembler::disp32_operand;
+  typedef Assembler::WhichOperand WhichOperand;
+  WhichOperand which = (WhichOperand) format();
+  if (which == Assembler::disp32_operand) {
     address orig_addr = old_addr_for(addr(), src, dest);
     NativeInstruction* oni = nativeInstruction_at(orig_addr);
     int32_t* orig_disp = (int32_t*) Assembler::locate_operand(orig_addr, which);
     // This poll_addr is incorrect by the size of the instruction it is irrelevant
     intptr_t poll_addr = (intptr_t)oni + *orig_disp;
-
     NativeInstruction* ni = nativeInstruction_at(addr());
     intptr_t new_disp = poll_addr - (intptr_t) ni;
 
--- a/src/share/vm/code/relocInfo.cpp	Wed Jan 08 16:56:01 2014 +0100
+++ b/src/share/vm/code/relocInfo.cpp	Wed Jan 08 16:57:30 2014 +0100
@@ -679,16 +679,6 @@
   _target  = address_from_scaled_offset(offset, base);
 }
 
-void poll_Relocation::pack_data_to(CodeSection* dest) {
-  short* p = (short*) dest->locs_end();
-  p = pack_1_int_to(p, _form);
-  dest->set_locs_end((relocInfo*) p);
-}
-
-void poll_Relocation::unpack_data() {
-  _form = (poll_Relocation::pollingForm) unpack_1_int();
-}
-
 //// miscellaneous methods
 oop* oop_Relocation::oop_addr() {
   int n = _oop_index;
@@ -985,22 +975,6 @@
       tty->print(" | [static_call=" INTPTR_FORMAT "]", r->static_call());
       break;
     }
-  case relocInfo::poll_type:
-  case relocInfo::poll_return_type:
-    {
-      poll_Relocation* r = (poll_Relocation*) reloc();
-      const char *formName = "unknown";
-      switch (r->form()) {
-        case poll_Relocation::pc_relative:
-          formName = "pc_relative";
-          break;
-        case poll_Relocation::absolute:
-          formName = "absolute";
-          break;
-      }
-      tty->print(" | [form=%d(%s)]", r->form(), formName);
-      break;
-    }
   }
   tty->cr();
 }
--- a/src/share/vm/code/relocInfo.hpp	Wed Jan 08 16:56:01 2014 +0100
+++ b/src/share/vm/code/relocInfo.hpp	Wed Jan 08 16:57:30 2014 +0100
@@ -213,8 +213,7 @@
 // relocInfo::poll_[return_]type -- a safepoint poll
 //   Value:  none
 //   Instruction types: memory load or test
-//   Data:  []       the associated set-oops are adjacent to the call
-//          [n]      n is a poll_Relocation::pollingForm value
+//   Data:  none
 //
 // For example:
 //
@@ -1277,53 +1276,15 @@
   section_word_Relocation() { }
 };
 
+
 class poll_Relocation : public Relocation {
- public:
-  enum pollingForm {
-    pc_relative,
-    absolute
-  };
+  bool          is_data()                      { return true; }
   relocInfo::relocType type() { return relocInfo::poll_type; }
-  bool          is_data()                      { return true; }
   void     fix_relocation_after_move(const CodeBuffer* src, CodeBuffer* dest);
- private:
-  pollingForm     _form;
- public:
-
-  static RelocationHolder spec(poll_Relocation::pollingForm form) {
-    RelocationHolder rh = newHolder();
-    new(rh) poll_Relocation(form);
-    return rh;
-  }
-
-  poll_Relocation(poll_Relocation::pollingForm form) {
-    _form = form;
-  }
-  poll_Relocation::pollingForm form() { return _form; }
-
-  void pack_data_to(CodeSection* dest);
-  void unpack_data();
-
- protected:
-  friend class RelocIterator;
-  poll_Relocation() { }
 };
 
 class poll_return_Relocation : public poll_Relocation {
- public:
   relocInfo::relocType type() { return relocInfo::poll_return_type; }
-
-  static RelocationHolder spec(poll_Relocation::pollingForm distance) {
-    RelocationHolder rh = newHolder();
-    new(rh) poll_return_Relocation(distance);
-    return rh;
-  }
-
-  poll_return_Relocation(poll_Relocation::pollingForm distance) : poll_Relocation(distance) { }
-
- private:
-  friend class RelocIterator;
-  poll_return_Relocation() { }
 };
 
 // We know all the xxx_Relocation classes, so now we can define these: