656 void set_last_Java_frame(Register last_java_sp, Register last_Java_pc);
657 void reset_last_Java_frame(void);
658 void set_top_ijava_frame_at_SP_as_last_Java_frame(Register sp, Register tmp1);
659
660 // Read vm result from thread: oop_result = R16_thread->result;
661 void get_vm_result (Register oop_result);
662 void get_vm_result_2(Register metadata_result);
663
664 static bool needs_explicit_null_check(intptr_t offset);
665 static bool uses_implicit_null_check(void* address);
666
667 // Trap-instruction-based checks.
668 // Range checks can be distinguished from zero checks as they check 32 bit,
669 // zero checks all 64 bits (tw, td).
670 inline void trap_null_check(Register a, trap_to_bits cmp = traptoEqual);
671 static bool is_trap_null_check(int x) {
672 return is_tdi(x, traptoEqual, -1/*any reg*/, 0) ||
673 is_tdi(x, traptoGreaterThanUnsigned, -1/*any reg*/, 0);
674 }
675
676 inline void trap_zombie_not_entrant();
677 static bool is_trap_zombie_not_entrant(int x) { return is_tdi(x, traptoUnconditional, 0/*reg 0*/, 1); }
678
679 inline void trap_should_not_reach_here();
680 static bool is_trap_should_not_reach_here(int x) { return is_tdi(x, traptoUnconditional, 0/*reg 0*/, 2); }
681
682 inline void trap_ic_miss_check(Register a, Register b);
683 static bool is_trap_ic_miss_check(int x) {
684 return is_td(x, traptoGreaterThanUnsigned | traptoLessThanUnsigned, -1/*any reg*/, -1/*any reg*/);
685 }
686
687 // Implicit or explicit null check, jumps to static address exception_entry.
688 inline void null_check_throw(Register a, int offset, Register temp_reg, address exception_entry);
689 inline void null_check(Register a, int offset, Label *Lis_null); // implicit only if Lis_null not provided
690
691 // Access heap oop, handle encoding and GC barriers.
692 // Some GC barriers call C so use needs_frame = true if an extra frame is needed at the current call site.
693 private:
694 inline void access_store_at(BasicType type, DecoratorSet decorators,
695 Register base, RegisterOrConstant ind_or_offs, Register val,
696 Register tmp1, Register tmp2, Register tmp3, bool needs_frame);
697 inline void access_load_at(BasicType type, DecoratorSet decorators,
698 Register base, RegisterOrConstant ind_or_offs, Register dst,
699 Register tmp1, Register tmp2, bool needs_frame, Label *L_handle_null = NULL);
700
701 public:
846 void sha512_load_h_vec(const Register state, const VectorRegister* hs, const int total_hs);
847 void sha512_calc_2w(const VectorRegister w0, const VectorRegister w1,
848 const VectorRegister w2, const VectorRegister w3,
849 const VectorRegister w4, const VectorRegister w5,
850 const VectorRegister w6, const VectorRegister w7,
851 const VectorRegister kpw0, const VectorRegister kpw1, const Register j,
852 const VectorRegister vRb, const Register k);
853
854 public:
855 void sha256(bool multi_block);
856 void sha512(bool multi_block);
857
858 void cache_wb(Address line);
859 void cache_wbsync(bool is_presync);
860
861 //
862 // Debugging
863 //
864
865 // assert on cr0
866 void asm_assert(bool check_equal, const char* msg, int id);
867 void asm_assert_eq(const char* msg, int id) { asm_assert(true, msg, id); }
868 void asm_assert_ne(const char* msg, int id) { asm_assert(false, msg, id); }
869
870 private:
871 void asm_assert_mems_zero(bool check_equal, int size, int mem_offset, Register mem_base,
872 const char* msg, int id);
873
874 public:
875
876 void asm_assert_mem8_is_zero(int mem_offset, Register mem_base, const char* msg, int id) {
877 asm_assert_mems_zero(true, 8, mem_offset, mem_base, msg, id);
878 }
879 void asm_assert_mem8_isnot_zero(int mem_offset, Register mem_base, const char* msg, int id) {
880 asm_assert_mems_zero(false, 8, mem_offset, mem_base, msg, id);
881 }
882
883 // Verify R16_thread contents.
884 void verify_thread();
885
886 // Calls verify_oop. If UseCompressedOops is on, decodes the oop.
887 // Preserves reg.
888 void verify_coop(Register reg, const char*);
889 // Emit code to verify that reg contains a valid oop if +VerifyOops is set.
890 void verify_oop(Register reg, const char* s = "broken oop");
891 void verify_oop_addr(RegisterOrConstant offs, Register base, const char* s = "contains broken oop");
892
893 // TODO: verify method and klass metadata (compare against vptr?)
894 void _verify_method_ptr(Register reg, const char * msg, const char * file, int line) {}
895 void _verify_klass_ptr(Register reg, const char * msg, const char * file, int line) {}
896
897 // Convenience method returning function entry. For the ELFv1 case
898 // creates function descriptor at the current address and returs
899 // the pointer to it. For the ELFv2 case returns the current address.
900 inline address function_entry();
901
902 #define verify_method_ptr(reg) _verify_method_ptr(reg, "broken method " #reg, __FILE__, __LINE__)
903 #define verify_klass_ptr(reg) _verify_klass_ptr(reg, "broken klass " #reg, __FILE__, __LINE__)
904
905 private:
906
907 enum {
908 stop_stop = 0,
909 stop_untested = 1,
910 stop_unimplemented = 2,
911 stop_shouldnotreachhere = 3,
912 stop_end = 4
913 };
914 void stop(int type, const char* msg, int id);
915
916 public:
917 // Prints msg, dumps registers and stops execution.
918 void stop (const char* msg = "", int id = 0) { stop(stop_stop, msg, id); }
919 void untested (const char* msg = "", int id = 0) { stop(stop_untested, msg, id); }
920 void unimplemented(const char* msg = "", int id = 0) { stop(stop_unimplemented, msg, id); }
921 void should_not_reach_here() { stop(stop_shouldnotreachhere, "", -1); }
922
923 void zap_from_to(Register low, int before, Register high, int after, Register val, Register addr) PRODUCT_RETURN;
924 };
925
926 // class SkipIfEqualZero:
927 //
928 // Instantiating this class will result in assembly code being output that will
929 // jump around any code emitted between the creation of the instance and it's
930 // automatic destruction at the end of a scope block, depending on the value of
931 // the flag passed to the constructor, which will be checked at run-time.
932 class SkipIfEqualZero : public StackObj {
933 private:
934 MacroAssembler* _masm;
935 Label _label;
936
937 public:
938 // 'Temp' is a temp register that this object can use (and trash).
939 explicit SkipIfEqualZero(MacroAssembler*, Register temp, const bool* flag_addr);
940 static void skip_to_label_if_equal_zero(MacroAssembler*, Register temp,
941 const bool* flag_addr, Label& label);
|
656 void set_last_Java_frame(Register last_java_sp, Register last_Java_pc);
657 void reset_last_Java_frame(void);
658 void set_top_ijava_frame_at_SP_as_last_Java_frame(Register sp, Register tmp1);
659
660 // Read vm result from thread: oop_result = R16_thread->result;
661 void get_vm_result (Register oop_result);
662 void get_vm_result_2(Register metadata_result);
663
664 static bool needs_explicit_null_check(intptr_t offset);
665 static bool uses_implicit_null_check(void* address);
666
667 // Trap-instruction-based checks.
668 // Range checks can be distinguished from zero checks as they check 32 bit,
669 // zero checks all 64 bits (tw, td).
670 inline void trap_null_check(Register a, trap_to_bits cmp = traptoEqual);
671 static bool is_trap_null_check(int x) {
672 return is_tdi(x, traptoEqual, -1/*any reg*/, 0) ||
673 is_tdi(x, traptoGreaterThanUnsigned, -1/*any reg*/, 0);
674 }
675
676 inline void trap_ic_miss_check(Register a, Register b);
677 static bool is_trap_ic_miss_check(int x) {
678 return is_td(x, traptoGreaterThanUnsigned | traptoLessThanUnsigned, -1/*any reg*/, -1/*any reg*/);
679 }
680
681 // Implicit or explicit null check, jumps to static address exception_entry.
682 inline void null_check_throw(Register a, int offset, Register temp_reg, address exception_entry);
683 inline void null_check(Register a, int offset, Label *Lis_null); // implicit only if Lis_null not provided
684
685 // Access heap oop, handle encoding and GC barriers.
686 // Some GC barriers call C so use needs_frame = true if an extra frame is needed at the current call site.
687 private:
688 inline void access_store_at(BasicType type, DecoratorSet decorators,
689 Register base, RegisterOrConstant ind_or_offs, Register val,
690 Register tmp1, Register tmp2, Register tmp3, bool needs_frame);
691 inline void access_load_at(BasicType type, DecoratorSet decorators,
692 Register base, RegisterOrConstant ind_or_offs, Register dst,
693 Register tmp1, Register tmp2, bool needs_frame, Label *L_handle_null = NULL);
694
695 public:
840 void sha512_load_h_vec(const Register state, const VectorRegister* hs, const int total_hs);
841 void sha512_calc_2w(const VectorRegister w0, const VectorRegister w1,
842 const VectorRegister w2, const VectorRegister w3,
843 const VectorRegister w4, const VectorRegister w5,
844 const VectorRegister w6, const VectorRegister w7,
845 const VectorRegister kpw0, const VectorRegister kpw1, const Register j,
846 const VectorRegister vRb, const Register k);
847
848 public:
849 void sha256(bool multi_block);
850 void sha512(bool multi_block);
851
852 void cache_wb(Address line);
853 void cache_wbsync(bool is_presync);
854
855 //
856 // Debugging
857 //
858
859 // assert on cr0
860 void asm_assert(bool check_equal, const char* msg);
861 void asm_assert_eq(const char* msg) { asm_assert(true, msg); }
862 void asm_assert_ne(const char* msg) { asm_assert(false, msg); }
863
864 private:
865 void asm_assert_mems_zero(bool check_equal, int size, int mem_offset, Register mem_base,
866 const char* msg);
867
868 public:
869
870 void asm_assert_mem8_is_zero(int mem_offset, Register mem_base, const char* msg) {
871 asm_assert_mems_zero(true, 8, mem_offset, mem_base, msg);
872 }
873 void asm_assert_mem8_isnot_zero(int mem_offset, Register mem_base, const char* msg) {
874 asm_assert_mems_zero(false, 8, mem_offset, mem_base, msg);
875 }
876
877 // Verify R16_thread contents.
878 void verify_thread();
879
880 // Calls verify_oop. If UseCompressedOops is on, decodes the oop.
881 // Preserves reg.
882 void verify_coop(Register reg, const char*);
883 // Emit code to verify that reg contains a valid oop if +VerifyOops is set.
884 void verify_oop(Register reg, const char* s = "broken oop");
885 void verify_oop_addr(RegisterOrConstant offs, Register base, const char* s = "contains broken oop");
886
887 // TODO: verify method and klass metadata (compare against vptr?)
888 void _verify_method_ptr(Register reg, const char * msg, const char * file, int line) {}
889 void _verify_klass_ptr(Register reg, const char * msg, const char * file, int line) {}
890
891 // Convenience method returning function entry. For the ELFv1 case
892 // creates function descriptor at the current address and returs
893 // the pointer to it. For the ELFv2 case returns the current address.
894 inline address function_entry();
895
896 #define verify_method_ptr(reg) _verify_method_ptr(reg, "broken method " #reg, __FILE__, __LINE__)
897 #define verify_klass_ptr(reg) _verify_klass_ptr(reg, "broken klass " #reg, __FILE__, __LINE__)
898
899 private:
900 void stop(int type, const char* msg);
901
902 public:
903 enum {
904 stop_stop = 0,
905 stop_untested = 1,
906 stop_unimplemented = 2,
907 stop_shouldnotreachhere = 3
908 };
909
910 // Prints msg, dumps registers and stops execution.
911 void stop (const char* msg = NULL) { stop(stop_stop, msg ); }
912 void untested (const char* msg = NULL) { stop(stop_untested, msg ); }
913 void unimplemented(const char* msg = NULL) { stop(stop_unimplemented, msg ); }
914 void should_not_reach_here() { stop(stop_shouldnotreachhere, NULL); }
915
916 void zap_from_to(Register low, int before, Register high, int after, Register val, Register addr) PRODUCT_RETURN;
917 };
918
919 // class SkipIfEqualZero:
920 //
921 // Instantiating this class will result in assembly code being output that will
922 // jump around any code emitted between the creation of the instance and it's
923 // automatic destruction at the end of a scope block, depending on the value of
924 // the flag passed to the constructor, which will be checked at run-time.
925 class SkipIfEqualZero : public StackObj {
926 private:
927 MacroAssembler* _masm;
928 Label _label;
929
930 public:
931 // 'Temp' is a temp register that this object can use (and trash).
932 explicit SkipIfEqualZero(MacroAssembler*, Register temp, const bool* flag_addr);
933 static void skip_to_label_if_equal_zero(MacroAssembler*, Register temp,
934 const bool* flag_addr, Label& label);
|