src/cpu/x86/vm/stubGenerator_x86_64.cpp
Index Unified diffs Context diffs Sdiffs Wdiffs Patch New Old Previous File Next File 6958254 Sdiff src/cpu/x86/vm

src/cpu/x86/vm/stubGenerator_x86_64.cpp

Print this page




 897     __ popa();
 898     __ ret(0);                        // jump to next address
 899 
 900     return start;
 901   }
 902 
 903   // Non-destructive plausibility checks for oops
 904   //
 905   // Arguments:
 906   //    all args on stack!
 907   //
 908   // Stack after saving c_rarg3:
 909   //    [tos + 0]: saved c_rarg3
 910   //    [tos + 1]: saved c_rarg2
 911   //    [tos + 2]: saved r12 (several TemplateTable methods use it)
 912   //    [tos + 3]: saved flags
 913   //    [tos + 4]: return address
 914   //  * [tos + 5]: error message (char*)
 915   //  * [tos + 6]: object to verify (oop)
 916   //  * [tos + 7]: saved rax - saved by caller and bashed

 917   //  * = popped on exit
 918   address generate_verify_oop() {
 919     StubCodeMark mark(this, "StubRoutines", "verify_oop");
 920     address start = __ pc();
 921 
 922     Label exit, error;
 923 
 924     __ pushf();
 925     __ incrementl(ExternalAddress((address) StubRoutines::verify_oop_count_addr()));
 926 
 927     __ push(r12);
 928 
 929     // save c_rarg2 and c_rarg3
 930     __ push(c_rarg2);
 931     __ push(c_rarg3);
 932 
 933     enum {
 934            // After previous pushes.
 935            oop_to_verify = 6 * wordSize,
 936            saved_rax     = 7 * wordSize,

 937 
 938            // Before the call to MacroAssembler::debug(), see below.
 939            return_addr   = 16 * wordSize,
 940            error_msg     = 17 * wordSize
 941     };
 942 
 943     // get object
 944     __ movptr(rax, Address(rsp, oop_to_verify));
 945 
 946     // make sure object is 'reasonable'
 947     __ testptr(rax, rax);
 948     __ jcc(Assembler::zero, exit); // if obj is NULL it is OK
 949     // Check if the oop is in the right area of memory
 950     __ movptr(c_rarg2, rax);
 951     __ movptr(c_rarg3, (intptr_t) Universe::verify_oop_mask());
 952     __ andptr(c_rarg2, c_rarg3);
 953     __ movptr(c_rarg3, (intptr_t) Universe::verify_oop_bits());
 954     __ cmpptr(c_rarg2, c_rarg3);
 955     __ jcc(Assembler::notZero, error);
 956 


 966     __ movptr(c_rarg3, (intptr_t) Universe::verify_klass_mask());
 967     __ andptr(c_rarg2, c_rarg3);
 968     __ movptr(c_rarg3, (intptr_t) Universe::verify_klass_bits());
 969     __ cmpptr(c_rarg2, c_rarg3);
 970     __ jcc(Assembler::notZero, error);
 971 
 972     // make sure klass' klass is 'reasonable'
 973     __ load_klass(rax, rax);
 974     __ testptr(rax, rax);
 975     __ jcc(Assembler::zero, error); // if klass' klass is NULL it is broken
 976     // Check if the klass' klass is in the right area of memory
 977     __ movptr(c_rarg3, (intptr_t) Universe::verify_klass_mask());
 978     __ andptr(rax, c_rarg3);
 979     __ movptr(c_rarg3, (intptr_t) Universe::verify_klass_bits());
 980     __ cmpptr(rax, c_rarg3);
 981     __ jcc(Assembler::notZero, error);
 982 
 983     // return if everything seems ok
 984     __ bind(exit);
 985     __ movptr(rax, Address(rsp, saved_rax));     // get saved rax back

 986     __ pop(c_rarg3);                             // restore c_rarg3
 987     __ pop(c_rarg2);                             // restore c_rarg2
 988     __ pop(r12);                                 // restore r12
 989     __ popf();                                   // restore flags
 990     __ ret(3 * wordSize);                        // pop caller saved stuff
 991 
 992     // handle errors
 993     __ bind(error);
 994     __ movptr(rax, Address(rsp, saved_rax));     // get saved rax back

 995     __ pop(c_rarg3);                             // get saved c_rarg3 back
 996     __ pop(c_rarg2);                             // get saved c_rarg2 back
 997     __ pop(r12);                                 // get saved r12 back
 998     __ popf();                                   // get saved flags off stack --
 999                                                  // will be ignored
1000 
1001     __ pusha();                                  // push registers
1002                                                  // (rip is already
1003                                                  // already pushed)
1004     // debug(char* msg, int64_t pc, int64_t regs[])
1005     // We've popped the registers we'd saved (c_rarg3, c_rarg2 and flags), and
1006     // pushed all the registers, so now the stack looks like:
1007     //     [tos +  0] 16 saved registers
1008     //     [tos + 16] return address
1009     //   * [tos + 17] error message (char*)
1010     //   * [tos + 18] object to verify (oop)
1011     //   * [tos + 19] saved rax - saved by caller and bashed

1012     //   * = popped on exit
1013 
1014     __ movptr(c_rarg0, Address(rsp, error_msg));    // pass address of error message
1015     __ movptr(c_rarg1, Address(rsp, return_addr));  // pass return address
1016     __ movq(c_rarg2, rsp);                          // pass address of regs on stack
1017     __ mov(r12, rsp);                               // remember rsp
1018     __ subptr(rsp, frame::arg_reg_save_area_bytes); // windows
1019     __ andptr(rsp, -16);                            // align stack as required by ABI
1020     BLOCK_COMMENT("call MacroAssembler::debug");
1021     __ call(RuntimeAddress(CAST_FROM_FN_PTR(address, MacroAssembler::debug64)));
1022     __ mov(rsp, r12);                               // restore rsp
1023     __ popa();                                      // pop registers (includes r12)
1024     __ ret(3 * wordSize);                           // pop caller saved stuff
1025 
1026     return start;
1027   }
1028 
1029   static address disjoint_byte_copy_entry;
1030   static address disjoint_short_copy_entry;
1031   static address disjoint_int_copy_entry;
1032   static address disjoint_long_copy_entry;
1033   static address disjoint_oop_copy_entry;
1034 
1035   static address byte_copy_entry;
1036   static address short_copy_entry;
1037   static address int_copy_entry;
1038   static address long_copy_entry;
1039   static address oop_copy_entry;
1040 
1041   static address checkcast_copy_entry;
1042 
1043   //
1044   // Verify that a register contains clean 32-bits positive value




 897     __ popa();
 898     __ ret(0);                        // jump to next address
 899 
 900     return start;
 901   }
 902 
 903   // Non-destructive plausibility checks for oops
 904   //
 905   // Arguments:
 906   //    all args on stack!
 907   //
 908   // Stack after saving c_rarg3:
 909   //    [tos + 0]: saved c_rarg3
 910   //    [tos + 1]: saved c_rarg2
 911   //    [tos + 2]: saved r12 (several TemplateTable methods use it)
 912   //    [tos + 3]: saved flags
 913   //    [tos + 4]: return address
 914   //  * [tos + 5]: error message (char*)
 915   //  * [tos + 6]: object to verify (oop)
 916   //  * [tos + 7]: saved rax - saved by caller and bashed
 917   //  * [tos + 8]: saved r10 (rscratch1) - saved by caller
 918   //  * = popped on exit
 919   address generate_verify_oop() {
 920     StubCodeMark mark(this, "StubRoutines", "verify_oop");
 921     address start = __ pc();
 922 
 923     Label exit, error;
 924 
 925     __ pushf();
 926     __ incrementl(ExternalAddress((address) StubRoutines::verify_oop_count_addr()));
 927 
 928     __ push(r12);
 929 
 930     // save c_rarg2 and c_rarg3
 931     __ push(c_rarg2);
 932     __ push(c_rarg3);
 933 
 934     enum {
 935            // After previous pushes.
 936            oop_to_verify = 6 * wordSize,
 937            saved_rax     = 7 * wordSize,
 938            saved_r10     = 8 * wordSize,
 939 
 940            // Before the call to MacroAssembler::debug(), see below.
 941            return_addr   = 16 * wordSize,
 942            error_msg     = 17 * wordSize
 943     };
 944 
 945     // get object
 946     __ movptr(rax, Address(rsp, oop_to_verify));
 947 
 948     // make sure object is 'reasonable'
 949     __ testptr(rax, rax);
 950     __ jcc(Assembler::zero, exit); // if obj is NULL it is OK
 951     // Check if the oop is in the right area of memory
 952     __ movptr(c_rarg2, rax);
 953     __ movptr(c_rarg3, (intptr_t) Universe::verify_oop_mask());
 954     __ andptr(c_rarg2, c_rarg3);
 955     __ movptr(c_rarg3, (intptr_t) Universe::verify_oop_bits());
 956     __ cmpptr(c_rarg2, c_rarg3);
 957     __ jcc(Assembler::notZero, error);
 958 


 968     __ movptr(c_rarg3, (intptr_t) Universe::verify_klass_mask());
 969     __ andptr(c_rarg2, c_rarg3);
 970     __ movptr(c_rarg3, (intptr_t) Universe::verify_klass_bits());
 971     __ cmpptr(c_rarg2, c_rarg3);
 972     __ jcc(Assembler::notZero, error);
 973 
 974     // make sure klass' klass is 'reasonable'
 975     __ load_klass(rax, rax);
 976     __ testptr(rax, rax);
 977     __ jcc(Assembler::zero, error); // if klass' klass is NULL it is broken
 978     // Check if the klass' klass is in the right area of memory
 979     __ movptr(c_rarg3, (intptr_t) Universe::verify_klass_mask());
 980     __ andptr(rax, c_rarg3);
 981     __ movptr(c_rarg3, (intptr_t) Universe::verify_klass_bits());
 982     __ cmpptr(rax, c_rarg3);
 983     __ jcc(Assembler::notZero, error);
 984 
 985     // return if everything seems ok
 986     __ bind(exit);
 987     __ movptr(rax, Address(rsp, saved_rax));     // get saved rax back
 988     __ movptr(rscratch1, Address(rsp, saved_r10)); // get saved r10 back
 989     __ pop(c_rarg3);                             // restore c_rarg3
 990     __ pop(c_rarg2);                             // restore c_rarg2
 991     __ pop(r12);                                 // restore r12
 992     __ popf();                                   // restore flags
 993     __ ret(4 * wordSize);                        // pop caller saved stuff
 994 
 995     // handle errors
 996     __ bind(error);
 997     __ movptr(rax, Address(rsp, saved_rax));     // get saved rax back
 998     __ movptr(rscratch1, Address(rsp, saved_r10)); // get saved r10 back
 999     __ pop(c_rarg3);                             // get saved c_rarg3 back
1000     __ pop(c_rarg2);                             // get saved c_rarg2 back
1001     __ pop(r12);                                 // get saved r12 back
1002     __ popf();                                   // get saved flags off stack --
1003                                                  // will be ignored
1004 
1005     __ pusha();                                  // push registers
1006                                                  // (rip is already
1007                                                  // already pushed)
1008     // debug(char* msg, int64_t pc, int64_t regs[])
1009     // We've popped the registers we'd saved (c_rarg3, c_rarg2 and flags), and
1010     // pushed all the registers, so now the stack looks like:
1011     //     [tos +  0] 16 saved registers
1012     //     [tos + 16] return address
1013     //   * [tos + 17] error message (char*)
1014     //   * [tos + 18] object to verify (oop)
1015     //   * [tos + 19] saved rax - saved by caller and bashed
1016     //   * [tos + 20] saved r10 (rscratch1) - saved by caller
1017     //   * = popped on exit
1018 
1019     __ movptr(c_rarg0, Address(rsp, error_msg));    // pass address of error message
1020     __ movptr(c_rarg1, Address(rsp, return_addr));  // pass return address
1021     __ movq(c_rarg2, rsp);                          // pass address of regs on stack
1022     __ mov(r12, rsp);                               // remember rsp
1023     __ subptr(rsp, frame::arg_reg_save_area_bytes); // windows
1024     __ andptr(rsp, -16);                            // align stack as required by ABI
1025     BLOCK_COMMENT("call MacroAssembler::debug");
1026     __ call(RuntimeAddress(CAST_FROM_FN_PTR(address, MacroAssembler::debug64)));
1027     __ mov(rsp, r12);                               // restore rsp
1028     __ popa();                                      // pop registers (includes r12)
1029     __ ret(4 * wordSize);                           // pop caller saved stuff
1030 
1031     return start;
1032   }
1033 
1034   static address disjoint_byte_copy_entry;
1035   static address disjoint_short_copy_entry;
1036   static address disjoint_int_copy_entry;
1037   static address disjoint_long_copy_entry;
1038   static address disjoint_oop_copy_entry;
1039 
1040   static address byte_copy_entry;
1041   static address short_copy_entry;
1042   static address int_copy_entry;
1043   static address long_copy_entry;
1044   static address oop_copy_entry;
1045 
1046   static address checkcast_copy_entry;
1047 
1048   //
1049   // Verify that a register contains clean 32-bits positive value


src/cpu/x86/vm/stubGenerator_x86_64.cpp
Index Unified diffs Context diffs Sdiffs Wdiffs Patch New Old Previous File Next File