< prev index next >

src/hotspot/cpu/s390/templateInterpreterGenerator_s390.cpp

Print this page

1288     __ save_return_pc();       // Save Z_R14.
1289     __ push_frame_abi160(0);   // Without new frame the RT call could overwrite the saved Z_R14.
1290 
1291     __ call_VM_leaf(runtime_entry);
1292 
1293     __ pop_frame();
1294     __ restore_return_pc();    // Restore Z_R14.
1295   }
1296 
1297   // Pop c2i arguments (if any) off when we return.
1298   __ resize_frame_absolute(Z_R10, Z_R0, true); // Cut the stack back to where the caller started.
1299 
1300   __ z_br(Z_R14);
1301 
1302   return entry;
1303 }
1304 
1305 // Interpreter stub for calling a native method. (asm interpreter).
1306 // This sets up a somewhat different looking stack for calling the
1307 // native method than the typical interpreter frame setup.
1308 address TemplateInterpreterGenerator::generate_native_entry(bool synchronized) {
1309   // Determine code generation flags.
1310   bool inc_counter = UseCompiler || CountCompiledCalls;
1311 
1312   // Interpreter entry for ordinary Java methods.
1313   //
1314   // Registers alive
1315   //   Z_SP          - stack pointer
1316   //   Z_thread      - JavaThread*
1317   //   Z_method      - callee's method (method to be invoked)
1318   //   Z_esp         - operand (or expression) stack pointer of caller. one slot above last arg.
1319   //   Z_R10         - sender sp (before modifications, e.g. by c2i adapter
1320   //                   and as well by generate_fixed_frame below)
1321   //   Z_R14         - return address to caller (call_stub or c2i_adapter)
1322   //
1323   // Registers updated
1324   //   Z_SP          - stack pointer
1325   //   Z_fp          - callee's framepointer
1326   //   Z_esp         - callee's operand stack pointer
1327   //                   points to the slot above the value on top
1328   //   Z_locals      - used to access locals: locals[i] := *(Z_locals - i*BytesPerWord)
1329   //   Z_tos         - integer result, if any
1330   //   z_ftos        - floating point result, if any

1646   // Pop the native method's interpreter frame.
1647   __ pop_interpreter_frame(Z_R14 /*return_pc*/, Z_ARG2/*tmp1*/, Z_ARG3/*tmp2*/);
1648 
1649   // Return to caller.
1650   __ z_br(Z_R14);
1651 
1652   if (inc_counter) {
1653     // Handle overflow of counter and compile method.
1654     __ bind(invocation_counter_overflow);
1655     generate_counter_overflow(continue_after_compile);
1656   }
1657 
1658   BLOCK_COMMENT("} native_entry");
1659 
1660   return entry_point;
1661 }
1662 
1663 //
1664 // Generic interpreted method entry to template interpreter.
1665 //
1666 address TemplateInterpreterGenerator::generate_normal_entry(bool synchronized) {
1667   address entry_point = __ pc();
1668 
1669   bool inc_counter = UseCompiler || CountCompiledCalls;
1670 
1671   // Interpreter entry for ordinary Java methods.
1672   //
1673   // Registers alive
1674   //   Z_SP       - stack pointer
1675   //   Z_thread   - JavaThread*
1676   //   Z_method   - callee's method (method to be invoked)
1677   //   Z_esp      - operand (or expression) stack pointer of caller. one slot above last arg.
1678   //   Z_R10      - sender sp (before modifications, e.g. by c2i adapter
1679   //                           and as well by generate_fixed_frame below)
1680   //   Z_R14      - return address to caller (call_stub or c2i_adapter)
1681   //
1682   // Registers updated
1683   //   Z_SP       - stack pointer
1684   //   Z_fp       - callee's framepointer
1685   //   Z_esp      - callee's operand stack pointer
1686   //                points to the slot above the value on top
1687   //   Z_locals   - used to access locals: locals[i] := *(Z_locals - i*BytesPerWord)
1688   //   Z_tos      - integer result, if any
1689   //   z_ftos     - floating point result, if any

2338 
2339   __ push(state);
2340   // Preserved return pointer is in Z_R14.
2341   // InterpreterRuntime::trace_bytecode() preserved and returns the value passed as second argument.
2342   __ z_lgr(Z_ARG2, Z_R14);
2343   __ z_lg(Z_ARG3, Address(Z_esp, Interpreter::expr_offset_in_bytes(0)));
2344   if (WizardMode) {
2345     __ z_lgr(Z_ARG4, Z_esp); // Trace Z_esp in WizardMode.
2346   } else {
2347     __ z_lg(Z_ARG4, Address(Z_esp, Interpreter::expr_offset_in_bytes(offset2)));
2348   }
2349   __ call_VM(noreg, CAST_FROM_FN_PTR(address, InterpreterRuntime::trace_bytecode), Z_ARG2, Z_ARG3, Z_ARG4);
2350   __ z_lgr(Z_R14, Z_RET); // Estore return address (see above).
2351   __ pop(state);
2352 
2353   __ bind(counter_below_trace_threshold);
2354   __ z_br(Z_R14); // return
2355 
2356   return entry;
2357 }

2358 
2359 // Make feasible for old CPUs.
2360 void TemplateInterpreterGenerator::count_bytecode() {
2361   __ load_absolute_address(Z_R1_scratch, (address) &BytecodeCounter::_counter_value);
2362   __ add2mem_64(Address(Z_R1_scratch), 1, Z_R0_scratch);
2363 }
2364 
2365 void TemplateInterpreterGenerator::histogram_bytecode(Template * t) {
2366   __ load_absolute_address(Z_R1_scratch, (address)&BytecodeHistogram::_counters[ t->bytecode() ]);
2367   __ add2mem_32(Address(Z_R1_scratch), 1, Z_tmp_1);
2368 }
2369 

2370 void TemplateInterpreterGenerator::histogram_bytecode_pair(Template * t) {
2371   Address  index_addr(Z_tmp_1, (intptr_t) 0);
2372   Register index = Z_tmp_2;
2373 
2374   // Load previous index.
2375   __ load_absolute_address(Z_tmp_1, (address) &BytecodePairHistogram::_index);
2376   __ mem2reg_opt(index, index_addr, false);
2377 
2378   // Mask with current bytecode and store as new previous index.
2379   __ z_srl(index, BytecodePairHistogram::log2_number_of_codes);
2380   __ load_const_optimized(Z_R0_scratch,
2381                           (int)t->bytecode() << BytecodePairHistogram::log2_number_of_codes);
2382   __ z_or(index, Z_R0_scratch);
2383   __ reg2mem_opt(index, index_addr, false);
2384 
2385   // Load counter array's address.
2386   __ z_lgfr(index, index);   // Sign extend for addressing.
2387   __ z_sllg(index, index, LogBytesPerInt);  // index2bytes
2388   __ load_absolute_address(Z_R1_scratch,
2389                            (address) &BytecodePairHistogram::_counters);

1288     __ save_return_pc();       // Save Z_R14.
1289     __ push_frame_abi160(0);   // Without new frame the RT call could overwrite the saved Z_R14.
1290 
1291     __ call_VM_leaf(runtime_entry);
1292 
1293     __ pop_frame();
1294     __ restore_return_pc();    // Restore Z_R14.
1295   }
1296 
1297   // Pop c2i arguments (if any) off when we return.
1298   __ resize_frame_absolute(Z_R10, Z_R0, true); // Cut the stack back to where the caller started.
1299 
1300   __ z_br(Z_R14);
1301 
1302   return entry;
1303 }
1304 
1305 // Interpreter stub for calling a native method. (asm interpreter).
1306 // This sets up a somewhat different looking stack for calling the
1307 // native method than the typical interpreter frame setup.
1308 address TemplateInterpreterGenerator::generate_native_entry(bool synchronized, bool runtime_upcalls) {
1309   // Determine code generation flags.
1310   bool inc_counter = (UseCompiler || CountCompiledCalls) && !PreloadOnly;
1311 
1312   // Interpreter entry for ordinary Java methods.
1313   //
1314   // Registers alive
1315   //   Z_SP          - stack pointer
1316   //   Z_thread      - JavaThread*
1317   //   Z_method      - callee's method (method to be invoked)
1318   //   Z_esp         - operand (or expression) stack pointer of caller. one slot above last arg.
1319   //   Z_R10         - sender sp (before modifications, e.g. by c2i adapter
1320   //                   and as well by generate_fixed_frame below)
1321   //   Z_R14         - return address to caller (call_stub or c2i_adapter)
1322   //
1323   // Registers updated
1324   //   Z_SP          - stack pointer
1325   //   Z_fp          - callee's framepointer
1326   //   Z_esp         - callee's operand stack pointer
1327   //                   points to the slot above the value on top
1328   //   Z_locals      - used to access locals: locals[i] := *(Z_locals - i*BytesPerWord)
1329   //   Z_tos         - integer result, if any
1330   //   z_ftos        - floating point result, if any

1646   // Pop the native method's interpreter frame.
1647   __ pop_interpreter_frame(Z_R14 /*return_pc*/, Z_ARG2/*tmp1*/, Z_ARG3/*tmp2*/);
1648 
1649   // Return to caller.
1650   __ z_br(Z_R14);
1651 
1652   if (inc_counter) {
1653     // Handle overflow of counter and compile method.
1654     __ bind(invocation_counter_overflow);
1655     generate_counter_overflow(continue_after_compile);
1656   }
1657 
1658   BLOCK_COMMENT("} native_entry");
1659 
1660   return entry_point;
1661 }
1662 
1663 //
1664 // Generic interpreted method entry to template interpreter.
1665 //
1666 address TemplateInterpreterGenerator::generate_normal_entry(bool synchronized, bool runtime_upcalls) {
1667   address entry_point = __ pc();
1668 
1669   bool inc_counter = (UseCompiler || CountCompiledCalls) && !PreloadOnly;
1670 
1671   // Interpreter entry for ordinary Java methods.
1672   //
1673   // Registers alive
1674   //   Z_SP       - stack pointer
1675   //   Z_thread   - JavaThread*
1676   //   Z_method   - callee's method (method to be invoked)
1677   //   Z_esp      - operand (or expression) stack pointer of caller. one slot above last arg.
1678   //   Z_R10      - sender sp (before modifications, e.g. by c2i adapter
1679   //                           and as well by generate_fixed_frame below)
1680   //   Z_R14      - return address to caller (call_stub or c2i_adapter)
1681   //
1682   // Registers updated
1683   //   Z_SP       - stack pointer
1684   //   Z_fp       - callee's framepointer
1685   //   Z_esp      - callee's operand stack pointer
1686   //                points to the slot above the value on top
1687   //   Z_locals   - used to access locals: locals[i] := *(Z_locals - i*BytesPerWord)
1688   //   Z_tos      - integer result, if any
1689   //   z_ftos     - floating point result, if any

2338 
2339   __ push(state);
2340   // Preserved return pointer is in Z_R14.
2341   // InterpreterRuntime::trace_bytecode() preserved and returns the value passed as second argument.
2342   __ z_lgr(Z_ARG2, Z_R14);
2343   __ z_lg(Z_ARG3, Address(Z_esp, Interpreter::expr_offset_in_bytes(0)));
2344   if (WizardMode) {
2345     __ z_lgr(Z_ARG4, Z_esp); // Trace Z_esp in WizardMode.
2346   } else {
2347     __ z_lg(Z_ARG4, Address(Z_esp, Interpreter::expr_offset_in_bytes(offset2)));
2348   }
2349   __ call_VM(noreg, CAST_FROM_FN_PTR(address, InterpreterRuntime::trace_bytecode), Z_ARG2, Z_ARG3, Z_ARG4);
2350   __ z_lgr(Z_R14, Z_RET); // Estore return address (see above).
2351   __ pop(state);
2352 
2353   __ bind(counter_below_trace_threshold);
2354   __ z_br(Z_R14); // return
2355 
2356   return entry;
2357 }
2358 #endif
2359 
2360 // Make feasible for old CPUs.
2361 void TemplateInterpreterGenerator::count_bytecode() {
2362   __ load_absolute_address(Z_R1_scratch, (address) &BytecodeCounter::_counter_value);
2363   __ add2mem_64(Address(Z_R1_scratch), 1, Z_R0_scratch);
2364 }
2365 
2366 void TemplateInterpreterGenerator::histogram_bytecode(Template * t) {
2367   __ load_absolute_address(Z_R1_scratch, (address)&BytecodeHistogram::_counters[ t->bytecode() ]);
2368   __ add2mem_32(Address(Z_R1_scratch), 1, Z_tmp_1);
2369 }
2370 
2371 #ifndef PRODUCT
2372 void TemplateInterpreterGenerator::histogram_bytecode_pair(Template * t) {
2373   Address  index_addr(Z_tmp_1, (intptr_t) 0);
2374   Register index = Z_tmp_2;
2375 
2376   // Load previous index.
2377   __ load_absolute_address(Z_tmp_1, (address) &BytecodePairHistogram::_index);
2378   __ mem2reg_opt(index, index_addr, false);
2379 
2380   // Mask with current bytecode and store as new previous index.
2381   __ z_srl(index, BytecodePairHistogram::log2_number_of_codes);
2382   __ load_const_optimized(Z_R0_scratch,
2383                           (int)t->bytecode() << BytecodePairHistogram::log2_number_of_codes);
2384   __ z_or(index, Z_R0_scratch);
2385   __ reg2mem_opt(index, index_addr, false);
2386 
2387   // Load counter array's address.
2388   __ z_lgfr(index, index);   // Sign extend for addressing.
2389   __ z_sllg(index, index, LogBytesPerInt);  // index2bytes
2390   __ load_absolute_address(Z_R1_scratch,
2391                            (address) &BytecodePairHistogram::_counters);
< prev index next >