17 * 2 along with this work; if not, write to the Free Software Foundation,
18 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
19 *
20 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
21 * or visit www.oracle.com if you need additional information or have any
22 * questions.
23 *
24 */
25
26 #include "precompiled.hpp"
27 #include "asm/macroAssembler.inline.hpp"
28 #include "code/debugInfoRec.hpp"
29 #include "code/icBuffer.hpp"
30 #include "code/vtableStubs.hpp"
31 #include "interpreter/interpreter.hpp"
32 #include "oops/compiledICHolder.hpp"
33 #include "prims/jvmtiRedefineClassesTrace.hpp"
34 #include "runtime/sharedRuntime.hpp"
35 #include "runtime/vframeArray.hpp"
36 #include "vmreg_ppc.inline.hpp"
37 #ifdef COMPILER1
38 #include "c1/c1_Runtime1.hpp"
39 #endif
40 #ifdef COMPILER2
41 #include "opto/runtime.hpp"
42 #endif
43
44 #define __ masm->
45
46 #ifdef PRODUCT
47 #define BLOCK_COMMENT(str) // nothing
48 #else
49 #define BLOCK_COMMENT(str) __ block_comment(str)
50 #endif
51
52 #define BIND(label) bind(label); BLOCK_COMMENT(#label ":")
53
54
55 // Used by generate_deopt_blob. Defined in .ad file.
56 extern uint size_deopt_handler();
57
58
59 class RegisterSaver {
60 // Used for saving volatile registers.
61 public:
62
63 // Support different return pc locations.
64 enum ReturnPCLocation {
65 return_pc_is_lr,
66 return_pc_is_r4,
67 return_pc_is_thread_saved_exception_pc
68 };
69
70 static OopMap* push_frame_reg_args_and_save_live_registers(MacroAssembler* masm,
71 int* out_frame_size_in_bytes,
72 bool generate_oop_map,
73 int return_pc_adjustment,
74 ReturnPCLocation return_pc_location);
75 static void restore_live_registers_and_pop_frame(MacroAssembler* masm,
76 int frame_size_in_bytes,
77 bool restore_ctr);
78
2765 // --------------------------------------------------------------------------
2766 // Prolog for non exception case!
2767
2768 // We have been called from the deopt handler of the deoptee.
2769 //
2770 // deoptee:
2771 // ...
2772 // call X
2773 // ...
2774 // deopt_handler: call_deopt_stub
2775 // cur. return pc --> ...
2776 //
2777 // So currently SR_LR points behind the call in the deopt handler.
2778 // We adjust it such that it points to the start of the deopt handler.
2779 // The return_pc has been stored in the frame of the deoptee and
2780 // will replace the address of the deopt_handler in the call
2781 // to Deoptimization::fetch_unroll_info below.
2782 // We can't grab a free register here, because all registers may
2783 // contain live values, so let the RegisterSaver do the adjustment
2784 // of the return pc.
2785 const int return_pc_adjustment_no_exception = -size_deopt_handler();
2786
2787 // Push the "unpack frame"
2788 // Save everything in sight.
2789 map = RegisterSaver::push_frame_reg_args_and_save_live_registers(masm,
2790 &first_frame_size_in_bytes,
2791 /*generate_oop_map=*/ true,
2792 return_pc_adjustment_no_exception,
2793 RegisterSaver::return_pc_is_lr);
2794 assert(map != NULL, "OopMap must have been created");
2795
2796 __ li(exec_mode_reg, Deoptimization::Unpack_deopt);
2797 // Save exec mode for unpack_frames.
2798 __ b(exec_mode_initialized);
2799
2800 // --------------------------------------------------------------------------
2801 // Prolog for exception case
2802
2803 // An exception is pending.
2804 // We have been called with a return (interpreter) or a jump (exception blob).
2805 //
|
17 * 2 along with this work; if not, write to the Free Software Foundation,
18 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
19 *
20 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
21 * or visit www.oracle.com if you need additional information or have any
22 * questions.
23 *
24 */
25
26 #include "precompiled.hpp"
27 #include "asm/macroAssembler.inline.hpp"
28 #include "code/debugInfoRec.hpp"
29 #include "code/icBuffer.hpp"
30 #include "code/vtableStubs.hpp"
31 #include "interpreter/interpreter.hpp"
32 #include "oops/compiledICHolder.hpp"
33 #include "prims/jvmtiRedefineClassesTrace.hpp"
34 #include "runtime/sharedRuntime.hpp"
35 #include "runtime/vframeArray.hpp"
36 #include "vmreg_ppc.inline.hpp"
37 #include "adfiles/ad_ppc_64.hpp"
38 #ifdef COMPILER1
39 #include "c1/c1_Runtime1.hpp"
40 #endif
41 #ifdef COMPILER2
42 #include "opto/runtime.hpp"
43 #endif
44
45 #define __ masm->
46
47 #ifdef PRODUCT
48 #define BLOCK_COMMENT(str) // nothing
49 #else
50 #define BLOCK_COMMENT(str) __ block_comment(str)
51 #endif
52
53 #define BIND(label) bind(label); BLOCK_COMMENT(#label ":")
54
55
56 class RegisterSaver {
57 // Used for saving volatile registers.
58 public:
59
60 // Support different return pc locations.
61 enum ReturnPCLocation {
62 return_pc_is_lr,
63 return_pc_is_r4,
64 return_pc_is_thread_saved_exception_pc
65 };
66
67 static OopMap* push_frame_reg_args_and_save_live_registers(MacroAssembler* masm,
68 int* out_frame_size_in_bytes,
69 bool generate_oop_map,
70 int return_pc_adjustment,
71 ReturnPCLocation return_pc_location);
72 static void restore_live_registers_and_pop_frame(MacroAssembler* masm,
73 int frame_size_in_bytes,
74 bool restore_ctr);
75
2762 // --------------------------------------------------------------------------
2763 // Prolog for non exception case!
2764
2765 // We have been called from the deopt handler of the deoptee.
2766 //
2767 // deoptee:
2768 // ...
2769 // call X
2770 // ...
2771 // deopt_handler: call_deopt_stub
2772 // cur. return pc --> ...
2773 //
2774 // So currently SR_LR points behind the call in the deopt handler.
2775 // We adjust it such that it points to the start of the deopt handler.
2776 // The return_pc has been stored in the frame of the deoptee and
2777 // will replace the address of the deopt_handler in the call
2778 // to Deoptimization::fetch_unroll_info below.
2779 // We can't grab a free register here, because all registers may
2780 // contain live values, so let the RegisterSaver do the adjustment
2781 // of the return pc.
2782 const int return_pc_adjustment_no_exception = -HandlerImpl::size_deopt_handler();
2783
2784 // Push the "unpack frame"
2785 // Save everything in sight.
2786 map = RegisterSaver::push_frame_reg_args_and_save_live_registers(masm,
2787 &first_frame_size_in_bytes,
2788 /*generate_oop_map=*/ true,
2789 return_pc_adjustment_no_exception,
2790 RegisterSaver::return_pc_is_lr);
2791 assert(map != NULL, "OopMap must have been created");
2792
2793 __ li(exec_mode_reg, Deoptimization::Unpack_deopt);
2794 // Save exec mode for unpack_frames.
2795 __ b(exec_mode_initialized);
2796
2797 // --------------------------------------------------------------------------
2798 // Prolog for exception case
2799
2800 // An exception is pending.
2801 // We have been called with a return (interpreter) or a jump (exception blob).
2802 //
|