Mercurial > hg > truffle
comparison src/cpu/ppc/vm/sharedRuntime_ppc.cpp @ 14726:92aa6797d639
Backed out merge changeset: b51e29501f30
Backed out merge revision to its first parent (8f483e200405)
author | Doug Simon <doug.simon@oracle.com> |
---|---|
date | Mon, 24 Mar 2014 21:30:43 +0100 |
parents | 58cf34613a72 |
children |
comparison
equal
deleted
inserted
replaced
14719:0bdd0d157040 | 14726:92aa6797d639 |
---|---|
1 /* | 1 /* |
2 * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved. | 2 * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved. |
3 * Copyright 2012, 2014 SAP AG. All rights reserved. | 3 * Copyright 2012, 2013 SAP AG. All rights reserved. |
4 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. | 4 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
5 * | 5 * |
6 * This code is free software; you can redistribute it and/or modify it | 6 * This code is free software; you can redistribute it and/or modify it |
7 * under the terms of the GNU General Public License version 2 only, as | 7 * under the terms of the GNU General Public License version 2 only, as |
8 * published by the Free Software Foundation. | 8 * published by the Free Software Foundation. |
65 return_pc_is_lr, | 65 return_pc_is_lr, |
66 return_pc_is_r4, | 66 return_pc_is_r4, |
67 return_pc_is_thread_saved_exception_pc | 67 return_pc_is_thread_saved_exception_pc |
68 }; | 68 }; |
69 | 69 |
70 static OopMap* push_frame_reg_args_and_save_live_registers(MacroAssembler* masm, | 70 static OopMap* push_frame_abi112_and_save_live_registers(MacroAssembler* masm, |
71 int* out_frame_size_in_bytes, | 71 int* out_frame_size_in_bytes, |
72 bool generate_oop_map, | 72 bool generate_oop_map, |
73 int return_pc_adjustment, | 73 int return_pc_adjustment, |
74 ReturnPCLocation return_pc_location); | 74 ReturnPCLocation return_pc_location); |
75 static void restore_live_registers_and_pop_frame(MacroAssembler* masm, | 75 static void restore_live_registers_and_pop_frame(MacroAssembler* masm, |
198 RegisterSaver_LiveIntReg( R29 ), | 198 RegisterSaver_LiveIntReg( R29 ), |
199 RegisterSaver_LiveIntReg( R31 ), | 199 RegisterSaver_LiveIntReg( R31 ), |
200 RegisterSaver_LiveIntReg( R30 ), // r30 must be the last register | 200 RegisterSaver_LiveIntReg( R30 ), // r30 must be the last register |
201 }; | 201 }; |
202 | 202 |
203 OopMap* RegisterSaver::push_frame_reg_args_and_save_live_registers(MacroAssembler* masm, | 203 OopMap* RegisterSaver::push_frame_abi112_and_save_live_registers(MacroAssembler* masm, |
204 int* out_frame_size_in_bytes, | 204 int* out_frame_size_in_bytes, |
205 bool generate_oop_map, | 205 bool generate_oop_map, |
206 int return_pc_adjustment, | 206 int return_pc_adjustment, |
207 ReturnPCLocation return_pc_location) { | 207 ReturnPCLocation return_pc_location) { |
208 // Push an abi_reg_args-frame and store all registers which may be live. | 208 // Push an abi112-frame and store all registers which may be live. |
209 // If requested, create an OopMap: Record volatile registers as | 209 // If requested, create an OopMap: Record volatile registers as |
210 // callee-save values in an OopMap so their save locations will be | 210 // callee-save values in an OopMap so their save locations will be |
211 // propagated to the RegisterMap of the caller frame during | 211 // propagated to the RegisterMap of the caller frame during |
212 // StackFrameStream construction (needed for deoptimization; see | 212 // StackFrameStream construction (needed for deoptimization; see |
213 // compiledVFrame::create_stack_value). | 213 // compiledVFrame::create_stack_value). |
219 // calcualte frame size | 219 // calcualte frame size |
220 const int regstosave_num = sizeof(RegisterSaver_LiveRegs) / | 220 const int regstosave_num = sizeof(RegisterSaver_LiveRegs) / |
221 sizeof(RegisterSaver::LiveRegType); | 221 sizeof(RegisterSaver::LiveRegType); |
222 const int register_save_size = regstosave_num * reg_size; | 222 const int register_save_size = regstosave_num * reg_size; |
223 const int frame_size_in_bytes = round_to(register_save_size, frame::alignment_in_bytes) | 223 const int frame_size_in_bytes = round_to(register_save_size, frame::alignment_in_bytes) |
224 + frame::abi_reg_args_size; | 224 + frame::abi_112_size; |
225 *out_frame_size_in_bytes = frame_size_in_bytes; | 225 *out_frame_size_in_bytes = frame_size_in_bytes; |
226 const int frame_size_in_slots = frame_size_in_bytes / sizeof(jint); | 226 const int frame_size_in_slots = frame_size_in_bytes / sizeof(jint); |
227 const int register_save_offset = frame_size_in_bytes - register_save_size; | 227 const int register_save_offset = frame_size_in_bytes - register_save_size; |
228 | 228 |
229 // OopMap frame size is in c2 stack slots (sizeof(jint)) not bytes or words. | 229 // OopMap frame size is in c2 stack slots (sizeof(jint)) not bytes or words. |
230 OopMap* map = generate_oop_map ? new OopMap(frame_size_in_slots, 0) : NULL; | 230 OopMap* map = generate_oop_map ? new OopMap(frame_size_in_slots, 0) : NULL; |
231 | 231 |
232 BLOCK_COMMENT("push_frame_reg_args_and_save_live_registers {"); | 232 BLOCK_COMMENT("push_frame_abi112_and_save_live_registers {"); |
233 | 233 |
234 // Save r30 in the last slot of the not yet pushed frame so that we | 234 // Save r30 in the last slot of the not yet pushed frame so that we |
235 // can use it as scratch reg. | 235 // can use it as scratch reg. |
236 __ std(R30, -reg_size, R1_SP); | 236 __ std(R30, -reg_size, R1_SP); |
237 assert(-reg_size == register_save_offset - frame_size_in_bytes + ((regstosave_num-1)*reg_size), | 237 assert(-reg_size == register_save_offset - frame_size_in_bytes + ((regstosave_num-1)*reg_size), |
292 RegisterSaver_LiveRegs[i].vmreg->next()); | 292 RegisterSaver_LiveRegs[i].vmreg->next()); |
293 } | 293 } |
294 offset += reg_size; | 294 offset += reg_size; |
295 } | 295 } |
296 | 296 |
297 BLOCK_COMMENT("} push_frame_reg_args_and_save_live_registers"); | 297 BLOCK_COMMENT("} push_frame_abi112_and_save_live_registers"); |
298 | 298 |
299 // And we're done. | 299 // And we're done. |
300 return map; | 300 return map; |
301 } | 301 } |
302 | 302 |
697 const int inc_stk_for_intfloat = 2; // 2 slots for ints and floats | 697 const int inc_stk_for_intfloat = 2; // 2 slots for ints and floats |
698 const int inc_stk_for_longdouble = 2; // 2 slots for longs and doubles | 698 const int inc_stk_for_longdouble = 2; // 2 slots for longs and doubles |
699 | 699 |
700 int i; | 700 int i; |
701 VMReg reg; | 701 VMReg reg; |
702 // Leave room for C-compatible ABI_REG_ARGS. | 702 // Leave room for C-compatible ABI_112. |
703 int stk = (frame::abi_reg_args_size - frame::jit_out_preserve_size) / VMRegImpl::stack_slot_size; | 703 int stk = (frame::abi_112_size - frame::jit_out_preserve_size) / VMRegImpl::stack_slot_size; |
704 int arg = 0; | 704 int arg = 0; |
705 int freg = 0; | 705 int freg = 0; |
706 | 706 |
707 // Avoid passing C arguments in the wrong stack slots. | 707 // Avoid passing C arguments in the wrong stack slots. |
708 #if defined(ABI_ELFv2) | |
709 assert((SharedRuntime::out_preserve_stack_slots() + stk) * VMRegImpl::stack_slot_size == 96, | |
710 "passing C arguments in wrong stack slots"); | |
711 #else | |
712 assert((SharedRuntime::out_preserve_stack_slots() + stk) * VMRegImpl::stack_slot_size == 112, | 708 assert((SharedRuntime::out_preserve_stack_slots() + stk) * VMRegImpl::stack_slot_size == 112, |
713 "passing C arguments in wrong stack slots"); | 709 "passing C arguments in wrong stack slots"); |
714 #endif | 710 |
715 // We fill-out regs AND regs2 if an argument must be passed in a | 711 // We fill-out regs AND regs2 if an argument must be passed in a |
716 // register AND in a stack slot. If regs2 is NULL in such a | 712 // register AND in a stack slot. If regs2 is NULL in such a |
717 // situation, we bail-out with a fatal error. | 713 // situation, we bail-out with a fatal error. |
718 for (int i = 0; i < total_args_passed; ++i, ++arg) { | 714 for (int i = 0; i < total_args_passed; ++i, ++arg) { |
719 // Initialize regs2 to BAD. | 715 // Initialize regs2 to BAD. |
955 | 951 |
956 // Jump to the interpreter just as if interpreter was doing it. | 952 // Jump to the interpreter just as if interpreter was doing it. |
957 | 953 |
958 #ifdef CC_INTERP | 954 #ifdef CC_INTERP |
959 const Register tos = R17_tos; | 955 const Register tos = R17_tos; |
960 #else | |
961 const Register tos = R15_esp; | |
962 __ load_const_optimized(R25_templateTableBase, (address)Interpreter::dispatch_table((TosState)0), R11_scratch1); | |
963 #endif | 956 #endif |
964 | 957 |
965 // load TOS | 958 // load TOS |
966 __ addi(tos, R1_SP, st_off); | 959 __ addi(tos, R1_SP, st_off); |
967 | 960 |
976 int total_args_passed, | 969 int total_args_passed, |
977 int comp_args_on_stack, | 970 int comp_args_on_stack, |
978 const BasicType *sig_bt, | 971 const BasicType *sig_bt, |
979 const VMRegPair *regs) { | 972 const VMRegPair *regs) { |
980 | 973 |
981 // Load method's entry-point from method. | 974 // Load method's entry-point from methodOop. |
982 __ ld(R12_scratch2, in_bytes(Method::from_compiled_offset()), R19_method); | 975 __ ld(R12_scratch2, in_bytes(Method::from_compiled_offset()), R19_method); |
983 __ mtctr(R12_scratch2); | 976 __ mtctr(R12_scratch2); |
984 | 977 |
985 // We will only enter here from an interpreted frame and never from after | 978 // We will only enter here from an interpreted frame and never from after |
986 // passing thru a c2i. Azul allowed this but we do not. If we lose the | 979 // passing thru a c2i. Azul allowed this but we do not. If we lose the |
997 // save code can segv when fxsave instructions find improperly | 990 // save code can segv when fxsave instructions find improperly |
998 // aligned stack pointer. | 991 // aligned stack pointer. |
999 | 992 |
1000 #ifdef CC_INTERP | 993 #ifdef CC_INTERP |
1001 const Register ld_ptr = R17_tos; | 994 const Register ld_ptr = R17_tos; |
1002 #else | |
1003 const Register ld_ptr = R15_esp; | |
1004 #endif | 995 #endif |
1005 | |
1006 const Register value_regs[] = { R22_tmp2, R23_tmp3, R24_tmp4, R25_tmp5, R26_tmp6 }; | 996 const Register value_regs[] = { R22_tmp2, R23_tmp3, R24_tmp4, R25_tmp5, R26_tmp6 }; |
1007 const int num_value_regs = sizeof(value_regs) / sizeof(Register); | 997 const int num_value_regs = sizeof(value_regs) / sizeof(Register); |
1008 int value_regs_index = 0; | 998 int value_regs_index = 0; |
1009 | 999 |
1010 int ld_offset = total_args_passed*wordSize; | 1000 int ld_offset = total_args_passed*wordSize; |
1091 } | 1081 } |
1092 } | 1082 } |
1093 } | 1083 } |
1094 } | 1084 } |
1095 | 1085 |
1096 BLOCK_COMMENT("Store method"); | 1086 BLOCK_COMMENT("Store method oop"); |
1097 // Store method into thread->callee_target. | 1087 // Store method oop into thread->callee_target. |
1098 // We might end up in handle_wrong_method if the callee is | 1088 // We might end up in handle_wrong_method if the callee is |
1099 // deoptimized as we race thru here. If that happens we don't want | 1089 // deoptimized as we race thru here. If that happens we don't want |
1100 // to take a safepoint because the caller frame will look | 1090 // to take a safepoint because the caller frame will look |
1101 // interpreted and arguments are now "compiled" so it is much better | 1091 // interpreted and arguments are now "compiled" so it is much better |
1102 // to make this transition invisible to the stack walking | 1092 // to make this transition invisible to the stack walking |
1512 __ mr(R3_ARG1, R16_thread); | 1502 __ mr(R3_ARG1, R16_thread); |
1513 __ set_last_Java_frame(R1_SP, noreg); | 1503 __ set_last_Java_frame(R1_SP, noreg); |
1514 | 1504 |
1515 __ block_comment("block_for_jni_critical"); | 1505 __ block_comment("block_for_jni_critical"); |
1516 address entry_point = CAST_FROM_FN_PTR(address, SharedRuntime::block_for_jni_critical); | 1506 address entry_point = CAST_FROM_FN_PTR(address, SharedRuntime::block_for_jni_critical); |
1517 #if defined(ABI_ELFv2) | |
1518 __ call_c(entry_point, relocInfo::runtime_call_type); | |
1519 #else | |
1520 __ call_c(CAST_FROM_FN_PTR(FunctionDescriptor*, entry_point), relocInfo::runtime_call_type); | 1507 __ call_c(CAST_FROM_FN_PTR(FunctionDescriptor*, entry_point), relocInfo::runtime_call_type); |
1521 #endif | |
1522 address start = __ pc() - __ offset(), | 1508 address start = __ pc() - __ offset(), |
1523 calls_return_pc = __ last_calls_return_pc(); | 1509 calls_return_pc = __ last_calls_return_pc(); |
1524 oop_maps->add_gc_map(calls_return_pc - start, map); | 1510 oop_maps->add_gc_map(calls_return_pc - start, map); |
1525 | 1511 |
1526 __ reset_last_Java_frame(); | 1512 __ reset_last_Java_frame(); |
1889 // 7) alignment | 1875 // 7) alignment |
1890 // | 1876 // |
1891 // Layout of the native wrapper frame: | 1877 // Layout of the native wrapper frame: |
1892 // (stack grows upwards, memory grows downwards) | 1878 // (stack grows upwards, memory grows downwards) |
1893 // | 1879 // |
1894 // NW [ABI_REG_ARGS] <-- 1) R1_SP | 1880 // NW [ABI_112] <-- 1) R1_SP |
1895 // [outgoing arguments] <-- 2) R1_SP + out_arg_slot_offset | 1881 // [outgoing arguments] <-- 2) R1_SP + out_arg_slot_offset |
1896 // [oopHandle area] <-- 3) R1_SP + oop_handle_offset (save area for critical natives) | 1882 // [oopHandle area] <-- 3) R1_SP + oop_handle_offset (save area for critical natives) |
1897 // klass <-- 4) R1_SP + klass_offset | 1883 // klass <-- 4) R1_SP + klass_offset |
1898 // lock <-- 5) R1_SP + lock_offset | 1884 // lock <-- 5) R1_SP + lock_offset |
1899 // [workspace] <-- 6) R1_SP + workspace_offset | 1885 // [workspace] <-- 6) R1_SP + workspace_offset |
2223 | 2209 |
2224 // None of the above fast optimizations worked so we have to get into the | 2210 // None of the above fast optimizations worked so we have to get into the |
2225 // slow case of monitor enter. Inline a special case of call_VM that | 2211 // slow case of monitor enter. Inline a special case of call_VM that |
2226 // disallows any pending_exception. | 2212 // disallows any pending_exception. |
2227 | 2213 |
2228 // Save argument registers and leave room for C-compatible ABI_REG_ARGS. | 2214 // Save argument registers and leave room for C-compatible ABI_112. |
2229 int frame_size = frame::abi_reg_args_size + | 2215 int frame_size = frame::abi_112_size + |
2230 round_to(total_c_args * wordSize, frame::alignment_in_bytes); | 2216 round_to(total_c_args * wordSize, frame::alignment_in_bytes); |
2231 __ mr(R11_scratch1, R1_SP); | 2217 __ mr(R11_scratch1, R1_SP); |
2232 RegisterSaver::push_frame_and_save_argument_registers(masm, R12_scratch2, frame_size, total_c_args, out_regs, out_regs2); | 2218 RegisterSaver::push_frame_and_save_argument_registers(masm, R12_scratch2, frame_size, total_c_args, out_regs, out_regs2); |
2233 | 2219 |
2234 // Do the call. | 2220 // Do the call. |
2262 } | 2248 } |
2263 | 2249 |
2264 | 2250 |
2265 // The JNI call | 2251 // The JNI call |
2266 // -------------------------------------------------------------------------- | 2252 // -------------------------------------------------------------------------- |
2267 #if defined(ABI_ELFv2) | 2253 |
2268 __ call_c(native_func, relocInfo::runtime_call_type); | |
2269 #else | |
2270 FunctionDescriptor* fd_native_method = (FunctionDescriptor*) native_func; | 2254 FunctionDescriptor* fd_native_method = (FunctionDescriptor*) native_func; |
2271 __ call_c(fd_native_method, relocInfo::runtime_call_type); | 2255 __ call_c(fd_native_method, relocInfo::runtime_call_type); |
2272 #endif | |
2273 | 2256 |
2274 | 2257 |
2275 // Now, we are back from the native code. | 2258 // Now, we are back from the native code. |
2276 | 2259 |
2277 | 2260 |
2621 __ std(pc_reg, _abi(lr), R1_SP); | 2604 __ std(pc_reg, _abi(lr), R1_SP); |
2622 __ push_frame(frame_size_reg, R0/*tmp*/); | 2605 __ push_frame(frame_size_reg, R0/*tmp*/); |
2623 #ifdef CC_INTERP | 2606 #ifdef CC_INTERP |
2624 __ std(R1_SP, _parent_ijava_frame_abi(initial_caller_sp), R1_SP); | 2607 __ std(R1_SP, _parent_ijava_frame_abi(initial_caller_sp), R1_SP); |
2625 #else | 2608 #else |
2626 #ifdef ASSERT | 2609 Unimplemented(); |
2627 __ load_const_optimized(pc_reg, 0x5afe); | |
2628 __ std(pc_reg, _ijava_state_neg(ijava_reserved), R1_SP); | |
2629 #endif | 2610 #endif |
2630 __ std(R1_SP, _ijava_state_neg(sender_sp), R1_SP); | |
2631 #endif // CC_INTERP | |
2632 __ addi(number_of_frames_reg, number_of_frames_reg, -1); | 2611 __ addi(number_of_frames_reg, number_of_frames_reg, -1); |
2633 __ addi(frame_sizes_reg, frame_sizes_reg, wordSize); | 2612 __ addi(frame_sizes_reg, frame_sizes_reg, wordSize); |
2634 __ addi(pcs_reg, pcs_reg, wordSize); | 2613 __ addi(pcs_reg, pcs_reg, wordSize); |
2635 } | 2614 } |
2636 | 2615 |
2698 // In the case where we have resized a c2i frame above, the optional | 2677 // In the case where we have resized a c2i frame above, the optional |
2699 // alignment below the locals has size 32 (why?). | 2678 // alignment below the locals has size 32 (why?). |
2700 __ std(R12_scratch2, _abi(lr), R1_SP); | 2679 __ std(R12_scratch2, _abi(lr), R1_SP); |
2701 | 2680 |
2702 // Initialize initial_caller_sp. | 2681 // Initialize initial_caller_sp. |
2703 #ifdef CC_INTERP | |
2704 __ std(frame_size_reg/*old_sp*/, _parent_ijava_frame_abi(initial_caller_sp), R1_SP); | 2682 __ std(frame_size_reg/*old_sp*/, _parent_ijava_frame_abi(initial_caller_sp), R1_SP); |
2705 #else | |
2706 #ifdef ASSERT | |
2707 __ load_const_optimized(pc_reg, 0x5afe); | |
2708 __ std(pc_reg, _ijava_state_neg(ijava_reserved), R1_SP); | |
2709 #endif | |
2710 __ std(frame_size_reg, _ijava_state_neg(sender_sp), R1_SP); | |
2711 #endif // CC_INTERP | |
2712 | 2683 |
2713 #ifdef ASSERT | 2684 #ifdef ASSERT |
2714 // Make sure that there is at least one entry in the array. | 2685 // Make sure that there is at least one entry in the array. |
2715 __ cmpdi(CCR0, number_of_frames_reg, 0); | 2686 __ cmpdi(CCR0, number_of_frames_reg, 0); |
2716 __ asm_assert_ne("array_size must be > 0", 0x205); | 2687 __ asm_assert_ne("array_size must be > 0", 0x205); |
2751 int frame_size_in_words; | 2722 int frame_size_in_words; |
2752 OopMap* map = NULL; | 2723 OopMap* map = NULL; |
2753 OopMapSet *oop_maps = new OopMapSet(); | 2724 OopMapSet *oop_maps = new OopMapSet(); |
2754 | 2725 |
2755 // size of ABI112 plus spill slots for R3_RET and F1_RET. | 2726 // size of ABI112 plus spill slots for R3_RET and F1_RET. |
2756 const int frame_size_in_bytes = frame::abi_reg_args_spill_size; | 2727 const int frame_size_in_bytes = frame::abi_112_spill_size; |
2757 const int frame_size_in_slots = frame_size_in_bytes / sizeof(jint); | 2728 const int frame_size_in_slots = frame_size_in_bytes / sizeof(jint); |
2758 int first_frame_size_in_bytes = 0; // frame size of "unpack frame" for call to fetch_unroll_info. | 2729 int first_frame_size_in_bytes = 0; // frame size of "unpack frame" for call to fetch_unroll_info. |
2759 | 2730 |
2760 const Register exec_mode_reg = R21_tmp1; | 2731 const Register exec_mode_reg = R21_tmp1; |
2761 | 2732 |
2784 // of the return pc. | 2755 // of the return pc. |
2785 const int return_pc_adjustment_no_exception = -size_deopt_handler(); | 2756 const int return_pc_adjustment_no_exception = -size_deopt_handler(); |
2786 | 2757 |
2787 // Push the "unpack frame" | 2758 // Push the "unpack frame" |
2788 // Save everything in sight. | 2759 // Save everything in sight. |
2789 map = RegisterSaver::push_frame_reg_args_and_save_live_registers(masm, | 2760 map = RegisterSaver::push_frame_abi112_and_save_live_registers(masm, |
2790 &first_frame_size_in_bytes, | 2761 &first_frame_size_in_bytes, |
2791 /*generate_oop_map=*/ true, | 2762 /*generate_oop_map=*/ true, |
2792 return_pc_adjustment_no_exception, | 2763 return_pc_adjustment_no_exception, |
2793 RegisterSaver::return_pc_is_lr); | 2764 RegisterSaver::return_pc_is_lr); |
2794 assert(map != NULL, "OopMap must have been created"); | 2765 assert(map != NULL, "OopMap must have been created"); |
2795 | 2766 |
2796 __ li(exec_mode_reg, Deoptimization::Unpack_deopt); | 2767 __ li(exec_mode_reg, Deoptimization::Unpack_deopt); |
2797 // Save exec mode for unpack_frames. | 2768 // Save exec mode for unpack_frames. |
2798 __ b(exec_mode_initialized); | 2769 __ b(exec_mode_initialized); |
2814 const int return_pc_adjustment_exception = 0; | 2785 const int return_pc_adjustment_exception = 0; |
2815 | 2786 |
2816 // Push the "unpack frame". | 2787 // Push the "unpack frame". |
2817 // Save everything in sight. | 2788 // Save everything in sight. |
2818 assert(R4 == R4_ARG2, "exception pc must be in r4"); | 2789 assert(R4 == R4_ARG2, "exception pc must be in r4"); |
2819 RegisterSaver::push_frame_reg_args_and_save_live_registers(masm, | 2790 RegisterSaver::push_frame_abi112_and_save_live_registers(masm, |
2820 &first_frame_size_in_bytes, | 2791 &first_frame_size_in_bytes, |
2821 /*generate_oop_map=*/ false, | 2792 /*generate_oop_map=*/ false, |
2822 return_pc_adjustment_exception, | 2793 return_pc_adjustment_exception, |
2823 RegisterSaver::return_pc_is_r4); | 2794 RegisterSaver::return_pc_is_r4); |
2824 | 2795 |
2825 // Deopt during an exception. Save exec mode for unpack_frames. | 2796 // Deopt during an exception. Save exec mode for unpack_frames. |
2826 __ li(exec_mode_reg, Deoptimization::Unpack_exception); | 2797 __ li(exec_mode_reg, Deoptimization::Unpack_exception); |
2827 | 2798 |
2828 // Store exception oop and pc in thread (location known to GC). | 2799 // Store exception oop and pc in thread (location known to GC). |
2903 // stack: (unpack frame, skeletal interpreter frame, ..., optional | 2874 // stack: (unpack frame, skeletal interpreter frame, ..., optional |
2904 // skeletal interpreter frame, optional c2i, caller of deoptee, | 2875 // skeletal interpreter frame, optional c2i, caller of deoptee, |
2905 // ...). | 2876 // ...). |
2906 | 2877 |
2907 // Spill live volatile registers since we'll do a call. | 2878 // Spill live volatile registers since we'll do a call. |
2908 __ std( R3_RET, _abi_reg_args_spill(spill_ret), R1_SP); | 2879 __ std( R3_RET, _abi_112_spill(spill_ret), R1_SP); |
2909 __ stfd(F1_RET, _abi_reg_args_spill(spill_fret), R1_SP); | 2880 __ stfd(F1_RET, _abi_112_spill(spill_fret), R1_SP); |
2910 | 2881 |
2911 // Let the unpacker layout information in the skeletal frames just | 2882 // Let the unpacker layout information in the skeletal frames just |
2912 // allocated. | 2883 // allocated. |
2913 __ get_PC_trash_LR(R3_RET); | 2884 __ get_PC_trash_LR(R3_RET); |
2914 __ set_last_Java_frame(/*sp*/R1_SP, /*pc*/R3_RET); | 2885 __ set_last_Java_frame(/*sp*/R1_SP, /*pc*/R3_RET); |
2916 __ call_VM_leaf(CAST_FROM_FN_PTR(address, Deoptimization::unpack_frames), | 2887 __ call_VM_leaf(CAST_FROM_FN_PTR(address, Deoptimization::unpack_frames), |
2917 R16_thread/*thread*/, exec_mode_reg/*exec_mode*/); | 2888 R16_thread/*thread*/, exec_mode_reg/*exec_mode*/); |
2918 __ reset_last_Java_frame(); | 2889 __ reset_last_Java_frame(); |
2919 | 2890 |
2920 // Restore the volatiles saved above. | 2891 // Restore the volatiles saved above. |
2921 __ ld( R3_RET, _abi_reg_args_spill(spill_ret), R1_SP); | 2892 __ ld( R3_RET, _abi_112_spill(spill_ret), R1_SP); |
2922 __ lfd(F1_RET, _abi_reg_args_spill(spill_fret), R1_SP); | 2893 __ lfd(F1_RET, _abi_112_spill(spill_fret), R1_SP); |
2923 | 2894 |
2924 // Pop the unpack frame. | 2895 // Pop the unpack frame. |
2925 __ pop_frame(); | 2896 __ pop_frame(); |
2926 __ restore_LR_CR(R0); | 2897 __ restore_LR_CR(R0); |
2927 | 2898 |
2928 // stack: (top interpreter frame, ..., optional interpreter frame, | 2899 // stack: (top interpreter frame, ..., optional interpreter frame, |
2929 // optional c2i, caller of deoptee, ...). | 2900 // optional c2i, caller of deoptee, ...). |
2930 | 2901 |
2931 // Initialize R14_state. | 2902 // Initialize R14_state. |
2932 #ifdef CC_INTERP | |
2933 __ ld(R14_state, 0, R1_SP); | 2903 __ ld(R14_state, 0, R1_SP); |
2934 __ addi(R14_state, R14_state, -frame::interpreter_frame_cinterpreterstate_size_in_bytes()); | 2904 __ addi(R14_state, R14_state, -frame::interpreter_frame_cinterpreterstate_size_in_bytes()); |
2935 // Also inititialize R15_prev_state. | 2905 // Also inititialize R15_prev_state. |
2936 __ restore_prev_state(); | 2906 __ restore_prev_state(); |
2937 #else | |
2938 __ restore_interpreter_state(R11_scratch1); | |
2939 __ load_const_optimized(R25_templateTableBase, (address)Interpreter::dispatch_table((TosState)0), R11_scratch1); | |
2940 #endif // CC_INTERP | |
2941 | |
2942 | 2907 |
2943 // Return to the interpreter entry point. | 2908 // Return to the interpreter entry point. |
2944 __ blr(); | 2909 __ blr(); |
2945 __ flush(); | 2910 __ flush(); |
2946 #else // COMPILER2 | 2911 #else // COMPILER2 |
2963 Register unroll_block_reg = R21_tmp1; | 2928 Register unroll_block_reg = R21_tmp1; |
2964 Register klass_index_reg = R22_tmp2; | 2929 Register klass_index_reg = R22_tmp2; |
2965 Register unc_trap_reg = R23_tmp3; | 2930 Register unc_trap_reg = R23_tmp3; |
2966 | 2931 |
2967 OopMapSet* oop_maps = new OopMapSet(); | 2932 OopMapSet* oop_maps = new OopMapSet(); |
2968 int frame_size_in_bytes = frame::abi_reg_args_size; | 2933 int frame_size_in_bytes = frame::abi_112_size; |
2969 OopMap* map = new OopMap(frame_size_in_bytes / sizeof(jint), 0); | 2934 OopMap* map = new OopMap(frame_size_in_bytes / sizeof(jint), 0); |
2970 | 2935 |
2971 // stack: (deoptee, optional i2c, caller_of_deoptee, ...). | 2936 // stack: (deoptee, optional i2c, caller_of_deoptee, ...). |
2972 | 2937 |
2973 // Push a dummy `unpack_frame' and call | 2938 // Push a dummy `unpack_frame' and call |
2976 | 2941 |
2977 // Save LR to compiled frame. | 2942 // Save LR to compiled frame. |
2978 __ save_LR_CR(R11_scratch1); | 2943 __ save_LR_CR(R11_scratch1); |
2979 | 2944 |
2980 // Push an "uncommon_trap" frame. | 2945 // Push an "uncommon_trap" frame. |
2981 __ push_frame_reg_args(0, R11_scratch1); | 2946 __ push_frame_abi112(0, R11_scratch1); |
2982 | 2947 |
2983 // stack: (unpack frame, deoptee, optional i2c, caller_of_deoptee, ...). | 2948 // stack: (unpack frame, deoptee, optional i2c, caller_of_deoptee, ...). |
2984 | 2949 |
2985 // Set the `unpack_frame' as last_Java_frame. | 2950 // Set the `unpack_frame' as last_Java_frame. |
2986 // `Deoptimization::uncommon_trap' expects it and considers its | 2951 // `Deoptimization::uncommon_trap' expects it and considers its |
3029 // Push a dummy `unpack_frame' taking care of float return values. | 2994 // Push a dummy `unpack_frame' taking care of float return values. |
3030 // Call `Deoptimization::unpack_frames' to layout information in the | 2995 // Call `Deoptimization::unpack_frames' to layout information in the |
3031 // interpreter frames just created. | 2996 // interpreter frames just created. |
3032 | 2997 |
3033 // Push a simple "unpack frame" here. | 2998 // Push a simple "unpack frame" here. |
3034 __ push_frame_reg_args(0, R11_scratch1); | 2999 __ push_frame_abi112(0, R11_scratch1); |
3035 | 3000 |
3036 // stack: (unpack frame, skeletal interpreter frame, ..., optional | 3001 // stack: (unpack frame, skeletal interpreter frame, ..., optional |
3037 // skeletal interpreter frame, optional c2i, caller of deoptee, | 3002 // skeletal interpreter frame, optional c2i, caller of deoptee, |
3038 // ...). | 3003 // ...). |
3039 | 3004 |
3055 __ restore_LR_CR(R11_scratch1); | 3020 __ restore_LR_CR(R11_scratch1); |
3056 | 3021 |
3057 // stack: (top interpreter frame, ..., optional interpreter frame, | 3022 // stack: (top interpreter frame, ..., optional interpreter frame, |
3058 // optional c2i, caller of deoptee, ...). | 3023 // optional c2i, caller of deoptee, ...). |
3059 | 3024 |
3060 #ifdef CC_INTERP | |
3061 // Initialize R14_state, ... | 3025 // Initialize R14_state, ... |
3062 __ ld(R11_scratch1, 0, R1_SP); | 3026 __ ld(R11_scratch1, 0, R1_SP); |
3063 __ addi(R14_state, R11_scratch1, -frame::interpreter_frame_cinterpreterstate_size_in_bytes()); | 3027 __ addi(R14_state, R11_scratch1, -frame::interpreter_frame_cinterpreterstate_size_in_bytes()); |
3064 // also initialize R15_prev_state. | 3028 // also initialize R15_prev_state. |
3065 __ restore_prev_state(); | 3029 __ restore_prev_state(); |
3066 #else | |
3067 __ restore_interpreter_state(R11_scratch1); | |
3068 __ load_const_optimized(R25_templateTableBase, (address)Interpreter::dispatch_table((TosState)0), R11_scratch1); | |
3069 #endif // CC_INTERP | |
3070 | |
3071 // Return to the interpreter entry point. | 3030 // Return to the interpreter entry point. |
3072 __ blr(); | 3031 __ blr(); |
3073 | 3032 |
3074 masm->flush(); | 3033 masm->flush(); |
3075 | 3034 |
3103 // Use thread()->saved_exception_pc() as return pc. | 3062 // Use thread()->saved_exception_pc() as return pc. |
3104 return_pc_location = RegisterSaver::return_pc_is_thread_saved_exception_pc; | 3063 return_pc_location = RegisterSaver::return_pc_is_thread_saved_exception_pc; |
3105 } | 3064 } |
3106 | 3065 |
3107 // Save registers, fpu state, and flags. | 3066 // Save registers, fpu state, and flags. |
3108 map = RegisterSaver::push_frame_reg_args_and_save_live_registers(masm, | 3067 map = RegisterSaver::push_frame_abi112_and_save_live_registers(masm, |
3109 &frame_size_in_bytes, | 3068 &frame_size_in_bytes, |
3110 /*generate_oop_map=*/ true, | 3069 /*generate_oop_map=*/ true, |
3111 /*return_pc_adjustment=*/0, | 3070 /*return_pc_adjustment=*/0, |
3112 return_pc_location); | 3071 return_pc_location); |
3113 | 3072 |
3114 // The following is basically a call_VM. However, we need the precise | 3073 // The following is basically a call_VM. However, we need the precise |
3115 // address of the call in order to generate an oopmap. Hence, we do all the | 3074 // address of the call in order to generate an oopmap. Hence, we do all the |
3116 // work outselves. | 3075 // work outselves. |
3117 __ set_last_Java_frame(/*sp=*/R1_SP, /*pc=*/noreg); | 3076 __ set_last_Java_frame(/*sp=*/R1_SP, /*pc=*/noreg); |
3142 | 3101 |
3143 // Exception pending | 3102 // Exception pending |
3144 RegisterSaver::restore_live_registers_and_pop_frame(masm, | 3103 RegisterSaver::restore_live_registers_and_pop_frame(masm, |
3145 frame_size_in_bytes, | 3104 frame_size_in_bytes, |
3146 /*restore_ctr=*/true); | 3105 /*restore_ctr=*/true); |
3106 | |
3147 | 3107 |
3148 BLOCK_COMMENT(" Jump to forward_exception_entry."); | 3108 BLOCK_COMMENT(" Jump to forward_exception_entry."); |
3149 // Jump to forward_exception_entry, with the issuing PC in LR | 3109 // Jump to forward_exception_entry, with the issuing PC in LR |
3150 // so it looks like the original nmethod called forward_exception_entry. | 3110 // so it looks like the original nmethod called forward_exception_entry. |
3151 __ b64_patchable(StubRoutines::forward_exception_entry(), relocInfo::runtime_call_type); | 3111 __ b64_patchable(StubRoutines::forward_exception_entry(), relocInfo::runtime_call_type); |
3189 OopMapSet *oop_maps = new OopMapSet(); | 3149 OopMapSet *oop_maps = new OopMapSet(); |
3190 OopMap* map = NULL; | 3150 OopMap* map = NULL; |
3191 | 3151 |
3192 address start = __ pc(); | 3152 address start = __ pc(); |
3193 | 3153 |
3194 map = RegisterSaver::push_frame_reg_args_and_save_live_registers(masm, | 3154 map = RegisterSaver::push_frame_abi112_and_save_live_registers(masm, |
3195 &frame_size_in_bytes, | 3155 &frame_size_in_bytes, |
3196 /*generate_oop_map*/ true, | 3156 /*generate_oop_map*/ true, |
3197 /*return_pc_adjustment*/ 0, | 3157 /*return_pc_adjustment*/ 0, |
3198 RegisterSaver::return_pc_is_lr); | 3158 RegisterSaver::return_pc_is_lr); |
3199 | 3159 |
3200 // Use noreg as last_Java_pc, the return pc will be reconstructed | 3160 // Use noreg as last_Java_pc, the return pc will be reconstructed |
3201 // from the physical frame. | 3161 // from the physical frame. |
3202 __ set_last_Java_frame(/*sp*/R1_SP, noreg); | 3162 __ set_last_Java_frame(/*sp*/R1_SP, noreg); |
3203 | 3163 |
3227 | 3187 |
3228 __ mtctr(R3_RET); // Ctr will not be touched by restore_live_registers_and_pop_frame. | 3188 __ mtctr(R3_RET); // Ctr will not be touched by restore_live_registers_and_pop_frame. |
3229 | 3189 |
3230 RegisterSaver::restore_live_registers_and_pop_frame(masm, frame_size_in_bytes, /*restore_ctr*/ false); | 3190 RegisterSaver::restore_live_registers_and_pop_frame(masm, frame_size_in_bytes, /*restore_ctr*/ false); |
3231 | 3191 |
3232 // Get the returned method. | 3192 // Get the returned methodOop. |
3233 __ get_vm_result_2(R19_method); | 3193 __ get_vm_result_2(R19_method); |
3234 | 3194 |
3235 __ bctr(); | 3195 __ bctr(); |
3236 | 3196 |
3237 | 3197 |