--- old/src/cpu/s390/vm/macroAssembler_s390.hpp 2017-03-02 17:12:11.525925000 +0100 +++ new/src/cpu/s390/vm/macroAssembler_s390.hpp 2017-03-02 17:12:11.418913000 +0100 @@ -1,6 +1,6 @@ /* - * Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved. - * Copyright (c) 2016 SAP SE. All rights reserved. + * Copyright (c) 2016, 2017, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2016, 2017, SAP SE. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -1004,22 +1004,35 @@ int before = 0, int after = 0) PRODUCT_RETURN; // Emitters for CRC32 calculation. + // A note on invertCRC: + // Unfortunately, internal representation of crc differs between CRC32 and CRC32C. + // CRC32 holds it's current crc value in the externally visible representation. + // CRC32C holds it's current crc value in internal format, ready for updating. + // Thus, the crc value must be bit-flipped before updating it in the CRC32 case. + // In the CRC32C case, it must be bit-flipped when it is given to the outside world (getValue()). + // The bool invertCRC parameter indicates whether bit-flipping is required before updates. private: void fold_byte_crc32(Register crc, Register table, Register val, Register tmp); void fold_8bit_crc32(Register crc, Register table, Register tmp); + void update_byte_crc32( Register crc, Register val, Register table); void update_byteLoop_crc32(Register crc, Register buf, Register len, Register table, - Register data, bool invertCRC); + Register data); void update_1word_crc32(Register crc, Register buf, Register table, int bufDisp, int bufInc, Register t0, Register t1, Register t2, Register t3); public: - void update_byte_crc32( Register crc, Register val, Register table); - void kernel_crc32_singleByte(Register crc, Register buf, Register len, Register table, Register tmp); + void kernel_crc32_singleByteReg(Register crc, Register val, Register table, + bool invertCRC); + void kernel_crc32_singleByte(Register crc, Register buf, Register len, Register table, Register tmp, + bool invertCRC); void kernel_crc32_1byte(Register crc, Register buf, Register len, Register table, - Register t0, Register t1, Register t2, Register t3); + Register t0, Register t1, Register t2, Register t3, + bool invertCRC); void kernel_crc32_1word(Register crc, Register buf, Register len, Register table, - Register t0, Register t1, Register t2, Register t3); + Register t0, Register t1, Register t2, Register t3, + bool invertCRC); void kernel_crc32_2word(Register crc, Register buf, Register len, Register table, - Register t0, Register t1, Register t2, Register t3); + Register t0, Register t1, Register t2, Register t3, + bool invertCRC); // Emitters for BigInteger.multiplyToLen intrinsic // note: length of result array (zlen) is passed on the stack