1 /*
2 * Copyright (c) 1997, 2019, Oracle and/or its affiliates. All rights reserved.
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
5 * This code is free software; you can redistribute it and/or modify it
6 * under the terms of the GNU General Public License version 2 only, as
7 * published by the Free Software Foundation.
8 *
9 * This code is distributed in the hope that it will be useful, but WITHOUT
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
12 * version 2 for more details (a copy is included in the LICENSE file that
13 * accompanied this code).
14 *
15 * You should have received a copy of the GNU General Public License version
16 * 2 along with this work; if not, write to the Free Software Foundation,
17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
18 *
19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
20 * or visit www.oracle.com if you need additional information or have any
21 * questions.
22 *
224
225 // Support for native calls
226 static address slow_signature_handler() { return _slow_signature_handler; }
227 static address result_handler(BasicType type) { return _native_abi_to_tosca[BasicType_as_index(type)]; }
228 static int BasicType_as_index(BasicType type); // computes index into result_handler_by_index table
229 static bool in_native_entry(address pc) { return _native_entry_begin <= pc && pc < _native_entry_end; }
230 // Debugging/printing
231 static void print(); // prints the interpreter code
232
233 public:
234 // Interpreter helpers
235 const static int stackElementWords = 1;
236 const static int stackElementSize = stackElementWords * wordSize;
237 const static int logStackElementSize = LogBytesPerWord;
238
239 static int expr_index_at(int i) {
240 return stackElementWords * i;
241 }
242
243 static int expr_offset_in_bytes(int i) {
244 #if !defined(ZERO) && (defined(PPC) || defined(S390) || defined(SPARC))
245 return stackElementSize * i + wordSize; // both point to one word past TOS
246 #else
247 return stackElementSize * i;
248 #endif
249 }
250
251 static int local_index_at(int i) {
252 assert(i <= 0, "local direction already negated");
253 return stackElementWords * i;
254 }
255
256 #if !defined(ZERO) && (defined(IA32) || defined(AMD64))
257 static Address::ScaleFactor stackElementScale() {
258 return NOT_LP64(Address::times_4) LP64_ONLY(Address::times_8);
259 }
260 #endif
261
262 // Local values relative to locals[n]
263 static int local_offset_in_bytes(int n) {
264 return ((frame::interpreter_frame_expression_stack_direction() * n) * stackElementSize);
|
1 /*
2 * Copyright (c) 1997, 2020, Oracle and/or its affiliates. All rights reserved.
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
5 * This code is free software; you can redistribute it and/or modify it
6 * under the terms of the GNU General Public License version 2 only, as
7 * published by the Free Software Foundation.
8 *
9 * This code is distributed in the hope that it will be useful, but WITHOUT
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
12 * version 2 for more details (a copy is included in the LICENSE file that
13 * accompanied this code).
14 *
15 * You should have received a copy of the GNU General Public License version
16 * 2 along with this work; if not, write to the Free Software Foundation,
17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
18 *
19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
20 * or visit www.oracle.com if you need additional information or have any
21 * questions.
22 *
224
225 // Support for native calls
226 static address slow_signature_handler() { return _slow_signature_handler; }
227 static address result_handler(BasicType type) { return _native_abi_to_tosca[BasicType_as_index(type)]; }
228 static int BasicType_as_index(BasicType type); // computes index into result_handler_by_index table
229 static bool in_native_entry(address pc) { return _native_entry_begin <= pc && pc < _native_entry_end; }
230 // Debugging/printing
231 static void print(); // prints the interpreter code
232
233 public:
234 // Interpreter helpers
235 const static int stackElementWords = 1;
236 const static int stackElementSize = stackElementWords * wordSize;
237 const static int logStackElementSize = LogBytesPerWord;
238
239 static int expr_index_at(int i) {
240 return stackElementWords * i;
241 }
242
243 static int expr_offset_in_bytes(int i) {
244 #if !defined(ZERO) && (defined(PPC) || defined(S390))
245 return stackElementSize * i + wordSize; // both point to one word past TOS
246 #else
247 return stackElementSize * i;
248 #endif
249 }
250
251 static int local_index_at(int i) {
252 assert(i <= 0, "local direction already negated");
253 return stackElementWords * i;
254 }
255
256 #if !defined(ZERO) && (defined(IA32) || defined(AMD64))
257 static Address::ScaleFactor stackElementScale() {
258 return NOT_LP64(Address::times_4) LP64_ONLY(Address::times_8);
259 }
260 #endif
261
262 // Local values relative to locals[n]
263 static int local_offset_in_bytes(int n) {
264 return ((frame::interpreter_frame_expression_stack_direction() * n) * stackElementSize);
|