Skip to content

Commit 5d4bfad

Browse files
committed
8327693: C1: LIRGenerator::_instruction_for_operand is only read by assertion code
Reviewed-by: gli, chagedorn
1 parent f3d0c45 commit 5d4bfad

File tree

2 files changed

+16
-13
lines changed

2 files changed

+16
-13
lines changed

src/hotspot/share/c1/c1_LIRGenerator.cpp

Lines changed: 9 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (c) 2005, 2023, Oracle and/or its affiliates. All rights reserved.
2+
* Copyright (c) 2005, 2024, Oracle and/or its affiliates. All rights reserved.
33
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
44
*
55
* This code is free software; you can redistribute it and/or modify it
@@ -205,9 +205,11 @@ void LIRItem::set_result(LIR_Opr opr) {
205205
assert(value()->operand()->is_illegal() || value()->operand()->is_constant(), "operand should never change");
206206
value()->set_operand(opr);
207207

208+
#ifdef ASSERT
208209
if (opr->is_virtual()) {
209210
_gen->_instruction_for_operand.at_put_grow(opr->vreg_number(), value(), nullptr);
210211
}
212+
#endif
211213

212214
_result = opr;
213215
}
@@ -1494,28 +1496,22 @@ LIR_Opr LIRGenerator::operand_for_instruction(Instruction* x) {
14941496
assert(x->as_Phi() || x->as_Local() != nullptr, "only for Phi and Local");
14951497
// allocate a virtual register for this local or phi
14961498
x->set_operand(rlock(x));
1499+
#ifdef ASSERT
14971500
_instruction_for_operand.at_put_grow(x->operand()->vreg_number(), x, nullptr);
1501+
#endif
14981502
}
14991503
}
15001504
return x->operand();
15011505
}
15021506

1503-
1504-
Instruction* LIRGenerator::instruction_for_opr(LIR_Opr opr) {
1505-
if (opr->is_virtual()) {
1506-
return instruction_for_vreg(opr->vreg_number());
1507-
}
1508-
return nullptr;
1509-
}
1510-
1511-
1507+
#ifdef ASSERT
15121508
Instruction* LIRGenerator::instruction_for_vreg(int reg_num) {
15131509
if (reg_num < _instruction_for_operand.length()) {
15141510
return _instruction_for_operand.at(reg_num);
15151511
}
15161512
return nullptr;
15171513
}
1518-
1514+
#endif
15191515

15201516
void LIRGenerator::set_vreg_flag(int vreg_num, VregFlag f) {
15211517
if (_vreg_flags.size_in_bits() == 0) {
@@ -2660,7 +2656,9 @@ void LIRGenerator::do_Base(Base* x) {
26602656
assert(as_ValueType(t)->tag() == local->type()->tag(), "check");
26612657
#endif // __SOFTFP__
26622658
local->set_operand(dest);
2659+
#ifdef ASSERT
26632660
_instruction_for_operand.at_put_grow(dest->vreg_number(), local, nullptr);
2661+
#endif
26642662
java_index += type2size[t];
26652663
}
26662664

src/hotspot/share/c1/c1_LIRGenerator.hpp

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (c) 2005, 2023, Oracle and/or its affiliates. All rights reserved.
2+
* Copyright (c) 2005, 2024, Oracle and/or its affiliates. All rights reserved.
33
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
44
*
55
* This code is free software; you can redistribute it and/or modify it
@@ -166,7 +166,9 @@ class LIRGenerator: public InstructionVisitor, public BlockClosure {
166166
PhiResolverState _resolver_state;
167167
BlockBegin* _block;
168168
int _virtual_register_number;
169+
#ifdef ASSERT
169170
Values _instruction_for_operand;
171+
#endif
170172
BitMap2D _vreg_flags; // flags which can be set on a per-vreg basis
171173
LIR_List* _lir;
172174

@@ -223,9 +225,11 @@ class LIRGenerator: public InstructionVisitor, public BlockClosure {
223225
assert(!opr->is_register() || opr->is_virtual(), "should never set result to a physical register");
224226
x->set_operand(opr);
225227
assert(opr == x->operand(), "must be");
228+
#ifdef ASSERT
226229
if (opr->is_virtual()) {
227230
_instruction_for_operand.at_put_grow(opr->vreg_number(), x, nullptr);
228231
}
232+
#endif
229233
}
230234
void set_no_result(Value x) { assert(!x->has_uses(), "can't have use"); x->clear_operand(); }
231235

@@ -507,9 +511,10 @@ class LIRGenerator: public InstructionVisitor, public BlockClosure {
507511
, _barrier_set(BarrierSet::barrier_set()->barrier_set_c1()) {
508512
}
509513

514+
#ifdef ASSERT
510515
// for virtual registers, maps them back to Phi's or Local's
511-
Instruction* instruction_for_opr(LIR_Opr opr);
512516
Instruction* instruction_for_vreg(int reg_num);
517+
#endif
513518

514519
void set_vreg_flag (int vreg_num, VregFlag f);
515520
bool is_vreg_flag_set(int vreg_num, VregFlag f);

0 commit comments

Comments
 (0)