author | psandoz |
Thu, 05 May 2016 10:03:26 -0700 | |
changeset 38238 | 1bbcc430c78d |
parent 38237 | d972e3a2df53 |
child 39421 | a9652c919db8 |
permissions | -rw-r--r-- |
1 | 1 |
/* |
35477
7a00b08d27bc
8144953: runtime/CommandLine/TraceExceptionsTest.java fails when exception is thrown in compiled code
rprotacio
parents:
35216
diff
changeset
|
2 |
* Copyright (c) 1999, 2016, 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:
4888
diff
changeset
|
19 |
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA |
f4b087cbb361
6941466: Oracle rebranding changes for Hotspot repositories
trims
parents:
4888
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:
4888
diff
changeset
|
21 |
* questions. |
1 | 22 |
* |
23 |
*/ |
|
24 |
||
7397 | 25 |
#include "precompiled.hpp" |
26 |
#include "asm/codeBuffer.hpp" |
|
27 |
#include "c1/c1_CodeStubs.hpp" |
|
28 |
#include "c1/c1_Defs.hpp" |
|
29 |
#include "c1/c1_FrameMap.hpp" |
|
30 |
#include "c1/c1_LIRAssembler.hpp" |
|
31 |
#include "c1/c1_MacroAssembler.hpp" |
|
32 |
#include "c1/c1_Runtime1.hpp" |
|
33 |
#include "classfile/systemDictionary.hpp" |
|
34 |
#include "classfile/vmSymbols.hpp" |
|
35 |
#include "code/codeBlob.hpp" |
|
31620
53be635ad49c
8087333: Optionally Pre-Generate the HotSpot Template Interpreter
bdelsart
parents:
30764
diff
changeset
|
36 |
#include "code/codeCacheExtensions.hpp" |
7397 | 37 |
#include "code/compiledIC.hpp" |
38 |
#include "code/pcDesc.hpp" |
|
39 |
#include "code/scopeDesc.hpp" |
|
40 |
#include "code/vtableStubs.hpp" |
|
41 |
#include "compiler/disassembler.hpp" |
|
30764 | 42 |
#include "gc/shared/barrierSet.hpp" |
43 |
#include "gc/shared/collectedHeap.hpp" |
|
7397 | 44 |
#include "interpreter/bytecode.hpp" |
45 |
#include "interpreter/interpreter.hpp" |
|
35216
71c463a17b3b
8141211: Convert TraceExceptions to Unified Logging
rprotacio
parents:
35071
diff
changeset
|
46 |
#include "logging/log.hpp" |
7397 | 47 |
#include "memory/allocation.inline.hpp" |
48 |
#include "memory/oopFactory.hpp" |
|
49 |
#include "memory/resourceArea.hpp" |
|
50 |
#include "oops/objArrayKlass.hpp" |
|
51 |
#include "oops/oop.inline.hpp" |
|
25351
7c198a690050
8044775: Improve usage of umbrella header atomic.inline.hpp.
goetz
parents:
24944
diff
changeset
|
52 |
#include "runtime/atomic.inline.hpp" |
7397 | 53 |
#include "runtime/biasedLocking.hpp" |
54 |
#include "runtime/compilationPolicy.hpp" |
|
55 |
#include "runtime/interfaceSupport.hpp" |
|
56 |
#include "runtime/javaCalls.hpp" |
|
57 |
#include "runtime/sharedRuntime.hpp" |
|
58 |
#include "runtime/threadCritical.hpp" |
|
59 |
#include "runtime/vframe.hpp" |
|
60 |
#include "runtime/vframeArray.hpp" |
|
25715
d5a8dbdc5150
8049325: Introduce and clean up umbrella headers for the files in the cpu subdirectories.
goetz
parents:
25351
diff
changeset
|
61 |
#include "runtime/vm_version.hpp" |
7397 | 62 |
#include "utilities/copy.hpp" |
63 |
#include "utilities/events.hpp" |
|
1 | 64 |
|
65 |
||
66 |
// Implementation of StubAssembler |
|
67 |
||
68 |
StubAssembler::StubAssembler(CodeBuffer* code, const char * name, int stub_id) : C1_MacroAssembler(code) { |
|
69 |
_name = name; |
|
70 |
_must_gc_arguments = false; |
|
71 |
_frame_size = no_frame_size; |
|
72 |
_num_rt_args = 0; |
|
73 |
_stub_id = stub_id; |
|
74 |
} |
|
75 |
||
76 |
||
77 |
void StubAssembler::set_info(const char* name, bool must_gc_arguments) { |
|
78 |
_name = name; |
|
79 |
_must_gc_arguments = must_gc_arguments; |
|
80 |
} |
|
81 |
||
82 |
||
83 |
void StubAssembler::set_frame_size(int size) { |
|
84 |
if (_frame_size == no_frame_size) { |
|
85 |
_frame_size = size; |
|
86 |
} |
|
87 |
assert(_frame_size == size, "can't change the frame size"); |
|
88 |
} |
|
89 |
||
90 |
||
91 |
void StubAssembler::set_num_rt_args(int args) { |
|
92 |
if (_num_rt_args == 0) { |
|
93 |
_num_rt_args = args; |
|
94 |
} |
|
95 |
assert(_num_rt_args == args, "can't change the number of args"); |
|
96 |
} |
|
97 |
||
98 |
// Implementation of Runtime1 |
|
99 |
||
100 |
CodeBlob* Runtime1::_blobs[Runtime1::number_of_ids]; |
|
101 |
const char *Runtime1::_blob_names[] = { |
|
102 |
RUNTIME1_STUBS(STUB_NAME, LAST_STUB_NAME) |
|
103 |
}; |
|
104 |
||
105 |
#ifndef PRODUCT |
|
106 |
// statistics |
|
107 |
int Runtime1::_generic_arraycopy_cnt = 0; |
|
108 |
int Runtime1::_primitive_arraycopy_cnt = 0; |
|
109 |
int Runtime1::_oop_arraycopy_cnt = 0; |
|
9102 | 110 |
int Runtime1::_generic_arraycopystub_cnt = 0; |
1 | 111 |
int Runtime1::_arraycopy_slowcase_cnt = 0; |
9102 | 112 |
int Runtime1::_arraycopy_checkcast_cnt = 0; |
113 |
int Runtime1::_arraycopy_checkcast_attempt_cnt = 0; |
|
1 | 114 |
int Runtime1::_new_type_array_slowcase_cnt = 0; |
115 |
int Runtime1::_new_object_array_slowcase_cnt = 0; |
|
116 |
int Runtime1::_new_instance_slowcase_cnt = 0; |
|
117 |
int Runtime1::_new_multi_array_slowcase_cnt = 0; |
|
118 |
int Runtime1::_monitorenter_slowcase_cnt = 0; |
|
119 |
int Runtime1::_monitorexit_slowcase_cnt = 0; |
|
120 |
int Runtime1::_patch_code_slowcase_cnt = 0; |
|
121 |
int Runtime1::_throw_range_check_exception_count = 0; |
|
122 |
int Runtime1::_throw_index_exception_count = 0; |
|
123 |
int Runtime1::_throw_div0_exception_count = 0; |
|
124 |
int Runtime1::_throw_null_pointer_exception_count = 0; |
|
125 |
int Runtime1::_throw_class_cast_exception_count = 0; |
|
126 |
int Runtime1::_throw_incompatible_class_change_error_count = 0; |
|
127 |
int Runtime1::_throw_array_store_exception_count = 0; |
|
128 |
int Runtime1::_throw_count = 0; |
|
9102 | 129 |
|
24944
5b01505efb7a
8033145: Runtime1::arraycopy_count_address uses wrong _oop_arraycopy_cnt variable
thartmann
parents:
24442
diff
changeset
|
130 |
static int _byte_arraycopy_stub_cnt = 0; |
5b01505efb7a
8033145: Runtime1::arraycopy_count_address uses wrong _oop_arraycopy_cnt variable
thartmann
parents:
24442
diff
changeset
|
131 |
static int _short_arraycopy_stub_cnt = 0; |
5b01505efb7a
8033145: Runtime1::arraycopy_count_address uses wrong _oop_arraycopy_cnt variable
thartmann
parents:
24442
diff
changeset
|
132 |
static int _int_arraycopy_stub_cnt = 0; |
5b01505efb7a
8033145: Runtime1::arraycopy_count_address uses wrong _oop_arraycopy_cnt variable
thartmann
parents:
24442
diff
changeset
|
133 |
static int _long_arraycopy_stub_cnt = 0; |
5b01505efb7a
8033145: Runtime1::arraycopy_count_address uses wrong _oop_arraycopy_cnt variable
thartmann
parents:
24442
diff
changeset
|
134 |
static int _oop_arraycopy_stub_cnt = 0; |
9102 | 135 |
|
136 |
address Runtime1::arraycopy_count_address(BasicType type) { |
|
137 |
switch (type) { |
|
138 |
case T_BOOLEAN: |
|
24944
5b01505efb7a
8033145: Runtime1::arraycopy_count_address uses wrong _oop_arraycopy_cnt variable
thartmann
parents:
24442
diff
changeset
|
139 |
case T_BYTE: return (address)&_byte_arraycopy_stub_cnt; |
9102 | 140 |
case T_CHAR: |
24944
5b01505efb7a
8033145: Runtime1::arraycopy_count_address uses wrong _oop_arraycopy_cnt variable
thartmann
parents:
24442
diff
changeset
|
141 |
case T_SHORT: return (address)&_short_arraycopy_stub_cnt; |
9102 | 142 |
case T_FLOAT: |
24944
5b01505efb7a
8033145: Runtime1::arraycopy_count_address uses wrong _oop_arraycopy_cnt variable
thartmann
parents:
24442
diff
changeset
|
143 |
case T_INT: return (address)&_int_arraycopy_stub_cnt; |
9102 | 144 |
case T_DOUBLE: |
24944
5b01505efb7a
8033145: Runtime1::arraycopy_count_address uses wrong _oop_arraycopy_cnt variable
thartmann
parents:
24442
diff
changeset
|
145 |
case T_LONG: return (address)&_long_arraycopy_stub_cnt; |
9102 | 146 |
case T_ARRAY: |
24944
5b01505efb7a
8033145: Runtime1::arraycopy_count_address uses wrong _oop_arraycopy_cnt variable
thartmann
parents:
24442
diff
changeset
|
147 |
case T_OBJECT: return (address)&_oop_arraycopy_stub_cnt; |
9102 | 148 |
default: |
149 |
ShouldNotReachHere(); |
|
150 |
return NULL; |
|
151 |
} |
|
152 |
} |
|
153 |
||
154 |
||
1 | 155 |
#endif |
156 |
||
157 |
// Simple helper to see if the caller of a runtime stub which |
|
158 |
// entered the VM has been deoptimized |
|
159 |
||
160 |
static bool caller_is_deopted() { |
|
161 |
JavaThread* thread = JavaThread::current(); |
|
162 |
RegisterMap reg_map(thread, false); |
|
163 |
frame runtime_frame = thread->last_frame(); |
|
164 |
frame caller_frame = runtime_frame.sender(®_map); |
|
165 |
assert(caller_frame.is_compiled_frame(), "must be compiled"); |
|
166 |
return caller_frame.is_deoptimized_frame(); |
|
167 |
} |
|
168 |
||
169 |
// Stress deoptimization |
|
170 |
static void deopt_caller() { |
|
171 |
if ( !caller_is_deopted()) { |
|
172 |
JavaThread* thread = JavaThread::current(); |
|
173 |
RegisterMap reg_map(thread, false); |
|
174 |
frame runtime_frame = thread->last_frame(); |
|
175 |
frame caller_frame = runtime_frame.sender(®_map); |
|
4761
bdb7375a1fee
6902182: 4/4 Starting with jdwp agent should not incur performance penalty
dcubed
parents:
4571
diff
changeset
|
176 |
Deoptimization::deoptimize_frame(thread, caller_frame.id()); |
1 | 177 |
assert(caller_is_deopted(), "Must be deoptimized"); |
178 |
} |
|
179 |
} |
|
180 |
||
181 |
||
5707 | 182 |
void Runtime1::generate_blob_for(BufferBlob* buffer_blob, StubID id) { |
1 | 183 |
assert(0 <= id && id < number_of_ids, "illegal stub id"); |
184 |
ResourceMark rm; |
|
185 |
// create code buffer for code storage |
|
6418 | 186 |
CodeBuffer code(buffer_blob); |
1 | 187 |
|
31620
53be635ad49c
8087333: Optionally Pre-Generate the HotSpot Template Interpreter
bdelsart
parents:
30764
diff
changeset
|
188 |
OopMapSet* oop_maps; |
53be635ad49c
8087333: Optionally Pre-Generate the HotSpot Template Interpreter
bdelsart
parents:
30764
diff
changeset
|
189 |
int frame_size; |
53be635ad49c
8087333: Optionally Pre-Generate the HotSpot Template Interpreter
bdelsart
parents:
30764
diff
changeset
|
190 |
bool must_gc_arguments; |
1 | 191 |
|
31620
53be635ad49c
8087333: Optionally Pre-Generate the HotSpot Template Interpreter
bdelsart
parents:
30764
diff
changeset
|
192 |
if (!CodeCacheExtensions::skip_compiler_support()) { |
53be635ad49c
8087333: Optionally Pre-Generate the HotSpot Template Interpreter
bdelsart
parents:
30764
diff
changeset
|
193 |
// bypass useless code generation |
53be635ad49c
8087333: Optionally Pre-Generate the HotSpot Template Interpreter
bdelsart
parents:
30764
diff
changeset
|
194 |
Compilation::setup_code_buffer(&code, 0); |
53be635ad49c
8087333: Optionally Pre-Generate the HotSpot Template Interpreter
bdelsart
parents:
30764
diff
changeset
|
195 |
|
53be635ad49c
8087333: Optionally Pre-Generate the HotSpot Template Interpreter
bdelsart
parents:
30764
diff
changeset
|
196 |
// create assembler for code generation |
53be635ad49c
8087333: Optionally Pre-Generate the HotSpot Template Interpreter
bdelsart
parents:
30764
diff
changeset
|
197 |
StubAssembler* sasm = new StubAssembler(&code, name_for(id), id); |
53be635ad49c
8087333: Optionally Pre-Generate the HotSpot Template Interpreter
bdelsart
parents:
30764
diff
changeset
|
198 |
// generate code for runtime stub |
53be635ad49c
8087333: Optionally Pre-Generate the HotSpot Template Interpreter
bdelsart
parents:
30764
diff
changeset
|
199 |
oop_maps = generate_code_for(id, sasm); |
53be635ad49c
8087333: Optionally Pre-Generate the HotSpot Template Interpreter
bdelsart
parents:
30764
diff
changeset
|
200 |
assert(oop_maps == NULL || sasm->frame_size() != no_frame_size, |
53be635ad49c
8087333: Optionally Pre-Generate the HotSpot Template Interpreter
bdelsart
parents:
30764
diff
changeset
|
201 |
"if stub has an oop map it must have a valid frame size"); |
1 | 202 |
|
203 |
#ifdef ASSERT |
|
31620
53be635ad49c
8087333: Optionally Pre-Generate the HotSpot Template Interpreter
bdelsart
parents:
30764
diff
changeset
|
204 |
// Make sure that stubs that need oopmaps have them |
53be635ad49c
8087333: Optionally Pre-Generate the HotSpot Template Interpreter
bdelsart
parents:
30764
diff
changeset
|
205 |
switch (id) { |
53be635ad49c
8087333: Optionally Pre-Generate the HotSpot Template Interpreter
bdelsart
parents:
30764
diff
changeset
|
206 |
// These stubs don't need to have an oopmap |
1 | 207 |
case dtrace_object_alloc_id: |
1374
4c24294029a9
6711316: Open source the Garbage-First garbage collector
ysr
parents:
360
diff
changeset
|
208 |
case g1_pre_barrier_slow_id: |
4c24294029a9
6711316: Open source the Garbage-First garbage collector
ysr
parents:
360
diff
changeset
|
209 |
case g1_post_barrier_slow_id: |
1 | 210 |
case slow_subtype_check_id: |
211 |
case fpu2long_stub_id: |
|
212 |
case unwind_exception_id: |
|
6453 | 213 |
case counter_overflow_id: |
34220 | 214 |
#if defined(SPARC) || defined(PPC32) |
1 | 215 |
case handle_exception_nofpu_id: // Unused on sparc |
216 |
#endif |
|
217 |
break; |
|
218 |
||
31620
53be635ad49c
8087333: Optionally Pre-Generate the HotSpot Template Interpreter
bdelsart
parents:
30764
diff
changeset
|
219 |
// All other stubs should have oopmaps |
1 | 220 |
default: |
221 |
assert(oop_maps != NULL, "must have an oopmap"); |
|
31620
53be635ad49c
8087333: Optionally Pre-Generate the HotSpot Template Interpreter
bdelsart
parents:
30764
diff
changeset
|
222 |
} |
1 | 223 |
#endif |
224 |
||
31620
53be635ad49c
8087333: Optionally Pre-Generate the HotSpot Template Interpreter
bdelsart
parents:
30764
diff
changeset
|
225 |
// align so printing shows nop's instead of random code at the end (SimpleStubs are aligned) |
53be635ad49c
8087333: Optionally Pre-Generate the HotSpot Template Interpreter
bdelsart
parents:
30764
diff
changeset
|
226 |
sasm->align(BytesPerWord); |
53be635ad49c
8087333: Optionally Pre-Generate the HotSpot Template Interpreter
bdelsart
parents:
30764
diff
changeset
|
227 |
// make sure all code is in code buffer |
53be635ad49c
8087333: Optionally Pre-Generate the HotSpot Template Interpreter
bdelsart
parents:
30764
diff
changeset
|
228 |
sasm->flush(); |
53be635ad49c
8087333: Optionally Pre-Generate the HotSpot Template Interpreter
bdelsart
parents:
30764
diff
changeset
|
229 |
|
53be635ad49c
8087333: Optionally Pre-Generate the HotSpot Template Interpreter
bdelsart
parents:
30764
diff
changeset
|
230 |
frame_size = sasm->frame_size(); |
53be635ad49c
8087333: Optionally Pre-Generate the HotSpot Template Interpreter
bdelsart
parents:
30764
diff
changeset
|
231 |
must_gc_arguments = sasm->must_gc_arguments(); |
53be635ad49c
8087333: Optionally Pre-Generate the HotSpot Template Interpreter
bdelsart
parents:
30764
diff
changeset
|
232 |
} else { |
53be635ad49c
8087333: Optionally Pre-Generate the HotSpot Template Interpreter
bdelsart
parents:
30764
diff
changeset
|
233 |
/* ignored values */ |
53be635ad49c
8087333: Optionally Pre-Generate the HotSpot Template Interpreter
bdelsart
parents:
30764
diff
changeset
|
234 |
oop_maps = NULL; |
53be635ad49c
8087333: Optionally Pre-Generate the HotSpot Template Interpreter
bdelsart
parents:
30764
diff
changeset
|
235 |
frame_size = 0; |
53be635ad49c
8087333: Optionally Pre-Generate the HotSpot Template Interpreter
bdelsart
parents:
30764
diff
changeset
|
236 |
must_gc_arguments = false; |
53be635ad49c
8087333: Optionally Pre-Generate the HotSpot Template Interpreter
bdelsart
parents:
30764
diff
changeset
|
237 |
} |
1 | 238 |
// create blob - distinguish a few special cases |
239 |
CodeBlob* blob = RuntimeStub::new_runtime_stub(name_for(id), |
|
240 |
&code, |
|
241 |
CodeOffsets::frame_never_safe, |
|
31620
53be635ad49c
8087333: Optionally Pre-Generate the HotSpot Template Interpreter
bdelsart
parents:
30764
diff
changeset
|
242 |
frame_size, |
1 | 243 |
oop_maps, |
31620
53be635ad49c
8087333: Optionally Pre-Generate the HotSpot Template Interpreter
bdelsart
parents:
30764
diff
changeset
|
244 |
must_gc_arguments); |
1 | 245 |
// install blob |
246 |
assert(blob != NULL, "blob must exist"); |
|
247 |
_blobs[id] = blob; |
|
248 |
} |
|
249 |
||
250 |
||
5707 | 251 |
void Runtime1::initialize(BufferBlob* blob) { |
252 |
// platform-dependent initialization |
|
253 |
initialize_pd(); |
|
254 |
// generate stubs |
|
255 |
for (int id = 0; id < number_of_ids; id++) generate_blob_for(blob, (StubID)id); |
|
256 |
// printing |
|
1 | 257 |
#ifndef PRODUCT |
5707 | 258 |
if (PrintSimpleStubs) { |
259 |
ResourceMark rm; |
|
260 |
for (int id = 0; id < number_of_ids; id++) { |
|
261 |
_blobs[id]->print(); |
|
262 |
if (_blobs[id]->oop_maps() != NULL) { |
|
263 |
_blobs[id]->oop_maps()->print(); |
|
1 | 264 |
} |
265 |
} |
|
5707 | 266 |
} |
1 | 267 |
#endif |
268 |
} |
|
269 |
||
270 |
||
271 |
CodeBlob* Runtime1::blob_for(StubID id) { |
|
272 |
assert(0 <= id && id < number_of_ids, "illegal stub id"); |
|
273 |
return _blobs[id]; |
|
274 |
} |
|
275 |
||
276 |
||
277 |
const char* Runtime1::name_for(StubID id) { |
|
278 |
assert(0 <= id && id < number_of_ids, "illegal stub id"); |
|
279 |
return _blob_names[id]; |
|
280 |
} |
|
281 |
||
282 |
const char* Runtime1::name_for_address(address entry) { |
|
283 |
for (int id = 0; id < number_of_ids; id++) { |
|
284 |
if (entry == entry_for((StubID)id)) return name_for((StubID)id); |
|
285 |
} |
|
286 |
||
287 |
#define FUNCTION_CASE(a, f) \ |
|
288 |
if ((intptr_t)a == CAST_FROM_FN_PTR(intptr_t, f)) return #f |
|
289 |
||
290 |
FUNCTION_CASE(entry, os::javaTimeMillis); |
|
291 |
FUNCTION_CASE(entry, os::javaTimeNanos); |
|
292 |
FUNCTION_CASE(entry, SharedRuntime::OSR_migration_end); |
|
293 |
FUNCTION_CASE(entry, SharedRuntime::d2f); |
|
294 |
FUNCTION_CASE(entry, SharedRuntime::d2i); |
|
295 |
FUNCTION_CASE(entry, SharedRuntime::d2l); |
|
296 |
FUNCTION_CASE(entry, SharedRuntime::dcos); |
|
297 |
FUNCTION_CASE(entry, SharedRuntime::dexp); |
|
298 |
FUNCTION_CASE(entry, SharedRuntime::dlog); |
|
299 |
FUNCTION_CASE(entry, SharedRuntime::dlog10); |
|
300 |
FUNCTION_CASE(entry, SharedRuntime::dpow); |
|
301 |
FUNCTION_CASE(entry, SharedRuntime::drem); |
|
302 |
FUNCTION_CASE(entry, SharedRuntime::dsin); |
|
303 |
FUNCTION_CASE(entry, SharedRuntime::dtan); |
|
304 |
FUNCTION_CASE(entry, SharedRuntime::f2i); |
|
305 |
FUNCTION_CASE(entry, SharedRuntime::f2l); |
|
306 |
FUNCTION_CASE(entry, SharedRuntime::frem); |
|
307 |
FUNCTION_CASE(entry, SharedRuntime::l2d); |
|
308 |
FUNCTION_CASE(entry, SharedRuntime::l2f); |
|
309 |
FUNCTION_CASE(entry, SharedRuntime::ldiv); |
|
310 |
FUNCTION_CASE(entry, SharedRuntime::lmul); |
|
311 |
FUNCTION_CASE(entry, SharedRuntime::lrem); |
|
312 |
FUNCTION_CASE(entry, SharedRuntime::lrem); |
|
313 |
FUNCTION_CASE(entry, SharedRuntime::dtrace_method_entry); |
|
314 |
FUNCTION_CASE(entry, SharedRuntime::dtrace_method_exit); |
|
12949 | 315 |
FUNCTION_CASE(entry, is_instance_of); |
1 | 316 |
FUNCTION_CASE(entry, trace_block_entry); |
12377
ae6def2813e0
7160570: Intrinsification support for tracing framework
rbackman
parents:
11636
diff
changeset
|
317 |
#ifdef TRACE_HAVE_INTRINSICS |
ae6def2813e0
7160570: Intrinsification support for tracing framework
rbackman
parents:
11636
diff
changeset
|
318 |
FUNCTION_CASE(entry, TRACE_TIME_METHOD); |
ae6def2813e0
7160570: Intrinsification support for tracing framework
rbackman
parents:
11636
diff
changeset
|
319 |
#endif |
18507
61bfc8995bb3
7088419: Use x86 Hardware CRC32 Instruction with java.util.zip.CRC32
drchase
parents:
17370
diff
changeset
|
320 |
FUNCTION_CASE(entry, StubRoutines::updateBytesCRC32()); |
38237
d972e3a2df53
8155162: java.util.zip.CRC32C Interpreter/C1 intrinsics support on SPARC
kvn
parents:
38018
diff
changeset
|
321 |
FUNCTION_CASE(entry, StubRoutines::updateBytesCRC32C()); |
38238
1bbcc430c78d
8151268: Wire up the x86 _vectorizedMismatch stub routine in C1
psandoz
parents:
38237
diff
changeset
|
322 |
FUNCTION_CASE(entry, StubRoutines::vectorizedMismatch()); |
33089 | 323 |
FUNCTION_CASE(entry, StubRoutines::dexp()); |
33465 | 324 |
FUNCTION_CASE(entry, StubRoutines::dlog()); |
38018
1dc6c6f21231
8152907: Update for x86 tan and log10 in the math lib
vdeshpande
parents:
36616
diff
changeset
|
325 |
FUNCTION_CASE(entry, StubRoutines::dlog10()); |
35146 | 326 |
FUNCTION_CASE(entry, StubRoutines::dpow()); |
35540
e001ad24dcdb
8143353: update for x86 sin and cos in the math lib
vdeshpande
parents:
35146
diff
changeset
|
327 |
FUNCTION_CASE(entry, StubRoutines::dsin()); |
e001ad24dcdb
8143353: update for x86 sin and cos in the math lib
vdeshpande
parents:
35146
diff
changeset
|
328 |
FUNCTION_CASE(entry, StubRoutines::dcos()); |
38018
1dc6c6f21231
8152907: Update for x86 tan and log10 in the math lib
vdeshpande
parents:
36616
diff
changeset
|
329 |
FUNCTION_CASE(entry, StubRoutines::dtan()); |
1 | 330 |
|
331 |
#undef FUNCTION_CASE |
|
332 |
||
6176
4d9030fe341f
6953477: Increase portability and flexibility of building Hotspot
bobv
parents:
5883
diff
changeset
|
333 |
// Soft float adds more runtime names. |
4d9030fe341f
6953477: Increase portability and flexibility of building Hotspot
bobv
parents:
5883
diff
changeset
|
334 |
return pd_name_for_address(entry); |
1 | 335 |
} |
336 |
||
337 |
||
13728
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
12949
diff
changeset
|
338 |
JRT_ENTRY(void, Runtime1::new_instance(JavaThread* thread, Klass* klass)) |
1 | 339 |
NOT_PRODUCT(_new_instance_slowcase_cnt++;) |
340 |
||
13728
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
12949
diff
changeset
|
341 |
assert(klass->is_klass(), "not a class"); |
36603
0bc3ad031d60
8141420: Compiler runtime entries don't hold Klass* from being GCed
vlivanov
parents:
36350
diff
changeset
|
342 |
Handle holder(THREAD, klass->klass_holder()); // keep the klass alive |
1 | 343 |
instanceKlassHandle h(thread, klass); |
344 |
h->check_valid_for_instantiation(true, CHECK); |
|
345 |
// make sure klass is initialized |
|
346 |
h->initialize(CHECK); |
|
347 |
// allocate instance and return via TLS |
|
348 |
oop obj = h->allocate_instance(CHECK); |
|
349 |
thread->set_vm_result(obj); |
|
350 |
JRT_END |
|
351 |
||
352 |
||
13728
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
12949
diff
changeset
|
353 |
JRT_ENTRY(void, Runtime1::new_type_array(JavaThread* thread, Klass* klass, jint length)) |
1 | 354 |
NOT_PRODUCT(_new_type_array_slowcase_cnt++;) |
355 |
// Note: no handle for klass needed since they are not used |
|
356 |
// anymore after new_typeArray() and no GC can happen before. |
|
357 |
// (This may have to change if this code changes!) |
|
13728
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
12949
diff
changeset
|
358 |
assert(klass->is_klass(), "not a class"); |
13952
e3cf184080bc
8000213: NPG: Should have renamed arrayKlass and typeArrayKlass
coleenp
parents:
13728
diff
changeset
|
359 |
BasicType elt_type = TypeArrayKlass::cast(klass)->element_type(); |
1 | 360 |
oop obj = oopFactory::new_typeArray(elt_type, length, CHECK); |
361 |
thread->set_vm_result(obj); |
|
362 |
// This is pretty rare but this runtime patch is stressful to deoptimization |
|
363 |
// if we deoptimize here so force a deopt to stress the path. |
|
364 |
if (DeoptimizeALot) { |
|
365 |
deopt_caller(); |
|
366 |
} |
|
367 |
||
368 |
JRT_END |
|
369 |
||
370 |
||
13728
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
12949
diff
changeset
|
371 |
JRT_ENTRY(void, Runtime1::new_object_array(JavaThread* thread, Klass* array_klass, jint length)) |
1 | 372 |
NOT_PRODUCT(_new_object_array_slowcase_cnt++;) |
373 |
||
374 |
// Note: no handle for klass needed since they are not used |
|
375 |
// anymore after new_objArray() and no GC can happen before. |
|
376 |
// (This may have to change if this code changes!) |
|
13728
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
12949
diff
changeset
|
377 |
assert(array_klass->is_klass(), "not a class"); |
36603
0bc3ad031d60
8141420: Compiler runtime entries don't hold Klass* from being GCed
vlivanov
parents:
36350
diff
changeset
|
378 |
Handle holder(THREAD, array_klass->klass_holder()); // keep the klass alive |
13952
e3cf184080bc
8000213: NPG: Should have renamed arrayKlass and typeArrayKlass
coleenp
parents:
13728
diff
changeset
|
379 |
Klass* elem_klass = ObjArrayKlass::cast(array_klass)->element_klass(); |
1 | 380 |
objArrayOop obj = oopFactory::new_objArray(elem_klass, length, CHECK); |
381 |
thread->set_vm_result(obj); |
|
382 |
// This is pretty rare but this runtime patch is stressful to deoptimization |
|
383 |
// if we deoptimize here so force a deopt to stress the path. |
|
384 |
if (DeoptimizeALot) { |
|
385 |
deopt_caller(); |
|
386 |
} |
|
387 |
JRT_END |
|
388 |
||
389 |
||
13728
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
12949
diff
changeset
|
390 |
JRT_ENTRY(void, Runtime1::new_multi_array(JavaThread* thread, Klass* klass, int rank, jint* dims)) |
1 | 391 |
NOT_PRODUCT(_new_multi_array_slowcase_cnt++;) |
392 |
||
13728
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
12949
diff
changeset
|
393 |
assert(klass->is_klass(), "not a class"); |
1 | 394 |
assert(rank >= 1, "rank must be nonzero"); |
36603
0bc3ad031d60
8141420: Compiler runtime entries don't hold Klass* from being GCed
vlivanov
parents:
36350
diff
changeset
|
395 |
Handle holder(THREAD, klass->klass_holder()); // keep the klass alive |
13952
e3cf184080bc
8000213: NPG: Should have renamed arrayKlass and typeArrayKlass
coleenp
parents:
13728
diff
changeset
|
396 |
oop obj = ArrayKlass::cast(klass)->multi_allocate(rank, dims, CHECK); |
1 | 397 |
thread->set_vm_result(obj); |
398 |
JRT_END |
|
399 |
||
400 |
||
401 |
JRT_ENTRY(void, Runtime1::unimplemented_entry(JavaThread* thread, StubID id)) |
|
402 |
tty->print_cr("Runtime1::entry_for(%d) returned unimplemented entry point", id); |
|
403 |
JRT_END |
|
404 |
||
405 |
||
8067
f5f4eac4c48f
7008809: should report the class in ArrayStoreExceptions from compiled code
never
parents:
7913
diff
changeset
|
406 |
JRT_ENTRY(void, Runtime1::throw_array_store_exception(JavaThread* thread, oopDesc* obj)) |
f5f4eac4c48f
7008809: should report the class in ArrayStoreExceptions from compiled code
never
parents:
7913
diff
changeset
|
407 |
ResourceMark rm(thread); |
14488 | 408 |
const char* klass_name = obj->klass()->external_name(); |
8067
f5f4eac4c48f
7008809: should report the class in ArrayStoreExceptions from compiled code
never
parents:
7913
diff
changeset
|
409 |
SharedRuntime::throw_and_post_jvmti_exception(thread, vmSymbols::java_lang_ArrayStoreException(), klass_name); |
1 | 410 |
JRT_END |
411 |
||
412 |
||
10014
a5c2141ee857
7057120: Tiered: Allow C1 to inline methods with loops
iveresov
parents:
9318
diff
changeset
|
413 |
// counter_overflow() is called from within C1-compiled methods. The enclosing method is the method |
a5c2141ee857
7057120: Tiered: Allow C1 to inline methods with loops
iveresov
parents:
9318
diff
changeset
|
414 |
// associated with the top activation record. The inlinee (that is possibly included in the enclosing |
a5c2141ee857
7057120: Tiered: Allow C1 to inline methods with loops
iveresov
parents:
9318
diff
changeset
|
415 |
// method) method oop is passed as an argument. In order to do that it is embedded in the code as |
a5c2141ee857
7057120: Tiered: Allow C1 to inline methods with loops
iveresov
parents:
9318
diff
changeset
|
416 |
// a constant. |
13728
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
12949
diff
changeset
|
417 |
static nmethod* counter_overflow_helper(JavaThread* THREAD, int branch_bci, Method* m) { |
6453 | 418 |
nmethod* osr_nm = NULL; |
419 |
methodHandle method(THREAD, m); |
|
420 |
||
421 |
RegisterMap map(THREAD, false); |
|
422 |
frame fr = THREAD->last_frame().sender(&map); |
|
1 | 423 |
nmethod* nm = (nmethod*) fr.cb(); |
6453 | 424 |
assert(nm!= NULL && nm->is_nmethod(), "Sanity check"); |
425 |
methodHandle enclosing_method(THREAD, nm->method()); |
|
426 |
||
427 |
CompLevel level = (CompLevel)nm->comp_level(); |
|
428 |
int bci = InvocationEntryBci; |
|
429 |
if (branch_bci != InvocationEntryBci) { |
|
31620
53be635ad49c
8087333: Optionally Pre-Generate the HotSpot Template Interpreter
bdelsart
parents:
30764
diff
changeset
|
430 |
// Compute destination bci |
6453 | 431 |
address pc = method()->code_base() + branch_bci; |
7913 | 432 |
Bytecodes::Code branch = Bytecodes::code_at(method(), pc); |
6453 | 433 |
int offset = 0; |
434 |
switch (branch) { |
|
435 |
case Bytecodes::_if_icmplt: case Bytecodes::_iflt: |
|
436 |
case Bytecodes::_if_icmpgt: case Bytecodes::_ifgt: |
|
437 |
case Bytecodes::_if_icmple: case Bytecodes::_ifle: |
|
438 |
case Bytecodes::_if_icmpge: case Bytecodes::_ifge: |
|
439 |
case Bytecodes::_if_icmpeq: case Bytecodes::_if_acmpeq: case Bytecodes::_ifeq: |
|
440 |
case Bytecodes::_if_icmpne: case Bytecodes::_if_acmpne: case Bytecodes::_ifne: |
|
441 |
case Bytecodes::_ifnull: case Bytecodes::_ifnonnull: case Bytecodes::_goto: |
|
442 |
offset = (int16_t)Bytes::get_Java_u2(pc + 1); |
|
443 |
break; |
|
444 |
case Bytecodes::_goto_w: |
|
445 |
offset = Bytes::get_Java_u4(pc + 1); |
|
446 |
break; |
|
447 |
default: ; |
|
1 | 448 |
} |
6453 | 449 |
bci = branch_bci + offset; |
450 |
} |
|
11572
84afef481892
7131259: compile_method and CompilationPolicy::event shouldn't be declared TRAPS
iveresov
parents:
10972
diff
changeset
|
451 |
assert(!HAS_PENDING_EXCEPTION, "Should not have any exceptions pending"); |
10014
a5c2141ee857
7057120: Tiered: Allow C1 to inline methods with loops
iveresov
parents:
9318
diff
changeset
|
452 |
osr_nm = CompilationPolicy::policy()->event(enclosing_method, method, branch_bci, bci, level, nm, THREAD); |
11572
84afef481892
7131259: compile_method and CompilationPolicy::event shouldn't be declared TRAPS
iveresov
parents:
10972
diff
changeset
|
453 |
assert(!HAS_PENDING_EXCEPTION, "Event handler should not throw any exceptions"); |
6453 | 454 |
return osr_nm; |
455 |
} |
|
456 |
||
13728
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
12949
diff
changeset
|
457 |
JRT_BLOCK_ENTRY(address, Runtime1::counter_overflow(JavaThread* thread, int bci, Method* method)) |
6453 | 458 |
nmethod* osr_nm; |
459 |
JRT_BLOCK |
|
460 |
osr_nm = counter_overflow_helper(thread, bci, method); |
|
461 |
if (osr_nm != NULL) { |
|
462 |
RegisterMap map(thread, false); |
|
463 |
frame fr = thread->last_frame().sender(&map); |
|
7106
867c9d296c6b
6968367: can_post_on_exceptions is still using VM_DeoptimizeFrame in some places
never
parents:
6453
diff
changeset
|
464 |
Deoptimization::deoptimize_frame(thread, fr.id()); |
1 | 465 |
} |
6453 | 466 |
JRT_BLOCK_END |
467 |
return NULL; |
|
1 | 468 |
JRT_END |
469 |
||
470 |
extern void vm_exit(int code); |
|
471 |
||
472 |
// Enter this method from compiled code handler below. This is where we transition |
|
473 |
// to VM mode. This is done as a helper routine so that the method called directly |
|
474 |
// from compiled code does not have to transition to VM. This allows the entry |
|
475 |
// method to see if the nmethod that we have just looked up a handler for has |
|
476 |
// been deoptimized while we were in the vm. This simplifies the assembly code |
|
477 |
// cpu directories. |
|
478 |
// |
|
479 |
// We are entering here from exception stub (via the entry method below) |
|
480 |
// If there is a compiled exception handler in this method, we will continue there; |
|
481 |
// otherwise we will unwind the stack and continue at the caller of top frame method |
|
482 |
// Note: we enter in Java using a special JRT wrapper. This wrapper allows us to |
|
483 |
// control the area where we can allow a safepoint. After we exit the safepoint area we can |
|
484 |
// check to see if the handler we are going to return is now in a nmethod that has |
|
485 |
// been deoptimized. If that is the case we return the deopt blob |
|
486 |
// unpack_with_exception entry instead. This makes life for the exception blob easier |
|
487 |
// because making that same check and diverting is painful from assembly language. |
|
488 |
JRT_ENTRY_NO_ASYNC(static address, exception_handler_for_pc_helper(JavaThread* thread, oopDesc* ex, address pc, nmethod*& nm)) |
|
8495
a4959965eaa3
7012914: JSR 292 MethodHandlesTest C1: frame::verify_return_pc(return_address) failed: must be a return pc
twisti
parents:
8067
diff
changeset
|
489 |
// Reset method handle flag. |
a4959965eaa3
7012914: JSR 292 MethodHandlesTest C1: frame::verify_return_pc(return_address) failed: must be a return pc
twisti
parents:
8067
diff
changeset
|
490 |
thread->set_is_method_handle_return(false); |
1 | 491 |
|
492 |
Handle exception(thread, ex); |
|
493 |
nm = CodeCache::find_nmethod(pc); |
|
494 |
assert(nm != NULL, "this is not an nmethod"); |
|
495 |
// Adjust the pc as needed/ |
|
496 |
if (nm->is_deopt_pc(pc)) { |
|
497 |
RegisterMap map(thread, false); |
|
498 |
frame exception_frame = thread->last_frame().sender(&map); |
|
499 |
// if the frame isn't deopted then pc must not correspond to the caller of last_frame |
|
500 |
assert(exception_frame.is_deoptimized_frame(), "must be deopted"); |
|
501 |
pc = exception_frame.pc(); |
|
502 |
} |
|
503 |
#ifdef ASSERT |
|
504 |
assert(exception.not_null(), "NULL exceptions should be handled by throw_exception"); |
|
505 |
assert(exception->is_oop(), "just checking"); |
|
506 |
// Check that exception is a subclass of Throwable, otherwise we have a VerifyError |
|
4571 | 507 |
if (!(exception->is_a(SystemDictionary::Throwable_klass()))) { |
1 | 508 |
if (ExitVMOnVerifyError) vm_exit(-1); |
509 |
ShouldNotReachHere(); |
|
510 |
} |
|
511 |
#endif |
|
512 |
||
513 |
// Check the stack guard pages and reenable them if necessary and there is |
|
514 |
// enough space on the stack to do so. Use fast exceptions only if the guard |
|
515 |
// pages are enabled. |
|
35071
a0910b1d3e0d
8046936: JEP 270: Reserved Stack Areas for Critical Sections
fparain
parents:
34500
diff
changeset
|
516 |
bool guard_pages_enabled = thread->stack_guards_enabled(); |
1 | 517 |
if (!guard_pages_enabled) guard_pages_enabled = thread->reguard_stack(); |
518 |
||
4761
bdb7375a1fee
6902182: 4/4 Starting with jdwp agent should not incur performance penalty
dcubed
parents:
4571
diff
changeset
|
519 |
if (JvmtiExport::can_post_on_exceptions()) { |
1 | 520 |
// To ensure correct notification of exception catches and throws |
521 |
// we have to deoptimize here. If we attempted to notify the |
|
522 |
// catches and throws during this exception lookup it's possible |
|
523 |
// we could deoptimize on the way out of the VM and end back in |
|
524 |
// the interpreter at the throw site. This would result in double |
|
525 |
// notifications since the interpreter would also notify about |
|
526 |
// these same catches and throws as it unwound the frame. |
|
527 |
||
528 |
RegisterMap reg_map(thread); |
|
529 |
frame stub_frame = thread->last_frame(); |
|
530 |
frame caller_frame = stub_frame.sender(®_map); |
|
531 |
||
532 |
// We don't really want to deoptimize the nmethod itself since we |
|
533 |
// can actually continue in the exception handler ourselves but I |
|
534 |
// don't see an easy way to have the desired effect. |
|
7106
867c9d296c6b
6968367: can_post_on_exceptions is still using VM_DeoptimizeFrame in some places
never
parents:
6453
diff
changeset
|
535 |
Deoptimization::deoptimize_frame(thread, caller_frame.id()); |
867c9d296c6b
6968367: can_post_on_exceptions is still using VM_DeoptimizeFrame in some places
never
parents:
6453
diff
changeset
|
536 |
assert(caller_is_deopted(), "Must be deoptimized"); |
1 | 537 |
|
538 |
return SharedRuntime::deopt_blob()->unpack_with_exception_in_tls(); |
|
539 |
} |
|
540 |
||
8495
a4959965eaa3
7012914: JSR 292 MethodHandlesTest C1: frame::verify_return_pc(return_address) failed: must be a return pc
twisti
parents:
8067
diff
changeset
|
541 |
// ExceptionCache is used only for exceptions at call sites and not for implicit exceptions |
1 | 542 |
if (guard_pages_enabled) { |
543 |
address fast_continuation = nm->handler_for_exception_and_pc(exception, pc); |
|
544 |
if (fast_continuation != NULL) { |
|
8495
a4959965eaa3
7012914: JSR 292 MethodHandlesTest C1: frame::verify_return_pc(return_address) failed: must be a return pc
twisti
parents:
8067
diff
changeset
|
545 |
// Set flag if return address is a method handle call site. |
a4959965eaa3
7012914: JSR 292 MethodHandlesTest C1: frame::verify_return_pc(return_address) failed: must be a return pc
twisti
parents:
8067
diff
changeset
|
546 |
thread->set_is_method_handle_return(nm->is_method_handle_return(pc)); |
1 | 547 |
return fast_continuation; |
548 |
} |
|
549 |
} |
|
550 |
||
551 |
// If the stack guard pages are enabled, check whether there is a handler in |
|
552 |
// the current method. Otherwise (guard pages disabled), force an unwind and |
|
553 |
// skip the exception cache update (i.e., just leave continuation==NULL). |
|
554 |
address continuation = NULL; |
|
555 |
if (guard_pages_enabled) { |
|
556 |
||
557 |
// New exception handling mechanism can support inlined methods |
|
558 |
// with exception handlers since the mappings are from PC to PC |
|
559 |
||
560 |
// debugging support |
|
561 |
// tracing |
|
35216
71c463a17b3b
8141211: Convert TraceExceptions to Unified Logging
rprotacio
parents:
35071
diff
changeset
|
562 |
if (log_is_enabled(Info, exceptions)) { |
1 | 563 |
ResourceMark rm; |
35477
7a00b08d27bc
8144953: runtime/CommandLine/TraceExceptionsTest.java fails when exception is thrown in compiled code
rprotacio
parents:
35216
diff
changeset
|
564 |
stringStream tempst; |
7a00b08d27bc
8144953: runtime/CommandLine/TraceExceptionsTest.java fails when exception is thrown in compiled code
rprotacio
parents:
35216
diff
changeset
|
565 |
tempst.print("compiled method <%s>\n" |
7a00b08d27bc
8144953: runtime/CommandLine/TraceExceptionsTest.java fails when exception is thrown in compiled code
rprotacio
parents:
35216
diff
changeset
|
566 |
" at PC" INTPTR_FORMAT " for thread " INTPTR_FORMAT, |
7a00b08d27bc
8144953: runtime/CommandLine/TraceExceptionsTest.java fails when exception is thrown in compiled code
rprotacio
parents:
35216
diff
changeset
|
567 |
nm->method()->print_value_string(), p2i(pc), p2i(thread)); |
7a00b08d27bc
8144953: runtime/CommandLine/TraceExceptionsTest.java fails when exception is thrown in compiled code
rprotacio
parents:
35216
diff
changeset
|
568 |
Exceptions::log_exception(exception, tempst); |
1 | 569 |
} |
570 |
// for AbortVMOnException flag |
|
33208
5ec6ffa63c57
8136577: Make AbortVMOnException available in product builds
poonam
parents:
31620
diff
changeset
|
571 |
Exceptions::debug_check_abort(exception); |
1 | 572 |
|
573 |
// Clear out the exception oop and pc since looking up an |
|
574 |
// exception handler can cause class loading, which might throw an |
|
575 |
// exception and those fields are expected to be clear during |
|
576 |
// normal bytecode execution. |
|
20703
2de7fe0e9693
8005173: assert(false) failed: DEBUG MESSAGE: exception oop must be empty (macroAssembler_x86.cpp:625)
twisti
parents:
20303
diff
changeset
|
577 |
thread->clear_exception_oop_and_pc(); |
1 | 578 |
|
26169
b1e1ef66da74
8054224: Recursive method that was compiled by C1 is unable to catch StackOverflowError
roland
parents:
25716
diff
changeset
|
579 |
Handle original_exception(thread, exception()); |
b1e1ef66da74
8054224: Recursive method that was compiled by C1 is unable to catch StackOverflowError
roland
parents:
25716
diff
changeset
|
580 |
|
1 | 581 |
continuation = SharedRuntime::compute_compiled_exc_handler(nm, pc, exception, false, false); |
582 |
// If an exception was thrown during exception dispatch, the exception oop may have changed |
|
583 |
thread->set_exception_oop(exception()); |
|
584 |
thread->set_exception_pc(pc); |
|
585 |
||
586 |
// the exception cache is used only by non-implicit exceptions |
|
26169
b1e1ef66da74
8054224: Recursive method that was compiled by C1 is unable to catch StackOverflowError
roland
parents:
25716
diff
changeset
|
587 |
// Update the exception cache only when there didn't happen |
b1e1ef66da74
8054224: Recursive method that was compiled by C1 is unable to catch StackOverflowError
roland
parents:
25716
diff
changeset
|
588 |
// another exception during the computation of the compiled |
b1e1ef66da74
8054224: Recursive method that was compiled by C1 is unable to catch StackOverflowError
roland
parents:
25716
diff
changeset
|
589 |
// exception handler. |
b1e1ef66da74
8054224: Recursive method that was compiled by C1 is unable to catch StackOverflowError
roland
parents:
25716
diff
changeset
|
590 |
if (continuation != NULL && original_exception() == exception()) { |
1 | 591 |
nm->add_handler_for_exception_and_pc(exception, pc, continuation); |
592 |
} |
|
593 |
} |
|
594 |
||
595 |
thread->set_vm_result(exception()); |
|
8495
a4959965eaa3
7012914: JSR 292 MethodHandlesTest C1: frame::verify_return_pc(return_address) failed: must be a return pc
twisti
parents:
8067
diff
changeset
|
596 |
// Set flag if return address is a method handle call site. |
a4959965eaa3
7012914: JSR 292 MethodHandlesTest C1: frame::verify_return_pc(return_address) failed: must be a return pc
twisti
parents:
8067
diff
changeset
|
597 |
thread->set_is_method_handle_return(nm->is_method_handle_return(pc)); |
1 | 598 |
|
35216
71c463a17b3b
8141211: Convert TraceExceptions to Unified Logging
rprotacio
parents:
35071
diff
changeset
|
599 |
if (log_is_enabled(Info, exceptions)) { |
1 | 600 |
ResourceMark rm; |
35216
71c463a17b3b
8141211: Convert TraceExceptions to Unified Logging
rprotacio
parents:
35071
diff
changeset
|
601 |
log_info(exceptions)("Thread " PTR_FORMAT " continuing at PC " PTR_FORMAT |
71c463a17b3b
8141211: Convert TraceExceptions to Unified Logging
rprotacio
parents:
35071
diff
changeset
|
602 |
" for exception thrown at PC " PTR_FORMAT, |
71c463a17b3b
8141211: Convert TraceExceptions to Unified Logging
rprotacio
parents:
35071
diff
changeset
|
603 |
p2i(thread), p2i(continuation), p2i(pc)); |
1 | 604 |
} |
605 |
||
606 |
return continuation; |
|
607 |
JRT_END |
|
608 |
||
609 |
// Enter this method from compiled code only if there is a Java exception handler |
|
8495
a4959965eaa3
7012914: JSR 292 MethodHandlesTest C1: frame::verify_return_pc(return_address) failed: must be a return pc
twisti
parents:
8067
diff
changeset
|
610 |
// in the method handling the exception. |
1 | 611 |
// We are entering here from exception stub. We don't do a normal VM transition here. |
612 |
// We do it in a helper. This is so we can check to see if the nmethod we have just |
|
613 |
// searched for an exception handler has been deoptimized in the meantime. |
|
8495
a4959965eaa3
7012914: JSR 292 MethodHandlesTest C1: frame::verify_return_pc(return_address) failed: must be a return pc
twisti
parents:
8067
diff
changeset
|
614 |
address Runtime1::exception_handler_for_pc(JavaThread* thread) { |
1 | 615 |
oop exception = thread->exception_oop(); |
616 |
address pc = thread->exception_pc(); |
|
617 |
// Still in Java mode |
|
8495
a4959965eaa3
7012914: JSR 292 MethodHandlesTest C1: frame::verify_return_pc(return_address) failed: must be a return pc
twisti
parents:
8067
diff
changeset
|
618 |
DEBUG_ONLY(ResetNoHandleMark rnhm); |
1 | 619 |
nmethod* nm = NULL; |
620 |
address continuation = NULL; |
|
621 |
{ |
|
622 |
// Enter VM mode by calling the helper |
|
623 |
ResetNoHandleMark rnhm; |
|
624 |
continuation = exception_handler_for_pc_helper(thread, exception, pc, nm); |
|
625 |
} |
|
626 |
// Back in JAVA, use no oops DON'T safepoint |
|
627 |
||
628 |
// Now check to see if the nmethod we were called from is now deoptimized. |
|
629 |
// If so we must return to the deopt blob and deoptimize the nmethod |
|
630 |
if (nm != NULL && caller_is_deopted()) { |
|
631 |
continuation = SharedRuntime::deopt_blob()->unpack_with_exception_in_tls(); |
|
632 |
} |
|
633 |
||
8495
a4959965eaa3
7012914: JSR 292 MethodHandlesTest C1: frame::verify_return_pc(return_address) failed: must be a return pc
twisti
parents:
8067
diff
changeset
|
634 |
assert(continuation != NULL, "no handler found"); |
1 | 635 |
return continuation; |
636 |
} |
|
637 |
||
638 |
||
639 |
JRT_ENTRY(void, Runtime1::throw_range_check_exception(JavaThread* thread, int index)) |
|
640 |
NOT_PRODUCT(_throw_range_check_exception_count++;) |
|
641 |
char message[jintAsStringSize]; |
|
642 |
sprintf(message, "%d", index); |
|
643 |
SharedRuntime::throw_and_post_jvmti_exception(thread, vmSymbols::java_lang_ArrayIndexOutOfBoundsException(), message); |
|
644 |
JRT_END |
|
645 |
||
646 |
||
647 |
JRT_ENTRY(void, Runtime1::throw_index_exception(JavaThread* thread, int index)) |
|
648 |
NOT_PRODUCT(_throw_index_exception_count++;) |
|
649 |
char message[16]; |
|
650 |
sprintf(message, "%d", index); |
|
651 |
SharedRuntime::throw_and_post_jvmti_exception(thread, vmSymbols::java_lang_IndexOutOfBoundsException(), message); |
|
652 |
JRT_END |
|
653 |
||
654 |
||
655 |
JRT_ENTRY(void, Runtime1::throw_div0_exception(JavaThread* thread)) |
|
656 |
NOT_PRODUCT(_throw_div0_exception_count++;) |
|
657 |
SharedRuntime::throw_and_post_jvmti_exception(thread, vmSymbols::java_lang_ArithmeticException(), "/ by zero"); |
|
658 |
JRT_END |
|
659 |
||
660 |
||
661 |
JRT_ENTRY(void, Runtime1::throw_null_pointer_exception(JavaThread* thread)) |
|
662 |
NOT_PRODUCT(_throw_null_pointer_exception_count++;) |
|
663 |
SharedRuntime::throw_and_post_jvmti_exception(thread, vmSymbols::java_lang_NullPointerException()); |
|
664 |
JRT_END |
|
665 |
||
666 |
||
667 |
JRT_ENTRY(void, Runtime1::throw_class_cast_exception(JavaThread* thread, oopDesc* object)) |
|
668 |
NOT_PRODUCT(_throw_class_cast_exception_count++;) |
|
669 |
ResourceMark rm(thread); |
|
670 |
char* message = SharedRuntime::generate_class_cast_message( |
|
36508 | 671 |
thread, object->klass()); |
1 | 672 |
SharedRuntime::throw_and_post_jvmti_exception( |
673 |
thread, vmSymbols::java_lang_ClassCastException(), message); |
|
674 |
JRT_END |
|
675 |
||
676 |
||
677 |
JRT_ENTRY(void, Runtime1::throw_incompatible_class_change_error(JavaThread* thread)) |
|
678 |
NOT_PRODUCT(_throw_incompatible_class_change_error_count++;) |
|
679 |
ResourceMark rm(thread); |
|
680 |
SharedRuntime::throw_and_post_jvmti_exception(thread, vmSymbols::java_lang_IncompatibleClassChangeError()); |
|
681 |
JRT_END |
|
682 |
||
683 |
||
684 |
JRT_ENTRY_NO_ASYNC(void, Runtime1::monitorenter(JavaThread* thread, oopDesc* obj, BasicObjectLock* lock)) |
|
685 |
NOT_PRODUCT(_monitorenter_slowcase_cnt++;) |
|
686 |
if (PrintBiasedLockingStatistics) { |
|
687 |
Atomic::inc(BiasedLocking::slow_path_entry_count_addr()); |
|
688 |
} |
|
689 |
Handle h_obj(thread, obj); |
|
690 |
assert(h_obj()->is_oop(), "must be NULL or an object"); |
|
691 |
if (UseBiasedLocking) { |
|
692 |
// Retry fast entry if bias is revoked to avoid unnecessary inflation |
|
693 |
ObjectSynchronizer::fast_enter(h_obj, lock->lock(), true, CHECK); |
|
694 |
} else { |
|
695 |
if (UseFastLocking) { |
|
696 |
// When using fast locking, the compiled code has already tried the fast case |
|
697 |
assert(obj == lock->obj(), "must match"); |
|
698 |
ObjectSynchronizer::slow_enter(h_obj, lock->lock(), THREAD); |
|
699 |
} else { |
|
700 |
lock->set_obj(obj); |
|
701 |
ObjectSynchronizer::fast_enter(h_obj, lock->lock(), false, THREAD); |
|
702 |
} |
|
703 |
} |
|
704 |
JRT_END |
|
705 |
||
706 |
||
707 |
JRT_LEAF(void, Runtime1::monitorexit(JavaThread* thread, BasicObjectLock* lock)) |
|
708 |
NOT_PRODUCT(_monitorexit_slowcase_cnt++;) |
|
709 |
assert(thread == JavaThread::current(), "threads must correspond"); |
|
710 |
assert(thread->last_Java_sp(), "last_Java_sp must be set"); |
|
711 |
// monitorexit is non-blocking (leaf routine) => no exceptions can be thrown |
|
712 |
EXCEPTION_MARK; |
|
713 |
||
714 |
oop obj = lock->obj(); |
|
715 |
assert(obj->is_oop(), "must be NULL or an object"); |
|
716 |
if (UseFastLocking) { |
|
717 |
// When using fast locking, the compiled code has already tried the fast case |
|
718 |
ObjectSynchronizer::slow_exit(obj, lock->lock(), THREAD); |
|
719 |
} else { |
|
720 |
ObjectSynchronizer::fast_exit(obj, lock->lock(), THREAD); |
|
721 |
} |
|
722 |
JRT_END |
|
723 |
||
10972
ef164805934c
7102657: JSR 292: C1 deoptimizes unlinked invokedynamic call sites infinitely
twisti
parents:
10508
diff
changeset
|
724 |
// Cf. OptoRuntime::deoptimize_caller_frame |
24442
4d4ae31dea26
8032463: VirtualDispatch test timeout with DeoptimizeALot
iveresov
parents:
24424
diff
changeset
|
725 |
JRT_ENTRY(void, Runtime1::deoptimize(JavaThread* thread, jint trap_request)) |
10972
ef164805934c
7102657: JSR 292: C1 deoptimizes unlinked invokedynamic call sites infinitely
twisti
parents:
10508
diff
changeset
|
726 |
// Called from within the owner thread, so no need for safepoint |
ef164805934c
7102657: JSR 292: C1 deoptimizes unlinked invokedynamic call sites infinitely
twisti
parents:
10508
diff
changeset
|
727 |
RegisterMap reg_map(thread, false); |
ef164805934c
7102657: JSR 292: C1 deoptimizes unlinked invokedynamic call sites infinitely
twisti
parents:
10508
diff
changeset
|
728 |
frame stub_frame = thread->last_frame(); |
24442
4d4ae31dea26
8032463: VirtualDispatch test timeout with DeoptimizeALot
iveresov
parents:
24424
diff
changeset
|
729 |
assert(stub_frame.is_runtime_frame(), "Sanity check"); |
10972
ef164805934c
7102657: JSR 292: C1 deoptimizes unlinked invokedynamic call sites infinitely
twisti
parents:
10508
diff
changeset
|
730 |
frame caller_frame = stub_frame.sender(®_map); |
24442
4d4ae31dea26
8032463: VirtualDispatch test timeout with DeoptimizeALot
iveresov
parents:
24424
diff
changeset
|
731 |
nmethod* nm = caller_frame.cb()->as_nmethod_or_null(); |
4d4ae31dea26
8032463: VirtualDispatch test timeout with DeoptimizeALot
iveresov
parents:
24424
diff
changeset
|
732 |
assert(nm != NULL, "Sanity check"); |
4d4ae31dea26
8032463: VirtualDispatch test timeout with DeoptimizeALot
iveresov
parents:
24424
diff
changeset
|
733 |
methodHandle method(thread, nm->method()); |
4d4ae31dea26
8032463: VirtualDispatch test timeout with DeoptimizeALot
iveresov
parents:
24424
diff
changeset
|
734 |
assert(nm == CodeCache::find_nmethod(caller_frame.pc()), "Should be the same"); |
4d4ae31dea26
8032463: VirtualDispatch test timeout with DeoptimizeALot
iveresov
parents:
24424
diff
changeset
|
735 |
Deoptimization::DeoptAction action = Deoptimization::trap_request_action(trap_request); |
4d4ae31dea26
8032463: VirtualDispatch test timeout with DeoptimizeALot
iveresov
parents:
24424
diff
changeset
|
736 |
Deoptimization::DeoptReason reason = Deoptimization::trap_request_reason(trap_request); |
10972
ef164805934c
7102657: JSR 292: C1 deoptimizes unlinked invokedynamic call sites infinitely
twisti
parents:
10508
diff
changeset
|
737 |
|
24442
4d4ae31dea26
8032463: VirtualDispatch test timeout with DeoptimizeALot
iveresov
parents:
24424
diff
changeset
|
738 |
if (action == Deoptimization::Action_make_not_entrant) { |
4d4ae31dea26
8032463: VirtualDispatch test timeout with DeoptimizeALot
iveresov
parents:
24424
diff
changeset
|
739 |
if (nm->make_not_entrant()) { |
4d4ae31dea26
8032463: VirtualDispatch test timeout with DeoptimizeALot
iveresov
parents:
24424
diff
changeset
|
740 |
if (reason == Deoptimization::Reason_tenured) { |
4d4ae31dea26
8032463: VirtualDispatch test timeout with DeoptimizeALot
iveresov
parents:
24424
diff
changeset
|
741 |
MethodData* trap_mdo = Deoptimization::get_method_data(thread, method, true /*create_if_missing*/); |
4d4ae31dea26
8032463: VirtualDispatch test timeout with DeoptimizeALot
iveresov
parents:
24424
diff
changeset
|
742 |
if (trap_mdo != NULL) { |
4d4ae31dea26
8032463: VirtualDispatch test timeout with DeoptimizeALot
iveresov
parents:
24424
diff
changeset
|
743 |
trap_mdo->inc_tenure_traps(); |
4d4ae31dea26
8032463: VirtualDispatch test timeout with DeoptimizeALot
iveresov
parents:
24424
diff
changeset
|
744 |
} |
4d4ae31dea26
8032463: VirtualDispatch test timeout with DeoptimizeALot
iveresov
parents:
24424
diff
changeset
|
745 |
} |
4d4ae31dea26
8032463: VirtualDispatch test timeout with DeoptimizeALot
iveresov
parents:
24424
diff
changeset
|
746 |
} |
4d4ae31dea26
8032463: VirtualDispatch test timeout with DeoptimizeALot
iveresov
parents:
24424
diff
changeset
|
747 |
} |
10972
ef164805934c
7102657: JSR 292: C1 deoptimizes unlinked invokedynamic call sites infinitely
twisti
parents:
10508
diff
changeset
|
748 |
|
ef164805934c
7102657: JSR 292: C1 deoptimizes unlinked invokedynamic call sites infinitely
twisti
parents:
10508
diff
changeset
|
749 |
// Deoptimize the caller frame. |
ef164805934c
7102657: JSR 292: C1 deoptimizes unlinked invokedynamic call sites infinitely
twisti
parents:
10508
diff
changeset
|
750 |
Deoptimization::deoptimize_frame(thread, caller_frame.id()); |
ef164805934c
7102657: JSR 292: C1 deoptimizes unlinked invokedynamic call sites infinitely
twisti
parents:
10508
diff
changeset
|
751 |
// Return to the now deoptimized frame. |
ef164805934c
7102657: JSR 292: C1 deoptimizes unlinked invokedynamic call sites infinitely
twisti
parents:
10508
diff
changeset
|
752 |
JRT_END |
ef164805934c
7102657: JSR 292: C1 deoptimizes unlinked invokedynamic call sites infinitely
twisti
parents:
10508
diff
changeset
|
753 |
|
1 | 754 |
|
29180 | 755 |
#ifndef DEOPTIMIZE_WHEN_PATCHING |
756 |
||
13728
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
12949
diff
changeset
|
757 |
static Klass* resolve_field_return_klass(methodHandle caller, int bci, TRAPS) { |
7913 | 758 |
Bytecode_field field_access(caller, bci); |
1 | 759 |
// This can be static or non-static field access |
7913 | 760 |
Bytecodes::Code code = field_access.code(); |
1 | 761 |
|
762 |
// We must load class, initialize class and resolvethe field |
|
20017
81eba62e9048
8014013: CallInfo structure no longer accurately reports the result of a LinkResolver operation
drchase
parents:
19710
diff
changeset
|
763 |
fieldDescriptor result; // initialize class if needed |
1 | 764 |
constantPoolHandle constants(THREAD, caller->constants()); |
20017
81eba62e9048
8014013: CallInfo structure no longer accurately reports the result of a LinkResolver operation
drchase
parents:
19710
diff
changeset
|
765 |
LinkResolver::resolve_field_access(result, constants, field_access.index(), Bytecodes::java_code(code), CHECK_NULL); |
81eba62e9048
8014013: CallInfo structure no longer accurately reports the result of a LinkResolver operation
drchase
parents:
19710
diff
changeset
|
766 |
return result.field_holder(); |
1 | 767 |
} |
768 |
||
769 |
||
770 |
// |
|
771 |
// This routine patches sites where a class wasn't loaded or |
|
772 |
// initialized at the time the code was generated. It handles |
|
773 |
// references to classes, fields and forcing of initialization. Most |
|
774 |
// of the cases are straightforward and involving simply forcing |
|
775 |
// resolution of a class, rewriting the instruction stream with the |
|
776 |
// needed constant and replacing the call in this function with the |
|
777 |
// patched code. The case for static field is more complicated since |
|
778 |
// the thread which is in the process of initializing a class can |
|
779 |
// access it's static fields but other threads can't so the code |
|
780 |
// either has to deoptimize when this case is detected or execute a |
|
781 |
// check that the current thread is the initializing thread. The |
|
782 |
// current |
|
783 |
// |
|
784 |
// Patches basically look like this: |
|
785 |
// |
|
786 |
// |
|
787 |
// patch_site: jmp patch stub ;; will be patched |
|
788 |
// continue: ... |
|
789 |
// ... |
|
790 |
// ... |
|
791 |
// ... |
|
792 |
// |
|
793 |
// They have a stub which looks like this: |
|
794 |
// |
|
795 |
// ;; patch body |
|
796 |
// movl <const>, reg (for class constants) |
|
797 |
// <or> movl [reg1 + <const>], reg (for field offsets) |
|
798 |
// <or> movl reg, [reg1 + <const>] (for field offsets) |
|
799 |
// <being_init offset> <bytes to copy> <bytes to skip> |
|
800 |
// patch_stub: call Runtime1::patch_code (through a runtime stub) |
|
801 |
// jmp patch_site |
|
802 |
// |
|
803 |
// |
|
804 |
// A normal patch is done by rewriting the patch body, usually a move, |
|
805 |
// and then copying it into place over top of the jmp instruction |
|
806 |
// being careful to flush caches and doing it in an MP-safe way. The |
|
807 |
// constants following the patch body are used to find various pieces |
|
808 |
// of the patch relative to the call site for Runtime1::patch_code. |
|
809 |
// The case for getstatic and putstatic is more complicated because |
|
810 |
// getstatic and putstatic have special semantics when executing while |
|
811 |
// the class is being initialized. getstatic/putstatic on a class |
|
812 |
// which is being_initialized may be executed by the initializing |
|
813 |
// thread but other threads have to block when they execute it. This |
|
814 |
// is accomplished in compiled code by executing a test of the current |
|
815 |
// thread against the initializing thread of the class. It's emitted |
|
816 |
// as boilerplate in their stub which allows the patched code to be |
|
817 |
// executed before it's copied back into the main body of the nmethod. |
|
818 |
// |
|
819 |
// being_init: get_thread(<tmp reg> |
|
820 |
// cmpl [reg1 + <init_thread_offset>], <tmp reg> |
|
821 |
// jne patch_stub |
|
822 |
// movl [reg1 + <const>], reg (for field offsets) <or> |
|
823 |
// movl reg, [reg1 + <const>] (for field offsets) |
|
824 |
// jmp continue |
|
825 |
// <being_init offset> <bytes to copy> <bytes to skip> |
|
826 |
// patch_stub: jmp Runtim1::patch_code (through a runtime stub) |
|
827 |
// jmp patch_site |
|
828 |
// |
|
829 |
// If the class is being initialized the patch body is rewritten and |
|
830 |
// the patch site is rewritten to jump to being_init, instead of |
|
831 |
// patch_stub. Whenever this code is executed it checks the current |
|
832 |
// thread against the intializing thread so other threads will enter |
|
833 |
// the runtime and end up blocked waiting the class to finish |
|
834 |
// initializing inside the calls to resolve_field below. The |
|
835 |
// initializing class will continue on it's way. Once the class is |
|
836 |
// fully_initialized, the intializing_thread of the class becomes |
|
837 |
// NULL, so the next thread to execute this code will fail the test, |
|
838 |
// call into patch_code and complete the patching process by copying |
|
839 |
// the patch body back into the main part of the nmethod and resume |
|
840 |
// executing. |
|
841 |
// |
|
842 |
// |
|
843 |
||
844 |
JRT_ENTRY(void, Runtime1::patch_code(JavaThread* thread, Runtime1::StubID stub_id )) |
|
845 |
NOT_PRODUCT(_patch_code_slowcase_cnt++;) |
|
846 |
||
847 |
ResourceMark rm(thread); |
|
848 |
RegisterMap reg_map(thread, false); |
|
849 |
frame runtime_frame = thread->last_frame(); |
|
850 |
frame caller_frame = runtime_frame.sender(®_map); |
|
851 |
||
852 |
// last java frame on stack |
|
853 |
vframeStream vfst(thread, true); |
|
854 |
assert(!vfst.at_end(), "Java frame must exist"); |
|
855 |
||
856 |
methodHandle caller_method(THREAD, vfst.method()); |
|
857 |
// Note that caller_method->code() may not be same as caller_code because of OSR's |
|
858 |
// Note also that in the presence of inlining it is not guaranteed |
|
859 |
// that caller_method() == caller_code->method() |
|
860 |
||
861 |
int bci = vfst.bci(); |
|
7913 | 862 |
Bytecodes::Code code = caller_method()->java_code_at(bci); |
1 | 863 |
|
864 |
// this is used by assertions in the access_field_patching_id |
|
865 |
BasicType patch_field_type = T_ILLEGAL; |
|
866 |
bool deoptimize_for_volatile = false; |
|
23189
27cf1316709b
8033380: Experimental VM flag to enforce access atomicity
shade
parents:
20703
diff
changeset
|
867 |
bool deoptimize_for_atomic = false; |
1 | 868 |
int patch_field_offset = -1; |
13728
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
12949
diff
changeset
|
869 |
KlassHandle init_klass(THREAD, NULL); // klass needed by load_klass_patching code |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
12949
diff
changeset
|
870 |
KlassHandle load_klass(THREAD, NULL); // klass needed by load_klass_patching code |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
12949
diff
changeset
|
871 |
Handle mirror(THREAD, NULL); // oop needed by load_mirror_patching code |
19710
2f8ca425504e
7199175: JSR 292: C1 needs patching when invokedynamic/invokehandle call site is not linked
roland
parents:
19339
diff
changeset
|
872 |
Handle appendix(THREAD, NULL); // oop needed by appendix_patching code |
13728
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
12949
diff
changeset
|
873 |
bool load_klass_or_mirror_patch_id = |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
12949
diff
changeset
|
874 |
(stub_id == Runtime1::load_klass_patching_id || stub_id == Runtime1::load_mirror_patching_id); |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
12949
diff
changeset
|
875 |
|
1 | 876 |
if (stub_id == Runtime1::access_field_patching_id) { |
877 |
||
7913 | 878 |
Bytecode_field field_access(caller_method, bci); |
20017
81eba62e9048
8014013: CallInfo structure no longer accurately reports the result of a LinkResolver operation
drchase
parents:
19710
diff
changeset
|
879 |
fieldDescriptor result; // initialize class if needed |
7913 | 880 |
Bytecodes::Code code = field_access.code(); |
1 | 881 |
constantPoolHandle constants(THREAD, caller_method->constants()); |
20017
81eba62e9048
8014013: CallInfo structure no longer accurately reports the result of a LinkResolver operation
drchase
parents:
19710
diff
changeset
|
882 |
LinkResolver::resolve_field_access(result, constants, field_access.index(), Bytecodes::java_code(code), CHECK); |
81eba62e9048
8014013: CallInfo structure no longer accurately reports the result of a LinkResolver operation
drchase
parents:
19710
diff
changeset
|
883 |
patch_field_offset = result.offset(); |
1 | 884 |
|
885 |
// If we're patching a field which is volatile then at compile it |
|
886 |
// must not have been know to be volatile, so the generated code |
|
887 |
// isn't correct for a volatile reference. The nmethod has to be |
|
888 |
// deoptimized so that the code can be regenerated correctly. |
|
889 |
// This check is only needed for access_field_patching since this |
|
890 |
// is the path for patching field offsets. load_klass is only |
|
891 |
// used for patching references to oops which don't need special |
|
892 |
// handling in the volatile case. |
|
23189
27cf1316709b
8033380: Experimental VM flag to enforce access atomicity
shade
parents:
20703
diff
changeset
|
893 |
|
1 | 894 |
deoptimize_for_volatile = result.access_flags().is_volatile(); |
895 |
||
23189
27cf1316709b
8033380: Experimental VM flag to enforce access atomicity
shade
parents:
20703
diff
changeset
|
896 |
// If we are patching a field which should be atomic, then |
27cf1316709b
8033380: Experimental VM flag to enforce access atomicity
shade
parents:
20703
diff
changeset
|
897 |
// the generated code is not correct either, force deoptimizing. |
27cf1316709b
8033380: Experimental VM flag to enforce access atomicity
shade
parents:
20703
diff
changeset
|
898 |
// We need to only cover T_LONG and T_DOUBLE fields, as we can |
27cf1316709b
8033380: Experimental VM flag to enforce access atomicity
shade
parents:
20703
diff
changeset
|
899 |
// break access atomicity only for them. |
27cf1316709b
8033380: Experimental VM flag to enforce access atomicity
shade
parents:
20703
diff
changeset
|
900 |
|
27cf1316709b
8033380: Experimental VM flag to enforce access atomicity
shade
parents:
20703
diff
changeset
|
901 |
// Strictly speaking, the deoptimizaation on 64-bit platforms |
27cf1316709b
8033380: Experimental VM flag to enforce access atomicity
shade
parents:
20703
diff
changeset
|
902 |
// is unnecessary, and T_LONG stores on 32-bit platforms need |
27cf1316709b
8033380: Experimental VM flag to enforce access atomicity
shade
parents:
20703
diff
changeset
|
903 |
// to be handled by special patching code when AlwaysAtomicAccesses |
27cf1316709b
8033380: Experimental VM flag to enforce access atomicity
shade
parents:
20703
diff
changeset
|
904 |
// becomes product feature. At this point, we are still going |
27cf1316709b
8033380: Experimental VM flag to enforce access atomicity
shade
parents:
20703
diff
changeset
|
905 |
// for the deoptimization for consistency against volatile |
27cf1316709b
8033380: Experimental VM flag to enforce access atomicity
shade
parents:
20703
diff
changeset
|
906 |
// accesses. |
27cf1316709b
8033380: Experimental VM flag to enforce access atomicity
shade
parents:
20703
diff
changeset
|
907 |
|
1 | 908 |
patch_field_type = result.field_type(); |
23189
27cf1316709b
8033380: Experimental VM flag to enforce access atomicity
shade
parents:
20703
diff
changeset
|
909 |
deoptimize_for_atomic = (AlwaysAtomicAccesses && (patch_field_type == T_DOUBLE || patch_field_type == T_LONG)); |
27cf1316709b
8033380: Experimental VM flag to enforce access atomicity
shade
parents:
20703
diff
changeset
|
910 |
|
13728
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
12949
diff
changeset
|
911 |
} else if (load_klass_or_mirror_patch_id) { |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
12949
diff
changeset
|
912 |
Klass* k = NULL; |
1 | 913 |
switch (code) { |
914 |
case Bytecodes::_putstatic: |
|
915 |
case Bytecodes::_getstatic: |
|
13728
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
12949
diff
changeset
|
916 |
{ Klass* klass = resolve_field_return_klass(caller_method, bci, CHECK); |
1 | 917 |
init_klass = KlassHandle(THREAD, klass); |
13728
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
12949
diff
changeset
|
918 |
mirror = Handle(THREAD, klass->java_mirror()); |
1 | 919 |
} |
920 |
break; |
|
921 |
case Bytecodes::_new: |
|
7913 | 922 |
{ Bytecode_new bnew(caller_method(), caller_method->bcp_from(bci)); |
923 |
k = caller_method->constants()->klass_at(bnew.index(), CHECK); |
|
1 | 924 |
} |
925 |
break; |
|
926 |
case Bytecodes::_multianewarray: |
|
7913 | 927 |
{ Bytecode_multianewarray mna(caller_method(), caller_method->bcp_from(bci)); |
928 |
k = caller_method->constants()->klass_at(mna.index(), CHECK); |
|
1 | 929 |
} |
930 |
break; |
|
931 |
case Bytecodes::_instanceof: |
|
7913 | 932 |
{ Bytecode_instanceof io(caller_method(), caller_method->bcp_from(bci)); |
933 |
k = caller_method->constants()->klass_at(io.index(), CHECK); |
|
1 | 934 |
} |
935 |
break; |
|
936 |
case Bytecodes::_checkcast: |
|
7913 | 937 |
{ Bytecode_checkcast cc(caller_method(), caller_method->bcp_from(bci)); |
938 |
k = caller_method->constants()->klass_at(cc.index(), CHECK); |
|
1 | 939 |
} |
940 |
break; |
|
941 |
case Bytecodes::_anewarray: |
|
7913 | 942 |
{ Bytecode_anewarray anew(caller_method(), caller_method->bcp_from(bci)); |
13728
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
12949
diff
changeset
|
943 |
Klass* ek = caller_method->constants()->klass_at(anew.index(), CHECK); |
14488 | 944 |
k = ek->array_klass(CHECK); |
1 | 945 |
} |
946 |
break; |
|
947 |
case Bytecodes::_ldc: |
|
948 |
case Bytecodes::_ldc_w: |
|
949 |
{ |
|
7913 | 950 |
Bytecode_loadconstant cc(caller_method, bci); |
13728
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
12949
diff
changeset
|
951 |
oop m = cc.resolve_constant(CHECK); |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
12949
diff
changeset
|
952 |
mirror = Handle(THREAD, m); |
1 | 953 |
} |
954 |
break; |
|
19710
2f8ca425504e
7199175: JSR 292: C1 needs patching when invokedynamic/invokehandle call site is not linked
roland
parents:
19339
diff
changeset
|
955 |
default: fatal("unexpected bytecode for load_klass_or_mirror_patch_id"); |
1 | 956 |
} |
957 |
// convert to handle |
|
13728
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
12949
diff
changeset
|
958 |
load_klass = KlassHandle(THREAD, k); |
19710
2f8ca425504e
7199175: JSR 292: C1 needs patching when invokedynamic/invokehandle call site is not linked
roland
parents:
19339
diff
changeset
|
959 |
} else if (stub_id == load_appendix_patching_id) { |
2f8ca425504e
7199175: JSR 292: C1 needs patching when invokedynamic/invokehandle call site is not linked
roland
parents:
19339
diff
changeset
|
960 |
Bytecode_invoke bytecode(caller_method, bci); |
2f8ca425504e
7199175: JSR 292: C1 needs patching when invokedynamic/invokehandle call site is not linked
roland
parents:
19339
diff
changeset
|
961 |
Bytecodes::Code bc = bytecode.invoke_code(); |
2f8ca425504e
7199175: JSR 292: C1 needs patching when invokedynamic/invokehandle call site is not linked
roland
parents:
19339
diff
changeset
|
962 |
|
2f8ca425504e
7199175: JSR 292: C1 needs patching when invokedynamic/invokehandle call site is not linked
roland
parents:
19339
diff
changeset
|
963 |
CallInfo info; |
2f8ca425504e
7199175: JSR 292: C1 needs patching when invokedynamic/invokehandle call site is not linked
roland
parents:
19339
diff
changeset
|
964 |
constantPoolHandle pool(thread, caller_method->constants()); |
2f8ca425504e
7199175: JSR 292: C1 needs patching when invokedynamic/invokehandle call site is not linked
roland
parents:
19339
diff
changeset
|
965 |
int index = bytecode.index(); |
2f8ca425504e
7199175: JSR 292: C1 needs patching when invokedynamic/invokehandle call site is not linked
roland
parents:
19339
diff
changeset
|
966 |
LinkResolver::resolve_invoke(info, Handle(), pool, index, bc, CHECK); |
2f8ca425504e
7199175: JSR 292: C1 needs patching when invokedynamic/invokehandle call site is not linked
roland
parents:
19339
diff
changeset
|
967 |
switch (bc) { |
2f8ca425504e
7199175: JSR 292: C1 needs patching when invokedynamic/invokehandle call site is not linked
roland
parents:
19339
diff
changeset
|
968 |
case Bytecodes::_invokehandle: { |
2f8ca425504e
7199175: JSR 292: C1 needs patching when invokedynamic/invokehandle call site is not linked
roland
parents:
19339
diff
changeset
|
969 |
int cache_index = ConstantPool::decode_cpcache_index(index, true); |
2f8ca425504e
7199175: JSR 292: C1 needs patching when invokedynamic/invokehandle call site is not linked
roland
parents:
19339
diff
changeset
|
970 |
assert(cache_index >= 0 && cache_index < pool->cache()->length(), "unexpected cache index"); |
35543
0961315f4016
8140659: C1: invokedynamic call patching violates JVMS-6.5.invokedynamic
vlivanov
parents:
35542
diff
changeset
|
971 |
ConstantPoolCacheEntry* cpce = pool->cache()->entry_at(cache_index); |
0961315f4016
8140659: C1: invokedynamic call patching violates JVMS-6.5.invokedynamic
vlivanov
parents:
35542
diff
changeset
|
972 |
cpce->set_method_handle(pool, info); |
35569
a2cdb4062a5d
8146983: C1: assert(appendix.not_null()) failed for invokehandle bytecode
vlivanov
parents:
35546
diff
changeset
|
973 |
appendix = cpce->appendix_if_resolved(pool); // just in case somebody already resolved the entry |
19710
2f8ca425504e
7199175: JSR 292: C1 needs patching when invokedynamic/invokehandle call site is not linked
roland
parents:
19339
diff
changeset
|
974 |
break; |
2f8ca425504e
7199175: JSR 292: C1 needs patching when invokedynamic/invokehandle call site is not linked
roland
parents:
19339
diff
changeset
|
975 |
} |
2f8ca425504e
7199175: JSR 292: C1 needs patching when invokedynamic/invokehandle call site is not linked
roland
parents:
19339
diff
changeset
|
976 |
case Bytecodes::_invokedynamic: { |
35543
0961315f4016
8140659: C1: invokedynamic call patching violates JVMS-6.5.invokedynamic
vlivanov
parents:
35542
diff
changeset
|
977 |
ConstantPoolCacheEntry* cpce = pool->invokedynamic_cp_cache_entry_at(index); |
0961315f4016
8140659: C1: invokedynamic call patching violates JVMS-6.5.invokedynamic
vlivanov
parents:
35542
diff
changeset
|
978 |
cpce->set_dynamic_call(pool, info); |
0961315f4016
8140659: C1: invokedynamic call patching violates JVMS-6.5.invokedynamic
vlivanov
parents:
35542
diff
changeset
|
979 |
appendix = cpce->appendix_if_resolved(pool); // just in case somebody already resolved the entry |
19710
2f8ca425504e
7199175: JSR 292: C1 needs patching when invokedynamic/invokehandle call site is not linked
roland
parents:
19339
diff
changeset
|
980 |
break; |
2f8ca425504e
7199175: JSR 292: C1 needs patching when invokedynamic/invokehandle call site is not linked
roland
parents:
19339
diff
changeset
|
981 |
} |
2f8ca425504e
7199175: JSR 292: C1 needs patching when invokedynamic/invokehandle call site is not linked
roland
parents:
19339
diff
changeset
|
982 |
default: fatal("unexpected bytecode for load_appendix_patching_id"); |
2f8ca425504e
7199175: JSR 292: C1 needs patching when invokedynamic/invokehandle call site is not linked
roland
parents:
19339
diff
changeset
|
983 |
} |
1 | 984 |
} else { |
985 |
ShouldNotReachHere(); |
|
986 |
} |
|
987 |
||
23189
27cf1316709b
8033380: Experimental VM flag to enforce access atomicity
shade
parents:
20703
diff
changeset
|
988 |
if (deoptimize_for_volatile || deoptimize_for_atomic) { |
27cf1316709b
8033380: Experimental VM flag to enforce access atomicity
shade
parents:
20703
diff
changeset
|
989 |
// At compile time we assumed the field wasn't volatile/atomic but after |
27cf1316709b
8033380: Experimental VM flag to enforce access atomicity
shade
parents:
20703
diff
changeset
|
990 |
// loading it turns out it was volatile/atomic so we have to throw the |
1 | 991 |
// compiled code out and let it be regenerated. |
992 |
if (TracePatching) { |
|
23189
27cf1316709b
8033380: Experimental VM flag to enforce access atomicity
shade
parents:
20703
diff
changeset
|
993 |
if (deoptimize_for_volatile) { |
27cf1316709b
8033380: Experimental VM flag to enforce access atomicity
shade
parents:
20703
diff
changeset
|
994 |
tty->print_cr("Deoptimizing for patching volatile field reference"); |
27cf1316709b
8033380: Experimental VM flag to enforce access atomicity
shade
parents:
20703
diff
changeset
|
995 |
} |
27cf1316709b
8033380: Experimental VM flag to enforce access atomicity
shade
parents:
20703
diff
changeset
|
996 |
if (deoptimize_for_atomic) { |
27cf1316709b
8033380: Experimental VM flag to enforce access atomicity
shade
parents:
20703
diff
changeset
|
997 |
tty->print_cr("Deoptimizing for patching atomic field reference"); |
27cf1316709b
8033380: Experimental VM flag to enforce access atomicity
shade
parents:
20703
diff
changeset
|
998 |
} |
1 | 999 |
} |
23189
27cf1316709b
8033380: Experimental VM flag to enforce access atomicity
shade
parents:
20703
diff
changeset
|
1000 |
|
1672
ae4d91125c2d
6767587: missing call to make_not_entrant after deoptimizing for patching volatiles
never
parents:
1394
diff
changeset
|
1001 |
// It's possible the nmethod was invalidated in the last |
ae4d91125c2d
6767587: missing call to make_not_entrant after deoptimizing for patching volatiles
never
parents:
1394
diff
changeset
|
1002 |
// safepoint, but if it's still alive then make it not_entrant. |
ae4d91125c2d
6767587: missing call to make_not_entrant after deoptimizing for patching volatiles
never
parents:
1394
diff
changeset
|
1003 |
nmethod* nm = CodeCache::find_nmethod(caller_frame.pc()); |
ae4d91125c2d
6767587: missing call to make_not_entrant after deoptimizing for patching volatiles
never
parents:
1394
diff
changeset
|
1004 |
if (nm != NULL) { |
ae4d91125c2d
6767587: missing call to make_not_entrant after deoptimizing for patching volatiles
never
parents:
1394
diff
changeset
|
1005 |
nm->make_not_entrant(); |
ae4d91125c2d
6767587: missing call to make_not_entrant after deoptimizing for patching volatiles
never
parents:
1394
diff
changeset
|
1006 |
} |
ae4d91125c2d
6767587: missing call to make_not_entrant after deoptimizing for patching volatiles
never
parents:
1394
diff
changeset
|
1007 |
|
7106
867c9d296c6b
6968367: can_post_on_exceptions is still using VM_DeoptimizeFrame in some places
never
parents:
6453
diff
changeset
|
1008 |
Deoptimization::deoptimize_frame(thread, caller_frame.id()); |
1 | 1009 |
|
1010 |
// Return to the now deoptimized frame. |
|
1011 |
} |
|
1012 |
||
1013 |
// Now copy code back |
|
1014 |
||
1015 |
{ |
|
1016 |
MutexLockerEx ml_patch (Patching_lock, Mutex::_no_safepoint_check_flag); |
|
1017 |
// |
|
1018 |
// Deoptimization may have happened while we waited for the lock. |
|
1019 |
// In that case we don't bother to do any patching we just return |
|
1020 |
// and let the deopt happen |
|
1021 |
if (!caller_is_deopted()) { |
|
1022 |
NativeGeneralJump* jump = nativeGeneralJump_at(caller_frame.pc()); |
|
1023 |
address instr_pc = jump->jump_destination(); |
|
1024 |
NativeInstruction* ni = nativeInstruction_at(instr_pc); |
|
1025 |
if (ni->is_jump() ) { |
|
1026 |
// the jump has not been patched yet |
|
1027 |
// The jump destination is slow case and therefore not part of the stubs |
|
1028 |
// (stubs are only for StaticCalls) |
|
1029 |
||
1030 |
// format of buffer |
|
1031 |
// .... |
|
1032 |
// instr byte 0 <-- copy_buff |
|
1033 |
// instr byte 1 |
|
1034 |
// .. |
|
1035 |
// instr byte n-1 |
|
1036 |
// n |
|
1037 |
// .... <-- call destination |
|
1038 |
||
1039 |
address stub_location = caller_frame.pc() + PatchingStub::patch_info_offset(); |
|
1040 |
unsigned char* byte_count = (unsigned char*) (stub_location - 1); |
|
1041 |
unsigned char* byte_skip = (unsigned char*) (stub_location - 2); |
|
1042 |
unsigned char* being_initialized_entry_offset = (unsigned char*) (stub_location - 3); |
|
1043 |
address copy_buff = stub_location - *byte_skip - *byte_count; |
|
1044 |
address being_initialized_entry = stub_location - *being_initialized_entry_offset; |
|
1045 |
if (TracePatching) { |
|
35542
9dccb7f9f656
8071374: -XX:+PrintAssembly -XX:+PrintSignatureHandlers crash fastdebug VM with assert(limit == __null || limit <= nm->code_end()) in RelocIterator::initialize
vlivanov
parents:
35540
diff
changeset
|
1046 |
ttyLocker ttyl; |
24424
2658d7834c6e
8037816: Fix for 8036122 breaks build with Xcode5/clang
drchase
parents:
23189
diff
changeset
|
1047 |
tty->print_cr(" Patching %s at bci %d at address " INTPTR_FORMAT " (%s)", Bytecodes::name(code), bci, |
2658d7834c6e
8037816: Fix for 8036122 breaks build with Xcode5/clang
drchase
parents:
23189
diff
changeset
|
1048 |
p2i(instr_pc), (stub_id == Runtime1::access_field_patching_id) ? "field" : "klass"); |
1 | 1049 |
nmethod* caller_code = CodeCache::find_nmethod(caller_frame.pc()); |
1050 |
assert(caller_code != NULL, "nmethod not found"); |
|
1051 |
||
1052 |
// NOTE we use pc() not original_pc() because we already know they are |
|
1053 |
// identical otherwise we'd have never entered this block of code |
|
1054 |
||
30590 | 1055 |
const ImmutableOopMap* map = caller_code->oop_map_for_return_address(caller_frame.pc()); |
1 | 1056 |
assert(map != NULL, "null check"); |
1057 |
map->print(); |
|
1058 |
tty->cr(); |
|
1059 |
||
1060 |
Disassembler::decode(copy_buff, copy_buff + *byte_count, tty); |
|
1061 |
} |
|
1062 |
// depending on the code below, do_patch says whether to copy the patch body back into the nmethod |
|
1063 |
bool do_patch = true; |
|
1064 |
if (stub_id == Runtime1::access_field_patching_id) { |
|
1065 |
// The offset may not be correct if the class was not loaded at code generation time. |
|
1066 |
// Set it now. |
|
1067 |
NativeMovRegMem* n_move = nativeMovRegMem_at(copy_buff); |
|
1068 |
assert(n_move->offset() == 0 || (n_move->offset() == 4 && (patch_field_type == T_DOUBLE || patch_field_type == T_LONG)), "illegal offset for type"); |
|
1069 |
assert(patch_field_offset >= 0, "illegal offset"); |
|
1070 |
n_move->add_offset_in_bytes(patch_field_offset); |
|
13728
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
12949
diff
changeset
|
1071 |
} else if (load_klass_or_mirror_patch_id) { |
1 | 1072 |
// If a getstatic or putstatic is referencing a klass which |
1073 |
// isn't fully initialized, the patch body isn't copied into |
|
1074 |
// place until initialization is complete. In this case the |
|
1075 |
// patch site is setup so that any threads besides the |
|
1076 |
// initializing thread are forced to come into the VM and |
|
1077 |
// block. |
|
1078 |
do_patch = (code != Bytecodes::_getstatic && code != Bytecodes::_putstatic) || |
|
13728
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
12949
diff
changeset
|
1079 |
InstanceKlass::cast(init_klass())->is_initialized(); |
1 | 1080 |
NativeGeneralJump* jump = nativeGeneralJump_at(instr_pc); |
1081 |
if (jump->jump_destination() == being_initialized_entry) { |
|
1082 |
assert(do_patch == true, "initialization must be complete at this point"); |
|
1083 |
} else { |
|
1084 |
// patch the instruction <move reg, klass> |
|
1085 |
NativeMovConstReg* n_copy = nativeMovConstReg_at(copy_buff); |
|
6176
4d9030fe341f
6953477: Increase portability and flexibility of building Hotspot
bobv
parents:
5883
diff
changeset
|
1086 |
|
4d9030fe341f
6953477: Increase portability and flexibility of building Hotspot
bobv
parents:
5883
diff
changeset
|
1087 |
assert(n_copy->data() == 0 || |
6453 | 1088 |
n_copy->data() == (intptr_t)Universe::non_oop_word(), |
6176
4d9030fe341f
6953477: Increase portability and flexibility of building Hotspot
bobv
parents:
5883
diff
changeset
|
1089 |
"illegal init value"); |
13728
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
12949
diff
changeset
|
1090 |
if (stub_id == Runtime1::load_klass_patching_id) { |
19710
2f8ca425504e
7199175: JSR 292: C1 needs patching when invokedynamic/invokehandle call site is not linked
roland
parents:
19339
diff
changeset
|
1091 |
assert(load_klass() != NULL, "klass not set"); |
2f8ca425504e
7199175: JSR 292: C1 needs patching when invokedynamic/invokehandle call site is not linked
roland
parents:
19339
diff
changeset
|
1092 |
n_copy->set_data((intx) (load_klass())); |
13728
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
12949
diff
changeset
|
1093 |
} else { |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
12949
diff
changeset
|
1094 |
assert(mirror() != NULL, "klass not set"); |
25492
d27050bdfb04
8049421: G1 Class Unloading after completing a concurrent mark cycle
stefank
parents:
25491
diff
changeset
|
1095 |
// Don't need a G1 pre-barrier here since we assert above that data isn't an oop. |
20282
7f9cbdf89af2
7195622: CheckUnhandledOops has limited usefulness now
hseigel
parents:
20017
diff
changeset
|
1096 |
n_copy->set_data(cast_from_oop<intx>(mirror())); |
13728
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
12949
diff
changeset
|
1097 |
} |
1 | 1098 |
|
1099 |
if (TracePatching) { |
|
1100 |
Disassembler::decode(copy_buff, copy_buff + *byte_count, tty); |
|
1101 |
} |
|
19710
2f8ca425504e
7199175: JSR 292: C1 needs patching when invokedynamic/invokehandle call site is not linked
roland
parents:
19339
diff
changeset
|
1102 |
} |
2f8ca425504e
7199175: JSR 292: C1 needs patching when invokedynamic/invokehandle call site is not linked
roland
parents:
19339
diff
changeset
|
1103 |
} else if (stub_id == Runtime1::load_appendix_patching_id) { |
2f8ca425504e
7199175: JSR 292: C1 needs patching when invokedynamic/invokehandle call site is not linked
roland
parents:
19339
diff
changeset
|
1104 |
NativeMovConstReg* n_copy = nativeMovConstReg_at(copy_buff); |
2f8ca425504e
7199175: JSR 292: C1 needs patching when invokedynamic/invokehandle call site is not linked
roland
parents:
19339
diff
changeset
|
1105 |
assert(n_copy->data() == 0 || |
2f8ca425504e
7199175: JSR 292: C1 needs patching when invokedynamic/invokehandle call site is not linked
roland
parents:
19339
diff
changeset
|
1106 |
n_copy->data() == (intptr_t)Universe::non_oop_word(), |
2f8ca425504e
7199175: JSR 292: C1 needs patching when invokedynamic/invokehandle call site is not linked
roland
parents:
19339
diff
changeset
|
1107 |
"illegal init value"); |
20282
7f9cbdf89af2
7195622: CheckUnhandledOops has limited usefulness now
hseigel
parents:
20017
diff
changeset
|
1108 |
n_copy->set_data(cast_from_oop<intx>(appendix())); |
1 | 1109 |
|
19710
2f8ca425504e
7199175: JSR 292: C1 needs patching when invokedynamic/invokehandle call site is not linked
roland
parents:
19339
diff
changeset
|
1110 |
if (TracePatching) { |
2f8ca425504e
7199175: JSR 292: C1 needs patching when invokedynamic/invokehandle call site is not linked
roland
parents:
19339
diff
changeset
|
1111 |
Disassembler::decode(copy_buff, copy_buff + *byte_count, tty); |
1 | 1112 |
} |
1113 |
} else { |
|
1114 |
ShouldNotReachHere(); |
|
1115 |
} |
|
13728
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
12949
diff
changeset
|
1116 |
|
34220 | 1117 |
#if defined(SPARC) || defined(PPC32) |
19710
2f8ca425504e
7199175: JSR 292: C1 needs patching when invokedynamic/invokehandle call site is not linked
roland
parents:
19339
diff
changeset
|
1118 |
if (load_klass_or_mirror_patch_id || |
2f8ca425504e
7199175: JSR 292: C1 needs patching when invokedynamic/invokehandle call site is not linked
roland
parents:
19339
diff
changeset
|
1119 |
stub_id == Runtime1::load_appendix_patching_id) { |
2f8ca425504e
7199175: JSR 292: C1 needs patching when invokedynamic/invokehandle call site is not linked
roland
parents:
19339
diff
changeset
|
1120 |
// Update the location in the nmethod with the proper |
2f8ca425504e
7199175: JSR 292: C1 needs patching when invokedynamic/invokehandle call site is not linked
roland
parents:
19339
diff
changeset
|
1121 |
// metadata. When the code was generated, a NULL was stuffed |
2f8ca425504e
7199175: JSR 292: C1 needs patching when invokedynamic/invokehandle call site is not linked
roland
parents:
19339
diff
changeset
|
1122 |
// in the metadata table and that table needs to be update to |
2f8ca425504e
7199175: JSR 292: C1 needs patching when invokedynamic/invokehandle call site is not linked
roland
parents:
19339
diff
changeset
|
1123 |
// have the right value. On intel the value is kept |
2f8ca425504e
7199175: JSR 292: C1 needs patching when invokedynamic/invokehandle call site is not linked
roland
parents:
19339
diff
changeset
|
1124 |
// directly in the instruction instead of in the metadata |
2f8ca425504e
7199175: JSR 292: C1 needs patching when invokedynamic/invokehandle call site is not linked
roland
parents:
19339
diff
changeset
|
1125 |
// table, so set_data above effectively updated the value. |
2f8ca425504e
7199175: JSR 292: C1 needs patching when invokedynamic/invokehandle call site is not linked
roland
parents:
19339
diff
changeset
|
1126 |
nmethod* nm = CodeCache::find_nmethod(instr_pc); |
2f8ca425504e
7199175: JSR 292: C1 needs patching when invokedynamic/invokehandle call site is not linked
roland
parents:
19339
diff
changeset
|
1127 |
assert(nm != NULL, "invalid nmethod_pc"); |
2f8ca425504e
7199175: JSR 292: C1 needs patching when invokedynamic/invokehandle call site is not linked
roland
parents:
19339
diff
changeset
|
1128 |
RelocIterator mds(nm, copy_buff, copy_buff + 1); |
2f8ca425504e
7199175: JSR 292: C1 needs patching when invokedynamic/invokehandle call site is not linked
roland
parents:
19339
diff
changeset
|
1129 |
bool found = false; |
2f8ca425504e
7199175: JSR 292: C1 needs patching when invokedynamic/invokehandle call site is not linked
roland
parents:
19339
diff
changeset
|
1130 |
while (mds.next() && !found) { |
2f8ca425504e
7199175: JSR 292: C1 needs patching when invokedynamic/invokehandle call site is not linked
roland
parents:
19339
diff
changeset
|
1131 |
if (mds.type() == relocInfo::oop_type) { |
2f8ca425504e
7199175: JSR 292: C1 needs patching when invokedynamic/invokehandle call site is not linked
roland
parents:
19339
diff
changeset
|
1132 |
assert(stub_id == Runtime1::load_mirror_patching_id || |
2f8ca425504e
7199175: JSR 292: C1 needs patching when invokedynamic/invokehandle call site is not linked
roland
parents:
19339
diff
changeset
|
1133 |
stub_id == Runtime1::load_appendix_patching_id, "wrong stub id"); |
2f8ca425504e
7199175: JSR 292: C1 needs patching when invokedynamic/invokehandle call site is not linked
roland
parents:
19339
diff
changeset
|
1134 |
oop_Relocation* r = mds.oop_reloc(); |
2f8ca425504e
7199175: JSR 292: C1 needs patching when invokedynamic/invokehandle call site is not linked
roland
parents:
19339
diff
changeset
|
1135 |
oop* oop_adr = r->oop_addr(); |
2f8ca425504e
7199175: JSR 292: C1 needs patching when invokedynamic/invokehandle call site is not linked
roland
parents:
19339
diff
changeset
|
1136 |
*oop_adr = stub_id == Runtime1::load_mirror_patching_id ? mirror() : appendix(); |
2f8ca425504e
7199175: JSR 292: C1 needs patching when invokedynamic/invokehandle call site is not linked
roland
parents:
19339
diff
changeset
|
1137 |
r->fix_oop_relocation(); |
2f8ca425504e
7199175: JSR 292: C1 needs patching when invokedynamic/invokehandle call site is not linked
roland
parents:
19339
diff
changeset
|
1138 |
found = true; |
2f8ca425504e
7199175: JSR 292: C1 needs patching when invokedynamic/invokehandle call site is not linked
roland
parents:
19339
diff
changeset
|
1139 |
} else if (mds.type() == relocInfo::metadata_type) { |
2f8ca425504e
7199175: JSR 292: C1 needs patching when invokedynamic/invokehandle call site is not linked
roland
parents:
19339
diff
changeset
|
1140 |
assert(stub_id == Runtime1::load_klass_patching_id, "wrong stub id"); |
2f8ca425504e
7199175: JSR 292: C1 needs patching when invokedynamic/invokehandle call site is not linked
roland
parents:
19339
diff
changeset
|
1141 |
metadata_Relocation* r = mds.metadata_reloc(); |
2f8ca425504e
7199175: JSR 292: C1 needs patching when invokedynamic/invokehandle call site is not linked
roland
parents:
19339
diff
changeset
|
1142 |
Metadata** metadata_adr = r->metadata_addr(); |
2f8ca425504e
7199175: JSR 292: C1 needs patching when invokedynamic/invokehandle call site is not linked
roland
parents:
19339
diff
changeset
|
1143 |
*metadata_adr = load_klass(); |
2f8ca425504e
7199175: JSR 292: C1 needs patching when invokedynamic/invokehandle call site is not linked
roland
parents:
19339
diff
changeset
|
1144 |
r->fix_metadata_relocation(); |
2f8ca425504e
7199175: JSR 292: C1 needs patching when invokedynamic/invokehandle call site is not linked
roland
parents:
19339
diff
changeset
|
1145 |
found = true; |
2f8ca425504e
7199175: JSR 292: C1 needs patching when invokedynamic/invokehandle call site is not linked
roland
parents:
19339
diff
changeset
|
1146 |
} |
2f8ca425504e
7199175: JSR 292: C1 needs patching when invokedynamic/invokehandle call site is not linked
roland
parents:
19339
diff
changeset
|
1147 |
} |
2f8ca425504e
7199175: JSR 292: C1 needs patching when invokedynamic/invokehandle call site is not linked
roland
parents:
19339
diff
changeset
|
1148 |
assert(found, "the metadata must exist!"); |
2f8ca425504e
7199175: JSR 292: C1 needs patching when invokedynamic/invokehandle call site is not linked
roland
parents:
19339
diff
changeset
|
1149 |
} |
2f8ca425504e
7199175: JSR 292: C1 needs patching when invokedynamic/invokehandle call site is not linked
roland
parents:
19339
diff
changeset
|
1150 |
#endif |
1 | 1151 |
if (do_patch) { |
1152 |
// replace instructions |
|
1153 |
// first replace the tail, then the call |
|
6176
4d9030fe341f
6953477: Increase portability and flexibility of building Hotspot
bobv
parents:
5883
diff
changeset
|
1154 |
#ifdef ARM |
20301
7a16289e8bef
8024990: JT_JDK: 11 failures with SIGSEGV on arm-sflt platforms in nightly fastdebug build.
jiangli
parents:
19710
diff
changeset
|
1155 |
if((load_klass_or_mirror_patch_id || |
7a16289e8bef
8024990: JT_JDK: 11 failures with SIGSEGV on arm-sflt platforms in nightly fastdebug build.
jiangli
parents:
19710
diff
changeset
|
1156 |
stub_id == Runtime1::load_appendix_patching_id) && |
29474
81a5c5330d08
8072383: resolve conflicts between open and closed ports
dlong
parents:
29180
diff
changeset
|
1157 |
nativeMovConstReg_at(copy_buff)->is_pc_relative()) { |
9318
c7acc13a9226
7035861: linux-armsflt: assert(ni->data() == (int)(x + o)) failed: instructions must match
vladidan
parents:
9102
diff
changeset
|
1158 |
nmethod* nm = CodeCache::find_nmethod(instr_pc); |
13728
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
12949
diff
changeset
|
1159 |
address addr = NULL; |
9318
c7acc13a9226
7035861: linux-armsflt: assert(ni->data() == (int)(x + o)) failed: instructions must match
vladidan
parents:
9102
diff
changeset
|
1160 |
assert(nm != NULL, "invalid nmethod_pc"); |
13728
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
12949
diff
changeset
|
1161 |
RelocIterator mds(nm, copy_buff, copy_buff + 1); |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
12949
diff
changeset
|
1162 |
while (mds.next()) { |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
12949
diff
changeset
|
1163 |
if (mds.type() == relocInfo::oop_type) { |
20301
7a16289e8bef
8024990: JT_JDK: 11 failures with SIGSEGV on arm-sflt platforms in nightly fastdebug build.
jiangli
parents:
19710
diff
changeset
|
1164 |
assert(stub_id == Runtime1::load_mirror_patching_id || |
7a16289e8bef
8024990: JT_JDK: 11 failures with SIGSEGV on arm-sflt platforms in nightly fastdebug build.
jiangli
parents:
19710
diff
changeset
|
1165 |
stub_id == Runtime1::load_appendix_patching_id, "wrong stub id"); |
13728
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
12949
diff
changeset
|
1166 |
oop_Relocation* r = mds.oop_reloc(); |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
12949
diff
changeset
|
1167 |
addr = (address)r->oop_addr(); |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
12949
diff
changeset
|
1168 |
break; |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
12949
diff
changeset
|
1169 |
} else if (mds.type() == relocInfo::metadata_type) { |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
12949
diff
changeset
|
1170 |
assert(stub_id == Runtime1::load_klass_patching_id, "wrong stub id"); |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
12949
diff
changeset
|
1171 |
metadata_Relocation* r = mds.metadata_reloc(); |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
12949
diff
changeset
|
1172 |
addr = (address)r->metadata_addr(); |
9318
c7acc13a9226
7035861: linux-armsflt: assert(ni->data() == (int)(x + o)) failed: instructions must match
vladidan
parents:
9102
diff
changeset
|
1173 |
break; |
c7acc13a9226
7035861: linux-armsflt: assert(ni->data() == (int)(x + o)) failed: instructions must match
vladidan
parents:
9102
diff
changeset
|
1174 |
} |
c7acc13a9226
7035861: linux-armsflt: assert(ni->data() == (int)(x + o)) failed: instructions must match
vladidan
parents:
9102
diff
changeset
|
1175 |
} |
13728
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
12949
diff
changeset
|
1176 |
assert(addr != NULL, "metadata relocation must exist"); |
6176
4d9030fe341f
6953477: Increase portability and flexibility of building Hotspot
bobv
parents:
5883
diff
changeset
|
1177 |
copy_buff -= *byte_count; |
4d9030fe341f
6953477: Increase portability and flexibility of building Hotspot
bobv
parents:
5883
diff
changeset
|
1178 |
NativeMovConstReg* n_copy2 = nativeMovConstReg_at(copy_buff); |
13728
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
12949
diff
changeset
|
1179 |
n_copy2->set_pc_relative_offset(addr, instr_pc); |
6176
4d9030fe341f
6953477: Increase portability and flexibility of building Hotspot
bobv
parents:
5883
diff
changeset
|
1180 |
} |
4d9030fe341f
6953477: Increase portability and flexibility of building Hotspot
bobv
parents:
5883
diff
changeset
|
1181 |
#endif |
4d9030fe341f
6953477: Increase portability and flexibility of building Hotspot
bobv
parents:
5883
diff
changeset
|
1182 |
|
34500
3c82f7ac03e6
8138896: C1: NativeGeneralJump is mixed up with NativeCall in C1 patching code
mdoerr
parents:
34220
diff
changeset
|
1183 |
for (int i = NativeGeneralJump::instruction_size; i < *byte_count; i++) { |
1 | 1184 |
address ptr = copy_buff + i; |
1185 |
int a_byte = (*ptr) & 0xFF; |
|
1186 |
address dst = instr_pc + i; |
|
1187 |
*(unsigned char*)dst = (unsigned char) a_byte; |
|
1188 |
} |
|
1189 |
ICache::invalidate_range(instr_pc, *byte_count); |
|
1190 |
NativeGeneralJump::replace_mt_safe(instr_pc, copy_buff); |
|
1191 |
||
19710
2f8ca425504e
7199175: JSR 292: C1 needs patching when invokedynamic/invokehandle call site is not linked
roland
parents:
19339
diff
changeset
|
1192 |
if (load_klass_or_mirror_patch_id || |
2f8ca425504e
7199175: JSR 292: C1 needs patching when invokedynamic/invokehandle call site is not linked
roland
parents:
19339
diff
changeset
|
1193 |
stub_id == Runtime1::load_appendix_patching_id) { |
13728
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
12949
diff
changeset
|
1194 |
relocInfo::relocType rtype = |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
12949
diff
changeset
|
1195 |
(stub_id == Runtime1::load_klass_patching_id) ? |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
12949
diff
changeset
|
1196 |
relocInfo::metadata_type : |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
12949
diff
changeset
|
1197 |
relocInfo::oop_type; |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
12949
diff
changeset
|
1198 |
// update relocInfo to metadata |
1 | 1199 |
nmethod* nm = CodeCache::find_nmethod(instr_pc); |
1200 |
assert(nm != NULL, "invalid nmethod_pc"); |
|
1201 |
||
1202 |
// The old patch site is now a move instruction so update |
|
1203 |
// the reloc info so that it will get updated during |
|
1204 |
// future GCs. |
|
1205 |
RelocIterator iter(nm, (address)instr_pc, (address)(instr_pc + 1)); |
|
1206 |
relocInfo::change_reloc_info_for_address(&iter, (address) instr_pc, |
|
13728
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
12949
diff
changeset
|
1207 |
relocInfo::none, rtype); |
1 | 1208 |
#ifdef SPARC |
13728
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
12949
diff
changeset
|
1209 |
// Sparc takes two relocations for an metadata so update the second one. |
1 | 1210 |
address instr_pc2 = instr_pc + NativeMovConstReg::add_offset; |
1211 |
RelocIterator iter2(nm, instr_pc2, instr_pc2 + 1); |
|
1212 |
relocInfo::change_reloc_info_for_address(&iter2, (address) instr_pc2, |
|
13728
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
12949
diff
changeset
|
1213 |
relocInfo::none, rtype); |
1 | 1214 |
#endif |
34220 | 1215 |
#ifdef PPC32 |
6176
4d9030fe341f
6953477: Increase portability and flexibility of building Hotspot
bobv
parents:
5883
diff
changeset
|
1216 |
{ address instr_pc2 = instr_pc + NativeMovConstReg::lo_offset; |
4d9030fe341f
6953477: Increase portability and flexibility of building Hotspot
bobv
parents:
5883
diff
changeset
|
1217 |
RelocIterator iter2(nm, instr_pc2, instr_pc2 + 1); |
13728
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
12949
diff
changeset
|
1218 |
relocInfo::change_reloc_info_for_address(&iter2, (address) instr_pc2, |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
12949
diff
changeset
|
1219 |
relocInfo::none, rtype); |
6176
4d9030fe341f
6953477: Increase portability and flexibility of building Hotspot
bobv
parents:
5883
diff
changeset
|
1220 |
} |
4d9030fe341f
6953477: Increase portability and flexibility of building Hotspot
bobv
parents:
5883
diff
changeset
|
1221 |
#endif |
1 | 1222 |
} |
1223 |
||
1224 |
} else { |
|
1225 |
ICache::invalidate_range(copy_buff, *byte_count); |
|
1226 |
NativeGeneralJump::insert_unconditional(instr_pc, being_initialized_entry); |
|
1227 |
} |
|
1228 |
} |
|
1229 |
} |
|
1230 |
} |
|
19339 | 1231 |
|
1232 |
// If we are patching in a non-perm oop, make sure the nmethod |
|
1233 |
// is on the right list. |
|
19710
2f8ca425504e
7199175: JSR 292: C1 needs patching when invokedynamic/invokehandle call site is not linked
roland
parents:
19339
diff
changeset
|
1234 |
if (ScavengeRootsInCode && ((mirror.not_null() && mirror()->is_scavengable()) || |
2f8ca425504e
7199175: JSR 292: C1 needs patching when invokedynamic/invokehandle call site is not linked
roland
parents:
19339
diff
changeset
|
1235 |
(appendix.not_null() && appendix->is_scavengable()))) { |
19339 | 1236 |
MutexLockerEx ml_code (CodeCache_lock, Mutex::_no_safepoint_check_flag); |
1237 |
nmethod* nm = CodeCache::find_nmethod(caller_frame.pc()); |
|
1238 |
guarantee(nm != NULL, "only nmethods can contain non-perm oops"); |
|
1239 |
if (!nm->on_scavenge_root_list()) { |
|
1240 |
CodeCache::add_scavenge_root_nmethod(nm); |
|
1241 |
} |
|
1242 |
||
1243 |
// Since we've patched some oops in the nmethod, |
|
1244 |
// (re)register it with the heap. |
|
1245 |
Universe::heap()->register_nmethod(nm); |
|
1246 |
} |
|
1 | 1247 |
JRT_END |
1248 |
||
29180 | 1249 |
#else // DEOPTIMIZE_WHEN_PATCHING |
1250 |
||
1251 |
JRT_ENTRY(void, Runtime1::patch_code(JavaThread* thread, Runtime1::StubID stub_id )) |
|
1252 |
RegisterMap reg_map(thread, false); |
|
1253 |
||
1254 |
NOT_PRODUCT(_patch_code_slowcase_cnt++;) |
|
1255 |
if (TracePatching) { |
|
1256 |
tty->print_cr("Deoptimizing because patch is needed"); |
|
1257 |
} |
|
1258 |
||
1259 |
frame runtime_frame = thread->last_frame(); |
|
1260 |
frame caller_frame = runtime_frame.sender(®_map); |
|
1261 |
||
1262 |
// It's possible the nmethod was invalidated in the last |
|
1263 |
// safepoint, but if it's still alive then make it not_entrant. |
|
1264 |
nmethod* nm = CodeCache::find_nmethod(caller_frame.pc()); |
|
1265 |
if (nm != NULL) { |
|
1266 |
nm->make_not_entrant(); |
|
1267 |
} |
|
1268 |
||
1269 |
Deoptimization::deoptimize_frame(thread, caller_frame.id()); |
|
1270 |
||
1271 |
// Return to the now deoptimized frame. |
|
1272 |
JRT_END |
|
1273 |
||
1274 |
#endif // DEOPTIMIZE_WHEN_PATCHING |
|
1275 |
||
1 | 1276 |
// |
1277 |
// Entry point for compiled code. We want to patch a nmethod. |
|
1278 |
// We don't do a normal VM transition here because we want to |
|
1279 |
// know after the patching is complete and any safepoint(s) are taken |
|
1280 |
// if the calling nmethod was deoptimized. We do this by calling a |
|
1281 |
// helper method which does the normal VM transition and when it |
|
1282 |
// completes we can check for deoptimization. This simplifies the |
|
1283 |
// assembly code in the cpu directories. |
|
1284 |
// |
|
1285 |
int Runtime1::move_klass_patching(JavaThread* thread) { |
|
1286 |
// |
|
1287 |
// NOTE: we are still in Java |
|
1288 |
// |
|
1289 |
Thread* THREAD = thread; |
|
1290 |
debug_only(NoHandleMark nhm;) |
|
1291 |
{ |
|
1292 |
// Enter VM mode |
|
1293 |
||
1294 |
ResetNoHandleMark rnhm; |
|
1295 |
patch_code(thread, load_klass_patching_id); |
|
1296 |
} |
|
1297 |
// Back in JAVA, use no oops DON'T safepoint |
|
1298 |
||
1299 |
// Return true if calling code is deoptimized |
|
1300 |
||
1301 |
return caller_is_deopted(); |
|
1302 |
} |
|
1303 |
||
13728
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
12949
diff
changeset
|
1304 |
int Runtime1::move_mirror_patching(JavaThread* thread) { |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
12949
diff
changeset
|
1305 |
// |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
12949
diff
changeset
|
1306 |
// NOTE: we are still in Java |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
12949
diff
changeset
|
1307 |
// |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
12949
diff
changeset
|
1308 |
Thread* THREAD = thread; |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
12949
diff
changeset
|
1309 |
debug_only(NoHandleMark nhm;) |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
12949
diff
changeset
|
1310 |
{ |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
12949
diff
changeset
|
1311 |
// Enter VM mode |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
12949
diff
changeset
|
1312 |
|
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
12949
diff
changeset
|
1313 |
ResetNoHandleMark rnhm; |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
12949
diff
changeset
|
1314 |
patch_code(thread, load_mirror_patching_id); |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
12949
diff
changeset
|
1315 |
} |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
12949
diff
changeset
|
1316 |
// Back in JAVA, use no oops DON'T safepoint |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
12949
diff
changeset
|
1317 |
|
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
12949
diff
changeset
|
1318 |
// Return true if calling code is deoptimized |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
12949
diff
changeset
|
1319 |
|
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
12949
diff
changeset
|
1320 |
return caller_is_deopted(); |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
12949
diff
changeset
|
1321 |
} |
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
12949
diff
changeset
|
1322 |
|
19710
2f8ca425504e
7199175: JSR 292: C1 needs patching when invokedynamic/invokehandle call site is not linked
roland
parents:
19339
diff
changeset
|
1323 |
int Runtime1::move_appendix_patching(JavaThread* thread) { |
2f8ca425504e
7199175: JSR 292: C1 needs patching when invokedynamic/invokehandle call site is not linked
roland
parents:
19339
diff
changeset
|
1324 |
// |
2f8ca425504e
7199175: JSR 292: C1 needs patching when invokedynamic/invokehandle call site is not linked
roland
parents:
19339
diff
changeset
|
1325 |
// NOTE: we are still in Java |
2f8ca425504e
7199175: JSR 292: C1 needs patching when invokedynamic/invokehandle call site is not linked
roland
parents:
19339
diff
changeset
|
1326 |
// |
2f8ca425504e
7199175: JSR 292: C1 needs patching when invokedynamic/invokehandle call site is not linked
roland
parents:
19339
diff
changeset
|
1327 |
Thread* THREAD = thread; |
2f8ca425504e
7199175: JSR 292: C1 needs patching when invokedynamic/invokehandle call site is not linked
roland
parents:
19339
diff
changeset
|
1328 |
debug_only(NoHandleMark nhm;) |
2f8ca425504e
7199175: JSR 292: C1 needs patching when invokedynamic/invokehandle call site is not linked
roland
parents:
19339
diff
changeset
|
1329 |
{ |
2f8ca425504e
7199175: JSR 292: C1 needs patching when invokedynamic/invokehandle call site is not linked
roland
parents:
19339
diff
changeset
|
1330 |
// Enter VM mode |
2f8ca425504e
7199175: JSR 292: C1 needs patching when invokedynamic/invokehandle call site is not linked
roland
parents:
19339
diff
changeset
|
1331 |
|
2f8ca425504e
7199175: JSR 292: C1 needs patching when invokedynamic/invokehandle call site is not linked
roland
parents:
19339
diff
changeset
|
1332 |
ResetNoHandleMark rnhm; |
2f8ca425504e
7199175: JSR 292: C1 needs patching when invokedynamic/invokehandle call site is not linked
roland
parents:
19339
diff
changeset
|
1333 |
patch_code(thread, load_appendix_patching_id); |
2f8ca425504e
7199175: JSR 292: C1 needs patching when invokedynamic/invokehandle call site is not linked
roland
parents:
19339
diff
changeset
|
1334 |
} |
2f8ca425504e
7199175: JSR 292: C1 needs patching when invokedynamic/invokehandle call site is not linked
roland
parents:
19339
diff
changeset
|
1335 |
// Back in JAVA, use no oops DON'T safepoint |
2f8ca425504e
7199175: JSR 292: C1 needs patching when invokedynamic/invokehandle call site is not linked
roland
parents:
19339
diff
changeset
|
1336 |
|
2f8ca425504e
7199175: JSR 292: C1 needs patching when invokedynamic/invokehandle call site is not linked
roland
parents:
19339
diff
changeset
|
1337 |
// Return true if calling code is deoptimized |
2f8ca425504e
7199175: JSR 292: C1 needs patching when invokedynamic/invokehandle call site is not linked
roland
parents:
19339
diff
changeset
|
1338 |
|
2f8ca425504e
7199175: JSR 292: C1 needs patching when invokedynamic/invokehandle call site is not linked
roland
parents:
19339
diff
changeset
|
1339 |
return caller_is_deopted(); |
2f8ca425504e
7199175: JSR 292: C1 needs patching when invokedynamic/invokehandle call site is not linked
roland
parents:
19339
diff
changeset
|
1340 |
} |
1 | 1341 |
// |
1342 |
// Entry point for compiled code. We want to patch a nmethod. |
|
1343 |
// We don't do a normal VM transition here because we want to |
|
1344 |
// know after the patching is complete and any safepoint(s) are taken |
|
1345 |
// if the calling nmethod was deoptimized. We do this by calling a |
|
1346 |
// helper method which does the normal VM transition and when it |
|
1347 |
// completes we can check for deoptimization. This simplifies the |
|
1348 |
// assembly code in the cpu directories. |
|
1349 |
// |
|
1350 |
||
1351 |
int Runtime1::access_field_patching(JavaThread* thread) { |
|
1352 |
// |
|
1353 |
// NOTE: we are still in Java |
|
1354 |
// |
|
1355 |
Thread* THREAD = thread; |
|
1356 |
debug_only(NoHandleMark nhm;) |
|
1357 |
{ |
|
1358 |
// Enter VM mode |
|
1359 |
||
1360 |
ResetNoHandleMark rnhm; |
|
1361 |
patch_code(thread, access_field_patching_id); |
|
1362 |
} |
|
1363 |
// Back in JAVA, use no oops DON'T safepoint |
|
1364 |
||
1365 |
// Return true if calling code is deoptimized |
|
1366 |
||
1367 |
return caller_is_deopted(); |
|
1368 |
JRT_END |
|
1369 |
||
1370 |
||
1371 |
JRT_LEAF(void, Runtime1::trace_block_entry(jint block_id)) |
|
1372 |
// for now we just print out the block id |
|
1373 |
tty->print("%d ", block_id); |
|
1374 |
JRT_END |
|
1375 |
||
1376 |
||
360
21d113ecbf6a
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
1
diff
changeset
|
1377 |
// Array copy return codes. |
21d113ecbf6a
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
1
diff
changeset
|
1378 |
enum { |
21d113ecbf6a
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
1
diff
changeset
|
1379 |
ac_failed = -1, // arraycopy failed |
21d113ecbf6a
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
1
diff
changeset
|
1380 |
ac_ok = 0 // arraycopy succeeded |
21d113ecbf6a
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
1
diff
changeset
|
1381 |
}; |
21d113ecbf6a
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
1
diff
changeset
|
1382 |
|
21d113ecbf6a
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
1
diff
changeset
|
1383 |
|
4886
a2f9a66475b3
6904516: More object array barrier fixes, following up on 6906727
ysr
parents:
4571
diff
changeset
|
1384 |
// Below length is the # elements copied. |
360
21d113ecbf6a
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
1
diff
changeset
|
1385 |
template <class T> int obj_arraycopy_work(oopDesc* src, T* src_addr, |
21d113ecbf6a
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
1
diff
changeset
|
1386 |
oopDesc* dst, T* dst_addr, |
21d113ecbf6a
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
1
diff
changeset
|
1387 |
int length) { |
21d113ecbf6a
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
1
diff
changeset
|
1388 |
|
21d113ecbf6a
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
1
diff
changeset
|
1389 |
// For performance reasons, we assume we are using a card marking write |
21d113ecbf6a
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
1
diff
changeset
|
1390 |
// barrier. The assert will fail if this is not the case. |
21d113ecbf6a
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
1
diff
changeset
|
1391 |
// Note that we use the non-virtual inlineable variant of write_ref_array. |
21d113ecbf6a
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
1
diff
changeset
|
1392 |
BarrierSet* bs = Universe::heap()->barrier_set(); |
4886
a2f9a66475b3
6904516: More object array barrier fixes, following up on 6906727
ysr
parents:
4571
diff
changeset
|
1393 |
assert(bs->has_write_ref_array_opt(), "Barrier set must have ref array opt"); |
a2f9a66475b3
6904516: More object array barrier fixes, following up on 6906727
ysr
parents:
4571
diff
changeset
|
1394 |
assert(bs->has_write_ref_array_pre_opt(), "For pre-barrier as well."); |
360
21d113ecbf6a
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
1
diff
changeset
|
1395 |
if (src == dst) { |
21d113ecbf6a
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
1
diff
changeset
|
1396 |
// same object, no check |
4886
a2f9a66475b3
6904516: More object array barrier fixes, following up on 6906727
ysr
parents:
4571
diff
changeset
|
1397 |
bs->write_ref_array_pre(dst_addr, length); |
360
21d113ecbf6a
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
1
diff
changeset
|
1398 |
Copy::conjoint_oops_atomic(src_addr, dst_addr, length); |
4886
a2f9a66475b3
6904516: More object array barrier fixes, following up on 6906727
ysr
parents:
4571
diff
changeset
|
1399 |
bs->write_ref_array((HeapWord*)dst_addr, length); |
360
21d113ecbf6a
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
1
diff
changeset
|
1400 |
return ac_ok; |
21d113ecbf6a
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
1
diff
changeset
|
1401 |
} else { |
13952
e3cf184080bc
8000213: NPG: Should have renamed arrayKlass and typeArrayKlass
coleenp
parents:
13728
diff
changeset
|
1402 |
Klass* bound = ObjArrayKlass::cast(dst->klass())->element_klass(); |
e3cf184080bc
8000213: NPG: Should have renamed arrayKlass and typeArrayKlass
coleenp
parents:
13728
diff
changeset
|
1403 |
Klass* stype = ObjArrayKlass::cast(src->klass())->element_klass(); |
14488 | 1404 |
if (stype == bound || stype->is_subtype_of(bound)) { |
360
21d113ecbf6a
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
1
diff
changeset
|
1405 |
// Elements are guaranteed to be subtypes, so no check necessary |
4886
a2f9a66475b3
6904516: More object array barrier fixes, following up on 6906727
ysr
parents:
4571
diff
changeset
|
1406 |
bs->write_ref_array_pre(dst_addr, length); |
360
21d113ecbf6a
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
1
diff
changeset
|
1407 |
Copy::conjoint_oops_atomic(src_addr, dst_addr, length); |
4886
a2f9a66475b3
6904516: More object array barrier fixes, following up on 6906727
ysr
parents:
4571
diff
changeset
|
1408 |
bs->write_ref_array((HeapWord*)dst_addr, length); |
360
21d113ecbf6a
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
1
diff
changeset
|
1409 |
return ac_ok; |
21d113ecbf6a
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
1
diff
changeset
|
1410 |
} |
21d113ecbf6a
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
1
diff
changeset
|
1411 |
} |
21d113ecbf6a
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
1
diff
changeset
|
1412 |
return ac_failed; |
21d113ecbf6a
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
1
diff
changeset
|
1413 |
} |
21d113ecbf6a
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
1
diff
changeset
|
1414 |
|
1 | 1415 |
// fast and direct copy of arrays; returning -1, means that an exception may be thrown |
1416 |
// and we did not copy anything |
|
1417 |
JRT_LEAF(int, Runtime1::arraycopy(oopDesc* src, int src_pos, oopDesc* dst, int dst_pos, int length)) |
|
1418 |
#ifndef PRODUCT |
|
1419 |
_generic_arraycopy_cnt++; // Slow-path oop array copy |
|
1420 |
#endif |
|
1421 |
||
1422 |
if (src == NULL || dst == NULL || src_pos < 0 || dst_pos < 0 || length < 0) return ac_failed; |
|
1423 |
if (!dst->is_array() || !src->is_array()) return ac_failed; |
|
1424 |
if ((unsigned int) arrayOop(src)->length() < (unsigned int)src_pos + (unsigned int)length) return ac_failed; |
|
1425 |
if ((unsigned int) arrayOop(dst)->length() < (unsigned int)dst_pos + (unsigned int)length) return ac_failed; |
|
1426 |
||
1427 |
if (length == 0) return ac_ok; |
|
1428 |
if (src->is_typeArray()) { |
|
17370
59a0620561fa
8003557: NPG: Klass* const k should be const Klass* k.
minqi
parents:
16611
diff
changeset
|
1429 |
Klass* klass_oop = src->klass(); |
1 | 1430 |
if (klass_oop != dst->klass()) return ac_failed; |
13952
e3cf184080bc
8000213: NPG: Should have renamed arrayKlass and typeArrayKlass
coleenp
parents:
13728
diff
changeset
|
1431 |
TypeArrayKlass* klass = TypeArrayKlass::cast(klass_oop); |
1 | 1432 |
const int l2es = klass->log2_element_size(); |
1433 |
const int ihs = klass->array_header_in_bytes() / wordSize; |
|
1434 |
char* src_addr = (char*) ((oopDesc**)src + ihs) + (src_pos << l2es); |
|
1435 |
char* dst_addr = (char*) ((oopDesc**)dst + ihs) + (dst_pos << l2es); |
|
1436 |
// Potential problem: memmove is not guaranteed to be word atomic |
|
1437 |
// Revisit in Merlin |
|
1438 |
memmove(dst_addr, src_addr, length << l2es); |
|
1439 |
return ac_ok; |
|
1440 |
} else if (src->is_objArray() && dst->is_objArray()) { |
|
7427 | 1441 |
if (UseCompressedOops) { |
360
21d113ecbf6a
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
1
diff
changeset
|
1442 |
narrowOop *src_addr = objArrayOop(src)->obj_at_addr<narrowOop>(src_pos); |
21d113ecbf6a
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
1
diff
changeset
|
1443 |
narrowOop *dst_addr = objArrayOop(dst)->obj_at_addr<narrowOop>(dst_pos); |
21d113ecbf6a
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
1
diff
changeset
|
1444 |
return obj_arraycopy_work(src, src_addr, dst, dst_addr, length); |
1 | 1445 |
} else { |
360
21d113ecbf6a
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
1
diff
changeset
|
1446 |
oop *src_addr = objArrayOop(src)->obj_at_addr<oop>(src_pos); |
21d113ecbf6a
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
1
diff
changeset
|
1447 |
oop *dst_addr = objArrayOop(dst)->obj_at_addr<oop>(dst_pos); |
21d113ecbf6a
6420645: Create a vm that uses compressed oops for up to 32gb heapsizes
coleenp
parents:
1
diff
changeset
|
1448 |
return obj_arraycopy_work(src, src_addr, dst, dst_addr, length); |
1 | 1449 |
} |
1450 |
} |
|
1451 |
return ac_failed; |
|
1452 |
JRT_END |
|
1453 |
||
1454 |
||
1455 |
JRT_LEAF(void, Runtime1::primitive_arraycopy(HeapWord* src, HeapWord* dst, int length)) |
|
1456 |
#ifndef PRODUCT |
|
1457 |
_primitive_arraycopy_cnt++; |
|
1458 |
#endif |
|
1459 |
||
1460 |
if (length == 0) return; |
|
1461 |
// Not guaranteed to be word atomic, but that doesn't matter |
|
1462 |
// for anything but an oop array, which is covered by oop_arraycopy. |
|
5883
8dc4bdc132d5
6730276: JDI_REGRESSION tests fail with "Error: count must be non-zero" error on x86
kvn
parents:
5882
diff
changeset
|
1463 |
Copy::conjoint_jbytes(src, dst, length); |
1 | 1464 |
JRT_END |
1465 |
||
1466 |
JRT_LEAF(void, Runtime1::oop_arraycopy(HeapWord* src, HeapWord* dst, int num)) |
|
1467 |
#ifndef PRODUCT |
|
1468 |
_oop_arraycopy_cnt++; |
|
1469 |
#endif |
|
1470 |
||
1471 |
if (num == 0) return; |
|
4886
a2f9a66475b3
6904516: More object array barrier fixes, following up on 6906727
ysr
parents:
4571
diff
changeset
|
1472 |
BarrierSet* bs = Universe::heap()->barrier_set(); |
a2f9a66475b3
6904516: More object array barrier fixes, following up on 6906727
ysr
parents:
4571
diff
changeset
|
1473 |
assert(bs->has_write_ref_array_opt(), "Barrier set must have ref array opt"); |
a2f9a66475b3
6904516: More object array barrier fixes, following up on 6906727
ysr
parents:
4571
diff
changeset
|
1474 |
assert(bs->has_write_ref_array_pre_opt(), "For pre-barrier as well."); |
a2f9a66475b3
6904516: More object array barrier fixes, following up on 6906727
ysr
parents:
4571
diff
changeset
|
1475 |
if (UseCompressedOops) { |
a2f9a66475b3
6904516: More object array barrier fixes, following up on 6906727
ysr
parents:
4571
diff
changeset
|
1476 |
bs->write_ref_array_pre((narrowOop*)dst, num); |
7427 | 1477 |
Copy::conjoint_oops_atomic((narrowOop*) src, (narrowOop*) dst, num); |
4886
a2f9a66475b3
6904516: More object array barrier fixes, following up on 6906727
ysr
parents:
4571
diff
changeset
|
1478 |
} else { |
a2f9a66475b3
6904516: More object array barrier fixes, following up on 6906727
ysr
parents:
4571
diff
changeset
|
1479 |
bs->write_ref_array_pre((oop*)dst, num); |
7427 | 1480 |
Copy::conjoint_oops_atomic((oop*) src, (oop*) dst, num); |
4886
a2f9a66475b3
6904516: More object array barrier fixes, following up on 6906727
ysr
parents:
4571
diff
changeset
|
1481 |
} |
a2f9a66475b3
6904516: More object array barrier fixes, following up on 6906727
ysr
parents:
4571
diff
changeset
|
1482 |
bs->write_ref_array(dst, num); |
1 | 1483 |
JRT_END |
1484 |
||
1485 |
||
12949 | 1486 |
JRT_LEAF(int, Runtime1::is_instance_of(oopDesc* mirror, oopDesc* obj)) |
1487 |
// had to return int instead of bool, otherwise there may be a mismatch |
|
1488 |
// between the C calling convention and the Java one. |
|
1489 |
// e.g., on x86, GCC may clear only %al when returning a bool false, but |
|
1490 |
// JVM takes the whole %eax as the return value, which may misinterpret |
|
1491 |
// the return value as a boolean true. |
|
1492 |
||
1493 |
assert(mirror != NULL, "should null-check on mirror before calling"); |
|
13728
882756847a04
6964458: Reimplement class meta-data storage to use native memory
coleenp
parents:
12949
diff
changeset
|
1494 |
Klass* k = java_lang_Class::as_Klass(mirror); |
12949 | 1495 |
return (k != NULL && obj != NULL && obj->is_a(k)) ? 1 : 0; |
1496 |
JRT_END |
|
1497 |
||
16611 | 1498 |
JRT_ENTRY(void, Runtime1::predicate_failed_trap(JavaThread* thread)) |
1499 |
ResourceMark rm; |
|
1500 |
||
1501 |
assert(!TieredCompilation, "incompatible with tiered compilation"); |
|
1502 |
||
1503 |
RegisterMap reg_map(thread, false); |
|
1504 |
frame runtime_frame = thread->last_frame(); |
|
1505 |
frame caller_frame = runtime_frame.sender(®_map); |
|
1506 |
||
1507 |
nmethod* nm = CodeCache::find_nmethod(caller_frame.pc()); |
|
1508 |
assert (nm != NULL, "no more nmethod?"); |
|
1509 |
nm->make_not_entrant(); |
|
1510 |
||
1511 |
methodHandle m(nm->method()); |
|
36350
29d8bb1668f5
8151130: [BACKOUT] Remove Method::_method_data for C1
thartmann
parents:
36345
diff
changeset
|
1512 |
MethodData* mdo = m->method_data(); |
16611 | 1513 |
|
36350
29d8bb1668f5
8151130: [BACKOUT] Remove Method::_method_data for C1
thartmann
parents:
36345
diff
changeset
|
1514 |
if (mdo == NULL && !HAS_PENDING_EXCEPTION) { |
29d8bb1668f5
8151130: [BACKOUT] Remove Method::_method_data for C1
thartmann
parents:
36345
diff
changeset
|
1515 |
// Build an MDO. Ignore errors like OutOfMemory; |
29d8bb1668f5
8151130: [BACKOUT] Remove Method::_method_data for C1
thartmann
parents:
36345
diff
changeset
|
1516 |
// that simply means we won't have an MDO to update. |
29d8bb1668f5
8151130: [BACKOUT] Remove Method::_method_data for C1
thartmann
parents:
36345
diff
changeset
|
1517 |
Method::build_interpreter_method_data(m, THREAD); |
29d8bb1668f5
8151130: [BACKOUT] Remove Method::_method_data for C1
thartmann
parents:
36345
diff
changeset
|
1518 |
if (HAS_PENDING_EXCEPTION) { |
29d8bb1668f5
8151130: [BACKOUT] Remove Method::_method_data for C1
thartmann
parents:
36345
diff
changeset
|
1519 |
assert((PENDING_EXCEPTION->is_a(SystemDictionary::OutOfMemoryError_klass())), "we expect only an OOM error here"); |
29d8bb1668f5
8151130: [BACKOUT] Remove Method::_method_data for C1
thartmann
parents:
36345
diff
changeset
|
1520 |
CLEAR_PENDING_EXCEPTION; |
16611 | 1521 |
} |
36350
29d8bb1668f5
8151130: [BACKOUT] Remove Method::_method_data for C1
thartmann
parents:
36345
diff
changeset
|
1522 |
mdo = m->method_data(); |
29d8bb1668f5
8151130: [BACKOUT] Remove Method::_method_data for C1
thartmann
parents:
36345
diff
changeset
|
1523 |
} |
16611 | 1524 |
|
36350
29d8bb1668f5
8151130: [BACKOUT] Remove Method::_method_data for C1
thartmann
parents:
36345
diff
changeset
|
1525 |
if (mdo != NULL) { |
29d8bb1668f5
8151130: [BACKOUT] Remove Method::_method_data for C1
thartmann
parents:
36345
diff
changeset
|
1526 |
mdo->inc_trap_count(Deoptimization::Reason_none); |
16611 | 1527 |
} |
1528 |
||
1529 |
if (TracePredicateFailedTraps) { |
|
1530 |
stringStream ss1, ss2; |
|
1531 |
vframeStream vfst(thread); |
|
1532 |
methodHandle inlinee = methodHandle(vfst.method()); |
|
1533 |
inlinee->print_short_name(&ss1); |
|
1534 |
m->print_short_name(&ss2); |
|
24424
2658d7834c6e
8037816: Fix for 8036122 breaks build with Xcode5/clang
drchase
parents:
23189
diff
changeset
|
1535 |
tty->print_cr("Predicate failed trap in method %s at bci %d inlined in %s at pc " INTPTR_FORMAT, ss1.as_string(), vfst.bci(), ss2.as_string(), p2i(caller_frame.pc())); |
16611 | 1536 |
} |
1537 |
||
1538 |
||
1539 |
Deoptimization::deoptimize_frame(thread, caller_frame.id()); |
|
1540 |
||
1541 |
JRT_END |
|
12949 | 1542 |
|
1 | 1543 |
#ifndef PRODUCT |
1544 |
void Runtime1::print_statistics() { |
|
1545 |
tty->print_cr("C1 Runtime statistics:"); |
|
1546 |
tty->print_cr(" _resolve_invoke_virtual_cnt: %d", SharedRuntime::_resolve_virtual_ctr); |
|
1547 |
tty->print_cr(" _resolve_invoke_opt_virtual_cnt: %d", SharedRuntime::_resolve_opt_virtual_ctr); |
|
1548 |
tty->print_cr(" _resolve_invoke_static_cnt: %d", SharedRuntime::_resolve_static_ctr); |
|
1549 |
tty->print_cr(" _handle_wrong_method_cnt: %d", SharedRuntime::_wrong_method_ctr); |
|
1550 |
tty->print_cr(" _ic_miss_cnt: %d", SharedRuntime::_ic_miss_ctr); |
|
1551 |
tty->print_cr(" _generic_arraycopy_cnt: %d", _generic_arraycopy_cnt); |
|
9102 | 1552 |
tty->print_cr(" _generic_arraycopystub_cnt: %d", _generic_arraycopystub_cnt); |
24944
5b01505efb7a
8033145: Runtime1::arraycopy_count_address uses wrong _oop_arraycopy_cnt variable
thartmann
parents:
24442
diff
changeset
|
1553 |
tty->print_cr(" _byte_arraycopy_cnt: %d", _byte_arraycopy_stub_cnt); |
5b01505efb7a
8033145: Runtime1::arraycopy_count_address uses wrong _oop_arraycopy_cnt variable
thartmann
parents:
24442
diff
changeset
|
1554 |
tty->print_cr(" _short_arraycopy_cnt: %d", _short_arraycopy_stub_cnt); |
5b01505efb7a
8033145: Runtime1::arraycopy_count_address uses wrong _oop_arraycopy_cnt variable
thartmann
parents:
24442
diff
changeset
|
1555 |
tty->print_cr(" _int_arraycopy_cnt: %d", _int_arraycopy_stub_cnt); |
5b01505efb7a
8033145: Runtime1::arraycopy_count_address uses wrong _oop_arraycopy_cnt variable
thartmann
parents:
24442
diff
changeset
|
1556 |
tty->print_cr(" _long_arraycopy_cnt: %d", _long_arraycopy_stub_cnt); |
1 | 1557 |
tty->print_cr(" _primitive_arraycopy_cnt: %d", _primitive_arraycopy_cnt); |
9102 | 1558 |
tty->print_cr(" _oop_arraycopy_cnt (C): %d", Runtime1::_oop_arraycopy_cnt); |
24944
5b01505efb7a
8033145: Runtime1::arraycopy_count_address uses wrong _oop_arraycopy_cnt variable
thartmann
parents:
24442
diff
changeset
|
1559 |
tty->print_cr(" _oop_arraycopy_cnt (stub): %d", _oop_arraycopy_stub_cnt); |
1 | 1560 |
tty->print_cr(" _arraycopy_slowcase_cnt: %d", _arraycopy_slowcase_cnt); |
9102 | 1561 |
tty->print_cr(" _arraycopy_checkcast_cnt: %d", _arraycopy_checkcast_cnt); |
1562 |
tty->print_cr(" _arraycopy_checkcast_attempt_cnt:%d", _arraycopy_checkcast_attempt_cnt); |
|
1 | 1563 |
|
1564 |
tty->print_cr(" _new_type_array_slowcase_cnt: %d", _new_type_array_slowcase_cnt); |
|
1565 |
tty->print_cr(" _new_object_array_slowcase_cnt: %d", _new_object_array_slowcase_cnt); |
|
1566 |
tty->print_cr(" _new_instance_slowcase_cnt: %d", _new_instance_slowcase_cnt); |
|
1567 |
tty->print_cr(" _new_multi_array_slowcase_cnt: %d", _new_multi_array_slowcase_cnt); |
|
1568 |
tty->print_cr(" _monitorenter_slowcase_cnt: %d", _monitorenter_slowcase_cnt); |
|
1569 |
tty->print_cr(" _monitorexit_slowcase_cnt: %d", _monitorexit_slowcase_cnt); |
|
1570 |
tty->print_cr(" _patch_code_slowcase_cnt: %d", _patch_code_slowcase_cnt); |
|
1571 |
||
1572 |
tty->print_cr(" _throw_range_check_exception_count: %d:", _throw_range_check_exception_count); |
|
1573 |
tty->print_cr(" _throw_index_exception_count: %d:", _throw_index_exception_count); |
|
1574 |
tty->print_cr(" _throw_div0_exception_count: %d:", _throw_div0_exception_count); |
|
1575 |
tty->print_cr(" _throw_null_pointer_exception_count: %d:", _throw_null_pointer_exception_count); |
|
1576 |
tty->print_cr(" _throw_class_cast_exception_count: %d:", _throw_class_cast_exception_count); |
|
1577 |
tty->print_cr(" _throw_incompatible_class_change_error_count: %d:", _throw_incompatible_class_change_error_count); |
|
1578 |
tty->print_cr(" _throw_array_store_exception_count: %d:", _throw_array_store_exception_count); |
|
1579 |
tty->print_cr(" _throw_count: %d:", _throw_count); |
|
1580 |
||
1581 |
SharedRuntime::print_ic_miss_histogram(); |
|
1582 |
tty->cr(); |
|
1583 |
} |
|
1584 |
#endif // PRODUCT |