Skip to content

Commit c525a38

Browse files
authored
update to jdk-20+20
28477: Fix misleading-indentation warnings 28476: Add some basic types for VectorLoadConst 28451: Fix error: the compiler can assume that the address of 'L' will never be NULL 28448: LA port of 8295457: Make the signatures of write barrier methods consistent 28452: 8294438: Fix misleading-indentation warnings in hotspot
1 parent 3f4f4e8 commit c525a38

File tree

9 files changed

+107
-125
lines changed

9 files changed

+107
-125
lines changed

make/hotspot/lib/CompileJvm.gmk

Lines changed: 0 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -155,24 +155,10 @@ $(eval $(call SetupJdkLibrary, BUILD_LIBJVM, \
155155
arguments.cpp_CXXFLAGS := $(CFLAGS_VM_VERSION), \
156156
DISABLED_WARNINGS_gcc := $(DISABLED_WARNINGS_gcc), \
157157
DISABLED_WARNINGS_gcc_ad_$(HOTSPOT_TARGET_CPU_ARCH).cpp := nonnull, \
158-
DISABLED_WARNINGS_gcc_assembler_aarch64.cpp := misleading-indentation, \
159-
DISABLED_WARNINGS_gcc_c1_LIR.cpp := misleading-indentation, \
160158
DISABLED_WARNINGS_gcc_cgroupV1Subsystem_linux.cpp := address, \
161159
DISABLED_WARNINGS_gcc_cgroupV2Subsystem_linux.cpp := address, \
162160
DISABLED_WARNINGS_gcc_interp_masm_x86.cpp := uninitialized, \
163-
DISABLED_WARNINGS_gcc_javaClasses.cpp := misleading-indentation, \
164161
DISABLED_WARNINGS_gcc_postaloc.cpp := address, \
165-
DISABLED_WARNINGS_gcc_sharedRuntimeTrig.cpp := misleading-indentation, \
166-
DISABLED_WARNINGS_gcc_shenandoahBarrierSet.cpp := misleading-indentation, \
167-
DISABLED_WARNINGS_gcc_shenandoahBarrierSetAssembler_aarch64.cpp := misleading-indentation, \
168-
DISABLED_WARNINGS_gcc_shenandoahBarrierSetAssembler_ppc.cpp := misleading-indentation, \
169-
DISABLED_WARNINGS_gcc_shenandoahBarrierSetAssembler_riscv.cpp := misleading-indentation, \
170-
DISABLED_WARNINGS_gcc_shenandoahBarrierSetAssembler_x86.cpp := misleading-indentation, \
171-
DISABLED_WARNINGS_gcc_shenandoahBarrierSetC1_aarch64.cpp := misleading-indentation, \
172-
DISABLED_WARNINGS_gcc_shenandoahBarrierSetC1_ppc.cpp := misleading-indentation, \
173-
DISABLED_WARNINGS_gcc_shenandoahBarrierSetC1_riscv.cpp := misleading-indentation, \
174-
DISABLED_WARNINGS_gcc_shenandoahBarrierSetC1_x86.cpp := misleading-indentation, \
175-
DISABLED_WARNINGS_gcc_shenandoahBarrierSetC1.cpp := misleading-indentation, \
176162
DISABLED_WARNINGS_gcc_templateTable.cpp := cast-function-type, \
177163
DISABLED_WARNINGS_clang := $(DISABLED_WARNINGS_clang), \
178164
DISABLED_WARNINGS_clang_arguments.cpp := missing-field-initializers, \

src/hotspot/cpu/loongarch/loongarch_64.ad

Lines changed: 35 additions & 68 deletions
Original file line numberDiff line numberDiff line change
@@ -5653,10 +5653,7 @@ instruct jmpDir_short(label labl) %{
56535653

56545654
ins_encode %{
56555655
Label &L = *($labl$$label);
5656-
if(&L)
5657-
__ b(L);
5658-
else
5659-
__ b(int(0));
5656+
__ b(L);
56605657
%}
56615658

56625659
ins_pipe( pipe_jump );
@@ -5714,16 +5711,10 @@ instruct jmpCon_flags_short(cmpOpEqNe cop, FlagsReg cr, label labl) %{
57145711
Label &L = *($labl$$label);
57155712
switch($cop$$cmpcode) {
57165713
case 0x01: //equal
5717-
if (&L)
5718-
__ bnez($cr$$Register, L);
5719-
else
5720-
__ bnez($cr$$Register, (int)0);
5714+
__ bnez($cr$$Register, L);
57215715
break;
57225716
case 0x02: //not equal
5723-
if (&L)
5724-
__ beqz($cr$$Register, L);
5725-
else
5726-
__ beqz($cr$$Register, (int)0);
5717+
__ beqz($cr$$Register, L);
57275718
break;
57285719
default:
57295720
Unimplemented();
@@ -6011,45 +6002,27 @@ instruct branchConF_reg_reg_short(cmpOp cmp, regF src1, regF src2, label labl) %
60116002
switch(flag) {
60126003
case 0x01: //equal
60136004
__ fcmp_ceq_s(FCC0, reg_op1, reg_op2);
6014-
if (&L)
6015-
__ bcnez(FCC0, L);
6016-
else
6017-
__ bcnez(FCC0, (int)0);
6005+
__ bcnez(FCC0, L);
60186006
break;
60196007
case 0x02: //not_equal
60206008
__ fcmp_ceq_s(FCC0, reg_op1, reg_op2);
6021-
if (&L)
6022-
__ bceqz(FCC0, L);
6023-
else
6024-
__ bceqz(FCC0, (int)0);
6009+
__ bceqz(FCC0, L);
60256010
break;
60266011
case 0x03: //greater
60276012
__ fcmp_cule_s(FCC0, reg_op1, reg_op2);
6028-
if(&L)
6029-
__ bceqz(FCC0, L);
6030-
else
6031-
__ bceqz(FCC0, (int)0);
6013+
__ bceqz(FCC0, L);
60326014
break;
60336015
case 0x04: //greater_equal
60346016
__ fcmp_cult_s(FCC0, reg_op1, reg_op2);
6035-
if(&L)
6036-
__ bceqz(FCC0, L);
6037-
else
6038-
__ bceqz(FCC0, (int)0);
6017+
__ bceqz(FCC0, L);
60396018
break;
60406019
case 0x05: //less
60416020
__ fcmp_cult_s(FCC0, reg_op1, reg_op2);
6042-
if(&L)
6043-
__ bcnez(FCC0, L);
6044-
else
6045-
__ bcnez(FCC0, (int)0);
6021+
__ bcnez(FCC0, L);
60466022
break;
60476023
case 0x06: //less_equal
60486024
__ fcmp_cule_s(FCC0, reg_op1, reg_op2);
6049-
if(&L)
6050-
__ bcnez(FCC0, L);
6051-
else
6052-
__ bcnez(FCC0, (int)0);
6025+
__ bcnez(FCC0, L);
60536026
break;
60546027
default:
60556028
Unimplemented();
@@ -6075,46 +6048,28 @@ instruct branchConD_reg_reg_short(cmpOp cmp, regD src1, regD src2, label labl) %
60756048
switch(flag) {
60766049
case 0x01: //equal
60776050
__ fcmp_ceq_d(FCC0, reg_op1, reg_op2);
6078-
if (&L)
6079-
__ bcnez(FCC0, L);
6080-
else
6081-
__ bcnez(FCC0, (int)0);
6051+
__ bcnez(FCC0, L);
60826052
break;
60836053
case 0x02: //not_equal
60846054
// c_ueq_d cannot distinguish NaN from equal. Double.isNaN(Double) is implemented by 'f != f', so the use of c_ueq_d causes bugs.
60856055
__ fcmp_ceq_d(FCC0, reg_op1, reg_op2);
6086-
if (&L)
6087-
__ bceqz(FCC0, L);
6088-
else
6089-
__ bceqz(FCC0, (int)0);
6056+
__ bceqz(FCC0, L);
60906057
break;
60916058
case 0x03: //greater
60926059
__ fcmp_cule_d(FCC0, reg_op1, reg_op2);
6093-
if(&L)
6094-
__ bceqz(FCC0, L);
6095-
else
6096-
__ bceqz(FCC0, (int)0);
6060+
__ bceqz(FCC0, L);
60976061
break;
60986062
case 0x04: //greater_equal
60996063
__ fcmp_cult_d(FCC0, reg_op1, reg_op2);
6100-
if(&L)
6101-
__ bceqz(FCC0, L);
6102-
else
6103-
__ bceqz(FCC0, (int)0);
6064+
__ bceqz(FCC0, L);
61046065
break;
61056066
case 0x05: //less
61066067
__ fcmp_cult_d(FCC0, reg_op1, reg_op2);
6107-
if(&L)
6108-
__ bcnez(FCC0, L);
6109-
else
6110-
__ bcnez(FCC0, (int)0);
6068+
__ bcnez(FCC0, L);
61116069
break;
61126070
case 0x06: //less_equal
61136071
__ fcmp_cule_d(FCC0, reg_op1, reg_op2);
6114-
if(&L)
6115-
__ bcnez(FCC0, L);
6116-
else
6117-
__ bcnez(FCC0, (int)0);
6072+
__ bcnez(FCC0, L);
61186073
break;
61196074
default:
61206075
Unimplemented();
@@ -16573,23 +16528,35 @@ instruct cmpV32(vecY dst, vecY src1, vecY src2, immI cond)
1657316528

1657416529
// ---------------------------- LOAD_IOTA_INDICES -----------------------------
1657516530

16576-
instruct loadcon16B(vecX dst, immI_0 src) %{
16577-
predicate(Matcher::vector_length(n) == 16 && Matcher::vector_element_basic_type(n) == T_BYTE);
16531+
instruct loadconV16(vecX dst, immI_0 src) %{
16532+
predicate(Matcher::vector_length_in_bytes(n) == 16);
1657816533
match(Set dst (VectorLoadConst src));
16579-
format %{ "vld_con $dst, CONSTANT_MEMORY\t# @loadcon16B" %}
16534+
format %{ "vld_con $dst, CONSTANT_MEMORY\t# @loadconV16" %}
1658016535
ins_encode %{
16581-
__ li(AT, (long)StubRoutines::la::vector_iota_indices());
16536+
// The iota indices are ordered by type B/S/I/L/F/D, and the offset between two types is 32.
16537+
BasicType bt = Matcher::vector_element_basic_type(this);
16538+
int offset = exact_log2(type2aelembytes(bt)) << 5;
16539+
if (is_floating_point_type(bt)) {
16540+
offset += 64;
16541+
}
16542+
__ li(AT, (long)(StubRoutines::la::vector_iota_indices() + offset));
1658216543
__ vld($dst$$FloatRegister, AT, (int)0);
1658316544
%}
1658416545
ins_pipe( pipe_slow );
1658516546
%}
1658616547

16587-
instruct loadcon32B(vecY dst, immI_0 src) %{
16588-
predicate(Matcher::vector_length(n) == 32 && Matcher::vector_element_basic_type(n) == T_BYTE);
16548+
instruct loadconV32(vecY dst, immI_0 src) %{
16549+
predicate(Matcher::vector_length_in_bytes(n) == 32);
1658916550
match(Set dst (VectorLoadConst src));
16590-
format %{ "xvld_con $dst, CONSTANT_MEMORY\t# @loadcon32B" %}
16551+
format %{ "xvld_con $dst, CONSTANT_MEMORY\t# @loadconV32" %}
1659116552
ins_encode %{
16592-
__ li(AT, (long)StubRoutines::la::vector_iota_indices());
16553+
// The iota indices are ordered by type B/S/I/L/F/D, and the offset between two types is 32.
16554+
BasicType bt = Matcher::vector_element_basic_type(this);
16555+
int offset = exact_log2(type2aelembytes(bt)) << 5;
16556+
if (is_floating_point_type(bt)) {
16557+
offset += 64;
16558+
}
16559+
__ li(AT, (long)(StubRoutines::la::vector_iota_indices() + offset));
1659316560
__ xvld($dst$$FloatRegister, AT, (int)0);
1659416561
%}
1659516562
ins_pipe( pipe_slow );

src/hotspot/cpu/loongarch/macroAssembler_loongarch.cpp

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1745,15 +1745,15 @@ void MacroAssembler::access_load_at(BasicType type, DecoratorSet decorators, Reg
17451745
}
17461746
}
17471747

1748-
void MacroAssembler::access_store_at(BasicType type, DecoratorSet decorators, Address dst, Register src,
1748+
void MacroAssembler::access_store_at(BasicType type, DecoratorSet decorators, Address dst, Register val,
17491749
Register tmp1, Register tmp2) {
17501750
BarrierSetAssembler* bs = BarrierSet::barrier_set()->barrier_set_assembler();
17511751
decorators = AccessInternal::decorator_fixup(decorators);
17521752
bool as_raw = (decorators & AS_RAW) != 0;
17531753
if (as_raw) {
1754-
bs->BarrierSetAssembler::store_at(this, decorators, type, dst, src, tmp1, tmp2);
1754+
bs->BarrierSetAssembler::store_at(this, decorators, type, dst, val, tmp1, tmp2);
17551755
} else {
1756-
bs->store_at(this, decorators, type, dst, src, tmp1, tmp2);
1756+
bs->store_at(this, decorators, type, dst, val, tmp1, tmp2);
17571757
}
17581758
}
17591759

@@ -1768,9 +1768,9 @@ void MacroAssembler::load_heap_oop_not_null(Register dst, Address src, Register
17681768
access_load_at(T_OBJECT, IN_HEAP | IS_NOT_NULL | decorators, dst, src, tmp1, thread_tmp);
17691769
}
17701770

1771-
void MacroAssembler::store_heap_oop(Address dst, Register src, Register tmp1,
1771+
void MacroAssembler::store_heap_oop(Address dst, Register val, Register tmp1,
17721772
Register tmp2, DecoratorSet decorators) {
1773-
access_store_at(T_OBJECT, IN_HEAP | decorators, dst, src, tmp1, tmp2);
1773+
access_store_at(T_OBJECT, IN_HEAP | decorators, dst, val, tmp1, tmp2);
17741774
}
17751775

17761776
// Used for storing NULLs.

src/hotspot/cpu/loongarch/macroAssembler_loongarch.hpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -254,14 +254,14 @@ class MacroAssembler: public Assembler {
254254

255255
void access_load_at(BasicType type, DecoratorSet decorators, Register dst, Address src,
256256
Register tmp1, Register thread_tmp);
257-
void access_store_at(BasicType type, DecoratorSet decorators, Address dst, Register src,
257+
void access_store_at(BasicType type, DecoratorSet decorators, Address dst, Register val,
258258
Register tmp1, Register tmp2);
259259

260260
void load_heap_oop(Register dst, Address src, Register tmp1,
261261
Register thread_tmp = noreg, DecoratorSet decorators = 0);
262262
void load_heap_oop_not_null(Register dst, Address src, Register tmp1 = noreg,
263263
Register thread_tmp = noreg, DecoratorSet decorators = 0);
264-
void store_heap_oop(Address dst, Register src, Register tmp1 = noreg,
264+
void store_heap_oop(Address dst, Register val, Register tmp1 = noreg,
265265
Register tmp2 = noreg, DecoratorSet decorators = 0);
266266

267267
// Used for storing NULL. All other oop constants should be

src/hotspot/cpu/loongarch/stubGenerator_loongarch_64.cpp

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -441,10 +441,36 @@ class StubGenerator: public StubCodeGenerator {
441441
__ align(CodeEntryAlignment);
442442
StubCodeMark mark(this, "StubRoutines", stub_name);
443443
address start = __ pc();
444+
// B
444445
__ emit_data64(0x0706050403020100, relocInfo::none);
445446
__ emit_data64(0x0F0E0D0C0B0A0908, relocInfo::none);
446447
__ emit_data64(0x1716151413121110, relocInfo::none);
447448
__ emit_data64(0x1F1E1D1C1B1A1918, relocInfo::none);
449+
// H
450+
__ emit_data64(0x0003000200010000, relocInfo::none);
451+
__ emit_data64(0x0007000600050004, relocInfo::none);
452+
__ emit_data64(0x000B000A00090008, relocInfo::none);
453+
__ emit_data64(0x000F000E000D000C, relocInfo::none);
454+
// W
455+
__ emit_data64(0x0000000100000000, relocInfo::none);
456+
__ emit_data64(0x0000000300000002, relocInfo::none);
457+
__ emit_data64(0x0000000500000004, relocInfo::none);
458+
__ emit_data64(0x0000000700000006, relocInfo::none);
459+
// D
460+
__ emit_data64(0x0000000000000000, relocInfo::none);
461+
__ emit_data64(0x0000000000000001, relocInfo::none);
462+
__ emit_data64(0x0000000000000002, relocInfo::none);
463+
__ emit_data64(0x0000000000000003, relocInfo::none);
464+
// S - FP
465+
__ emit_data64(0x3F80000000000000, relocInfo::none); // 0.0f, 1.0f
466+
__ emit_data64(0x4040000040000000, relocInfo::none); // 2.0f, 3.0f
467+
__ emit_data64(0x40A0000040800000, relocInfo::none); // 4.0f, 5.0f
468+
__ emit_data64(0x40E0000040C00000, relocInfo::none); // 6.0f, 7.0f
469+
// D - FP
470+
__ emit_data64(0x0000000000000000, relocInfo::none); // 0.0d
471+
__ emit_data64(0x3FF0000000000000, relocInfo::none); // 1.0d
472+
__ emit_data64(0x4000000000000000, relocInfo::none); // 2.0d
473+
__ emit_data64(0x4008000000000000, relocInfo::none); // 3.0d
448474
return start;
449475
}
450476

src/hotspot/share/c1/c1_LIR.cpp

Lines changed: 24 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -540,7 +540,7 @@ void LIR_OpVisitState::visit(LIR_Op* op) {
540540
if (opAllocObj->_tmp3->is_valid()) do_temp(opAllocObj->_tmp3);
541541
if (opAllocObj->_tmp4->is_valid()) do_temp(opAllocObj->_tmp4);
542542
if (opAllocObj->_result->is_valid()) do_output(opAllocObj->_result);
543-
do_stub(opAllocObj->_stub);
543+
if (opAllocObj->_stub != nullptr) do_stub(opAllocObj->_stub);
544544
break;
545545
}
546546

@@ -840,7 +840,7 @@ void LIR_OpVisitState::visit(LIR_Op* op) {
840840
if (opTypeCheck->_tmp2->is_valid()) do_temp(opTypeCheck->_tmp2);
841841
if (opTypeCheck->_tmp3->is_valid()) do_temp(opTypeCheck->_tmp3);
842842
if (opTypeCheck->_result->is_valid()) do_output(opTypeCheck->_result);
843-
do_stub(opTypeCheck->_stub);
843+
if (opTypeCheck->_stub != nullptr) do_stub(opTypeCheck->_stub);
844844
break;
845845
}
846846

@@ -849,21 +849,18 @@ void LIR_OpVisitState::visit(LIR_Op* op) {
849849
case lir_cas_obj:
850850
case lir_cas_int: {
851851
assert(op->as_OpCompareAndSwap() != NULL, "must be");
852-
LIR_OpCompareAndSwap* opCompareAndSwap = (LIR_OpCompareAndSwap*)op;
853-
854-
assert(opCompareAndSwap->_addr->is_valid(), "used");
855-
assert(opCompareAndSwap->_cmp_value->is_valid(), "used");
856-
assert(opCompareAndSwap->_new_value->is_valid(), "used");
857-
if (opCompareAndSwap->_info) do_info(opCompareAndSwap->_info);
858-
do_input(opCompareAndSwap->_addr);
859-
do_temp(opCompareAndSwap->_addr);
860-
do_input(opCompareAndSwap->_cmp_value);
861-
do_temp(opCompareAndSwap->_cmp_value);
862-
do_input(opCompareAndSwap->_new_value);
863-
do_temp(opCompareAndSwap->_new_value);
864-
if (opCompareAndSwap->_tmp1->is_valid()) do_temp(opCompareAndSwap->_tmp1);
865-
if (opCompareAndSwap->_tmp2->is_valid()) do_temp(opCompareAndSwap->_tmp2);
866-
if (opCompareAndSwap->_result->is_valid()) do_output(opCompareAndSwap->_result);
852+
LIR_OpCompareAndSwap* opCmpAndSwap = (LIR_OpCompareAndSwap*)op;
853+
854+
if (opCmpAndSwap->_info) do_info(opCmpAndSwap->_info);
855+
assert(opCmpAndSwap->_addr->is_valid(), "used"); do_input(opCmpAndSwap->_addr);
856+
do_temp(opCmpAndSwap->_addr);
857+
assert(opCmpAndSwap->_cmp_value->is_valid(), "used"); do_input(opCmpAndSwap->_cmp_value);
858+
do_temp(opCmpAndSwap->_cmp_value);
859+
assert(opCmpAndSwap->_new_value->is_valid(), "used"); do_input(opCmpAndSwap->_new_value);
860+
do_temp(opCmpAndSwap->_new_value);
861+
if (opCmpAndSwap->_tmp1->is_valid()) do_temp(opCmpAndSwap->_tmp1);
862+
if (opCmpAndSwap->_tmp2->is_valid()) do_temp(opCmpAndSwap->_tmp2);
863+
if (opCmpAndSwap->_result->is_valid()) do_output(opCmpAndSwap->_result);
867864

868865
break;
869866
}
@@ -875,14 +872,18 @@ void LIR_OpVisitState::visit(LIR_Op* op) {
875872
LIR_OpAllocArray* opAllocArray = (LIR_OpAllocArray*)op;
876873

877874
if (opAllocArray->_info) do_info(opAllocArray->_info);
878-
if (opAllocArray->_klass->is_valid()) do_input(opAllocArray->_klass); do_temp(opAllocArray->_klass);
879-
if (opAllocArray->_len->is_valid()) do_input(opAllocArray->_len); do_temp(opAllocArray->_len);
875+
if (opAllocArray->_klass->is_valid()) { do_input(opAllocArray->_klass);
876+
do_temp(opAllocArray->_klass);
877+
}
878+
if (opAllocArray->_len->is_valid()) { do_input(opAllocArray->_len);
879+
do_temp(opAllocArray->_len);
880+
}
880881
if (opAllocArray->_tmp1->is_valid()) do_temp(opAllocArray->_tmp1);
881882
if (opAllocArray->_tmp2->is_valid()) do_temp(opAllocArray->_tmp2);
882883
if (opAllocArray->_tmp3->is_valid()) do_temp(opAllocArray->_tmp3);
883884
if (opAllocArray->_tmp4->is_valid()) do_temp(opAllocArray->_tmp4);
884885
if (opAllocArray->_result->is_valid()) do_output(opAllocArray->_result);
885-
do_stub(opAllocArray->_stub);
886+
if (opAllocArray->_stub != nullptr) do_stub(opAllocArray->_stub);
886887
break;
887888
}
888889

@@ -1924,7 +1925,9 @@ void LIR_OpConvert::print_instr(outputStream* out) const {
19241925
print_bytecode(out, bytecode());
19251926
in_opr()->print(out); out->print(" ");
19261927
result_opr()->print(out); out->print(" ");
1927-
if(tmp()->is_valid()) tmp()->print(out); out->print(" ");
1928+
if(tmp()->is_valid()) {
1929+
tmp()->print(out); out->print(" ");
1930+
}
19281931
}
19291932

19301933
void LIR_OpConvert::print_bytecode(outputStream* out, Bytecodes::Code code) {

src/hotspot/share/classfile/javaClasses.cpp

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3846,7 +3846,9 @@ oop java_lang_boxing_object::initialize_and_allocate(BasicType type, TRAPS) {
38463846
Klass* k = vmClasses::box_klass(type);
38473847
if (k == NULL) return NULL;
38483848
InstanceKlass* ik = InstanceKlass::cast(k);
3849-
if (!ik->is_initialized()) ik->initialize(CHECK_NULL);
3849+
if (!ik->is_initialized()) {
3850+
ik->initialize(CHECK_NULL);
3851+
}
38503852
return ik->allocate_instance(THREAD);
38513853
}
38523854

0 commit comments

Comments
 (0)