< prev index next >

src/cpu/ppc/vm/stubGenerator_ppc.cpp

Print this page
rev 7958 : 8152172: PPC64: Support AES intrinsics
Reviewed-by: kvn, mdoerr, simonis
Contributed-by: horii@jp.ibm.com


1944     address start = __ function_entry();
1945 
1946     gen_write_ref_array_pre_barrier(R3_ARG1, R4_ARG2, R5_ARG3, dest_uninitialized, R9_ARG7);
1947 
1948     // save some arguments, disjoint_long_copy_core destroys them.
1949     // needed for post barrier
1950     __ mr(R9_ARG7, R4_ARG2);
1951     __ mr(R10_ARG8, R5_ARG3);
1952 
1953     if (UseCompressedOops) {
1954       generate_disjoint_int_copy_core(aligned);
1955     } else {
1956       generate_disjoint_long_copy_core(aligned);
1957     }
1958 
1959     gen_write_ref_array_post_barrier(R9_ARG7, R10_ARG8, R11_scratch1, /*branchToEnd*/ false);
1960 
1961     return start;
1962   }
1963 












































































































































































































































































































































































































































1964   void generate_arraycopy_stubs() {
1965     // Note: the disjoint stubs must be generated first, some of
1966     // the conjoint stubs use them.
1967 
1968     // non-aligned disjoint versions
1969     StubRoutines::_jbyte_disjoint_arraycopy       = generate_disjoint_byte_copy(false, "jbyte_disjoint_arraycopy");
1970     StubRoutines::_jshort_disjoint_arraycopy      = generate_disjoint_short_copy(false, "jshort_disjoint_arraycopy");
1971     StubRoutines::_jint_disjoint_arraycopy        = generate_disjoint_int_copy(false, "jint_disjoint_arraycopy");
1972     StubRoutines::_jlong_disjoint_arraycopy       = generate_disjoint_long_copy(false, "jlong_disjoint_arraycopy");
1973     StubRoutines::_oop_disjoint_arraycopy         = generate_disjoint_oop_copy(false, "oop_disjoint_arraycopy", false);
1974     StubRoutines::_oop_disjoint_arraycopy_uninit  = generate_disjoint_oop_copy(false, "oop_disjoint_arraycopy_uninit", true);
1975 
1976     // aligned disjoint versions
1977     StubRoutines::_arrayof_jbyte_disjoint_arraycopy      = generate_disjoint_byte_copy(true, "arrayof_jbyte_disjoint_arraycopy");
1978     StubRoutines::_arrayof_jshort_disjoint_arraycopy     = generate_disjoint_short_copy(true, "arrayof_jshort_disjoint_arraycopy");
1979     StubRoutines::_arrayof_jint_disjoint_arraycopy       = generate_disjoint_int_copy(true, "arrayof_jint_disjoint_arraycopy");
1980     StubRoutines::_arrayof_jlong_disjoint_arraycopy      = generate_disjoint_long_copy(true, "arrayof_jlong_disjoint_arraycopy");
1981     StubRoutines::_arrayof_oop_disjoint_arraycopy        = generate_disjoint_oop_copy(true, "arrayof_oop_disjoint_arraycopy", false);
1982     StubRoutines::_arrayof_oop_disjoint_arraycopy_uninit = generate_disjoint_oop_copy(true, "oop_disjoint_arraycopy_uninit", true);
1983 


2066   }
2067 
2068   void generate_all() {
2069     // Generates all stubs and initializes the entry points
2070 
2071     // These entry points require SharedInfo::stack0 to be set up in
2072     // non-core builds
2073     StubRoutines::_throw_AbstractMethodError_entry         = generate_throw_exception("AbstractMethodError throw_exception",          CAST_FROM_FN_PTR(address, SharedRuntime::throw_AbstractMethodError),  false);
2074     // Handle IncompatibleClassChangeError in itable stubs.
2075     StubRoutines::_throw_IncompatibleClassChangeError_entry= generate_throw_exception("IncompatibleClassChangeError throw_exception", CAST_FROM_FN_PTR(address, SharedRuntime::throw_IncompatibleClassChangeError),  false);
2076     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);
2077 
2078     StubRoutines::_handler_for_unsafe_access_entry         = generate_handler_for_unsafe_access();
2079 
2080     // support for verify_oop (must happen after universe_init)
2081     StubRoutines::_verify_oop_subroutine_entry             = generate_verify_oop();
2082 
2083     // arraycopy stubs used by compilers
2084     generate_arraycopy_stubs();
2085 
2086     if (UseAESIntrinsics) {
2087       guarantee(!UseAESIntrinsics, "not yet implemented.");
2088     }
2089 
2090     // Safefetch stubs.
2091     generate_safefetch("SafeFetch32", sizeof(int),     &StubRoutines::_safefetch32_entry,
2092                                                        &StubRoutines::_safefetch32_fault_pc,
2093                                                        &StubRoutines::_safefetch32_continuation_pc);
2094     generate_safefetch("SafeFetchN", sizeof(intptr_t), &StubRoutines::_safefetchN_entry,
2095                                                        &StubRoutines::_safefetchN_fault_pc,
2096                                                        &StubRoutines::_safefetchN_continuation_pc);






2097   }
2098 
2099  public:
2100   StubGenerator(CodeBuffer* code, bool all) : StubCodeGenerator(code) {
2101     // replace the standard masm with a special one:
2102     _masm = new MacroAssembler(code);
2103     if (all) {
2104       generate_all();
2105     } else {
2106       generate_initial();
2107     }
2108   }
2109 };
2110 
2111 void StubGenerator_generate(CodeBuffer* code, bool all) {
2112   StubGenerator g(code, all);
2113 }


1944     address start = __ function_entry();
1945 
1946     gen_write_ref_array_pre_barrier(R3_ARG1, R4_ARG2, R5_ARG3, dest_uninitialized, R9_ARG7);
1947 
1948     // save some arguments, disjoint_long_copy_core destroys them.
1949     // needed for post barrier
1950     __ mr(R9_ARG7, R4_ARG2);
1951     __ mr(R10_ARG8, R5_ARG3);
1952 
1953     if (UseCompressedOops) {
1954       generate_disjoint_int_copy_core(aligned);
1955     } else {
1956       generate_disjoint_long_copy_core(aligned);
1957     }
1958 
1959     gen_write_ref_array_post_barrier(R9_ARG7, R10_ARG8, R11_scratch1, /*branchToEnd*/ false);
1960 
1961     return start;
1962   }
1963 
1964   // Arguments for generated stub (little endian only):
1965   //   R3_ARG1   - source byte array address
1966   //   R4_ARG2   - destination byte array address
1967   //   R5_ARG3   - round key array
1968   address generate_aescrypt_encryptBlock() {
1969     assert(UseAES, "need AES instructions and misaligned SSE support");
1970     StubCodeMark mark(this, "StubRoutines", "aescrypt_encryptBlock");
1971 
1972     address start = __ function_entry();
1973 
1974     Label L_doLast;
1975 
1976     Register from           = R3_ARG1;  // source array address
1977     Register to             = R4_ARG2;  // destination array address
1978     Register key            = R5_ARG3;  // round key array
1979 
1980     Register keylen         = R8;
1981     Register temp           = R9;
1982     Register keypos         = R10;
1983     Register hex            = R11;
1984     Register fifteen        = R12;
1985 
1986     VectorRegister vRet     = VR0;
1987 
1988     VectorRegister vKey1    = VR1;
1989     VectorRegister vKey2    = VR2;
1990     VectorRegister vKey3    = VR3;
1991     VectorRegister vKey4    = VR4;
1992 
1993     VectorRegister fromPerm = VR5;
1994     VectorRegister keyPerm  = VR6;
1995     VectorRegister toPerm   = VR7;
1996     VectorRegister fSplt    = VR8;
1997 
1998     VectorRegister vTmp1    = VR9;
1999     VectorRegister vTmp2    = VR10;
2000     VectorRegister vTmp3    = VR11;
2001     VectorRegister vTmp4    = VR12;
2002 
2003     VectorRegister vLow     = VR13;
2004     VectorRegister vHigh    = VR14;
2005 
2006     __ li              (hex, 16);
2007     __ li              (fifteen, 15);
2008     __ vspltisb        (fSplt, 0x0f);
2009 
2010     // load unaligned from[0-15] to vsRet
2011     __ lvx             (vRet, from);
2012     __ lvx             (vTmp1, fifteen, from);
2013     __ lvsl            (fromPerm, from);
2014     __ vxor            (fromPerm, fromPerm, fSplt);
2015     __ vperm           (vRet, vRet, vTmp1, fromPerm);
2016 
2017     // load keylen (44 or 52 or 60)
2018     __ lwz             (keylen, arrayOopDesc::length_offset_in_bytes() - arrayOopDesc::base_offset_in_bytes(T_INT), key);
2019 
2020     // to load keys
2021     __ lvsr            (keyPerm, key);
2022     __ vxor            (vTmp2, vTmp2, vTmp2);
2023     __ vspltisb        (vTmp2, -16);
2024     __ vrld            (keyPerm, keyPerm, vTmp2);
2025     __ vrld            (keyPerm, keyPerm, vTmp2);
2026     __ vsldoi          (keyPerm, keyPerm, keyPerm, -8);
2027 
2028     // load the 1st round key to vKey1
2029     __ li              (keypos, 0);
2030     __ lvx             (vKey1, keypos, key);
2031     __ addi            (keypos, keypos, 16);
2032     __ lvx             (vTmp1, keypos, key);
2033     __ vperm           (vKey1, vTmp1, vKey1, keyPerm);
2034 
2035     // 1st round
2036     __ vxor (vRet, vRet, vKey1);
2037 
2038     // load the 2nd round key to vKey1
2039     __ addi            (keypos, keypos, 16);
2040     __ lvx             (vTmp2, keypos, key);
2041     __ vperm           (vKey1, vTmp2, vTmp1, keyPerm);
2042 
2043     // load the 3rd round key to vKey2
2044     __ addi            (keypos, keypos, 16);
2045     __ lvx             (vTmp1, keypos, key);
2046     __ vperm           (vKey2, vTmp1, vTmp2, keyPerm);
2047 
2048     // load the 4th round key to vKey3
2049     __ addi            (keypos, keypos, 16);
2050     __ lvx             (vTmp2, keypos, key);
2051     __ vperm           (vKey3, vTmp2, vTmp1, keyPerm);
2052 
2053     // load the 5th round key to vKey4
2054     __ addi            (keypos, keypos, 16);
2055     __ lvx             (vTmp1, keypos, key);
2056     __ vperm           (vKey4, vTmp1, vTmp2, keyPerm);
2057 
2058     // 2nd - 5th rounds
2059     __ vcipher (vRet, vRet, vKey1);
2060     __ vcipher (vRet, vRet, vKey2);
2061     __ vcipher (vRet, vRet, vKey3);
2062     __ vcipher (vRet, vRet, vKey4);
2063 
2064     // load the 6th round key to vKey1
2065     __ addi            (keypos, keypos, 16);
2066     __ lvx             (vTmp2, keypos, key);
2067     __ vperm           (vKey1, vTmp2, vTmp1, keyPerm);
2068 
2069     // load the 7th round key to vKey2
2070     __ addi            (keypos, keypos, 16);
2071     __ lvx             (vTmp1, keypos, key);
2072     __ vperm           (vKey2, vTmp1, vTmp2, keyPerm);
2073 
2074     // load the 8th round key to vKey3
2075     __ addi            (keypos, keypos, 16);
2076     __ lvx             (vTmp2, keypos, key);
2077     __ vperm           (vKey3, vTmp2, vTmp1, keyPerm);
2078 
2079     // load the 9th round key to vKey4
2080     __ addi            (keypos, keypos, 16);
2081     __ lvx             (vTmp1, keypos, key);
2082     __ vperm           (vKey4, vTmp1, vTmp2, keyPerm);
2083 
2084     // 6th - 9th rounds
2085     __ vcipher (vRet, vRet, vKey1);
2086     __ vcipher (vRet, vRet, vKey2);
2087     __ vcipher (vRet, vRet, vKey3);
2088     __ vcipher (vRet, vRet, vKey4);
2089 
2090     // load the 10th round key to vKey1
2091     __ addi            (keypos, keypos, 16);
2092     __ lvx             (vTmp2, keypos, key);
2093     __ vperm           (vKey1, vTmp2, vTmp1, keyPerm);
2094 
2095     // load the 11th round key to vKey2
2096     __ addi            (keypos, keypos, 16);
2097     __ lvx             (vTmp1, keypos, key);
2098     __ vperm           (vKey2, vTmp1, vTmp2, keyPerm);
2099 
2100     // if all round keys are loaded, skip next 4 rounds
2101     __ cmpwi           (CCR0, keylen, 44);
2102     __ beq             (CCR0, L_doLast);
2103 
2104     // 10th - 11th rounds
2105     __ vcipher (vRet, vRet, vKey1);
2106     __ vcipher (vRet, vRet, vKey2);
2107 
2108     // load the 12th round key to vKey1
2109     __ addi            (keypos, keypos, 16);
2110     __ lvx             (vTmp2, keypos, key);
2111     __ vperm           (vKey1, vTmp2, vTmp1, keyPerm);
2112 
2113     // load the 13th round key to vKey2
2114     __ addi            (keypos, keypos, 16);
2115     __ lvx             (vTmp1, keypos, key);
2116     __ vperm           (vKey2, vTmp1, vTmp2, keyPerm);
2117 
2118     // if all round keys are loaded, skip next 2 rounds
2119     __ cmpwi           (CCR0, keylen, 52);
2120     __ beq             (CCR0, L_doLast);
2121 
2122     // 12th - 13th rounds
2123     __ vcipher (vRet, vRet, vKey1);
2124     __ vcipher (vRet, vRet, vKey2);
2125 
2126     // load the 14th round key to vKey1
2127     __ addi            (keypos, keypos, 16);
2128     __ lvx             (vTmp2, keypos, key);
2129     __ vperm           (vKey1, vTmp2, vTmp1, keyPerm);
2130 
2131     // load the 15th round key to vKey2
2132     __ addi            (keypos, keypos, 16);
2133     __ lvx             (vTmp1, keypos, key);
2134     __ vperm           (vKey2, vTmp1, vTmp2, keyPerm);
2135 
2136     __ bind(L_doLast);
2137 
2138     // last two rounds
2139     __ vcipher (vRet, vRet, vKey1);
2140     __ vcipherlast (vRet, vRet, vKey2);
2141 
2142     __ neg             (temp, to);
2143     __ lvsr            (toPerm, temp);
2144     __ vspltisb        (vTmp2, -1);
2145     __ vxor            (vTmp1, vTmp1, vTmp1);
2146     __ vperm           (vTmp2, vTmp2, vTmp1, toPerm);
2147     __ vxor            (toPerm, toPerm, fSplt);
2148     __ lvx             (vTmp1, to);
2149     __ vperm           (vRet, vRet, vRet, toPerm);
2150     __ vsel            (vTmp1, vTmp1, vRet, vTmp2);
2151     __ lvx             (vTmp4, fifteen, to);
2152     __ stvx            (vTmp1, to);
2153     __ vsel            (vRet, vRet, vTmp4, vTmp2);
2154     __ stvx            (vRet, fifteen, to);
2155 
2156     __ blr();
2157      return start;
2158   }
2159 
2160   // Arguments for generated stub (little endian only):
2161   //   R3_ARG1   - source byte array address
2162   //   R4_ARG2   - destination byte array address
2163   //   R5_ARG3   - K (key) in little endian int array
2164   address generate_aescrypt_decryptBlock() {
2165     assert(UseAES, "need AES instructions and misaligned SSE support");
2166     StubCodeMark mark(this, "StubRoutines", "aescrypt_decryptBlock");
2167 
2168     address start = __ function_entry();
2169 
2170     Label L_doLast;
2171     Label L_do44;
2172     Label L_do52;
2173     Label L_do60;
2174 
2175     Register from           = R3_ARG1;  // source array address
2176     Register to             = R4_ARG2;  // destination array address
2177     Register key            = R5_ARG3;  // round key array
2178 
2179     Register keylen         = R8;
2180     Register temp           = R9;
2181     Register keypos         = R10;
2182     Register hex            = R11;
2183     Register fifteen        = R12;
2184 
2185     VectorRegister vRet     = VR0;
2186 
2187     VectorRegister vKey1    = VR1;
2188     VectorRegister vKey2    = VR2;
2189     VectorRegister vKey3    = VR3;
2190     VectorRegister vKey4    = VR4;
2191     VectorRegister vKey5    = VR5;
2192 
2193     VectorRegister fromPerm = VR6;
2194     VectorRegister keyPerm  = VR7;
2195     VectorRegister toPerm   = VR8;
2196     VectorRegister fSplt    = VR9;
2197 
2198     VectorRegister vTmp1    = VR10;
2199     VectorRegister vTmp2    = VR11;
2200     VectorRegister vTmp3    = VR12;
2201     VectorRegister vTmp4    = VR13;
2202 
2203     VectorRegister vLow     = VR14;
2204     VectorRegister vHigh    = VR15;
2205 
2206     __ li              (hex, 16);
2207     __ li              (fifteen, 15);
2208     __ vspltisb        (fSplt, 0x0f);
2209 
2210     // load unaligned from[0-15] to vsRet
2211     __ lvx             (vRet, from);
2212     __ lvx             (vTmp1, fifteen, from);
2213     __ lvsl            (fromPerm, from);
2214     __ vxor            (fromPerm, fromPerm, fSplt);
2215     __ vperm           (vRet, vRet, vTmp1, fromPerm); // align [and byte swap in LE]
2216 
2217     // load keylen (44 or 52 or 60)
2218     __ lwz             (keylen, arrayOopDesc::length_offset_in_bytes() - arrayOopDesc::base_offset_in_bytes(T_INT), key);
2219 
2220     // to load keys
2221     __ lvsr            (keyPerm, key);
2222     __ vxor            (vTmp2, vTmp2, vTmp2);
2223     __ vspltisb        (vTmp2, -16);
2224     __ vrld            (keyPerm, keyPerm, vTmp2);
2225     __ vrld            (keyPerm, keyPerm, vTmp2);
2226     __ vsldoi          (keyPerm, keyPerm, keyPerm, -8);
2227 
2228     __ cmpwi           (CCR0, keylen, 44);
2229     __ beq             (CCR0, L_do44);
2230 
2231     __ cmpwi           (CCR0, keylen, 52);
2232     __ beq             (CCR0, L_do52);
2233 
2234     // load the 15th round key to vKey11
2235     __ li              (keypos, 240);
2236     __ lvx             (vTmp1, keypos, key);
2237     __ addi            (keypos, keypos, -16);
2238     __ lvx             (vTmp2, keypos, key);
2239     __ vperm           (vKey1, vTmp1, vTmp2, keyPerm);
2240 
2241     // load the 14th round key to vKey10
2242     __ addi            (keypos, keypos, -16);
2243     __ lvx             (vTmp1, keypos, key);
2244     __ vperm           (vKey2, vTmp2, vTmp1, keyPerm);
2245 
2246     // load the 13th round key to vKey10
2247     __ addi            (keypos, keypos, -16);
2248     __ lvx             (vTmp2, keypos, key);
2249     __ vperm           (vKey3, vTmp1, vTmp2, keyPerm);
2250 
2251     // load the 12th round key to vKey10
2252     __ addi            (keypos, keypos, -16);
2253     __ lvx             (vTmp1, keypos, key);
2254     __ vperm           (vKey4, vTmp2, vTmp1, keyPerm);
2255 
2256     // load the 11th round key to vKey10
2257     __ addi            (keypos, keypos, -16);
2258     __ lvx             (vTmp2, keypos, key);
2259     __ vperm           (vKey5, vTmp1, vTmp2, keyPerm);
2260 
2261     // 1st - 5th rounds
2262     __ vxor            (vRet, vRet, vKey1);
2263     __ vncipher        (vRet, vRet, vKey2);
2264     __ vncipher        (vRet, vRet, vKey3);
2265     __ vncipher        (vRet, vRet, vKey4);
2266     __ vncipher        (vRet, vRet, vKey5);
2267 
2268     __ b               (L_doLast);
2269 
2270     __ bind            (L_do52);
2271 
2272     // load the 13th round key to vKey11
2273     __ li              (keypos, 208);
2274     __ lvx             (vTmp1, keypos, key);
2275     __ addi            (keypos, keypos, -16);
2276     __ lvx             (vTmp2, keypos, key);
2277     __ vperm           (vKey1, vTmp1, vTmp2, keyPerm);
2278 
2279     // load the 12th round key to vKey10
2280     __ addi            (keypos, keypos, -16);
2281     __ lvx             (vTmp1, keypos, key);
2282     __ vperm           (vKey2, vTmp2, vTmp1, keyPerm);
2283 
2284     // load the 11th round key to vKey10
2285     __ addi            (keypos, keypos, -16);
2286     __ lvx             (vTmp2, keypos, key);
2287     __ vperm           (vKey3, vTmp1, vTmp2, keyPerm);
2288 
2289     // 1st - 3rd rounds
2290     __ vxor            (vRet, vRet, vKey1);
2291     __ vncipher        (vRet, vRet, vKey2);
2292     __ vncipher        (vRet, vRet, vKey3);
2293 
2294     __ b               (L_doLast);
2295 
2296     __ bind            (L_do44);
2297 
2298     // load the 11th round key to vKey11
2299     __ li              (keypos, 176);
2300     __ lvx             (vTmp1, keypos, key);
2301     __ addi            (keypos, keypos, -16);
2302     __ lvx             (vTmp2, keypos, key);
2303     __ vperm           (vKey1, vTmp1, vTmp2, keyPerm);
2304 
2305     // 1st round
2306     __ vxor            (vRet, vRet, vKey1);
2307 
2308     __ bind            (L_doLast);
2309 
2310     // load the 10th round key to vKey10
2311     __ addi            (keypos, keypos, -16);
2312     __ lvx             (vTmp1, keypos, key);
2313     __ vperm           (vKey1, vTmp2, vTmp1, keyPerm);
2314 
2315     // load the 9th round key to vKey10
2316     __ addi            (keypos, keypos, -16);
2317     __ lvx             (vTmp2, keypos, key);
2318     __ vperm           (vKey2, vTmp1, vTmp2, keyPerm);
2319 
2320     // load the 8th round key to vKey10
2321     __ addi            (keypos, keypos, -16);
2322     __ lvx             (vTmp1, keypos, key);
2323     __ vperm           (vKey3, vTmp2, vTmp1, keyPerm);
2324 
2325     // load the 7th round key to vKey10
2326     __ addi            (keypos, keypos, -16);
2327     __ lvx             (vTmp2, keypos, key);
2328     __ vperm           (vKey4, vTmp1, vTmp2, keyPerm);
2329 
2330     // load the 6th round key to vKey10
2331     __ addi            (keypos, keypos, -16);
2332     __ lvx             (vTmp1, keypos, key);
2333     __ vperm           (vKey5, vTmp2, vTmp1, keyPerm);
2334 
2335     // last 10th - 6th rounds
2336     __ vncipher        (vRet, vRet, vKey1);
2337     __ vncipher        (vRet, vRet, vKey2);
2338     __ vncipher        (vRet, vRet, vKey3);
2339     __ vncipher        (vRet, vRet, vKey4);
2340     __ vncipher        (vRet, vRet, vKey5);
2341 
2342     // load the 5th round key to vKey10
2343     __ addi            (keypos, keypos, -16);
2344     __ lvx             (vTmp2, keypos, key);
2345     __ vperm           (vKey1, vTmp1, vTmp2, keyPerm);
2346 
2347     // load the 4th round key to vKey10
2348     __ addi            (keypos, keypos, -16);
2349     __ lvx             (vTmp1, keypos, key);
2350     __ vperm           (vKey2, vTmp2, vTmp1, keyPerm);
2351 
2352     // load the 3rd round key to vKey10
2353     __ addi            (keypos, keypos, -16);
2354     __ lvx             (vTmp2, keypos, key);
2355     __ vperm           (vKey3, vTmp1, vTmp2, keyPerm);
2356 
2357     // load the 2nd round key to vKey10
2358     __ addi            (keypos, keypos, -16);
2359     __ lvx             (vTmp1, keypos, key);
2360     __ vperm           (vKey4, vTmp2, vTmp1, keyPerm);
2361 
2362     // load the 1st round key to vKey10
2363     __ addi            (keypos, keypos, -16);
2364     __ lvx             (vTmp2, keypos, key);
2365     __ vperm           (vKey5, vTmp1, vTmp2, keyPerm);
2366 
2367     // last 5th - 1th rounds
2368     __ vncipher        (vRet, vRet, vKey1);
2369     __ vncipher        (vRet, vRet, vKey2);
2370     __ vncipher        (vRet, vRet, vKey3);
2371     __ vncipher        (vRet, vRet, vKey4);
2372     __ vncipherlast    (vRet, vRet, vKey5);
2373 
2374     __ neg             (temp, to);
2375     __ lvsr            (toPerm, temp);
2376     __ vspltisb        (vTmp2, -1);
2377     __ vxor            (vTmp1, vTmp1, vTmp1);
2378     __ vperm           (vTmp2, vTmp2, vTmp1, toPerm);
2379     __ vxor            (toPerm, toPerm, fSplt);
2380     __ lvx             (vTmp1, to);
2381     __ vperm           (vRet, vRet, vRet, toPerm);
2382     __ vsel            (vTmp1, vTmp1, vRet, vTmp2);
2383     __ lvx             (vTmp4, fifteen, to);
2384     __ stvx            (vTmp1, to);
2385     __ vsel            (vRet, vRet, vTmp4, vTmp2);
2386     __ stvx            (vRet, fifteen, to);
2387 
2388     __ blr();
2389      return start;
2390   }
2391 
2392   void generate_arraycopy_stubs() {
2393     // Note: the disjoint stubs must be generated first, some of
2394     // the conjoint stubs use them.
2395 
2396     // non-aligned disjoint versions
2397     StubRoutines::_jbyte_disjoint_arraycopy       = generate_disjoint_byte_copy(false, "jbyte_disjoint_arraycopy");
2398     StubRoutines::_jshort_disjoint_arraycopy      = generate_disjoint_short_copy(false, "jshort_disjoint_arraycopy");
2399     StubRoutines::_jint_disjoint_arraycopy        = generate_disjoint_int_copy(false, "jint_disjoint_arraycopy");
2400     StubRoutines::_jlong_disjoint_arraycopy       = generate_disjoint_long_copy(false, "jlong_disjoint_arraycopy");
2401     StubRoutines::_oop_disjoint_arraycopy         = generate_disjoint_oop_copy(false, "oop_disjoint_arraycopy", false);
2402     StubRoutines::_oop_disjoint_arraycopy_uninit  = generate_disjoint_oop_copy(false, "oop_disjoint_arraycopy_uninit", true);
2403 
2404     // aligned disjoint versions
2405     StubRoutines::_arrayof_jbyte_disjoint_arraycopy      = generate_disjoint_byte_copy(true, "arrayof_jbyte_disjoint_arraycopy");
2406     StubRoutines::_arrayof_jshort_disjoint_arraycopy     = generate_disjoint_short_copy(true, "arrayof_jshort_disjoint_arraycopy");
2407     StubRoutines::_arrayof_jint_disjoint_arraycopy       = generate_disjoint_int_copy(true, "arrayof_jint_disjoint_arraycopy");
2408     StubRoutines::_arrayof_jlong_disjoint_arraycopy      = generate_disjoint_long_copy(true, "arrayof_jlong_disjoint_arraycopy");
2409     StubRoutines::_arrayof_oop_disjoint_arraycopy        = generate_disjoint_oop_copy(true, "arrayof_oop_disjoint_arraycopy", false);
2410     StubRoutines::_arrayof_oop_disjoint_arraycopy_uninit = generate_disjoint_oop_copy(true, "oop_disjoint_arraycopy_uninit", true);
2411 


2494   }
2495 
2496   void generate_all() {
2497     // Generates all stubs and initializes the entry points
2498 
2499     // These entry points require SharedInfo::stack0 to be set up in
2500     // non-core builds
2501     StubRoutines::_throw_AbstractMethodError_entry         = generate_throw_exception("AbstractMethodError throw_exception",          CAST_FROM_FN_PTR(address, SharedRuntime::throw_AbstractMethodError),  false);
2502     // Handle IncompatibleClassChangeError in itable stubs.
2503     StubRoutines::_throw_IncompatibleClassChangeError_entry= generate_throw_exception("IncompatibleClassChangeError throw_exception", CAST_FROM_FN_PTR(address, SharedRuntime::throw_IncompatibleClassChangeError),  false);
2504     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);
2505 
2506     StubRoutines::_handler_for_unsafe_access_entry         = generate_handler_for_unsafe_access();
2507 
2508     // support for verify_oop (must happen after universe_init)
2509     StubRoutines::_verify_oop_subroutine_entry             = generate_verify_oop();
2510 
2511     // arraycopy stubs used by compilers
2512     generate_arraycopy_stubs();
2513 




2514     // Safefetch stubs.
2515     generate_safefetch("SafeFetch32", sizeof(int),     &StubRoutines::_safefetch32_entry,
2516                                                        &StubRoutines::_safefetch32_fault_pc,
2517                                                        &StubRoutines::_safefetch32_continuation_pc);
2518     generate_safefetch("SafeFetchN", sizeof(intptr_t), &StubRoutines::_safefetchN_entry,
2519                                                        &StubRoutines::_safefetchN_fault_pc,
2520                                                        &StubRoutines::_safefetchN_continuation_pc);
2521 
2522     if (UseAESIntrinsics) {
2523       StubRoutines::_aescrypt_encryptBlock = generate_aescrypt_encryptBlock();
2524       StubRoutines::_aescrypt_decryptBlock = generate_aescrypt_decryptBlock();
2525     }
2526 
2527   }
2528 
2529  public:
2530   StubGenerator(CodeBuffer* code, bool all) : StubCodeGenerator(code) {
2531     // replace the standard masm with a special one:
2532     _masm = new MacroAssembler(code);
2533     if (all) {
2534       generate_all();
2535     } else {
2536       generate_initial();
2537     }
2538   }
2539 };
2540 
2541 void StubGenerator_generate(CodeBuffer* code, bool all) {
2542   StubGenerator g(code, all);
2543 }
< prev index next >