Bug Summary

File:jdk/src/hotspot/cpu/x86/compiledIC_x86.cpp
Warning:line 142, column 22
Value stored to 'jump' 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 compiledIC_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/compiledIC_x86.cpp
1/*
2 * Copyright (c) 1997, 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 "asm/macroAssembler.inline.hpp"
27#include "code/codeCache.hpp"
28#include "code/compiledIC.hpp"
29#include "code/icBuffer.hpp"
30#include "code/nmethod.hpp"
31#include "memory/resourceArea.hpp"
32#include "runtime/mutexLocker.hpp"
33#include "runtime/safepoint.hpp"
34
35// ----------------------------------------------------------------------------
36
37#define __ _masm.
38address CompiledStaticCall::emit_to_interp_stub(CodeBuffer &cbuf, address mark) {
39 // Stub is fixed up when the corresponding call is converted from
40 // calling compiled code to calling interpreted code.
41 // movq rbx, 0
42 // jmp -5 # to self
43
44 if (mark == NULL__null) {
45 mark = cbuf.insts_mark(); // Get mark within main instrs section.
46 }
47
48 // Note that the code buffer's insts_mark is always relative to insts.
49 // That's why we must use the macroassembler to generate a stub.
50 MacroAssembler _masm(&cbuf);
51
52 address base = __ start_a_stub(to_interp_stub_size());
53 if (base == NULL__null) {
54 return NULL__null; // CodeBuffer::expand failed.
55 }
56 // Static stub relocation stores the instruction address of the call.
57 __ relocate(static_stub_Relocation::spec(mark), Assembler::imm_operand);
58 // Static stub relocation also tags the Method* in the code-stream.
59 __ mov_metadata(rbx, (Metadata*) NULL__null); // Method is zapped till fixup time.
60 // This is recognized as unresolved by relocs/nativeinst/ic code.
61 __ jump(RuntimeAddress(__ pc()));
62
63 assert(__ pc() - base <= to_interp_stub_size(), "wrong stub size")do { if (!(__ pc() - base <= to_interp_stub_size())) { (*g_assert_poison
) = 'X';; report_vm_error("/home/daniel/Projects/java/jdk/src/hotspot/cpu/x86/compiledIC_x86.cpp"
, 63, "assert(" "__ pc() - base <= to_interp_stub_size()" ") failed"
, "wrong stub size"); ::breakpoint(); } } while (0)
;
64
65 // Update current stubs pointer and restore insts_end.
66 __ end_a_stub();
67 return base;
68}
69#undef __
70
71int CompiledStaticCall::to_interp_stub_size() {
72 return NOT_LP64(10) // movl; jmp
73 LP64_ONLY(15)15; // movq (1+1+8); jmp (1+4)
74}
75
76int CompiledStaticCall::to_trampoline_stub_size() {
77 // x86 doesn't use trampolines.
78 return 0;
79}
80
81// Relocation entries for call stub, compiled java to interpreter.
82int CompiledStaticCall::reloc_to_interp_stub() {
83 return 4; // 3 in emit_to_interp_stub + 1 in emit_call
84}
85
86void CompiledDirectStaticCall::set_to_interpreted(const methodHandle& callee, address entry) {
87 address stub = find_stub();
88 guarantee(stub != NULL, "stub not found")do { if (!(stub != __null)) { (*g_assert_poison) = 'X';; report_vm_error
("/home/daniel/Projects/java/jdk/src/hotspot/cpu/x86/compiledIC_x86.cpp"
, 88, "guarantee(" "stub != NULL" ") failed", "stub not found"
); ::breakpoint(); } } while (0)
;
89
90 if (TraceICs) {
91 ResourceMark rm;
92 tty->print_cr("CompiledDirectStaticCall@" INTPTR_FORMAT"0x%016" "l" "x" ": set_to_interpreted %s",
93 p2i(instruction_address()),
94 callee->name_and_sig_as_C_string());
95 }
96
97 // Creation also verifies the object.
98 NativeMovConstReg* method_holder = nativeMovConstReg_at(stub);
99 NativeJump* jump = nativeJump_at(method_holder->next_instruction_address());
100 verify_mt_safe(callee, entry, method_holder, jump);
101
102 // Update stub.
103 method_holder->set_data((intptr_t)callee());
104 jump->set_jump_destination(entry);
105
106 // Update jump to call.
107 set_destination_mt_safe(stub);
108}
109
110void CompiledDirectStaticCall::set_stub_to_clean(static_stub_Relocation* static_stub) {
111 assert(CompiledICLocker::is_safe(static_stub->addr()), "mt unsafe call")do { if (!(CompiledICLocker::is_safe(static_stub->addr()))
) { (*g_assert_poison) = 'X';; report_vm_error("/home/daniel/Projects/java/jdk/src/hotspot/cpu/x86/compiledIC_x86.cpp"
, 111, "assert(" "CompiledICLocker::is_safe(static_stub->addr())"
") failed", "mt unsafe call"); ::breakpoint(); } } while (0)
;
112 // Reset stub.
113 address stub = static_stub->addr();
114 assert(stub != NULL, "stub not found")do { if (!(stub != __null)) { (*g_assert_poison) = 'X';; report_vm_error
("/home/daniel/Projects/java/jdk/src/hotspot/cpu/x86/compiledIC_x86.cpp"
, 114, "assert(" "stub != __null" ") failed", "stub not found"
); ::breakpoint(); } } while (0)
;
115 // Creation also verifies the object.
116 NativeMovConstReg* method_holder = nativeMovConstReg_at(stub);
117 method_holder->set_data(0);
118 NativeJump* jump = nativeJump_at(method_holder->next_instruction_address());
119 jump->set_jump_destination((address)-1);
120}
121
122
123//-----------------------------------------------------------------------------
124// Non-product mode code
125#ifndef PRODUCT
126
127void CompiledDirectStaticCall::verify() {
128 // Verify call.
129 _call->verify();
130 _call->verify_alignment();
131
132#ifdef ASSERT1
133 CodeBlob *cb = CodeCache::find_blob_unsafe((address) _call);
134 assert(cb != NULL, "sanity")do { if (!(cb != __null)) { (*g_assert_poison) = 'X';; report_vm_error
("/home/daniel/Projects/java/jdk/src/hotspot/cpu/x86/compiledIC_x86.cpp"
, 134, "assert(" "cb != __null" ") failed", "sanity"); ::breakpoint
(); } } while (0)
;
135#endif
136
137 // Verify stub.
138 address stub = find_stub();
139 assert(stub != NULL, "no stub found for static call")do { if (!(stub != __null)) { (*g_assert_poison) = 'X';; report_vm_error
("/home/daniel/Projects/java/jdk/src/hotspot/cpu/x86/compiledIC_x86.cpp"
, 139, "assert(" "stub != __null" ") failed", "no stub found for static call"
); ::breakpoint(); } } while (0)
;
140 // Creation also verifies the object.
141 NativeMovConstReg* method_holder = nativeMovConstReg_at(stub);
142 NativeJump* jump = nativeJump_at(method_holder->next_instruction_address());
Value stored to 'jump' during its initialization is never read
143
144 // Verify state.
145 assert(is_clean() || is_call_to_compiled() || is_call_to_interpreted(), "sanity check")do { if (!(is_clean() || is_call_to_compiled() || is_call_to_interpreted
())) { (*g_assert_poison) = 'X';; report_vm_error("/home/daniel/Projects/java/jdk/src/hotspot/cpu/x86/compiledIC_x86.cpp"
, 145, "assert(" "is_clean() || is_call_to_compiled() || is_call_to_interpreted()"
") failed", "sanity check"); ::breakpoint(); } } while (0)
;
146}
147#endif // !PRODUCT