changeset 9048:3999f5f297f2

8211231: BarrierSetC1::generate_referent_check() confuses register allocator Reviewed-by: iveresov, kvn
author roland
date Tue, 19 Feb 2019 10:06:13 +0100
parents 6384d7f8a123
children 71bd8f8ad1fb
files src/share/vm/c1/c1_LIRGenerator.cpp
diffstat 1 files changed, 6 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/src/share/vm/c1/c1_LIRGenerator.cpp	Tue Feb 12 16:14:28 2019 +0100
+++ b/src/share/vm/c1/c1_LIRGenerator.cpp	Tue Feb 19 10:06:13 2019 +0100
@@ -2305,6 +2305,10 @@
 
       // We can have generate one runtime check here. Let's start with
       // the offset check.
+      // Allocate temp register to src and load it here, otherwise
+      // control flow below may confuse register allocator.
+      LIR_Opr src_reg = new_register(T_OBJECT);
+      __ move(src.result(), src_reg);
       if (gen_offset_check) {
         // if (offset != referent_offset) -> continue
         // If offset is an int then we can do the comparison with the
@@ -2327,14 +2331,14 @@
       if (gen_source_check) {
         // offset is a const and equals referent offset
         // if (source == null) -> continue
-        __ cmp(lir_cond_equal, src.result(), LIR_OprFact::oopConst(NULL));
+        __ cmp(lir_cond_equal, src_reg, LIR_OprFact::oopConst(NULL));
         __ branch(lir_cond_equal, T_OBJECT, Lcont->label());
       }
       LIR_Opr src_klass = new_register(T_OBJECT);
       if (gen_type_check) {
         // We have determined that offset == referent_offset && src != null.
         // if (src->_klass->_reference_type == REF_NONE) -> continue
-        __ move(new LIR_Address(src.result(), oopDesc::klass_offset_in_bytes(), T_ADDRESS), src_klass);
+        __ move(new LIR_Address(src_reg, oopDesc::klass_offset_in_bytes(), T_ADDRESS), src_klass);
         LIR_Address* reference_type_addr = new LIR_Address(src_klass, in_bytes(InstanceKlass::reference_type_offset()), T_BYTE);
         LIR_Opr reference_type = new_register(T_INT);
         __ move(reference_type_addr, reference_type);