author | rprotacio |
Tue, 22 Dec 2015 16:29:48 -0500 | |
changeset 35216 | 71c463a17b3b |
parent 35214 | d86005e0b4c2 |
child 35479 | 62c12ca7a45e |
permissions | -rw-r--r-- |
1 | 1 |
/* |
35214 | 2 |
* Copyright (c) 1997, 2015, Oracle and/or its affiliates. All rights reserved. |
1 | 3 |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
4 |
* |
|
5 |
* This code is free software; you can redistribute it and/or modify it |
|
6 |
* under the terms of the GNU General Public License version 2 only, as |
|
7 |
* published by the Free Software Foundation. |
|
8 |
* |
|
9 |
* This code is distributed in the hope that it will be useful, but WITHOUT |
|
10 |
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
|
11 |
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
|
12 |
* version 2 for more details (a copy is included in the LICENSE file that |
|
13 |
* accompanied this code). |
|
14 |
* |
|
15 |
* You should have received a copy of the GNU General Public License version |
|
16 |
* 2 along with this work; if not, write to the Free Software Foundation, |
|
17 |
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. |
|
18 |
* |
|
5547
f4b087cbb361
6941466: Oracle rebranding changes for Hotspot repositories
trims
parents:
2534
diff
changeset
|
19 |
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA |
f4b087cbb361
6941466: Oracle rebranding changes for Hotspot repositories
trims
parents:
2534
diff
changeset
|
20 |
* or visit www.oracle.com if you need additional information or have any |
f4b087cbb361
6941466: Oracle rebranding changes for Hotspot repositories
trims
parents:
2534
diff
changeset
|
21 |
* questions. |
1 | 22 |
* |
23 |
*/ |
|
24 |
||
7397 | 25 |
#include "precompiled.hpp" |
26 |
#include "interpreter/bytecodeInterpreter.hpp" |
|
35214 | 27 |
#include "interpreter/cppInterpreterGenerator.hpp" |
7397 | 28 |
#include "interpreter/interpreter.hpp" |
29 |
#include "interpreter/interpreterRuntime.hpp" |
|
1 | 30 |
|
31 |
#ifdef CC_INTERP |
|
35214 | 32 |
|
33 |
#ifdef ZERO |
|
34 |
# include "entry_zero.hpp" |
|
35 |
#else |
|
36 |
#error "Only Zero CppInterpreter is supported" |
|
37 |
#endif |
|
1 | 38 |
|
39 |
void CppInterpreter::initialize() { |
|
40 |
if (_code != NULL) return; |
|
41 |
AbstractInterpreter::initialize(); |
|
42 |
||
43 |
// generate interpreter |
|
44 |
{ ResourceMark rm; |
|
45 |
TraceTime timer("Interpreter generation", TraceStartupTime); |
|
46 |
int code_size = InterpreterCodeSize; |
|
47 |
NOT_PRODUCT(code_size *= 4;) // debug uses extra interpreter code space |
|
48 |
_code = new StubQueue(new InterpreterCodeletInterface, code_size, NULL, |
|
49 |
"Interpreter"); |
|
35214 | 50 |
CppInterpreterGenerator g(_code); |
1 | 51 |
if (PrintInterpreter) print(); |
52 |
} |
|
53 |
||
54 |
||
55 |
// Allow c++ interpreter to do one initialization now that switches are set, etc. |
|
56 |
BytecodeInterpreter start_msg(BytecodeInterpreter::initialize); |
|
57 |
if (JvmtiExport::can_post_interpreter_events()) |
|
58 |
BytecodeInterpreter::runWithChecks(&start_msg); |
|
59 |
else |
|
60 |
BytecodeInterpreter::run(&start_msg); |
|
61 |
} |
|
62 |
||
63 |
||
35214 | 64 |
void CppInterpreter::invoke_method(Method* method, address entry_point, TRAPS) { |
65 |
((ZeroEntry *) entry_point)->invoke(method, THREAD); |
|
66 |
} |
|
67 |
||
68 |
void CppInterpreter::invoke_osr(Method* method, |
|
69 |
address entry_point, |
|
70 |
address osr_buf, |
|
71 |
TRAPS) { |
|
72 |
((ZeroEntry *) entry_point)->invoke_osr(method, osr_buf, THREAD); |
|
73 |
} |
|
74 |
||
1 | 75 |
|
76 |
CppInterpreterGenerator::CppInterpreterGenerator(StubQueue* _code): AbstractInterpreterGenerator(_code) { |
|
35214 | 77 |
generate_all(); |
1 | 78 |
} |
79 |
||
80 |
static const BasicType types[Interpreter::number_of_result_handlers] = { |
|
81 |
T_BOOLEAN, |
|
82 |
T_CHAR , |
|
83 |
T_BYTE , |
|
84 |
T_SHORT , |
|
85 |
T_INT , |
|
86 |
T_LONG , |
|
87 |
T_VOID , |
|
88 |
T_FLOAT , |
|
89 |
T_DOUBLE , |
|
90 |
T_OBJECT |
|
91 |
}; |
|
92 |
||
93 |
void CppInterpreterGenerator::generate_all() { |
|
94 |
AbstractInterpreterGenerator::generate_all(); |
|
95 |
||
96 |
||
35214 | 97 |
#define method_entry(kind) Interpreter::_entry_table[Interpreter::kind] = generate_method_entry(Interpreter::kind) |
1 | 98 |
|
99 |
{ CodeletMark cm(_masm, "(kind = frame_manager)"); |
|
100 |
// all non-native method kinds |
|
101 |
method_entry(zerolocals); |
|
102 |
method_entry(zerolocals_synchronized); |
|
103 |
method_entry(empty); |
|
104 |
method_entry(accessor); |
|
105 |
method_entry(abstract); |
|
106 |
method_entry(java_lang_math_sin ); |
|
107 |
method_entry(java_lang_math_cos ); |
|
108 |
method_entry(java_lang_math_tan ); |
|
109 |
method_entry(java_lang_math_abs ); |
|
110 |
method_entry(java_lang_math_sqrt ); |
|
111 |
method_entry(java_lang_math_log ); |
|
112 |
method_entry(java_lang_math_log10 ); |
|
14294 | 113 |
method_entry(java_lang_math_pow ); |
114 |
method_entry(java_lang_math_exp ); |
|
9176
42d9d1010f38
7009266: G1: assert(obj->is_oop_or_null(true )) failed: Error
johnc
parents:
7397
diff
changeset
|
115 |
method_entry(java_lang_ref_reference_get); |
14294 | 116 |
|
117 |
initialize_method_handle_entries(); |
|
118 |
||
1 | 119 |
Interpreter::_native_entry_begin = Interpreter::code()->code_end(); |
120 |
method_entry(native); |
|
121 |
method_entry(native_synchronized); |
|
122 |
Interpreter::_native_entry_end = Interpreter::code()->code_end(); |
|
123 |
} |
|
124 |
||
125 |
||
126 |
#undef method_entry |
|
35214 | 127 |
} |
1 | 128 |
|
35214 | 129 |
InterpreterCodelet* CppInterpreter::codelet_containing(address pc) { |
130 |
// FIXME: I'm pretty sure _code is null and this is never called, which is why it's copied. |
|
131 |
return (InterpreterCodelet*)_code->stub_containing(pc); |
|
1 | 132 |
} |
133 |
||
35214 | 134 |
// Generate method entries |
135 |
address CppInterpreterGenerator::generate_method_entry( |
|
136 |
AbstractInterpreter::MethodKind kind) { |
|
137 |
// determine code generation flags |
|
138 |
bool native = false; |
|
139 |
bool synchronized = false; |
|
140 |
address entry_point = NULL; |
|
141 |
||
142 |
switch (kind) { |
|
143 |
case Interpreter::zerolocals : break; |
|
144 |
case Interpreter::zerolocals_synchronized: synchronized = true; break; |
|
145 |
case Interpreter::native : native = true; break; |
|
146 |
case Interpreter::native_synchronized : native = true; synchronized = true; break; |
|
147 |
case Interpreter::empty : entry_point = generate_empty_entry(); break; |
|
148 |
case Interpreter::accessor : entry_point = generate_accessor_entry(); break; |
|
149 |
case Interpreter::abstract : entry_point = generate_abstract_entry(); break; |
|
150 |
||
151 |
case Interpreter::java_lang_math_sin : // fall thru |
|
152 |
case Interpreter::java_lang_math_cos : // fall thru |
|
153 |
case Interpreter::java_lang_math_tan : // fall thru |
|
154 |
case Interpreter::java_lang_math_abs : // fall thru |
|
155 |
case Interpreter::java_lang_math_log : // fall thru |
|
156 |
case Interpreter::java_lang_math_log10 : // fall thru |
|
157 |
case Interpreter::java_lang_math_sqrt : // fall thru |
|
158 |
case Interpreter::java_lang_math_pow : // fall thru |
|
159 |
case Interpreter::java_lang_math_exp : entry_point = generate_math_entry(kind); break; |
|
160 |
case Interpreter::java_lang_ref_reference_get |
|
161 |
: entry_point = generate_Reference_get_entry(); break; |
|
162 |
default: |
|
163 |
fatal("unexpected method kind: %d", kind); |
|
164 |
break; |
|
165 |
} |
|
166 |
||
167 |
if (entry_point) { |
|
168 |
return entry_point; |
|
169 |
} |
|
170 |
||
171 |
// We expect the normal and native entry points to be generated first so we can reuse them. |
|
172 |
if (native) { |
|
173 |
entry_point = Interpreter::entry_for_kind(synchronized ? Interpreter::native_synchronized : Interpreter::native); |
|
174 |
if (entry_point == NULL) { |
|
175 |
entry_point = generate_native_entry(synchronized); |
|
176 |
} |
|
177 |
} else { |
|
178 |
entry_point = Interpreter::entry_for_kind(synchronized ? Interpreter::zerolocals_synchronized : Interpreter::zerolocals); |
|
179 |
if (entry_point == NULL) { |
|
180 |
entry_point = generate_normal_entry(synchronized); |
|
181 |
} |
|
182 |
} |
|
183 |
||
184 |
return entry_point; |
|
185 |
} |
|
1 | 186 |
#endif // CC_INTERP |