src/cpu/sparc/vm/sharedRuntime_sparc.cpp

Print this page
rev 6361 : [mq]: 8041934-method_exit


2640     __ restore_thread(L7_thread_cache); // restore G2_thread
2641 
2642 #ifdef ASSERT
2643     { Label L;
2644     __ ld_ptr(G2_thread, in_bytes(Thread::pending_exception_offset()), O0);
2645     __ br_null_short(O0, Assembler::pt, L);
2646     __ stop("no pending exception allowed on exit from IR::monitorexit");
2647     __ bind(L);
2648     }
2649 #endif
2650     restore_native_result(masm, ret_type, stack_slots);
2651     // check_forward_pending_exception jump to forward_exception if any pending
2652     // exception is set.  The forward_exception routine expects to see the
2653     // exception in pending_exception and not in a register.  Kind of clumsy,
2654     // since all folks who branch to forward_exception must have tested
2655     // pending_exception first and hence have it in a register already.
2656     __ st_ptr(I2_ex_oop, G2_thread, in_bytes(Thread::pending_exception_offset()));
2657     __ bind(done);
2658   }
2659 






















2660   // Tell dtrace about this method exit
2661   {
2662     SkipIfEqual skip_if(
2663       masm, G3_scratch, &DTraceMethodProbes, Assembler::zero);
2664     save_native_result(masm, ret_type, stack_slots);
2665     __ set_metadata_constant(method(), O1);
2666     __ call_VM_leaf(L7_thread_cache,
2667        CAST_FROM_FN_PTR(address, SharedRuntime::dtrace_method_exit),
2668        G2_thread, O1);
2669     restore_native_result(masm, ret_type, stack_slots);
2670   }
2671 
2672   // Clear "last Java frame" SP and PC.
2673   __ verify_thread(); // G2_thread must be correct
2674   __ reset_last_Java_frame();
2675 
2676   // Unpack oop result
2677   if (ret_type == T_OBJECT || ret_type == T_ARRAY) {
2678       Label L;
2679       __ addcc(G0, I0, G0);




2640     __ restore_thread(L7_thread_cache); // restore G2_thread
2641 
2642 #ifdef ASSERT
2643     { Label L;
2644     __ ld_ptr(G2_thread, in_bytes(Thread::pending_exception_offset()), O0);
2645     __ br_null_short(O0, Assembler::pt, L);
2646     __ stop("no pending exception allowed on exit from IR::monitorexit");
2647     __ bind(L);
2648     }
2649 #endif
2650     restore_native_result(masm, ret_type, stack_slots);
2651     // check_forward_pending_exception jump to forward_exception if any pending
2652     // exception is set.  The forward_exception routine expects to see the
2653     // exception in pending_exception and not in a register.  Kind of clumsy,
2654     // since all folks who branch to forward_exception must have tested
2655     // pending_exception first and hence have it in a register already.
2656     __ st_ptr(I2_ex_oop, G2_thread, in_bytes(Thread::pending_exception_offset()));
2657     __ bind(done);
2658   }
2659 
2660   {
2661     // Normally we do not post method_entry and method_exit events from
2662     // compiled code, only from the interpreter. If method_entry/exit
2663     // events are switched on at runtime, we will deoptimize everything
2664     // (see VM_EnterInterpOnlyMode) on the stack and call method_entry/exit
2665     // from the interpreter. But when we do that, we will not deoptimize
2666     // this native wrapper frame. Thus we have an extra check here to see
2667     // if we are now in interp_only_mode and in that case we do the jvmti
2668     // callback.
2669     Label skip_jvmti_method_exit;
2670     __ ld(G2_thread, JavaThread::interp_only_mode_offset(), G3_scratch);
2671     __ cmp_and_br_short(G3_scratch, 0, Assembler::zero, Assembler::pt, skip_jvmti_method_exit);
2672 
2673     save_native_result(masm, ret_type, stack_slots);
2674     __ set_metadata_constant(method(), O1);
2675     __ call_VM_leaf(L7_thread_cache,
2676        CAST_FROM_FN_PTR(address, SharedRuntime::jvmti_method_exit),
2677        G2_thread, O1);
2678     restore_native_result(masm, ret_type, stack_slots);
2679     __ bind(skip_jvmti_method_exit);
2680   }
2681 
2682   // Tell dtrace about this method exit
2683   {
2684     SkipIfEqual skip_if(
2685       masm, G3_scratch, &DTraceMethodProbes, Assembler::zero);
2686     save_native_result(masm, ret_type, stack_slots);
2687     __ set_metadata_constant(method(), O1);
2688     __ call_VM_leaf(L7_thread_cache,
2689        CAST_FROM_FN_PTR(address, SharedRuntime::dtrace_method_exit),
2690        G2_thread, O1);
2691     restore_native_result(masm, ret_type, stack_slots);
2692   }
2693 
2694   // Clear "last Java frame" SP and PC.
2695   __ verify_thread(); // G2_thread must be correct
2696   __ reset_last_Java_frame();
2697 
2698   // Unpack oop result
2699   if (ret_type == T_OBJECT || ret_type == T_ARRAY) {
2700       Label L;
2701       __ addcc(G0, I0, G0);