annotate src/share/vm/interpreter/cppInterpreter.cpp @ 4181:319860ae697a

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