Wed, 03 Jul 2019 20:42:37 +0800
Merge
aoqi@0 | 1 | /* |
aoqi@0 | 2 | * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved. |
aoqi@0 | 3 | * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
aoqi@0 | 4 | * |
aoqi@0 | 5 | * This code is free software; you can redistribute it and/or modify it |
aoqi@0 | 6 | * under the terms of the GNU General Public License version 2 only, as |
aoqi@0 | 7 | * published by the Free Software Foundation. |
aoqi@0 | 8 | * |
aoqi@0 | 9 | * This code is distributed in the hope that it will be useful, but WITHOUT |
aoqi@0 | 10 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
aoqi@0 | 11 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
aoqi@0 | 12 | * version 2 for more details (a copy is included in the LICENSE file that |
aoqi@0 | 13 | * accompanied this code). |
aoqi@0 | 14 | * |
aoqi@0 | 15 | * You should have received a copy of the GNU General Public License version |
aoqi@0 | 16 | * 2 along with this work; if not, write to the Free Software Foundation, |
aoqi@0 | 17 | * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. |
aoqi@0 | 18 | * |
aoqi@0 | 19 | * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA |
aoqi@0 | 20 | * or visit www.oracle.com if you need additional information or have any |
aoqi@0 | 21 | * questions. |
aoqi@0 | 22 | * |
aoqi@0 | 23 | */ |
aoqi@0 | 24 | |
aoqi@1 | 25 | /* |
aoqi@1 | 26 | * This file has been modified by Loongson Technology in 2015. These |
aoqi@1 | 27 | * modifications are Copyright (c) 2015 Loongson Technology, and are made |
aoqi@1 | 28 | * available on the same license terms set forth above. |
aoqi@1 | 29 | */ |
aoqi@1 | 30 | |
aoqi@0 | 31 | #ifndef SHARE_VM_INTERPRETER_CPPINTERPRETER_HPP |
aoqi@0 | 32 | #define SHARE_VM_INTERPRETER_CPPINTERPRETER_HPP |
aoqi@0 | 33 | |
aoqi@0 | 34 | #include "interpreter/abstractInterpreter.hpp" |
aoqi@0 | 35 | |
aoqi@0 | 36 | #ifdef CC_INTERP |
aoqi@0 | 37 | |
aoqi@0 | 38 | // This file contains the platform-independent parts |
aoqi@0 | 39 | // of the c++ interpreter |
aoqi@0 | 40 | |
aoqi@0 | 41 | class CppInterpreter: public AbstractInterpreter { |
aoqi@0 | 42 | friend class VMStructs; |
aoqi@0 | 43 | friend class Interpreter; // contains() |
aoqi@0 | 44 | friend class InterpreterGenerator; // result handlers |
aoqi@0 | 45 | friend class CppInterpreterGenerator; // result handlers |
aoqi@0 | 46 | public: |
aoqi@0 | 47 | |
aoqi@0 | 48 | |
aoqi@0 | 49 | protected: |
aoqi@0 | 50 | |
aoqi@0 | 51 | // tosca result -> stack result |
aoqi@0 | 52 | static address _tosca_to_stack[number_of_result_handlers]; // converts tosca to C++ interpreter stack result |
aoqi@0 | 53 | // stack result -> stack result |
aoqi@0 | 54 | static address _stack_to_stack[number_of_result_handlers]; // pass result between C++ interpreter calls |
aoqi@0 | 55 | // stack result -> native abi result |
aoqi@0 | 56 | static address _stack_to_native_abi[number_of_result_handlers]; // converts C++ interpreter results to native abi |
aoqi@0 | 57 | |
aoqi@0 | 58 | // this is to allow frame and only frame to use contains(). |
aoqi@0 | 59 | friend class frame; |
aoqi@0 | 60 | |
aoqi@0 | 61 | public: |
aoqi@0 | 62 | // Initialization/debugging |
aoqi@0 | 63 | static void initialize(); |
aoqi@0 | 64 | // this only returns whether a pc is within generated code for the interpreter. |
aoqi@0 | 65 | |
aoqi@0 | 66 | // This is a moderately dubious interface for the c++ interpreter. Only |
aoqi@0 | 67 | // frame code and debug.cpp should be using it. |
aoqi@0 | 68 | static bool contains(address pc); |
aoqi@0 | 69 | |
aoqi@0 | 70 | public: |
aoqi@0 | 71 | |
aoqi@0 | 72 | |
aoqi@0 | 73 | // No displatch table to switch so no need for these to do anything special |
aoqi@0 | 74 | static void notice_safepoints() {} |
aoqi@0 | 75 | static void ignore_safepoints() {} |
aoqi@0 | 76 | |
aoqi@0 | 77 | static address native_result_to_tosca() { return (address)_native_abi_to_tosca; } // aka result handler |
aoqi@0 | 78 | static address tosca_result_to_stack() { return (address)_tosca_to_stack; } |
aoqi@0 | 79 | static address stack_result_to_stack() { return (address)_stack_to_stack; } |
aoqi@0 | 80 | static address stack_result_to_native() { return (address)_stack_to_native_abi; } |
aoqi@0 | 81 | |
aoqi@0 | 82 | static address native_result_to_tosca(int index) { return _native_abi_to_tosca[index]; } // aka result handler |
aoqi@0 | 83 | static address tosca_result_to_stack(int index) { return _tosca_to_stack[index]; } |
aoqi@0 | 84 | static address stack_result_to_stack(int index) { return _stack_to_stack[index]; } |
aoqi@0 | 85 | static address stack_result_to_native(int index) { return _stack_to_native_abi[index]; } |
aoqi@0 | 86 | |
aoqi@0 | 87 | static address return_entry (TosState state, int length, Bytecodes::Code code); |
aoqi@0 | 88 | static address deopt_entry (TosState state, int length); |
aoqi@0 | 89 | |
aoqi@0 | 90 | #ifdef TARGET_ARCH_x86 |
aoqi@0 | 91 | # include "cppInterpreter_x86.hpp" |
aoqi@0 | 92 | #endif |
aoqi@1 | 93 | #ifdef TARGET_ARCH_mips |
aoqi@1 | 94 | # include "cppInterpreter_mips.hpp" |
aoqi@1 | 95 | #endif |
aoqi@0 | 96 | #ifdef TARGET_ARCH_sparc |
aoqi@0 | 97 | # include "cppInterpreter_sparc.hpp" |
aoqi@0 | 98 | #endif |
aoqi@0 | 99 | #ifdef TARGET_ARCH_zero |
aoqi@0 | 100 | # include "cppInterpreter_zero.hpp" |
aoqi@0 | 101 | #endif |
aoqi@0 | 102 | #ifdef TARGET_ARCH_arm |
aoqi@0 | 103 | # include "cppInterpreter_arm.hpp" |
aoqi@0 | 104 | #endif |
aoqi@0 | 105 | #ifdef TARGET_ARCH_ppc |
aoqi@0 | 106 | # include "cppInterpreter_ppc.hpp" |
aoqi@0 | 107 | #endif |
aoqi@0 | 108 | |
aoqi@0 | 109 | |
aoqi@0 | 110 | }; |
aoqi@0 | 111 | |
aoqi@0 | 112 | #endif // CC_INTERP |
aoqi@0 | 113 | |
aoqi@0 | 114 | #endif // SHARE_VM_INTERPRETER_CPPINTERPRETER_HPP |