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 */ 25 26 #ifndef CPU_PPC_VM_INTERP_MASM_PPC_64_HPP 27 #define CPU_PPC_VM_INTERP_MASM_PPC_64_HPP 28 29 #include "assembler_ppc.inline.hpp" 30 #include "interpreter/invocationCounter.hpp" 31 32 // This file specializes the assembler with interpreter-specific macros 33 34 35 class InterpreterMacroAssembler: public MacroAssembler { 36 37 public: 38 InterpreterMacroAssembler(CodeBuffer* code) : MacroAssembler(code) {} 39 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 43 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 48 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); 51 52 // Object locking 53 void lock_object (Register lock_reg, Register obj_reg); 54 void unlock_object(Register lock_reg); 55 56 // Debugging 57 void verify_oop(Register reg, TosState state = atos); // only if +VerifyOops && state == atos 58 59 // support for jvmdi/jvmpi 60 void notify_method_entry(); 61 void notify_method_exit(bool save_result, TosState state); 62 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); 68 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); 72 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); 75 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); 78 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); 85 86 void restore_prev_state(); 87 }; 88 89 #endif // CPU_PPC_VM_INTERP_MASM_PPC_64_HPP