Wed, 27 Nov 2013 16:16:21 -0800
8029015: PPC64 (part 216): opto: trap based null and range checks
Summary: On PPC64 use tdi instruction that does a compare and raises SIGTRAP for NULL and range checks.
Reviewed-by: kvn
1 /*
2 * Copyright (c) 2002, 2013, Oracle and/or its affiliates. All rights reserved.
3 * Copyright 2012, 2013 SAP AG. All rights reserved.
4 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 *
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
8 * published by the Free Software Foundation.
9 *
10 * This code is distributed in the hope that it will be useful, but WITHOUT
11 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
12 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
13 * version 2 for more details (a copy is included in the LICENSE file that
14 * accompanied this code).
15 *
16 * You should have received a copy of the GNU General Public License version
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 */
26 #ifndef CPU_PPC_VM_INTERP_MASM_PPC_64_HPP
27 #define CPU_PPC_VM_INTERP_MASM_PPC_64_HPP
29 #include "assembler_ppc.inline.hpp"
30 #include "interpreter/invocationCounter.hpp"
32 // This file specializes the assembler with interpreter-specific macros
35 class InterpreterMacroAssembler: public MacroAssembler {
37 public:
38 InterpreterMacroAssembler(CodeBuffer* code) : MacroAssembler(code) {}
40 // Handy address generation macros
41 #define thread_(field_name) in_bytes(JavaThread::field_name ## _offset()), R16_thread
42 #define method_(field_name) in_bytes(Method::field_name ## _offset()), R19_method
44 #ifdef CC_INTERP
45 #define state_(field_name) in_bytes(byte_offset_of(BytecodeInterpreter, field_name)), R14_state
46 #define prev_state_(field_name) in_bytes(byte_offset_of(BytecodeInterpreter, field_name)), R15_prev_state
47 #endif
49 void get_method_counters(Register method, Register Rcounters, Label& skip);
50 void increment_invocation_counter(Register iv_be_count, Register Rtmp1, Register Rtmp2_r0);
52 // Object locking
53 void lock_object (Register lock_reg, Register obj_reg);
54 void unlock_object(Register lock_reg);
56 // Debugging
57 void verify_oop(Register reg, TosState state = atos); // only if +VerifyOops && state == atos
59 // support for jvmdi/jvmpi
60 void notify_method_entry();
61 void notify_method_exit(bool save_result, TosState state);
63 // Convert the current TOP_IJAVA_FRAME into a PARENT_IJAVA_FRAME
64 // (using parent_frame_resize) and push a new interpreter
65 // TOP_IJAVA_FRAME (using frame_size).
66 void push_interpreter_frame(Register top_frame_size, Register parent_frame_resize,
67 Register tmp1, Register tmp2, Register tmp3, Register tmp4, Register pc=noreg);
69 // Pop the topmost TOP_IJAVA_FRAME and convert the previous
70 // PARENT_IJAVA_FRAME back into a TOP_IJAVA_FRAME.
71 void pop_interpreter_frame(Register tmp1, Register tmp2, Register tmp3, Register tmp4);
73 // Turn state's interpreter frame into the current TOP_IJAVA_FRAME.
74 void pop_interpreter_frame_to_state(Register state, Register tmp1, Register tmp2, Register tmp3);
76 // Set SP to initial caller's sp, but before fix the back chain.
77 void resize_frame_to_initial_caller(Register tmp1, Register tmp2);
79 // Pop the current interpreter state (without popping the
80 // correspoding frame) and restore R14_state and R15_prev_state
81 // accordingly. Use prev_state_may_be_0 to indicate whether
82 // prev_state may be 0 in order to generate an extra check before
83 // retrieving prev_state_(_prev_link).
84 void pop_interpreter_state(bool prev_state_may_be_0);
86 void restore_prev_state();
87 };
89 #endif // CPU_PPC_VM_INTERP_MASM_PPC_64_HPP