1916 if (inc_counter) { 1917 if (ProfileInterpreter) { 1918 // We have decided to profile this method in the interpreter. 1919 __ bind(profile_method); 1920 1921 __ call_VM(noreg, CAST_FROM_FN_PTR(address, InterpreterRuntime::profile_method)); 1922 __ set_method_data_pointer_for_bcp(); 1923 __ z_bru(profile_method_continue); 1924 } 1925 1926 // Handle invocation counter overflow. 1927 __ bind(invocation_counter_overflow); 1928 generate_counter_overflow(Lcontinue); 1929 } 1930 1931 BLOCK_COMMENT("} normal_entry"); 1932 1933 return entry_point; 1934 } 1935 1936 // Method entry for static native methods: 1937 // int java.util.zip.CRC32.update(int crc, int b) 1938 address TemplateInterpreterGenerator::generate_CRC32_update_entry() { 1939 1940 if (UseCRC32Intrinsics) { 1941 uint64_t entry_off = __ offset(); 1942 Label slow_path; 1943 1944 // If we need a safepoint check, generate full interpreter entry. 1945 __ generate_safepoint_check(slow_path, Z_R1, false); 1946 1947 BLOCK_COMMENT("CRC32_update {"); 1948 1949 // We don't generate local frame and don't align stack because 1950 // we not even call stub code (we generate the code inline) 1951 // and there is no safepoint on this path. 1952 1953 // Load java parameters. 1954 // Z_esp is callers operand stack pointer, i.e. it points to the parameters. 1955 const Register argP = Z_esp; 1956 const Register crc = Z_ARG1; // crc value 1957 const Register data = Z_ARG2; // address of java byte value (kernel_crc32 needs address) 1966 StubRoutines::zarch::generate_load_crc_table_addr(_masm, table); 1967 __ kernel_crc32_singleByte(crc, data, dataLen, table, Z_R1, true); 1968 1969 // Restore caller sp for c2i case. 1970 __ resize_frame_absolute(Z_R10, Z_R0, true); // Cut the stack back to where the caller started. 1971 1972 __ z_br(Z_R14); 1973 1974 BLOCK_COMMENT("} CRC32_update"); 1975 1976 // Use a previously generated vanilla native entry as the slow path. 1977 BIND(slow_path); 1978 __ jump_to_entry(Interpreter::entry_for_kind(Interpreter::native), Z_R1); 1979 return __ addr_at(entry_off); 1980 } 1981 1982 return NULL; 1983 } 1984 1985 1986 // Method entry for static native methods: 1987 // int java.util.zip.CRC32.updateBytes(int crc, byte[] b, int off, int len) 1988 // int java.util.zip.CRC32.updateByteBuffer(int crc, long buf, int off, int len) 1989 address TemplateInterpreterGenerator::generate_CRC32_updateBytes_entry(AbstractInterpreter::MethodKind kind) { 1990 1991 if (UseCRC32Intrinsics) { 1992 uint64_t entry_off = __ offset(); 1993 Label slow_path; 1994 1995 // If we need a safepoint check, generate full interpreter entry. 1996 __ generate_safepoint_check(slow_path, Z_R1, false); 1997 1998 // We don't generate local frame and don't align stack because 1999 // we call stub code and there is no safepoint on this path. 2000 2001 // Load parameters. 2002 // Z_esp is callers operand stack pointer, i.e. it points to the parameters. 2003 const Register argP = Z_esp; 2004 const Register crc = Z_ARG1; // crc value 2005 const Register data = Z_ARG2; // address of java byte array 2006 const Register dataLen = Z_ARG3; // source data len 2007 const Register table = Z_ARG4; // address of crc32 table 2008 const Register t0 = Z_R10; // work reg for kernel* emitters 2044 __ kernel_crc32_1word(crc, data, dataLen, table, t0, t1, t2, t3, true); 2045 __ z_lmg(t0, t3, 1*8, Z_SP); // Spill regs 10..13 back from stack. 2046 2047 // Restore caller sp for c2i case. 2048 __ resize_frame_absolute(Z_R10, Z_R0, true); // Cut the stack back to where the caller started. 2049 2050 __ z_br(Z_R14); 2051 2052 BLOCK_COMMENT("} CRC32_update{Bytes|ByteBuffer}"); 2053 2054 // Use a previously generated vanilla native entry as the slow path. 2055 BIND(slow_path); 2056 __ jump_to_entry(Interpreter::entry_for_kind(Interpreter::native), Z_R1); 2057 return __ addr_at(entry_off); 2058 } 2059 2060 return NULL; 2061 } 2062 2063 2064 // Method entry for static native methods: 2065 // int java.util.zip.CRC32C.updateBytes(int crc, byte[] b, int off, int len) 2066 // int java.util.zip.CRC32C.updateDirectByteBuffer(int crc, long buf, int off, int len) 2067 address TemplateInterpreterGenerator::generate_CRC32C_updateBytes_entry(AbstractInterpreter::MethodKind kind) { 2068 2069 if (UseCRC32CIntrinsics) { 2070 uint64_t entry_off = __ offset(); 2071 2072 // We don't generate local frame and don't align stack because 2073 // we call stub code and there is no safepoint on this path. 2074 2075 // Load parameters. 2076 // Z_esp is callers operand stack pointer, i.e. it points to the parameters. 2077 const Register argP = Z_esp; 2078 const Register crc = Z_ARG1; // crc value 2079 const Register data = Z_ARG2; // address of java byte array 2080 const Register dataLen = Z_ARG3; // source data len 2081 const Register table = Z_ARG4; // address of crc32 table 2082 const Register t0 = Z_R10; // work reg for kernel* emitters 2083 const Register t1 = Z_R11; // work reg for kernel* emitters 2084 const Register t2 = Z_R12; // work reg for kernel* emitters 2085 const Register t3 = Z_R13; // work reg for kernel* emitters 2086 2087 // Arguments are reversed on java expression stack. 2088 // Calculate address of start element. 2089 if (kind == Interpreter::java_util_zip_CRC32C_updateDirectByteBuffer) { // Used for "updateByteBuffer direct". 2090 // crc @ (SP + 5W) (32bit) 2091 // buf @ (SP + 3W) (64bit ptr to long array) 2092 // off @ (SP + 2W) (32bit) 2093 // dataLen @ (SP + 1W) (32bit) 2094 // data = buf + off 2095 BLOCK_COMMENT("CRC32C_updateDirectByteBuffer {"); 2096 __ z_llgf(crc, 5*wordSize, argP); // current crc state 2097 __ z_lg(data, 3*wordSize, argP); // start of byte buffer 2098 __ z_agf(data, 2*wordSize, argP); // Add byte buffer offset. 2099 __ z_lgf(dataLen, 1*wordSize, argP); // #bytes to process 2100 } else { // Used for "updateBytes update". 2101 // crc @ (SP + 4W) (32bit) 2102 // buf @ (SP + 3W) (64bit ptr to byte array) 2103 // off @ (SP + 2W) (32bit) 2104 // dataLen @ (SP + 1W) (32bit) 2105 // data = buf + off + base_offset 2106 BLOCK_COMMENT("CRC32C_updateBytes {"); 2107 __ z_llgf(crc, 4*wordSize, argP); // current crc state 2108 __ z_lg(data, 3*wordSize, argP); // start of byte buffer 2109 __ z_agf(data, 2*wordSize, argP); // Add byte buffer offset. 2110 __ z_lgf(dataLen, 1*wordSize, argP); // #bytes to process 2111 __ z_aghi(data, arrayOopDesc::base_offset_in_bytes(T_BYTE)); 2112 } 2113 2114 StubRoutines::zarch::generate_load_crc32c_table_addr(_masm, table); 2115 2116 __ resize_frame(-(6*8), Z_R0, true); // Resize frame to provide add'l space to spill 5 registers. 2117 __ z_stmg(t0, t3, 1*8, Z_SP); // Spill regs 10..13 to make them available as work registers. 2118 __ kernel_crc32_1word(crc, data, dataLen, table, t0, t1, t2, t3, false); 2119 __ z_lmg(t0, t3, 1*8, Z_SP); // Spill regs 10..13 back from stack. 2120 2121 // Restore caller sp for c2i case. 2122 __ resize_frame_absolute(Z_R10, Z_R0, true); // Cut the stack back to where the caller started. 2123 2124 __ z_br(Z_R14); 2125 2126 BLOCK_COMMENT("} CRC32C_update{Bytes|DirectByteBuffer}"); 2127 return __ addr_at(entry_off); 2128 } 2129 2130 return NULL; | 1916 if (inc_counter) { 1917 if (ProfileInterpreter) { 1918 // We have decided to profile this method in the interpreter. 1919 __ bind(profile_method); 1920 1921 __ call_VM(noreg, CAST_FROM_FN_PTR(address, InterpreterRuntime::profile_method)); 1922 __ set_method_data_pointer_for_bcp(); 1923 __ z_bru(profile_method_continue); 1924 } 1925 1926 // Handle invocation counter overflow. 1927 __ bind(invocation_counter_overflow); 1928 generate_counter_overflow(Lcontinue); 1929 } 1930 1931 BLOCK_COMMENT("} normal_entry"); 1932 1933 return entry_point; 1934 } 1935 1936 1937 /** 1938 * Method entry for static native methods: 1939 * int java.util.zip.CRC32.update(int crc, int b) 1940 */ 1941 address TemplateInterpreterGenerator::generate_CRC32_update_entry() { 1942 1943 if (UseCRC32Intrinsics) { 1944 uint64_t entry_off = __ offset(); 1945 Label slow_path; 1946 1947 // If we need a safepoint check, generate full interpreter entry. 1948 __ generate_safepoint_check(slow_path, Z_R1, false); 1949 1950 BLOCK_COMMENT("CRC32_update {"); 1951 1952 // We don't generate local frame and don't align stack because 1953 // we not even call stub code (we generate the code inline) 1954 // and there is no safepoint on this path. 1955 1956 // Load java parameters. 1957 // Z_esp is callers operand stack pointer, i.e. it points to the parameters. 1958 const Register argP = Z_esp; 1959 const Register crc = Z_ARG1; // crc value 1960 const Register data = Z_ARG2; // address of java byte value (kernel_crc32 needs address) 1969 StubRoutines::zarch::generate_load_crc_table_addr(_masm, table); 1970 __ kernel_crc32_singleByte(crc, data, dataLen, table, Z_R1, true); 1971 1972 // Restore caller sp for c2i case. 1973 __ resize_frame_absolute(Z_R10, Z_R0, true); // Cut the stack back to where the caller started. 1974 1975 __ z_br(Z_R14); 1976 1977 BLOCK_COMMENT("} CRC32_update"); 1978 1979 // Use a previously generated vanilla native entry as the slow path. 1980 BIND(slow_path); 1981 __ jump_to_entry(Interpreter::entry_for_kind(Interpreter::native), Z_R1); 1982 return __ addr_at(entry_off); 1983 } 1984 1985 return NULL; 1986 } 1987 1988 1989 /** 1990 * Method entry for static native methods: 1991 * int java.util.zip.CRC32.updateBytes( int crc, byte[] b, int off, int len) 1992 * int java.util.zip.CRC32.updateByteBuffer(int crc, long* buf, int off, int len) 1993 */ 1994 address TemplateInterpreterGenerator::generate_CRC32_updateBytes_entry(AbstractInterpreter::MethodKind kind) { 1995 1996 if (UseCRC32Intrinsics) { 1997 uint64_t entry_off = __ offset(); 1998 Label slow_path; 1999 2000 // If we need a safepoint check, generate full interpreter entry. 2001 __ generate_safepoint_check(slow_path, Z_R1, false); 2002 2003 // We don't generate local frame and don't align stack because 2004 // we call stub code and there is no safepoint on this path. 2005 2006 // Load parameters. 2007 // Z_esp is callers operand stack pointer, i.e. it points to the parameters. 2008 const Register argP = Z_esp; 2009 const Register crc = Z_ARG1; // crc value 2010 const Register data = Z_ARG2; // address of java byte array 2011 const Register dataLen = Z_ARG3; // source data len 2012 const Register table = Z_ARG4; // address of crc32 table 2013 const Register t0 = Z_R10; // work reg for kernel* emitters 2049 __ kernel_crc32_1word(crc, data, dataLen, table, t0, t1, t2, t3, true); 2050 __ z_lmg(t0, t3, 1*8, Z_SP); // Spill regs 10..13 back from stack. 2051 2052 // Restore caller sp for c2i case. 2053 __ resize_frame_absolute(Z_R10, Z_R0, true); // Cut the stack back to where the caller started. 2054 2055 __ z_br(Z_R14); 2056 2057 BLOCK_COMMENT("} CRC32_update{Bytes|ByteBuffer}"); 2058 2059 // Use a previously generated vanilla native entry as the slow path. 2060 BIND(slow_path); 2061 __ jump_to_entry(Interpreter::entry_for_kind(Interpreter::native), Z_R1); 2062 return __ addr_at(entry_off); 2063 } 2064 2065 return NULL; 2066 } 2067 2068 2069 /** 2070 * Method entry for intrinsic-candidate (non-native) methods: 2071 * int java.util.zip.CRC32C.updateBytes( int crc, byte[] b, int off, int end) 2072 * int java.util.zip.CRC32C.updateDirectByteBuffer(int crc, long* buf, int off, int end) 2073 * Unlike CRC32, CRC32C does not have any methods marked as native 2074 * CRC32C also uses an "end" variable instead of the length variable CRC32 uses 2075 */ 2076 address TemplateInterpreterGenerator::generate_CRC32C_updateBytes_entry(AbstractInterpreter::MethodKind kind) { 2077 2078 if (UseCRC32CIntrinsics) { 2079 uint64_t entry_off = __ offset(); 2080 2081 // We don't generate local frame and don't align stack because 2082 // we call stub code and there is no safepoint on this path. 2083 2084 // Load parameters. 2085 // Z_esp is callers operand stack pointer, i.e. it points to the parameters. 2086 const Register argP = Z_esp; 2087 const Register crc = Z_ARG1; // crc value 2088 const Register data = Z_ARG2; // address of java byte array 2089 const Register dataLen = Z_ARG3; // source data len 2090 const Register table = Z_ARG4; // address of crc32 table 2091 const Register t0 = Z_R10; // work reg for kernel* emitters 2092 const Register t1 = Z_R11; // work reg for kernel* emitters 2093 const Register t2 = Z_R12; // work reg for kernel* emitters 2094 const Register t3 = Z_R13; // work reg for kernel* emitters 2095 2096 // Arguments are reversed on java expression stack. 2097 // Calculate address of start element. 2098 if (kind == Interpreter::java_util_zip_CRC32C_updateDirectByteBuffer) { // Used for "updateByteBuffer direct". 2099 // crc @ (SP + 5W) (32bit) 2100 // buf @ (SP + 3W) (64bit ptr to long array) 2101 // off @ (SP + 2W) (32bit) 2102 // dataLen @ (SP + 1W) (32bit) 2103 // data = buf + off 2104 BLOCK_COMMENT("CRC32C_updateDirectByteBuffer {"); 2105 __ z_llgf(crc, 5*wordSize, argP); // current crc state 2106 __ z_lg(data, 3*wordSize, argP); // start of byte buffer 2107 __ z_agf(data, 2*wordSize, argP); // Add byte buffer offset. 2108 __ z_lgf(dataLen, 1*wordSize, argP); // #bytes to process, calculated as 2109 __ z_sgf(dataLen, Address(argP, 2*wordSize)); // (end_index - offset) 2110 } else { // Used for "updateBytes update". 2111 // crc @ (SP + 4W) (32bit) 2112 // buf @ (SP + 3W) (64bit ptr to byte array) 2113 // off @ (SP + 2W) (32bit) 2114 // dataLen @ (SP + 1W) (32bit) 2115 // data = buf + off + base_offset 2116 BLOCK_COMMENT("CRC32C_updateBytes {"); 2117 __ z_llgf(crc, 4*wordSize, argP); // current crc state 2118 __ z_lg(data, 3*wordSize, argP); // start of byte buffer 2119 __ z_agf(data, 2*wordSize, argP); // Add byte buffer offset. 2120 __ z_lgf(dataLen, 1*wordSize, argP); // #bytes to process, calculated as 2121 __ z_sgf(dataLen, Address(argP, 2*wordSize)); // (end_index - offset) 2122 __ z_aghi(data, arrayOopDesc::base_offset_in_bytes(T_BYTE)); 2123 } 2124 2125 StubRoutines::zarch::generate_load_crc32c_table_addr(_masm, table); 2126 2127 __ resize_frame(-(6*8), Z_R0, true); // Resize frame to provide add'l space to spill 5 registers. 2128 __ z_stmg(t0, t3, 1*8, Z_SP); // Spill regs 10..13 to make them available as work registers. 2129 __ kernel_crc32_1word(crc, data, dataLen, table, t0, t1, t2, t3, false); 2130 __ z_lmg(t0, t3, 1*8, Z_SP); // Spill regs 10..13 back from stack. 2131 2132 // Restore caller sp for c2i case. 2133 __ resize_frame_absolute(Z_R10, Z_R0, true); // Cut the stack back to where the caller started. 2134 2135 __ z_br(Z_R14); 2136 2137 BLOCK_COMMENT("} CRC32C_update{Bytes|DirectByteBuffer}"); 2138 return __ addr_at(entry_off); 2139 } 2140 2141 return NULL; |