2163 address& fep,
2164 address& dep,
2165 address& vep) {
2166 assert(t->is_valid() && t->tos_in() == vtos, "illegal template");
2167 Label L;
2168
2169 aep = __ pc(); __ push_ptr(); __ b(L);
2170 fep = __ pc(); __ push_f(); __ b(L);
2171 dep = __ pc(); __ push_d(); __ b(L);
2172 lep = __ pc(); __ push_l(); __ b(L);
2173 __ align(32, 12, 24); // align L
2174 bep = cep = sep =
2175 iep = __ pc(); __ push_i();
2176 vep = __ pc();
2177 __ bind(L);
2178 generate_and_dispatch(t);
2179 }
2180
2181 //-----------------------------------------------------------------------------
2182
2183 // Non-product code
2184 #ifndef PRODUCT
2185 address TemplateInterpreterGenerator::generate_trace_code(TosState state) {
2186 //__ flush_bundle();
2187 address entry = __ pc();
2188
2189 const char *bname = nullptr;
2190 uint tsize = 0;
2191 switch(state) {
2192 case ftos:
2193 bname = "trace_code_ftos {";
2194 tsize = 2;
2195 break;
2196 case btos:
2197 bname = "trace_code_btos {";
2198 tsize = 2;
2199 break;
2200 case ztos:
2201 bname = "trace_code_ztos {";
2202 tsize = 2;
2250 __ blt(CCR0, Lskip_vm_call);
2251 }
2252
2253 __ push(state);
2254 // Load 2 topmost expression stack values.
2255 __ ld(R6_ARG4, tsize*Interpreter::stackElementSize, R15_esp);
2256 __ ld(R5_ARG3, Interpreter::stackElementSize, R15_esp);
2257 __ mflr(R31);
2258 __ call_VM(noreg, CAST_FROM_FN_PTR(address, InterpreterRuntime::trace_bytecode), /* unused */ R4_ARG2, R5_ARG3, R6_ARG4, false);
2259 __ mtlr(R31);
2260 __ pop(state);
2261
2262 if (TraceBytecodesAt > 0 && TraceBytecodesAt < max_intx) {
2263 __ bind(Lskip_vm_call);
2264 }
2265 __ blr();
2266 BLOCK_COMMENT("} trace_code");
2267 return entry;
2268 }
2269
2270 void TemplateInterpreterGenerator::count_bytecode() {
2271 int offs = __ load_const_optimized(R11_scratch1, (address) &BytecodeCounter::_counter_value, R12_scratch2, true);
2272 __ lwz(R12_scratch2, offs, R11_scratch1);
2273 __ addi(R12_scratch2, R12_scratch2, 1);
2274 __ stw(R12_scratch2, offs, R11_scratch1);
2275 }
2276
2277 void TemplateInterpreterGenerator::histogram_bytecode(Template* t) {
2278 int offs = __ load_const_optimized(R11_scratch1, (address) &BytecodeHistogram::_counters[t->bytecode()], R12_scratch2, true);
2279 __ lwz(R12_scratch2, offs, R11_scratch1);
2280 __ addi(R12_scratch2, R12_scratch2, 1);
2281 __ stw(R12_scratch2, offs, R11_scratch1);
2282 }
2283
2284 void TemplateInterpreterGenerator::histogram_bytecode_pair(Template* t) {
2285 const Register addr = R11_scratch1,
2286 tmp = R12_scratch2;
2287 // Get index, shift out old bytecode, bring in new bytecode, and store it.
2288 // _index = (_index >> log2_number_of_codes) |
2289 // (bytecode << log2_number_of_codes);
2290 int offs1 = __ load_const_optimized(addr, (address)&BytecodePairHistogram::_index, tmp, true);
2291 __ lwz(tmp, offs1, addr);
2292 __ srwi(tmp, tmp, BytecodePairHistogram::log2_number_of_codes);
2293 __ ori(tmp, tmp, ((int) t->bytecode()) << BytecodePairHistogram::log2_number_of_codes);
2294 __ stw(tmp, offs1, addr);
2295
2296 // Bump bucket contents.
2297 // _counters[_index] ++;
2298 int offs2 = __ load_const_optimized(addr, (address)&BytecodePairHistogram::_counters, R0, true);
2299 __ sldi(tmp, tmp, LogBytesPerInt);
2300 __ add(addr, tmp, addr);
2301 __ lwz(tmp, offs2, addr);
2302 __ addi(tmp, tmp, 1);
2303 __ stw(tmp, offs2, addr);
|
2163 address& fep,
2164 address& dep,
2165 address& vep) {
2166 assert(t->is_valid() && t->tos_in() == vtos, "illegal template");
2167 Label L;
2168
2169 aep = __ pc(); __ push_ptr(); __ b(L);
2170 fep = __ pc(); __ push_f(); __ b(L);
2171 dep = __ pc(); __ push_d(); __ b(L);
2172 lep = __ pc(); __ push_l(); __ b(L);
2173 __ align(32, 12, 24); // align L
2174 bep = cep = sep =
2175 iep = __ pc(); __ push_i();
2176 vep = __ pc();
2177 __ bind(L);
2178 generate_and_dispatch(t);
2179 }
2180
2181 //-----------------------------------------------------------------------------
2182
2183 void TemplateInterpreterGenerator::count_bytecode() {
2184 int offs = __ load_const_optimized(R11_scratch1, (address) &BytecodeCounter::_counter_value, R12_scratch2, true);
2185 __ lwz(R12_scratch2, offs, R11_scratch1);
2186 __ addi(R12_scratch2, R12_scratch2, 1);
2187 __ stw(R12_scratch2, offs, R11_scratch1);
2188 }
2189
2190 void TemplateInterpreterGenerator::histogram_bytecode(Template* t) {
2191 int offs = __ load_const_optimized(R11_scratch1, (address) &BytecodeHistogram::_counters[t->bytecode()], R12_scratch2, true);
2192 __ lwz(R12_scratch2, offs, R11_scratch1);
2193 __ addi(R12_scratch2, R12_scratch2, 1);
2194 __ stw(R12_scratch2, offs, R11_scratch1);
2195 }
2196
2197 // Non-product code
2198 #ifndef PRODUCT
2199 address TemplateInterpreterGenerator::generate_trace_code(TosState state) {
2200 //__ flush_bundle();
2201 address entry = __ pc();
2202
2203 const char *bname = nullptr;
2204 uint tsize = 0;
2205 switch(state) {
2206 case ftos:
2207 bname = "trace_code_ftos {";
2208 tsize = 2;
2209 break;
2210 case btos:
2211 bname = "trace_code_btos {";
2212 tsize = 2;
2213 break;
2214 case ztos:
2215 bname = "trace_code_ztos {";
2216 tsize = 2;
2264 __ blt(CCR0, Lskip_vm_call);
2265 }
2266
2267 __ push(state);
2268 // Load 2 topmost expression stack values.
2269 __ ld(R6_ARG4, tsize*Interpreter::stackElementSize, R15_esp);
2270 __ ld(R5_ARG3, Interpreter::stackElementSize, R15_esp);
2271 __ mflr(R31);
2272 __ call_VM(noreg, CAST_FROM_FN_PTR(address, InterpreterRuntime::trace_bytecode), /* unused */ R4_ARG2, R5_ARG3, R6_ARG4, false);
2273 __ mtlr(R31);
2274 __ pop(state);
2275
2276 if (TraceBytecodesAt > 0 && TraceBytecodesAt < max_intx) {
2277 __ bind(Lskip_vm_call);
2278 }
2279 __ blr();
2280 BLOCK_COMMENT("} trace_code");
2281 return entry;
2282 }
2283
2284 void TemplateInterpreterGenerator::histogram_bytecode_pair(Template* t) {
2285 const Register addr = R11_scratch1,
2286 tmp = R12_scratch2;
2287 // Get index, shift out old bytecode, bring in new bytecode, and store it.
2288 // _index = (_index >> log2_number_of_codes) |
2289 // (bytecode << log2_number_of_codes);
2290 int offs1 = __ load_const_optimized(addr, (address)&BytecodePairHistogram::_index, tmp, true);
2291 __ lwz(tmp, offs1, addr);
2292 __ srwi(tmp, tmp, BytecodePairHistogram::log2_number_of_codes);
2293 __ ori(tmp, tmp, ((int) t->bytecode()) << BytecodePairHistogram::log2_number_of_codes);
2294 __ stw(tmp, offs1, addr);
2295
2296 // Bump bucket contents.
2297 // _counters[_index] ++;
2298 int offs2 = __ load_const_optimized(addr, (address)&BytecodePairHistogram::_counters, R0, true);
2299 __ sldi(tmp, tmp, LogBytesPerInt);
2300 __ add(addr, tmp, addr);
2301 __ lwz(tmp, offs2, addr);
2302 __ addi(tmp, tmp, 1);
2303 __ stw(tmp, offs2, addr);
|