2335
2336 // Jump to the compiled code just as if compiled code was doing it.
2337 // load target address from method:
2338 __ z_lg(Z_R1_scratch, Address(Z_method, Method::from_compiled_offset()));
2339
2340 // Store method into thread->callee_target.
2341 // 6243940: We might end up in handle_wrong_method if
2342 // the callee is deoptimized as we race thru here. If that
2343 // happens we don't want to take a safepoint because the
2344 // caller frame will look interpreted and arguments are now
2345 // "compiled" so it is much better to make this transition
2346 // invisible to the stack walking code. Unfortunately, if
2347 // we try and find the callee by normal means a safepoint
2348 // is possible. So we stash the desired callee in the thread
2349 // and the vm will find it there should this case occur.
2350 __ z_stg(Z_method, thread_(callee_target));
2351
2352 __ z_br(Z_R1_scratch);
2353 }
2354
2355 AdapterHandlerEntry* SharedRuntime::generate_i2c2i_adapters(MacroAssembler *masm,
2356 int total_args_passed,
2357 int comp_args_on_stack,
2358 const BasicType *sig_bt,
2359 const VMRegPair *regs,
2360 AdapterFingerPrint* fingerprint) {
2361 __ align(CodeEntryAlignment);
2362 address i2c_entry = __ pc();
2363 gen_i2c_adapter(masm, total_args_passed, comp_args_on_stack, sig_bt, regs);
2364
2365 address c2i_unverified_entry;
2366
2367 Label skip_fixup;
2368 {
2369 Label ic_miss;
2370
2371 // Out-of-line call to ic_miss handler.
2372 __ call_ic_miss_handler(ic_miss, 0x11, 0, Z_R1_scratch);
2373
2374 // Unverified Entry Point UEP
2375 __ align(CodeEntryAlignment);
2376 c2i_unverified_entry = __ pc();
2377
2378 __ ic_check(2);
2379 __ z_lg(Z_method, Address(Z_inline_cache, CompiledICData::speculated_method_offset()));
2380 // This def MUST MATCH code in gen_c2i_adapter!
2394 Label L_skip_barrier;
2395
2396 { // Bypass the barrier for non-static methods
2397 __ testbit_ushort(Address(Z_method, Method::access_flags_offset()), JVM_ACC_STATIC_BIT);
2398 __ z_bfalse(L_skip_barrier); // non-static
2399 }
2400
2401 Register klass = Z_R11;
2402 __ load_method_holder(klass, Z_method);
2403 __ clinit_barrier(klass, Z_thread, &L_skip_barrier /*L_fast_path*/);
2404
2405 __ load_const_optimized(klass, SharedRuntime::get_handle_wrong_method_stub());
2406 __ z_br(klass);
2407
2408 __ bind(L_skip_barrier);
2409 c2i_no_clinit_check_entry = __ pc();
2410 }
2411
2412 gen_c2i_adapter(masm, total_args_passed, comp_args_on_stack, sig_bt, regs, skip_fixup);
2413
2414 return AdapterHandlerLibrary::new_entry(fingerprint, i2c_entry, c2i_entry, c2i_unverified_entry, c2i_no_clinit_check_entry);
2415 }
2416
2417 // This function returns the adjust size (in number of words) to a c2i adapter
2418 // activation for use during deoptimization.
2419 //
2420 // Actually only compiled frames need to be adjusted, but it
2421 // doesn't harm to adjust entry and interpreter frames, too.
2422 //
2423 int Deoptimization::last_frame_adjust(int callee_parameters, int callee_locals) {
2424 assert(callee_locals >= callee_parameters,
2425 "test and remove; got more parms than locals");
2426 // Handle the abi adjustment here instead of doing it in push_skeleton_frames.
2427 return (callee_locals - callee_parameters) * Interpreter::stackElementWords +
2428 frame::z_parent_ijava_frame_abi_size / BytesPerWord;
2429 }
2430
2431 uint SharedRuntime::in_preserve_stack_slots() {
2432 return frame::jit_in_preserve_size_in_4_byte_units;
2433 }
2434
|
2335
2336 // Jump to the compiled code just as if compiled code was doing it.
2337 // load target address from method:
2338 __ z_lg(Z_R1_scratch, Address(Z_method, Method::from_compiled_offset()));
2339
2340 // Store method into thread->callee_target.
2341 // 6243940: We might end up in handle_wrong_method if
2342 // the callee is deoptimized as we race thru here. If that
2343 // happens we don't want to take a safepoint because the
2344 // caller frame will look interpreted and arguments are now
2345 // "compiled" so it is much better to make this transition
2346 // invisible to the stack walking code. Unfortunately, if
2347 // we try and find the callee by normal means a safepoint
2348 // is possible. So we stash the desired callee in the thread
2349 // and the vm will find it there should this case occur.
2350 __ z_stg(Z_method, thread_(callee_target));
2351
2352 __ z_br(Z_R1_scratch);
2353 }
2354
2355 void SharedRuntime::generate_i2c2i_adapters(MacroAssembler *masm,
2356 int total_args_passed,
2357 int comp_args_on_stack,
2358 const BasicType *sig_bt,
2359 const VMRegPair *regs,
2360 AdapterHandlerEntry* handler) {
2361 __ align(CodeEntryAlignment);
2362 address i2c_entry = __ pc();
2363 gen_i2c_adapter(masm, total_args_passed, comp_args_on_stack, sig_bt, regs);
2364
2365 address c2i_unverified_entry;
2366
2367 Label skip_fixup;
2368 {
2369 Label ic_miss;
2370
2371 // Out-of-line call to ic_miss handler.
2372 __ call_ic_miss_handler(ic_miss, 0x11, 0, Z_R1_scratch);
2373
2374 // Unverified Entry Point UEP
2375 __ align(CodeEntryAlignment);
2376 c2i_unverified_entry = __ pc();
2377
2378 __ ic_check(2);
2379 __ z_lg(Z_method, Address(Z_inline_cache, CompiledICData::speculated_method_offset()));
2380 // This def MUST MATCH code in gen_c2i_adapter!
2394 Label L_skip_barrier;
2395
2396 { // Bypass the barrier for non-static methods
2397 __ testbit_ushort(Address(Z_method, Method::access_flags_offset()), JVM_ACC_STATIC_BIT);
2398 __ z_bfalse(L_skip_barrier); // non-static
2399 }
2400
2401 Register klass = Z_R11;
2402 __ load_method_holder(klass, Z_method);
2403 __ clinit_barrier(klass, Z_thread, &L_skip_barrier /*L_fast_path*/);
2404
2405 __ load_const_optimized(klass, SharedRuntime::get_handle_wrong_method_stub());
2406 __ z_br(klass);
2407
2408 __ bind(L_skip_barrier);
2409 c2i_no_clinit_check_entry = __ pc();
2410 }
2411
2412 gen_c2i_adapter(masm, total_args_passed, comp_args_on_stack, sig_bt, regs, skip_fixup);
2413
2414 handler->set_entry_points(i2c_entry, c2i_entry, c2i_unverified_entry, c2i_no_clinit_check_entry);
2415 return;
2416 }
2417
2418 // This function returns the adjust size (in number of words) to a c2i adapter
2419 // activation for use during deoptimization.
2420 //
2421 // Actually only compiled frames need to be adjusted, but it
2422 // doesn't harm to adjust entry and interpreter frames, too.
2423 //
2424 int Deoptimization::last_frame_adjust(int callee_parameters, int callee_locals) {
2425 assert(callee_locals >= callee_parameters,
2426 "test and remove; got more parms than locals");
2427 // Handle the abi adjustment here instead of doing it in push_skeleton_frames.
2428 return (callee_locals - callee_parameters) * Interpreter::stackElementWords +
2429 frame::z_parent_ijava_frame_abi_size / BytesPerWord;
2430 }
2431
2432 uint SharedRuntime::in_preserve_stack_slots() {
2433 return frame::jit_in_preserve_size_in_4_byte_units;
2434 }
2435
|