author | chegar |
Thu, 17 Oct 2019 20:54:25 +0100 | |
branch | datagramsocketimpl-branch |
changeset 58679 | 9c3209ff7550 |
parent 58678 | 9cf78a70fa4f |
parent 55637 | 422fb430bc7b |
permissions | -rw-r--r-- |
1 | 1 |
/* |
55608
47af68c44e02
8227117: normal interpreter table is not restored after single stepping with TLH
dcubed
parents:
47916
diff
changeset
|
2 |
* Copyright (c) 1997, 2019, 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:
5402
diff
changeset
|
19 |
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA |
f4b087cbb361
6941466: Oracle rebranding changes for Hotspot repositories
trims
parents:
5402
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:
5402
diff
changeset
|
21 |
* questions. |
1 | 22 |
* |
23 |
*/ |
|
24 |
||
7397 | 25 |
#include "precompiled.hpp" |
26 |
#include "interpreter/interpreter.hpp" |
|
27 |
#include "interpreter/interpreterRuntime.hpp" |
|
25715
d5a8dbdc5150
8049325: Introduce and clean up umbrella headers for the files in the cpu subdirectories.
goetz
parents:
24424
diff
changeset
|
28 |
#include "interpreter/interp_masm.hpp" |
d5a8dbdc5150
8049325: Introduce and clean up umbrella headers for the files in the cpu subdirectories.
goetz
parents:
24424
diff
changeset
|
29 |
#include "interpreter/templateInterpreter.hpp" |
35214 | 30 |
#include "interpreter/templateInterpreterGenerator.hpp" |
7397 | 31 |
#include "interpreter/templateTable.hpp" |
55608
47af68c44e02
8227117: normal interpreter table is not restored after single stepping with TLH
dcubed
parents:
47916
diff
changeset
|
32 |
#include "logging/log.hpp" |
35479
62c12ca7a45e
8146410: Interpreter functions are declared and defined in the wrong files
coleenp
parents:
35214
diff
changeset
|
33 |
#include "memory/resourceArea.hpp" |
55637
422fb430bc7b
8227338: templateInterpreter.cpp: copy_table() needs to be safer
dcubed
parents:
55608
diff
changeset
|
34 |
#include "runtime/safepoint.hpp" |
37161
e881f320966e
8150015: Integrate TraceTime with Unified Logging more seamlessly
rehn
parents:
36178
diff
changeset
|
35 |
#include "runtime/timerTrace.hpp" |
55637
422fb430bc7b
8227338: templateInterpreter.cpp: copy_table() needs to be safer
dcubed
parents:
55608
diff
changeset
|
36 |
#include "utilities/copy.hpp" |
1 | 37 |
|
38 |
#ifndef CC_INTERP |
|
39 |
||
40 |
# define __ _masm-> |
|
41 |
||
42 |
void TemplateInterpreter::initialize() { |
|
43 |
if (_code != NULL) return; |
|
44 |
// assertions |
|
45 |
assert((int)Bytecodes::number_of_codes <= (int)DispatchTable::length, |
|
46 |
"dispatch table too small"); |
|
47 |
||
48 |
AbstractInterpreter::initialize(); |
|
49 |
||
50 |
TemplateTable::initialize(); |
|
51 |
||
52 |
// generate interpreter |
|
53 |
{ ResourceMark rm; |
|
37161
e881f320966e
8150015: Integrate TraceTime with Unified Logging more seamlessly
rehn
parents:
36178
diff
changeset
|
54 |
TraceTime timer("Interpreter generation", TRACETIME_LOG(Info, startuptime)); |
1 | 55 |
int code_size = InterpreterCodeSize; |
56 |
NOT_PRODUCT(code_size *= 4;) // debug uses extra interpreter code space |
|
57 |
_code = new StubQueue(new InterpreterCodeletInterface, code_size, NULL, |
|
58 |
"Interpreter"); |
|
35214 | 59 |
TemplateInterpreterGenerator g(_code); |
47688 | 60 |
// Free the unused memory not occupied by the interpreter and the stubs |
61 |
_code->deallocate_unused_tail(); |
|
31620
53be635ad49c
8087333: Optionally Pre-Generate the HotSpot Template Interpreter
bdelsart
parents:
25950
diff
changeset
|
62 |
} |
53be635ad49c
8087333: Optionally Pre-Generate the HotSpot Template Interpreter
bdelsart
parents:
25950
diff
changeset
|
63 |
|
53be635ad49c
8087333: Optionally Pre-Generate the HotSpot Template Interpreter
bdelsart
parents:
25950
diff
changeset
|
64 |
if (PrintInterpreter) { |
53be635ad49c
8087333: Optionally Pre-Generate the HotSpot Template Interpreter
bdelsart
parents:
25950
diff
changeset
|
65 |
ResourceMark rm; |
53be635ad49c
8087333: Optionally Pre-Generate the HotSpot Template Interpreter
bdelsart
parents:
25950
diff
changeset
|
66 |
print(); |
1 | 67 |
} |
68 |
||
69 |
// initialize dispatch table |
|
70 |
_active_table = _normal_table; |
|
71 |
} |
|
72 |
||
73 |
//------------------------------------------------------------------------------------------------------------------------ |
|
74 |
// Implementation of EntryPoint |
|
75 |
||
76 |
EntryPoint::EntryPoint() { |
|
37480 | 77 |
assert(number_of_states == 10, "check the code below"); |
1 | 78 |
_entry[btos] = NULL; |
37480 | 79 |
_entry[ztos] = NULL; |
1 | 80 |
_entry[ctos] = NULL; |
81 |
_entry[stos] = NULL; |
|
82 |
_entry[atos] = NULL; |
|
83 |
_entry[itos] = NULL; |
|
84 |
_entry[ltos] = NULL; |
|
85 |
_entry[ftos] = NULL; |
|
86 |
_entry[dtos] = NULL; |
|
87 |
_entry[vtos] = NULL; |
|
88 |
} |
|
89 |
||
90 |
||
37480 | 91 |
EntryPoint::EntryPoint(address bentry, address zentry, address centry, address sentry, address aentry, address ientry, address lentry, address fentry, address dentry, address ventry) { |
92 |
assert(number_of_states == 10, "check the code below"); |
|
1 | 93 |
_entry[btos] = bentry; |
37480 | 94 |
_entry[ztos] = zentry; |
1 | 95 |
_entry[ctos] = centry; |
96 |
_entry[stos] = sentry; |
|
97 |
_entry[atos] = aentry; |
|
98 |
_entry[itos] = ientry; |
|
99 |
_entry[ltos] = lentry; |
|
100 |
_entry[ftos] = fentry; |
|
101 |
_entry[dtos] = dentry; |
|
102 |
_entry[vtos] = ventry; |
|
103 |
} |
|
104 |
||
105 |
||
106 |
void EntryPoint::set_entry(TosState state, address entry) { |
|
107 |
assert(0 <= state && state < number_of_states, "state out of bounds"); |
|
108 |
_entry[state] = entry; |
|
109 |
} |
|
110 |
||
111 |
||
112 |
address EntryPoint::entry(TosState state) const { |
|
113 |
assert(0 <= state && state < number_of_states, "state out of bounds"); |
|
114 |
return _entry[state]; |
|
115 |
} |
|
116 |
||
117 |
||
118 |
void EntryPoint::print() { |
|
119 |
tty->print("["); |
|
120 |
for (int i = 0; i < number_of_states; i++) { |
|
121 |
if (i > 0) tty->print(", "); |
|
24424
2658d7834c6e
8037816: Fix for 8036122 breaks build with Xcode5/clang
drchase
parents:
21198
diff
changeset
|
122 |
tty->print(INTPTR_FORMAT, p2i(_entry[i])); |
1 | 123 |
} |
124 |
tty->print("]"); |
|
125 |
} |
|
126 |
||
127 |
||
128 |
bool EntryPoint::operator == (const EntryPoint& y) { |
|
129 |
int i = number_of_states; |
|
130 |
while (i-- > 0) { |
|
131 |
if (_entry[i] != y._entry[i]) return false; |
|
132 |
} |
|
133 |
return true; |
|
134 |
} |
|
135 |
||
136 |
||
137 |
//------------------------------------------------------------------------------------------------------------------------ |
|
138 |
// Implementation of DispatchTable |
|
139 |
||
140 |
EntryPoint DispatchTable::entry(int i) const { |
|
141 |
assert(0 <= i && i < length, "index out of bounds"); |
|
142 |
return |
|
143 |
EntryPoint( |
|
144 |
_table[btos][i], |
|
37480 | 145 |
_table[ztos][i], |
1 | 146 |
_table[ctos][i], |
147 |
_table[stos][i], |
|
148 |
_table[atos][i], |
|
149 |
_table[itos][i], |
|
150 |
_table[ltos][i], |
|
151 |
_table[ftos][i], |
|
152 |
_table[dtos][i], |
|
153 |
_table[vtos][i] |
|
154 |
); |
|
155 |
} |
|
156 |
||
157 |
||
158 |
void DispatchTable::set_entry(int i, EntryPoint& entry) { |
|
159 |
assert(0 <= i && i < length, "index out of bounds"); |
|
37480 | 160 |
assert(number_of_states == 10, "check the code below"); |
1 | 161 |
_table[btos][i] = entry.entry(btos); |
37480 | 162 |
_table[ztos][i] = entry.entry(ztos); |
1 | 163 |
_table[ctos][i] = entry.entry(ctos); |
164 |
_table[stos][i] = entry.entry(stos); |
|
165 |
_table[atos][i] = entry.entry(atos); |
|
166 |
_table[itos][i] = entry.entry(itos); |
|
167 |
_table[ltos][i] = entry.entry(ltos); |
|
168 |
_table[ftos][i] = entry.entry(ftos); |
|
169 |
_table[dtos][i] = entry.entry(dtos); |
|
170 |
_table[vtos][i] = entry.entry(vtos); |
|
171 |
} |
|
172 |
||
173 |
||
174 |
bool DispatchTable::operator == (DispatchTable& y) { |
|
175 |
int i = length; |
|
176 |
while (i-- > 0) { |
|
177 |
EntryPoint t = y.entry(i); // for compiler compatibility (BugId 4150096) |
|
178 |
if (!(entry(i) == t)) return false; |
|
179 |
} |
|
180 |
return true; |
|
181 |
} |
|
182 |
||
183 |
address TemplateInterpreter::_remove_activation_entry = NULL; |
|
184 |
address TemplateInterpreter::_remove_activation_preserving_args_entry = NULL; |
|
185 |
||
186 |
||
187 |
address TemplateInterpreter::_throw_ArrayIndexOutOfBoundsException_entry = NULL; |
|
188 |
address TemplateInterpreter::_throw_ArrayStoreException_entry = NULL; |
|
189 |
address TemplateInterpreter::_throw_ArithmeticException_entry = NULL; |
|
190 |
address TemplateInterpreter::_throw_ClassCastException_entry = NULL; |
|
191 |
address TemplateInterpreter::_throw_NullPointerException_entry = NULL; |
|
192 |
address TemplateInterpreter::_throw_StackOverflowError_entry = NULL; |
|
193 |
address TemplateInterpreter::_throw_exception_entry = NULL; |
|
194 |
||
195 |
#ifndef PRODUCT |
|
196 |
EntryPoint TemplateInterpreter::_trace_code; |
|
197 |
#endif // !PRODUCT |
|
198 |
EntryPoint TemplateInterpreter::_return_entry[TemplateInterpreter::number_of_return_entries]; |
|
199 |
EntryPoint TemplateInterpreter::_earlyret_entry; |
|
200 |
EntryPoint TemplateInterpreter::_deopt_entry [TemplateInterpreter::number_of_deopt_entries ]; |
|
47916
bdbef8638948
8190817: deopt special-case for _return_register_finalizer is confusing and leads to bugs
dlong
parents:
47688
diff
changeset
|
201 |
address TemplateInterpreter::_deopt_reexecute_return_entry; |
1 | 202 |
EntryPoint TemplateInterpreter::_safept_entry; |
203 |
||
21198
dd647e8d1d72
8026328: Setting a breakpoint on invokedynamic crashes the JVM
twisti
parents:
18507
diff
changeset
|
204 |
address TemplateInterpreter::_invoke_return_entry[TemplateInterpreter::number_of_return_addrs]; |
dd647e8d1d72
8026328: Setting a breakpoint on invokedynamic crashes the JVM
twisti
parents:
18507
diff
changeset
|
205 |
address TemplateInterpreter::_invokeinterface_return_entry[TemplateInterpreter::number_of_return_addrs]; |
dd647e8d1d72
8026328: Setting a breakpoint on invokedynamic crashes the JVM
twisti
parents:
18507
diff
changeset
|
206 |
address TemplateInterpreter::_invokedynamic_return_entry[TemplateInterpreter::number_of_return_addrs]; |
1 | 207 |
|
208 |
DispatchTable TemplateInterpreter::_active_table; |
|
209 |
DispatchTable TemplateInterpreter::_normal_table; |
|
210 |
DispatchTable TemplateInterpreter::_safept_table; |
|
211 |
address TemplateInterpreter::_wentry_point[DispatchTable::length]; |
|
212 |
||
213 |
||
214 |
//------------------------------------------------------------------------------------------------------------------------ |
|
215 |
// Entry points |
|
216 |
||
21198
dd647e8d1d72
8026328: Setting a breakpoint on invokedynamic crashes the JVM
twisti
parents:
18507
diff
changeset
|
217 |
/** |
dd647e8d1d72
8026328: Setting a breakpoint on invokedynamic crashes the JVM
twisti
parents:
18507
diff
changeset
|
218 |
* Returns the return entry table for the given invoke bytecode. |
dd647e8d1d72
8026328: Setting a breakpoint on invokedynamic crashes the JVM
twisti
parents:
18507
diff
changeset
|
219 |
*/ |
dd647e8d1d72
8026328: Setting a breakpoint on invokedynamic crashes the JVM
twisti
parents:
18507
diff
changeset
|
220 |
address* TemplateInterpreter::invoke_return_entry_table_for(Bytecodes::Code code) { |
dd647e8d1d72
8026328: Setting a breakpoint on invokedynamic crashes the JVM
twisti
parents:
18507
diff
changeset
|
221 |
switch (code) { |
dd647e8d1d72
8026328: Setting a breakpoint on invokedynamic crashes the JVM
twisti
parents:
18507
diff
changeset
|
222 |
case Bytecodes::_invokestatic: |
dd647e8d1d72
8026328: Setting a breakpoint on invokedynamic crashes the JVM
twisti
parents:
18507
diff
changeset
|
223 |
case Bytecodes::_invokespecial: |
dd647e8d1d72
8026328: Setting a breakpoint on invokedynamic crashes the JVM
twisti
parents:
18507
diff
changeset
|
224 |
case Bytecodes::_invokevirtual: |
dd647e8d1d72
8026328: Setting a breakpoint on invokedynamic crashes the JVM
twisti
parents:
18507
diff
changeset
|
225 |
case Bytecodes::_invokehandle: |
dd647e8d1d72
8026328: Setting a breakpoint on invokedynamic crashes the JVM
twisti
parents:
18507
diff
changeset
|
226 |
return Interpreter::invoke_return_entry_table(); |
dd647e8d1d72
8026328: Setting a breakpoint on invokedynamic crashes the JVM
twisti
parents:
18507
diff
changeset
|
227 |
case Bytecodes::_invokeinterface: |
dd647e8d1d72
8026328: Setting a breakpoint on invokedynamic crashes the JVM
twisti
parents:
18507
diff
changeset
|
228 |
return Interpreter::invokeinterface_return_entry_table(); |
dd647e8d1d72
8026328: Setting a breakpoint on invokedynamic crashes the JVM
twisti
parents:
18507
diff
changeset
|
229 |
case Bytecodes::_invokedynamic: |
dd647e8d1d72
8026328: Setting a breakpoint on invokedynamic crashes the JVM
twisti
parents:
18507
diff
changeset
|
230 |
return Interpreter::invokedynamic_return_entry_table(); |
dd647e8d1d72
8026328: Setting a breakpoint on invokedynamic crashes the JVM
twisti
parents:
18507
diff
changeset
|
231 |
default: |
33105
294e48b4f704
8080775: Better argument formatting for assert() and friends
david
parents:
32391
diff
changeset
|
232 |
fatal("invalid bytecode: %s", Bytecodes::name(code)); |
21198
dd647e8d1d72
8026328: Setting a breakpoint on invokedynamic crashes the JVM
twisti
parents:
18507
diff
changeset
|
233 |
return NULL; |
dd647e8d1d72
8026328: Setting a breakpoint on invokedynamic crashes the JVM
twisti
parents:
18507
diff
changeset
|
234 |
} |
dd647e8d1d72
8026328: Setting a breakpoint on invokedynamic crashes the JVM
twisti
parents:
18507
diff
changeset
|
235 |
} |
dd647e8d1d72
8026328: Setting a breakpoint on invokedynamic crashes the JVM
twisti
parents:
18507
diff
changeset
|
236 |
|
dd647e8d1d72
8026328: Setting a breakpoint on invokedynamic crashes the JVM
twisti
parents:
18507
diff
changeset
|
237 |
/** |
dd647e8d1d72
8026328: Setting a breakpoint on invokedynamic crashes the JVM
twisti
parents:
18507
diff
changeset
|
238 |
* Returns the return entry address for the given top-of-stack state and bytecode. |
dd647e8d1d72
8026328: Setting a breakpoint on invokedynamic crashes the JVM
twisti
parents:
18507
diff
changeset
|
239 |
*/ |
dd647e8d1d72
8026328: Setting a breakpoint on invokedynamic crashes the JVM
twisti
parents:
18507
diff
changeset
|
240 |
address TemplateInterpreter::return_entry(TosState state, int length, Bytecodes::Code code) { |
1 | 241 |
guarantee(0 <= length && length < Interpreter::number_of_return_entries, "illegal length"); |
21198
dd647e8d1d72
8026328: Setting a breakpoint on invokedynamic crashes the JVM
twisti
parents:
18507
diff
changeset
|
242 |
const int index = TosState_as_index(state); |
dd647e8d1d72
8026328: Setting a breakpoint on invokedynamic crashes the JVM
twisti
parents:
18507
diff
changeset
|
243 |
switch (code) { |
dd647e8d1d72
8026328: Setting a breakpoint on invokedynamic crashes the JVM
twisti
parents:
18507
diff
changeset
|
244 |
case Bytecodes::_invokestatic: |
dd647e8d1d72
8026328: Setting a breakpoint on invokedynamic crashes the JVM
twisti
parents:
18507
diff
changeset
|
245 |
case Bytecodes::_invokespecial: |
dd647e8d1d72
8026328: Setting a breakpoint on invokedynamic crashes the JVM
twisti
parents:
18507
diff
changeset
|
246 |
case Bytecodes::_invokevirtual: |
dd647e8d1d72
8026328: Setting a breakpoint on invokedynamic crashes the JVM
twisti
parents:
18507
diff
changeset
|
247 |
case Bytecodes::_invokehandle: |
dd647e8d1d72
8026328: Setting a breakpoint on invokedynamic crashes the JVM
twisti
parents:
18507
diff
changeset
|
248 |
return _invoke_return_entry[index]; |
dd647e8d1d72
8026328: Setting a breakpoint on invokedynamic crashes the JVM
twisti
parents:
18507
diff
changeset
|
249 |
case Bytecodes::_invokeinterface: |
dd647e8d1d72
8026328: Setting a breakpoint on invokedynamic crashes the JVM
twisti
parents:
18507
diff
changeset
|
250 |
return _invokeinterface_return_entry[index]; |
dd647e8d1d72
8026328: Setting a breakpoint on invokedynamic crashes the JVM
twisti
parents:
18507
diff
changeset
|
251 |
case Bytecodes::_invokedynamic: |
dd647e8d1d72
8026328: Setting a breakpoint on invokedynamic crashes the JVM
twisti
parents:
18507
diff
changeset
|
252 |
return _invokedynamic_return_entry[index]; |
dd647e8d1d72
8026328: Setting a breakpoint on invokedynamic crashes the JVM
twisti
parents:
18507
diff
changeset
|
253 |
default: |
33105
294e48b4f704
8080775: Better argument formatting for assert() and friends
david
parents:
32391
diff
changeset
|
254 |
assert(!Bytecodes::is_invoke(code), "invoke instructions should be handled separately: %s", Bytecodes::name(code)); |
47916
bdbef8638948
8190817: deopt special-case for _return_register_finalizer is confusing and leads to bugs
dlong
parents:
47688
diff
changeset
|
255 |
address entry = _return_entry[length].entry(state); |
bdbef8638948
8190817: deopt special-case for _return_register_finalizer is confusing and leads to bugs
dlong
parents:
47688
diff
changeset
|
256 |
vmassert(entry != NULL, "unsupported return entry requested, length=%d state=%d", length, index); |
bdbef8638948
8190817: deopt special-case for _return_register_finalizer is confusing and leads to bugs
dlong
parents:
47688
diff
changeset
|
257 |
return entry; |
21198
dd647e8d1d72
8026328: Setting a breakpoint on invokedynamic crashes the JVM
twisti
parents:
18507
diff
changeset
|
258 |
} |
1 | 259 |
} |
260 |
||
261 |
||
262 |
address TemplateInterpreter::deopt_entry(TosState state, int length) { |
|
263 |
guarantee(0 <= length && length < Interpreter::number_of_deopt_entries, "illegal length"); |
|
47916
bdbef8638948
8190817: deopt special-case for _return_register_finalizer is confusing and leads to bugs
dlong
parents:
47688
diff
changeset
|
264 |
address entry = _deopt_entry[length].entry(state); |
bdbef8638948
8190817: deopt special-case for _return_register_finalizer is confusing and leads to bugs
dlong
parents:
47688
diff
changeset
|
265 |
vmassert(entry != NULL, "unsupported deopt entry requested, length=%d state=%d", length, TosState_as_index(state)); |
bdbef8638948
8190817: deopt special-case for _return_register_finalizer is confusing and leads to bugs
dlong
parents:
47688
diff
changeset
|
266 |
return entry; |
1 | 267 |
} |
268 |
||
269 |
//------------------------------------------------------------------------------------------------------------------------ |
|
270 |
// Suport for invokes |
|
271 |
||
272 |
int TemplateInterpreter::TosState_as_index(TosState state) { |
|
273 |
assert( state < number_of_states , "Invalid state in TosState_as_index"); |
|
274 |
assert(0 <= (int)state && (int)state < TemplateInterpreter::number_of_return_addrs, "index out of bounds"); |
|
275 |
return (int)state; |
|
276 |
} |
|
277 |
||
278 |
||
279 |
//------------------------------------------------------------------------------------------------------------------------ |
|
55637
422fb430bc7b
8227338: templateInterpreter.cpp: copy_table() needs to be safer
dcubed
parents:
55608
diff
changeset
|
280 |
// Safepoint support |
1 | 281 |
|
282 |
static inline void copy_table(address* from, address* to, int size) { |
|
55637
422fb430bc7b
8227338: templateInterpreter.cpp: copy_table() needs to be safer
dcubed
parents:
55608
diff
changeset
|
283 |
// Copy non-overlapping tables. |
422fb430bc7b
8227338: templateInterpreter.cpp: copy_table() needs to be safer
dcubed
parents:
55608
diff
changeset
|
284 |
if (SafepointSynchronize::is_at_safepoint()) { |
422fb430bc7b
8227338: templateInterpreter.cpp: copy_table() needs to be safer
dcubed
parents:
55608
diff
changeset
|
285 |
// Nothing is using the table at a safepoint so skip atomic word copy. |
422fb430bc7b
8227338: templateInterpreter.cpp: copy_table() needs to be safer
dcubed
parents:
55608
diff
changeset
|
286 |
Copy::disjoint_words((HeapWord*)from, (HeapWord*)to, (size_t)size); |
422fb430bc7b
8227338: templateInterpreter.cpp: copy_table() needs to be safer
dcubed
parents:
55608
diff
changeset
|
287 |
} else { |
422fb430bc7b
8227338: templateInterpreter.cpp: copy_table() needs to be safer
dcubed
parents:
55608
diff
changeset
|
288 |
// Use atomic word copy when not at a safepoint for safety. |
422fb430bc7b
8227338: templateInterpreter.cpp: copy_table() needs to be safer
dcubed
parents:
55608
diff
changeset
|
289 |
Copy::disjoint_words_atomic((HeapWord*)from, (HeapWord*)to, (size_t)size); |
422fb430bc7b
8227338: templateInterpreter.cpp: copy_table() needs to be safer
dcubed
parents:
55608
diff
changeset
|
290 |
} |
1 | 291 |
} |
292 |
||
293 |
void TemplateInterpreter::notice_safepoints() { |
|
294 |
if (!_notice_safepoints) { |
|
55608
47af68c44e02
8227117: normal interpreter table is not restored after single stepping with TLH
dcubed
parents:
47916
diff
changeset
|
295 |
log_debug(interpreter, safepoint)("switching active_table to safept_table."); |
1 | 296 |
// switch to safepoint dispatch table |
297 |
_notice_safepoints = true; |
|
298 |
copy_table((address*)&_safept_table, (address*)&_active_table, sizeof(_active_table) / sizeof(address)); |
|
55608
47af68c44e02
8227117: normal interpreter table is not restored after single stepping with TLH
dcubed
parents:
47916
diff
changeset
|
299 |
} else { |
47af68c44e02
8227117: normal interpreter table is not restored after single stepping with TLH
dcubed
parents:
47916
diff
changeset
|
300 |
log_debug(interpreter, safepoint)("active_table is already safept_table; " |
47af68c44e02
8227117: normal interpreter table is not restored after single stepping with TLH
dcubed
parents:
47916
diff
changeset
|
301 |
"notice_safepoints() call is no-op."); |
1 | 302 |
} |
303 |
} |
|
304 |
||
305 |
// switch from the dispatch table which notices safepoints back to the |
|
306 |
// normal dispatch table. So that we can notice single stepping points, |
|
307 |
// keep the safepoint dispatch table if we are single stepping in JVMTI. |
|
308 |
// Note that the should_post_single_step test is exactly as fast as the |
|
309 |
// JvmtiExport::_enabled test and covers both cases. |
|
310 |
void TemplateInterpreter::ignore_safepoints() { |
|
311 |
if (_notice_safepoints) { |
|
312 |
if (!JvmtiExport::should_post_single_step()) { |
|
55608
47af68c44e02
8227117: normal interpreter table is not restored after single stepping with TLH
dcubed
parents:
47916
diff
changeset
|
313 |
log_debug(interpreter, safepoint)("switching active_table to normal_table."); |
1 | 314 |
// switch to normal dispatch table |
315 |
_notice_safepoints = false; |
|
316 |
copy_table((address*)&_normal_table, (address*)&_active_table, sizeof(_active_table) / sizeof(address)); |
|
55608
47af68c44e02
8227117: normal interpreter table is not restored after single stepping with TLH
dcubed
parents:
47916
diff
changeset
|
317 |
} else { |
47af68c44e02
8227117: normal interpreter table is not restored after single stepping with TLH
dcubed
parents:
47916
diff
changeset
|
318 |
log_debug(interpreter, safepoint)("single stepping is still active; " |
47af68c44e02
8227117: normal interpreter table is not restored after single stepping with TLH
dcubed
parents:
47916
diff
changeset
|
319 |
"ignoring ignore_safepoints() call."); |
1 | 320 |
} |
55608
47af68c44e02
8227117: normal interpreter table is not restored after single stepping with TLH
dcubed
parents:
47916
diff
changeset
|
321 |
} else { |
47af68c44e02
8227117: normal interpreter table is not restored after single stepping with TLH
dcubed
parents:
47916
diff
changeset
|
322 |
log_debug(interpreter, safepoint)("active_table is already normal_table; " |
47af68c44e02
8227117: normal interpreter table is not restored after single stepping with TLH
dcubed
parents:
47916
diff
changeset
|
323 |
"ignore_safepoints() call is no-op."); |
1 | 324 |
} |
325 |
} |
|
326 |
||
3600
27aa4477d039
6833129: specjvm98 fails with NullPointerException in the compiler with -XX:DeoptimizeALot
cfang
parents:
2570
diff
changeset
|
327 |
//------------------------------------------------------------------------------------------------------------------------ |
27aa4477d039
6833129: specjvm98 fails with NullPointerException in the compiler with -XX:DeoptimizeALot
cfang
parents:
2570
diff
changeset
|
328 |
// Deoptimization support |
1 | 329 |
|
3600
27aa4477d039
6833129: specjvm98 fails with NullPointerException in the compiler with -XX:DeoptimizeALot
cfang
parents:
2570
diff
changeset
|
330 |
// If deoptimization happens, this function returns the point of next bytecode to continue execution |
13728
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
13391
diff
changeset
|
331 |
address TemplateInterpreter::deopt_continue_after_entry(Method* method, address bcp, int callee_parameters, bool is_top_frame) { |
3600
27aa4477d039
6833129: specjvm98 fails with NullPointerException in the compiler with -XX:DeoptimizeALot
cfang
parents:
2570
diff
changeset
|
332 |
return AbstractInterpreter::deopt_continue_after_entry(method, bcp, callee_parameters, is_top_frame); |
27aa4477d039
6833129: specjvm98 fails with NullPointerException in the compiler with -XX:DeoptimizeALot
cfang
parents:
2570
diff
changeset
|
333 |
} |
1 | 334 |
|
3600
27aa4477d039
6833129: specjvm98 fails with NullPointerException in the compiler with -XX:DeoptimizeALot
cfang
parents:
2570
diff
changeset
|
335 |
// If deoptimization happens, this function returns the point where the interpreter reexecutes |
27aa4477d039
6833129: specjvm98 fails with NullPointerException in the compiler with -XX:DeoptimizeALot
cfang
parents:
2570
diff
changeset
|
336 |
// the bytecode. |
27aa4477d039
6833129: specjvm98 fails with NullPointerException in the compiler with -XX:DeoptimizeALot
cfang
parents:
2570
diff
changeset
|
337 |
// Note: Bytecodes::_athrow (C1 only) and Bytecodes::_return are the special cases |
27aa4477d039
6833129: specjvm98 fails with NullPointerException in the compiler with -XX:DeoptimizeALot
cfang
parents:
2570
diff
changeset
|
338 |
// that do not return "Interpreter::deopt_entry(vtos, 0)" |
13728
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
13391
diff
changeset
|
339 |
address TemplateInterpreter::deopt_reexecute_entry(Method* method, address bcp) { |
1 | 340 |
assert(method->contains(bcp), "just checkin'"); |
47916
bdbef8638948
8190817: deopt special-case for _return_register_finalizer is confusing and leads to bugs
dlong
parents:
47688
diff
changeset
|
341 |
Bytecodes::Code code = Bytecodes::code_at(method, bcp); |
bdbef8638948
8190817: deopt special-case for _return_register_finalizer is confusing and leads to bugs
dlong
parents:
47688
diff
changeset
|
342 |
if (code == Bytecodes::_return_register_finalizer) { |
3600
27aa4477d039
6833129: specjvm98 fails with NullPointerException in the compiler with -XX:DeoptimizeALot
cfang
parents:
2570
diff
changeset
|
343 |
// This is used for deopt during registration of finalizers |
27aa4477d039
6833129: specjvm98 fails with NullPointerException in the compiler with -XX:DeoptimizeALot
cfang
parents:
2570
diff
changeset
|
344 |
// during Object.<init>. We simply need to resume execution at |
27aa4477d039
6833129: specjvm98 fails with NullPointerException in the compiler with -XX:DeoptimizeALot
cfang
parents:
2570
diff
changeset
|
345 |
// the standard return vtos bytecode to pop the frame normally. |
27aa4477d039
6833129: specjvm98 fails with NullPointerException in the compiler with -XX:DeoptimizeALot
cfang
parents:
2570
diff
changeset
|
346 |
// reexecuting the real bytecode would cause double registration |
27aa4477d039
6833129: specjvm98 fails with NullPointerException in the compiler with -XX:DeoptimizeALot
cfang
parents:
2570
diff
changeset
|
347 |
// of the finalizable object. |
47916
bdbef8638948
8190817: deopt special-case for _return_register_finalizer is confusing and leads to bugs
dlong
parents:
47688
diff
changeset
|
348 |
return Interpreter::deopt_reexecute_return_entry(); |
1 | 349 |
} else { |
3600
27aa4477d039
6833129: specjvm98 fails with NullPointerException in the compiler with -XX:DeoptimizeALot
cfang
parents:
2570
diff
changeset
|
350 |
return AbstractInterpreter::deopt_reexecute_entry(method, bcp); |
27aa4477d039
6833129: specjvm98 fails with NullPointerException in the compiler with -XX:DeoptimizeALot
cfang
parents:
2570
diff
changeset
|
351 |
} |
27aa4477d039
6833129: specjvm98 fails with NullPointerException in the compiler with -XX:DeoptimizeALot
cfang
parents:
2570
diff
changeset
|
352 |
} |
27aa4477d039
6833129: specjvm98 fails with NullPointerException in the compiler with -XX:DeoptimizeALot
cfang
parents:
2570
diff
changeset
|
353 |
|
27aa4477d039
6833129: specjvm98 fails with NullPointerException in the compiler with -XX:DeoptimizeALot
cfang
parents:
2570
diff
changeset
|
354 |
// If deoptimization happens, the interpreter should reexecute this bytecode. |
27aa4477d039
6833129: specjvm98 fails with NullPointerException in the compiler with -XX:DeoptimizeALot
cfang
parents:
2570
diff
changeset
|
355 |
// This function mainly helps the compilers to set up the reexecute bit. |
27aa4477d039
6833129: specjvm98 fails with NullPointerException in the compiler with -XX:DeoptimizeALot
cfang
parents:
2570
diff
changeset
|
356 |
bool TemplateInterpreter::bytecode_should_reexecute(Bytecodes::Code code) { |
27aa4477d039
6833129: specjvm98 fails with NullPointerException in the compiler with -XX:DeoptimizeALot
cfang
parents:
2570
diff
changeset
|
357 |
if (code == Bytecodes::_return) { |
27aa4477d039
6833129: specjvm98 fails with NullPointerException in the compiler with -XX:DeoptimizeALot
cfang
parents:
2570
diff
changeset
|
358 |
//Yes, we consider Bytecodes::_return as a special case of reexecution |
27aa4477d039
6833129: specjvm98 fails with NullPointerException in the compiler with -XX:DeoptimizeALot
cfang
parents:
2570
diff
changeset
|
359 |
return true; |
27aa4477d039
6833129: specjvm98 fails with NullPointerException in the compiler with -XX:DeoptimizeALot
cfang
parents:
2570
diff
changeset
|
360 |
} else { |
27aa4477d039
6833129: specjvm98 fails with NullPointerException in the compiler with -XX:DeoptimizeALot
cfang
parents:
2570
diff
changeset
|
361 |
return AbstractInterpreter::bytecode_should_reexecute(code); |
1 | 362 |
} |
363 |
} |
|
364 |
||
35214 | 365 |
InterpreterCodelet* TemplateInterpreter::codelet_containing(address pc) { |
366 |
return (InterpreterCodelet*)_code->stub_containing(pc); |
|
367 |
} |
|
368 |
||
1 | 369 |
#endif // !CC_INTERP |