1 /* |
1 /* |
2 * Copyright (c) 2014, 2016, Oracle and/or its affiliates. All rights reserved. |
2 * Copyright (c) 2014, 2017, Oracle and/or its affiliates. All rights reserved. |
3 * Copyright (c) 2015, 2016 SAP SE. All rights reserved. |
3 * Copyright (c) 2015, 2017, SAP SE. All rights reserved. |
4 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
4 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
5 * |
5 * |
6 * This code is free software; you can redistribute it and/or modify it |
6 * This code is free software; you can redistribute it and/or modify it |
7 * under the terms of the GNU General Public License version 2 only, as |
7 * under the terms of the GNU General Public License version 2 only, as |
8 * published by the Free Software Foundation. |
8 * published by the Free Software Foundation. |
693 #else |
687 #else |
694 __ lbz(size, in_bytes(ConstantPoolCache::base_offset() + ConstantPoolCacheEntry::flags_offset()) + 7, cache); |
688 __ lbz(size, in_bytes(ConstantPoolCache::base_offset() + ConstantPoolCacheEntry::flags_offset()) + 7, cache); |
695 #endif |
689 #endif |
696 __ sldi(size, size, Interpreter::logStackElementSize); |
690 __ sldi(size, size, Interpreter::logStackElementSize); |
697 __ add(R15_esp, R15_esp, size); |
691 __ add(R15_esp, R15_esp, size); |
|
692 |
|
693 __ check_and_handle_popframe(R11_scratch1); |
|
694 __ check_and_handle_earlyret(R11_scratch1); |
|
695 |
698 __ dispatch_next(state, step); |
696 __ dispatch_next(state, step); |
699 return entry; |
697 return entry; |
700 } |
698 } |
701 |
699 |
702 address TemplateInterpreterGenerator::generate_deopt_entry_for(TosState state, int step) { |
700 address TemplateInterpreterGenerator::generate_deopt_entry_for(TosState state, int step) { |
1895 // Being passed from java as an int, the single byte is at offset +3. |
1893 // Being passed from java as an int, the single byte is at offset +3. |
1896 #endif |
1894 #endif |
1897 __ lwz(crc, 2*wordSize, argP); // Current crc state, zero extend to 64 bit to have a clean register. |
1895 __ lwz(crc, 2*wordSize, argP); // Current crc state, zero extend to 64 bit to have a clean register. |
1898 |
1896 |
1899 StubRoutines::ppc64::generate_load_crc_table_addr(_masm, table); |
1897 StubRoutines::ppc64::generate_load_crc_table_addr(_masm, table); |
1900 __ kernel_crc32_singleByte(crc, data, dataLen, table, tmp); |
1898 __ kernel_crc32_singleByte(crc, data, dataLen, table, tmp, true); |
1901 |
1899 |
1902 // Restore caller sp for c2i case and return. |
1900 // Restore caller sp for c2i case and return. |
1903 __ mr(R1_SP, R21_sender_SP); // Cut the stack back to where the caller started. |
1901 __ mr(R1_SP, R21_sender_SP); // Cut the stack back to where the caller started. |
1904 __ blr(); |
1902 __ blr(); |
1905 |
1903 |
1987 StubRoutines::ppc64::generate_load_crc_table_addr(_masm, table); |
1989 StubRoutines::ppc64::generate_load_crc_table_addr(_masm, table); |
1988 |
1990 |
1989 // Performance measurements show the 1word and 2word variants to be almost equivalent, |
1991 // Performance measurements show the 1word and 2word variants to be almost equivalent, |
1990 // with very light advantages for the 1word variant. We chose the 1word variant for |
1992 // with very light advantages for the 1word variant. We chose the 1word variant for |
1991 // code compactness. |
1993 // code compactness. |
1992 __ kernel_crc32_1word(crc, data, dataLen, table, t0, t1, t2, t3, tc0, tc1, tc2, tc3); |
1994 __ kernel_crc32_1word(crc, data, dataLen, table, t0, t1, t2, t3, tc0, tc1, tc2, tc3, true); |
1993 |
1995 |
1994 // Restore caller sp for c2i case and return. |
1996 // Restore caller sp for c2i case and return. |
1995 __ mr(R1_SP, R21_sender_SP); // Cut the stack back to where the caller started. |
1997 __ mr(R1_SP, R21_sender_SP); // Cut the stack back to where the caller started. |
1996 __ blr(); |
1998 __ blr(); |
1997 |
1999 |
2003 } |
2005 } |
2004 |
2006 |
2005 return NULL; |
2007 return NULL; |
2006 } |
2008 } |
2007 |
2009 |
2008 // Not supported |
2010 // CRC32C Intrinsics. |
|
2011 /** |
|
2012 * Method entry for static native methods: |
|
2013 * int java.util.zip.CRC32C.updateBytes( int crc, byte[] b, int off, int len) |
|
2014 * int java.util.zip.CRC32C.updateDirectByteBuffer(int crc, long* buf, int off, int len) |
|
2015 **/ |
2009 address TemplateInterpreterGenerator::generate_CRC32C_updateBytes_entry(AbstractInterpreter::MethodKind kind) { |
2016 address TemplateInterpreterGenerator::generate_CRC32C_updateBytes_entry(AbstractInterpreter::MethodKind kind) { |
|
2017 if (UseCRC32CIntrinsics) { |
|
2018 address start = __ pc(); // Remember stub start address (is rtn value). |
|
2019 |
|
2020 // We don't generate local frame and don't align stack because |
|
2021 // we not even call stub code (we generate the code inline) |
|
2022 // and there is no safepoint on this path. |
|
2023 |
|
2024 // Load parameters. |
|
2025 // Z_esp is callers operand stack pointer, i.e. it points to the parameters. |
|
2026 const Register argP = R15_esp; |
|
2027 const Register crc = R3_ARG1; // crc value |
|
2028 const Register data = R4_ARG2; // address of java byte array |
|
2029 const Register dataLen = R5_ARG3; // source data len |
|
2030 const Register table = R6_ARG4; // address of crc32c table |
|
2031 |
|
2032 const Register t0 = R9; // scratch registers for crc calculation |
|
2033 const Register t1 = R10; |
|
2034 const Register t2 = R11; |
|
2035 const Register t3 = R12; |
|
2036 |
|
2037 const Register tc0 = R2; // registers to hold pre-calculated column addresses |
|
2038 const Register tc1 = R7; |
|
2039 const Register tc2 = R8; |
|
2040 const Register tc3 = table; // table address is reconstructed at the end of kernel_crc32_* emitters |
|
2041 |
|
2042 const Register tmp = t0; // Only used very locally to calculate byte buffer address. |
|
2043 |
|
2044 // Arguments are reversed on java expression stack. |
|
2045 // Calculate address of start element. |
|
2046 if (kind == Interpreter::java_util_zip_CRC32C_updateDirectByteBuffer) { // Used for "updateDirectByteBuffer". |
|
2047 BLOCK_COMMENT("CRC32C_updateDirectByteBuffer {"); |
|
2048 // crc @ (SP + 5W) (32bit) |
|
2049 // buf @ (SP + 3W) (64bit ptr to long array) |
|
2050 // off @ (SP + 2W) (32bit) |
|
2051 // dataLen @ (SP + 1W) (32bit) |
|
2052 // data = buf + off |
|
2053 __ ld( data, 3*wordSize, argP); // start of byte buffer |
|
2054 __ lwa( tmp, 2*wordSize, argP); // byte buffer offset |
|
2055 __ lwa( dataLen, 1*wordSize, argP); // #bytes to process |
|
2056 __ lwz( crc, 5*wordSize, argP); // current crc state |
|
2057 __ add( data, data, tmp); // Add byte buffer offset. |
|
2058 } else { // Used for "updateBytes update". |
|
2059 BLOCK_COMMENT("CRC32C_updateBytes {"); |
|
2060 // crc @ (SP + 4W) (32bit) |
|
2061 // buf @ (SP + 3W) (64bit ptr to byte array) |
|
2062 // off @ (SP + 2W) (32bit) |
|
2063 // dataLen @ (SP + 1W) (32bit) |
|
2064 // data = buf + off + base_offset |
|
2065 __ ld( data, 3*wordSize, argP); // start of byte buffer |
|
2066 __ lwa( tmp, 2*wordSize, argP); // byte buffer offset |
|
2067 __ lwa( dataLen, 1*wordSize, argP); // #bytes to process |
|
2068 __ add( data, data, tmp); // add byte buffer offset |
|
2069 __ lwz( crc, 4*wordSize, argP); // current crc state |
|
2070 __ addi(data, data, arrayOopDesc::base_offset_in_bytes(T_BYTE)); |
|
2071 } |
|
2072 |
|
2073 StubRoutines::ppc64::generate_load_crc32c_table_addr(_masm, table); |
|
2074 |
|
2075 // Performance measurements show the 1word and 2word variants to be almost equivalent, |
|
2076 // with very light advantages for the 1word variant. We chose the 1word variant for |
|
2077 // code compactness. |
|
2078 __ kernel_crc32_1word(crc, data, dataLen, table, t0, t1, t2, t3, tc0, tc1, tc2, tc3, false); |
|
2079 |
|
2080 // Restore caller sp for c2i case and return. |
|
2081 __ mr(R1_SP, R21_sender_SP); // Cut the stack back to where the caller started. |
|
2082 __ blr(); |
|
2083 |
|
2084 BLOCK_COMMENT("} CRC32C_update{Bytes|DirectByteBuffer}"); |
|
2085 return start; |
|
2086 } |
|
2087 |
2010 return NULL; |
2088 return NULL; |
2011 } |
2089 } |
2012 |
2090 |
2013 // ============================================================================= |
2091 // ============================================================================= |
2014 // Exceptions |
2092 // Exceptions |