< prev index next >

src/hotspot/cpu/ppc/templateInterpreterGenerator_ppc.cpp

Print this page
rev 53130 : 8216060: [PPC64] Vector CRC implementation should be used by interpreter and be faster for short arrays
Reviewed-by: gromero


1909       __ lwa( dataLen, 1*wordSize, argP);  // #bytes to process
1910       __ lwz( crc,     5*wordSize, argP);  // current crc state
1911       __ add( data, data, tmp);            // Add byte buffer offset.
1912     } else {                                                         // Used for "updateBytes update".
1913       BLOCK_COMMENT("CRC32_updateBytes {");
1914       // crc     @ (SP + 4W) (32bit)
1915       // buf     @ (SP + 3W) (64bit ptr to byte array)
1916       // off     @ (SP + 2W) (32bit)
1917       // dataLen @ (SP + 1W) (32bit)
1918       // data = buf + off + base_offset
1919       __ ld(  data,    3*wordSize, argP);  // start of byte buffer
1920       __ lwa( tmp,     2*wordSize, argP);  // byte buffer offset
1921       __ lwa( dataLen, 1*wordSize, argP);  // #bytes to process
1922       __ add( data, data, tmp);            // add byte buffer offset
1923       __ lwz( crc,     4*wordSize, argP);  // current crc state
1924       __ addi(data, data, arrayOopDesc::base_offset_in_bytes(T_BYTE));
1925     }
1926 
1927     StubRoutines::ppc64::generate_load_crc_table_addr(_masm, table);
1928 
1929     // Performance measurements show the 1word and 2word variants to be almost equivalent,
1930     // with very light advantages for the 1word variant. We chose the 1word variant for
1931     // code compactness.
1932     __ kernel_crc32_1word(crc, data, dataLen, table, t0, t1, t2, t3, tc0, tc1, tc2, tc3, true);




1933 
1934     // Restore caller sp for c2i case and return.
1935     __ mr(R1_SP, R21_sender_SP); // Cut the stack back to where the caller started.
1936     __ blr();
1937 
1938     // Generate a vanilla native entry as the slow path.
1939     BLOCK_COMMENT("} CRC32_updateBytes(Buffer)");
1940     BIND(slow_path);
1941     __ jump_to_entry(Interpreter::entry_for_kind(Interpreter::native), R11_scratch1);
1942     return start;
1943   }
1944 
1945   return NULL;
1946 }
1947 
1948 
1949 /**
1950  * Method entry for intrinsic-candidate (non-native) methods:
1951  *   int java.util.zip.CRC32C.updateBytes(           int crc, byte[] b,  int off, int end)
1952  *   int java.util.zip.CRC32C.updateDirectByteBuffer(int crc, long* buf, int off, int end)


1997       __ add( data, data, tmp);            // Add byte buffer offset.
1998       __ sub( dataLen, dataLen, tmp);      // (end_index - offset)
1999     } else {                                                         // Used for "updateBytes update".
2000       BLOCK_COMMENT("CRC32C_updateBytes {");
2001       // crc     @ (SP + 4W) (32bit)
2002       // buf     @ (SP + 3W) (64bit ptr to byte array)
2003       // off     @ (SP + 2W) (32bit)
2004       // dataLen @ (SP + 1W) (32bit)
2005       // data = buf + off + base_offset
2006       __ ld(  data,    3*wordSize, argP);  // start of byte buffer
2007       __ lwa( tmp,     2*wordSize, argP);  // byte buffer offset
2008       __ lwa( dataLen, 1*wordSize, argP);  // #bytes to process
2009       __ add( data, data, tmp);            // add byte buffer offset
2010       __ sub( dataLen, dataLen, tmp);      // (end_index - offset)
2011       __ lwz( crc,     4*wordSize, argP);  // current crc state
2012       __ addi(data, data, arrayOopDesc::base_offset_in_bytes(T_BYTE));
2013     }
2014 
2015     StubRoutines::ppc64::generate_load_crc32c_table_addr(_masm, table);
2016 
2017     // Performance measurements show the 1word and 2word variants to be almost equivalent,
2018     // with very light advantages for the 1word variant. We chose the 1word variant for
2019     // code compactness.
2020     __ kernel_crc32_1word(crc, data, dataLen, table, t0, t1, t2, t3, tc0, tc1, tc2, tc3, false);




2021 
2022     // Restore caller sp for c2i case and return.
2023     __ mr(R1_SP, R21_sender_SP); // Cut the stack back to where the caller started.
2024     __ blr();
2025 
2026     BLOCK_COMMENT("} CRC32C_update{Bytes|DirectByteBuffer}");
2027     return start;
2028   }
2029 
2030   return NULL;
2031 }
2032 
2033 // =============================================================================
2034 // Exceptions
2035 
2036 void TemplateInterpreterGenerator::generate_throw_exception() {
2037   Register Rexception    = R17_tos,
2038            Rcontinuation = R3_RET;
2039 
2040   // --------------------------------------------------------------------------




1909       __ lwa( dataLen, 1*wordSize, argP);  // #bytes to process
1910       __ lwz( crc,     5*wordSize, argP);  // current crc state
1911       __ add( data, data, tmp);            // Add byte buffer offset.
1912     } else {                                                         // Used for "updateBytes update".
1913       BLOCK_COMMENT("CRC32_updateBytes {");
1914       // crc     @ (SP + 4W) (32bit)
1915       // buf     @ (SP + 3W) (64bit ptr to byte array)
1916       // off     @ (SP + 2W) (32bit)
1917       // dataLen @ (SP + 1W) (32bit)
1918       // data = buf + off + base_offset
1919       __ ld(  data,    3*wordSize, argP);  // start of byte buffer
1920       __ lwa( tmp,     2*wordSize, argP);  // byte buffer offset
1921       __ lwa( dataLen, 1*wordSize, argP);  // #bytes to process
1922       __ add( data, data, tmp);            // add byte buffer offset
1923       __ lwz( crc,     4*wordSize, argP);  // current crc state
1924       __ addi(data, data, arrayOopDesc::base_offset_in_bytes(T_BYTE));
1925     }
1926 
1927     StubRoutines::ppc64::generate_load_crc_table_addr(_masm, table);
1928 
1929     if (!VM_Version::has_vpmsumb()) {


1930       __ kernel_crc32_1word(crc, data, dataLen, table, t0, t1, t2, t3, tc0, tc1, tc2, tc3, true);
1931     } else {
1932       StubRoutines::ppc64::generate_load_crc_constants_addr(_masm, t0);
1933       __ kernel_crc32_vpmsum(crc, data, dataLen, table, t0, t1, t2, t3, tc0, tc1, tc2, true);
1934     }
1935 
1936     // Restore caller sp for c2i case and return.
1937     __ mr(R1_SP, R21_sender_SP); // Cut the stack back to where the caller started.
1938     __ blr();
1939 
1940     // Generate a vanilla native entry as the slow path.
1941     BLOCK_COMMENT("} CRC32_updateBytes(Buffer)");
1942     BIND(slow_path);
1943     __ jump_to_entry(Interpreter::entry_for_kind(Interpreter::native), R11_scratch1);
1944     return start;
1945   }
1946 
1947   return NULL;
1948 }
1949 
1950 
1951 /**
1952  * Method entry for intrinsic-candidate (non-native) methods:
1953  *   int java.util.zip.CRC32C.updateBytes(           int crc, byte[] b,  int off, int end)
1954  *   int java.util.zip.CRC32C.updateDirectByteBuffer(int crc, long* buf, int off, int end)


1999       __ add( data, data, tmp);            // Add byte buffer offset.
2000       __ sub( dataLen, dataLen, tmp);      // (end_index - offset)
2001     } else {                                                         // Used for "updateBytes update".
2002       BLOCK_COMMENT("CRC32C_updateBytes {");
2003       // crc     @ (SP + 4W) (32bit)
2004       // buf     @ (SP + 3W) (64bit ptr to byte array)
2005       // off     @ (SP + 2W) (32bit)
2006       // dataLen @ (SP + 1W) (32bit)
2007       // data = buf + off + base_offset
2008       __ ld(  data,    3*wordSize, argP);  // start of byte buffer
2009       __ lwa( tmp,     2*wordSize, argP);  // byte buffer offset
2010       __ lwa( dataLen, 1*wordSize, argP);  // #bytes to process
2011       __ add( data, data, tmp);            // add byte buffer offset
2012       __ sub( dataLen, dataLen, tmp);      // (end_index - offset)
2013       __ lwz( crc,     4*wordSize, argP);  // current crc state
2014       __ addi(data, data, arrayOopDesc::base_offset_in_bytes(T_BYTE));
2015     }
2016 
2017     StubRoutines::ppc64::generate_load_crc32c_table_addr(_masm, table);
2018 
2019     if (!VM_Version::has_vpmsumb()) {


2020       __ kernel_crc32_1word(crc, data, dataLen, table, t0, t1, t2, t3, tc0, tc1, tc2, tc3, false);
2021     } else {
2022       StubRoutines::ppc64::generate_load_crc32c_constants_addr(_masm, t0);
2023       __ kernel_crc32_vpmsum(crc, data, dataLen, table, t0, t1, t2, t3, tc0, tc1, tc2, false);
2024     }
2025 
2026     // Restore caller sp for c2i case and return.
2027     __ mr(R1_SP, R21_sender_SP); // Cut the stack back to where the caller started.
2028     __ blr();
2029 
2030     BLOCK_COMMENT("} CRC32C_update{Bytes|DirectByteBuffer}");
2031     return start;
2032   }
2033 
2034   return NULL;
2035 }
2036 
2037 // =============================================================================
2038 // Exceptions
2039 
2040 void TemplateInterpreterGenerator::generate_throw_exception() {
2041   Register Rexception    = R17_tos,
2042            Rcontinuation = R3_RET;
2043 
2044   // --------------------------------------------------------------------------


< prev index next >