< prev index next >

src/hotspot/cpu/aarch64/macroAssembler_aarch64.hpp

Print this page

 665   // register to hold the constant. so, a register increment/decrement
 666   // may trash rscratch2 and an address increment/decrement trash
 667   // rscratch and rscratch2
 668 
 669   void decrementw(Address dst, int value = 1);
 670   void decrementw(Register reg, int value = 1);
 671 
 672   void decrement(Register reg, int value = 1);
 673   void decrement(Address dst, int value = 1);
 674 
 675   void incrementw(Address dst, int value = 1);
 676   void incrementw(Register reg, int value = 1);
 677 
 678   void increment(Register reg, int value = 1);
 679   void increment(Address dst, int value = 1);
 680 
 681 
 682   // Alignment
 683   void align(int modulus);
 684 



 685   // Stack frame creation/removal
 686   void enter()
 687   {
 688     stp(rfp, lr, Address(pre(sp, -2 * wordSize)));
 689     mov(rfp, sp);
 690   }
 691   void leave()
 692   {
 693     mov(sp, rfp);
 694     ldp(rfp, lr, Address(post(sp, 2 * wordSize)));
 695   }
 696 
 697   // Support for getting the JavaThread pointer (i.e.; a reference to thread-local information)
 698   // The pointer will be loaded into the thread register.
 699   void get_thread(Register thread);
 700 
 701 
 702   // Support for VM calls
 703   //
 704   // It is imperative that all calls into the VM are handled via the call_VM macros.

 852 
 853   void set_narrow_oop(Register dst, jobject obj);
 854 
 855   void encode_klass_not_null(Register r);
 856   void decode_klass_not_null(Register r);
 857   void encode_klass_not_null(Register dst, Register src);
 858   void decode_klass_not_null(Register dst, Register src);
 859 
 860   void set_narrow_klass(Register dst, Klass* k);
 861 
 862   // if heap base register is used - reinit it with the correct value
 863   void reinit_heapbase();
 864 
 865   DEBUG_ONLY(void verify_heapbase(const char* msg);)
 866 
 867   void push_CPU_state(bool save_vectors = false, bool use_sve = false,
 868                       int sve_vector_size_in_bytes = 0);
 869   void pop_CPU_state(bool restore_vectors = false, bool use_sve = false,
 870                       int sve_vector_size_in_bytes = 0);
 871 






 872   // Round up to a power of two
 873   void round_to(Register reg, int modulus);
 874 
 875   // allocation
 876   void eden_allocate(
 877     Register obj,                      // result: pointer to object after successful allocation
 878     Register var_size_in_bytes,        // object size in bytes if unknown at compile time; invalid otherwise
 879     int      con_size_in_bytes,        // object size in bytes if   known at compile time
 880     Register t1,                       // temp register
 881     Label&   slow_case                 // continuation point if fast allocation fails
 882   );
 883   void tlab_allocate(
 884     Register obj,                      // result: pointer to object after successful allocation
 885     Register var_size_in_bytes,        // object size in bytes if unknown at compile time; invalid otherwise
 886     int      con_size_in_bytes,        // object size in bytes if   known at compile time
 887     Register t1,                       // temp register
 888     Register t2,                       // temp register
 889     Label&   slow_case                 // continuation point if fast allocation fails
 890   );
 891   void verify_tlab();

 964   void _verify_method_ptr(Register reg, const char * msg, const char * file, int line) {}
 965   void _verify_klass_ptr(Register reg, const char * msg, const char * file, int line){}
 966 
 967 #define verify_method_ptr(reg) _verify_method_ptr(reg, "broken method " #reg, __FILE__, __LINE__)
 968 #define verify_klass_ptr(reg) _verify_klass_ptr(reg, "broken klass " #reg, __FILE__, __LINE__)
 969 
 970   // only if +VerifyFPU
 971   void verify_FPU(int stack_depth, const char* s = "illegal FPU state");
 972 
 973   // prints msg, dumps registers and stops execution
 974   void stop(const char* msg);
 975 
 976   static void debug64(char* msg, int64_t pc, int64_t regs[]);
 977 
 978   void untested()                                { stop("untested"); }
 979 
 980   void unimplemented(const char* what = "");
 981 
 982   void should_not_reach_here()                   { stop("should not reach here"); }
 983 




 984   // Stack overflow checking
 985   void bang_stack_with_offset(int offset) {
 986     // stack grows down, caller passes positive offset
 987     assert(offset > 0, "must bang with negative offset");
 988     sub(rscratch2, sp, offset);
 989     str(zr, Address(rscratch2));
 990   }
 991 
 992   // Writes to stack successive pages until offset reached to check for
 993   // stack overflow + shadow pages.  Also, clobbers tmp
 994   void bang_stack_size(Register size, Register tmp);
 995 
 996   // Check for reserved stack access in method being exited (for JIT)
 997   void reserved_stack_check();
 998 
 999   // Arithmetics
1000 
1001   void addptr(const Address &dst, int32_t src);
1002   void cmpptr(Register src1, Address src2);
1003 

1044 private:
1045   void compare_eq(Register rn, Register rm, enum operand_size size);
1046 
1047 #ifdef ASSERT
1048   // Template short-hand support to clean-up after a failed call to trampoline
1049   // call generation (see trampoline_call() below),  when a set of Labels must
1050   // be reset (before returning).
1051   template<typename Label, typename... More>
1052   void reset_labels(Label &lbl, More&... more) {
1053     lbl.reset(); reset_labels(more...);
1054   }
1055   template<typename Label>
1056   void reset_labels(Label &lbl) {
1057     lbl.reset();
1058   }
1059 #endif
1060 
1061 public:
1062   // Calls
1063 
1064   address trampoline_call(Address entry, CodeBuffer* cbuf = NULL);

1065 
1066   static bool far_branches() {
1067     return ReservedCodeCacheSize > branch_range;
1068   }
1069 
1070   // Jumps that can reach anywhere in the code cache.
1071   // Trashes tmp.
1072   void far_call(Address entry, CodeBuffer *cbuf = NULL, Register tmp = rscratch1);
1073   void far_jump(Address entry, CodeBuffer *cbuf = NULL, Register tmp = rscratch1);
1074 
1075   static int far_branch_size() {
1076     if (far_branches()) {
1077       return 3 * 4;  // adrp, add, br
1078     } else {
1079       return 4;
1080     }
1081   }
1082 
1083   // Emit the CompiledIC call idiom
1084   address ic_call(address entry, jint method_index = 0);

 665   // register to hold the constant. so, a register increment/decrement
 666   // may trash rscratch2 and an address increment/decrement trash
 667   // rscratch and rscratch2
 668 
 669   void decrementw(Address dst, int value = 1);
 670   void decrementw(Register reg, int value = 1);
 671 
 672   void decrement(Register reg, int value = 1);
 673   void decrement(Address dst, int value = 1);
 674 
 675   void incrementw(Address dst, int value = 1);
 676   void incrementw(Register reg, int value = 1);
 677 
 678   void increment(Register reg, int value = 1);
 679   void increment(Address dst, int value = 1);
 680 
 681 
 682   // Alignment
 683   void align(int modulus);
 684 
 685   // nop
 686   void post_call_nop() { nop(); }
 687 
 688   // Stack frame creation/removal
 689   void enter()
 690   {
 691     stp(rfp, lr, Address(pre(sp, -2 * wordSize)));
 692     mov(rfp, sp);
 693   }
 694   void leave()
 695   {
 696     mov(sp, rfp);
 697     ldp(rfp, lr, Address(post(sp, 2 * wordSize)));
 698   }
 699 
 700   // Support for getting the JavaThread pointer (i.e.; a reference to thread-local information)
 701   // The pointer will be loaded into the thread register.
 702   void get_thread(Register thread);
 703 
 704 
 705   // Support for VM calls
 706   //
 707   // It is imperative that all calls into the VM are handled via the call_VM macros.

 855 
 856   void set_narrow_oop(Register dst, jobject obj);
 857 
 858   void encode_klass_not_null(Register r);
 859   void decode_klass_not_null(Register r);
 860   void encode_klass_not_null(Register dst, Register src);
 861   void decode_klass_not_null(Register dst, Register src);
 862 
 863   void set_narrow_klass(Register dst, Klass* k);
 864 
 865   // if heap base register is used - reinit it with the correct value
 866   void reinit_heapbase();
 867 
 868   DEBUG_ONLY(void verify_heapbase(const char* msg);)
 869 
 870   void push_CPU_state(bool save_vectors = false, bool use_sve = false,
 871                       int sve_vector_size_in_bytes = 0);
 872   void pop_CPU_state(bool restore_vectors = false, bool use_sve = false,
 873                       int sve_vector_size_in_bytes = 0);
 874 
 875   void push_cont_fastpath(Register java_thread);
 876   void pop_cont_fastpath(Register java_thread);
 877   void inc_held_monitor_count(Register java_thread);
 878   void dec_held_monitor_count(Register java_thread);
 879   void reset_held_monitor_count(Register java_thread);
 880 
 881   // Round up to a power of two
 882   void round_to(Register reg, int modulus);
 883 
 884   // allocation
 885   void eden_allocate(
 886     Register obj,                      // result: pointer to object after successful allocation
 887     Register var_size_in_bytes,        // object size in bytes if unknown at compile time; invalid otherwise
 888     int      con_size_in_bytes,        // object size in bytes if   known at compile time
 889     Register t1,                       // temp register
 890     Label&   slow_case                 // continuation point if fast allocation fails
 891   );
 892   void tlab_allocate(
 893     Register obj,                      // result: pointer to object after successful allocation
 894     Register var_size_in_bytes,        // object size in bytes if unknown at compile time; invalid otherwise
 895     int      con_size_in_bytes,        // object size in bytes if   known at compile time
 896     Register t1,                       // temp register
 897     Register t2,                       // temp register
 898     Label&   slow_case                 // continuation point if fast allocation fails
 899   );
 900   void verify_tlab();

 973   void _verify_method_ptr(Register reg, const char * msg, const char * file, int line) {}
 974   void _verify_klass_ptr(Register reg, const char * msg, const char * file, int line){}
 975 
 976 #define verify_method_ptr(reg) _verify_method_ptr(reg, "broken method " #reg, __FILE__, __LINE__)
 977 #define verify_klass_ptr(reg) _verify_klass_ptr(reg, "broken klass " #reg, __FILE__, __LINE__)
 978 
 979   // only if +VerifyFPU
 980   void verify_FPU(int stack_depth, const char* s = "illegal FPU state");
 981 
 982   // prints msg, dumps registers and stops execution
 983   void stop(const char* msg);
 984 
 985   static void debug64(char* msg, int64_t pc, int64_t regs[]);
 986 
 987   void untested()                                { stop("untested"); }
 988 
 989   void unimplemented(const char* what = "");
 990 
 991   void should_not_reach_here()                   { stop("should not reach here"); }
 992 
 993   void _assert_asm(Condition cc, const char* msg);
 994 #define assert_asm0(cc, msg) _assert_asm(cc, FILE_AND_LINE ": " msg)
 995 #define assert_asm(masm, command, cc, msg) DEBUG_ONLY(command; (masm)->_assert_asm(cc, FILE_AND_LINE ": " #command " " #cc ": " msg))
 996 
 997   // Stack overflow checking
 998   void bang_stack_with_offset(int offset) {
 999     // stack grows down, caller passes positive offset
1000     assert(offset > 0, "must bang with negative offset");
1001     sub(rscratch2, sp, offset);
1002     str(zr, Address(rscratch2));
1003   }
1004 
1005   // Writes to stack successive pages until offset reached to check for
1006   // stack overflow + shadow pages.  Also, clobbers tmp
1007   void bang_stack_size(Register size, Register tmp);
1008 
1009   // Check for reserved stack access in method being exited (for JIT)
1010   void reserved_stack_check();
1011 
1012   // Arithmetics
1013 
1014   void addptr(const Address &dst, int32_t src);
1015   void cmpptr(Register src1, Address src2);
1016 

1057 private:
1058   void compare_eq(Register rn, Register rm, enum operand_size size);
1059 
1060 #ifdef ASSERT
1061   // Template short-hand support to clean-up after a failed call to trampoline
1062   // call generation (see trampoline_call() below),  when a set of Labels must
1063   // be reset (before returning).
1064   template<typename Label, typename... More>
1065   void reset_labels(Label &lbl, More&... more) {
1066     lbl.reset(); reset_labels(more...);
1067   }
1068   template<typename Label>
1069   void reset_labels(Label &lbl) {
1070     lbl.reset();
1071   }
1072 #endif
1073 
1074 public:
1075   // Calls
1076 
1077   address trampoline_call(Address entry, CodeBuffer* cbuf = NULL) { return trampoline_call1(entry, cbuf, true); }
1078   address trampoline_call1(Address entry, CodeBuffer* cbuf, bool check_emit_size = true);
1079 
1080   static bool far_branches() {
1081     return ReservedCodeCacheSize > branch_range;
1082   }
1083 
1084   // Jumps that can reach anywhere in the code cache.
1085   // Trashes tmp.
1086   void far_call(Address entry, CodeBuffer *cbuf = NULL, Register tmp = rscratch1);
1087   void far_jump(Address entry, CodeBuffer *cbuf = NULL, Register tmp = rscratch1);
1088 
1089   static int far_branch_size() {
1090     if (far_branches()) {
1091       return 3 * 4;  // adrp, add, br
1092     } else {
1093       return 4;
1094     }
1095   }
1096 
1097   // Emit the CompiledIC call idiom
1098   address ic_call(address entry, jint method_index = 0);
< prev index next >