< prev index next >

src/cpu/ppc/vm/stubGenerator_ppc.cpp

Print this page
rev 8631 : 8130654: ppc: implement MultiplyToLen intrinsic
Contributed-by: Peter.Januschke@sap.com


2036     *fault_pc = __ pc();
2037     switch (size) {
2038       case 4:
2039         // int32_t, signed extended
2040         __ lwa(R4_ARG2, 0, R3_ARG1);
2041         break;
2042       case 8:
2043         // int64_t
2044         __ ld(R4_ARG2, 0, R3_ARG1);
2045         break;
2046       default:
2047         ShouldNotReachHere();
2048     }
2049 
2050     // return errValue or *adr
2051     *continuation_pc = __ pc();
2052     __ mr(R3_RET, R4_ARG2);
2053     __ blr();
2054   }
2055 









































































2056   // Initialization
2057   void generate_initial() {
2058     // Generates all stubs and initializes the entry points
2059 
2060     // Entry points that exist in all platforms.
2061     // Note: This is code that could be shared among different platforms - however the
2062     // benefit seems to be smaller than the disadvantage of having a
2063     // much more complicated generator structure. See also comment in
2064     // stubRoutines.hpp.
2065 
2066     StubRoutines::_forward_exception_entry          = generate_forward_exception();
2067     StubRoutines::_call_stub_entry                  = generate_call_stub(StubRoutines::_call_stub_return_address);
2068     StubRoutines::_catch_exception_entry            = generate_catch_exception();
2069 
2070     // Build this early so it's available for the interpreter.
2071     StubRoutines::_throw_StackOverflowError_entry   =
2072       generate_throw_exception("StackOverflowError throw_exception",
2073                                CAST_FROM_FN_PTR(address, SharedRuntime::throw_StackOverflowError), false);
2074   }
2075 


2085 
2086     StubRoutines::_handler_for_unsafe_access_entry         = generate_handler_for_unsafe_access();
2087 
2088     // support for verify_oop (must happen after universe_init)
2089     StubRoutines::_verify_oop_subroutine_entry             = generate_verify_oop();
2090 
2091     // arraycopy stubs used by compilers
2092     generate_arraycopy_stubs();
2093 
2094     if (UseAESIntrinsics) {
2095       guarantee(!UseAESIntrinsics, "not yet implemented.");
2096     }
2097 
2098     // Safefetch stubs.
2099     generate_safefetch("SafeFetch32", sizeof(int),     &StubRoutines::_safefetch32_entry,
2100                                                        &StubRoutines::_safefetch32_fault_pc,
2101                                                        &StubRoutines::_safefetch32_continuation_pc);
2102     generate_safefetch("SafeFetchN", sizeof(intptr_t), &StubRoutines::_safefetchN_entry,
2103                                                        &StubRoutines::_safefetchN_fault_pc,
2104                                                        &StubRoutines::_safefetchN_continuation_pc);






2105   }
2106 
2107  public:
2108   StubGenerator(CodeBuffer* code, bool all) : StubCodeGenerator(code) {
2109     // replace the standard masm with a special one:
2110     _masm = new MacroAssembler(code);
2111     if (all) {
2112       generate_all();
2113     } else {
2114       generate_initial();
2115     }
2116   }
2117 };
2118 
2119 void StubGenerator_generate(CodeBuffer* code, bool all) {
2120   StubGenerator g(code, all);
2121 }


2036     *fault_pc = __ pc();
2037     switch (size) {
2038       case 4:
2039         // int32_t, signed extended
2040         __ lwa(R4_ARG2, 0, R3_ARG1);
2041         break;
2042       case 8:
2043         // int64_t
2044         __ ld(R4_ARG2, 0, R3_ARG1);
2045         break;
2046       default:
2047         ShouldNotReachHere();
2048     }
2049 
2050     // return errValue or *adr
2051     *continuation_pc = __ pc();
2052     __ mr(R3_RET, R4_ARG2);
2053     __ blr();
2054   }
2055 
2056   // Stub for BigInteger::multiplyToLen()
2057   //
2058   //  Arguments:
2059   //
2060   //  Input:
2061   //    R3 - x address
2062   //    R4 - x length
2063   //    R5 - y address
2064   //    R6 - y length
2065   //    R7 - z address
2066   //    R8 - z length
2067   //
2068   address generate_multiplyToLen() {
2069 
2070     StubCodeMark mark(this, "StubRoutines", "multiplyToLen");
2071 
2072     address start = __ function_entry();
2073 
2074     const Register x     = R3;
2075     const Register xlen  = R4;
2076     const Register y     = R5;
2077     const Register ylen  = R6;
2078     const Register z     = R7;
2079     const Register zlen  = R8;
2080 
2081     const Register tmp1  = R2; // TOC not used.
2082     const Register tmp2  = R9;
2083     const Register tmp3  = R10;
2084     const Register tmp4  = R11;
2085     const Register tmp5  = R12;
2086 
2087     // non-volatile regs
2088     const Register tmp6  = R31;
2089     const Register tmp7  = R30;
2090     const Register tmp8  = R29;
2091     const Register tmp9  = R28;
2092     const Register tmp10 = R27;
2093     const Register tmp11 = R26;
2094     const Register tmp12 = R25;
2095     const Register tmp13 = R24;
2096 
2097     BLOCK_COMMENT("Entry:");
2098 
2099     // Save non-volatile regs (frameless).
2100     int current_offs = 8;
2101     __ std(R24, -current_offs, R1_SP); current_offs += 8;
2102     __ std(R25, -current_offs, R1_SP); current_offs += 8;
2103     __ std(R26, -current_offs, R1_SP); current_offs += 8;
2104     __ std(R27, -current_offs, R1_SP); current_offs += 8;
2105     __ std(R28, -current_offs, R1_SP); current_offs += 8;
2106     __ std(R29, -current_offs, R1_SP); current_offs += 8;
2107     __ std(R30, -current_offs, R1_SP); current_offs += 8;
2108     __ std(R31, -current_offs, R1_SP);
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 


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 
2167     if (UseAESIntrinsics) {
2168       guarantee(!UseAESIntrinsics, "not yet implemented.");
2169     }
2170 
2171     // Safefetch stubs.
2172     generate_safefetch("SafeFetch32", sizeof(int),     &StubRoutines::_safefetch32_entry,
2173                                                        &StubRoutines::_safefetch32_fault_pc,
2174                                                        &StubRoutines::_safefetch32_continuation_pc);
2175     generate_safefetch("SafeFetchN", sizeof(intptr_t), &StubRoutines::_safefetchN_entry,
2176                                                        &StubRoutines::_safefetchN_fault_pc,
2177                                                        &StubRoutines::_safefetchN_continuation_pc);
2178 
2179 #ifdef COMPILER2
2180     if (UseMultiplyToLenIntrinsic) {
2181       StubRoutines::_multiplyToLen = generate_multiplyToLen();
2182     }
2183 #endif
2184   }
2185 
2186  public:
2187   StubGenerator(CodeBuffer* code, bool all) : StubCodeGenerator(code) {
2188     // replace the standard masm with a special one:
2189     _masm = new MacroAssembler(code);
2190     if (all) {
2191       generate_all();
2192     } else {
2193       generate_initial();
2194     }
2195   }
2196 };
2197 
2198 void StubGenerator_generate(CodeBuffer* code, bool all) {
2199   StubGenerator g(code, all);
2200 }
< prev index next >