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