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