1860
1861 // higher 32bits must be null
1862 __ sra(dst_pos, 0, dst_pos);
1863 __ sra(src_pos, 0, src_pos);
1864 __ sra(length, 0, length);
1865
1866 // set up the arraycopy stub information
1867 ArrayCopyStub* stub = op->stub();
1868
1869 // always do stub if no type information is available. it's ok if
1870 // the known type isn't loaded since the code sanity checks
1871 // in debug mode and the type isn't required when we know the exact type
1872 // also check that the type is an array type.
1873 if (op->expected_type() == NULL) {
1874 __ mov(src, O0);
1875 __ mov(src_pos, O1);
1876 __ mov(dst, O2);
1877 __ mov(dst_pos, O3);
1878 __ mov(length, O4);
1879 address copyfunc_addr = StubRoutines::generic_arraycopy();
1880
1881 if (copyfunc_addr == NULL) { // Use C version if stub was not generated
1882 __ call_VM_leaf(tmp, CAST_FROM_FN_PTR(address, Runtime1::arraycopy));
1883 } else {
1884 #ifndef PRODUCT
1885 if (PrintC1Statistics) {
1886 address counter = (address)&Runtime1::_generic_arraycopystub_cnt;
1887 __ inc_counter(counter, G1, G3);
1888 }
1889 #endif
1890 __ call_VM_leaf(tmp, copyfunc_addr);
1891 }
1892
1893 if (copyfunc_addr != NULL) {
1894 __ xor3(O0, -1, tmp);
1895 __ sub(length, tmp, length);
1896 __ add(src_pos, tmp, src_pos);
1897 __ cmp_zero_and_br(Assembler::less, O0, *stub->entry());
1898 __ delayed()->add(dst_pos, tmp, dst_pos);
1899 } else {
1900 __ cmp_zero_and_br(Assembler::less, O0, *stub->entry());
1901 __ delayed()->nop();
1902 }
1903 __ bind(*stub->continuation());
1904 return;
1905 }
1906
1907 assert(default_type != NULL && default_type->is_array_klass(), "must be true at this point");
1908
1909 // make sure src and dst are non-null and load array length
1910 if (flags & LIR_OpArrayCopy::src_null_check) {
1911 __ tst(src);
1912 __ brx(Assembler::equal, false, Assembler::pn, *stub->entry());
1913 __ delayed()->nop();
1914 }
1915
1916 if (flags & LIR_OpArrayCopy::dst_null_check) {
1917 __ tst(dst);
1918 __ brx(Assembler::equal, false, Assembler::pn, *stub->entry());
1919 __ delayed()->nop();
1920 }
1921
|
1860
1861 // higher 32bits must be null
1862 __ sra(dst_pos, 0, dst_pos);
1863 __ sra(src_pos, 0, src_pos);
1864 __ sra(length, 0, length);
1865
1866 // set up the arraycopy stub information
1867 ArrayCopyStub* stub = op->stub();
1868
1869 // always do stub if no type information is available. it's ok if
1870 // the known type isn't loaded since the code sanity checks
1871 // in debug mode and the type isn't required when we know the exact type
1872 // also check that the type is an array type.
1873 if (op->expected_type() == NULL) {
1874 __ mov(src, O0);
1875 __ mov(src_pos, O1);
1876 __ mov(dst, O2);
1877 __ mov(dst_pos, O3);
1878 __ mov(length, O4);
1879 address copyfunc_addr = StubRoutines::generic_arraycopy();
1880 assert(copyfunc_addr != NULL, "generic arraycopy stub required");
1881
1882 #ifndef PRODUCT
1883 if (PrintC1Statistics) {
1884 address counter = (address)&Runtime1::_generic_arraycopystub_cnt;
1885 __ inc_counter(counter, G1, G3);
1886 }
1887 #endif
1888 __ call_VM_leaf(tmp, copyfunc_addr);
1889
1890 __ xor3(O0, -1, tmp);
1891 __ sub(length, tmp, length);
1892 __ add(src_pos, tmp, src_pos);
1893 __ cmp_zero_and_br(Assembler::less, O0, *stub->entry());
1894 __ delayed()->add(dst_pos, tmp, dst_pos);
1895 __ bind(*stub->continuation());
1896 return;
1897 }
1898
1899 assert(default_type != NULL && default_type->is_array_klass(), "must be true at this point");
1900
1901 // make sure src and dst are non-null and load array length
1902 if (flags & LIR_OpArrayCopy::src_null_check) {
1903 __ tst(src);
1904 __ brx(Assembler::equal, false, Assembler::pn, *stub->entry());
1905 __ delayed()->nop();
1906 }
1907
1908 if (flags & LIR_OpArrayCopy::dst_null_check) {
1909 __ tst(dst);
1910 __ brx(Assembler::equal, false, Assembler::pn, *stub->entry());
1911 __ delayed()->nop();
1912 }
1913
|