1 /*
2 * Copyright (c) 2002, 2015, Oracle and/or its affiliates. All rights reserved.
3 * Copyright (c) 2012, 2015 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 *
662 static bool is_trap_range_check_le(int x) {
663 return is_twi(x, traptoEqual | traptoLessThanUnsigned, -1/*any reg*/);
664 }
665 inline void trap_range_check_g(Register a, int si16);
666 static bool is_trap_range_check_g(int x) {
667 return is_twi(x, traptoGreaterThanUnsigned, -1/*any reg*/);
668 }
669 inline void trap_range_check_ge(Register a, Register b);
670 inline void trap_range_check_ge(Register a, int si16);
671 static bool is_trap_range_check_ge(int x) {
672 return (is_tw (x, traptoEqual | traptoGreaterThanUnsigned, -1/*any reg*/, -1/*any reg*/) ||
673 is_twi(x, traptoEqual | traptoGreaterThanUnsigned, -1/*any reg*/) );
674 }
675 static bool is_trap_range_check(int x) {
676 return is_trap_range_check_l(x) || is_trap_range_check_le(x) ||
677 is_trap_range_check_g(x) || is_trap_range_check_ge(x);
678 }
679
680 void clear_memory_doubleword(Register base_ptr, Register cnt_dwords, Register tmp = R0);
681
682 // Needle of length 1.
683 void string_indexof_1(Register result, Register haystack, Register haycnt,
684 Register needle, jchar needleChar,
685 Register tmp1, Register tmp2);
686 // General indexof, eventually with constant needle length.
687 void string_indexof(Register result, Register haystack, Register haycnt,
688 Register needle, ciTypeArray* needle_values, Register needlecnt, int needlecntval,
689 Register tmp1, Register tmp2, Register tmp3, Register tmp4);
690 void string_compare(Register str1_reg, Register str2_reg, Register cnt1_reg, Register cnt2_reg,
691 Register result_reg, Register tmp_reg);
692 void char_arrays_equals(Register str1_reg, Register str2_reg, Register cnt_reg, Register result_reg,
693 Register tmp1_reg, Register tmp2_reg, Register tmp3_reg, Register tmp4_reg,
694 Register tmp5_reg);
695 void char_arrays_equalsImm(Register str1_reg, Register str2_reg, int cntval, Register result_reg,
696 Register tmp1_reg, Register tmp2_reg);
697
698 // Emitters for BigInteger.multiplyToLen intrinsic.
699 inline void multiply64(Register dest_hi, Register dest_lo,
700 Register x, Register y);
701 void add2_with_carry(Register dest_hi, Register dest_lo,
702 Register src1, Register src2);
703 void multiply_64_x_64_loop(Register x, Register xstart, Register x_xstart,
704 Register y, Register y_idx, Register z,
705 Register carry, Register product_high, Register product,
706 Register idx, Register kdx, Register tmp);
707 void multiply_add_128_x_128(Register x_xstart, Register y, Register z,
708 Register yz_idx, Register idx, Register carry,
709 Register product_high, Register product, Register tmp,
710 int offset);
711 void multiply_128_x_128_loop(Register x_xstart,
712 Register y, Register z,
713 Register yz_idx, Register idx, Register carry,
714 Register product_high, Register product,
715 Register carry2, Register tmp);
716 void multiply_to_len(Register x, Register xlen,
|
1 /*
2 * Copyright (c) 2002, 2016, Oracle and/or its affiliates. All rights reserved.
3 * Copyright (c) 2012, 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 *
662 static bool is_trap_range_check_le(int x) {
663 return is_twi(x, traptoEqual | traptoLessThanUnsigned, -1/*any reg*/);
664 }
665 inline void trap_range_check_g(Register a, int si16);
666 static bool is_trap_range_check_g(int x) {
667 return is_twi(x, traptoGreaterThanUnsigned, -1/*any reg*/);
668 }
669 inline void trap_range_check_ge(Register a, Register b);
670 inline void trap_range_check_ge(Register a, int si16);
671 static bool is_trap_range_check_ge(int x) {
672 return (is_tw (x, traptoEqual | traptoGreaterThanUnsigned, -1/*any reg*/, -1/*any reg*/) ||
673 is_twi(x, traptoEqual | traptoGreaterThanUnsigned, -1/*any reg*/) );
674 }
675 static bool is_trap_range_check(int x) {
676 return is_trap_range_check_l(x) || is_trap_range_check_le(x) ||
677 is_trap_range_check_g(x) || is_trap_range_check_ge(x);
678 }
679
680 void clear_memory_doubleword(Register base_ptr, Register cnt_dwords, Register tmp = R0);
681
682 #ifdef COMPILER2
683 // Intrinsics for CompactStrings
684 // Compress char[] to byte[] by compressing 16 bytes at once.
685 void string_compress_16(Register src, Register dst, Register cnt,
686 Register tmp1, Register tmp2, Register tmp3, Register tmp4, Register tmp5,
687 Label& Lfailure);
688
689 // Compress char[] to byte[]. cnt must be positive int.
690 void string_compress(Register src, Register dst, Register cnt, Register tmp, Label& Lfailure);
691
692 // Inflate byte[] to char[] by inflating 16 bytes at once.
693 void string_inflate_16(Register src, Register dst, Register cnt,
694 Register tmp1, Register tmp2, Register tmp3, Register tmp4, Register tmp5);
695
696 // Inflate byte[] to char[]. cnt must be positive int.
697 void string_inflate(Register src, Register dst, Register cnt, Register tmp);
698
699 void string_compare(Register str1, Register str2, Register cnt1, Register cnt2,
700 Register tmp1, Register result, int ae);
701
702 void array_equals(bool is_array_equ, Register ary1, Register ary2,
703 Register limit, Register tmp1, Register result, bool is_byte);
704
705 void string_indexof(Register result, Register haystack, Register haycnt,
706 Register needle, ciTypeArray* needle_values, Register needlecnt, int needlecntval,
707 Register tmp1, Register tmp2, Register tmp3, Register tmp4, int ae);
708
709 void string_indexof_char(Register result, Register haystack, Register haycnt,
710 Register needle, jchar needleChar, Register tmp1, Register tmp2, bool is_byte);
711
712 void has_negatives(Register src, Register cnt, Register result, Register tmp1, Register tmp2);
713
714 // Intrinsics for non-CompactStrings
715 // Needle of length 1.
716 void string_indexof_1(Register result, Register haystack, Register haycnt,
717 Register needle, jchar needleChar,
718 Register tmp1, Register tmp2);
719 // General indexof, eventually with constant needle length.
720 void string_indexof(Register result, Register haystack, Register haycnt,
721 Register needle, ciTypeArray* needle_values, Register needlecnt, int needlecntval,
722 Register tmp1, Register tmp2, Register tmp3, Register tmp4);
723 void string_compare(Register str1_reg, Register str2_reg, Register cnt1_reg, Register cnt2_reg,
724 Register result_reg, Register tmp_reg);
725 void char_arrays_equals(Register str1_reg, Register str2_reg, Register cnt_reg, Register result_reg,
726 Register tmp1_reg, Register tmp2_reg, Register tmp3_reg, Register tmp4_reg,
727 Register tmp5_reg);
728 void char_arrays_equalsImm(Register str1_reg, Register str2_reg, int cntval, Register result_reg,
729 Register tmp1_reg, Register tmp2_reg);
730 #endif
731
732 // Emitters for BigInteger.multiplyToLen intrinsic.
733 inline void multiply64(Register dest_hi, Register dest_lo,
734 Register x, Register y);
735 void add2_with_carry(Register dest_hi, Register dest_lo,
736 Register src1, Register src2);
737 void multiply_64_x_64_loop(Register x, Register xstart, Register x_xstart,
738 Register y, Register y_idx, Register z,
739 Register carry, Register product_high, Register product,
740 Register idx, Register kdx, Register tmp);
741 void multiply_add_128_x_128(Register x_xstart, Register y, Register z,
742 Register yz_idx, Register idx, Register carry,
743 Register product_high, Register product, Register tmp,
744 int offset);
745 void multiply_128_x_128_loop(Register x_xstart,
746 Register y, Register z,
747 Register yz_idx, Register idx, Register carry,
748 Register product_high, Register product,
749 Register carry2, Register tmp);
750 void multiply_to_len(Register x, Register xlen,
|