Path: blob/aarch64-shenandoah-jdk8u272-b10/hotspot/src/share/vm/interpreter/cppInterpreter.cpp
32285 views
/*1* Copyright (c) 1997, 2011, Oracle and/or its affiliates. All rights reserved.2* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.3*4* This code is free software; you can redistribute it and/or modify it5* under the terms of the GNU General Public License version 2 only, as6* published by the Free Software Foundation.7*8* This code is distributed in the hope that it will be useful, but WITHOUT9* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or10* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License11* version 2 for more details (a copy is included in the LICENSE file that12* accompanied this code).13*14* You should have received a copy of the GNU General Public License version15* 2 along with this work; if not, write to the Free Software Foundation,16* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.17*18* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA19* or visit www.oracle.com if you need additional information or have any20* questions.21*22*/2324#include "precompiled.hpp"25#include "interpreter/bytecodeInterpreter.hpp"26#include "interpreter/interpreter.hpp"27#include "interpreter/interpreterGenerator.hpp"28#include "interpreter/interpreterRuntime.hpp"2930#ifdef CC_INTERP31# define __ _masm->3233void CppInterpreter::initialize() {34if (_code != NULL) return;35AbstractInterpreter::initialize();3637// generate interpreter38{ ResourceMark rm;39TraceTime timer("Interpreter generation", TraceStartupTime);40int code_size = InterpreterCodeSize;41NOT_PRODUCT(code_size *= 4;) // debug uses extra interpreter code space42_code = new StubQueue(new InterpreterCodeletInterface, code_size, NULL,43"Interpreter");44InterpreterGenerator g(_code);45if (PrintInterpreter) print();46}474849// Allow c++ interpreter to do one initialization now that switches are set, etc.50BytecodeInterpreter start_msg(BytecodeInterpreter::initialize);51if (JvmtiExport::can_post_interpreter_events())52BytecodeInterpreter::runWithChecks(&start_msg);53else54BytecodeInterpreter::run(&start_msg);55}565758address CppInterpreter::_tosca_to_stack [AbstractInterpreter::number_of_result_handlers];59address CppInterpreter::_stack_to_stack [AbstractInterpreter::number_of_result_handlers];60address CppInterpreter::_stack_to_native_abi [AbstractInterpreter::number_of_result_handlers];6162CppInterpreterGenerator::CppInterpreterGenerator(StubQueue* _code): AbstractInterpreterGenerator(_code) {63}6465static const BasicType types[Interpreter::number_of_result_handlers] = {66T_BOOLEAN,67T_CHAR ,68T_BYTE ,69T_SHORT ,70T_INT ,71T_LONG ,72T_VOID ,73T_FLOAT ,74T_DOUBLE ,75T_OBJECT76};7778void CppInterpreterGenerator::generate_all() {79AbstractInterpreterGenerator::generate_all();8081{ CodeletMark cm(_masm, "result handlers for native calls");82// The various result converter stublets.83int is_generated[Interpreter::number_of_result_handlers];84memset(is_generated, 0, sizeof(is_generated));85int _tosca_to_stack_is_generated[Interpreter::number_of_result_handlers];86int _stack_to_stack_is_generated[Interpreter::number_of_result_handlers];87int _stack_to_native_abi_is_generated[Interpreter::number_of_result_handlers];8889memset(_tosca_to_stack_is_generated, 0, sizeof(_tosca_to_stack_is_generated));90memset(_stack_to_stack_is_generated, 0, sizeof(_stack_to_stack_is_generated));91memset(_stack_to_native_abi_is_generated, 0, sizeof(_stack_to_native_abi_is_generated));92for (int i = 0; i < Interpreter::number_of_result_handlers; i++) {93BasicType type = types[i];94if (!is_generated[Interpreter::BasicType_as_index(type)]++) {95Interpreter::_native_abi_to_tosca[Interpreter::BasicType_as_index(type)] = generate_result_handler_for(type);96}97if (!_tosca_to_stack_is_generated[Interpreter::BasicType_as_index(type)]++) {98Interpreter::_tosca_to_stack[Interpreter::BasicType_as_index(type)] = generate_tosca_to_stack_converter(type);99}100if (!_stack_to_stack_is_generated[Interpreter::BasicType_as_index(type)]++) {101Interpreter::_stack_to_stack[Interpreter::BasicType_as_index(type)] = generate_stack_to_stack_converter(type);102}103if (!_stack_to_native_abi_is_generated[Interpreter::BasicType_as_index(type)]++) {104Interpreter::_stack_to_native_abi[Interpreter::BasicType_as_index(type)] = generate_stack_to_native_abi_converter(type);105}106}107}108109110#define method_entry(kind) Interpreter::_entry_table[Interpreter::kind] = generate_method_entry(Interpreter::kind)111112{ CodeletMark cm(_masm, "(kind = frame_manager)");113// all non-native method kinds114method_entry(zerolocals);115method_entry(zerolocals_synchronized);116method_entry(empty);117method_entry(accessor);118method_entry(abstract);119method_entry(java_lang_math_sin );120method_entry(java_lang_math_cos );121method_entry(java_lang_math_tan );122method_entry(java_lang_math_abs );123method_entry(java_lang_math_sqrt );124method_entry(java_lang_math_log );125method_entry(java_lang_math_log10 );126method_entry(java_lang_math_pow );127method_entry(java_lang_math_exp );128method_entry(java_lang_ref_reference_get);129130initialize_method_handle_entries();131132Interpreter::_native_entry_begin = Interpreter::code()->code_end();133method_entry(native);134method_entry(native_synchronized);135Interpreter::_native_entry_end = Interpreter::code()->code_end();136}137138139#undef method_entry140141}142143#endif // CC_INTERP144145146