Bug Summary

File:jdk/src/hotspot/cpu/x86/gc/shared/barrierSetAssembler_x86.cpp
Warning:line 110, column 8
Value stored to 'atomic' during its initialization is never read

Annotated Source Code

Press '?' to see keyboard shortcuts

clang -cc1 -triple x86_64-pc-linux-gnu -analyze -disable-free -disable-llvm-verifier -discard-value-names -main-file-name barrierSetAssembler_x86.cpp -analyzer-store=region -analyzer-opt-analyze-nested-blocks -analyzer-checker=core -analyzer-checker=apiModeling -analyzer-checker=unix -analyzer-checker=deadcode -analyzer-checker=cplusplus -analyzer-checker=security.insecureAPI.UncheckedReturn -analyzer-checker=security.insecureAPI.getpw -analyzer-checker=security.insecureAPI.gets -analyzer-checker=security.insecureAPI.mktemp -analyzer-checker=security.insecureAPI.mkstemp -analyzer-checker=security.insecureAPI.vfork -analyzer-checker=nullability.NullPassedToNonnull -analyzer-checker=nullability.NullReturnedFromNonnull -analyzer-output plist -w -setup-static-analyzer -mrelocation-model pic -pic-level 2 -mthread-model posix -fno-delete-null-pointer-checks -mframe-pointer=all -relaxed-aliasing -fmath-errno -fno-rounding-math -masm-verbose -mconstructor-aliases -munwind-tables -target-cpu x86-64 -dwarf-column-info -fno-split-dwarf-inlining -debugger-tuning=gdb -resource-dir /usr/lib/llvm-10/lib/clang/10.0.0 -I /home/daniel/Projects/java/jdk/build/linux-x86_64-server-fastdebug/hotspot/variant-server/libjvm/objs/precompiled -D __STDC_FORMAT_MACROS -D __STDC_LIMIT_MACROS -D __STDC_CONSTANT_MACROS -D _GNU_SOURCE -D _REENTRANT -D LIBC=gnu -D LINUX -D VM_LITTLE_ENDIAN -D _LP64=1 -D ASSERT -D CHECK_UNHANDLED_OOPS -D TARGET_ARCH_x86 -D INCLUDE_SUFFIX_OS=_linux -D INCLUDE_SUFFIX_CPU=_x86 -D INCLUDE_SUFFIX_COMPILER=_gcc -D TARGET_COMPILER_gcc -D AMD64 -D HOTSPOT_LIB_ARCH="amd64" -D COMPILER1 -D COMPILER2 -I /home/daniel/Projects/java/jdk/build/linux-x86_64-server-fastdebug/hotspot/variant-server/gensrc/adfiles -I /home/daniel/Projects/java/jdk/src/hotspot/share -I /home/daniel/Projects/java/jdk/src/hotspot/os/linux -I /home/daniel/Projects/java/jdk/src/hotspot/os/posix -I /home/daniel/Projects/java/jdk/src/hotspot/cpu/x86 -I /home/daniel/Projects/java/jdk/src/hotspot/os_cpu/linux_x86 -I /home/daniel/Projects/java/jdk/build/linux-x86_64-server-fastdebug/hotspot/variant-server/gensrc -I /home/daniel/Projects/java/jdk/src/hotspot/share/precompiled -I /home/daniel/Projects/java/jdk/src/hotspot/share/include -I /home/daniel/Projects/java/jdk/src/hotspot/os/posix/include -I /home/daniel/Projects/java/jdk/build/linux-x86_64-server-fastdebug/support/modules_include/java.base -I /home/daniel/Projects/java/jdk/build/linux-x86_64-server-fastdebug/support/modules_include/java.base/linux -I /home/daniel/Projects/java/jdk/src/java.base/share/native/libjimage -I /home/daniel/Projects/java/jdk/build/linux-x86_64-server-fastdebug/hotspot/variant-server/gensrc/adfiles -I /home/daniel/Projects/java/jdk/src/hotspot/share -I /home/daniel/Projects/java/jdk/src/hotspot/os/linux -I /home/daniel/Projects/java/jdk/src/hotspot/os/posix -I /home/daniel/Projects/java/jdk/src/hotspot/cpu/x86 -I /home/daniel/Projects/java/jdk/src/hotspot/os_cpu/linux_x86 -I /home/daniel/Projects/java/jdk/build/linux-x86_64-server-fastdebug/hotspot/variant-server/gensrc -D _FORTIFY_SOURCE=2 -internal-isystem /usr/lib/gcc/x86_64-linux-gnu/7.5.0/../../../../include/c++/7.5.0 -internal-isystem /usr/lib/gcc/x86_64-linux-gnu/7.5.0/../../../../include/x86_64-linux-gnu/c++/7.5.0 -internal-isystem /usr/lib/gcc/x86_64-linux-gnu/7.5.0/../../../../include/x86_64-linux-gnu/c++/7.5.0 -internal-isystem /usr/lib/gcc/x86_64-linux-gnu/7.5.0/../../../../include/c++/7.5.0/backward -internal-isystem /usr/local/include -internal-isystem /usr/lib/llvm-10/lib/clang/10.0.0/include -internal-externc-isystem /usr/include/x86_64-linux-gnu -internal-externc-isystem /include -internal-externc-isystem /usr/include -O3 -Wno-format-zero-length -Wno-unused-parameter -Wno-unused -Wno-parentheses -Wno-comment -Wno-unknown-pragmas -Wno-address -Wno-delete-non-virtual-dtor -Wno-char-subscripts -Wno-array-bounds -Wno-int-in-bool-context -Wno-ignored-qualifiers -Wno-missing-field-initializers -Wno-implicit-fallthrough -Wno-empty-body -Wno-strict-overflow -Wno-sequence-point -Wno-maybe-uninitialized -Wno-misleading-indentation -Wno-cast-function-type -Wno-shift-negative-value -std=c++14 -fdeprecated-macro -fdebug-compilation-dir /home/daniel/Projects/java/jdk/make/hotspot -ferror-limit 19 -fmessage-length 0 -fvisibility hidden -stack-protector 1 -fno-rtti -fgnuc-version=4.2.1 -fobjc-runtime=gcc -fdiagnostics-show-option -vectorize-loops -vectorize-slp -analyzer-output=html -faddrsig -o /home/daniel/Projects/java/scan/2021-12-21-193737-8510-1 -x c++ /home/daniel/Projects/java/jdk/src/hotspot/cpu/x86/gc/shared/barrierSetAssembler_x86.cpp
1/*
2 * Copyright (c) 2018, 2021, Oracle and/or its affiliates. All rights reserved.
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 *
19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
20 * or visit www.oracle.com if you need additional information or have any
21 * questions.
22 *
23 */
24
25#include "precompiled.hpp"
26#include "classfile/classLoaderData.hpp"
27#include "gc/shared/barrierSet.hpp"
28#include "gc/shared/barrierSetAssembler.hpp"
29#include "gc/shared/barrierSetNMethod.hpp"
30#include "gc/shared/collectedHeap.hpp"
31#include "interpreter/interp_masm.hpp"
32#include "memory/universe.hpp"
33#include "runtime/jniHandles.hpp"
34#include "runtime/sharedRuntime.hpp"
35#include "runtime/stubRoutines.hpp"
36#include "runtime/thread.hpp"
37
38#define __masm-> masm->
39
40void BarrierSetAssembler::load_at(MacroAssembler* masm, DecoratorSet decorators, BasicType type,
41 Register dst, Address src, Register tmp1, Register tmp_thread) {
42 bool in_heap = (decorators & IN_HEAP) != 0;
43 bool in_native = (decorators & IN_NATIVE) != 0;
44 bool is_not_null = (decorators & IS_NOT_NULL) != 0;
45 bool atomic = (decorators & MO_RELAXED) != 0;
46
47 switch (type) {
48 case T_OBJECT:
49 case T_ARRAY: {
50 if (in_heap) {
51#ifdef _LP641
52 if (UseCompressedOops) {
53 __masm-> movl(dst, src);
54 if (is_not_null) {
55 __masm-> decode_heap_oop_not_null(dst);
56 } else {
57 __masm-> decode_heap_oop(dst);
58 }
59 } else
60#endif
61 {
62 __masm-> movptr(dst, src);
63 }
64 } else {
65 assert(in_native, "why else?")do { if (!(in_native)) { (*g_assert_poison) = 'X';; report_vm_error
("/home/daniel/Projects/java/jdk/src/hotspot/cpu/x86/gc/shared/barrierSetAssembler_x86.cpp"
, 65, "assert(" "in_native" ") failed", "why else?"); ::breakpoint
(); } } while (0)
;
66 __masm-> movptr(dst, src);
67 }
68 break;
69 }
70 case T_BOOLEAN: __masm-> load_unsigned_byte(dst, src); break;
71 case T_BYTE: __masm-> load_signed_byte(dst, src); break;
72 case T_CHAR: __masm-> load_unsigned_short(dst, src); break;
73 case T_SHORT: __masm-> load_signed_short(dst, src); break;
74 case T_INT: __masm-> movl (dst, src); break;
75 case T_ADDRESS: __masm-> movptr(dst, src); break;
76 case T_FLOAT:
77 assert(dst == noreg, "only to ftos")do { if (!(dst == noreg)) { (*g_assert_poison) = 'X';; report_vm_error
("/home/daniel/Projects/java/jdk/src/hotspot/cpu/x86/gc/shared/barrierSetAssembler_x86.cpp"
, 77, "assert(" "dst == noreg" ") failed", "only to ftos"); ::
breakpoint(); } } while (0)
;
78 __masm-> load_float(src);
79 break;
80 case T_DOUBLE:
81 assert(dst == noreg, "only to dtos")do { if (!(dst == noreg)) { (*g_assert_poison) = 'X';; report_vm_error
("/home/daniel/Projects/java/jdk/src/hotspot/cpu/x86/gc/shared/barrierSetAssembler_x86.cpp"
, 81, "assert(" "dst == noreg" ") failed", "only to dtos"); ::
breakpoint(); } } while (0)
;
82 __masm-> load_double(src);
83 break;
84 case T_LONG:
85 assert(dst == noreg, "only to ltos")do { if (!(dst == noreg)) { (*g_assert_poison) = 'X';; report_vm_error
("/home/daniel/Projects/java/jdk/src/hotspot/cpu/x86/gc/shared/barrierSetAssembler_x86.cpp"
, 85, "assert(" "dst == noreg" ") failed", "only to ltos"); ::
breakpoint(); } } while (0)
;
86#ifdef _LP641
87 __masm-> movq(rax, src);
88#else
89 if (atomic) {
90 __masm-> fild_d(src); // Must load atomically
91 __masm-> subptr(rsp,2*wordSize); // Make space for store
92 __masm-> fistp_d(Address(rsp,0));
93 __masm-> pop(rax);
94 __masm-> pop(rdx);
95 } else {
96 __masm-> movl(rax, src);
97 __masm-> movl(rdx, src.plus_disp(wordSize));
98 }
99#endif
100 break;
101 default: Unimplemented()do { (*g_assert_poison) = 'X';; report_unimplemented("/home/daniel/Projects/java/jdk/src/hotspot/cpu/x86/gc/shared/barrierSetAssembler_x86.cpp"
, 101); ::breakpoint(); } while (0)
;
102 }
103}
104
105void BarrierSetAssembler::store_at(MacroAssembler* masm, DecoratorSet decorators, BasicType type,
106 Address dst, Register val, Register tmp1, Register tmp2) {
107 bool in_heap = (decorators & IN_HEAP) != 0;
108 bool in_native = (decorators & IN_NATIVE) != 0;
109 bool is_not_null = (decorators & IS_NOT_NULL) != 0;
110 bool atomic = (decorators & MO_RELAXED) != 0;
Value stored to 'atomic' during its initialization is never read
111
112 switch (type) {
113 case T_OBJECT:
114 case T_ARRAY: {
115 if (in_heap) {
116 if (val == noreg) {
117 assert(!is_not_null, "inconsistent access")do { if (!(!is_not_null)) { (*g_assert_poison) = 'X';; report_vm_error
("/home/daniel/Projects/java/jdk/src/hotspot/cpu/x86/gc/shared/barrierSetAssembler_x86.cpp"
, 117, "assert(" "!is_not_null" ") failed", "inconsistent access"
); ::breakpoint(); } } while (0)
;
118#ifdef _LP641
119 if (UseCompressedOops) {
120 __masm-> movl(dst, (int32_t)NULL_WORD0L);
121 } else {
122 __masm-> movslq(dst, (int32_t)NULL_WORD0L);
123 }
124#else
125 __masm-> movl(dst, (int32_t)NULL_WORD0L);
126#endif
127 } else {
128#ifdef _LP641
129 if (UseCompressedOops) {
130 assert(!dst.uses(val), "not enough registers")do { if (!(!dst.uses(val))) { (*g_assert_poison) = 'X';; report_vm_error
("/home/daniel/Projects/java/jdk/src/hotspot/cpu/x86/gc/shared/barrierSetAssembler_x86.cpp"
, 130, "assert(" "!dst.uses(val)" ") failed", "not enough registers"
); ::breakpoint(); } } while (0)
;
131 if (is_not_null) {
132 __masm-> encode_heap_oop_not_null(val);
133 } else {
134 __masm-> encode_heap_oop(val);
135 }
136 __masm-> movl(dst, val);
137 } else
138#endif
139 {
140 __masm-> movptr(dst, val);
141 }
142 }
143 } else {
144 assert(in_native, "why else?")do { if (!(in_native)) { (*g_assert_poison) = 'X';; report_vm_error
("/home/daniel/Projects/java/jdk/src/hotspot/cpu/x86/gc/shared/barrierSetAssembler_x86.cpp"
, 144, "assert(" "in_native" ") failed", "why else?"); ::breakpoint
(); } } while (0)
;
145 assert(val != noreg, "not supported")do { if (!(val != noreg)) { (*g_assert_poison) = 'X';; report_vm_error
("/home/daniel/Projects/java/jdk/src/hotspot/cpu/x86/gc/shared/barrierSetAssembler_x86.cpp"
, 145, "assert(" "val != noreg" ") failed", "not supported");
::breakpoint(); } } while (0)
;
146 __masm-> movptr(dst, val);
147 }
148 break;
149 }
150 case T_BOOLEAN:
151 __masm-> andl(val, 0x1); // boolean is true if LSB is 1
152 __masm-> movb(dst, val);
153 break;
154 case T_BYTE:
155 __masm-> movb(dst, val);
156 break;
157 case T_SHORT:
158 __masm-> movw(dst, val);
159 break;
160 case T_CHAR:
161 __masm-> movw(dst, val);
162 break;
163 case T_INT:
164 __masm-> movl(dst, val);
165 break;
166 case T_LONG:
167 assert(val == noreg, "only tos")do { if (!(val == noreg)) { (*g_assert_poison) = 'X';; report_vm_error
("/home/daniel/Projects/java/jdk/src/hotspot/cpu/x86/gc/shared/barrierSetAssembler_x86.cpp"
, 167, "assert(" "val == noreg" ") failed", "only tos"); ::breakpoint
(); } } while (0)
;
168#ifdef _LP641
169 __masm-> movq(dst, rax);
170#else
171 if (atomic) {
172 __masm-> push(rdx);
173 __masm-> push(rax); // Must update atomically with FIST
174 __masm-> fild_d(Address(rsp,0)); // So load into FPU register
175 __masm-> fistp_d(dst); // and put into memory atomically
176 __masm-> addptr(rsp, 2*wordSize);
177 } else {
178 __masm-> movptr(dst, rax);
179 __masm-> movptr(dst.plus_disp(wordSize), rdx);
180 }
181#endif
182 break;
183 case T_FLOAT:
184 assert(val == noreg, "only tos")do { if (!(val == noreg)) { (*g_assert_poison) = 'X';; report_vm_error
("/home/daniel/Projects/java/jdk/src/hotspot/cpu/x86/gc/shared/barrierSetAssembler_x86.cpp"
, 184, "assert(" "val == noreg" ") failed", "only tos"); ::breakpoint
(); } } while (0)
;
185 __masm-> store_float(dst);
186 break;
187 case T_DOUBLE:
188 assert(val == noreg, "only tos")do { if (!(val == noreg)) { (*g_assert_poison) = 'X';; report_vm_error
("/home/daniel/Projects/java/jdk/src/hotspot/cpu/x86/gc/shared/barrierSetAssembler_x86.cpp"
, 188, "assert(" "val == noreg" ") failed", "only tos"); ::breakpoint
(); } } while (0)
;
189 __masm-> store_double(dst);
190 break;
191 case T_ADDRESS:
192 __masm-> movptr(dst, val);
193 break;
194 default: Unimplemented()do { (*g_assert_poison) = 'X';; report_unimplemented("/home/daniel/Projects/java/jdk/src/hotspot/cpu/x86/gc/shared/barrierSetAssembler_x86.cpp"
, 194); ::breakpoint(); } while (0)
;
195 }
196}
197
198void BarrierSetAssembler::try_resolve_jobject_in_native(MacroAssembler* masm, Register jni_env,
199 Register obj, Register tmp, Label& slowpath) {
200 __masm-> clear_jweak_tag(obj);
201 __masm-> movptr(obj, Address(obj, 0));
202}
203
204void BarrierSetAssembler::tlab_allocate(MacroAssembler* masm,
205 Register thread, Register obj,
206 Register var_size_in_bytes,
207 int con_size_in_bytes,
208 Register t1,
209 Register t2,
210 Label& slow_case) {
211 assert_different_registers(obj, t1, t2);
212 assert_different_registers(obj, var_size_in_bytes, t1);
213 Register end = t2;
214 if (!thread->is_valid()) {
215#ifdef _LP641
216 thread = r15_thread;
217#else
218 assert(t1->is_valid(), "need temp reg")do { if (!(t1->is_valid())) { (*g_assert_poison) = 'X';; report_vm_error
("/home/daniel/Projects/java/jdk/src/hotspot/cpu/x86/gc/shared/barrierSetAssembler_x86.cpp"
, 218, "assert(" "t1->is_valid()" ") failed", "need temp reg"
); ::breakpoint(); } } while (0)
;
219 thread = t1;
220 __masm-> get_thread(thread);
221#endif
222 }
223
224 __masm-> verify_tlab();
225
226 __masm-> movptr(obj, Address(thread, JavaThread::tlab_top_offset()));
227 if (var_size_in_bytes == noreg) {
228 __masm-> lea(end, Address(obj, con_size_in_bytes));
229 } else {
230 __masm-> lea(end, Address(obj, var_size_in_bytes, Address::times_1));
231 }
232 __masm-> cmpptr(end, Address(thread, JavaThread::tlab_end_offset()));
233 __masm-> jcc(Assembler::above, slow_case);
234
235 // update the tlab top pointer
236 __masm-> movptr(Address(thread, JavaThread::tlab_top_offset()), end);
237
238 // recover var_size_in_bytes if necessary
239 if (var_size_in_bytes == end) {
240 __masm-> subptr(var_size_in_bytes, obj);
241 }
242 __masm-> verify_tlab();
243}
244
245// Defines obj, preserves var_size_in_bytes
246void BarrierSetAssembler::eden_allocate(MacroAssembler* masm,
247 Register thread, Register obj,
248 Register var_size_in_bytes,
249 int con_size_in_bytes,
250 Register t1,
251 Label& slow_case) {
252 assert(obj == rax, "obj must be in rax, for cmpxchg")do { if (!(obj == rax)) { (*g_assert_poison) = 'X';; report_vm_error
("/home/daniel/Projects/java/jdk/src/hotspot/cpu/x86/gc/shared/barrierSetAssembler_x86.cpp"
, 252, "assert(" "obj == rax" ") failed", "obj must be in rax, for cmpxchg"
); ::breakpoint(); } } while (0)
;
253 assert_different_registers(obj, var_size_in_bytes, t1);
254 if (!Universe::heap()->supports_inline_contig_alloc()) {
255 __masm-> jmp(slow_case);
256 } else {
257 Register end = t1;
258 Label retry;
259 __masm-> bind(retry);
260 ExternalAddress heap_top((address) Universe::heap()->top_addr());
261 __masm-> movptr(obj, heap_top);
262 if (var_size_in_bytes == noreg) {
263 __masm-> lea(end, Address(obj, con_size_in_bytes));
264 } else {
265 __masm-> lea(end, Address(obj, var_size_in_bytes, Address::times_1));
266 }
267 // if end < obj then we wrapped around => object too long => slow case
268 __masm-> cmpptr(end, obj);
269 __masm-> jcc(Assembler::below, slow_case);
270 __masm-> cmpptr(end, ExternalAddress((address) Universe::heap()->end_addr()));
271 __masm-> jcc(Assembler::above, slow_case);
272 // Compare obj with the top addr, and if still equal, store the new top addr in
273 // end at the address of the top addr pointer. Sets ZF if was equal, and clears
274 // it otherwise. Use lock prefix for atomicity on MPs.
275 __masm-> locked_cmpxchgptr(end, heap_top);
276 __masm-> jcc(Assembler::notEqual, retry);
277 incr_allocated_bytes(masm, thread, var_size_in_bytes, con_size_in_bytes, thread->is_valid() ? noreg : t1);
278 }
279}
280
281void BarrierSetAssembler::incr_allocated_bytes(MacroAssembler* masm, Register thread,
282 Register var_size_in_bytes,
283 int con_size_in_bytes,
284 Register t1) {
285 if (!thread->is_valid()) {
286#ifdef _LP641
287 thread = r15_thread;
288#else
289 assert(t1->is_valid(), "need temp reg")do { if (!(t1->is_valid())) { (*g_assert_poison) = 'X';; report_vm_error
("/home/daniel/Projects/java/jdk/src/hotspot/cpu/x86/gc/shared/barrierSetAssembler_x86.cpp"
, 289, "assert(" "t1->is_valid()" ") failed", "need temp reg"
); ::breakpoint(); } } while (0)
;
290 thread = t1;
291 __masm-> get_thread(thread);
292#endif
293 }
294
295#ifdef _LP641
296 if (var_size_in_bytes->is_valid()) {
297 __masm-> addq(Address(thread, in_bytes(JavaThread::allocated_bytes_offset())), var_size_in_bytes);
298 } else {
299 __masm-> addq(Address(thread, in_bytes(JavaThread::allocated_bytes_offset())), con_size_in_bytes);
300 }
301#else
302 if (var_size_in_bytes->is_valid()) {
303 __masm-> addl(Address(thread, in_bytes(JavaThread::allocated_bytes_offset())), var_size_in_bytes);
304 } else {
305 __masm-> addl(Address(thread, in_bytes(JavaThread::allocated_bytes_offset())), con_size_in_bytes);
306 }
307 __masm-> adcl(Address(thread, in_bytes(JavaThread::allocated_bytes_offset())+4), 0);
308#endif
309}
310
311#ifdef _LP641
312void BarrierSetAssembler::nmethod_entry_barrier(MacroAssembler* masm) {
313 BarrierSetNMethod* bs_nm = BarrierSet::barrier_set()->barrier_set_nmethod();
314 if (bs_nm == NULL__null) {
315 return;
316 }
317 Label continuation;
318 Register thread = r15_thread;
319 Address disarmed_addr(thread, in_bytes(bs_nm->thread_disarmed_offset()));
320 __masm-> align(8);
321 __masm-> cmpl(disarmed_addr, 0);
322 __masm-> jcc(Assembler::equal, continuation);
323 __masm-> call(RuntimeAddress(StubRoutines::x86::method_entry_barrier()));
324 __masm-> bind(continuation);
325}
326#else
327void BarrierSetAssembler::nmethod_entry_barrier(MacroAssembler* masm) {
328 BarrierSetNMethod* bs_nm = BarrierSet::barrier_set()->barrier_set_nmethod();
329 if (bs_nm == NULL__null) {
330 return;
331 }
332
333 Label continuation;
334
335 Register tmp = rdi;
336 __masm-> push(tmp);
337 __masm-> movptr(tmp, (intptr_t)bs_nm->disarmed_value_address());
338 Address disarmed_addr(tmp, 0);
339 __masm-> align(4);
340 __masm-> cmpl(disarmed_addr, 0);
341 __masm-> pop(tmp);
342 __masm-> jcc(Assembler::equal, continuation);
343 __masm-> call(RuntimeAddress(StubRoutines::x86::method_entry_barrier()));
344 __masm-> bind(continuation);
345}
346#endif
347
348void BarrierSetAssembler::c2i_entry_barrier(MacroAssembler* masm) {
349 BarrierSetNMethod* bs = BarrierSet::barrier_set()->barrier_set_nmethod();
350 if (bs == NULL__null) {
351 return;
352 }
353
354 Label bad_call;
355 __masm-> cmpptr(rbx, 0); // rbx contains the incoming method for c2i adapters.
356 __masm-> jcc(Assembler::equal, bad_call);
357
358#ifdef _LP641
359 Register tmp1 = rscratch1;
360 Register tmp2 = rscratch2;
361#else
362 Register tmp1 = rax;
363 Register tmp2 = rcx;
364 __masm-> push(tmp1);
365 __masm-> push(tmp2);
366#endif // _LP64
367
368 // Pointer chase to the method holder to find out if the method is concurrently unloading.
369 Label method_live;
370 __masm-> load_method_holder_cld(tmp1, rbx);
371
372 // Is it a strong CLD?
373 __masm-> cmpl(Address(tmp1, ClassLoaderData::keep_alive_offset()), 0);
374 __masm-> jcc(Assembler::greater, method_live);
375
376 // Is it a weak but alive CLD?
377 __masm-> movptr(tmp1, Address(tmp1, ClassLoaderData::holder_offset()));
378 __masm-> resolve_weak_handle(tmp1, tmp2);
379 __masm-> cmpptr(tmp1, 0);
380 __masm-> jcc(Assembler::notEqual, method_live);
381
382#ifndef _LP641
383 __masm-> pop(tmp2);
384 __masm-> pop(tmp1);
385#endif
386
387 __masm-> bind(bad_call);
388 __masm-> jump(RuntimeAddress(SharedRuntime::get_handle_wrong_method_stub()));
389 __masm-> bind(method_live);
390
391#ifndef _LP641
392 __masm-> pop(tmp2);
393 __masm-> pop(tmp1);
394#endif
395}