1893 BasicType basic_type = default_type != NULL ? default_type->element_type()->basic_type() : T_ILLEGAL; |
1893 BasicType basic_type = default_type != NULL ? default_type->element_type()->basic_type() : T_ILLEGAL; |
1894 if (basic_type == T_ARRAY) basic_type = T_OBJECT; |
1894 if (basic_type == T_ARRAY) basic_type = T_OBJECT; |
1895 |
1895 |
1896 // If we don't know anything, just go through the generic arraycopy. |
1896 // If we don't know anything, just go through the generic arraycopy. |
1897 if (default_type == NULL) { |
1897 if (default_type == NULL) { |
|
1898 address copyfunc_addr = StubRoutines::generic_arraycopy(); |
|
1899 |
|
1900 if (copyfunc_addr == NULL) { |
|
1901 // Take a slow path for generic arraycopy. |
|
1902 __ branch_optimized(Assembler::bcondAlways, *stub->entry()); |
|
1903 __ bind(*stub->continuation()); |
|
1904 return; |
|
1905 } |
|
1906 |
1898 Label done; |
1907 Label done; |
1899 // Save outgoing arguments in callee saved registers (C convention) in case |
1908 // Save outgoing arguments in callee saved registers (C convention) in case |
1900 // a call to System.arraycopy is needed. |
1909 // a call to System.arraycopy is needed. |
1901 Register callee_saved_src = Z_R10; |
1910 Register callee_saved_src = Z_R10; |
1902 Register callee_saved_src_pos = Z_R11; |
1911 Register callee_saved_src_pos = Z_R11; |
1913 // C function requires 64 bit values. |
1922 // C function requires 64 bit values. |
1914 __ z_lgfr(src_pos, src_pos); |
1923 __ z_lgfr(src_pos, src_pos); |
1915 __ z_lgfr(dst_pos, dst_pos); |
1924 __ z_lgfr(dst_pos, dst_pos); |
1916 __ z_lgfr(length, length); |
1925 __ z_lgfr(length, length); |
1917 |
1926 |
1918 address C_entry = CAST_FROM_FN_PTR(address, Runtime1::arraycopy); |
|
1919 |
|
1920 address copyfunc_addr = StubRoutines::generic_arraycopy(); |
|
1921 |
|
1922 // Pass arguments: may push as this is not a safepoint; SP must be fix at each safepoint. |
1927 // Pass arguments: may push as this is not a safepoint; SP must be fix at each safepoint. |
1923 |
1928 |
1924 // The arguments are in the corresponding registers. |
1929 // The arguments are in the corresponding registers. |
1925 assert(Z_ARG1 == src, "assumption"); |
1930 assert(Z_ARG1 == src, "assumption"); |
1926 assert(Z_ARG2 == src_pos, "assumption"); |
1931 assert(Z_ARG2 == src_pos, "assumption"); |
1927 assert(Z_ARG3 == dst, "assumption"); |
1932 assert(Z_ARG3 == dst, "assumption"); |
1928 assert(Z_ARG4 == dst_pos, "assumption"); |
1933 assert(Z_ARG4 == dst_pos, "assumption"); |
1929 assert(Z_ARG5 == length, "assumption"); |
1934 assert(Z_ARG5 == length, "assumption"); |
1930 if (copyfunc_addr == NULL) { // Use C version if stub was not generated. |
|
1931 emit_call_c(C_entry); |
|
1932 } else { |
|
1933 #ifndef PRODUCT |
1935 #ifndef PRODUCT |
1934 if (PrintC1Statistics) { |
1936 if (PrintC1Statistics) { |
1935 __ load_const_optimized(Z_R1_scratch, (address)&Runtime1::_generic_arraycopystub_cnt); |
1937 __ load_const_optimized(Z_R1_scratch, (address)&Runtime1::_generic_arraycopystub_cnt); |
1936 __ add2mem_32(Address(Z_R1_scratch), 1, Z_R0_scratch); |
1938 __ add2mem_32(Address(Z_R1_scratch), 1, Z_R0_scratch); |
1937 } |
1939 } |
1938 #endif |
1940 #endif |
1939 emit_call_c(copyfunc_addr); |
1941 emit_call_c(copyfunc_addr); |
1940 } |
|
1941 CHECK_BAILOUT(); |
1942 CHECK_BAILOUT(); |
1942 |
1943 |
1943 __ compare32_and_branch(Z_RET, (intptr_t)0, Assembler::bcondEqual, *stub->continuation()); |
1944 __ compare32_and_branch(Z_RET, (intptr_t)0, Assembler::bcondEqual, *stub->continuation()); |
1944 |
1945 |
1945 if (copyfunc_addr != NULL) { |
1946 __ z_lgr(tmp, Z_RET); |
1946 __ z_lgr(tmp, Z_RET); |
1947 __ z_xilf(tmp, -1); |
1947 __ z_xilf(tmp, -1); |
|
1948 } |
|
1949 |
1948 |
1950 // Restore values from callee saved registers so they are where the stub |
1949 // Restore values from callee saved registers so they are where the stub |
1951 // expects them. |
1950 // expects them. |
1952 __ lgr_if_needed(src, callee_saved_src); |
1951 __ lgr_if_needed(src, callee_saved_src); |
1953 __ lgr_if_needed(src_pos, callee_saved_src_pos); |
1952 __ lgr_if_needed(src_pos, callee_saved_src_pos); |
1954 __ lgr_if_needed(dst, callee_saved_dst); |
1953 __ lgr_if_needed(dst, callee_saved_dst); |
1955 __ lgr_if_needed(dst_pos, callee_saved_dst_pos); |
1954 __ lgr_if_needed(dst_pos, callee_saved_dst_pos); |
1956 __ lgr_if_needed(length, callee_saved_length); |
1955 __ lgr_if_needed(length, callee_saved_length); |
1957 |
1956 |
1958 if (copyfunc_addr != NULL) { |
1957 __ z_sr(length, tmp); |
1959 __ z_sr(length, tmp); |
1958 __ z_ar(src_pos, tmp); |
1960 __ z_ar(src_pos, tmp); |
1959 __ z_ar(dst_pos, tmp); |
1961 __ z_ar(dst_pos, tmp); |
|
1962 } |
|
1963 __ branch_optimized(Assembler::bcondAlways, *stub->entry()); |
1960 __ branch_optimized(Assembler::bcondAlways, *stub->entry()); |
1964 |
1961 |
1965 __ bind(*stub->continuation()); |
1962 __ bind(*stub->continuation()); |
1966 return; |
1963 return; |
1967 } |
1964 } |