--- a/hotspot/src/cpu/sparc/vm/c1_LIRGenerator_sparc.cpp Fri Apr 29 17:24:16 2016 +0200
+++ b/hotspot/src/cpu/sparc/vm/c1_LIRGenerator_sparc.cpp Wed May 04 15:30:21 2016 -0700
@@ -868,6 +868,90 @@
}
}
+void LIRGenerator::do_update_CRC32C(Intrinsic* x) {
+ // Make all state_for calls early since they can emit code
+ LIR_Opr result = rlock_result(x);
+ int flags = 0;
+ switch (x->id()) {
+ case vmIntrinsics::_updateBytesCRC32C:
+ case vmIntrinsics::_updateDirectByteBufferCRC32C: {
+
+ bool is_updateBytes = (x->id() == vmIntrinsics::_updateBytesCRC32C);
+ int array_offset = is_updateBytes ? arrayOopDesc::base_offset_in_bytes(T_BYTE) : 0;
+
+ LIRItem crc(x->argument_at(0), this);
+ LIRItem buf(x->argument_at(1), this);
+ LIRItem off(x->argument_at(2), 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();
+
+ if(off.result()->is_constant()) {
+ index = LIR_OprFact::illegalOpr;
+ array_offset += off.result()->as_jint();
+ }
+
+ LIR_Opr base_op = buf.result();
+
+ if (index->is_valid()) {
+ LIR_Opr tmp = new_register(T_LONG);
+ __ convert(Bytecodes::_i2l, index, tmp);
+ index = tmp;
+ if (index->is_constant()) {
+ array_offset += index->as_constant_ptr()->as_jint();
+ index = LIR_OprFact::illegalOpr;
+ } else if (index->is_register()) {
+ LIR_Opr tmp2 = new_register(T_LONG);
+ LIR_Opr tmp3 = new_register(T_LONG);
+ __ move(base_op, tmp2);
+ __ move(index, tmp3);
+ __ add(tmp2, tmp3, tmp2);
+ base_op = tmp2;
+ } else {
+ ShouldNotReachHere();
+ }
+ }
+
+ LIR_Address* a = new LIR_Address(base_op, array_offset, T_BYTE);
+
+ BasicTypeList signature(3);
+ signature.append(T_INT);
+ signature.append(T_ADDRESS);
+ signature.append(T_INT);
+ CallingConvention* cc = frame_map()->c_calling_convention(&signature);
+ const LIR_Opr result_reg = result_register_for(x->type());
+
+ LIR_Opr addr = new_pointer_register();
+ __ leal(LIR_OprFact::address(a), addr);
+
+ crc.load_item_force(cc->at(0));
+ __ move(addr, cc->at(1));
+ __ move(len, cc->at(2));
+
+ __ call_runtime_leaf(StubRoutines::updateBytesCRC32C(), getThreadTemp(), result_reg, cc->args());
+ __ move(result_reg, result);
+
+ break;
+ }
+ default: {
+ ShouldNotReachHere();
+ }
+ }
+}
+
// _i2l, _i2f, _i2d, _l2i, _l2f, _l2d, _f2i, _f2l, _f2d, _d2i, _d2l, _d2f
// _i2b, _i2c, _i2s
void LIRGenerator::do_Convert(Convert* x) {