src/cpu/x86/vm/sharedRuntime_x86_64.cpp

changeset 548
ba764ed4b6f2
parent 435
a61af66fc99e
child 551
018d5b58dd4f
equal deleted inserted replaced
545:a49a647afe9a 548:ba764ed4b6f2
787 Register receiver = j_rarg0; 787 Register receiver = j_rarg0;
788 Register temp = rbx; 788 Register temp = rbx;
789 789
790 { 790 {
791 __ verify_oop(holder); 791 __ verify_oop(holder);
792 __ movq(temp, Address(receiver, oopDesc::klass_offset_in_bytes())); 792 __ load_klass(temp, receiver);
793 __ verify_oop(temp); 793 __ verify_oop(temp);
794 794
795 __ cmpq(temp, Address(holder, compiledICHolderOopDesc::holder_klass_offset())); 795 __ cmpq(temp, Address(holder, compiledICHolderOopDesc::holder_klass_offset()));
796 __ movq(rbx, Address(holder, compiledICHolderOopDesc::holder_method_offset())); 796 __ movq(rbx, Address(holder, compiledICHolderOopDesc::holder_method_offset()));
797 __ jcc(Assembler::equal, ok); 797 __ jcc(Assembler::equal, ok);
1295 // as far as the interpreter and the compiler(s) are concerned. 1295 // as far as the interpreter and the compiler(s) are concerned.
1296 1296
1297 1297
1298 const Register ic_reg = rax; 1298 const Register ic_reg = rax;
1299 const Register receiver = j_rarg0; 1299 const Register receiver = j_rarg0;
1300 const Register tmp = rdx;
1300 1301
1301 Label ok; 1302 Label ok;
1302 Label exception_pending; 1303 Label exception_pending;
1303 1304
1304 __ verify_oop(receiver); 1305 __ verify_oop(receiver);
1305 __ cmpq(ic_reg, Address(receiver, oopDesc::klass_offset_in_bytes())); 1306 __ pushq(tmp); // spill (any other registers free here???)
1307 __ load_klass(tmp, receiver);
1308 __ cmpq(ic_reg, tmp);
1306 __ jcc(Assembler::equal, ok); 1309 __ jcc(Assembler::equal, ok);
1307 1310
1311 __ popq(tmp);
1308 __ jump(RuntimeAddress(SharedRuntime::get_ic_miss_stub())); 1312 __ jump(RuntimeAddress(SharedRuntime::get_ic_miss_stub()));
1313
1314 __ bind(ok);
1315 __ popq(tmp);
1309 1316
1310 // Verified entry point must be aligned 1317 // Verified entry point must be aligned
1311 __ align(8); 1318 __ align(8);
1312
1313 __ bind(ok);
1314 1319
1315 int vep_offset = ((intptr_t)__ pc()) - start; 1320 int vep_offset = ((intptr_t)__ pc()) - start;
1316 1321
1317 // The instruction at the verified entry point must be 5 bytes or longer 1322 // The instruction at the verified entry point must be 5 bytes or longer
1318 // because it can be patched on the fly by make_non_entrant. The stack bang 1323 // because it can be patched on the fly by make_non_entrant. The stack bang
1661 __ movq(r12, rsp); // remember sp 1666 __ movq(r12, rsp); // remember sp
1662 __ subq(rsp, frame::arg_reg_save_area_bytes); // windows 1667 __ subq(rsp, frame::arg_reg_save_area_bytes); // windows
1663 __ andq(rsp, -16); // align stack as required by ABI 1668 __ andq(rsp, -16); // align stack as required by ABI
1664 __ call(RuntimeAddress(CAST_FROM_FN_PTR(address, JavaThread::check_special_condition_for_native_trans))); 1669 __ call(RuntimeAddress(CAST_FROM_FN_PTR(address, JavaThread::check_special_condition_for_native_trans)));
1665 __ movq(rsp, r12); // restore sp 1670 __ movq(rsp, r12); // restore sp
1671 __ reinit_heapbase();
1666 // Restore any method result value 1672 // Restore any method result value
1667 restore_native_result(masm, ret_type, stack_slots); 1673 restore_native_result(masm, ret_type, stack_slots);
1668 __ bind(Continue); 1674 __ bind(Continue);
1669 } 1675 }
1670 1676
1723 } 1729 }
1724 1730
1725 __ bind(done); 1731 __ bind(done);
1726 1732
1727 } 1733 }
1728
1729 { 1734 {
1730 SkipIfEqual skip(masm, &DTraceMethodProbes, false); 1735 SkipIfEqual skip(masm, &DTraceMethodProbes, false);
1731 save_native_result(masm, ret_type, stack_slots); 1736 save_native_result(masm, ret_type, stack_slots);
1732 __ movoop(c_rarg1, JNIHandles::make_local(method())); 1737 __ movoop(c_rarg1, JNIHandles::make_local(method()));
1733 __ call_VM_leaf( 1738 __ call_VM_leaf(
1827 __ movq(rbx, Address(r15_thread, in_bytes(Thread::pending_exception_offset()))); 1832 __ movq(rbx, Address(r15_thread, in_bytes(Thread::pending_exception_offset())));
1828 __ movptr(Address(r15_thread, in_bytes(Thread::pending_exception_offset())), (int)NULL_WORD); 1833 __ movptr(Address(r15_thread, in_bytes(Thread::pending_exception_offset())), (int)NULL_WORD);
1829 1834
1830 __ call(RuntimeAddress(CAST_FROM_FN_PTR(address, SharedRuntime::complete_monitor_unlocking_C))); 1835 __ call(RuntimeAddress(CAST_FROM_FN_PTR(address, SharedRuntime::complete_monitor_unlocking_C)));
1831 __ movq(rsp, r12); // restore sp 1836 __ movq(rsp, r12); // restore sp
1837 __ reinit_heapbase();
1832 #ifdef ASSERT 1838 #ifdef ASSERT
1833 { 1839 {
1834 Label L; 1840 Label L;
1835 __ cmpq(Address(r15_thread, in_bytes(Thread::pending_exception_offset())), (int)NULL_WORD); 1841 __ cmpq(Address(r15_thread, in_bytes(Thread::pending_exception_offset())), (int)NULL_WORD);
1836 __ jcc(Assembler::equal, L); 1842 __ jcc(Assembler::equal, L);
1857 __ movq(r12, rsp); // remember sp 1863 __ movq(r12, rsp); // remember sp
1858 __ subq(rsp, frame::arg_reg_save_area_bytes); // windows 1864 __ subq(rsp, frame::arg_reg_save_area_bytes); // windows
1859 __ andq(rsp, -16); // align stack as required by ABI 1865 __ andq(rsp, -16); // align stack as required by ABI
1860 __ call(RuntimeAddress(CAST_FROM_FN_PTR(address, SharedRuntime::reguard_yellow_pages))); 1866 __ call(RuntimeAddress(CAST_FROM_FN_PTR(address, SharedRuntime::reguard_yellow_pages)));
1861 __ movq(rsp, r12); // restore sp 1867 __ movq(rsp, r12); // restore sp
1868 __ reinit_heapbase();
1862 restore_native_result(masm, ret_type, stack_slots); 1869 restore_native_result(masm, ret_type, stack_slots);
1863 // and continue 1870 // and continue
1864 __ jmp(reguard_done); 1871 __ jmp(reguard_done);
1865 1872
1866 1873
1939 1946
1940 // Save everything in sight. 1947 // Save everything in sight.
1941 map = RegisterSaver::save_live_registers(masm, 0, &frame_size_in_words); 1948 map = RegisterSaver::save_live_registers(masm, 0, &frame_size_in_words);
1942 1949
1943 // Normal deoptimization. Save exec mode for unpack_frames. 1950 // Normal deoptimization. Save exec mode for unpack_frames.
1944 __ movl(r12, Deoptimization::Unpack_deopt); // callee-saved 1951 __ movl(r14, Deoptimization::Unpack_deopt); // callee-saved
1945 __ jmp(cont); 1952 __ jmp(cont);
1946
1947 int exception_offset = __ pc() - start; 1953 int exception_offset = __ pc() - start;
1948 1954
1949 // Prolog for exception case 1955 // Prolog for exception case
1950 1956
1951 // Push throwing pc as return address 1957 // Push throwing pc as return address
1953 1959
1954 // Save everything in sight. 1960 // Save everything in sight.
1955 map = RegisterSaver::save_live_registers(masm, 0, &frame_size_in_words); 1961 map = RegisterSaver::save_live_registers(masm, 0, &frame_size_in_words);
1956 1962
1957 // Deopt during an exception. Save exec mode for unpack_frames. 1963 // Deopt during an exception. Save exec mode for unpack_frames.
1958 __ movl(r12, Deoptimization::Unpack_exception); // callee-saved 1964 __ movl(r14, Deoptimization::Unpack_exception); // callee-saved
1959 1965
1960 __ bind(cont); 1966 __ bind(cont);
1961 1967
1962 // Call C code. Need thread and this frame, but NOT official VM entry 1968 // Call C code. Need thread and this frame, but NOT official VM entry
1963 // crud. We cannot block on this call, no GC can happen. 1969 // crud. We cannot block on this call, no GC can happen.
2086 2092
2087 // Use rbp because the frames look interpreted now 2093 // Use rbp because the frames look interpreted now
2088 __ set_last_Java_frame(noreg, rbp, NULL); 2094 __ set_last_Java_frame(noreg, rbp, NULL);
2089 2095
2090 __ movq(c_rarg0, r15_thread); 2096 __ movq(c_rarg0, r15_thread);
2091 __ movl(c_rarg1, r12); // second arg: exec_mode 2097 __ movl(c_rarg1, r14); // second arg: exec_mode
2092 __ call(RuntimeAddress(CAST_FROM_FN_PTR(address, Deoptimization::unpack_frames))); 2098 __ call(RuntimeAddress(CAST_FROM_FN_PTR(address, Deoptimization::unpack_frames)));
2093 2099
2094 // Set an oopmap for the call site 2100 // Set an oopmap for the call site
2095 oop_maps->add_gc_map(__ pc() - start, 2101 oop_maps->add_gc_map(__ pc() - start,
2096 new OopMap( frame_size_in_words, 0 )); 2102 new OopMap( frame_size_in_words, 0 ));

mercurial