1840 Register length = op->length()->as_register();
1841 Register tmp = op->tmp()->as_register();
1842 Register tmp2 = R0;
1843
1844 int flags = op->flags();
1845 ciArrayKlass* default_type = op->expected_type();
1846 BasicType basic_type = default_type != NULL ? default_type->element_type()->basic_type() : T_ILLEGAL;
1847 if (basic_type == T_ARRAY) basic_type = T_OBJECT;
1848
1849 // Set up the arraycopy stub information.
1850 ArrayCopyStub* stub = op->stub();
1851 const int frame_resize = frame::abi_reg_args_size - sizeof(frame::jit_abi); // C calls need larger frame.
1852
1853 // Always do stub if no type information is available. It's ok if
1854 // the known type isn't loaded since the code sanity checks
1855 // in debug mode and the type isn't required when we know the exact type
1856 // also check that the type is an array type.
1857 if (op->expected_type() == NULL) {
1858 assert(src->is_nonvolatile() && src_pos->is_nonvolatile() && dst->is_nonvolatile() && dst_pos->is_nonvolatile() &&
1859 length->is_nonvolatile(), "must preserve");
1860 // 3 parms are int. Convert to long.
1861 __ mr(R3_ARG1, src);
1862 __ extsw(R4_ARG2, src_pos);
1863 __ mr(R5_ARG3, dst);
1864 __ extsw(R6_ARG4, dst_pos);
1865 __ extsw(R7_ARG5, length);
1866 address copyfunc_addr = StubRoutines::generic_arraycopy();
1867
1868 if (copyfunc_addr == NULL) { // Use C version if stub was not generated.
1869 address entry = CAST_FROM_FN_PTR(address, Runtime1::arraycopy);
1870 __ call_c_with_frame_resize(entry, frame_resize);
1871 } else {
1872 #ifndef PRODUCT
1873 if (PrintC1Statistics) {
1874 address counter = (address)&Runtime1::_generic_arraycopystub_cnt;
1875 int simm16_offs = __ load_const_optimized(tmp, counter, tmp2, true);
1876 __ lwz(R11_scratch1, simm16_offs, tmp);
1877 __ addi(R11_scratch1, R11_scratch1, 1);
1878 __ stw(R11_scratch1, simm16_offs, tmp);
1879 }
1880 #endif
1881 __ call_c_with_frame_resize(copyfunc_addr, /*stub does not need resized frame*/ 0);
1882
1883 __ nand(tmp, R3_RET, R3_RET);
1884 __ subf(length, tmp, length);
1885 __ add(src_pos, tmp, src_pos);
1886 __ add(dst_pos, tmp, dst_pos);
1887 }
1888
1889 __ cmpwi(CCR0, R3_RET, 0);
1890 __ bc_far_optimized(Assembler::bcondCRbiIs1, __ bi0(CCR0, Assembler::less), *stub->entry());
1891 __ bind(*stub->continuation());
1892 return;
1893 }
1894
1895 assert(default_type != NULL && default_type->is_array_klass(), "must be true at this point");
1896 Label cont, slow, copyfunc;
1897
1898 bool simple_check_flag_set = flags & (LIR_OpArrayCopy::src_null_check |
1899 LIR_OpArrayCopy::dst_null_check |
1900 LIR_OpArrayCopy::src_pos_positive_check |
1901 LIR_OpArrayCopy::dst_pos_positive_check |
1902 LIR_OpArrayCopy::length_positive_check);
1903
1904 // Use only one conditional branch for simple checks.
1905 if (simple_check_flag_set) {
1906 ConditionRegister combined_check = CCR1, tmp_check = CCR1;
|
1840 Register length = op->length()->as_register();
1841 Register tmp = op->tmp()->as_register();
1842 Register tmp2 = R0;
1843
1844 int flags = op->flags();
1845 ciArrayKlass* default_type = op->expected_type();
1846 BasicType basic_type = default_type != NULL ? default_type->element_type()->basic_type() : T_ILLEGAL;
1847 if (basic_type == T_ARRAY) basic_type = T_OBJECT;
1848
1849 // Set up the arraycopy stub information.
1850 ArrayCopyStub* stub = op->stub();
1851 const int frame_resize = frame::abi_reg_args_size - sizeof(frame::jit_abi); // C calls need larger frame.
1852
1853 // Always do stub if no type information is available. It's ok if
1854 // the known type isn't loaded since the code sanity checks
1855 // in debug mode and the type isn't required when we know the exact type
1856 // also check that the type is an array type.
1857 if (op->expected_type() == NULL) {
1858 assert(src->is_nonvolatile() && src_pos->is_nonvolatile() && dst->is_nonvolatile() && dst_pos->is_nonvolatile() &&
1859 length->is_nonvolatile(), "must preserve");
1860 address copyfunc_addr = StubRoutines::generic_arraycopy();
1861 assert(copyfunc_addr != NULL, "generic arraycopy stub required");
1862
1863 // 3 parms are int. Convert to long.
1864 __ mr(R3_ARG1, src);
1865 __ extsw(R4_ARG2, src_pos);
1866 __ mr(R5_ARG3, dst);
1867 __ extsw(R6_ARG4, dst_pos);
1868 __ extsw(R7_ARG5, length);
1869
1870 #ifndef PRODUCT
1871 if (PrintC1Statistics) {
1872 address counter = (address)&Runtime1::_generic_arraycopystub_cnt;
1873 int simm16_offs = __ load_const_optimized(tmp, counter, tmp2, true);
1874 __ lwz(R11_scratch1, simm16_offs, tmp);
1875 __ addi(R11_scratch1, R11_scratch1, 1);
1876 __ stw(R11_scratch1, simm16_offs, tmp);
1877 }
1878 #endif
1879 __ call_c_with_frame_resize(copyfunc_addr, /*stub does not need resized frame*/ 0);
1880
1881 __ nand(tmp, R3_RET, R3_RET);
1882 __ subf(length, tmp, length);
1883 __ add(src_pos, tmp, src_pos);
1884 __ add(dst_pos, tmp, dst_pos);
1885
1886 __ cmpwi(CCR0, R3_RET, 0);
1887 __ bc_far_optimized(Assembler::bcondCRbiIs1, __ bi0(CCR0, Assembler::less), *stub->entry());
1888 __ bind(*stub->continuation());
1889 return;
1890 }
1891
1892 assert(default_type != NULL && default_type->is_array_klass(), "must be true at this point");
1893 Label cont, slow, copyfunc;
1894
1895 bool simple_check_flag_set = flags & (LIR_OpArrayCopy::src_null_check |
1896 LIR_OpArrayCopy::dst_null_check |
1897 LIR_OpArrayCopy::src_pos_positive_check |
1898 LIR_OpArrayCopy::dst_pos_positive_check |
1899 LIR_OpArrayCopy::length_positive_check);
1900
1901 // Use only one conditional branch for simple checks.
1902 if (simple_check_flag_set) {
1903 ConditionRegister combined_check = CCR1, tmp_check = CCR1;
|