1301 __ save_return_pc(); // Save Z_R14.
1302 __ push_frame_abi160(0); // Without new frame the RT call could overwrite the saved Z_R14.
1303
1304 __ call_VM_leaf(runtime_entry);
1305
1306 __ pop_frame();
1307 __ restore_return_pc(); // Restore Z_R14.
1308 }
1309
1310 // Pop c2i arguments (if any) off when we return.
1311 __ resize_frame_absolute(Z_R10, Z_R0, true); // Cut the stack back to where the caller started.
1312
1313 __ z_br(Z_R14);
1314
1315 return entry;
1316 }
1317
1318 // Interpreter stub for calling a native method. (asm interpreter).
1319 // This sets up a somewhat different looking stack for calling the
1320 // native method than the typical interpreter frame setup.
1321 address TemplateInterpreterGenerator::generate_native_entry(bool synchronized) {
1322 // Determine code generation flags.
1323 bool inc_counter = UseCompiler || CountCompiledCalls;
1324
1325 // Interpreter entry for ordinary Java methods.
1326 //
1327 // Registers alive
1328 // Z_SP - stack pointer
1329 // Z_thread - JavaThread*
1330 // Z_method - callee's method (method to be invoked)
1331 // Z_esp - operand (or expression) stack pointer of caller. one slot above last arg.
1332 // Z_R10 - sender sp (before modifications, e.g. by c2i adapter
1333 // and as well by generate_fixed_frame below)
1334 // Z_R14 - return address to caller (call_stub or c2i_adapter)
1335 //
1336 // Registers updated
1337 // Z_SP - stack pointer
1338 // Z_fp - callee's framepointer
1339 // Z_esp - callee's operand stack pointer
1340 // points to the slot above the value on top
1341 // Z_locals - used to access locals: locals[i] := *(Z_locals - i*BytesPerWord)
1342 // Z_tos - integer result, if any
1343 // z_ftos - floating point result, if any
1659 // Pop the native method's interpreter frame.
1660 __ pop_interpreter_frame(Z_R14 /*return_pc*/, Z_ARG2/*tmp1*/, Z_ARG3/*tmp2*/);
1661
1662 // Return to caller.
1663 __ z_br(Z_R14);
1664
1665 if (inc_counter) {
1666 // Handle overflow of counter and compile method.
1667 __ bind(invocation_counter_overflow);
1668 generate_counter_overflow(continue_after_compile);
1669 }
1670
1671 BLOCK_COMMENT("} native_entry");
1672
1673 return entry_point;
1674 }
1675
1676 //
1677 // Generic interpreted method entry to template interpreter.
1678 //
1679 address TemplateInterpreterGenerator::generate_normal_entry(bool synchronized) {
1680 address entry_point = __ pc();
1681
1682 bool inc_counter = UseCompiler || CountCompiledCalls;
1683
1684 // Interpreter entry for ordinary Java methods.
1685 //
1686 // Registers alive
1687 // Z_SP - stack pointer
1688 // Z_thread - JavaThread*
1689 // Z_method - callee's method (method to be invoked)
1690 // Z_esp - operand (or expression) stack pointer of caller. one slot above last arg.
1691 // Z_R10 - sender sp (before modifications, e.g. by c2i adapter
1692 // and as well by generate_fixed_frame below)
1693 // Z_R14 - return address to caller (call_stub or c2i_adapter)
1694 //
1695 // Registers updated
1696 // Z_SP - stack pointer
1697 // Z_fp - callee's framepointer
1698 // Z_esp - callee's operand stack pointer
1699 // points to the slot above the value on top
1700 // Z_locals - used to access locals: locals[i] := *(Z_locals - i*BytesPerWord)
1701 // Z_tos - integer result, if any
1702 // z_ftos - floating point result, if any
2347
2348 __ push(state);
2349 // Preserved return pointer is in Z_R14.
2350 // InterpreterRuntime::trace_bytecode() preserved and returns the value passed as second argument.
2351 __ z_lgr(Z_ARG2, Z_R14);
2352 __ z_lg(Z_ARG3, Address(Z_esp, Interpreter::expr_offset_in_bytes(0)));
2353 if (WizardMode) {
2354 __ z_lgr(Z_ARG4, Z_esp); // Trace Z_esp in WizardMode.
2355 } else {
2356 __ z_lg(Z_ARG4, Address(Z_esp, Interpreter::expr_offset_in_bytes(offset2)));
2357 }
2358 __ call_VM(noreg, CAST_FROM_FN_PTR(address, InterpreterRuntime::trace_bytecode), Z_ARG2, Z_ARG3, Z_ARG4);
2359 __ z_lgr(Z_R14, Z_RET); // Estore return address (see above).
2360 __ pop(state);
2361
2362 __ bind(counter_below_trace_threshold);
2363 __ z_br(Z_R14); // return
2364
2365 return entry;
2366 }
2367
2368 // Make feasible for old CPUs.
2369 void TemplateInterpreterGenerator::count_bytecode() {
2370 __ load_absolute_address(Z_R1_scratch, (address) &BytecodeCounter::_counter_value);
2371 __ add2mem_64(Address(Z_R1_scratch), 1, Z_R0_scratch);
2372 }
2373
2374 void TemplateInterpreterGenerator::histogram_bytecode(Template * t) {
2375 __ load_absolute_address(Z_R1_scratch, (address)&BytecodeHistogram::_counters[ t->bytecode() ]);
2376 __ add2mem_32(Address(Z_R1_scratch), 1, Z_tmp_1);
2377 }
2378
2379 void TemplateInterpreterGenerator::histogram_bytecode_pair(Template * t) {
2380 Address index_addr(Z_tmp_1, (intptr_t) 0);
2381 Register index = Z_tmp_2;
2382
2383 // Load previous index.
2384 __ load_absolute_address(Z_tmp_1, (address) &BytecodePairHistogram::_index);
2385 __ mem2reg_opt(index, index_addr, false);
2386
2387 // Mask with current bytecode and store as new previous index.
2388 __ z_srl(index, BytecodePairHistogram::log2_number_of_codes);
2389 __ load_const_optimized(Z_R0_scratch,
2390 (int)t->bytecode() << BytecodePairHistogram::log2_number_of_codes);
2391 __ z_or(index, Z_R0_scratch);
2392 __ reg2mem_opt(index, index_addr, false);
2393
2394 // Load counter array's address.
2395 __ z_lgfr(index, index); // Sign extend for addressing.
2396 __ z_sllg(index, index, LogBytesPerInt); // index2bytes
2397 __ load_absolute_address(Z_R1_scratch,
2398 (address) &BytecodePairHistogram::_counters);
|
1301 __ save_return_pc(); // Save Z_R14.
1302 __ push_frame_abi160(0); // Without new frame the RT call could overwrite the saved Z_R14.
1303
1304 __ call_VM_leaf(runtime_entry);
1305
1306 __ pop_frame();
1307 __ restore_return_pc(); // Restore Z_R14.
1308 }
1309
1310 // Pop c2i arguments (if any) off when we return.
1311 __ resize_frame_absolute(Z_R10, Z_R0, true); // Cut the stack back to where the caller started.
1312
1313 __ z_br(Z_R14);
1314
1315 return entry;
1316 }
1317
1318 // Interpreter stub for calling a native method. (asm interpreter).
1319 // This sets up a somewhat different looking stack for calling the
1320 // native method than the typical interpreter frame setup.
1321 address TemplateInterpreterGenerator::generate_native_entry(bool synchronized, bool runtime_upcalls) {
1322 // Determine code generation flags.
1323 bool inc_counter = (UseCompiler || CountCompiledCalls) && !PreloadOnly;
1324
1325 // Interpreter entry for ordinary Java methods.
1326 //
1327 // Registers alive
1328 // Z_SP - stack pointer
1329 // Z_thread - JavaThread*
1330 // Z_method - callee's method (method to be invoked)
1331 // Z_esp - operand (or expression) stack pointer of caller. one slot above last arg.
1332 // Z_R10 - sender sp (before modifications, e.g. by c2i adapter
1333 // and as well by generate_fixed_frame below)
1334 // Z_R14 - return address to caller (call_stub or c2i_adapter)
1335 //
1336 // Registers updated
1337 // Z_SP - stack pointer
1338 // Z_fp - callee's framepointer
1339 // Z_esp - callee's operand stack pointer
1340 // points to the slot above the value on top
1341 // Z_locals - used to access locals: locals[i] := *(Z_locals - i*BytesPerWord)
1342 // Z_tos - integer result, if any
1343 // z_ftos - floating point result, if any
1659 // Pop the native method's interpreter frame.
1660 __ pop_interpreter_frame(Z_R14 /*return_pc*/, Z_ARG2/*tmp1*/, Z_ARG3/*tmp2*/);
1661
1662 // Return to caller.
1663 __ z_br(Z_R14);
1664
1665 if (inc_counter) {
1666 // Handle overflow of counter and compile method.
1667 __ bind(invocation_counter_overflow);
1668 generate_counter_overflow(continue_after_compile);
1669 }
1670
1671 BLOCK_COMMENT("} native_entry");
1672
1673 return entry_point;
1674 }
1675
1676 //
1677 // Generic interpreted method entry to template interpreter.
1678 //
1679 address TemplateInterpreterGenerator::generate_normal_entry(bool synchronized, bool runtime_upcalls) {
1680 address entry_point = __ pc();
1681
1682 bool inc_counter = (UseCompiler || CountCompiledCalls) && !PreloadOnly;
1683
1684 // Interpreter entry for ordinary Java methods.
1685 //
1686 // Registers alive
1687 // Z_SP - stack pointer
1688 // Z_thread - JavaThread*
1689 // Z_method - callee's method (method to be invoked)
1690 // Z_esp - operand (or expression) stack pointer of caller. one slot above last arg.
1691 // Z_R10 - sender sp (before modifications, e.g. by c2i adapter
1692 // and as well by generate_fixed_frame below)
1693 // Z_R14 - return address to caller (call_stub or c2i_adapter)
1694 //
1695 // Registers updated
1696 // Z_SP - stack pointer
1697 // Z_fp - callee's framepointer
1698 // Z_esp - callee's operand stack pointer
1699 // points to the slot above the value on top
1700 // Z_locals - used to access locals: locals[i] := *(Z_locals - i*BytesPerWord)
1701 // Z_tos - integer result, if any
1702 // z_ftos - floating point result, if any
2347
2348 __ push(state);
2349 // Preserved return pointer is in Z_R14.
2350 // InterpreterRuntime::trace_bytecode() preserved and returns the value passed as second argument.
2351 __ z_lgr(Z_ARG2, Z_R14);
2352 __ z_lg(Z_ARG3, Address(Z_esp, Interpreter::expr_offset_in_bytes(0)));
2353 if (WizardMode) {
2354 __ z_lgr(Z_ARG4, Z_esp); // Trace Z_esp in WizardMode.
2355 } else {
2356 __ z_lg(Z_ARG4, Address(Z_esp, Interpreter::expr_offset_in_bytes(offset2)));
2357 }
2358 __ call_VM(noreg, CAST_FROM_FN_PTR(address, InterpreterRuntime::trace_bytecode), Z_ARG2, Z_ARG3, Z_ARG4);
2359 __ z_lgr(Z_R14, Z_RET); // Estore return address (see above).
2360 __ pop(state);
2361
2362 __ bind(counter_below_trace_threshold);
2363 __ z_br(Z_R14); // return
2364
2365 return entry;
2366 }
2367 #endif
2368
2369 // Make feasible for old CPUs.
2370 void TemplateInterpreterGenerator::count_bytecode() {
2371 __ load_absolute_address(Z_R1_scratch, (address) &BytecodeCounter::_counter_value);
2372 __ add2mem_64(Address(Z_R1_scratch), 1, Z_R0_scratch);
2373 }
2374
2375 void TemplateInterpreterGenerator::histogram_bytecode(Template * t) {
2376 __ load_absolute_address(Z_R1_scratch, (address)&BytecodeHistogram::_counters[ t->bytecode() ]);
2377 __ add2mem_32(Address(Z_R1_scratch), 1, Z_tmp_1);
2378 }
2379
2380 #ifndef PRODUCT
2381 void TemplateInterpreterGenerator::histogram_bytecode_pair(Template * t) {
2382 Address index_addr(Z_tmp_1, (intptr_t) 0);
2383 Register index = Z_tmp_2;
2384
2385 // Load previous index.
2386 __ load_absolute_address(Z_tmp_1, (address) &BytecodePairHistogram::_index);
2387 __ mem2reg_opt(index, index_addr, false);
2388
2389 // Mask with current bytecode and store as new previous index.
2390 __ z_srl(index, BytecodePairHistogram::log2_number_of_codes);
2391 __ load_const_optimized(Z_R0_scratch,
2392 (int)t->bytecode() << BytecodePairHistogram::log2_number_of_codes);
2393 __ z_or(index, Z_R0_scratch);
2394 __ reg2mem_opt(index, index_addr, false);
2395
2396 // Load counter array's address.
2397 __ z_lgfr(index, index); // Sign extend for addressing.
2398 __ z_sllg(index, index, LogBytesPerInt); // index2bytes
2399 __ load_absolute_address(Z_R1_scratch,
2400 (address) &BytecodePairHistogram::_counters);
|