Bug Summary

File:jdk/src/hotspot/share/code/scopeDesc.hpp
Warning:line 51, column 9
Value stored to 'ignore_sender' 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 pcDesc.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/share/code/pcDesc.cpp
1/*
2 * Copyright (c) 1997, 2020, 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#ifndef SHARE_CODE_SCOPEDESC_HPP
26#define SHARE_CODE_SCOPEDESC_HPP
27
28#include "code/debugInfo.hpp"
29#include "code/pcDesc.hpp"
30#include "oops/method.hpp"
31#include "utilities/growableArray.hpp"
32
33// SimpleScopeDesc is used when all you need to extract from
34// a given pc,nmethod pair is a Method* and a bci. This is
35// quite a bit faster than allocating a full ScopeDesc, but
36// very limited in abilities.
37
38class SimpleScopeDesc : public StackObj {
39 private:
40 Method* _method;
41 int _bci;
42 bool _is_optimized_linkToNative;
43
44 public:
45 SimpleScopeDesc(CompiledMethod* code, address pc) {
46 PcDesc* pc_desc = code->pc_desc_at(pc);
47 assert(pc_desc != NULL, "Must be able to find matching PcDesc")do { if (!(pc_desc != __null)) { (*g_assert_poison) = 'X';; report_vm_error
("/home/daniel/Projects/java/jdk/src/hotspot/share/code/scopeDesc.hpp"
, 47, "assert(" "pc_desc != __null" ") failed", "Must be able to find matching PcDesc"
); ::breakpoint(); } } while (0)
;
48 // save this here so we only have to look up the PcDesc once
49 _is_optimized_linkToNative = pc_desc->is_optimized_linkToNative();
50 DebugInfoReadStream buffer(code, pc_desc->scope_decode_offset());
51 int ignore_sender = buffer.read_int();
Value stored to 'ignore_sender' during its initialization is never read
52 _method = buffer.read_method();
53 _bci = buffer.read_bci();
54 }
55
56 Method* method() { return _method; }
57 int bci() { return _bci; }
58 bool is_optimized_linkToNative() { return _is_optimized_linkToNative; }
59};
60
61// ScopeDescs contain the information that makes source-level debugging of
62// nmethods possible; each scopeDesc describes a method activation
63
64class ScopeDesc : public ResourceObj {
65 public:
66 // Constructor
67 ScopeDesc(const CompiledMethod* code, PcDesc* pd, bool ignore_objects = false);
68
69 // Direct access to scope
70 ScopeDesc* at_offset(int decode_offset) { return new ScopeDesc(this, decode_offset); }
71
72 // JVM state
73 Method* method() const { return _method; }
74 int bci() const { return _bci; }
75 bool should_reexecute() const { return _reexecute; }
76 bool rethrow_exception() const { return _rethrow_exception; }
77 bool return_oop() const { return _return_oop; }
78 // Returns true if one or more NoEscape or ArgEscape objects exist in
79 // any of the scopes at compiled pc.
80 bool has_ea_local_in_scope() const { return _has_ea_local_in_scope; }
81 bool arg_escape() const { return _arg_escape; }
82
83 GrowableArray<ScopeValue*>* locals();
84 GrowableArray<ScopeValue*>* expressions();
85 GrowableArray<MonitorValue*>* monitors();
86 GrowableArray<ScopeValue*>* objects();
87
88 // Stack walking, returns NULL if this is the outer most scope.
89 ScopeDesc* sender() const;
90
91 // Returns where the scope was decoded
92 int decode_offset() const { return _decode_offset; }
93
94 int sender_decode_offset() const { return _sender_decode_offset; }
95
96 // Tells whether sender() returns NULL
97 bool is_top() const;
98
99 private:
100 void initialize(const ScopeDesc* parent, int decode_offset);
101 // Alternative constructors
102 ScopeDesc(const ScopeDesc* parent);
103 ScopeDesc(const ScopeDesc* parent, int decode_offset);
104
105 // JVM state
106 Method* _method;
107 int _bci;
108 bool _reexecute;
109 bool _rethrow_exception;
110 bool _return_oop;
111 bool _has_ea_local_in_scope; // One or more NoEscape or ArgEscape objects exist in
112 // any of the scopes at compiled pc.
113 bool _arg_escape; // Compiled Java call in youngest scope passes ArgEscape
114
115 // Decoding offsets
116 int _decode_offset;
117 int _sender_decode_offset;
118 int _locals_decode_offset;
119 int _expressions_decode_offset;
120 int _monitors_decode_offset;
121
122 // Object pool
123 GrowableArray<ScopeValue*>* _objects;
124
125 // Nmethod information
126 const CompiledMethod* _code;
127
128 // Decoding operations
129 void decode_body();
130 GrowableArray<ScopeValue*>* decode_scope_values(int decode_offset);
131 GrowableArray<MonitorValue*>* decode_monitor_values(int decode_offset);
132 GrowableArray<ScopeValue*>* decode_object_values(int decode_offset);
133
134 DebugInfoReadStream* stream_at(int decode_offset) const;
135
136
137 public:
138 // Verification
139 void verify();
140
141#ifndef PRODUCT
142 public:
143 // Printing support
144 void print_on(outputStream* st) const;
145 void print_on(outputStream* st, PcDesc* pd) const;
146 void print_value_on(outputStream* st) const;
147#endif
148};
149
150#endif // SHARE_CODE_SCOPEDESC_HPP