< prev index next >

src/hotspot/cpu/aarch64/nativeInst_aarch64.hpp

Print this page
rev 54117 : AArch64: 64-bit Literal Oops

@@ -88,11 +88,10 @@
 
   address ptr_at(int offset) const     { return *(address*) addr_at(offset); }
 
   oop  oop_at (int offset) const       { return *(oop*) addr_at(offset); }
 
-
   void set_char_at(int offset, char c)        { *addr_at(offset) = (u_char)c; }
   void set_int_at(int offset, jint  i)        { *(jint*)addr_at(offset) = i; }
   void set_uint_at(int offset, jint  i)       { *(juint*)addr_at(offset) = i; }
   void set_ptr_at (int offset, address  ptr)  { *(address*) addr_at(offset) = ptr; }
   void set_oop_at (int offset, oop  o)        { *(oop*) addr_at(offset) = o; }

@@ -288,64 +287,48 @@
 // An interface for accessing/manipulating native mov reg, imm instructions.
 // (used to manipulate inlined 64-bit data calls, etc.)
 class NativeMovConstReg: public NativeInstruction {
  public:
   enum Aarch64_specific_constants {
-    instruction_size            =    3 * 4, // movz, movk, movk.  See movptr().
     instruction_offset          =    0,
     displacement_offset         =    0,
   };
 
   address instruction_address() const       { return addr_at(instruction_offset); }
   address next_instruction_address() const  {
-    if (nativeInstruction_at(instruction_address())->is_movz())
-      // Assume movz, movk, movk
-      return addr_at(instruction_size);
-    else if (is_adrp_at(instruction_address()))
-      return addr_at(2*4);
-    else if (is_ldr_literal_at(instruction_address()))
-      return(addr_at(4));
-    assert(false, "Unknown instruction in NativeMovConstReg");
-    return NULL;
+    return addr_at(get_instruction_size());
   }
 
   intptr_t data() const;
   void  set_data(intptr_t x);
 
   void flush() {
     if (! maybe_cpool_ref(instruction_address())) {
-      ICache::invalidate_range(instruction_address(), instruction_size);
+      ICache::invalidate_range(instruction_address(), get_instruction_size());
     }
   }
 
+  int get_instruction_size() const;
+
   void  verify();
   void  print();
 
   // unit test stuff
   static void test() {}
 
   // Creation
   inline friend NativeMovConstReg* nativeMovConstReg_at(address address);
-  inline friend NativeMovConstReg* nativeMovConstReg_before(address address);
 };
 
 inline NativeMovConstReg* nativeMovConstReg_at(address address) {
   NativeMovConstReg* test = (NativeMovConstReg*)(address - NativeMovConstReg::instruction_offset);
 #ifdef ASSERT
   test->verify();
 #endif
   return test;
 }
 
-inline NativeMovConstReg* nativeMovConstReg_before(address address) {
-  NativeMovConstReg* test = (NativeMovConstReg*)(address - NativeMovConstReg::instruction_size - NativeMovConstReg::instruction_offset);
-#ifdef ASSERT
-  test->verify();
-#endif
-  return test;
-}
-
 class NativeMovConstRegPatching: public NativeMovConstReg {
  private:
     friend NativeMovConstRegPatching* nativeMovConstRegPatching_at(address address) {
     NativeMovConstRegPatching* test = (NativeMovConstRegPatching*)(address - instruction_offset);
     #ifdef ASSERT

@@ -506,16 +489,16 @@
 }
 
 class NativeGeneralJump: public NativeJump {
 public:
   enum AArch64_specific_constants {
-    instruction_size            =    4 * 4,
     instruction_offset          =    0,
-    data_offset                 =    0,
-    next_instruction_offset     =    4 * 4
+    data_offset                 =    0
   };
 
+  static int instruction_size;
+
   address jump_destination() const;
   void set_jump_destination(address dest);
 
   static void insert_unconditional(address code_pos, address entry);
   static void replace_mt_safe(address instr_addr, address code_buffer);
< prev index next >