templateInterpreter.hpp revision 605
/*
* Copyright 1997-2007 Sun Microsystems, Inc. All Rights Reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
* CA 95054 USA or visit www.sun.com if you need additional information or
* have any questions.
*
*/
// This file contains the platform-independent parts
// of the template interpreter and the template interpreter generator.
#ifndef CC_INTERP
//------------------------------------------------------------------------------------------------------------------------
// A little wrapper class to group tosca-specific entry points into a unit.
// (tosca = Top-Of-Stack CAche)
class EntryPoint VALUE_OBJ_CLASS_SPEC {
private:
public:
// Construction
EntryPoint();
EntryPoint(address bentry, address centry, address sentry, address aentry, address ientry, address lentry, address fentry, address dentry, address ventry);
// Attributes
void print();
// Comparison
bool operator == (const EntryPoint& y); // for debugging only
};
//------------------------------------------------------------------------------------------------------------------------
// A little wrapper class to group tosca-specific dispatch tables into a unit.
class DispatchTable VALUE_OBJ_CLASS_SPEC {
public:
enum { length = 1 << BitsPerByte }; // an entry point for each byte value (also for undefined bytecodes)
private:
public:
// Attributes
// Comparison
bool operator == (DispatchTable& y); // for debugging only
};
class TemplateInterpreter: public AbstractInterpreter {
friend class VMStructs;
friend class InterpreterMacroAssembler;
friend class TemplateInterpreterGenerator;
friend class TemplateTable;
// friend class Interpreter;
public:
enum MoreConstants {
};
protected:
static address _throw_exception_entry;
static address _remove_activation_entry; // continuation address if an exception is not handled by current frame
#ifdef HOTSWAP
static address _remove_activation_preserving_args_entry; // continuation address when current frame is being popped
#endif // HOTSWAP
#ifndef PRODUCT
static EntryPoint _trace_code;
#endif // !PRODUCT
static EntryPoint _deopt_entry[number_of_deopt_entries]; // entry points to return to from a deoptimization
static EntryPoint _continuation_entry;
static EntryPoint _safept_entry;
static address _return_3_addrs_by_index[number_of_return_addrs]; // for invokevirtual return entries
static address _return_5_addrs_by_index[number_of_return_addrs]; // for invokeinterface return entries
static DispatchTable _active_table; // the active dispatch table (used by the interpreter for dispatch)
static DispatchTable _normal_table; // the normal dispatch table (used to set the active table in normal mode)
static DispatchTable _safept_table; // the safepoint dispatch table (used to set the active table for safepoints)
public:
static void initialize();
// this only returns whether a pc is within generated code for the interpreter.
public:
static address remove_activation_early_entry(TosState state) { return _earlyret_entry.entry(state); }
#ifdef HOTSWAP
static address remove_activation_preserving_args_entry() { return _remove_activation_preserving_args_entry; }
#endif // HOTSWAP
// Code generation
#ifndef PRODUCT
#endif // !PRODUCT
static int distance_from_dispatch_table(TosState state){ return _active_table.distance_from(state); }
// Support for invokes
// Safepoint support
static void notice_safepoints(); // stops the thread when reaching a safepoint
static void ignore_safepoints(); // ignores safepoints
// Deoptimization support
int callee_parameters,
bool is_top_frame,
bool& use_next_mdp);
#include "incls/_templateInterpreter_pd.hpp.incl"
};
#endif // !CC_INTERP