comparison src/cpu/x86/vm/stubGenerator_x86_64.cpp @ 1583:02e771df338e

6958254: -XX:+VerifyOops is broken on x86 Summary: save and restore r10 in verify_oop(). Reviewed-by: never
author kvn
date Thu, 03 Jun 2010 14:20:27 -0700
parents c18cbe5936b8
children d6f45b55c972
comparison
equal deleted inserted replaced
1579:e9ff18c4ace7 1583:02e771df338e
912 // [tos + 3]: saved flags 912 // [tos + 3]: saved flags
913 // [tos + 4]: return address 913 // [tos + 4]: return address
914 // * [tos + 5]: error message (char*) 914 // * [tos + 5]: error message (char*)
915 // * [tos + 6]: object to verify (oop) 915 // * [tos + 6]: object to verify (oop)
916 // * [tos + 7]: saved rax - saved by caller and bashed 916 // * [tos + 7]: saved rax - saved by caller and bashed
917 // * [tos + 8]: saved r10 (rscratch1) - saved by caller
917 // * = popped on exit 918 // * = popped on exit
918 address generate_verify_oop() { 919 address generate_verify_oop() {
919 StubCodeMark mark(this, "StubRoutines", "verify_oop"); 920 StubCodeMark mark(this, "StubRoutines", "verify_oop");
920 address start = __ pc(); 921 address start = __ pc();
921 922
932 933
933 enum { 934 enum {
934 // After previous pushes. 935 // After previous pushes.
935 oop_to_verify = 6 * wordSize, 936 oop_to_verify = 6 * wordSize,
936 saved_rax = 7 * wordSize, 937 saved_rax = 7 * wordSize,
938 saved_r10 = 8 * wordSize,
937 939
938 // Before the call to MacroAssembler::debug(), see below. 940 // Before the call to MacroAssembler::debug(), see below.
939 return_addr = 16 * wordSize, 941 return_addr = 16 * wordSize,
940 error_msg = 17 * wordSize 942 error_msg = 17 * wordSize
941 }; 943 };
981 __ jcc(Assembler::notZero, error); 983 __ jcc(Assembler::notZero, error);
982 984
983 // return if everything seems ok 985 // return if everything seems ok
984 __ bind(exit); 986 __ bind(exit);
985 __ movptr(rax, Address(rsp, saved_rax)); // get saved rax back 987 __ movptr(rax, Address(rsp, saved_rax)); // get saved rax back
988 __ movptr(rscratch1, Address(rsp, saved_r10)); // get saved r10 back
986 __ pop(c_rarg3); // restore c_rarg3 989 __ pop(c_rarg3); // restore c_rarg3
987 __ pop(c_rarg2); // restore c_rarg2 990 __ pop(c_rarg2); // restore c_rarg2
988 __ pop(r12); // restore r12 991 __ pop(r12); // restore r12
989 __ popf(); // restore flags 992 __ popf(); // restore flags
990 __ ret(3 * wordSize); // pop caller saved stuff 993 __ ret(4 * wordSize); // pop caller saved stuff
991 994
992 // handle errors 995 // handle errors
993 __ bind(error); 996 __ bind(error);
994 __ movptr(rax, Address(rsp, saved_rax)); // get saved rax back 997 __ movptr(rax, Address(rsp, saved_rax)); // get saved rax back
998 __ movptr(rscratch1, Address(rsp, saved_r10)); // get saved r10 back
995 __ pop(c_rarg3); // get saved c_rarg3 back 999 __ pop(c_rarg3); // get saved c_rarg3 back
996 __ pop(c_rarg2); // get saved c_rarg2 back 1000 __ pop(c_rarg2); // get saved c_rarg2 back
997 __ pop(r12); // get saved r12 back 1001 __ pop(r12); // get saved r12 back
998 __ popf(); // get saved flags off stack -- 1002 __ popf(); // get saved flags off stack --
999 // will be ignored 1003 // will be ignored
1007 // [tos + 0] 16 saved registers 1011 // [tos + 0] 16 saved registers
1008 // [tos + 16] return address 1012 // [tos + 16] return address
1009 // * [tos + 17] error message (char*) 1013 // * [tos + 17] error message (char*)
1010 // * [tos + 18] object to verify (oop) 1014 // * [tos + 18] object to verify (oop)
1011 // * [tos + 19] saved rax - saved by caller and bashed 1015 // * [tos + 19] saved rax - saved by caller and bashed
1016 // * [tos + 20] saved r10 (rscratch1) - saved by caller
1012 // * = popped on exit 1017 // * = popped on exit
1013 1018
1014 __ movptr(c_rarg0, Address(rsp, error_msg)); // pass address of error message 1019 __ movptr(c_rarg0, Address(rsp, error_msg)); // pass address of error message
1015 __ movptr(c_rarg1, Address(rsp, return_addr)); // pass return address 1020 __ movptr(c_rarg1, Address(rsp, return_addr)); // pass return address
1016 __ movq(c_rarg2, rsp); // pass address of regs on stack 1021 __ movq(c_rarg2, rsp); // pass address of regs on stack
1019 __ andptr(rsp, -16); // align stack as required by ABI 1024 __ andptr(rsp, -16); // align stack as required by ABI
1020 BLOCK_COMMENT("call MacroAssembler::debug"); 1025 BLOCK_COMMENT("call MacroAssembler::debug");
1021 __ call(RuntimeAddress(CAST_FROM_FN_PTR(address, MacroAssembler::debug64))); 1026 __ call(RuntimeAddress(CAST_FROM_FN_PTR(address, MacroAssembler::debug64)));
1022 __ mov(rsp, r12); // restore rsp 1027 __ mov(rsp, r12); // restore rsp
1023 __ popa(); // pop registers (includes r12) 1028 __ popa(); // pop registers (includes r12)
1024 __ ret(3 * wordSize); // pop caller saved stuff 1029 __ ret(4 * wordSize); // pop caller saved stuff
1025 1030
1026 return start; 1031 return start;
1027 } 1032 }
1028 1033
1029 static address disjoint_byte_copy_entry; 1034 static address disjoint_byte_copy_entry;