0N/A/*
4155N/A * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved.
0N/A * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
0N/A *
0N/A * This code is free software; you can redistribute it and/or modify it
0N/A * under the terms of the GNU General Public License version 2 only, as
0N/A * published by the Free Software Foundation.
0N/A *
0N/A * This code is distributed in the hope that it will be useful, but WITHOUT
0N/A * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
0N/A * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
0N/A * version 2 for more details (a copy is included in the LICENSE file that
0N/A * accompanied this code).
0N/A *
0N/A * You should have received a copy of the GNU General Public License version
0N/A * 2 along with this work; if not, write to the Free Software Foundation,
0N/A * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
0N/A *
1472N/A * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
1472N/A * or visit www.oracle.com if you need additional information or have any
1472N/A * questions.
0N/A *
0N/A */
0N/A
1879N/A#include "precompiled.hpp"
1879N/A#include "interpreter/bytecodeInterpreter.hpp"
1879N/A#include "interpreter/interpreter.hpp"
1879N/A#include "interpreter/interpreterGenerator.hpp"
1879N/A#include "interpreter/interpreterRuntime.hpp"
0N/A
0N/A#ifdef CC_INTERP
0N/A# define __ _masm->
0N/A
0N/Avoid CppInterpreter::initialize() {
0N/A if (_code != NULL) return;
0N/A AbstractInterpreter::initialize();
0N/A
0N/A // generate interpreter
0N/A { ResourceMark rm;
0N/A TraceTime timer("Interpreter generation", TraceStartupTime);
0N/A int code_size = InterpreterCodeSize;
0N/A NOT_PRODUCT(code_size *= 4;) // debug uses extra interpreter code space
0N/A _code = new StubQueue(new InterpreterCodeletInterface, code_size, NULL,
0N/A "Interpreter");
0N/A InterpreterGenerator g(_code);
0N/A if (PrintInterpreter) print();
0N/A }
0N/A
0N/A
0N/A // Allow c++ interpreter to do one initialization now that switches are set, etc.
0N/A BytecodeInterpreter start_msg(BytecodeInterpreter::initialize);
0N/A if (JvmtiExport::can_post_interpreter_events())
0N/A BytecodeInterpreter::runWithChecks(&start_msg);
0N/A else
0N/A BytecodeInterpreter::run(&start_msg);
0N/A}
0N/A
0N/A
0N/Aaddress CppInterpreter::_tosca_to_stack [AbstractInterpreter::number_of_result_handlers];
0N/Aaddress CppInterpreter::_stack_to_stack [AbstractInterpreter::number_of_result_handlers];
0N/Aaddress CppInterpreter::_stack_to_native_abi [AbstractInterpreter::number_of_result_handlers];
0N/A
0N/ACppInterpreterGenerator::CppInterpreterGenerator(StubQueue* _code): AbstractInterpreterGenerator(_code) {
0N/A}
0N/A
0N/Astatic const BasicType types[Interpreter::number_of_result_handlers] = {
0N/A T_BOOLEAN,
0N/A T_CHAR ,
0N/A T_BYTE ,
0N/A T_SHORT ,
0N/A T_INT ,
0N/A T_LONG ,
0N/A T_VOID ,
0N/A T_FLOAT ,
0N/A T_DOUBLE ,
0N/A T_OBJECT
0N/A};
0N/A
0N/Avoid CppInterpreterGenerator::generate_all() {
0N/A AbstractInterpreterGenerator::generate_all();
0N/A
0N/A { CodeletMark cm(_masm, "result handlers for native calls");
0N/A // The various result converter stublets.
0N/A int is_generated[Interpreter::number_of_result_handlers];
0N/A memset(is_generated, 0, sizeof(is_generated));
0N/A int _tosca_to_stack_is_generated[Interpreter::number_of_result_handlers];
0N/A int _stack_to_stack_is_generated[Interpreter::number_of_result_handlers];
0N/A int _stack_to_native_abi_is_generated[Interpreter::number_of_result_handlers];
0N/A
0N/A memset(_tosca_to_stack_is_generated, 0, sizeof(_tosca_to_stack_is_generated));
0N/A memset(_stack_to_stack_is_generated, 0, sizeof(_stack_to_stack_is_generated));
0N/A memset(_stack_to_native_abi_is_generated, 0, sizeof(_stack_to_native_abi_is_generated));
0N/A for (int i = 0; i < Interpreter::number_of_result_handlers; i++) {
0N/A BasicType type = types[i];
0N/A if (!is_generated[Interpreter::BasicType_as_index(type)]++) {
0N/A Interpreter::_native_abi_to_tosca[Interpreter::BasicType_as_index(type)] = generate_result_handler_for(type);
0N/A }
0N/A if (!_tosca_to_stack_is_generated[Interpreter::BasicType_as_index(type)]++) {
0N/A Interpreter::_tosca_to_stack[Interpreter::BasicType_as_index(type)] = generate_tosca_to_stack_converter(type);
0N/A }
0N/A if (!_stack_to_stack_is_generated[Interpreter::BasicType_as_index(type)]++) {
0N/A Interpreter::_stack_to_stack[Interpreter::BasicType_as_index(type)] = generate_stack_to_stack_converter(type);
0N/A }
0N/A if (!_stack_to_native_abi_is_generated[Interpreter::BasicType_as_index(type)]++) {
0N/A Interpreter::_stack_to_native_abi[Interpreter::BasicType_as_index(type)] = generate_stack_to_native_abi_converter(type);
0N/A }
0N/A }
0N/A }
0N/A
0N/A
0N/A#define method_entry(kind) Interpreter::_entry_table[Interpreter::kind] = generate_method_entry(Interpreter::kind)
0N/A
0N/A { CodeletMark cm(_masm, "(kind = frame_manager)");
0N/A // all non-native method kinds
0N/A method_entry(zerolocals);
0N/A method_entry(zerolocals_synchronized);
0N/A method_entry(empty);
0N/A method_entry(accessor);
0N/A method_entry(abstract);
0N/A method_entry(java_lang_math_sin );
0N/A method_entry(java_lang_math_cos );
0N/A method_entry(java_lang_math_tan );
0N/A method_entry(java_lang_math_abs );
0N/A method_entry(java_lang_math_sqrt );
0N/A method_entry(java_lang_math_log );
0N/A method_entry(java_lang_math_log10 );
4155N/A method_entry(java_lang_math_pow );
4155N/A method_entry(java_lang_math_exp );
2346N/A method_entry(java_lang_ref_reference_get);
4155N/A
4155N/A initialize_method_handle_entries();
4155N/A
0N/A Interpreter::_native_entry_begin = Interpreter::code()->code_end();
0N/A method_entry(native);
0N/A method_entry(native_synchronized);
0N/A Interpreter::_native_entry_end = Interpreter::code()->code_end();
0N/A }
0N/A
0N/A
0N/A#undef method_entry
0N/A
0N/A}
0N/A
0N/A#endif // CC_INTERP