< prev index next >

src/hotspot/cpu/s390/templateInterpreterGenerator_s390.cpp

Print this page

2284                                                          address& iep,
2285                                                          address& lep,
2286                                                          address& fep,
2287                                                          address& dep,
2288                                                          address& vep) {
2289   assert(t->is_valid() && t->tos_in() == vtos, "illegal template");
2290   Label L;
2291   aep = __ pc(); __ push_ptr(); __ z_bru(L);
2292   fep = __ pc(); __ push_f();   __ z_bru(L);
2293   dep = __ pc(); __ push_d();   __ z_bru(L);
2294   lep = __ pc(); __ push_l();   __ z_bru(L);
2295   bep = cep = sep =
2296   iep = __ pc(); __ push_i();
2297   vep = __ pc();
2298   __ bind(L);
2299   generate_and_dispatch(t);
2300 }
2301 
2302 //-----------------------------------------------------------------------------
2303 











2304 #ifndef PRODUCT
2305 address TemplateInterpreterGenerator::generate_trace_code(TosState state) {
2306   address entry = __ pc();
2307   NearLabel counter_below_trace_threshold;
2308 
2309   if (TraceBytecodesAt > 0) {
2310     // Skip runtime call, if the trace threshold is not yet reached.
2311     __ load_absolute_address(Z_tmp_1, (address)&BytecodeCounter::_counter_value);
2312     __ load_absolute_address(Z_tmp_2, (address)&TraceBytecodesAt);
2313     __ load_sized_value(Z_tmp_1, Address(Z_tmp_1), 4, false /*signed*/);
2314     __ load_sized_value(Z_tmp_2, Address(Z_tmp_2), 8, false /*signed*/);
2315     __ compareU64_and_branch(Z_tmp_1, Z_tmp_2, Assembler::bcondLow, counter_below_trace_threshold);
2316   }
2317 
2318   int offset2 = state == ltos || state == dtos ? 2 : 1;
2319 
2320   __ push(state);
2321   // Preserved return pointer is in Z_R14.
2322   // InterpreterRuntime::trace_bytecode() preserved and returns the value passed as second argument.
2323   __ z_lgr(Z_ARG2, Z_R14);
2324   __ z_lg(Z_ARG3, Address(Z_esp, Interpreter::expr_offset_in_bytes(0)));
2325   if (WizardMode) {
2326     __ z_lgr(Z_ARG4, Z_esp); // Trace Z_esp in WizardMode.
2327   } else {
2328     __ z_lg(Z_ARG4, Address(Z_esp, Interpreter::expr_offset_in_bytes(offset2)));
2329   }
2330   __ call_VM(noreg, CAST_FROM_FN_PTR(address, InterpreterRuntime::trace_bytecode), Z_ARG2, Z_ARG3, Z_ARG4);
2331   __ z_lgr(Z_R14, Z_RET); // Estore return address (see above).
2332   __ pop(state);
2333 
2334   __ bind(counter_below_trace_threshold);
2335   __ z_br(Z_R14); // return
2336 
2337   return entry;
2338 }
2339 
2340 // Make feasible for old CPUs.
2341 void TemplateInterpreterGenerator::count_bytecode() {
2342   __ load_absolute_address(Z_R1_scratch, (address) &BytecodeCounter::_counter_value);
2343   __ add2mem_32(Address(Z_R1_scratch), 1, Z_R0_scratch);
2344 }
2345 
2346 void TemplateInterpreterGenerator::histogram_bytecode(Template * t) {
2347   __ load_absolute_address(Z_R1_scratch, (address)&BytecodeHistogram::_counters[ t->bytecode() ]);
2348   __ add2mem_32(Address(Z_R1_scratch), 1, Z_tmp_1);
2349 }
2350 
2351 void TemplateInterpreterGenerator::histogram_bytecode_pair(Template * t) {
2352   Address  index_addr(Z_tmp_1, (intptr_t) 0);
2353   Register index = Z_tmp_2;
2354 
2355   // Load previous index.
2356   __ load_absolute_address(Z_tmp_1, (address) &BytecodePairHistogram::_index);
2357   __ mem2reg_opt(index, index_addr, false);
2358 
2359   // Mask with current bytecode and store as new previous index.
2360   __ z_srl(index, BytecodePairHistogram::log2_number_of_codes);
2361   __ load_const_optimized(Z_R0_scratch,
2362                           (int)t->bytecode() << BytecodePairHistogram::log2_number_of_codes);
2363   __ z_or(index, Z_R0_scratch);
2364   __ reg2mem_opt(index, index_addr, false);
2365 
2366   // Load counter array's address.
2367   __ z_lgfr(index, index);   // Sign extend for addressing.
2368   __ z_sllg(index, index, LogBytesPerInt);  // index2bytes
2369   __ load_absolute_address(Z_R1_scratch,
2370                            (address) &BytecodePairHistogram::_counters);

2284                                                          address& iep,
2285                                                          address& lep,
2286                                                          address& fep,
2287                                                          address& dep,
2288                                                          address& vep) {
2289   assert(t->is_valid() && t->tos_in() == vtos, "illegal template");
2290   Label L;
2291   aep = __ pc(); __ push_ptr(); __ z_bru(L);
2292   fep = __ pc(); __ push_f();   __ z_bru(L);
2293   dep = __ pc(); __ push_d();   __ z_bru(L);
2294   lep = __ pc(); __ push_l();   __ z_bru(L);
2295   bep = cep = sep =
2296   iep = __ pc(); __ push_i();
2297   vep = __ pc();
2298   __ bind(L);
2299   generate_and_dispatch(t);
2300 }
2301 
2302 //-----------------------------------------------------------------------------
2303 
2304 // Make feasible for old CPUs.
2305 void TemplateInterpreterGenerator::count_bytecode() {
2306   __ load_absolute_address(Z_R1_scratch, (address) &BytecodeCounter::_counter_value);
2307   __ add2mem_32(Address(Z_R1_scratch), 1, Z_R0_scratch);
2308 }
2309 
2310 void TemplateInterpreterGenerator::histogram_bytecode(Template * t) {
2311   __ load_absolute_address(Z_R1_scratch, (address)&BytecodeHistogram::_counters[ t->bytecode() ]);
2312   __ add2mem_32(Address(Z_R1_scratch), 1, Z_tmp_1);
2313 }
2314 
2315 #ifndef PRODUCT
2316 address TemplateInterpreterGenerator::generate_trace_code(TosState state) {
2317   address entry = __ pc();
2318   NearLabel counter_below_trace_threshold;
2319 
2320   if (TraceBytecodesAt > 0) {
2321     // Skip runtime call, if the trace threshold is not yet reached.
2322     __ load_absolute_address(Z_tmp_1, (address)&BytecodeCounter::_counter_value);
2323     __ load_absolute_address(Z_tmp_2, (address)&TraceBytecodesAt);
2324     __ load_sized_value(Z_tmp_1, Address(Z_tmp_1), 4, false /*signed*/);
2325     __ load_sized_value(Z_tmp_2, Address(Z_tmp_2), 8, false /*signed*/);
2326     __ compareU64_and_branch(Z_tmp_1, Z_tmp_2, Assembler::bcondLow, counter_below_trace_threshold);
2327   }
2328 
2329   int offset2 = state == ltos || state == dtos ? 2 : 1;
2330 
2331   __ push(state);
2332   // Preserved return pointer is in Z_R14.
2333   // InterpreterRuntime::trace_bytecode() preserved and returns the value passed as second argument.
2334   __ z_lgr(Z_ARG2, Z_R14);
2335   __ z_lg(Z_ARG3, Address(Z_esp, Interpreter::expr_offset_in_bytes(0)));
2336   if (WizardMode) {
2337     __ z_lgr(Z_ARG4, Z_esp); // Trace Z_esp in WizardMode.
2338   } else {
2339     __ z_lg(Z_ARG4, Address(Z_esp, Interpreter::expr_offset_in_bytes(offset2)));
2340   }
2341   __ call_VM(noreg, CAST_FROM_FN_PTR(address, InterpreterRuntime::trace_bytecode), Z_ARG2, Z_ARG3, Z_ARG4);
2342   __ z_lgr(Z_R14, Z_RET); // Estore return address (see above).
2343   __ pop(state);
2344 
2345   __ bind(counter_below_trace_threshold);
2346   __ z_br(Z_R14); // return
2347 
2348   return entry;
2349 }
2350 











2351 void TemplateInterpreterGenerator::histogram_bytecode_pair(Template * t) {
2352   Address  index_addr(Z_tmp_1, (intptr_t) 0);
2353   Register index = Z_tmp_2;
2354 
2355   // Load previous index.
2356   __ load_absolute_address(Z_tmp_1, (address) &BytecodePairHistogram::_index);
2357   __ mem2reg_opt(index, index_addr, false);
2358 
2359   // Mask with current bytecode and store as new previous index.
2360   __ z_srl(index, BytecodePairHistogram::log2_number_of_codes);
2361   __ load_const_optimized(Z_R0_scratch,
2362                           (int)t->bytecode() << BytecodePairHistogram::log2_number_of_codes);
2363   __ z_or(index, Z_R0_scratch);
2364   __ reg2mem_opt(index, index_addr, false);
2365 
2366   // Load counter array's address.
2367   __ z_lgfr(index, index);   // Sign extend for addressing.
2368   __ z_sllg(index, index, LogBytesPerInt);  // index2bytes
2369   __ load_absolute_address(Z_R1_scratch,
2370                            (address) &BytecodePairHistogram::_counters);
< prev index next >