1 /* 2 * Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved. 3 * Copyright (c) 2016 SAP SE. All rights reserved. 4 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 5 * 6 * This code is free software; you can redistribute it and/or modify it 7 * under the terms of the GNU General Public License version 2 only, as 8 * published by the Free Software Foundation. 9 * 10 * This code is distributed in the hope that it will be useful, but WITHOUT 11 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 12 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 13 * version 2 for more details (a copy is included in the LICENSE file that 14 * accompanied this code). 15 * 16 * You should have received a copy of the GNU General Public License version 17 * 2 along with this work; if not, write to the Free Software Foundation, 18 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 19 * 20 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 21 * or visit www.oracle.com if you need additional information or have any 22 * questions. 23 * 987 988 // Prints msg, but don't stop. 989 void warn(const char* msg); 990 991 //----------------------------- 992 //--- basic block tracing code 993 //----------------------------- 994 void trace_basic_block(uint i); 995 void init_basic_block_trace(); 996 // Number of bytes a basic block gets larger due to the tracing code macro (worst case). 997 // Currently, worst case is 48 bytes. 64 puts us securely on the safe side. 998 static int basic_blck_trace_blk_size_incr() { return 64; } 999 1000 // Write pattern 0x0101010101010101 in region [low-before, high+after]. 1001 // Low and high may be the same registers. Before and after are 1002 // the numbers of 8-byte words. 1003 void zap_from_to(Register low, Register high, Register tmp1 = Z_R0, Register tmp2 = Z_R1, 1004 int before = 0, int after = 0) PRODUCT_RETURN; 1005 1006 // Emitters for CRC32 calculation. 1007 private: 1008 void fold_byte_crc32(Register crc, Register table, Register val, Register tmp); 1009 void fold_8bit_crc32(Register crc, Register table, Register tmp); 1010 void update_byteLoop_crc32(Register crc, Register buf, Register len, Register table, 1011 Register data, bool invertCRC); 1012 void update_1word_crc32(Register crc, Register buf, Register table, int bufDisp, int bufInc, 1013 Register t0, Register t1, Register t2, Register t3); 1014 public: 1015 void update_byte_crc32( Register crc, Register val, Register table); 1016 void kernel_crc32_singleByte(Register crc, Register buf, Register len, Register table, Register tmp); 1017 void kernel_crc32_1byte(Register crc, Register buf, Register len, Register table, 1018 Register t0, Register t1, Register t2, Register t3); 1019 void kernel_crc32_1word(Register crc, Register buf, Register len, Register table, 1020 Register t0, Register t1, Register t2, Register t3); 1021 void kernel_crc32_2word(Register crc, Register buf, Register len, Register table, 1022 Register t0, Register t1, Register t2, Register t3); 1023 1024 // Emitters for BigInteger.multiplyToLen intrinsic 1025 // note: length of result array (zlen) is passed on the stack 1026 private: 1027 void add2_with_carry(Register dest_hi, Register dest_lo, 1028 Register src1, Register src2); 1029 void multiply_64_x_64_loop(Register x, Register xstart, 1030 Register x_xstart, 1031 Register y, Register y_idx, Register z, 1032 Register carry, Register product, 1033 Register idx, Register kdx); 1034 void multiply_add_128_x_128(Register x_xstart, Register y, Register z, 1035 Register yz_idx, Register idx, 1036 Register carry, Register product, int offset); 1037 void multiply_128_x_128_loop(Register x_xstart, 1038 Register y, Register z, 1039 Register yz_idx, Register idx, 1040 Register jdx, 1041 Register carry, Register product, 1042 Register carry2); | 1 /* 2 * Copyright (c) 2016, 2017, Oracle and/or its affiliates. All rights reserved. 3 * Copyright (c) 2016, 2017, SAP SE. All rights reserved. 4 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 5 * 6 * This code is free software; you can redistribute it and/or modify it 7 * under the terms of the GNU General Public License version 2 only, as 8 * published by the Free Software Foundation. 9 * 10 * This code is distributed in the hope that it will be useful, but WITHOUT 11 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 12 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 13 * version 2 for more details (a copy is included in the LICENSE file that 14 * accompanied this code). 15 * 16 * You should have received a copy of the GNU General Public License version 17 * 2 along with this work; if not, write to the Free Software Foundation, 18 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 19 * 20 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 21 * or visit www.oracle.com if you need additional information or have any 22 * questions. 23 * 987 988 // Prints msg, but don't stop. 989 void warn(const char* msg); 990 991 //----------------------------- 992 //--- basic block tracing code 993 //----------------------------- 994 void trace_basic_block(uint i); 995 void init_basic_block_trace(); 996 // Number of bytes a basic block gets larger due to the tracing code macro (worst case). 997 // Currently, worst case is 48 bytes. 64 puts us securely on the safe side. 998 static int basic_blck_trace_blk_size_incr() { return 64; } 999 1000 // Write pattern 0x0101010101010101 in region [low-before, high+after]. 1001 // Low and high may be the same registers. Before and after are 1002 // the numbers of 8-byte words. 1003 void zap_from_to(Register low, Register high, Register tmp1 = Z_R0, Register tmp2 = Z_R1, 1004 int before = 0, int after = 0) PRODUCT_RETURN; 1005 1006 // Emitters for CRC32 calculation. 1007 // A note on invertCRC: 1008 // Unfortunately, internal representation of crc differs between CRC32 and CRC32C. 1009 // CRC32 holds it's current crc value in the externally visible representation. 1010 // CRC32C holds it's current crc value in internal format, ready for updating. 1011 // Thus, the crc value must be bit-flipped before updating it in the CRC32 case. 1012 // In the CRC32C case, it must be bit-flipped when it is given to the outside world (getValue()). 1013 // The bool invertCRC parameter indicates whether bit-flipping is required before updates. 1014 private: 1015 void fold_byte_crc32(Register crc, Register table, Register val, Register tmp); 1016 void fold_8bit_crc32(Register crc, Register table, Register tmp); 1017 void update_byte_crc32( Register crc, Register val, Register table); 1018 void update_byteLoop_crc32(Register crc, Register buf, Register len, Register table, 1019 Register data); 1020 void update_1word_crc32(Register crc, Register buf, Register table, int bufDisp, int bufInc, 1021 Register t0, Register t1, Register t2, Register t3); 1022 public: 1023 void kernel_crc32_singleByteReg(Register crc, Register val, Register table, 1024 bool invertCRC); 1025 void kernel_crc32_singleByte(Register crc, Register buf, Register len, Register table, Register tmp, 1026 bool invertCRC); 1027 void kernel_crc32_1byte(Register crc, Register buf, Register len, Register table, 1028 Register t0, Register t1, Register t2, Register t3, 1029 bool invertCRC); 1030 void kernel_crc32_1word(Register crc, Register buf, Register len, Register table, 1031 Register t0, Register t1, Register t2, Register t3, 1032 bool invertCRC); 1033 void kernel_crc32_2word(Register crc, Register buf, Register len, Register table, 1034 Register t0, Register t1, Register t2, Register t3, 1035 bool invertCRC); 1036 1037 // Emitters for BigInteger.multiplyToLen intrinsic 1038 // note: length of result array (zlen) is passed on the stack 1039 private: 1040 void add2_with_carry(Register dest_hi, Register dest_lo, 1041 Register src1, Register src2); 1042 void multiply_64_x_64_loop(Register x, Register xstart, 1043 Register x_xstart, 1044 Register y, Register y_idx, Register z, 1045 Register carry, Register product, 1046 Register idx, Register kdx); 1047 void multiply_add_128_x_128(Register x_xstart, Register y, Register z, 1048 Register yz_idx, Register idx, 1049 Register carry, Register product, int offset); 1050 void multiply_128_x_128_loop(Register x_xstart, 1051 Register y, Register z, 1052 Register yz_idx, Register idx, 1053 Register jdx, 1054 Register carry, Register product, 1055 Register carry2); |