866 ShouldNotReachHere(); |
866 ShouldNotReachHere(); |
867 } |
867 } |
868 } |
868 } |
869 } |
869 } |
870 |
870 |
|
871 void LIRGenerator::do_update_CRC32C(Intrinsic* x) { |
|
872 // Make all state_for calls early since they can emit code |
|
873 LIR_Opr result = rlock_result(x); |
|
874 int flags = 0; |
|
875 switch (x->id()) { |
|
876 case vmIntrinsics::_updateBytesCRC32C: |
|
877 case vmIntrinsics::_updateDirectByteBufferCRC32C: { |
|
878 |
|
879 bool is_updateBytes = (x->id() == vmIntrinsics::_updateBytesCRC32C); |
|
880 int array_offset = is_updateBytes ? arrayOopDesc::base_offset_in_bytes(T_BYTE) : 0; |
|
881 |
|
882 LIRItem crc(x->argument_at(0), this); |
|
883 LIRItem buf(x->argument_at(1), this); |
|
884 LIRItem off(x->argument_at(2), this); |
|
885 LIRItem end(x->argument_at(3), this); |
|
886 |
|
887 buf.load_item(); |
|
888 off.load_nonconstant(); |
|
889 end.load_nonconstant(); |
|
890 |
|
891 // len = end - off |
|
892 LIR_Opr len = end.result(); |
|
893 LIR_Opr tmpA = new_register(T_INT); |
|
894 LIR_Opr tmpB = new_register(T_INT); |
|
895 __ move(end.result(), tmpA); |
|
896 __ move(off.result(), tmpB); |
|
897 __ sub(tmpA, tmpB, tmpA); |
|
898 len = tmpA; |
|
899 |
|
900 LIR_Opr index = off.result(); |
|
901 |
|
902 if(off.result()->is_constant()) { |
|
903 index = LIR_OprFact::illegalOpr; |
|
904 array_offset += off.result()->as_jint(); |
|
905 } |
|
906 |
|
907 LIR_Opr base_op = buf.result(); |
|
908 |
|
909 if (index->is_valid()) { |
|
910 LIR_Opr tmp = new_register(T_LONG); |
|
911 __ convert(Bytecodes::_i2l, index, tmp); |
|
912 index = tmp; |
|
913 if (index->is_constant()) { |
|
914 array_offset += index->as_constant_ptr()->as_jint(); |
|
915 index = LIR_OprFact::illegalOpr; |
|
916 } else if (index->is_register()) { |
|
917 LIR_Opr tmp2 = new_register(T_LONG); |
|
918 LIR_Opr tmp3 = new_register(T_LONG); |
|
919 __ move(base_op, tmp2); |
|
920 __ move(index, tmp3); |
|
921 __ add(tmp2, tmp3, tmp2); |
|
922 base_op = tmp2; |
|
923 } else { |
|
924 ShouldNotReachHere(); |
|
925 } |
|
926 } |
|
927 |
|
928 LIR_Address* a = new LIR_Address(base_op, array_offset, T_BYTE); |
|
929 |
|
930 BasicTypeList signature(3); |
|
931 signature.append(T_INT); |
|
932 signature.append(T_ADDRESS); |
|
933 signature.append(T_INT); |
|
934 CallingConvention* cc = frame_map()->c_calling_convention(&signature); |
|
935 const LIR_Opr result_reg = result_register_for(x->type()); |
|
936 |
|
937 LIR_Opr addr = new_pointer_register(); |
|
938 __ leal(LIR_OprFact::address(a), addr); |
|
939 |
|
940 crc.load_item_force(cc->at(0)); |
|
941 __ move(addr, cc->at(1)); |
|
942 __ move(len, cc->at(2)); |
|
943 |
|
944 __ call_runtime_leaf(StubRoutines::updateBytesCRC32C(), getThreadTemp(), result_reg, cc->args()); |
|
945 __ move(result_reg, result); |
|
946 |
|
947 break; |
|
948 } |
|
949 default: { |
|
950 ShouldNotReachHere(); |
|
951 } |
|
952 } |
|
953 } |
|
954 |
871 // _i2l, _i2f, _i2d, _l2i, _l2f, _l2d, _f2i, _f2l, _f2d, _d2i, _d2l, _d2f |
955 // _i2l, _i2f, _i2d, _l2i, _l2f, _l2d, _f2i, _f2l, _f2d, _d2i, _d2l, _d2f |
872 // _i2b, _i2c, _i2s |
956 // _i2b, _i2c, _i2s |
873 void LIRGenerator::do_Convert(Convert* x) { |
957 void LIRGenerator::do_Convert(Convert* x) { |
874 |
958 |
875 switch (x->op()) { |
959 switch (x->op()) { |