cppInterpreter.hpp revision 5776:de6a9e811145
11541Srgrimes/*
21541Srgrimes * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved.
31541Srgrimes * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
41541Srgrimes *
51541Srgrimes * This code is free software; you can redistribute it and/or modify it
61541Srgrimes * under the terms of the GNU General Public License version 2 only, as
71541Srgrimes * published by the Free Software Foundation.
81541Srgrimes *
91541Srgrimes * This code is distributed in the hope that it will be useful, but WITHOUT
101541Srgrimes * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
111541Srgrimes * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
121541Srgrimes * version 2 for more details (a copy is included in the LICENSE file that
131541Srgrimes * accompanied this code).
141541Srgrimes *
151541Srgrimes * You should have received a copy of the GNU General Public License version
161541Srgrimes * 2 along with this work; if not, write to the Free Software Foundation,
171541Srgrimes * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
181541Srgrimes *
191541Srgrimes * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
201541Srgrimes * or visit www.oracle.com if you need additional information or have any
211541Srgrimes * questions.
221541Srgrimes *
231541Srgrimes */
241541Srgrimes
251541Srgrimes#ifndef SHARE_VM_INTERPRETER_CPPINTERPRETER_HPP
261541Srgrimes#define SHARE_VM_INTERPRETER_CPPINTERPRETER_HPP
271541Srgrimes
281541Srgrimes#include "interpreter/abstractInterpreter.hpp"
291541Srgrimes
301541Srgrimes#ifdef CC_INTERP
311541Srgrimes
321541Srgrimes// This file contains the platform-independent parts
331541Srgrimes// of the c++ interpreter
341541Srgrimes
351541Srgrimesclass CppInterpreter: public AbstractInterpreter {
361541Srgrimes  friend class VMStructs;
371541Srgrimes  friend class Interpreter; // contains()
381541Srgrimes  friend class InterpreterGenerator; // result handlers
3936127Sbde  friend class CppInterpreterGenerator; // result handlers
401541Srgrimes public:
411541Srgrimes
421541Srgrimes
431541Srgrimes protected:
4433392Sphk
451541Srgrimes  // tosca result -> stack result
461541Srgrimes  static address    _tosca_to_stack[number_of_result_handlers];  // converts tosca to C++ interpreter stack result
4733392Sphk  // stack result -> stack result
4833392Sphk  static address    _stack_to_stack[number_of_result_handlers];  // pass result between C++ interpreter calls
4933392Sphk  // stack result -> native abi result
5033392Sphk  static address    _stack_to_native_abi[number_of_result_handlers];  // converts C++ interpreter results to native abi
5133392Sphk
5233392Sphk  // this is to allow frame and only frame to use contains().
5329680Sgibbs  friend class      frame;
5429680Sgibbs
5529680Sgibbs public:
5629680Sgibbs  // Initialization/debugging
5733392Sphk  static void       initialize();
582112Swollman  // this only returns whether a pc is within generated code for the interpreter.
5929680Sgibbs
601541Srgrimes  // This is a moderately dubious interface for the c++ interpreter. Only
611541Srgrimes  // frame code and debug.cpp should be using it.
6229680Sgibbs  static bool       contains(address pc);
6329680Sgibbs
6429680Sgibbs public:
6529680Sgibbs
6629680Sgibbs
6729680Sgibbs  // No displatch table to switch so no need for these to do anything special
6829680Sgibbs  static void notice_safepoints() {}
6929680Sgibbs  static void ignore_safepoints() {}
7029680Sgibbs
7129680Sgibbs  static address    native_result_to_tosca()                    { return (address)_native_abi_to_tosca; } // aka result handler
7232388Sphk  static address    tosca_result_to_stack()                     { return (address)_tosca_to_stack; }
7329680Sgibbs  static address    stack_result_to_stack()                     { return (address)_stack_to_stack; }
741541Srgrimes  static address    stack_result_to_native()                    { return (address)_stack_to_native_abi; }
751541Srgrimes
761541Srgrimes  static address    native_result_to_tosca(int index)           { return _native_abi_to_tosca[index]; } // aka result handler
771541Srgrimes  static address    tosca_result_to_stack(int index)            { return _tosca_to_stack[index]; }
7832391Sphk  static address    stack_result_to_stack(int index)            { return _stack_to_stack[index]; }
791541Srgrimes  static address    stack_result_to_native(int index)           { return _stack_to_native_abi[index]; }
801541Srgrimes
8129805Sgibbs  static address    return_entry  (TosState state, int length, Bytecodes::Code code);
821541Srgrimes  static address    deopt_entry   (TosState state, int length);
8329805Sgibbs
8433392Sphk#ifdef TARGET_ARCH_x86
851541Srgrimes# include "cppInterpreter_x86.hpp"
8633392Sphk#endif
8733392Sphk#ifdef TARGET_ARCH_sparc
8833392Sphk# include "cppInterpreter_sparc.hpp"
8929680Sgibbs#endif
9029680Sgibbs#ifdef TARGET_ARCH_zero
911541Srgrimes# include "cppInterpreter_zero.hpp"
9229680Sgibbs#endif
9329805Sgibbs#ifdef TARGET_ARCH_arm
9429805Sgibbs# include "cppInterpreter_arm.hpp"
9529805Sgibbs#endif
9629805Sgibbs#ifdef TARGET_ARCH_ppc
9729805Sgibbs# include "cppInterpreter_ppc.hpp"
9829805Sgibbs#endif
9929805Sgibbs
10029805Sgibbs
10129680Sgibbs};
10229805Sgibbs
10329680Sgibbs#endif // CC_INTERP
10429680Sgibbs
10529680Sgibbs#endif // SHARE_VM_INTERPRETER_CPPINTERPRETER_HPP
10629680Sgibbs