Tue, 19 Feb 2019 10:06:13 +0100
8211231: BarrierSetC1::generate_referent_check() confuses register allocator
Reviewed-by: iveresov, kvn
src/share/vm/c1/c1_LIRGenerator.cpp | file | annotate | diff | comparison | revisions |
1.1 --- a/src/share/vm/c1/c1_LIRGenerator.cpp Tue Feb 12 16:14:28 2019 +0100 1.2 +++ b/src/share/vm/c1/c1_LIRGenerator.cpp Tue Feb 19 10:06:13 2019 +0100 1.3 @@ -2305,6 +2305,10 @@ 1.4 1.5 // We can have generate one runtime check here. Let's start with 1.6 // the offset check. 1.7 + // Allocate temp register to src and load it here, otherwise 1.8 + // control flow below may confuse register allocator. 1.9 + LIR_Opr src_reg = new_register(T_OBJECT); 1.10 + __ move(src.result(), src_reg); 1.11 if (gen_offset_check) { 1.12 // if (offset != referent_offset) -> continue 1.13 // If offset is an int then we can do the comparison with the 1.14 @@ -2327,14 +2331,14 @@ 1.15 if (gen_source_check) { 1.16 // offset is a const and equals referent offset 1.17 // if (source == null) -> continue 1.18 - __ cmp(lir_cond_equal, src.result(), LIR_OprFact::oopConst(NULL)); 1.19 + __ cmp(lir_cond_equal, src_reg, LIR_OprFact::oopConst(NULL)); 1.20 __ branch(lir_cond_equal, T_OBJECT, Lcont->label()); 1.21 } 1.22 LIR_Opr src_klass = new_register(T_OBJECT); 1.23 if (gen_type_check) { 1.24 // We have determined that offset == referent_offset && src != null. 1.25 // if (src->_klass->_reference_type == REF_NONE) -> continue 1.26 - __ move(new LIR_Address(src.result(), oopDesc::klass_offset_in_bytes(), T_ADDRESS), src_klass); 1.27 + __ move(new LIR_Address(src_reg, oopDesc::klass_offset_in_bytes(), T_ADDRESS), src_klass); 1.28 LIR_Address* reference_type_addr = new LIR_Address(src_klass, in_bytes(InstanceKlass::reference_type_offset()), T_BYTE); 1.29 LIR_Opr reference_type = new_register(T_INT); 1.30 __ move(reference_type_addr, reference_type);