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