1 /*
2 * Copyright (c) 2003, 2016, Oracle and/or its affiliates. All rights reserved.
3 * Copyright (c) 2014, 2015, Red Hat Inc. All rights reserved.
4 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 *
6 * This code is free software; you can redistribute it and/or modify it
7 * under the terms of the GNU General Public License version 2 only, as
8 * published by the Free Software Foundation.
9 *
10 * This code is distributed in the hope that it will be useful, but WITHOUT
11 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
12 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
13 * version 2 for more details (a copy is included in the LICENSE file that
14 * accompanied this code).
15 *
16 * You should have received a copy of the GNU General Public License version
17 * 2 along with this work; if not, write to the Free Software Foundation,
18 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
19 *
20 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
21 * or visit www.oracle.com if you need additional information or have any
22 * questions.
2035 // slow path re-enters here
2036 __ bind(unlock_done);
2037 if (ret_type != T_FLOAT && ret_type != T_DOUBLE && ret_type != T_VOID) {
2038 restore_native_result(masm, ret_type, stack_slots);
2039 }
2040
2041 __ bind(done);
2042 }
2043
2044 Label dtrace_method_exit, dtrace_method_exit_done;
2045 {
2046 unsigned long offset;
2047 __ adrp(rscratch1, ExternalAddress((address)&DTraceMethodProbes), offset);
2048 __ ldrb(rscratch1, Address(rscratch1, offset));
2049 __ cbnzw(rscratch1, dtrace_method_exit);
2050 __ bind(dtrace_method_exit_done);
2051 }
2052
2053 __ reset_last_Java_frame(false);
2054
2055 // Unpack oop result
2056 if (ret_type == T_OBJECT || ret_type == T_ARRAY) {
2057 Label L;
2058 __ cbz(r0, L);
2059 __ ldr(r0, Address(r0, 0));
2060 __ bind(L);
2061 __ verify_oop(r0);
2062 }
2063
2064 if (CheckJNICalls) {
2065 // clear_pending_jni_exception_check
2066 __ str(zr, Address(rthread, JavaThread::pending_jni_exception_check_fn_offset()));
2067 }
2068
2069 if (!is_critical_native) {
2070 // reset handle block
2071 __ ldr(r2, Address(rthread, JavaThread::active_handles_offset()));
2072 __ str(zr, Address(r2, JNIHandleBlock::top_offset_in_bytes()));
2073 }
2074
2075 __ leave();
2076
2077 if (!is_critical_native) {
2078 // Any exception pending?
2079 __ ldr(rscratch1, Address(rthread, in_bytes(Thread::pending_exception_offset())));
2080 __ cbnz(rscratch1, exception_pending);
2081 }
|
1 /*
2 * Copyright (c) 2003, 2017, Oracle and/or its affiliates. All rights reserved.
3 * Copyright (c) 2014, 2015, Red Hat Inc. All rights reserved.
4 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 *
6 * This code is free software; you can redistribute it and/or modify it
7 * under the terms of the GNU General Public License version 2 only, as
8 * published by the Free Software Foundation.
9 *
10 * This code is distributed in the hope that it will be useful, but WITHOUT
11 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
12 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
13 * version 2 for more details (a copy is included in the LICENSE file that
14 * accompanied this code).
15 *
16 * You should have received a copy of the GNU General Public License version
17 * 2 along with this work; if not, write to the Free Software Foundation,
18 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
19 *
20 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
21 * or visit www.oracle.com if you need additional information or have any
22 * questions.
2035 // slow path re-enters here
2036 __ bind(unlock_done);
2037 if (ret_type != T_FLOAT && ret_type != T_DOUBLE && ret_type != T_VOID) {
2038 restore_native_result(masm, ret_type, stack_slots);
2039 }
2040
2041 __ bind(done);
2042 }
2043
2044 Label dtrace_method_exit, dtrace_method_exit_done;
2045 {
2046 unsigned long offset;
2047 __ adrp(rscratch1, ExternalAddress((address)&DTraceMethodProbes), offset);
2048 __ ldrb(rscratch1, Address(rscratch1, offset));
2049 __ cbnzw(rscratch1, dtrace_method_exit);
2050 __ bind(dtrace_method_exit_done);
2051 }
2052
2053 __ reset_last_Java_frame(false);
2054
2055 // Unbox oop result, e.g. JNIHandles::resolve result.
2056 if (ret_type == T_OBJECT || ret_type == T_ARRAY) {
2057 Label done, not_weak;
2058 __ cbz(r0, done); // Use NULL as-is.
2059 STATIC_ASSERT(JNIHandles::weak_tag_mask == 1u);
2060 __ tbz(r0, 0, not_weak); // Test for jweak tag.
2061 // Resolve jweak.
2062 __ ldr(r0, Address(r0, -JNIHandles::weak_tag_value));
2063 __ verify_oop(r0);
2064 #if INCLUDE_ALL_GCS
2065 if (UseG1GC) {
2066 __ g1_write_barrier_pre(noreg /* obj */,
2067 r0 /* pre_val */,
2068 rthread /* thread */,
2069 rscratch1 /* tmp */,
2070 true /* tosca_live */,
2071 true /* expand_call */);
2072 }
2073 #endif // INCLUDE_ALL_GCS
2074 __ b(done);
2075 __ bind(not_weak);
2076 // Resolve (untagged) jobject.
2077 __ ldr(r0, Address(r0, 0));
2078 __ verify_oop(r0);
2079 __ bind(done);
2080 }
2081
2082 if (CheckJNICalls) {
2083 // clear_pending_jni_exception_check
2084 __ str(zr, Address(rthread, JavaThread::pending_jni_exception_check_fn_offset()));
2085 }
2086
2087 if (!is_critical_native) {
2088 // reset handle block
2089 __ ldr(r2, Address(rthread, JavaThread::active_handles_offset()));
2090 __ str(zr, Address(r2, JNIHandleBlock::top_offset_in_bytes()));
2091 }
2092
2093 __ leave();
2094
2095 if (!is_critical_native) {
2096 // Any exception pending?
2097 __ ldr(rscratch1, Address(rthread, in_bytes(Thread::pending_exception_offset())));
2098 __ cbnz(rscratch1, exception_pending);
2099 }
|