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 *
2209
2210 __ bind(done);
2211
2212 }
2213
2214 {
2215 SkipIfEqual skip_if(masm, &DTraceMethodProbes, 0);
2216 // Tell dtrace about this method exit
2217 save_native_result(masm, ret_type, stack_slots);
2218 __ mov_metadata(rax, method());
2219 __ call_VM_leaf(
2220 CAST_FROM_FN_PTR(address, SharedRuntime::dtrace_method_exit),
2221 thread, rax);
2222 restore_native_result(masm, ret_type, stack_slots);
2223 }
2224
2225 // We can finally stop using that last_Java_frame we setup ages ago
2226
2227 __ reset_last_Java_frame(thread, false);
2228
2229 // Unpack oop result
2230 if (ret_type == T_OBJECT || ret_type == T_ARRAY) {
2231 Label L;
2232 __ cmpptr(rax, (int32_t)NULL_WORD);
2233 __ jcc(Assembler::equal, L);
2234 __ movptr(rax, Address(rax, 0));
2235 __ bind(L);
2236 __ verify_oop(rax);
2237 }
2238
2239 if (CheckJNICalls) {
2240 // clear_pending_jni_exception_check
2241 __ movptr(Address(thread, JavaThread::pending_jni_exception_check_fn_offset()), NULL_WORD);
2242 }
2243
2244 if (!is_critical_native) {
2245 // reset handle block
2246 __ movptr(rcx, Address(thread, JavaThread::active_handles_offset()));
2247 __ movl(Address(rcx, JNIHandleBlock::top_offset_in_bytes()), NULL_WORD);
2248
2249 // Any exception pending?
2250 __ cmpptr(Address(thread, in_bytes(Thread::pending_exception_offset())), (int32_t)NULL_WORD);
2251 __ jcc(Assembler::notEqual, exception_pending);
2252 }
2253
2254 // no exception, we're almost done
2255
2256 // check that only result value is on FPU stack
|
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 *
2209
2210 __ bind(done);
2211
2212 }
2213
2214 {
2215 SkipIfEqual skip_if(masm, &DTraceMethodProbes, 0);
2216 // Tell dtrace about this method exit
2217 save_native_result(masm, ret_type, stack_slots);
2218 __ mov_metadata(rax, method());
2219 __ call_VM_leaf(
2220 CAST_FROM_FN_PTR(address, SharedRuntime::dtrace_method_exit),
2221 thread, rax);
2222 restore_native_result(masm, ret_type, stack_slots);
2223 }
2224
2225 // We can finally stop using that last_Java_frame we setup ages ago
2226
2227 __ reset_last_Java_frame(thread, false);
2228
2229 // Unbox oop result, e.g. JNIHandles::resolve value.
2230 if (ret_type == T_OBJECT || ret_type == T_ARRAY) {
2231 __ resolve_jobject(rax /* value */,
2232 thread /* thread */,
2233 rcx /* tmp */);
2234 }
2235
2236 if (CheckJNICalls) {
2237 // clear_pending_jni_exception_check
2238 __ movptr(Address(thread, JavaThread::pending_jni_exception_check_fn_offset()), NULL_WORD);
2239 }
2240
2241 if (!is_critical_native) {
2242 // reset handle block
2243 __ movptr(rcx, Address(thread, JavaThread::active_handles_offset()));
2244 __ movl(Address(rcx, JNIHandleBlock::top_offset_in_bytes()), NULL_WORD);
2245
2246 // Any exception pending?
2247 __ cmpptr(Address(thread, in_bytes(Thread::pending_exception_offset())), (int32_t)NULL_WORD);
2248 __ jcc(Assembler::notEqual, exception_pending);
2249 }
2250
2251 // no exception, we're almost done
2252
2253 // check that only result value is on FPU stack
|