< prev index next >

src/hotspot/cpu/aarch64/macroAssembler_aarch64.hpp

Print this page

  69 
  70   // This is the base routine called by the different versions of call_VM. The interpreter
  71   // may customize this version by overriding it for its purposes (e.g., to save/restore
  72   // additional registers when doing a VM call).
  73   //
  74   // If no java_thread register is specified (noreg) than rthread will be used instead. call_VM_base
  75   // returns the register which contains the thread upon return. If a thread register has been
  76   // specified, the return value will correspond to that register. If no last_java_sp is specified
  77   // (noreg) than rsp will be used instead.
  78   virtual void call_VM_base(           // returns the register containing the thread upon return
  79     Register oop_result,               // where an oop-result ends up if any; use noreg otherwise
  80     Register java_thread,              // the thread if computed before     ; use noreg otherwise
  81     Register last_java_sp,             // to set up last_Java_frame in stubs; use noreg otherwise
  82     address  entry_point,              // the entry point
  83     int      number_of_arguments,      // the number of arguments (w/o thread) to pop after the call
  84     bool     check_exceptions          // whether to check for pending exceptions after return
  85   );
  86 
  87   void call_VM_helper(Register oop_result, address entry_point, int number_of_arguments, bool check_exceptions = true);
  88 


  89   enum KlassDecodeMode {
  90     KlassDecodeNone,
  91     KlassDecodeZero,
  92     KlassDecodeXor,
  93     KlassDecodeMovk
  94   };
  95 
  96   KlassDecodeMode klass_decode_mode();








  97 
  98  private:

  99   static KlassDecodeMode _klass_decode_mode;
 100 
 101  public:
 102   MacroAssembler(CodeBuffer* code) : Assembler(code) {}
 103 
 104  // These routines should emit JVMTI PopFrame and ForceEarlyReturn handling code.
 105  // The implementation is only non-empty for the InterpreterMacroAssembler,
 106  // as only the interpreter handles PopFrame and ForceEarlyReturn requests.
 107  virtual void check_and_handle_popframe(Register java_thread);
 108  virtual void check_and_handle_earlyret(Register java_thread);
 109 
 110   void safepoint_poll(Label& slow_path, bool at_return, bool acquire, bool in_nmethod, Register tmp = rscratch1);
 111   void rt_call(address dest, Register tmp = rscratch1);
 112 
 113   // Helper functions for statistics gathering.
 114   // Unconditional atomic increment.
 115   void atomic_incw(Register counter_addr, Register tmp, Register tmp2);
 116   void atomic_incw(Address counter_addr, Register tmp1, Register tmp2, Register tmp3) {
 117     lea(tmp1, counter_addr);
 118     atomic_incw(tmp1, tmp2, tmp3);

 822                            Register scratch);
 823 
 824   void reset_last_Java_frame(Register thread);
 825 
 826   // thread in the default location (rthread)
 827   void reset_last_Java_frame(bool clear_fp);
 828 
 829   // Stores
 830   void store_check(Register obj);                // store check for obj - register is destroyed afterwards
 831   void store_check(Register obj, Address dst);   // same as above, dst is exact store location (reg. is destroyed)
 832 
 833   void resolve_jobject(Register value, Register tmp1, Register tmp2);
 834 
 835   // C 'boolean' to Java boolean: x == 0 ? 0 : 1
 836   void c2bool(Register x);
 837 
 838   void load_method_holder_cld(Register rresult, Register rmethod);
 839   void load_method_holder(Register holder, Register method);
 840 
 841   // oop manipulations

 842   void load_klass(Register dst, Register src);
 843   void store_klass(Register dst, Register src);
 844   void cmp_klass(Register oop, Register trial_klass, Register tmp);
 845 
 846   void resolve_weak_handle(Register result, Register tmp1, Register tmp2);
 847   void resolve_oop_handle(Register result, Register tmp1, Register tmp2);
 848   void load_mirror(Register dst, Register method, Register tmp1, Register tmp2);
 849 
 850   void access_load_at(BasicType type, DecoratorSet decorators, Register dst, Address src,
 851                       Register tmp1, Register tmp2);
 852 
 853   void access_store_at(BasicType type, DecoratorSet decorators, Address dst, Register src,
 854                        Register tmp1, Register tmp2, Register tmp3);
 855 
 856   void load_heap_oop(Register dst, Address src, Register tmp1 = noreg,
 857                      Register tmp2 = noreg, DecoratorSet decorators = 0);
 858 
 859   void load_heap_oop_not_null(Register dst, Address src, Register tmp1 = noreg,
 860                               Register tmp2 = noreg, DecoratorSet decorators = 0);
 861   void store_heap_oop(Address dst, Register src, Register tmp1 = noreg,
 862                       Register tmp2 = noreg, Register tmp3 = noreg, DecoratorSet decorators = 0);
 863 
 864   // currently unimplemented
 865   // Used for storing NULL. All other oop constants should be
 866   // stored using routines that take a jobject.
 867   void store_heap_oop_null(Address dst);
 868 
 869   void store_klass_gap(Register dst, Register src);
 870 
 871   // This dummy is to prevent a call to store_heap_oop from
 872   // converting a zero (like NULL) into a Register by giving
 873   // the compiler two choices it can't resolve
 874 
 875   void store_heap_oop(Address dst, void* dummy);
 876 
 877   void encode_heap_oop(Register d, Register s);
 878   void encode_heap_oop(Register r) { encode_heap_oop(r, r); }
 879   void decode_heap_oop(Register d, Register s);
 880   void decode_heap_oop(Register r) { decode_heap_oop(r, r); }
 881   void encode_heap_oop_not_null(Register r);
 882   void decode_heap_oop_not_null(Register r);
 883   void encode_heap_oop_not_null(Register dst, Register src);
 884   void decode_heap_oop_not_null(Register dst, Register src);
 885 
 886   void set_narrow_oop(Register dst, jobject obj);
 887 
 888   void encode_klass_not_null(Register r);
 889   void decode_klass_not_null(Register r);
 890   void encode_klass_not_null(Register dst, Register src);

1541       src_offset += 16;
1542       dst_offset += 16;
1543     }
1544   }
1545   void spill_copy_sve_predicate_stack_to_stack(int src_offset, int dst_offset,
1546                                                int sve_predicate_reg_size_in_bytes) {
1547     sve_ldr(ptrue, sve_spill_address(sve_predicate_reg_size_in_bytes, src_offset));
1548     sve_str(ptrue, sve_spill_address(sve_predicate_reg_size_in_bytes, dst_offset));
1549     reinitialize_ptrue();
1550   }
1551   void cache_wb(Address line);
1552   void cache_wbsync(bool is_pre);
1553 
1554   // Code for java.lang.Thread::onSpinWait() intrinsic.
1555   void spin_wait();
1556 
1557 private:
1558   // Check the current thread doesn't need a cross modify fence.
1559   void verify_cross_modify_fence_not_required() PRODUCT_RETURN;
1560 



1561 };
1562 
1563 #ifdef ASSERT
1564 inline bool AbstractAssembler::pd_check_instruction_mark() { return false; }
1565 #endif
1566 
1567 /**
1568  * class SkipIfEqual:
1569  *
1570  * Instantiating this class will result in assembly code being output that will
1571  * jump around any code emitted between the creation of the instance and it's
1572  * automatic destruction at the end of a scope block, depending on the value of
1573  * the flag passed to the constructor, which will be checked at run-time.
1574  */
1575 class SkipIfEqual {
1576  private:
1577   MacroAssembler* _masm;
1578   Label _label;
1579 
1580  public:

  69 
  70   // This is the base routine called by the different versions of call_VM. The interpreter
  71   // may customize this version by overriding it for its purposes (e.g., to save/restore
  72   // additional registers when doing a VM call).
  73   //
  74   // If no java_thread register is specified (noreg) than rthread will be used instead. call_VM_base
  75   // returns the register which contains the thread upon return. If a thread register has been
  76   // specified, the return value will correspond to that register. If no last_java_sp is specified
  77   // (noreg) than rsp will be used instead.
  78   virtual void call_VM_base(           // returns the register containing the thread upon return
  79     Register oop_result,               // where an oop-result ends up if any; use noreg otherwise
  80     Register java_thread,              // the thread if computed before     ; use noreg otherwise
  81     Register last_java_sp,             // to set up last_Java_frame in stubs; use noreg otherwise
  82     address  entry_point,              // the entry point
  83     int      number_of_arguments,      // the number of arguments (w/o thread) to pop after the call
  84     bool     check_exceptions          // whether to check for pending exceptions after return
  85   );
  86 
  87   void call_VM_helper(Register oop_result, address entry_point, int number_of_arguments, bool check_exceptions = true);
  88 
  89  public:
  90 
  91   enum KlassDecodeMode {
  92     KlassDecodeNone,
  93     KlassDecodeZero,
  94     KlassDecodeXor,
  95     KlassDecodeMovk
  96   };
  97 
  98   // Return the current narrow Klass pointer decode mode. Initialized on first call.
  99   static KlassDecodeMode klass_decode_mode();
 100 
 101   // Given an arbitrary base address, return the KlassDecodeMode that would be used. Return KlassDecodeNone
 102   // if base address is not valid for encoding.
 103   static KlassDecodeMode klass_decode_mode_for_base(address base);
 104 
 105   // Returns a static string
 106   static const char* describe_klass_decode_mode(KlassDecodeMode mode);
 107 
 108  private:
 109 
 110   static KlassDecodeMode _klass_decode_mode;
 111 
 112  public:
 113   MacroAssembler(CodeBuffer* code) : Assembler(code) {}
 114 
 115  // These routines should emit JVMTI PopFrame and ForceEarlyReturn handling code.
 116  // The implementation is only non-empty for the InterpreterMacroAssembler,
 117  // as only the interpreter handles PopFrame and ForceEarlyReturn requests.
 118  virtual void check_and_handle_popframe(Register java_thread);
 119  virtual void check_and_handle_earlyret(Register java_thread);
 120 
 121   void safepoint_poll(Label& slow_path, bool at_return, bool acquire, bool in_nmethod, Register tmp = rscratch1);
 122   void rt_call(address dest, Register tmp = rscratch1);
 123 
 124   // Helper functions for statistics gathering.
 125   // Unconditional atomic increment.
 126   void atomic_incw(Register counter_addr, Register tmp, Register tmp2);
 127   void atomic_incw(Address counter_addr, Register tmp1, Register tmp2, Register tmp3) {
 128     lea(tmp1, counter_addr);
 129     atomic_incw(tmp1, tmp2, tmp3);

 833                            Register scratch);
 834 
 835   void reset_last_Java_frame(Register thread);
 836 
 837   // thread in the default location (rthread)
 838   void reset_last_Java_frame(bool clear_fp);
 839 
 840   // Stores
 841   void store_check(Register obj);                // store check for obj - register is destroyed afterwards
 842   void store_check(Register obj, Address dst);   // same as above, dst is exact store location (reg. is destroyed)
 843 
 844   void resolve_jobject(Register value, Register tmp1, Register tmp2);
 845 
 846   // C 'boolean' to Java boolean: x == 0 ? 0 : 1
 847   void c2bool(Register x);
 848 
 849   void load_method_holder_cld(Register rresult, Register rmethod);
 850   void load_method_holder(Register holder, Register method);
 851 
 852   // oop manipulations
 853   void load_nklass(Register dst, Register src);
 854   void load_klass(Register dst, Register src);

 855   void cmp_klass(Register oop, Register trial_klass, Register tmp);
 856 
 857   void resolve_weak_handle(Register result, Register tmp1, Register tmp2);
 858   void resolve_oop_handle(Register result, Register tmp1, Register tmp2);
 859   void load_mirror(Register dst, Register method, Register tmp1, Register tmp2);
 860 
 861   void access_load_at(BasicType type, DecoratorSet decorators, Register dst, Address src,
 862                       Register tmp1, Register tmp2);
 863 
 864   void access_store_at(BasicType type, DecoratorSet decorators, Address dst, Register src,
 865                        Register tmp1, Register tmp2, Register tmp3);
 866 
 867   void load_heap_oop(Register dst, Address src, Register tmp1 = noreg,
 868                      Register tmp2 = noreg, DecoratorSet decorators = 0);
 869 
 870   void load_heap_oop_not_null(Register dst, Address src, Register tmp1 = noreg,
 871                               Register tmp2 = noreg, DecoratorSet decorators = 0);
 872   void store_heap_oop(Address dst, Register src, Register tmp1 = noreg,
 873                       Register tmp2 = noreg, Register tmp3 = noreg, DecoratorSet decorators = 0);
 874 
 875   // currently unimplemented
 876   // Used for storing NULL. All other oop constants should be
 877   // stored using routines that take a jobject.
 878   void store_heap_oop_null(Address dst);
 879 


 880   // This dummy is to prevent a call to store_heap_oop from
 881   // converting a zero (like NULL) into a Register by giving
 882   // the compiler two choices it can't resolve
 883 
 884   void store_heap_oop(Address dst, void* dummy);
 885 
 886   void encode_heap_oop(Register d, Register s);
 887   void encode_heap_oop(Register r) { encode_heap_oop(r, r); }
 888   void decode_heap_oop(Register d, Register s);
 889   void decode_heap_oop(Register r) { decode_heap_oop(r, r); }
 890   void encode_heap_oop_not_null(Register r);
 891   void decode_heap_oop_not_null(Register r);
 892   void encode_heap_oop_not_null(Register dst, Register src);
 893   void decode_heap_oop_not_null(Register dst, Register src);
 894 
 895   void set_narrow_oop(Register dst, jobject obj);
 896 
 897   void encode_klass_not_null(Register r);
 898   void decode_klass_not_null(Register r);
 899   void encode_klass_not_null(Register dst, Register src);

1550       src_offset += 16;
1551       dst_offset += 16;
1552     }
1553   }
1554   void spill_copy_sve_predicate_stack_to_stack(int src_offset, int dst_offset,
1555                                                int sve_predicate_reg_size_in_bytes) {
1556     sve_ldr(ptrue, sve_spill_address(sve_predicate_reg_size_in_bytes, src_offset));
1557     sve_str(ptrue, sve_spill_address(sve_predicate_reg_size_in_bytes, dst_offset));
1558     reinitialize_ptrue();
1559   }
1560   void cache_wb(Address line);
1561   void cache_wbsync(bool is_pre);
1562 
1563   // Code for java.lang.Thread::onSpinWait() intrinsic.
1564   void spin_wait();
1565 
1566 private:
1567   // Check the current thread doesn't need a cross modify fence.
1568   void verify_cross_modify_fence_not_required() PRODUCT_RETURN;
1569 
1570 public:
1571   void fast_lock(Register obj, Register hdr, Register t1, Register t2, Register t3, Label& slow);
1572   void fast_unlock(Register obj, Register hdr, Register t1, Register t2, Label& slow);
1573 };
1574 
1575 #ifdef ASSERT
1576 inline bool AbstractAssembler::pd_check_instruction_mark() { return false; }
1577 #endif
1578 
1579 /**
1580  * class SkipIfEqual:
1581  *
1582  * Instantiating this class will result in assembly code being output that will
1583  * jump around any code emitted between the creation of the instance and it's
1584  * automatic destruction at the end of a scope block, depending on the value of
1585  * the flag passed to the constructor, which will be checked at run-time.
1586  */
1587 class SkipIfEqual {
1588  private:
1589   MacroAssembler* _masm;
1590   Label _label;
1591 
1592  public:
< prev index next >