hotspot/src/cpu/s390/vm/c1_LIRGenerator_s390.cpp
changeset 46386 742f8b16d00c
parent 46315 a796c32af782
child 46458 3c12af929e7d
--- a/hotspot/src/cpu/s390/vm/c1_LIRGenerator_s390.cpp	Fri Apr 14 15:47:33 2017 -0700
+++ b/hotspot/src/cpu/s390/vm/c1_LIRGenerator_s390.cpp	Fri Mar 24 16:35:37 2017 +0100
@@ -1229,9 +1229,19 @@
       LIRItem crc(x->argument_at(0), this);
       LIRItem buf(x->argument_at(1), this);
       LIRItem off(x->argument_at(2), this);
-      LIRItem len(x->argument_at(3), this);
+      LIRItem end(x->argument_at(3), this);
       buf.load_item();
       off.load_nonconstant();
+      end.load_nonconstant();
+
+      // len = end - off
+      LIR_Opr len  = end.result();
+      LIR_Opr tmpA = new_register(T_INT);
+      LIR_Opr tmpB = new_register(T_INT);
+      __ move(end.result(), tmpA);
+      __ move(off.result(), tmpB);
+      __ sub(tmpA, tmpB, tmpA);
+      len = tmpA;
 
       LIR_Opr index = off.result();
       int offset = is_updateBytes ? arrayOopDesc::base_offset_in_bytes(T_BYTE) : 0;
@@ -1262,7 +1272,7 @@
 
       crc.load_item_force(arg1); // We skip int->long conversion here, because CRC32C stub doesn't care about high bits.
       __ leal(LIR_OprFact::address(a), arg2);
-      len.load_item_force(arg3); // We skip int->long conversion here, because CRC32C stub expects int.
+      __ move(len, cc->at(2));   // We skip int->long conversion here, because CRC32C stub expects int.
 
       __ call_runtime_leaf(StubRoutines::updateBytesCRC32C(), LIR_OprFact::illegalOpr, result_reg, cc->args());
       __ move(result_reg, result);