1 /*
2 * Copyright (c) 2003, 2016, Oracle and/or its affiliates. All rights reserved.
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
5 * This code is free software; you can redistribute it and/or modify it
6 * under the terms of the GNU General Public License version 2 only, as
7 * published by the Free Software Foundation.
8 *
9 * This code is distributed in the hope that it will be useful, but WITHOUT
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
12 * version 2 for more details (a copy is included in the LICENSE file that
13 * accompanied this code).
14 *
15 * You should have received a copy of the GNU General Public License version
16 * 2 along with this work; if not, write to the Free Software Foundation,
17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
18 *
19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
20 * or visit www.oracle.com if you need additional information or have any
21 * questions.
22 *
2737 __ st_ptr(I2_ex_oop, G2_thread, in_bytes(Thread::pending_exception_offset()));
2738 __ bind(done);
2739 }
2740
2741 // Tell dtrace about this method exit
2742 {
2743 SkipIfEqual skip_if(
2744 masm, G3_scratch, &DTraceMethodProbes, Assembler::zero);
2745 save_native_result(masm, ret_type, stack_slots);
2746 __ set_metadata_constant(method(), O1);
2747 __ call_VM_leaf(L7_thread_cache,
2748 CAST_FROM_FN_PTR(address, SharedRuntime::dtrace_method_exit),
2749 G2_thread, O1);
2750 restore_native_result(masm, ret_type, stack_slots);
2751 }
2752
2753 // Clear "last Java frame" SP and PC.
2754 __ verify_thread(); // G2_thread must be correct
2755 __ reset_last_Java_frame();
2756
2757 // Unpack oop result
2758 if (ret_type == T_OBJECT || ret_type == T_ARRAY) {
2759 Label L;
2760 __ addcc(G0, I0, G0);
2761 __ brx(Assembler::notZero, true, Assembler::pt, L);
2762 __ delayed()->ld_ptr(I0, 0, I0);
2763 __ mov(G0, I0);
2764 __ bind(L);
2765 __ verify_oop(I0);
2766 }
2767
2768 if (CheckJNICalls) {
2769 // clear_pending_jni_exception_check
2770 __ st_ptr(G0, G2_thread, JavaThread::pending_jni_exception_check_fn_offset());
2771 }
2772
2773 if (!is_critical_native) {
2774 // reset handle block
2775 __ ld_ptr(G2_thread, in_bytes(JavaThread::active_handles_offset()), L5);
2776 __ st(G0, L5, JNIHandleBlock::top_offset_in_bytes());
2777
2778 __ ld_ptr(G2_thread, in_bytes(Thread::pending_exception_offset()), G3_scratch);
2779 check_forward_pending_exception(masm, G3_scratch);
2780 }
2781
2782
2783 // Return
2784
2785 #ifndef _LP64
|
1 /*
2 * Copyright (c) 2003, 2017, Oracle and/or its affiliates. All rights reserved.
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
5 * This code is free software; you can redistribute it and/or modify it
6 * under the terms of the GNU General Public License version 2 only, as
7 * published by the Free Software Foundation.
8 *
9 * This code is distributed in the hope that it will be useful, but WITHOUT
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
12 * version 2 for more details (a copy is included in the LICENSE file that
13 * accompanied this code).
14 *
15 * You should have received a copy of the GNU General Public License version
16 * 2 along with this work; if not, write to the Free Software Foundation,
17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
18 *
19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
20 * or visit www.oracle.com if you need additional information or have any
21 * questions.
22 *
2737 __ st_ptr(I2_ex_oop, G2_thread, in_bytes(Thread::pending_exception_offset()));
2738 __ bind(done);
2739 }
2740
2741 // Tell dtrace about this method exit
2742 {
2743 SkipIfEqual skip_if(
2744 masm, G3_scratch, &DTraceMethodProbes, Assembler::zero);
2745 save_native_result(masm, ret_type, stack_slots);
2746 __ set_metadata_constant(method(), O1);
2747 __ call_VM_leaf(L7_thread_cache,
2748 CAST_FROM_FN_PTR(address, SharedRuntime::dtrace_method_exit),
2749 G2_thread, O1);
2750 restore_native_result(masm, ret_type, stack_slots);
2751 }
2752
2753 // Clear "last Java frame" SP and PC.
2754 __ verify_thread(); // G2_thread must be correct
2755 __ reset_last_Java_frame();
2756
2757 // Unbox oop result, e.g. JNIHandles::resolve value in I0.
2758 if (ret_type == T_OBJECT || ret_type == T_ARRAY) {
2759 Label done, not_weak;
2760 __ br_null(I0, false, Assembler::pn, done); // Use NULL as-is.
2761 __ delayed()->andcc(I0, JNIHandles::weak_tag_mask, G0); // Test for jweak
2762 __ brx(Assembler::zero, true, Assembler::pt, not_weak);
2763 __ delayed()->ld_ptr(I0, 0, I0); // Maybe resolve (untagged) jobject.
2764 // Resolve jweak.
2765 __ ld_ptr(I0, -JNIHandles::weak_tag_value, I0);
2766 #if INCLUDE_ALL_GCS
2767 if (UseG1GC) {
2768 // Copy to O0 because macro doesn't allow pre_val in input reg.
2769 __ mov(I0, O0);
2770 __ g1_write_barrier_pre(noreg /* obj */,
2771 noreg /* index */,
2772 0 /* offset */,
2773 O0 /* pre_val */,
2774 G3_scratch /* tmp */,
2775 true /* preserve_o_regs */);
2776 }
2777 #endif // INCLUDE_ALL_GCS
2778 __ bind(not_weak);
2779 __ verify_oop(I0);
2780 __ bind(done);
2781 }
2782
2783 if (CheckJNICalls) {
2784 // clear_pending_jni_exception_check
2785 __ st_ptr(G0, G2_thread, JavaThread::pending_jni_exception_check_fn_offset());
2786 }
2787
2788 if (!is_critical_native) {
2789 // reset handle block
2790 __ ld_ptr(G2_thread, in_bytes(JavaThread::active_handles_offset()), L5);
2791 __ st(G0, L5, JNIHandleBlock::top_offset_in_bytes());
2792
2793 __ ld_ptr(G2_thread, in_bytes(Thread::pending_exception_offset()), G3_scratch);
2794 check_forward_pending_exception(masm, G3_scratch);
2795 }
2796
2797
2798 // Return
2799
2800 #ifndef _LP64
|