< prev index next >

src/cpu/ppc/vm/sharedRuntime_ppc.cpp

Print this page




2785 
2786   // Store exception oop and pc in thread (location known to GC).
2787   // This is needed since the call to "fetch_unroll_info()" may safepoint.
2788   __ std(R3_ARG1, in_bytes(JavaThread::exception_oop_offset()), R16_thread);
2789   __ std(R4_ARG2, in_bytes(JavaThread::exception_pc_offset()),  R16_thread);
2790 
2791   // fall through
2792 
2793   // --------------------------------------------------------------------------
2794   __ BIND(exec_mode_initialized);
2795 
2796   {
2797   const Register unroll_block_reg = R22_tmp2;
2798 
2799   // We need to set `last_Java_frame' because `fetch_unroll_info' will
2800   // call `last_Java_frame()'. The value of the pc in the frame is not
2801   // particularly important. It just needs to identify this blob.
2802   __ set_last_Java_frame(R1_SP, noreg);
2803 
2804   // With EscapeAnalysis turned on, this call may safepoint!
2805   __ call_VM_leaf(CAST_FROM_FN_PTR(address, Deoptimization::fetch_unroll_info), R16_thread);
2806   address calls_return_pc = __ last_calls_return_pc();
2807   // Set an oopmap for the call site that describes all our saved registers.
2808   oop_maps->add_gc_map(calls_return_pc - start, map);
2809 
2810   __ reset_last_Java_frame();
2811   // Save the return value.
2812   __ mr(unroll_block_reg, R3_RET);
2813 
2814   // Restore only the result registers that have been saved
2815   // by save_volatile_registers(...).
2816   RegisterSaver::restore_result_registers(masm, first_frame_size_in_bytes);
2817 


2818   // In excp_deopt_mode, restore and clear exception oop which we
2819   // stored in the thread during exception entry above. The exception
2820   // oop will be the return value of this stub.
2821   Label skip_restore_excp;
2822   __ cmpdi(CCR0, exec_mode_reg, Deoptimization::Unpack_exception);
2823   __ bne(CCR0, skip_restore_excp);
2824   __ ld(R3_RET, in_bytes(JavaThread::exception_oop_offset()), R16_thread);
2825   __ ld(R4_ARG2, in_bytes(JavaThread::exception_pc_offset()), R16_thread);
2826   __ li(R0, 0);
2827   __ std(R0, in_bytes(JavaThread::exception_pc_offset()),  R16_thread);
2828   __ std(R0, in_bytes(JavaThread::exception_oop_offset()), R16_thread);
2829   __ BIND(skip_restore_excp);
2830 
2831   __ pop_frame();
2832 
2833   // stack: (deoptee, optional i2c, caller of deoptee, ...).
2834 
2835   // pop the deoptee's frame
2836   __ pop_frame();
2837 


2928   // vframe array and return the `UnrollBlock' information.
2929 
2930   // Save LR to compiled frame.
2931   __ save_LR_CR(R11_scratch1);
2932 
2933   // Push an "uncommon_trap" frame.
2934   __ push_frame_reg_args(0, R11_scratch1);
2935 
2936   // stack: (unpack frame, deoptee, optional i2c, caller_of_deoptee, ...).
2937 
2938   // Set the `unpack_frame' as last_Java_frame.
2939   // `Deoptimization::uncommon_trap' expects it and considers its
2940   // sender frame as the deoptee frame.
2941   // Remember the offset of the instruction whose address will be
2942   // moved to R11_scratch1.
2943   address gc_map_pc = __ get_PC_trash_LR(R11_scratch1);
2944 
2945   __ set_last_Java_frame(/*sp*/R1_SP, /*pc*/R11_scratch1);
2946 
2947   __ mr(klass_index_reg, R3);

2948   __ call_VM_leaf(CAST_FROM_FN_PTR(address, Deoptimization::uncommon_trap),
2949                   R16_thread, klass_index_reg);
2950 
2951   // Set an oopmap for the call site.
2952   oop_maps->add_gc_map(gc_map_pc - start, map);
2953 
2954   __ reset_last_Java_frame();
2955 
2956   // Pop the `unpack frame'.
2957   __ pop_frame();
2958 
2959   // stack: (deoptee, optional i2c, caller_of_deoptee, ...).
2960 
2961   // Save the return value.
2962   __ mr(unroll_block_reg, R3_RET);
2963 
2964   // Pop the uncommon_trap frame.
2965   __ pop_frame();
2966 
2967   // stack: (caller_of_deoptee, ...).






2968 
2969   // Allocate new interpreter frame(s) and possibly a c2i adapter
2970   // frame.
2971   push_skeleton_frames(masm, false/*deopt*/,
2972                        unroll_block_reg,
2973                        R22_tmp2,
2974                        R23_tmp3,
2975                        R24_tmp4,
2976                        R25_tmp5,
2977                        R26_tmp6);
2978 
2979   // stack: (skeletal interpreter frame, ..., optional skeletal
2980   // interpreter frame, optional c2i, caller of deoptee, ...).
2981 
2982   // Push a dummy `unpack_frame' taking care of float return values.
2983   // Call `Deoptimization::unpack_frames' to layout information in the
2984   // interpreter frames just created.
2985 
2986   // Push a simple "unpack frame" here.
2987   __ push_frame_reg_args(0, R11_scratch1);




2785 
2786   // Store exception oop and pc in thread (location known to GC).
2787   // This is needed since the call to "fetch_unroll_info()" may safepoint.
2788   __ std(R3_ARG1, in_bytes(JavaThread::exception_oop_offset()), R16_thread);
2789   __ std(R4_ARG2, in_bytes(JavaThread::exception_pc_offset()),  R16_thread);
2790 
2791   // fall through
2792 
2793   // --------------------------------------------------------------------------
2794   __ BIND(exec_mode_initialized);
2795 
2796   {
2797   const Register unroll_block_reg = R22_tmp2;
2798 
2799   // We need to set `last_Java_frame' because `fetch_unroll_info' will
2800   // call `last_Java_frame()'. The value of the pc in the frame is not
2801   // particularly important. It just needs to identify this blob.
2802   __ set_last_Java_frame(R1_SP, noreg);
2803 
2804   // With EscapeAnalysis turned on, this call may safepoint!
2805   __ call_VM_leaf(CAST_FROM_FN_PTR(address, Deoptimization::fetch_unroll_info), R16_thread, exec_mode_reg);
2806   address calls_return_pc = __ last_calls_return_pc();
2807   // Set an oopmap for the call site that describes all our saved registers.
2808   oop_maps->add_gc_map(calls_return_pc - start, map);
2809 
2810   __ reset_last_Java_frame();
2811   // Save the return value.
2812   __ mr(unroll_block_reg, R3_RET);
2813 
2814   // Restore only the result registers that have been saved
2815   // by save_volatile_registers(...).
2816   RegisterSaver::restore_result_registers(masm, first_frame_size_in_bytes);
2817 
2818   // reload the exec mode from the UnrollBlock (it might have changed)
2819   __ lwz(exec_mode_reg, Deoptimization::UnrollBlock::unpack_kind_offset_in_bytes(), unroll_block_reg);
2820   // In excp_deopt_mode, restore and clear exception oop which we
2821   // stored in the thread during exception entry above. The exception
2822   // oop will be the return value of this stub.
2823   Label skip_restore_excp;
2824   __ cmpdi(CCR0, exec_mode_reg, Deoptimization::Unpack_exception);
2825   __ bne(CCR0, skip_restore_excp);
2826   __ ld(R3_RET, in_bytes(JavaThread::exception_oop_offset()), R16_thread);
2827   __ ld(R4_ARG2, in_bytes(JavaThread::exception_pc_offset()), R16_thread);
2828   __ li(R0, 0);
2829   __ std(R0, in_bytes(JavaThread::exception_pc_offset()),  R16_thread);
2830   __ std(R0, in_bytes(JavaThread::exception_oop_offset()), R16_thread);
2831   __ BIND(skip_restore_excp);
2832 
2833   __ pop_frame();
2834 
2835   // stack: (deoptee, optional i2c, caller of deoptee, ...).
2836 
2837   // pop the deoptee's frame
2838   __ pop_frame();
2839 


2930   // vframe array and return the `UnrollBlock' information.
2931 
2932   // Save LR to compiled frame.
2933   __ save_LR_CR(R11_scratch1);
2934 
2935   // Push an "uncommon_trap" frame.
2936   __ push_frame_reg_args(0, R11_scratch1);
2937 
2938   // stack: (unpack frame, deoptee, optional i2c, caller_of_deoptee, ...).
2939 
2940   // Set the `unpack_frame' as last_Java_frame.
2941   // `Deoptimization::uncommon_trap' expects it and considers its
2942   // sender frame as the deoptee frame.
2943   // Remember the offset of the instruction whose address will be
2944   // moved to R11_scratch1.
2945   address gc_map_pc = __ get_PC_trash_LR(R11_scratch1);
2946 
2947   __ set_last_Java_frame(/*sp*/R1_SP, /*pc*/R11_scratch1);
2948 
2949   __ mr(klass_index_reg, R3);
2950   __ li(R5, Deoptimization::Unpack_exception);
2951   __ call_VM_leaf(CAST_FROM_FN_PTR(address, Deoptimization::uncommon_trap),
2952                   R16_thread, klass_index_reg, R5);
2953 
2954   // Set an oopmap for the call site.
2955   oop_maps->add_gc_map(gc_map_pc - start, map);
2956 
2957   __ reset_last_Java_frame();
2958 
2959   // Pop the `unpack frame'.
2960   __ pop_frame();
2961 
2962   // stack: (deoptee, optional i2c, caller_of_deoptee, ...).
2963 
2964   // Save the return value.
2965   __ mr(unroll_block_reg, R3_RET);
2966 
2967   // Pop the uncommon_trap frame.
2968   __ pop_frame();
2969 
2970   // stack: (caller_of_deoptee, ...).
2971 
2972 #ifdef ASSERT
2973   __ lwz(R22_tmp2, Deoptimization::UnrollBlock::unpack_kind_offset_in_bytes(), unroll_block_reg);
2974   __ cmpdi(CCR0, R22_tmp2, (unsigned)Deoptimization::Unpack_uncommon_trap);
2975   __ asm_assert_eq("SharedRuntime::generate_deopt_blob: expected Unpack_uncommon_trap", 0);
2976 #endif
2977 
2978   // Allocate new interpreter frame(s) and possibly a c2i adapter
2979   // frame.
2980   push_skeleton_frames(masm, false/*deopt*/,
2981                        unroll_block_reg,
2982                        R22_tmp2,
2983                        R23_tmp3,
2984                        R24_tmp4,
2985                        R25_tmp5,
2986                        R26_tmp6);
2987 
2988   // stack: (skeletal interpreter frame, ..., optional skeletal
2989   // interpreter frame, optional c2i, caller of deoptee, ...).
2990 
2991   // Push a dummy `unpack_frame' taking care of float return values.
2992   // Call `Deoptimization::unpack_frames' to layout information in the
2993   // interpreter frames just created.
2994 
2995   // Push a simple "unpack frame" here.
2996   __ push_frame_reg_args(0, R11_scratch1);


< prev index next >