1 /* 2 * Copyright (c) 2013, Red Hat Inc. 3 * Copyright (c) 2002, 2010, Oracle and/or its affiliates. 4 * All rights reserved. 5 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 6 * 7 * This code is free software; you can redistribute it and/or modify it 8 * under the terms of the GNU General Public License version 2 only, as 9 * published by the Free Software Foundation. 10 * 11 * This code is distributed in the hope that it will be useful, but WITHOUT 12 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 13 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 14 * version 2 for more details (a copy is included in the LICENSE file that 15 * accompanied this code). 16 * 17 * You should have received a copy of the GNU General Public License version 18 * 2 along with this work; if not, write to the Free Software Foundation, 19 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 20 * 21 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 22 * or visit www.oracle.com if you need additional information or have any 23 * questions. 24 * 25 */ 26 27 #ifndef CPU_AARCH64_VM_BYTECODEINTERPRETER_AARCH64_HPP 28 #define CPU_AARCH64_VM_BYTECODEINTERPRETER_AARCH64_HPP 29 30 // Platform specific for C++ based Interpreter 31 32 private: 33 34 interpreterState _self_link; /* Previous interpreter state */ /* sometimes points to self??? */ 35 address _result_handler; /* temp for saving native result handler */ 36 intptr_t* _sender_sp; /* sender's sp before stack (locals) extension */ 37 38 address _extra_junk1; /* temp to save on recompiles */ 39 address _extra_junk2; /* temp to save on recompiles */ 40 address _extra_junk3; /* temp to save on recompiles */ 41 // address dummy_for_native2; /* a native frame result handler would be here... */ 42 // address dummy_for_native1; /* native result type stored here in a interpreter native frame */ 43 address _extra_junk4; /* temp to save on recompiles */ 44 address _extra_junk5; /* temp to save on recompiles */ 45 address _extra_junk6; /* temp to save on recompiles */ 46 public: 47 // we have an interpreter frame... 48 inline intptr_t* sender_sp() { 49 return _sender_sp; 50 } 51 52 // The interpreter always has the frame anchor fully setup so we don't 53 // have to do anything going to vm from the interpreter. On return 54 // we do have to clear the flags in case they we're modified to 55 // maintain the stack walking invariants. 56 // 57 #define SET_LAST_JAVA_FRAME() 58 59 #define RESET_LAST_JAVA_FRAME() 60 61 /* 62 * Macros for accessing the stack. 63 */ 64 #undef STACK_INT 65 #undef STACK_FLOAT 66 #undef STACK_ADDR 67 #undef STACK_OBJECT 68 #undef STACK_DOUBLE 69 #undef STACK_LONG 70 71 // JavaStack Implementation 72 73 #define GET_STACK_SLOT(offset) (*((intptr_t*) &topOfStack[-(offset)])) 74 #define STACK_SLOT(offset) ((address) &topOfStack[-(offset)]) 75 #define STACK_ADDR(offset) (*((address *) &topOfStack[-(offset)])) 76 #define STACK_INT(offset) (*((jint*) &topOfStack[-(offset)])) 77 #define STACK_FLOAT(offset) (*((jfloat *) &topOfStack[-(offset)])) 78 #define STACK_OBJECT(offset) (*((oop *) &topOfStack [-(offset)])) 79 #define STACK_DOUBLE(offset) (((VMJavaVal64*) &topOfStack[-(offset)])->d) 80 #define STACK_LONG(offset) (((VMJavaVal64 *) &topOfStack[-(offset)])->l) 81 82 #define SET_STACK_SLOT(value, offset) (*(intptr_t*)&topOfStack[-(offset)] = *(intptr_t*)(value)) 83 #define SET_STACK_ADDR(value, offset) (*((address *)&topOfStack[-(offset)]) = (value)) 84 #define SET_STACK_INT(value, offset) (*((jint *)&topOfStack[-(offset)]) = (value)) 85 #define SET_STACK_FLOAT(value, offset) (*((jfloat *)&topOfStack[-(offset)]) = (value)) 86 #define SET_STACK_OBJECT(value, offset) (*((oop *)&topOfStack[-(offset)]) = (value)) 87 #define SET_STACK_DOUBLE(value, offset) (((VMJavaVal64*)&topOfStack[-(offset)])->d = (value)) 88 #define SET_STACK_DOUBLE_FROM_ADDR(addr, offset) (((VMJavaVal64*)&topOfStack[-(offset)])->d = \ 89 ((VMJavaVal64*)(addr))->d) 90 #define SET_STACK_LONG(value, offset) (((VMJavaVal64*)&topOfStack[-(offset)])->l = (value)) 91 #define SET_STACK_LONG_FROM_ADDR(addr, offset) (((VMJavaVal64*)&topOfStack[-(offset)])->l = \ 92 ((VMJavaVal64*)(addr))->l) 93 // JavaLocals implementation 94 95 #define LOCALS_SLOT(offset) ((intptr_t*)&locals[-(offset)]) 96 #define LOCALS_ADDR(offset) ((address)locals[-(offset)]) 97 #define LOCALS_INT(offset) ((jint)(locals[-(offset)])) 98 #define LOCALS_FLOAT(offset) (*((jfloat*)&locals[-(offset)])) 99 #define LOCALS_OBJECT(offset) (cast_to_oop(locals[-(offset)])) 100 #define LOCALS_DOUBLE(offset) (((VMJavaVal64*)&locals[-((offset) + 1)])->d) 101 #define LOCALS_LONG(offset) (((VMJavaVal64*)&locals[-((offset) + 1)])->l) 102 #define LOCALS_LONG_AT(offset) (((address)&locals[-((offset) + 1)])) 103 #define LOCALS_DOUBLE_AT(offset) (((address)&locals[-((offset) + 1)])) 104 105 #define SET_LOCALS_SLOT(value, offset) (*(intptr_t*)&locals[-(offset)] = *(intptr_t *)(value)) 106 #define SET_LOCALS_ADDR(value, offset) (*((address *)&locals[-(offset)]) = (value)) 107 #define SET_LOCALS_INT(value, offset) (*((jint *)&locals[-(offset)]) = (value)) 108 #define SET_LOCALS_FLOAT(value, offset) (*((jfloat *)&locals[-(offset)]) = (value)) 109 #define SET_LOCALS_OBJECT(value, offset) (*((oop *)&locals[-(offset)]) = (value)) 110 #define SET_LOCALS_DOUBLE(value, offset) (((VMJavaVal64*)&locals[-((offset)+1)])->d = (value)) 111 #define SET_LOCALS_LONG(value, offset) (((VMJavaVal64*)&locals[-((offset)+1)])->l = (value)) 112 #define SET_LOCALS_DOUBLE_FROM_ADDR(addr, offset) (((VMJavaVal64*)&locals[-((offset)+1)])->d = \ 113 ((VMJavaVal64*)(addr))->d) 114 #define SET_LOCALS_LONG_FROM_ADDR(addr, offset) (((VMJavaVal64*)&locals[-((offset)+1)])->l = \ 115 ((VMJavaVal64*)(addr))->l) 116 117 #endif // CPU_AARCH64_VM_BYTECODEINTERPRETER_AARCH64_HPP