< prev index next >

src/cpu/ppc/vm/stubGenerator_ppc.cpp

Print this page
rev 8685 : 8131048: ppc: implement CRC32 intrinsic
Contributed-by: lutz.schmidt@sap.com


2109 
2110     __ multiply_to_len(x, xlen, y, ylen, z, zlen, tmp1, tmp2, tmp3, tmp4, tmp5,
2111                        tmp6, tmp7, tmp8, tmp9, tmp10, tmp11, tmp12, tmp13);
2112 
2113     // Restore non-volatile regs.
2114     current_offs = 8;
2115     __ ld(R24, -current_offs, R1_SP); current_offs += 8;
2116     __ ld(R25, -current_offs, R1_SP); current_offs += 8;
2117     __ ld(R26, -current_offs, R1_SP); current_offs += 8;
2118     __ ld(R27, -current_offs, R1_SP); current_offs += 8;
2119     __ ld(R28, -current_offs, R1_SP); current_offs += 8;
2120     __ ld(R29, -current_offs, R1_SP); current_offs += 8;
2121     __ ld(R30, -current_offs, R1_SP); current_offs += 8;
2122     __ ld(R31, -current_offs, R1_SP);
2123 
2124     __ blr();  // Return to caller.
2125 
2126     return start;
2127   }
2128 
















































2129   // Initialization
2130   void generate_initial() {
2131     // Generates all stubs and initializes the entry points
2132 
2133     // Entry points that exist in all platforms.
2134     // Note: This is code that could be shared among different platforms - however the
2135     // benefit seems to be smaller than the disadvantage of having a
2136     // much more complicated generator structure. See also comment in
2137     // stubRoutines.hpp.
2138 
2139     StubRoutines::_forward_exception_entry          = generate_forward_exception();
2140     StubRoutines::_call_stub_entry                  = generate_call_stub(StubRoutines::_call_stub_return_address);
2141     StubRoutines::_catch_exception_entry            = generate_catch_exception();
2142 
2143     // Build this early so it's available for the interpreter.
2144     StubRoutines::_throw_StackOverflowError_entry   =
2145       generate_throw_exception("StackOverflowError throw_exception",
2146                                CAST_FROM_FN_PTR(address, SharedRuntime::throw_StackOverflowError), false);






2147   }
2148 
2149   void generate_all() {
2150     // Generates all stubs and initializes the entry points
2151 
2152     // These entry points require SharedInfo::stack0 to be set up in
2153     // non-core builds
2154     StubRoutines::_throw_AbstractMethodError_entry         = generate_throw_exception("AbstractMethodError throw_exception",          CAST_FROM_FN_PTR(address, SharedRuntime::throw_AbstractMethodError),  false);
2155     // Handle IncompatibleClassChangeError in itable stubs.
2156     StubRoutines::_throw_IncompatibleClassChangeError_entry= generate_throw_exception("IncompatibleClassChangeError throw_exception", CAST_FROM_FN_PTR(address, SharedRuntime::throw_IncompatibleClassChangeError),  false);
2157     StubRoutines::_throw_NullPointerException_at_call_entry= generate_throw_exception("NullPointerException at call throw_exception", CAST_FROM_FN_PTR(address, SharedRuntime::throw_NullPointerException_at_call), false);
2158 
2159     StubRoutines::_handler_for_unsafe_access_entry         = generate_handler_for_unsafe_access();
2160 
2161     // support for verify_oop (must happen after universe_init)
2162     StubRoutines::_verify_oop_subroutine_entry             = generate_verify_oop();
2163 
2164     // arraycopy stubs used by compilers
2165     generate_arraycopy_stubs();
2166 




2109 
2110     __ multiply_to_len(x, xlen, y, ylen, z, zlen, tmp1, tmp2, tmp3, tmp4, tmp5,
2111                        tmp6, tmp7, tmp8, tmp9, tmp10, tmp11, tmp12, tmp13);
2112 
2113     // Restore non-volatile regs.
2114     current_offs = 8;
2115     __ ld(R24, -current_offs, R1_SP); current_offs += 8;
2116     __ ld(R25, -current_offs, R1_SP); current_offs += 8;
2117     __ ld(R26, -current_offs, R1_SP); current_offs += 8;
2118     __ ld(R27, -current_offs, R1_SP); current_offs += 8;
2119     __ ld(R28, -current_offs, R1_SP); current_offs += 8;
2120     __ ld(R29, -current_offs, R1_SP); current_offs += 8;
2121     __ ld(R30, -current_offs, R1_SP); current_offs += 8;
2122     __ ld(R31, -current_offs, R1_SP);
2123 
2124     __ blr();  // Return to caller.
2125 
2126     return start;
2127   }
2128 
2129   /**
2130    * Arguments:
2131    *
2132    * Inputs:
2133    *   R3_ARG1    - int   crc
2134    *   R4_ARG2    - byte* buf
2135    *   R5_ARG3    - int   length (of buffer)
2136    *
2137    * scratch:
2138    *   R6_ARG4    - crc table address
2139    *   R7_ARG5    - tmp1
2140    *   R8_ARG6    - tmp2
2141    *
2142    * Ouput:
2143    *   R3_RET     - int   crc result
2144    */
2145   // Compute CRC32 function.
2146   address generate_CRC32_updateBytes(const char* name) {
2147     __ align(CodeEntryAlignment);
2148     StubCodeMark mark(this, "StubRoutines", name);
2149     address start = __ function_entry();  // Remember stub start address (is rtn value).
2150 
2151     // arguments to kernel_crc32:
2152     Register       crc     = R3_ARG1;  // Current checksum, preset by caller or result from previous call.
2153     Register       data    = R4_ARG2;  // source byte array
2154     Register       dataLen = R5_ARG3;  // #bytes to process
2155     Register       table   = R6_ARG4;  // crc table address
2156 
2157     Register       t0      = R9;       // work reg for kernel* emitters
2158     Register       t1      = R10;      // work reg for kernel* emitters
2159     Register       t2      = R11;      // work reg for kernel* emitters
2160     Register       t3      = R12;      // work reg for kernel* emitters
2161 
2162     BLOCK_COMMENT("Stub body {");
2163     assert_different_registers(crc, data, dataLen, table);
2164 
2165     StubRoutines::ppc64::generate_load_crc_table_addr(_masm, table);
2166 
2167     __ kernel_crc32_1byte(crc, data, dataLen, table, t0, t1, t2, t3);
2168 
2169     BLOCK_COMMENT("return");
2170     __ mr_if_needed(R3_RET, crc);      // Updated crc is function result. No copying required (R3_ARG1 == R3_RET).
2171     __ blr();
2172 
2173     BLOCK_COMMENT("} Stub body");
2174     return start;
2175   }
2176 
2177   // Initialization
2178   void generate_initial() {
2179     // Generates all stubs and initializes the entry points
2180 
2181     // Entry points that exist in all platforms.
2182     // Note: This is code that could be shared among different platforms - however the
2183     // benefit seems to be smaller than the disadvantage of having a
2184     // much more complicated generator structure. See also comment in
2185     // stubRoutines.hpp.
2186 
2187     StubRoutines::_forward_exception_entry          = generate_forward_exception();
2188     StubRoutines::_call_stub_entry                  = generate_call_stub(StubRoutines::_call_stub_return_address);
2189     StubRoutines::_catch_exception_entry            = generate_catch_exception();
2190 
2191     // Build this early so it's available for the interpreter.
2192     StubRoutines::_throw_StackOverflowError_entry   =
2193       generate_throw_exception("StackOverflowError throw_exception",
2194                                CAST_FROM_FN_PTR(address, SharedRuntime::throw_StackOverflowError), false);
2195 
2196     // CRC32 Intrinsics.
2197     if (UseCRC32Intrinsics) {
2198       StubRoutines::_crc_table_adr    = (address)StubRoutines::ppc64::_crc_table;
2199       StubRoutines::_updateBytesCRC32 = generate_CRC32_updateBytes("CRC32_updateBytes");
2200     }
2201   }
2202 
2203   void generate_all() {
2204     // Generates all stubs and initializes the entry points
2205 
2206     // These entry points require SharedInfo::stack0 to be set up in
2207     // non-core builds
2208     StubRoutines::_throw_AbstractMethodError_entry         = generate_throw_exception("AbstractMethodError throw_exception",          CAST_FROM_FN_PTR(address, SharedRuntime::throw_AbstractMethodError),  false);
2209     // Handle IncompatibleClassChangeError in itable stubs.
2210     StubRoutines::_throw_IncompatibleClassChangeError_entry= generate_throw_exception("IncompatibleClassChangeError throw_exception", CAST_FROM_FN_PTR(address, SharedRuntime::throw_IncompatibleClassChangeError),  false);
2211     StubRoutines::_throw_NullPointerException_at_call_entry= generate_throw_exception("NullPointerException at call throw_exception", CAST_FROM_FN_PTR(address, SharedRuntime::throw_NullPointerException_at_call), false);
2212 
2213     StubRoutines::_handler_for_unsafe_access_entry         = generate_handler_for_unsafe_access();
2214 
2215     // support for verify_oop (must happen after universe_init)
2216     StubRoutines::_verify_oop_subroutine_entry             = generate_verify_oop();
2217 
2218     // arraycopy stubs used by compilers
2219     generate_arraycopy_stubs();
2220 


< prev index next >