2504 }
2505
2506 // Tell dtrace about this method exit
2507 {
2508 SkipIfEqual skip_if(
2509 masm, G3_scratch, &DTraceMethodProbes, Assembler::zero);
2510 save_native_result(masm, ret_type, stack_slots);
2511 __ set_metadata_constant(method(), O1);
2512 __ call_VM_leaf(L7_thread_cache,
2513 CAST_FROM_FN_PTR(address, SharedRuntime::dtrace_method_exit),
2514 G2_thread, O1);
2515 restore_native_result(masm, ret_type, stack_slots);
2516 }
2517
2518 // Clear "last Java frame" SP and PC.
2519 __ verify_thread(); // G2_thread must be correct
2520 __ reset_last_Java_frame();
2521
2522 // Unbox oop result, e.g. JNIHandles::resolve value in I0.
2523 if (ret_type == T_OBJECT || ret_type == T_ARRAY) {
2524 Label done, not_weak;
2525 __ br_null(I0, false, Assembler::pn, done); // Use NULL as-is.
2526 __ delayed()->andcc(I0, JNIHandles::weak_tag_mask, G0); // Test for jweak
2527 __ brx(Assembler::zero, true, Assembler::pt, not_weak);
2528 __ delayed()->ld_ptr(I0, 0, I0); // Maybe resolve (untagged) jobject.
2529 // Resolve jweak.
2530 __ ld_ptr(I0, -JNIHandles::weak_tag_value, I0);
2531 #if INCLUDE_ALL_GCS
2532 if (UseG1GC) {
2533 // Copy to O0 because macro doesn't allow pre_val in input reg.
2534 __ mov(I0, O0);
2535 __ g1_write_barrier_pre(noreg /* obj */,
2536 noreg /* index */,
2537 0 /* offset */,
2538 O0 /* pre_val */,
2539 G3_scratch /* tmp */,
2540 true /* preserve_o_regs */);
2541 }
2542 #endif // INCLUDE_ALL_GCS
2543 __ bind(not_weak);
2544 __ verify_oop(I0);
2545 __ bind(done);
2546 }
2547
2548 if (CheckJNICalls) {
2549 // clear_pending_jni_exception_check
2550 __ st_ptr(G0, G2_thread, JavaThread::pending_jni_exception_check_fn_offset());
2551 }
2552
2553 if (!is_critical_native) {
2554 // reset handle block
2555 __ ld_ptr(G2_thread, in_bytes(JavaThread::active_handles_offset()), L5);
2556 __ st(G0, L5, JNIHandleBlock::top_offset_in_bytes());
2557
2558 __ ld_ptr(G2_thread, in_bytes(Thread::pending_exception_offset()), G3_scratch);
2559 check_forward_pending_exception(masm, G3_scratch);
2560 }
2561
2562
2563 // Return
2564
2565 __ ret();
|
2504 }
2505
2506 // Tell dtrace about this method exit
2507 {
2508 SkipIfEqual skip_if(
2509 masm, G3_scratch, &DTraceMethodProbes, Assembler::zero);
2510 save_native_result(masm, ret_type, stack_slots);
2511 __ set_metadata_constant(method(), O1);
2512 __ call_VM_leaf(L7_thread_cache,
2513 CAST_FROM_FN_PTR(address, SharedRuntime::dtrace_method_exit),
2514 G2_thread, O1);
2515 restore_native_result(masm, ret_type, stack_slots);
2516 }
2517
2518 // Clear "last Java frame" SP and PC.
2519 __ verify_thread(); // G2_thread must be correct
2520 __ reset_last_Java_frame();
2521
2522 // Unbox oop result, e.g. JNIHandles::resolve value in I0.
2523 if (ret_type == T_OBJECT || ret_type == T_ARRAY) {
2524 __ mov(I0, O0);
2525 __ resolve_jobject(O0, G3_scratch);
2526 __ mov(O0, I0);
2527 }
2528
2529 if (CheckJNICalls) {
2530 // clear_pending_jni_exception_check
2531 __ st_ptr(G0, G2_thread, JavaThread::pending_jni_exception_check_fn_offset());
2532 }
2533
2534 if (!is_critical_native) {
2535 // reset handle block
2536 __ ld_ptr(G2_thread, in_bytes(JavaThread::active_handles_offset()), L5);
2537 __ st(G0, L5, JNIHandleBlock::top_offset_in_bytes());
2538
2539 __ ld_ptr(G2_thread, in_bytes(Thread::pending_exception_offset()), G3_scratch);
2540 check_forward_pending_exception(masm, G3_scratch);
2541 }
2542
2543
2544 // Return
2545
2546 __ ret();
|