abstractInterpreter.hpp revision 2346
/*
* 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 Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*
*/
#include "interpreter/bytecodes.hpp"
#include "runtime/vmThread.hpp"
#ifdef TARGET_ARCH_MODEL_x86_32
# include "interp_masm_x86_32.hpp"
#endif
#ifdef TARGET_ARCH_MODEL_x86_64
# include "interp_masm_x86_64.hpp"
#endif
#ifdef TARGET_ARCH_MODEL_sparc
# include "interp_masm_sparc.hpp"
#endif
#ifdef TARGET_ARCH_MODEL_zero
# include "interp_masm_zero.hpp"
#endif
#ifdef TARGET_ARCH_MODEL_arm
# include "interp_masm_arm.hpp"
#endif
#ifdef TARGET_ARCH_MODEL_ppc
# include "interp_masm_ppc.hpp"
#endif
#ifdef TARGET_OS_FAMILY_linux
# include "thread_linux.inline.hpp"
#endif
#ifdef TARGET_OS_FAMILY_solaris
# include "thread_solaris.inline.hpp"
#endif
#ifdef TARGET_OS_FAMILY_windows
# include "thread_windows.inline.hpp"
#endif
// This file contains the platform-independent parts
// of the abstract interpreter and the abstract interpreter generator.
// Organization of the interpreter(s). There exists two different interpreters in hotpot
// an assembly language version (aka template interpreter) and a high level language version
// (aka c++ interpreter). Th division of labor is as follows:
// Template Interpreter C++ Interpreter Functionality
//
// templateTable* bytecodeInterpreter* actual interpretation of bytecodes
//
// templateInterpreter* cppInterpreter* generation of assembly code that creates
// and manages interpreter runtime frames.
// Also code for populating interpreter
// frames created during deoptimization.
//
// For both template and c++ interpreter. There are common files for aspects of the interpreter
// that are generic to both interpreters. This is the layout:
//
// abstractInterpreter.hpp: generic description of the interpreter.
// interpreter*: generic frame creation and handling.
//
//------------------------------------------------------------------------------------------------------------------------
// The C++ interface to the bytecode interpreter(s).
class AbstractInterpreter: AllStatic {
friend class VMStructs;
friend class Interpreter;
friend class CppInterpreterGenerator;
public:
enum MethodKind {
zerolocals, // method needs locals initialization
zerolocals_synchronized, // method needs locals initialization & is synchronized
native, // native method
native_synchronized, // native method & is synchronized
empty, // empty method (code: _return)
accessor, // accessor method (code: _aload_0, _getfield, _(a|i)return)
abstract, // abstract method (throws an AbstractMethodException)
method_handle, // java.lang.invoke.MethodHandles::invoke
java_lang_math_sin, // implementation of java.lang.Math.sin (x)
java_lang_math_cos, // implementation of java.lang.Math.cos (x)
java_lang_math_tan, // implementation of java.lang.Math.tan (x)
java_lang_math_abs, // implementation of java.lang.Math.abs (x)
java_lang_math_sqrt, // implementation of java.lang.Math.sqrt (x)
java_lang_math_log, // implementation of java.lang.Math.log (x)
java_lang_math_log10, // implementation of java.lang.Math.log10 (x)
java_lang_ref_reference_get, // implementation of java.lang.ref.Reference.get()
invalid = -1
};
enum SomeConstants {
};
protected:
static bool _notice_safepoints; // true if safepoints are activated
static address _native_entry_end;
// method entry points
static address _native_abi_to_tosca[number_of_result_handlers]; // for native method result handlers
friend class AbstractInterpreterGenerator;
friend class InterpreterGenerator;
friend class InterpreterMacroAssembler;
public:
static void initialize();
// Method activation
static address entry_for_kind(MethodKind k) { assert(0 <= k && k < number_of_method_entries, "illegal kind"); return _entry_table[k]; }
static bool can_be_compiled(methodHandle m);
// Runtime support
// length = invoke bytecode length (to advance to next bytecode)
// Activation size in words for a method that is just being called.
// Parameters haven't been pushed so count them too.
// Deoptimization support
// Compute the entry address for continuation after
int callee_parameters,
bool is_top_frame);
// Compute the entry address for reexecution
// Deoptimization should reexecute this bytecode
// share implementation of size_activation and layout_activation:
int temps,
int popframe_args,
int monitors,
int callee_params,
int callee_locals,
bool is_top_frame);
int temps,
int popframe_args,
int monitors,
int callee_params,
int callee_locals,
bool is_top_frame);
// Runtime support
// Safepoint support
static void notice_safepoints() { ShouldNotReachHere(); } // stops the thread when reaching a safepoint
// Support for native calls
static address result_handler(BasicType type) { return _native_abi_to_tosca[BasicType_as_index(type)]; }
static bool in_native_entry(address pc) { return _native_entry_begin <= pc && pc < _native_entry_end; }
static void print(); // prints the interpreter code
public:
// Interpreter helpers
const static int stackElementWords = 1;
const static int logStackElementSize = LogBytesPerWord;
// Local values relative to locals[n]
static int local_offset_in_bytes(int n) {
}
// access to stacked values according to type:
}
// big-endian LP64
else
}
} else {
}
}
} else {
}
}
switch (type) {
default: ShouldNotReachHere();
}
}
switch (type) {
default: ShouldNotReachHere();
}
}
};
//------------------------------------------------------------------------------------------------------------------------
// The interpreter generator.
class Template;
class AbstractInterpreterGenerator: public StackObj {
protected:
// shared code sequences
// Converter for native abi result to tosca result
// entry point generator
void bang_stack_shadow_pages(bool native_call);
void generate_all();
public:
};
#endif // SHARE_VM_INTERPRETER_ABSTRACTINTERPRETER_HPP