src/share/vm/interpreter/cppInterpreter.cpp

Thu, 17 Mar 2011 18:29:18 -0700

author
jrose
date
Thu, 17 Mar 2011 18:29:18 -0700
changeset 2641
d2134498fd3f
parent 2314
f95d63e2154a
child 2781
e1162778c1c8
permissions
-rw-r--r--

7011865: JSR 292 CTW fails: !THREAD->is_Compiler_thread() failed: Can not load classes with the Compiler thre
Reviewed-by: kvn, never

duke@435 1 /*
stefank@2314 2 * Copyright (c) 1997, 2010, Oracle and/or its affiliates. All rights reserved.
duke@435 3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
duke@435 4 *
duke@435 5 * This code is free software; you can redistribute it and/or modify it
duke@435 6 * under the terms of the GNU General Public License version 2 only, as
duke@435 7 * published by the Free Software Foundation.
duke@435 8 *
duke@435 9 * This code is distributed in the hope that it will be useful, but WITHOUT
duke@435 10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
duke@435 11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
duke@435 12 * version 2 for more details (a copy is included in the LICENSE file that
duke@435 13 * accompanied this code).
duke@435 14 *
duke@435 15 * You should have received a copy of the GNU General Public License version
duke@435 16 * 2 along with this work; if not, write to the Free Software Foundation,
duke@435 17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
duke@435 18 *
trims@1907 19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
trims@1907 20 * or visit www.oracle.com if you need additional information or have any
trims@1907 21 * questions.
duke@435 22 *
duke@435 23 */
duke@435 24
stefank@2314 25 #include "precompiled.hpp"
stefank@2314 26 #include "interpreter/bytecodeInterpreter.hpp"
stefank@2314 27 #include "interpreter/interpreter.hpp"
stefank@2314 28 #include "interpreter/interpreterGenerator.hpp"
stefank@2314 29 #include "interpreter/interpreterRuntime.hpp"
duke@435 30
duke@435 31 #ifdef CC_INTERP
duke@435 32 # define __ _masm->
duke@435 33
duke@435 34 void CppInterpreter::initialize() {
duke@435 35 if (_code != NULL) return;
duke@435 36 AbstractInterpreter::initialize();
duke@435 37
duke@435 38 // generate interpreter
duke@435 39 { ResourceMark rm;
duke@435 40 TraceTime timer("Interpreter generation", TraceStartupTime);
duke@435 41 int code_size = InterpreterCodeSize;
duke@435 42 NOT_PRODUCT(code_size *= 4;) // debug uses extra interpreter code space
duke@435 43 _code = new StubQueue(new InterpreterCodeletInterface, code_size, NULL,
duke@435 44 "Interpreter");
duke@435 45 InterpreterGenerator g(_code);
duke@435 46 if (PrintInterpreter) print();
duke@435 47 }
duke@435 48
duke@435 49
duke@435 50 // Allow c++ interpreter to do one initialization now that switches are set, etc.
duke@435 51 BytecodeInterpreter start_msg(BytecodeInterpreter::initialize);
duke@435 52 if (JvmtiExport::can_post_interpreter_events())
duke@435 53 BytecodeInterpreter::runWithChecks(&start_msg);
duke@435 54 else
duke@435 55 BytecodeInterpreter::run(&start_msg);
duke@435 56 }
duke@435 57
duke@435 58
duke@435 59 address CppInterpreter::_tosca_to_stack [AbstractInterpreter::number_of_result_handlers];
duke@435 60 address CppInterpreter::_stack_to_stack [AbstractInterpreter::number_of_result_handlers];
duke@435 61 address CppInterpreter::_stack_to_native_abi [AbstractInterpreter::number_of_result_handlers];
duke@435 62
duke@435 63 CppInterpreterGenerator::CppInterpreterGenerator(StubQueue* _code): AbstractInterpreterGenerator(_code) {
duke@435 64 }
duke@435 65
duke@435 66 static const BasicType types[Interpreter::number_of_result_handlers] = {
duke@435 67 T_BOOLEAN,
duke@435 68 T_CHAR ,
duke@435 69 T_BYTE ,
duke@435 70 T_SHORT ,
duke@435 71 T_INT ,
duke@435 72 T_LONG ,
duke@435 73 T_VOID ,
duke@435 74 T_FLOAT ,
duke@435 75 T_DOUBLE ,
duke@435 76 T_OBJECT
duke@435 77 };
duke@435 78
duke@435 79 void CppInterpreterGenerator::generate_all() {
duke@435 80 AbstractInterpreterGenerator::generate_all();
duke@435 81
duke@435 82 { CodeletMark cm(_masm, "result handlers for native calls");
duke@435 83 // The various result converter stublets.
duke@435 84 int is_generated[Interpreter::number_of_result_handlers];
duke@435 85 memset(is_generated, 0, sizeof(is_generated));
duke@435 86 int _tosca_to_stack_is_generated[Interpreter::number_of_result_handlers];
duke@435 87 int _stack_to_stack_is_generated[Interpreter::number_of_result_handlers];
duke@435 88 int _stack_to_native_abi_is_generated[Interpreter::number_of_result_handlers];
duke@435 89
duke@435 90 memset(_tosca_to_stack_is_generated, 0, sizeof(_tosca_to_stack_is_generated));
duke@435 91 memset(_stack_to_stack_is_generated, 0, sizeof(_stack_to_stack_is_generated));
duke@435 92 memset(_stack_to_native_abi_is_generated, 0, sizeof(_stack_to_native_abi_is_generated));
duke@435 93 for (int i = 0; i < Interpreter::number_of_result_handlers; i++) {
duke@435 94 BasicType type = types[i];
duke@435 95 if (!is_generated[Interpreter::BasicType_as_index(type)]++) {
duke@435 96 Interpreter::_native_abi_to_tosca[Interpreter::BasicType_as_index(type)] = generate_result_handler_for(type);
duke@435 97 }
duke@435 98 if (!_tosca_to_stack_is_generated[Interpreter::BasicType_as_index(type)]++) {
duke@435 99 Interpreter::_tosca_to_stack[Interpreter::BasicType_as_index(type)] = generate_tosca_to_stack_converter(type);
duke@435 100 }
duke@435 101 if (!_stack_to_stack_is_generated[Interpreter::BasicType_as_index(type)]++) {
duke@435 102 Interpreter::_stack_to_stack[Interpreter::BasicType_as_index(type)] = generate_stack_to_stack_converter(type);
duke@435 103 }
duke@435 104 if (!_stack_to_native_abi_is_generated[Interpreter::BasicType_as_index(type)]++) {
duke@435 105 Interpreter::_stack_to_native_abi[Interpreter::BasicType_as_index(type)] = generate_stack_to_native_abi_converter(type);
duke@435 106 }
duke@435 107 }
duke@435 108 }
duke@435 109
duke@435 110
duke@435 111 #define method_entry(kind) Interpreter::_entry_table[Interpreter::kind] = generate_method_entry(Interpreter::kind)
duke@435 112
duke@435 113 { CodeletMark cm(_masm, "(kind = frame_manager)");
duke@435 114 // all non-native method kinds
duke@435 115 method_entry(zerolocals);
duke@435 116 method_entry(zerolocals_synchronized);
duke@435 117 method_entry(empty);
duke@435 118 method_entry(accessor);
duke@435 119 method_entry(abstract);
jrose@1145 120 method_entry(method_handle);
duke@435 121 method_entry(java_lang_math_sin );
duke@435 122 method_entry(java_lang_math_cos );
duke@435 123 method_entry(java_lang_math_tan );
duke@435 124 method_entry(java_lang_math_abs );
duke@435 125 method_entry(java_lang_math_sqrt );
duke@435 126 method_entry(java_lang_math_log );
duke@435 127 method_entry(java_lang_math_log10 );
duke@435 128 Interpreter::_native_entry_begin = Interpreter::code()->code_end();
duke@435 129 method_entry(native);
duke@435 130 method_entry(native_synchronized);
duke@435 131 Interpreter::_native_entry_end = Interpreter::code()->code_end();
duke@435 132 }
duke@435 133
duke@435 134
duke@435 135 #undef method_entry
duke@435 136
duke@435 137 }
duke@435 138
duke@435 139 #endif // CC_INTERP

mercurial