Bug Summary

File:jdk/src/hotspot/cpu/x86/c1_LIRGenerator_x86.cpp
Warning:line 348, column 12
Value stored to 'left_arg' 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 c1_LIRGenerator_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/c1_LIRGenerator_x86.cpp
1/*
2 * Copyright (c) 2005, 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 "c1/c1_Compilation.hpp"
27#include "c1/c1_FrameMap.hpp"
28#include "c1/c1_Instruction.hpp"
29#include "c1/c1_LIRAssembler.hpp"
30#include "c1/c1_LIRGenerator.hpp"
31#include "c1/c1_Runtime1.hpp"
32#include "c1/c1_ValueStack.hpp"
33#include "ci/ciArray.hpp"
34#include "ci/ciObjArrayKlass.hpp"
35#include "ci/ciTypeArrayKlass.hpp"
36#include "gc/shared/c1/barrierSetC1.hpp"
37#include "runtime/sharedRuntime.hpp"
38#include "runtime/stubRoutines.hpp"
39#include "utilities/powerOfTwo.hpp"
40#include "vmreg_x86.inline.hpp"
41
42#ifdef ASSERT1
43#define __gen()->lir("/home/daniel/Projects/java/jdk/src/hotspot/cpu/x86/c1_LIRGenerator_x86.cpp"
, 43)->
gen()->lir(__FILE__"/home/daniel/Projects/java/jdk/src/hotspot/cpu/x86/c1_LIRGenerator_x86.cpp", __LINE__43)->
44#else
45#define __gen()->lir("/home/daniel/Projects/java/jdk/src/hotspot/cpu/x86/c1_LIRGenerator_x86.cpp"
, 45)->
gen()->lir()->
46#endif
47
48// Item will be loaded into a byte register; Intel only
49void LIRItem::load_byte_item() {
50 load_item();
51 LIR_Opr res = result();
52
53 if (!res->is_virtual() || !_gen->is_vreg_flag_set(res, LIRGenerator::byte_reg)) {
54 // make sure that it is a byte register
55 assert(!value()->type()->is_float() && !value()->type()->is_double(),do { if (!(!value()->type()->is_float() && !value
()->type()->is_double())) { (*g_assert_poison) = 'X';; report_vm_error
("/home/daniel/Projects/java/jdk/src/hotspot/cpu/x86/c1_LIRGenerator_x86.cpp"
, 56, "assert(" "!value()->type()->is_float() && !value()->type()->is_double()"
") failed", "can't load floats in byte register"); ::breakpoint
(); } } while (0)
56 "can't load floats in byte register")do { if (!(!value()->type()->is_float() && !value
()->type()->is_double())) { (*g_assert_poison) = 'X';; report_vm_error
("/home/daniel/Projects/java/jdk/src/hotspot/cpu/x86/c1_LIRGenerator_x86.cpp"
, 56, "assert(" "!value()->type()->is_float() && !value()->type()->is_double()"
") failed", "can't load floats in byte register"); ::breakpoint
(); } } while (0)
;
57 LIR_Opr reg = _gen->rlock_byte(T_BYTE);
58 __gen()->lir("/home/daniel/Projects/java/jdk/src/hotspot/cpu/x86/c1_LIRGenerator_x86.cpp"
, 58)->
move(res, reg);
59
60 _result = reg;
61 }
62}
63
64
65void LIRItem::load_nonconstant() {
66 LIR_Opr r = value()->operand();
67 if (r->is_constant()) {
68 _result = r;
69 } else {
70 load_item();
71 }
72}
73
74//--------------------------------------------------------------
75// LIRGenerator
76//--------------------------------------------------------------
77
78
79LIR_Opr LIRGenerator::exceptionOopOpr() { return FrameMap::rax_oop_opr; }
80LIR_Opr LIRGenerator::exceptionPcOpr() { return FrameMap::rdx_opr; }
81LIR_Opr LIRGenerator::divInOpr() { return FrameMap::rax_opr; }
82LIR_Opr LIRGenerator::divOutOpr() { return FrameMap::rax_opr; }
83LIR_Opr LIRGenerator::remOutOpr() { return FrameMap::rdx_opr; }
84LIR_Opr LIRGenerator::shiftCountOpr() { return FrameMap::rcx_opr; }
85LIR_Opr LIRGenerator::syncLockOpr() { return new_register(T_INT); }
86LIR_Opr LIRGenerator::syncTempOpr() { return FrameMap::rax_opr; }
87LIR_Opr LIRGenerator::getThreadTemp() { return LIR_OprFact::illegalOpr; }
88
89
90LIR_Opr LIRGenerator::result_register_for(ValueType* type, bool callee) {
91 LIR_Opr opr;
92 switch (type->tag()) {
93 case intTag: opr = FrameMap::rax_opr; break;
94 case objectTag: opr = FrameMap::rax_oop_opr; break;
95 case longTag: opr = FrameMap::long0_opr; break;
96#ifdef _LP641
97 case floatTag: opr = FrameMap::xmm0_float_opr; break;
98 case doubleTag: opr = FrameMap::xmm0_double_opr; break;
99#else
100 case floatTag: opr = UseSSE >= 1 ? FrameMap::xmm0_float_opr : FrameMap::fpu0_float_opr; break;
101 case doubleTag: opr = UseSSE >= 2 ? FrameMap::xmm0_double_opr : FrameMap::fpu0_double_opr; break;
102#endif // _LP64
103 case addressTag:
104 default: ShouldNotReachHere()do { (*g_assert_poison) = 'X';; report_should_not_reach_here(
"/home/daniel/Projects/java/jdk/src/hotspot/cpu/x86/c1_LIRGenerator_x86.cpp"
, 104); ::breakpoint(); } while (0)
; return LIR_OprFact::illegalOpr;
105 }
106
107 assert(opr->type_field() == as_OprType(as_BasicType(type)), "type mismatch")do { if (!(opr->type_field() == as_OprType(as_BasicType(type
)))) { (*g_assert_poison) = 'X';; report_vm_error("/home/daniel/Projects/java/jdk/src/hotspot/cpu/x86/c1_LIRGenerator_x86.cpp"
, 107, "assert(" "opr->type_field() == as_OprType(as_BasicType(type))"
") failed", "type mismatch"); ::breakpoint(); } } while (0)
;
108 return opr;
109}
110
111
112LIR_Opr LIRGenerator::rlock_byte(BasicType type) {
113 LIR_Opr reg = new_register(T_INT);
114 set_vreg_flag(reg, LIRGenerator::byte_reg);
115 return reg;
116}
117
118
119//--------- loading items into registers --------------------------------
120
121
122// i486 instructions can inline constants
123bool LIRGenerator::can_store_as_constant(Value v, BasicType type) const {
124 if (type == T_SHORT || type == T_CHAR) {
125 // there is no immediate move of word values in asembler_i486.?pp
126 return false;
127 }
128 Constant* c = v->as_Constant();
129 if (c && c->state_before() == NULL__null) {
130 // constants of any type can be stored directly, except for
131 // unloaded object constants.
132 return true;
133 }
134 return false;
135}
136
137
138bool LIRGenerator::can_inline_as_constant(Value v) const {
139 if (v->type()->tag() == longTag) return false;
140 return v->type()->tag() != objectTag ||
141 (v->type()->is_constant() && v->type()->as_ObjectType()->constant_value()->is_null_object());
142}
143
144
145bool LIRGenerator::can_inline_as_constant(LIR_Const* c) const {
146 if (c->type() == T_LONG) return false;
147 return c->type() != T_OBJECT || c->as_jobject() == NULL__null;
148}
149
150
151LIR_Opr LIRGenerator::safepoint_poll_register() {
152 NOT_LP64( return new_register(T_ADDRESS); )
153 return LIR_OprFact::illegalOpr;
154}
155
156
157LIR_Address* LIRGenerator::generate_address(LIR_Opr base, LIR_Opr index,
158 int shift, int disp, BasicType type) {
159 assert(base->is_register(), "must be")do { if (!(base->is_register())) { (*g_assert_poison) = 'X'
;; report_vm_error("/home/daniel/Projects/java/jdk/src/hotspot/cpu/x86/c1_LIRGenerator_x86.cpp"
, 159, "assert(" "base->is_register()" ") failed", "must be"
); ::breakpoint(); } } while (0)
;
160 if (index->is_constant()) {
161 LIR_Const *constant = index->as_constant_ptr();
162#ifdef _LP641
163 jlong c;
164 if (constant->type() == T_INT) {
165 c = (jlong(index->as_jint()) << shift) + disp;
166 } else {
167 assert(constant->type() == T_LONG, "should be")do { if (!(constant->type() == T_LONG)) { (*g_assert_poison
) = 'X';; report_vm_error("/home/daniel/Projects/java/jdk/src/hotspot/cpu/x86/c1_LIRGenerator_x86.cpp"
, 167, "assert(" "constant->type() == T_LONG" ") failed", "should be"
); ::breakpoint(); } } while (0)
;
168 c = (index->as_jlong() << shift) + disp;
169 }
170 if ((jlong)((jint)c) == c) {
171 return new LIR_Address(base, (jint)c, type);
172 } else {
173 LIR_Opr tmp = new_register(T_LONG);
174 __gen()->lir("/home/daniel/Projects/java/jdk/src/hotspot/cpu/x86/c1_LIRGenerator_x86.cpp"
, 174)->
move(index, tmp);
175 return new LIR_Address(base, tmp, type);
176 }
177#else
178 return new LIR_Address(base,
179 ((intx)(constant->as_jint()) << shift) + disp,
180 type);
181#endif
182 } else {
183 return new LIR_Address(base, index, (LIR_Address::Scale)shift, disp, type);
184 }
185}
186
187
188LIR_Address* LIRGenerator::emit_array_address(LIR_Opr array_opr, LIR_Opr index_opr,
189 BasicType type) {
190 int offset_in_bytes = arrayOopDesc::base_offset_in_bytes(type);
191
192 LIR_Address* addr;
193 if (index_opr->is_constant()) {
194 int elem_size = type2aelembytes(type);
195 addr = new LIR_Address(array_opr,
196 offset_in_bytes + (intx)(index_opr->as_jint()) * elem_size, type);
197 } else {
198#ifdef _LP641
199 if (index_opr->type() == T_INT) {
200 LIR_Opr tmp = new_register(T_LONG);
201 __gen()->lir("/home/daniel/Projects/java/jdk/src/hotspot/cpu/x86/c1_LIRGenerator_x86.cpp"
, 201)->
convert(Bytecodes::_i2l, index_opr, tmp);
202 index_opr = tmp;
203 }
204#endif // _LP64
205 addr = new LIR_Address(array_opr,
206 index_opr,
207 LIR_Address::scale(type),
208 offset_in_bytes, type);
209 }
210 return addr;
211}
212
213
214LIR_Opr LIRGenerator::load_immediate(int x, BasicType type) {
215 LIR_Opr r;
216 if (type == T_LONG) {
217 r = LIR_OprFact::longConst(x);
218 } else if (type == T_INT) {
219 r = LIR_OprFact::intConst(x);
220 } else {
221 ShouldNotReachHere()do { (*g_assert_poison) = 'X';; report_should_not_reach_here(
"/home/daniel/Projects/java/jdk/src/hotspot/cpu/x86/c1_LIRGenerator_x86.cpp"
, 221); ::breakpoint(); } while (0)
;
222 }
223 return r;
224}
225
226void LIRGenerator::increment_counter(address counter, BasicType type, int step) {
227 LIR_Opr pointer = new_pointer_register();
228 __gen()->lir("/home/daniel/Projects/java/jdk/src/hotspot/cpu/x86/c1_LIRGenerator_x86.cpp"
, 228)->
move(LIR_OprFact::intptrConst(counter), pointer);
229 LIR_Address* addr = new LIR_Address(pointer, type);
230 increment_counter(addr, step);
231}
232
233
234void LIRGenerator::increment_counter(LIR_Address* addr, int step) {
235 __gen()->lir("/home/daniel/Projects/java/jdk/src/hotspot/cpu/x86/c1_LIRGenerator_x86.cpp"
, 235)->
add((LIR_Opr)addr, LIR_OprFact::intConst(step), (LIR_Opr)addr);
236}
237
238void LIRGenerator::cmp_mem_int(LIR_Condition condition, LIR_Opr base, int disp, int c, CodeEmitInfo* info) {
239 __gen()->lir("/home/daniel/Projects/java/jdk/src/hotspot/cpu/x86/c1_LIRGenerator_x86.cpp"
, 239)->
cmp_mem_int(condition, base, disp, c, info);
240}
241
242
243void LIRGenerator::cmp_reg_mem(LIR_Condition condition, LIR_Opr reg, LIR_Opr base, int disp, BasicType type, CodeEmitInfo* info) {
244 __gen()->lir("/home/daniel/Projects/java/jdk/src/hotspot/cpu/x86/c1_LIRGenerator_x86.cpp"
, 244)->
cmp_reg_mem(condition, reg, new LIR_Address(base, disp, type), info);
245}
246
247
248bool LIRGenerator::strength_reduce_multiply(LIR_Opr left, jint c, LIR_Opr result, LIR_Opr tmp) {
249 if (tmp->is_valid() && c > 0 && c < max_jint) {
250 if (is_power_of_2(c + 1)) {
251 __gen()->lir("/home/daniel/Projects/java/jdk/src/hotspot/cpu/x86/c1_LIRGenerator_x86.cpp"
, 251)->
move(left, tmp);
252 __gen()->lir("/home/daniel/Projects/java/jdk/src/hotspot/cpu/x86/c1_LIRGenerator_x86.cpp"
, 252)->
shift_left(left, log2i_exact(c + 1), left);
253 __gen()->lir("/home/daniel/Projects/java/jdk/src/hotspot/cpu/x86/c1_LIRGenerator_x86.cpp"
, 253)->
sub(left, tmp, result);
254 return true;
255 } else if (is_power_of_2(c - 1)) {
256 __gen()->lir("/home/daniel/Projects/java/jdk/src/hotspot/cpu/x86/c1_LIRGenerator_x86.cpp"
, 256)->
move(left, tmp);
257 __gen()->lir("/home/daniel/Projects/java/jdk/src/hotspot/cpu/x86/c1_LIRGenerator_x86.cpp"
, 257)->
shift_left(left, log2i_exact(c - 1), left);
258 __gen()->lir("/home/daniel/Projects/java/jdk/src/hotspot/cpu/x86/c1_LIRGenerator_x86.cpp"
, 258)->
add(left, tmp, result);
259 return true;
260 }
261 }
262 return false;
263}
264
265
266void LIRGenerator::store_stack_parameter (LIR_Opr item, ByteSize offset_from_sp) {
267 BasicType type = item->type();
268 __gen()->lir("/home/daniel/Projects/java/jdk/src/hotspot/cpu/x86/c1_LIRGenerator_x86.cpp"
, 268)->
store(item, new LIR_Address(FrameMap::rsp_opr, in_bytes(offset_from_sp), type));
269}
270
271void LIRGenerator::array_store_check(LIR_Opr value, LIR_Opr array, CodeEmitInfo* store_check_info, ciMethod* profiled_method, int profiled_bci) {
272 LIR_Opr tmp1 = new_register(objectType);
273 LIR_Opr tmp2 = new_register(objectType);
274 LIR_Opr tmp3 = new_register(objectType);
275 __gen()->lir("/home/daniel/Projects/java/jdk/src/hotspot/cpu/x86/c1_LIRGenerator_x86.cpp"
, 275)->
store_check(value, array, tmp1, tmp2, tmp3, store_check_info, profiled_method, profiled_bci);
276}
277
278//----------------------------------------------------------------------
279// visitor functions
280//----------------------------------------------------------------------
281
282void LIRGenerator::do_MonitorEnter(MonitorEnter* x) {
283 assert(x->is_pinned(),"")do { if (!(x->is_pinned())) { (*g_assert_poison) = 'X';; report_vm_error
("/home/daniel/Projects/java/jdk/src/hotspot/cpu/x86/c1_LIRGenerator_x86.cpp"
, 283, "assert(" "x->is_pinned()" ") failed", ""); ::breakpoint
(); } } while (0)
;
284 LIRItem obj(x->obj(), this);
285 obj.load_item();
286
287 set_no_result(x);
288
289 // "lock" stores the address of the monitor stack slot, so this is not an oop
290 LIR_Opr lock = new_register(T_INT);
291
292 CodeEmitInfo* info_for_exception = NULL__null;
293 if (x->needs_null_check()) {
294 info_for_exception = state_for(x);
295 }
296 // this CodeEmitInfo must not have the xhandlers because here the
297 // object is already locked (xhandlers expect object to be unlocked)
298 CodeEmitInfo* info = state_for(x, x->state(), true);
299 monitor_enter(obj.result(), lock, syncTempOpr(), LIR_OprFact::illegalOpr,
300 x->monitor_no(), info_for_exception, info);
301}
302
303
304void LIRGenerator::do_MonitorExit(MonitorExit* x) {
305 assert(x->is_pinned(),"")do { if (!(x->is_pinned())) { (*g_assert_poison) = 'X';; report_vm_error
("/home/daniel/Projects/java/jdk/src/hotspot/cpu/x86/c1_LIRGenerator_x86.cpp"
, 305, "assert(" "x->is_pinned()" ") failed", ""); ::breakpoint
(); } } while (0)
;
306
307 LIRItem obj(x->obj(), this);
308 obj.dont_load_item();
309
310 LIR_Opr lock = new_register(T_INT);
311 LIR_Opr obj_temp = new_register(T_INT);
312 set_no_result(x);
313 monitor_exit(obj_temp, lock, syncTempOpr(), LIR_OprFact::illegalOpr, x->monitor_no());
314}
315
316
317// _ineg, _lneg, _fneg, _dneg
318void LIRGenerator::do_NegateOp(NegateOp* x) {
319 LIRItem value(x->x(), this);
320 value.set_destroys_register();
321 value.load_item();
322 LIR_Opr reg = rlock(x);
323
324 LIR_Opr tmp = LIR_OprFact::illegalOpr;
325#ifdef _LP641
326 if (UseAVX > 2 && !VM_Version::supports_avx512vl()) {
327 if (x->type()->tag() == doubleTag) {
328 tmp = new_register(T_DOUBLE);
329 __gen()->lir("/home/daniel/Projects/java/jdk/src/hotspot/cpu/x86/c1_LIRGenerator_x86.cpp"
, 329)->
move(LIR_OprFact::doubleConst(-0.0), tmp);
330 }
331 else if (x->type()->tag() == floatTag) {
332 tmp = new_register(T_FLOAT);
333 __gen()->lir("/home/daniel/Projects/java/jdk/src/hotspot/cpu/x86/c1_LIRGenerator_x86.cpp"
, 333)->
move(LIR_OprFact::floatConst(-0.0), tmp);
334 }
335 }
336#endif
337 __gen()->lir("/home/daniel/Projects/java/jdk/src/hotspot/cpu/x86/c1_LIRGenerator_x86.cpp"
, 337)->
negate(value.result(), reg, tmp);
338
339 set_result(x, round_item(reg));
340}
341
342
343// for _fadd, _fmul, _fsub, _fdiv, _frem
344// _dadd, _dmul, _dsub, _ddiv, _drem
345void LIRGenerator::do_ArithmeticOp_FPU(ArithmeticOp* x) {
346 LIRItem left(x->x(), this);
347 LIRItem right(x->y(), this);
348 LIRItem* left_arg = &left;
Value stored to 'left_arg' during its initialization is never read
349 LIRItem* right_arg = &right;
350 assert(!left.is_stack() || !right.is_stack(), "can't both be memory operands")do { if (!(!left.is_stack() || !right.is_stack())) { (*g_assert_poison
) = 'X';; report_vm_error("/home/daniel/Projects/java/jdk/src/hotspot/cpu/x86/c1_LIRGenerator_x86.cpp"
, 350, "assert(" "!left.is_stack() || !right.is_stack()" ") failed"
, "can't both be memory operands"); ::breakpoint(); } } while
(0)
;
351 bool must_load_both = (x->op() == Bytecodes::_frem || x->op() == Bytecodes::_drem);
352 if (left.is_register() || x->x()->type()->is_constant() || must_load_both) {
353 left.load_item();
354 } else {
355 left.dont_load_item();
356 }
357
358#ifndef _LP641
359 // do not load right operand if it is a constant. only 0 and 1 are
360 // loaded because there are special instructions for loading them
361 // without memory access (not needed for SSE2 instructions)
362 bool must_load_right = false;
363 if (right.is_constant()) {
364 LIR_Const* c = right.result()->as_constant_ptr();
365 assert(c != NULL, "invalid constant")do { if (!(c != __null)) { (*g_assert_poison) = 'X';; report_vm_error
("/home/daniel/Projects/java/jdk/src/hotspot/cpu/x86/c1_LIRGenerator_x86.cpp"
, 365, "assert(" "c != __null" ") failed", "invalid constant"
); ::breakpoint(); } } while (0)
;
366 assert(c->type() == T_FLOAT || c->type() == T_DOUBLE, "invalid type")do { if (!(c->type() == T_FLOAT || c->type() == T_DOUBLE
)) { (*g_assert_poison) = 'X';; report_vm_error("/home/daniel/Projects/java/jdk/src/hotspot/cpu/x86/c1_LIRGenerator_x86.cpp"
, 366, "assert(" "c->type() == T_FLOAT || c->type() == T_DOUBLE"
") failed", "invalid type"); ::breakpoint(); } } while (0)
;
367
368 if (c->type() == T_FLOAT) {
369 must_load_right = UseSSE < 1 && (c->is_one_float() || c->is_zero_float());
370 } else {
371 must_load_right = UseSSE < 2 && (c->is_one_double() || c->is_zero_double());
372 }
373 }
374#endif // !LP64
375
376 if (must_load_both) {
377 // frem and drem destroy also right operand, so move it to a new register
378 right.set_destroys_register();
379 right.load_item();
380 } else if (right.is_register()) {
381 right.load_item();
382#ifndef _LP641
383 } else if (must_load_right) {
384 right.load_item();
385#endif // !LP64
386 } else {
387 right.dont_load_item();
388 }
389 LIR_Opr reg = rlock(x);
390 LIR_Opr tmp = LIR_OprFact::illegalOpr;
391 if (x->op() == Bytecodes::_dmul || x->op() == Bytecodes::_ddiv) {
392 tmp = new_register(T_DOUBLE);
393 }
394
395#ifdef _LP641
396 if (x->op() == Bytecodes::_frem || x->op() == Bytecodes::_drem) {
397 // frem and drem are implemented as a direct call into the runtime.
398 LIRItem left(x->x(), this);
399 LIRItem right(x->y(), this);
400
401 BasicType bt = as_BasicType(x->type());
402 BasicTypeList signature(2);
403 signature.append(bt);
404 signature.append(bt);
405 CallingConvention* cc = frame_map()->c_calling_convention(&signature);
406
407 const LIR_Opr result_reg = result_register_for(x->type());
408 left.load_item_force(cc->at(0));
409 right.load_item_force(cc->at(1));
410
411 address entry = NULL__null;
412 switch (x->op()) {
413 case Bytecodes::_frem:
414 entry = CAST_FROM_FN_PTR(address, SharedRuntime::frem)((address)((address_word)(SharedRuntime::frem)));
415 break;
416 case Bytecodes::_drem:
417 entry = CAST_FROM_FN_PTR(address, SharedRuntime::drem)((address)((address_word)(SharedRuntime::drem)));
418 break;
419 default:
420 ShouldNotReachHere()do { (*g_assert_poison) = 'X';; report_should_not_reach_here(
"/home/daniel/Projects/java/jdk/src/hotspot/cpu/x86/c1_LIRGenerator_x86.cpp"
, 420); ::breakpoint(); } while (0)
;
421 }
422
423 LIR_Opr result = rlock_result(x);
424 __gen()->lir("/home/daniel/Projects/java/jdk/src/hotspot/cpu/x86/c1_LIRGenerator_x86.cpp"
, 424)->
call_runtime_leaf(entry, getThreadTemp(), result_reg, cc->args());
425 __gen()->lir("/home/daniel/Projects/java/jdk/src/hotspot/cpu/x86/c1_LIRGenerator_x86.cpp"
, 425)->
move(result_reg, result);
426 } else {
427 arithmetic_op_fpu(x->op(), reg, left.result(), right.result(), tmp);
428 set_result(x, round_item(reg));
429 }
430#else
431 if ((UseSSE >= 1 && x->op() == Bytecodes::_frem) || (UseSSE >= 2 && x->op() == Bytecodes::_drem)) {
432 // special handling for frem and drem: no SSE instruction, so must use FPU with temporary fpu stack slots
433 LIR_Opr fpu0, fpu1;
434 if (x->op() == Bytecodes::_frem) {
435 fpu0 = LIR_OprFact::single_fpu(0);
436 fpu1 = LIR_OprFact::single_fpu(1);
437 } else {
438 fpu0 = LIR_OprFact::double_fpu(0);
439 fpu1 = LIR_OprFact::double_fpu(1);
440 }
441 __gen()->lir("/home/daniel/Projects/java/jdk/src/hotspot/cpu/x86/c1_LIRGenerator_x86.cpp"
, 441)->
move(right.result(), fpu1); // order of left and right operand is important!
442 __gen()->lir("/home/daniel/Projects/java/jdk/src/hotspot/cpu/x86/c1_LIRGenerator_x86.cpp"
, 442)->
move(left.result(), fpu0);
443 __gen()->lir("/home/daniel/Projects/java/jdk/src/hotspot/cpu/x86/c1_LIRGenerator_x86.cpp"
, 443)->
rem (fpu0, fpu1, fpu0);
444 __gen()->lir("/home/daniel/Projects/java/jdk/src/hotspot/cpu/x86/c1_LIRGenerator_x86.cpp"
, 444)->
move(fpu0, reg);
445
446 } else {
447 arithmetic_op_fpu(x->op(), reg, left.result(), right.result(), tmp);
448 }
449 set_result(x, round_item(reg));
450#endif // _LP64
451}
452
453
454// for _ladd, _lmul, _lsub, _ldiv, _lrem
455void LIRGenerator::do_ArithmeticOp_Long(ArithmeticOp* x) {
456 if (x->op() == Bytecodes::_ldiv || x->op() == Bytecodes::_lrem ) {
457 // long division is implemented as a direct call into the runtime
458 LIRItem left(x->x(), this);
459 LIRItem right(x->y(), this);
460
461 // the check for division by zero destroys the right operand
462 right.set_destroys_register();
463
464 BasicTypeList signature(2);
465 signature.append(T_LONG);
466 signature.append(T_LONG);
467 CallingConvention* cc = frame_map()->c_calling_convention(&signature);
468
469 // check for division by zero (destroys registers of right operand!)
470 CodeEmitInfo* info = state_for(x);
471
472 const LIR_Opr result_reg = result_register_for(x->type());
473 left.load_item_force(cc->at(1));
474 right.load_item();
475
476 __gen()->lir("/home/daniel/Projects/java/jdk/src/hotspot/cpu/x86/c1_LIRGenerator_x86.cpp"
, 476)->
move(right.result(), cc->at(0));
477
478 __gen()->lir("/home/daniel/Projects/java/jdk/src/hotspot/cpu/x86/c1_LIRGenerator_x86.cpp"
, 478)->
cmp(lir_cond_equal, right.result(), LIR_OprFact::longConst(0));
479 __gen()->lir("/home/daniel/Projects/java/jdk/src/hotspot/cpu/x86/c1_LIRGenerator_x86.cpp"
, 479)->
branch(lir_cond_equal, new DivByZeroStub(info));
480
481 address entry = NULL__null;
482 switch (x->op()) {
483 case Bytecodes::_lrem:
484 entry = CAST_FROM_FN_PTR(address, SharedRuntime::lrem)((address)((address_word)(SharedRuntime::lrem)));
485 break; // check if dividend is 0 is done elsewhere
486 case Bytecodes::_ldiv:
487 entry = CAST_FROM_FN_PTR(address, SharedRuntime::ldiv)((address)((address_word)(SharedRuntime::ldiv)));
488 break; // check if dividend is 0 is done elsewhere
489 default:
490 ShouldNotReachHere()do { (*g_assert_poison) = 'X';; report_should_not_reach_here(
"/home/daniel/Projects/java/jdk/src/hotspot/cpu/x86/c1_LIRGenerator_x86.cpp"
, 490); ::breakpoint(); } while (0)
;
491 }
492
493 LIR_Opr result = rlock_result(x);
494 __gen()->lir("/home/daniel/Projects/java/jdk/src/hotspot/cpu/x86/c1_LIRGenerator_x86.cpp"
, 494)->
call_runtime_leaf(entry, getThreadTemp(), result_reg, cc->args());
495 __gen()->lir("/home/daniel/Projects/java/jdk/src/hotspot/cpu/x86/c1_LIRGenerator_x86.cpp"
, 495)->
move(result_reg, result);
496 } else if (x->op() == Bytecodes::_lmul) {
497 // missing test if instr is commutative and if we should swap
498 LIRItem left(x->x(), this);
499 LIRItem right(x->y(), this);
500
501 // right register is destroyed by the long mul, so it must be
502 // copied to a new register.
503 right.set_destroys_register();
504
505 left.load_item();
506 right.load_item();
507
508 LIR_Opr reg = FrameMap::long0_opr;
509 arithmetic_op_long(x->op(), reg, left.result(), right.result(), NULL__null);
510 LIR_Opr result = rlock_result(x);
511 __gen()->lir("/home/daniel/Projects/java/jdk/src/hotspot/cpu/x86/c1_LIRGenerator_x86.cpp"
, 511)->
move(reg, result);
512 } else {
513 // missing test if instr is commutative and if we should swap
514 LIRItem left(x->x(), this);
515 LIRItem right(x->y(), this);
516
517 left.load_item();
518 // don't load constants to save register
519 right.load_nonconstant();
520 rlock_result(x);
521 arithmetic_op_long(x->op(), x->operand(), left.result(), right.result(), NULL__null);
522 }
523}
524
525
526
527// for: _iadd, _imul, _isub, _idiv, _irem
528void LIRGenerator::do_ArithmeticOp_Int(ArithmeticOp* x) {
529 if (x->op() == Bytecodes::_idiv || x->op() == Bytecodes::_irem) {
530 // The requirements for division and modulo
531 // input : rax,: dividend min_int
532 // reg: divisor (may not be rax,/rdx) -1
533 //
534 // output: rax,: quotient (= rax, idiv reg) min_int
535 // rdx: remainder (= rax, irem reg) 0
536
537 // rax, and rdx will be destroyed
538
539 // Note: does this invalidate the spec ???
540 LIRItem right(x->y(), this);
541 LIRItem left(x->x() , this); // visit left second, so that the is_register test is valid
542
543 // call state_for before load_item_force because state_for may
544 // force the evaluation of other instructions that are needed for
545 // correct debug info. Otherwise the live range of the fix
546 // register might be too long.
547 CodeEmitInfo* info = state_for(x);
548
549 left.load_item_force(divInOpr());
550
551 right.load_item();
552
553 LIR_Opr result = rlock_result(x);
554 LIR_Opr result_reg;
555 if (x->op() == Bytecodes::_idiv) {
556 result_reg = divOutOpr();
557 } else {
558 result_reg = remOutOpr();
559 }
560
561 if (!ImplicitDiv0Checks) {
562 __gen()->lir("/home/daniel/Projects/java/jdk/src/hotspot/cpu/x86/c1_LIRGenerator_x86.cpp"
, 562)->
cmp(lir_cond_equal, right.result(), LIR_OprFact::intConst(0));
563 __gen()->lir("/home/daniel/Projects/java/jdk/src/hotspot/cpu/x86/c1_LIRGenerator_x86.cpp"
, 563)->
branch(lir_cond_equal, new DivByZeroStub(info));
564 // Idiv/irem cannot trap (passing info would generate an assertion).
565 info = NULL__null;
566 }
567 LIR_Opr tmp = FrameMap::rdx_opr; // idiv and irem use rdx in their implementation
568 if (x->op() == Bytecodes::_irem) {
569 __gen()->lir("/home/daniel/Projects/java/jdk/src/hotspot/cpu/x86/c1_LIRGenerator_x86.cpp"
, 569)->
irem(left.result(), right.result(), result_reg, tmp, info);
570 } else if (x->op() == Bytecodes::_idiv) {
571 __gen()->lir("/home/daniel/Projects/java/jdk/src/hotspot/cpu/x86/c1_LIRGenerator_x86.cpp"
, 571)->
idiv(left.result(), right.result(), result_reg, tmp, info);
572 } else {
573 ShouldNotReachHere()do { (*g_assert_poison) = 'X';; report_should_not_reach_here(
"/home/daniel/Projects/java/jdk/src/hotspot/cpu/x86/c1_LIRGenerator_x86.cpp"
, 573); ::breakpoint(); } while (0)
;
574 }
575
576 __gen()->lir("/home/daniel/Projects/java/jdk/src/hotspot/cpu/x86/c1_LIRGenerator_x86.cpp"
, 576)->
move(result_reg, result);
577 } else {
578 // missing test if instr is commutative and if we should swap
579 LIRItem left(x->x(), this);
580 LIRItem right(x->y(), this);
581 LIRItem* left_arg = &left;
582 LIRItem* right_arg = &right;
583 if (x->is_commutative() && left.is_stack() && right.is_register()) {
584 // swap them if left is real stack (or cached) and right is real register(not cached)
585 left_arg = &right;
586 right_arg = &left;
587 }
588
589 left_arg->load_item();
590
591 // do not need to load right, as we can handle stack and constants
592 if (x->op() == Bytecodes::_imul ) {
593 // check if we can use shift instead
594 bool use_constant = false;
595 bool use_tmp = false;
596 if (right_arg->is_constant()) {
597 jint iconst = right_arg->get_jint_constant();
598 if (iconst > 0 && iconst < max_jint) {
599 if (is_power_of_2(iconst)) {
600 use_constant = true;
601 } else if (is_power_of_2(iconst - 1) || is_power_of_2(iconst + 1)) {
602 use_constant = true;
603 use_tmp = true;
604 }
605 }
606 }
607 if (use_constant) {
608 right_arg->dont_load_item();
609 } else {
610 right_arg->load_item();
611 }
612 LIR_Opr tmp = LIR_OprFact::illegalOpr;
613 if (use_tmp) {
614 tmp = new_register(T_INT);
615 }
616 rlock_result(x);
617
618 arithmetic_op_int(x->op(), x->operand(), left_arg->result(), right_arg->result(), tmp);
619 } else {
620 right_arg->dont_load_item();
621 rlock_result(x);
622 LIR_Opr tmp = LIR_OprFact::illegalOpr;
623 arithmetic_op_int(x->op(), x->operand(), left_arg->result(), right_arg->result(), tmp);
624 }
625 }
626}
627
628
629void LIRGenerator::do_ArithmeticOp(ArithmeticOp* x) {
630 // when an operand with use count 1 is the left operand, then it is
631 // likely that no move for 2-operand-LIR-form is necessary
632 if (x->is_commutative() && x->y()->as_Constant() == NULL__null && x->x()->use_count() > x->y()->use_count()) {
633 x->swap_operands();
634 }
635
636 ValueTag tag = x->type()->tag();
637 assert(x->x()->type()->tag() == tag && x->y()->type()->tag() == tag, "wrong parameters")do { if (!(x->x()->type()->tag() == tag && x
->y()->type()->tag() == tag)) { (*g_assert_poison) =
'X';; report_vm_error("/home/daniel/Projects/java/jdk/src/hotspot/cpu/x86/c1_LIRGenerator_x86.cpp"
, 637, "assert(" "x->x()->type()->tag() == tag && x->y()->type()->tag() == tag"
") failed", "wrong parameters"); ::breakpoint(); } } while (
0)
;
638 switch (tag) {
639 case floatTag:
640 case doubleTag: do_ArithmeticOp_FPU(x); return;
641 case longTag: do_ArithmeticOp_Long(x); return;
642 case intTag: do_ArithmeticOp_Int(x); return;
643 default: ShouldNotReachHere()do { (*g_assert_poison) = 'X';; report_should_not_reach_here(
"/home/daniel/Projects/java/jdk/src/hotspot/cpu/x86/c1_LIRGenerator_x86.cpp"
, 643); ::breakpoint(); } while (0)
; return;
644 }
645}
646
647
648// _ishl, _lshl, _ishr, _lshr, _iushr, _lushr
649void LIRGenerator::do_ShiftOp(ShiftOp* x) {
650 // count must always be in rcx
651 LIRItem value(x->x(), this);
652 LIRItem count(x->y(), this);
653
654 ValueTag elemType = x->type()->tag();
655 bool must_load_count = !count.is_constant() || elemType == longTag;
656 if (must_load_count) {
657 // count for long must be in register
658 count.load_item_force(shiftCountOpr());
659 } else {
660 count.dont_load_item();
661 }
662 value.load_item();
663 LIR_Opr reg = rlock_result(x);
664
665 shift_op(x->op(), reg, value.result(), count.result(), LIR_OprFact::illegalOpr);
666}
667
668
669// _iand, _land, _ior, _lor, _ixor, _lxor
670void LIRGenerator::do_LogicOp(LogicOp* x) {
671 // when an operand with use count 1 is the left operand, then it is
672 // likely that no move for 2-operand-LIR-form is necessary
673 if (x->is_commutative() && x->y()->as_Constant() == NULL__null && x->x()->use_count() > x->y()->use_count()) {
674 x->swap_operands();
675 }
676
677 LIRItem left(x->x(), this);
678 LIRItem right(x->y(), this);
679
680 left.load_item();
681 right.load_nonconstant();
682 LIR_Opr reg = rlock_result(x);
683
684 logic_op(x->op(), reg, left.result(), right.result());
685}
686
687
688
689// _lcmp, _fcmpl, _fcmpg, _dcmpl, _dcmpg
690void LIRGenerator::do_CompareOp(CompareOp* x) {
691 LIRItem left(x->x(), this);
692 LIRItem right(x->y(), this);
693 ValueTag tag = x->x()->type()->tag();
694 if (tag == longTag) {
695 left.set_destroys_register();
696 }
697 left.load_item();
698 right.load_item();
699 LIR_Opr reg = rlock_result(x);
700
701 if (x->x()->type()->is_float_kind()) {
702 Bytecodes::Code code = x->op();
703 __gen()->lir("/home/daniel/Projects/java/jdk/src/hotspot/cpu/x86/c1_LIRGenerator_x86.cpp"
, 703)->
fcmp2int(left.result(), right.result(), reg, (code == Bytecodes::_fcmpl || code == Bytecodes::_dcmpl));
704 } else if (x->x()->type()->tag() == longTag) {
705 __gen()->lir("/home/daniel/Projects/java/jdk/src/hotspot/cpu/x86/c1_LIRGenerator_x86.cpp"
, 705)->
lcmp2int(left.result(), right.result(), reg);
706 } else {
707 Unimplemented()do { (*g_assert_poison) = 'X';; report_unimplemented("/home/daniel/Projects/java/jdk/src/hotspot/cpu/x86/c1_LIRGenerator_x86.cpp"
, 707); ::breakpoint(); } while (0)
;
708 }
709}
710
711LIR_Opr LIRGenerator::atomic_cmpxchg(BasicType type, LIR_Opr addr, LIRItem& cmp_value, LIRItem& new_value) {
712 LIR_Opr ill = LIR_OprFact::illegalOpr; // for convenience
713 if (is_reference_type(type)) {
714 cmp_value.load_item_force(FrameMap::rax_oop_opr);
715 new_value.load_item();
716 __gen()->lir("/home/daniel/Projects/java/jdk/src/hotspot/cpu/x86/c1_LIRGenerator_x86.cpp"
, 716)->
cas_obj(addr->as_address_ptr()->base(), cmp_value.result(), new_value.result(), ill, ill);
717 } else if (type == T_INT) {
718 cmp_value.load_item_force(FrameMap::rax_opr);
719 new_value.load_item();
720 __gen()->lir("/home/daniel/Projects/java/jdk/src/hotspot/cpu/x86/c1_LIRGenerator_x86.cpp"
, 720)->
cas_int(addr->as_address_ptr()->base(), cmp_value.result(), new_value.result(), ill, ill);
721 } else if (type == T_LONG) {
722 cmp_value.load_item_force(FrameMap::long0_opr);
723 new_value.load_item_force(FrameMap::long1_opr);
724 __gen()->lir("/home/daniel/Projects/java/jdk/src/hotspot/cpu/x86/c1_LIRGenerator_x86.cpp"
, 724)->
cas_long(addr->as_address_ptr()->base(), cmp_value.result(), new_value.result(), ill, ill);
725 } else {
726 Unimplemented()do { (*g_assert_poison) = 'X';; report_unimplemented("/home/daniel/Projects/java/jdk/src/hotspot/cpu/x86/c1_LIRGenerator_x86.cpp"
, 726); ::breakpoint(); } while (0)
;
727 }
728 LIR_Opr result = new_register(T_INT);
729 __gen()->lir("/home/daniel/Projects/java/jdk/src/hotspot/cpu/x86/c1_LIRGenerator_x86.cpp"
, 729)->
cmove(lir_cond_equal, LIR_OprFact::intConst(1), LIR_OprFact::intConst(0),
730 result, T_INT);
731 return result;
732}
733
734LIR_Opr LIRGenerator::atomic_xchg(BasicType type, LIR_Opr addr, LIRItem& value) {
735 bool is_oop = is_reference_type(type);
736 LIR_Opr result = new_register(type);
737 value.load_item();
738 // Because we want a 2-arg form of xchg and xadd
739 __gen()->lir("/home/daniel/Projects/java/jdk/src/hotspot/cpu/x86/c1_LIRGenerator_x86.cpp"
, 739)->
move(value.result(), result);
740 assert(type == T_INT || is_oop LP64_ONLY( || type == T_LONG ), "unexpected type")do { if (!(type == T_INT || is_oop || type == T_LONG)) { (*g_assert_poison
) = 'X';; report_vm_error("/home/daniel/Projects/java/jdk/src/hotspot/cpu/x86/c1_LIRGenerator_x86.cpp"
, 740, "assert(" "type == T_INT || is_oop || type == T_LONG" ") failed"
, "unexpected type"); ::breakpoint(); } } while (0)
;
741 __gen()->lir("/home/daniel/Projects/java/jdk/src/hotspot/cpu/x86/c1_LIRGenerator_x86.cpp"
, 741)->
xchg(addr, result, result, LIR_OprFact::illegalOpr);
742 return result;
743}
744
745LIR_Opr LIRGenerator::atomic_add(BasicType type, LIR_Opr addr, LIRItem& value) {
746 LIR_Opr result = new_register(type);
747 value.load_item();
748 // Because we want a 2-arg form of xchg and xadd
749 __gen()->lir("/home/daniel/Projects/java/jdk/src/hotspot/cpu/x86/c1_LIRGenerator_x86.cpp"
, 749)->
move(value.result(), result);
750 assert(type == T_INT LP64_ONLY( || type == T_LONG ), "unexpected type")do { if (!(type == T_INT || type == T_LONG)) { (*g_assert_poison
) = 'X';; report_vm_error("/home/daniel/Projects/java/jdk/src/hotspot/cpu/x86/c1_LIRGenerator_x86.cpp"
, 750, "assert(" "type == T_INT || type == T_LONG" ") failed"
, "unexpected type"); ::breakpoint(); } } while (0)
;
751 __gen()->lir("/home/daniel/Projects/java/jdk/src/hotspot/cpu/x86/c1_LIRGenerator_x86.cpp"
, 751)->
xadd(addr, result, result, LIR_OprFact::illegalOpr);
752 return result;
753}
754
755void LIRGenerator::do_FmaIntrinsic(Intrinsic* x) {
756 assert(x->number_of_arguments() == 3, "wrong type")do { if (!(x->number_of_arguments() == 3)) { (*g_assert_poison
) = 'X';; report_vm_error("/home/daniel/Projects/java/jdk/src/hotspot/cpu/x86/c1_LIRGenerator_x86.cpp"
, 756, "assert(" "x->number_of_arguments() == 3" ") failed"
, "wrong type"); ::breakpoint(); } } while (0)
;
757 assert(UseFMA, "Needs FMA instructions support.")do { if (!(UseFMA)) { (*g_assert_poison) = 'X';; report_vm_error
("/home/daniel/Projects/java/jdk/src/hotspot/cpu/x86/c1_LIRGenerator_x86.cpp"
, 757, "assert(" "UseFMA" ") failed", "Needs FMA instructions support."
); ::breakpoint(); } } while (0)
;
758 LIRItem value(x->argument_at(0), this);
759 LIRItem value1(x->argument_at(1), this);
760 LIRItem value2(x->argument_at(2), this);
761
762 value2.set_destroys_register();
763
764 value.load_item();
765 value1.load_item();
766 value2.load_item();
767
768 LIR_Opr calc_input = value.result();
769 LIR_Opr calc_input1 = value1.result();
770 LIR_Opr calc_input2 = value2.result();
771 LIR_Opr calc_result = rlock_result(x);
772
773 switch (x->id()) {
774 case vmIntrinsics::_fmaD: __gen()->lir("/home/daniel/Projects/java/jdk/src/hotspot/cpu/x86/c1_LIRGenerator_x86.cpp"
, 774)->
fmad(calc_input, calc_input1, calc_input2, calc_result); break;
775 case vmIntrinsics::_fmaF: __gen()->lir("/home/daniel/Projects/java/jdk/src/hotspot/cpu/x86/c1_LIRGenerator_x86.cpp"
, 775)->
fmaf(calc_input, calc_input1, calc_input2, calc_result); break;
776 default: ShouldNotReachHere()do { (*g_assert_poison) = 'X';; report_should_not_reach_here(
"/home/daniel/Projects/java/jdk/src/hotspot/cpu/x86/c1_LIRGenerator_x86.cpp"
, 776); ::breakpoint(); } while (0)
;
777 }
778
779}
780
781
782void LIRGenerator::do_MathIntrinsic(Intrinsic* x) {
783 assert(x->number_of_arguments() == 1 || (x->number_of_arguments() == 2 && x->id() == vmIntrinsics::_dpow), "wrong type")do { if (!(x->number_of_arguments() == 1 || (x->number_of_arguments
() == 2 && x->id() == vmIntrinsics::_dpow))) { (*g_assert_poison
) = 'X';; report_vm_error("/home/daniel/Projects/java/jdk/src/hotspot/cpu/x86/c1_LIRGenerator_x86.cpp"
, 783, "assert(" "x->number_of_arguments() == 1 || (x->number_of_arguments() == 2 && x->id() == vmIntrinsics::_dpow)"
") failed", "wrong type"); ::breakpoint(); } } while (0)
;
784
785 if (x->id() == vmIntrinsics::_dexp || x->id() == vmIntrinsics::_dlog ||
786 x->id() == vmIntrinsics::_dpow || x->id() == vmIntrinsics::_dcos ||
787 x->id() == vmIntrinsics::_dsin || x->id() == vmIntrinsics::_dtan ||
788 x->id() == vmIntrinsics::_dlog10) {
789 do_LibmIntrinsic(x);
790 return;
791 }
792
793 LIRItem value(x->argument_at(0), this);
794
795 bool use_fpu = false;
796#ifndef _LP641
797 if (UseSSE < 2) {
798 value.set_destroys_register();
799 }
800#endif // !LP64
801 value.load_item();
802
803 LIR_Opr calc_input = value.result();
804 LIR_Opr calc_result = rlock_result(x);
805
806 LIR_Opr tmp = LIR_OprFact::illegalOpr;
807#ifdef _LP641
808 if (UseAVX > 2 && (!VM_Version::supports_avx512vl()) &&
809 (x->id() == vmIntrinsics::_dabs)) {
810 tmp = new_register(T_DOUBLE);
811 __gen()->lir("/home/daniel/Projects/java/jdk/src/hotspot/cpu/x86/c1_LIRGenerator_x86.cpp"
, 811)->
move(LIR_OprFact::doubleConst(-0.0), tmp);
812 }
813#endif
814
815 switch(x->id()) {
816 case vmIntrinsics::_dabs:
817 __gen()->lir("/home/daniel/Projects/java/jdk/src/hotspot/cpu/x86/c1_LIRGenerator_x86.cpp"
, 817)->
abs(calc_input, calc_result, tmp);
818 break;
819 case vmIntrinsics::_dsqrt:
820 case vmIntrinsics::_dsqrt_strict:
821 __gen()->lir("/home/daniel/Projects/java/jdk/src/hotspot/cpu/x86/c1_LIRGenerator_x86.cpp"
, 821)->
sqrt(calc_input, calc_result, LIR_OprFact::illegalOpr);
822 break;
823 default:
824 ShouldNotReachHere()do { (*g_assert_poison) = 'X';; report_should_not_reach_here(
"/home/daniel/Projects/java/jdk/src/hotspot/cpu/x86/c1_LIRGenerator_x86.cpp"
, 824); ::breakpoint(); } while (0)
;
825 }
826
827 if (use_fpu) {
828 __gen()->lir("/home/daniel/Projects/java/jdk/src/hotspot/cpu/x86/c1_LIRGenerator_x86.cpp"
, 828)->
move(calc_result, x->operand());
829 }
830}
831
832void LIRGenerator::do_LibmIntrinsic(Intrinsic* x) {
833 LIRItem value(x->argument_at(0), this);
834 value.set_destroys_register();
835
836 LIR_Opr calc_result = rlock_result(x);
837 LIR_Opr result_reg = result_register_for(x->type());
838
839 CallingConvention* cc = NULL__null;
840
841 if (x->id() == vmIntrinsics::_dpow) {
842 LIRItem value1(x->argument_at(1), this);
843
844 value1.set_destroys_register();
845
846 BasicTypeList signature(2);
847 signature.append(T_DOUBLE);
848 signature.append(T_DOUBLE);
849 cc = frame_map()->c_calling_convention(&signature);
850 value.load_item_force(cc->at(0));
851 value1.load_item_force(cc->at(1));
852 } else {
853 BasicTypeList signature(1);
854 signature.append(T_DOUBLE);
855 cc = frame_map()->c_calling_convention(&signature);
856 value.load_item_force(cc->at(0));
857 }
858
859#ifndef _LP641
860 LIR_Opr tmp = FrameMap::fpu0_double_opr;
861 result_reg = tmp;
862 switch(x->id()) {
863 case vmIntrinsics::_dexp:
864 if (StubRoutines::dexp() != NULL__null) {
865 __gen()->lir("/home/daniel/Projects/java/jdk/src/hotspot/cpu/x86/c1_LIRGenerator_x86.cpp"
, 865)->
call_runtime_leaf(StubRoutines::dexp(), getThreadTemp(), result_reg, cc->args());
866 } else {
867 __gen()->lir("/home/daniel/Projects/java/jdk/src/hotspot/cpu/x86/c1_LIRGenerator_x86.cpp"
, 867)->
call_runtime_leaf(CAST_FROM_FN_PTR(address, SharedRuntime::dexp)((address)((address_word)(SharedRuntime::dexp))), getThreadTemp(), result_reg, cc->args());
868 }
869 break;
870 case vmIntrinsics::_dlog:
871 if (StubRoutines::dlog() != NULL__null) {
872 __gen()->lir("/home/daniel/Projects/java/jdk/src/hotspot/cpu/x86/c1_LIRGenerator_x86.cpp"
, 872)->
call_runtime_leaf(StubRoutines::dlog(), getThreadTemp(), result_reg, cc->args());
873 } else {
874 __gen()->lir("/home/daniel/Projects/java/jdk/src/hotspot/cpu/x86/c1_LIRGenerator_x86.cpp"
, 874)->
call_runtime_leaf(CAST_FROM_FN_PTR(address, SharedRuntime::dlog)((address)((address_word)(SharedRuntime::dlog))), getThreadTemp(), result_reg, cc->args());
875 }
876 break;
877 case vmIntrinsics::_dlog10:
878 if (StubRoutines::dlog10() != NULL__null) {
879 __gen()->lir("/home/daniel/Projects/java/jdk/src/hotspot/cpu/x86/c1_LIRGenerator_x86.cpp"
, 879)->
call_runtime_leaf(StubRoutines::dlog10(), getThreadTemp(), result_reg, cc->args());
880 } else {
881 __gen()->lir("/home/daniel/Projects/java/jdk/src/hotspot/cpu/x86/c1_LIRGenerator_x86.cpp"
, 881)->
call_runtime_leaf(CAST_FROM_FN_PTR(address, SharedRuntime::dlog10)((address)((address_word)(SharedRuntime::dlog10))), getThreadTemp(), result_reg, cc->args());
882 }
883 break;
884 case vmIntrinsics::_dpow:
885 if (StubRoutines::dpow() != NULL__null) {
886 __gen()->lir("/home/daniel/Projects/java/jdk/src/hotspot/cpu/x86/c1_LIRGenerator_x86.cpp"
, 886)->
call_runtime_leaf(StubRoutines::dpow(), getThreadTemp(), result_reg, cc->args());
887 } else {
888 __gen()->lir("/home/daniel/Projects/java/jdk/src/hotspot/cpu/x86/c1_LIRGenerator_x86.cpp"
, 888)->
call_runtime_leaf(CAST_FROM_FN_PTR(address, SharedRuntime::dpow)((address)((address_word)(SharedRuntime::dpow))), getThreadTemp(), result_reg, cc->args());
889 }
890 break;
891 case vmIntrinsics::_dsin:
892 if (VM_Version::supports_sse2() && StubRoutines::dsin() != NULL__null) {
893 __gen()->lir("/home/daniel/Projects/java/jdk/src/hotspot/cpu/x86/c1_LIRGenerator_x86.cpp"
, 893)->
call_runtime_leaf(StubRoutines::dsin(), getThreadTemp(), result_reg, cc->args());
894 } else {
895 __gen()->lir("/home/daniel/Projects/java/jdk/src/hotspot/cpu/x86/c1_LIRGenerator_x86.cpp"
, 895)->
call_runtime_leaf(CAST_FROM_FN_PTR(address, SharedRuntime::dsin)((address)((address_word)(SharedRuntime::dsin))), getThreadTemp(), result_reg, cc->args());
896 }
897 break;
898 case vmIntrinsics::_dcos:
899 if (VM_Version::supports_sse2() && StubRoutines::dcos() != NULL__null) {
900 __gen()->lir("/home/daniel/Projects/java/jdk/src/hotspot/cpu/x86/c1_LIRGenerator_x86.cpp"
, 900)->
call_runtime_leaf(StubRoutines::dcos(), getThreadTemp(), result_reg, cc->args());
901 } else {
902 __gen()->lir("/home/daniel/Projects/java/jdk/src/hotspot/cpu/x86/c1_LIRGenerator_x86.cpp"
, 902)->
call_runtime_leaf(CAST_FROM_FN_PTR(address, SharedRuntime::dcos)((address)((address_word)(SharedRuntime::dcos))), getThreadTemp(), result_reg, cc->args());
903 }
904 break;
905 case vmIntrinsics::_dtan:
906 if (StubRoutines::dtan() != NULL__null) {
907 __gen()->lir("/home/daniel/Projects/java/jdk/src/hotspot/cpu/x86/c1_LIRGenerator_x86.cpp"
, 907)->
call_runtime_leaf(StubRoutines::dtan(), getThreadTemp(), result_reg, cc->args());
908 } else {
909 __gen()->lir("/home/daniel/Projects/java/jdk/src/hotspot/cpu/x86/c1_LIRGenerator_x86.cpp"
, 909)->
call_runtime_leaf(CAST_FROM_FN_PTR(address, SharedRuntime::dtan)((address)((address_word)(SharedRuntime::dtan))), getThreadTemp(), result_reg, cc->args());
910 }
911 break;
912 default: ShouldNotReachHere()do { (*g_assert_poison) = 'X';; report_should_not_reach_here(
"/home/daniel/Projects/java/jdk/src/hotspot/cpu/x86/c1_LIRGenerator_x86.cpp"
, 912); ::breakpoint(); } while (0)
;
913 }
914#else
915 switch (x->id()) {
916 case vmIntrinsics::_dexp:
917 if (StubRoutines::dexp() != NULL__null) {
918 __gen()->lir("/home/daniel/Projects/java/jdk/src/hotspot/cpu/x86/c1_LIRGenerator_x86.cpp"
, 918)->
call_runtime_leaf(StubRoutines::dexp(), getThreadTemp(), result_reg, cc->args());
919 } else {
920 __gen()->lir("/home/daniel/Projects/java/jdk/src/hotspot/cpu/x86/c1_LIRGenerator_x86.cpp"
, 920)->
call_runtime_leaf(CAST_FROM_FN_PTR(address, SharedRuntime::dexp)((address)((address_word)(SharedRuntime::dexp))), getThreadTemp(), result_reg, cc->args());
921 }
922 break;
923 case vmIntrinsics::_dlog:
924 if (StubRoutines::dlog() != NULL__null) {
925 __gen()->lir("/home/daniel/Projects/java/jdk/src/hotspot/cpu/x86/c1_LIRGenerator_x86.cpp"
, 925)->
call_runtime_leaf(StubRoutines::dlog(), getThreadTemp(), result_reg, cc->args());
926 } else {
927 __gen()->lir("/home/daniel/Projects/java/jdk/src/hotspot/cpu/x86/c1_LIRGenerator_x86.cpp"
, 927)->
call_runtime_leaf(CAST_FROM_FN_PTR(address, SharedRuntime::dlog)((address)((address_word)(SharedRuntime::dlog))), getThreadTemp(), result_reg, cc->args());
928 }
929 break;
930 case vmIntrinsics::_dlog10:
931 if (StubRoutines::dlog10() != NULL__null) {
932 __gen()->lir("/home/daniel/Projects/java/jdk/src/hotspot/cpu/x86/c1_LIRGenerator_x86.cpp"
, 932)->
call_runtime_leaf(StubRoutines::dlog10(), getThreadTemp(), result_reg, cc->args());
933 } else {
934 __gen()->lir("/home/daniel/Projects/java/jdk/src/hotspot/cpu/x86/c1_LIRGenerator_x86.cpp"
, 934)->
call_runtime_leaf(CAST_FROM_FN_PTR(address, SharedRuntime::dlog10)((address)((address_word)(SharedRuntime::dlog10))), getThreadTemp(), result_reg, cc->args());
935 }
936 break;
937 case vmIntrinsics::_dpow:
938 if (StubRoutines::dpow() != NULL__null) {
939 __gen()->lir("/home/daniel/Projects/java/jdk/src/hotspot/cpu/x86/c1_LIRGenerator_x86.cpp"
, 939)->
call_runtime_leaf(StubRoutines::dpow(), getThreadTemp(), result_reg, cc->args());
940 } else {
941 __gen()->lir("/home/daniel/Projects/java/jdk/src/hotspot/cpu/x86/c1_LIRGenerator_x86.cpp"
, 941)->
call_runtime_leaf(CAST_FROM_FN_PTR(address, SharedRuntime::dpow)((address)((address_word)(SharedRuntime::dpow))), getThreadTemp(), result_reg, cc->args());
942 }
943 break;
944 case vmIntrinsics::_dsin:
945 if (StubRoutines::dsin() != NULL__null) {
946 __gen()->lir("/home/daniel/Projects/java/jdk/src/hotspot/cpu/x86/c1_LIRGenerator_x86.cpp"
, 946)->
call_runtime_leaf(StubRoutines::dsin(), getThreadTemp(), result_reg, cc->args());
947 } else {
948 __gen()->lir("/home/daniel/Projects/java/jdk/src/hotspot/cpu/x86/c1_LIRGenerator_x86.cpp"
, 948)->
call_runtime_leaf(CAST_FROM_FN_PTR(address, SharedRuntime::dsin)((address)((address_word)(SharedRuntime::dsin))), getThreadTemp(), result_reg, cc->args());
949 }
950 break;
951 case vmIntrinsics::_dcos:
952 if (StubRoutines::dcos() != NULL__null) {
953 __gen()->lir("/home/daniel/Projects/java/jdk/src/hotspot/cpu/x86/c1_LIRGenerator_x86.cpp"
, 953)->
call_runtime_leaf(StubRoutines::dcos(), getThreadTemp(), result_reg, cc->args());
954 } else {
955 __gen()->lir("/home/daniel/Projects/java/jdk/src/hotspot/cpu/x86/c1_LIRGenerator_x86.cpp"
, 955)->
call_runtime_leaf(CAST_FROM_FN_PTR(address, SharedRuntime::dcos)((address)((address_word)(SharedRuntime::dcos))), getThreadTemp(), result_reg, cc->args());
956 }
957 break;
958 case vmIntrinsics::_dtan:
959 if (StubRoutines::dtan() != NULL__null) {
960 __gen()->lir("/home/daniel/Projects/java/jdk/src/hotspot/cpu/x86/c1_LIRGenerator_x86.cpp"
, 960)->
call_runtime_leaf(StubRoutines::dtan(), getThreadTemp(), result_reg, cc->args());
961 } else {
962 __gen()->lir("/home/daniel/Projects/java/jdk/src/hotspot/cpu/x86/c1_LIRGenerator_x86.cpp"
, 962)->
call_runtime_leaf(CAST_FROM_FN_PTR(address, SharedRuntime::dtan)((address)((address_word)(SharedRuntime::dtan))), getThreadTemp(), result_reg, cc->args());
963 }
964 break;
965 default: ShouldNotReachHere()do { (*g_assert_poison) = 'X';; report_should_not_reach_here(
"/home/daniel/Projects/java/jdk/src/hotspot/cpu/x86/c1_LIRGenerator_x86.cpp"
, 965); ::breakpoint(); } while (0)
;
966 }
967#endif // _LP64
968 __gen()->lir("/home/daniel/Projects/java/jdk/src/hotspot/cpu/x86/c1_LIRGenerator_x86.cpp"
, 968)->
move(result_reg, calc_result);
969}
970
971void LIRGenerator::do_ArrayCopy(Intrinsic* x) {
972 assert(x->number_of_arguments() == 5, "wrong type")do { if (!(x->number_of_arguments() == 5)) { (*g_assert_poison
) = 'X';; report_vm_error("/home/daniel/Projects/java/jdk/src/hotspot/cpu/x86/c1_LIRGenerator_x86.cpp"
, 972, "assert(" "x->number_of_arguments() == 5" ") failed"
, "wrong type"); ::breakpoint(); } } while (0)
;
973
974 // Make all state_for calls early since they can emit code
975 CodeEmitInfo* info = state_for(x, x->state());
976
977 LIRItem src(x->argument_at(0), this);
978 LIRItem src_pos(x->argument_at(1), this);
979 LIRItem dst(x->argument_at(2), this);
980 LIRItem dst_pos(x->argument_at(3), this);
981 LIRItem length(x->argument_at(4), this);
982
983 // operands for arraycopy must use fixed registers, otherwise
984 // LinearScan will fail allocation (because arraycopy always needs a
985 // call)
986
987#ifndef _LP641
988 src.load_item_force (FrameMap::rcx_oop_opr);
989 src_pos.load_item_force (FrameMap::rdx_opr);
990 dst.load_item_force (FrameMap::rax_oop_opr);
991 dst_pos.load_item_force (FrameMap::rbx_opr);
992 length.load_item_force (FrameMap::rdi_opr);
993 LIR_Opr tmp = (FrameMap::rsi_opr);
994#else
995
996 // The java calling convention will give us enough registers
997 // so that on the stub side the args will be perfect already.
998 // On the other slow/special case side we call C and the arg
999 // positions are not similar enough to pick one as the best.
1000 // Also because the java calling convention is a "shifted" version
1001 // of the C convention we can process the java args trivially into C
1002 // args without worry of overwriting during the xfer
1003
1004 src.load_item_force (FrameMap::as_oop_opr(j_rarg0));
1005 src_pos.load_item_force (FrameMap::as_opr(j_rarg1));
1006 dst.load_item_force (FrameMap::as_oop_opr(j_rarg2));
1007 dst_pos.load_item_force (FrameMap::as_opr(j_rarg3));
1008 length.load_item_force (FrameMap::as_opr(j_rarg4));
1009
1010 LIR_Opr tmp = FrameMap::as_opr(j_rarg5);
1011#endif // LP64
1012
1013 set_no_result(x);
1014
1015 int flags;
1016 ciArrayKlass* expected_type;
1017 arraycopy_helper(x, &flags, &expected_type);
1018
1019 __gen()->lir("/home/daniel/Projects/java/jdk/src/hotspot/cpu/x86/c1_LIRGenerator_x86.cpp"
, 1019)->
arraycopy(src.result(), src_pos.result(), dst.result(), dst_pos.result(), length.result(), tmp, expected_type, flags, info); // does add_safepoint
1020}
1021
1022void LIRGenerator::do_update_CRC32(Intrinsic* x) {
1023 assert(UseCRC32Intrinsics, "need AVX and LCMUL instructions support")do { if (!(UseCRC32Intrinsics)) { (*g_assert_poison) = 'X';; report_vm_error
("/home/daniel/Projects/java/jdk/src/hotspot/cpu/x86/c1_LIRGenerator_x86.cpp"
, 1023, "assert(" "UseCRC32Intrinsics" ") failed", "need AVX and LCMUL instructions support"
); ::breakpoint(); } } while (0)
;
1024 // Make all state_for calls early since they can emit code
1025 LIR_Opr result = rlock_result(x);
1026 int flags = 0;
1027 switch (x->id()) {
1028 case vmIntrinsics::_updateCRC32: {
1029 LIRItem crc(x->argument_at(0), this);
1030 LIRItem val(x->argument_at(1), this);
1031 // val is destroyed by update_crc32
1032 val.set_destroys_register();
1033 crc.load_item();
1034 val.load_item();
1035 __gen()->lir("/home/daniel/Projects/java/jdk/src/hotspot/cpu/x86/c1_LIRGenerator_x86.cpp"
, 1035)->
update_crc32(crc.result(), val.result(), result);
1036 break;
1037 }
1038 case vmIntrinsics::_updateBytesCRC32:
1039 case vmIntrinsics::_updateByteBufferCRC32: {
1040 bool is_updateBytes = (x->id() == vmIntrinsics::_updateBytesCRC32);
1041
1042 LIRItem crc(x->argument_at(0), this);
1043 LIRItem buf(x->argument_at(1), this);
1044 LIRItem off(x->argument_at(2), this);
1045 LIRItem len(x->argument_at(3), this);
1046 buf.load_item();
1047 off.load_nonconstant();
1048
1049 LIR_Opr index = off.result();
1050 int offset = is_updateBytes ? arrayOopDesc::base_offset_in_bytes(T_BYTE) : 0;
1051 if(off.result()->is_constant()) {
1052 index = LIR_OprFact::illegalOpr;
1053 offset += off.result()->as_jint();
1054 }
1055 LIR_Opr base_op = buf.result();
1056
1057#ifndef _LP641
1058 if (!is_updateBytes) { // long b raw address
1059 base_op = new_register(T_INT);
1060 __gen()->lir("/home/daniel/Projects/java/jdk/src/hotspot/cpu/x86/c1_LIRGenerator_x86.cpp"
, 1060)->
convert(Bytecodes::_l2i, buf.result(), base_op);
1061 }
1062#else
1063 if (index->is_valid()) {
1064 LIR_Opr tmp = new_register(T_LONG);
1065 __gen()->lir("/home/daniel/Projects/java/jdk/src/hotspot/cpu/x86/c1_LIRGenerator_x86.cpp"
, 1065)->
convert(Bytecodes::_i2l, index, tmp);
1066 index = tmp;
1067 }
1068#endif
1069
1070 LIR_Address* a = new LIR_Address(base_op,
1071 index,
1072 offset,
1073 T_BYTE);
1074 BasicTypeList signature(3);
1075 signature.append(T_INT);
1076 signature.append(T_ADDRESS);
1077 signature.append(T_INT);
1078 CallingConvention* cc = frame_map()->c_calling_convention(&signature);
1079 const LIR_Opr result_reg = result_register_for(x->type());
1080
1081 LIR_Opr addr = new_pointer_register();
1082 __gen()->lir("/home/daniel/Projects/java/jdk/src/hotspot/cpu/x86/c1_LIRGenerator_x86.cpp"
, 1082)->
leal(LIR_OprFact::address(a), addr);
1083
1084 crc.load_item_force(cc->at(0));
1085 __gen()->lir("/home/daniel/Projects/java/jdk/src/hotspot/cpu/x86/c1_LIRGenerator_x86.cpp"
, 1085)->
move(addr, cc->at(1));
1086 len.load_item_force(cc->at(2));
1087
1088 __gen()->lir("/home/daniel/Projects/java/jdk/src/hotspot/cpu/x86/c1_LIRGenerator_x86.cpp"
, 1088)->
call_runtime_leaf(StubRoutines::updateBytesCRC32(), getThreadTemp(), result_reg, cc->args());
1089 __gen()->lir("/home/daniel/Projects/java/jdk/src/hotspot/cpu/x86/c1_LIRGenerator_x86.cpp"
, 1089)->
move(result_reg, result);
1090
1091 break;
1092 }
1093 default: {
1094 ShouldNotReachHere()do { (*g_assert_poison) = 'X';; report_should_not_reach_here(
"/home/daniel/Projects/java/jdk/src/hotspot/cpu/x86/c1_LIRGenerator_x86.cpp"
, 1094); ::breakpoint(); } while (0)
;
1095 }
1096 }
1097}
1098
1099void LIRGenerator::do_update_CRC32C(Intrinsic* x) {
1100 Unimplemented()do { (*g_assert_poison) = 'X';; report_unimplemented("/home/daniel/Projects/java/jdk/src/hotspot/cpu/x86/c1_LIRGenerator_x86.cpp"
, 1100); ::breakpoint(); } while (0)
;
1101}
1102
1103void LIRGenerator::do_vectorizedMismatch(Intrinsic* x) {
1104 assert(UseVectorizedMismatchIntrinsic, "need AVX instruction support")do { if (!(UseVectorizedMismatchIntrinsic)) { (*g_assert_poison
) = 'X';; report_vm_error("/home/daniel/Projects/java/jdk/src/hotspot/cpu/x86/c1_LIRGenerator_x86.cpp"
, 1104, "assert(" "UseVectorizedMismatchIntrinsic" ") failed"
, "need AVX instruction support"); ::breakpoint(); } } while (
0)
;
1105
1106 // Make all state_for calls early since they can emit code
1107 LIR_Opr result = rlock_result(x);
1108
1109 LIRItem a(x->argument_at(0), this); // Object
1110 LIRItem aOffset(x->argument_at(1), this); // long
1111 LIRItem b(x->argument_at(2), this); // Object
1112 LIRItem bOffset(x->argument_at(3), this); // long
1113 LIRItem length(x->argument_at(4), this); // int
1114 LIRItem log2ArrayIndexScale(x->argument_at(5), this); // int
1115
1116 a.load_item();
1117 aOffset.load_nonconstant();
1118 b.load_item();
1119 bOffset.load_nonconstant();
1120
1121 long constant_aOffset = 0;
1122 LIR_Opr result_aOffset = aOffset.result();
1123 if (result_aOffset->is_constant()) {
1124 constant_aOffset = result_aOffset->as_jlong();
1125 result_aOffset = LIR_OprFact::illegalOpr;
1126 }
1127 LIR_Opr result_a = a.result();
1128
1129 long constant_bOffset = 0;
1130 LIR_Opr result_bOffset = bOffset.result();
1131 if (result_bOffset->is_constant()) {
1132 constant_bOffset = result_bOffset->as_jlong();
1133 result_bOffset = LIR_OprFact::illegalOpr;
1134 }
1135 LIR_Opr result_b = b.result();
1136
1137#ifndef _LP641
1138 result_a = new_register(T_INT);
1139 __gen()->lir("/home/daniel/Projects/java/jdk/src/hotspot/cpu/x86/c1_LIRGenerator_x86.cpp"
, 1139)->
convert(Bytecodes::_l2i, a.result(), result_a);
1140 result_b = new_register(T_INT);
1141 __gen()->lir("/home/daniel/Projects/java/jdk/src/hotspot/cpu/x86/c1_LIRGenerator_x86.cpp"
, 1141)->
convert(Bytecodes::_l2i, b.result(), result_b);
1142#endif
1143
1144
1145 LIR_Address* addr_a = new LIR_Address(result_a,
1146 result_aOffset,
1147 constant_aOffset,
1148 T_BYTE);
1149
1150 LIR_Address* addr_b = new LIR_Address(result_b,
1151 result_bOffset,
1152 constant_bOffset,
1153 T_BYTE);
1154
1155 BasicTypeList signature(4);
1156 signature.append(T_ADDRESS);
1157 signature.append(T_ADDRESS);
1158 signature.append(T_INT);
1159 signature.append(T_INT);
1160 CallingConvention* cc = frame_map()->c_calling_convention(&signature);
1161 const LIR_Opr result_reg = result_register_for(x->type());
1162
1163 LIR_Opr ptr_addr_a = new_pointer_register();
1164 __gen()->lir("/home/daniel/Projects/java/jdk/src/hotspot/cpu/x86/c1_LIRGenerator_x86.cpp"
, 1164)->
leal(LIR_OprFact::address(addr_a), ptr_addr_a);
1165
1166 LIR_Opr ptr_addr_b = new_pointer_register();
1167 __gen()->lir("/home/daniel/Projects/java/jdk/src/hotspot/cpu/x86/c1_LIRGenerator_x86.cpp"
, 1167)->
leal(LIR_OprFact::address(addr_b), ptr_addr_b);
1168
1169 __gen()->lir("/home/daniel/Projects/java/jdk/src/hotspot/cpu/x86/c1_LIRGenerator_x86.cpp"
, 1169)->
move(ptr_addr_a, cc->at(0));
1170 __gen()->lir("/home/daniel/Projects/java/jdk/src/hotspot/cpu/x86/c1_LIRGenerator_x86.cpp"
, 1170)->
move(ptr_addr_b, cc->at(1));
1171 length.load_item_force(cc->at(2));
1172 log2ArrayIndexScale.load_item_force(cc->at(3));
1173
1174 __gen()->lir("/home/daniel/Projects/java/jdk/src/hotspot/cpu/x86/c1_LIRGenerator_x86.cpp"
, 1174)->
call_runtime_leaf(StubRoutines::vectorizedMismatch(), getThreadTemp(), result_reg, cc->args());
1175 __gen()->lir("/home/daniel/Projects/java/jdk/src/hotspot/cpu/x86/c1_LIRGenerator_x86.cpp"
, 1175)->
move(result_reg, result);
1176}
1177
1178// _i2l, _i2f, _i2d, _l2i, _l2f, _l2d, _f2i, _f2l, _f2d, _d2i, _d2l, _d2f
1179// _i2b, _i2c, _i2s
1180LIR_Opr fixed_register_for(BasicType type) {
1181 switch (type) {
1182 case T_FLOAT: return FrameMap::fpu0_float_opr;
1183 case T_DOUBLE: return FrameMap::fpu0_double_opr;
1184 case T_INT: return FrameMap::rax_opr;
1185 case T_LONG: return FrameMap::long0_opr;
1186 default: ShouldNotReachHere()do { (*g_assert_poison) = 'X';; report_should_not_reach_here(
"/home/daniel/Projects/java/jdk/src/hotspot/cpu/x86/c1_LIRGenerator_x86.cpp"
, 1186); ::breakpoint(); } while (0)
; return LIR_OprFact::illegalOpr;
1187 }
1188}
1189
1190void LIRGenerator::do_Convert(Convert* x) {
1191#ifdef _LP641
1192 LIRItem value(x->value(), this);
1193 value.load_item();
1194 LIR_Opr input = value.result();
1195 LIR_Opr result = rlock(x);
1196 __gen()->lir("/home/daniel/Projects/java/jdk/src/hotspot/cpu/x86/c1_LIRGenerator_x86.cpp"
, 1196)->
convert(x->op(), input, result);
1197 assert(result->is_virtual(), "result must be virtual register")do { if (!(result->is_virtual())) { (*g_assert_poison) = 'X'
;; report_vm_error("/home/daniel/Projects/java/jdk/src/hotspot/cpu/x86/c1_LIRGenerator_x86.cpp"
, 1197, "assert(" "result->is_virtual()" ") failed", "result must be virtual register"
); ::breakpoint(); } } while (0)
;
1198 set_result(x, result);
1199#else
1200 // flags that vary for the different operations and different SSE-settings
1201 bool fixed_input = false, fixed_result = false, round_result = false, needs_stub = false;
1202
1203 switch (x->op()) {
1204 case Bytecodes::_i2l: // fall through
1205 case Bytecodes::_l2i: // fall through
1206 case Bytecodes::_i2b: // fall through
1207 case Bytecodes::_i2c: // fall through
1208 case Bytecodes::_i2s: fixed_input = false; fixed_result = false; round_result = false; needs_stub = false; break;
1209
1210 case Bytecodes::_f2d: fixed_input = UseSSE == 1; fixed_result = false; round_result = false; needs_stub = false; break;
1211 case Bytecodes::_d2f: fixed_input = false; fixed_result = UseSSE == 1; round_result = UseSSE < 1; needs_stub = false; break;
1212 case Bytecodes::_i2f: fixed_input = false; fixed_result = false; round_result = UseSSE < 1; needs_stub = false; break;
1213 case Bytecodes::_i2d: fixed_input = false; fixed_result = false; round_result = false; needs_stub = false; break;
1214 case Bytecodes::_f2i: fixed_input = false; fixed_result = false; round_result = false; needs_stub = true; break;
1215 case Bytecodes::_d2i: fixed_input = false; fixed_result = false; round_result = false; needs_stub = true; break;
1216 case Bytecodes::_l2f: fixed_input = false; fixed_result = UseSSE >= 1; round_result = UseSSE < 1; needs_stub = false; break;
1217 case Bytecodes::_l2d: fixed_input = false; fixed_result = UseSSE >= 2; round_result = UseSSE < 2; needs_stub = false; break;
1218 case Bytecodes::_f2l: fixed_input = true; fixed_result = true; round_result = false; needs_stub = false; break;
1219 case Bytecodes::_d2l: fixed_input = true; fixed_result = true; round_result = false; needs_stub = false; break;
1220 default: ShouldNotReachHere()do { (*g_assert_poison) = 'X';; report_should_not_reach_here(
"/home/daniel/Projects/java/jdk/src/hotspot/cpu/x86/c1_LIRGenerator_x86.cpp"
, 1220); ::breakpoint(); } while (0)
;
1221 }
1222
1223 LIRItem value(x->value(), this);
1224 value.load_item();
1225 LIR_Opr input = value.result();
1226 LIR_Opr result = rlock(x);
1227
1228 // arguments of lir_convert
1229 LIR_Opr conv_input = input;
1230 LIR_Opr conv_result = result;
1231 ConversionStub* stub = NULL__null;
1232
1233 if (fixed_input) {
1234 conv_input = fixed_register_for(input->type());
1235 __gen()->lir("/home/daniel/Projects/java/jdk/src/hotspot/cpu/x86/c1_LIRGenerator_x86.cpp"
, 1235)->
move(input, conv_input);
1236 }
1237
1238 assert(fixed_result == false || round_result == false, "cannot set both")do { if (!(fixed_result == false || round_result == false)) {
(*g_assert_poison) = 'X';; report_vm_error("/home/daniel/Projects/java/jdk/src/hotspot/cpu/x86/c1_LIRGenerator_x86.cpp"
, 1238, "assert(" "fixed_result == false || round_result == false"
") failed", "cannot set both"); ::breakpoint(); } } while (0
)
;
1239 if (fixed_result) {
1240 conv_result = fixed_register_for(result->type());
1241 } else if (round_result) {
1242 result = new_register(result->type());
1243 set_vreg_flag(result, must_start_in_memory);
1244 }
1245
1246 if (needs_stub) {
1247 stub = new ConversionStub(x->op(), conv_input, conv_result);
1248 }
1249
1250 __gen()->lir("/home/daniel/Projects/java/jdk/src/hotspot/cpu/x86/c1_LIRGenerator_x86.cpp"
, 1250)->
convert(x->op(), conv_input, conv_result, stub);
1251
1252 if (result != conv_result) {
1253 __gen()->lir("/home/daniel/Projects/java/jdk/src/hotspot/cpu/x86/c1_LIRGenerator_x86.cpp"
, 1253)->
move(conv_result, result);
1254 }
1255
1256 assert(result->is_virtual(), "result must be virtual register")do { if (!(result->is_virtual())) { (*g_assert_poison) = 'X'
;; report_vm_error("/home/daniel/Projects/java/jdk/src/hotspot/cpu/x86/c1_LIRGenerator_x86.cpp"
, 1256, "assert(" "result->is_virtual()" ") failed", "result must be virtual register"
); ::breakpoint(); } } while (0)
;
1257 set_result(x, result);
1258#endif // _LP64
1259}
1260
1261
1262void LIRGenerator::do_NewInstance(NewInstance* x) {
1263 print_if_not_loaded(x);
1264
1265 CodeEmitInfo* info = state_for(x, x->state());
1266 LIR_Opr reg = result_register_for(x->type());
1267 new_instance(reg, x->klass(), x->is_unresolved(),
1268 FrameMap::rcx_oop_opr,
1269 FrameMap::rdi_oop_opr,
1270 FrameMap::rsi_oop_opr,
1271 LIR_OprFact::illegalOpr,
1272 FrameMap::rdx_metadata_opr, info);
1273 LIR_Opr result = rlock_result(x);
1274 __gen()->lir("/home/daniel/Projects/java/jdk/src/hotspot/cpu/x86/c1_LIRGenerator_x86.cpp"
, 1274)->
move(reg, result);
1275}
1276
1277
1278void LIRGenerator::do_NewTypeArray(NewTypeArray* x) {
1279 CodeEmitInfo* info = state_for(x, x->state());
1280
1281 LIRItem length(x->length(), this);
1282 length.load_item_force(FrameMap::rbx_opr);
1283
1284 LIR_Opr reg = result_register_for(x->type());
1285 LIR_Opr tmp1 = FrameMap::rcx_oop_opr;
1286 LIR_Opr tmp2 = FrameMap::rsi_oop_opr;
1287 LIR_Opr tmp3 = FrameMap::rdi_oop_opr;
1288 LIR_Opr tmp4 = reg;
1289 LIR_Opr klass_reg = FrameMap::rdx_metadata_opr;
1290 LIR_Opr len = length.result();
1291 BasicType elem_type = x->elt_type();
1292
1293 __gen()->lir("/home/daniel/Projects/java/jdk/src/hotspot/cpu/x86/c1_LIRGenerator_x86.cpp"
, 1293)->
metadata2reg(ciTypeArrayKlass::make(elem_type)->constant_encoding(), klass_reg);
1294
1295 CodeStub* slow_path = new NewTypeArrayStub(klass_reg, len, reg, info);
1296 __gen()->lir("/home/daniel/Projects/java/jdk/src/hotspot/cpu/x86/c1_LIRGenerator_x86.cpp"
, 1296)->
allocate_array(reg, len, tmp1, tmp2, tmp3, tmp4, elem_type, klass_reg, slow_path);
1297
1298 LIR_Opr result = rlock_result(x);
1299 __gen()->lir("/home/daniel/Projects/java/jdk/src/hotspot/cpu/x86/c1_LIRGenerator_x86.cpp"
, 1299)->
move(reg, result);
1300}
1301
1302
1303void LIRGenerator::do_NewObjectArray(NewObjectArray* x) {
1304 LIRItem length(x->length(), this);
1305 // in case of patching (i.e., object class is not yet loaded), we need to reexecute the instruction
1306 // and therefore provide the state before the parameters have been consumed
1307 CodeEmitInfo* patching_info = NULL__null;
1308 if (!x->klass()->is_loaded() || PatchALot) {
1309 patching_info = state_for(x, x->state_before());
1310 }
1311
1312 CodeEmitInfo* info = state_for(x, x->state());
1313
1314 const LIR_Opr reg = result_register_for(x->type());
1315 LIR_Opr tmp1 = FrameMap::rcx_oop_opr;
1316 LIR_Opr tmp2 = FrameMap::rsi_oop_opr;
1317 LIR_Opr tmp3 = FrameMap::rdi_oop_opr;
1318 LIR_Opr tmp4 = reg;
1319 LIR_Opr klass_reg = FrameMap::rdx_metadata_opr;
1320
1321 length.load_item_force(FrameMap::rbx_opr);
1322 LIR_Opr len = length.result();
1323
1324 CodeStub* slow_path = new NewObjectArrayStub(klass_reg, len, reg, info);
1325 ciKlass* obj = (ciKlass*) ciObjArrayKlass::make(x->klass());
1326 if (obj == ciEnv::unloaded_ciobjarrayklass()) {
1327 BAILOUT("encountered unloaded_ciobjarrayklass due to out of memory error"){ bailout("encountered unloaded_ciobjarrayklass due to out of memory error"
); return; }
;
1328 }
1329 klass2reg_with_patching(klass_reg, obj, patching_info);
1330 __gen()->lir("/home/daniel/Projects/java/jdk/src/hotspot/cpu/x86/c1_LIRGenerator_x86.cpp"
, 1330)->
allocate_array(reg, len, tmp1, tmp2, tmp3, tmp4, T_OBJECT, klass_reg, slow_path);
1331
1332 LIR_Opr result = rlock_result(x);
1333 __gen()->lir("/home/daniel/Projects/java/jdk/src/hotspot/cpu/x86/c1_LIRGenerator_x86.cpp"
, 1333)->
move(reg, result);
1334}
1335
1336
1337void LIRGenerator::do_NewMultiArray(NewMultiArray* x) {
1338 Values* dims = x->dims();
1339 int i = dims->length();
1340 LIRItemList* items = new LIRItemList(i, i, NULL__null);
1341 while (i-- > 0) {
1342 LIRItem* size = new LIRItem(dims->at(i), this);
1343 items->at_put(i, size);
1344 }
1345
1346 // Evaluate state_for early since it may emit code.
1347 CodeEmitInfo* patching_info = NULL__null;
1348 if (!x->klass()->is_loaded() || PatchALot) {
1349 patching_info = state_for(x, x->state_before());
1350
1351 // Cannot re-use same xhandlers for multiple CodeEmitInfos, so
1352 // clone all handlers (NOTE: Usually this is handled transparently
1353 // by the CodeEmitInfo cloning logic in CodeStub constructors but
1354 // is done explicitly here because a stub isn't being used).
1355 x->set_exception_handlers(new XHandlers(x->exception_handlers()));
1356 }
1357 CodeEmitInfo* info = state_for(x, x->state());
1358
1359 i = dims->length();
1360 while (i-- > 0) {
1361 LIRItem* size = items->at(i);
1362 size->load_nonconstant();
1363
1364 store_stack_parameter(size->result(), in_ByteSize(i*4));
1365 }
1366
1367 LIR_Opr klass_reg = FrameMap::rax_metadata_opr;
1368 klass2reg_with_patching(klass_reg, x->klass(), patching_info);
1369
1370 LIR_Opr rank = FrameMap::rbx_opr;
1371 __gen()->lir("/home/daniel/Projects/java/jdk/src/hotspot/cpu/x86/c1_LIRGenerator_x86.cpp"
, 1371)->
move(LIR_OprFact::intConst(x->rank()), rank);
1372 LIR_Opr varargs = FrameMap::rcx_opr;
1373 __gen()->lir("/home/daniel/Projects/java/jdk/src/hotspot/cpu/x86/c1_LIRGenerator_x86.cpp"
, 1373)->
move(FrameMap::rsp_opr, varargs);
1374 LIR_OprList* args = new LIR_OprList(3);
1375 args->append(klass_reg);
1376 args->append(rank);
1377 args->append(varargs);
1378 LIR_Opr reg = result_register_for(x->type());
1379 __gen()->lir("/home/daniel/Projects/java/jdk/src/hotspot/cpu/x86/c1_LIRGenerator_x86.cpp"
, 1379)->
call_runtime(Runtime1::entry_for(Runtime1::new_multi_array_id),
1380 LIR_OprFact::illegalOpr,
1381 reg, args, info);
1382
1383 LIR_Opr result = rlock_result(x);
1384 __gen()->lir("/home/daniel/Projects/java/jdk/src/hotspot/cpu/x86/c1_LIRGenerator_x86.cpp"
, 1384)->
move(reg, result);
1385}
1386
1387
1388void LIRGenerator::do_BlockBegin(BlockBegin* x) {
1389 // nothing to do for now
1390}
1391
1392
1393void LIRGenerator::do_CheckCast(CheckCast* x) {
1394 LIRItem obj(x->obj(), this);
1395
1396 CodeEmitInfo* patching_info = NULL__null;
1397 if (!x->klass()->is_loaded() || (PatchALot && !x->is_incompatible_class_change_check() && !x->is_invokespecial_receiver_check())) {
1398 // must do this before locking the destination register as an oop register,
1399 // and before the obj is loaded (the latter is for deoptimization)
1400 patching_info = state_for(x, x->state_before());
1401 }
1402 obj.load_item();
1403
1404 // info for exceptions
1405 CodeEmitInfo* info_for_exception =
1406 (x->needs_exception_state() ? state_for(x) :
1407 state_for(x, x->state_before(), true /*ignore_xhandler*/));
1408
1409 CodeStub* stub;
1410 if (x->is_incompatible_class_change_check()) {
1411 assert(patching_info == NULL, "can't patch this")do { if (!(patching_info == __null)) { (*g_assert_poison) = 'X'
;; report_vm_error("/home/daniel/Projects/java/jdk/src/hotspot/cpu/x86/c1_LIRGenerator_x86.cpp"
, 1411, "assert(" "patching_info == __null" ") failed", "can't patch this"
); ::breakpoint(); } } while (0)
;
1412 stub = new SimpleExceptionStub(Runtime1::throw_incompatible_class_change_error_id, LIR_OprFact::illegalOpr, info_for_exception);
1413 } else if (x->is_invokespecial_receiver_check()) {
1414 assert(patching_info == NULL, "can't patch this")do { if (!(patching_info == __null)) { (*g_assert_poison) = 'X'
;; report_vm_error("/home/daniel/Projects/java/jdk/src/hotspot/cpu/x86/c1_LIRGenerator_x86.cpp"
, 1414, "assert(" "patching_info == __null" ") failed", "can't patch this"
); ::breakpoint(); } } while (0)
;
1415 stub = new DeoptimizeStub(info_for_exception, Deoptimization::Reason_class_check, Deoptimization::Action_none);
1416 } else {
1417 stub = new SimpleExceptionStub(Runtime1::throw_class_cast_exception_id, obj.result(), info_for_exception);
1418 }
1419 LIR_Opr reg = rlock_result(x);
1420 LIR_Opr tmp3 = LIR_OprFact::illegalOpr;
1421 if (!x->klass()->is_loaded() || UseCompressedClassPointers) {
1422 tmp3 = new_register(objectType);
1423 }
1424 __gen()->lir("/home/daniel/Projects/java/jdk/src/hotspot/cpu/x86/c1_LIRGenerator_x86.cpp"
, 1424)->
checkcast(reg, obj.result(), x->klass(),
1425 new_register(objectType), new_register(objectType), tmp3,
1426 x->direct_compare(), info_for_exception, patching_info, stub,
1427 x->profiled_method(), x->profiled_bci());
1428}
1429
1430
1431void LIRGenerator::do_InstanceOf(InstanceOf* x) {
1432 LIRItem obj(x->obj(), this);
1433
1434 // result and test object may not be in same register
1435 LIR_Opr reg = rlock_result(x);
1436 CodeEmitInfo* patching_info = NULL__null;
1437 if ((!x->klass()->is_loaded() || PatchALot)) {
1438 // must do this before locking the destination register as an oop register
1439 patching_info = state_for(x, x->state_before());
1440 }
1441 obj.load_item();
1442 LIR_Opr tmp3 = LIR_OprFact::illegalOpr;
1443 if (!x->klass()->is_loaded() || UseCompressedClassPointers) {
1444 tmp3 = new_register(objectType);
1445 }
1446 __gen()->lir("/home/daniel/Projects/java/jdk/src/hotspot/cpu/x86/c1_LIRGenerator_x86.cpp"
, 1446)->
instanceof(reg, obj.result(), x->klass(),
1447 new_register(objectType), new_register(objectType), tmp3,
1448 x->direct_compare(), patching_info, x->profiled_method(), x->profiled_bci());
1449}
1450
1451
1452void LIRGenerator::do_If(If* x) {
1453 assert(x->number_of_sux() == 2, "inconsistency")do { if (!(x->number_of_sux() == 2)) { (*g_assert_poison) =
'X';; report_vm_error("/home/daniel/Projects/java/jdk/src/hotspot/cpu/x86/c1_LIRGenerator_x86.cpp"
, 1453, "assert(" "x->number_of_sux() == 2" ") failed", "inconsistency"
); ::breakpoint(); } } while (0)
;
1454 ValueTag tag = x->x()->type()->tag();
1455 bool is_safepoint = x->is_safepoint();
1456
1457 If::Condition cond = x->cond();
1458
1459 LIRItem xitem(x->x(), this);
1460 LIRItem yitem(x->y(), this);
1461 LIRItem* xin = &xitem;
1462 LIRItem* yin = &yitem;
1463
1464 if (tag == longTag) {
1465 // for longs, only conditions "eql", "neq", "lss", "geq" are valid;
1466 // mirror for other conditions
1467 if (cond == If::gtr || cond == If::leq) {
1468 cond = Instruction::mirror(cond);
1469 xin = &yitem;
1470 yin = &xitem;
1471 }
1472 xin->set_destroys_register();
1473 }
1474 xin->load_item();
1475 if (tag == longTag && yin->is_constant() && yin->get_jlong_constant() == 0 && (cond == If::eql || cond == If::neq)) {
1476 // inline long zero
1477 yin->dont_load_item();
1478 } else if (tag == longTag || tag == floatTag || tag == doubleTag) {
1479 // longs cannot handle constants at right side
1480 yin->load_item();
1481 } else {
1482 yin->dont_load_item();
1483 }
1484
1485 LIR_Opr left = xin->result();
1486 LIR_Opr right = yin->result();
1487
1488 set_no_result(x);
1489
1490 // add safepoint before generating condition code so it can be recomputed
1491 if (x->is_safepoint()) {
1492 // increment backedge counter if needed
1493 increment_backedge_counter_conditionally(lir_cond(cond), left, right, state_for(x, x->state_before()),
1494 x->tsux()->bci(), x->fsux()->bci(), x->profiled_bci());
1495 __gen()->lir("/home/daniel/Projects/java/jdk/src/hotspot/cpu/x86/c1_LIRGenerator_x86.cpp"
, 1495)->
safepoint(safepoint_poll_register(), state_for(x, x->state_before()));
1496 }
1497
1498 __gen()->lir("/home/daniel/Projects/java/jdk/src/hotspot/cpu/x86/c1_LIRGenerator_x86.cpp"
, 1498)->
cmp(lir_cond(cond), left, right);
1499 // Generate branch profiling. Profiling code doesn't kill flags.
1500 profile_branch(x, cond);
1501 move_to_phi(x->state());
1502 if (x->x()->type()->is_float_kind()) {
1503 __gen()->lir("/home/daniel/Projects/java/jdk/src/hotspot/cpu/x86/c1_LIRGenerator_x86.cpp"
, 1503)->
branch(lir_cond(cond), x->tsux(), x->usux());
1504 } else {
1505 __gen()->lir("/home/daniel/Projects/java/jdk/src/hotspot/cpu/x86/c1_LIRGenerator_x86.cpp"
, 1505)->
branch(lir_cond(cond), x->tsux());
1506 }
1507 assert(x->default_sux() == x->fsux(), "wrong destination above")do { if (!(x->default_sux() == x->fsux())) { (*g_assert_poison
) = 'X';; report_vm_error("/home/daniel/Projects/java/jdk/src/hotspot/cpu/x86/c1_LIRGenerator_x86.cpp"
, 1507, "assert(" "x->default_sux() == x->fsux()" ") failed"
, "wrong destination above"); ::breakpoint(); } } while (0)
;
1508 __gen()->lir("/home/daniel/Projects/java/jdk/src/hotspot/cpu/x86/c1_LIRGenerator_x86.cpp"
, 1508)->
jump(x->default_sux());
1509}
1510
1511
1512LIR_Opr LIRGenerator::getThreadPointer() {
1513#ifdef _LP641
1514 return FrameMap::as_pointer_opr(r15_thread);
1515#else
1516 LIR_Opr result = new_register(T_INT);
1517 __gen()->lir("/home/daniel/Projects/java/jdk/src/hotspot/cpu/x86/c1_LIRGenerator_x86.cpp"
, 1517)->
get_thread(result);
1518 return result;
1519#endif //
1520}
1521
1522void LIRGenerator::trace_block_entry(BlockBegin* block) {
1523 store_stack_parameter(LIR_OprFact::intConst(block->block_id()), in_ByteSize(0));
1524 LIR_OprList* args = new LIR_OprList();
1525 address func = CAST_FROM_FN_PTR(address, Runtime1::trace_block_entry)((address)((address_word)(Runtime1::trace_block_entry)));
1526 __gen()->lir("/home/daniel/Projects/java/jdk/src/hotspot/cpu/x86/c1_LIRGenerator_x86.cpp"
, 1526)->
call_runtime_leaf(func, LIR_OprFact::illegalOpr, LIR_OprFact::illegalOpr, args);
1527}
1528
1529
1530void LIRGenerator::volatile_field_store(LIR_Opr value, LIR_Address* address,
1531 CodeEmitInfo* info) {
1532 if (address->type() == T_LONG) {
1533 address = new LIR_Address(address->base(),
1534 address->index(), address->scale(),
1535 address->disp(), T_DOUBLE);
1536 // Transfer the value atomically by using FP moves. This means
1537 // the value has to be moved between CPU and FPU registers. It
1538 // always has to be moved through spill slot since there's no
1539 // quick way to pack the value into an SSE register.
1540 LIR_Opr temp_double = new_register(T_DOUBLE);
1541 LIR_Opr spill = new_register(T_LONG);
1542 set_vreg_flag(spill, must_start_in_memory);
1543 __gen()->lir("/home/daniel/Projects/java/jdk/src/hotspot/cpu/x86/c1_LIRGenerator_x86.cpp"
, 1543)->
move(value, spill);
1544 __gen()->lir("/home/daniel/Projects/java/jdk/src/hotspot/cpu/x86/c1_LIRGenerator_x86.cpp"
, 1544)->
volatile_move(spill, temp_double, T_LONG);
1545 __gen()->lir("/home/daniel/Projects/java/jdk/src/hotspot/cpu/x86/c1_LIRGenerator_x86.cpp"
, 1545)->
volatile_move(temp_double, LIR_OprFact::address(address), T_LONG, info);
1546 } else {
1547 __gen()->lir("/home/daniel/Projects/java/jdk/src/hotspot/cpu/x86/c1_LIRGenerator_x86.cpp"
, 1547)->
store(value, address, info);
1548 }
1549}
1550
1551void LIRGenerator::volatile_field_load(LIR_Address* address, LIR_Opr result,
1552 CodeEmitInfo* info) {
1553 if (address->type() == T_LONG) {
1554 address = new LIR_Address(address->base(),
1555 address->index(), address->scale(),
1556 address->disp(), T_DOUBLE);
1557 // Transfer the value atomically by using FP moves. This means
1558 // the value has to be moved between CPU and FPU registers. In
1559 // SSE0 and SSE1 mode it has to be moved through spill slot but in
1560 // SSE2+ mode it can be moved directly.
1561 LIR_Opr temp_double = new_register(T_DOUBLE);
1562 __gen()->lir("/home/daniel/Projects/java/jdk/src/hotspot/cpu/x86/c1_LIRGenerator_x86.cpp"
, 1562)->
volatile_move(LIR_OprFact::address(address), temp_double, T_LONG, info);
1563 __gen()->lir("/home/daniel/Projects/java/jdk/src/hotspot/cpu/x86/c1_LIRGenerator_x86.cpp"
, 1563)->
volatile_move(temp_double, result, T_LONG);
1564#ifndef _LP641
1565 if (UseSSE < 2) {
1566 // no spill slot needed in SSE2 mode because xmm->cpu register move is possible
1567 set_vreg_flag(result, must_start_in_memory);
1568 }
1569#endif // !LP64
1570 } else {
1571 __gen()->lir("/home/daniel/Projects/java/jdk/src/hotspot/cpu/x86/c1_LIRGenerator_x86.cpp"
, 1571)->
load(address, result, info);
1572 }
1573}