1 /* 2 * Copyright (c) 2016, 2017, Oracle and/or its affiliates. All rights reserved. 3 * Copyright (c) 2016, 2017 SAP SE. 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. 23 * 2255 // exception is set. The forward_exception routine expects to see the 2256 // exception in pending_exception and not in a register. Kind of clumsy, 2257 // since all folks who branch to forward_exception must have tested 2258 // pending_exception first and hence have it in a register already. 2259 __ z_stg(R_exc, Address(Z_thread, Thread::pending_exception_offset())); 2260 restore_native_result(masm, ret_type, workspace_slot_offset); 2261 __ z_bru(done); 2262 __ z_illtrap(0x66); 2263 2264 __ bind(done); 2265 } 2266 2267 2268 //-------------------------------------------------------------------- 2269 // Clear "last Java frame" SP and PC. 2270 //-------------------------------------------------------------------- 2271 __ verify_thread(); // Z_thread must be correct. 2272 2273 __ reset_last_Java_frame(); 2274 2275 // Unpack oop result, e.g. JNIHandles::resolve result. 2276 if (ret_type == T_OBJECT || ret_type == T_ARRAY) { 2277 __ resolve_jobject(Z_RET, /* tmp1 */ Z_R13, /* tmp2 */ Z_R7); 2278 } 2279 2280 if (CheckJNICalls) { 2281 // clear_pending_jni_exception_check 2282 __ clear_mem(Address(Z_thread, JavaThread::pending_jni_exception_check_fn_offset()), sizeof(oop)); 2283 } 2284 2285 // Reset handle block. 2286 if (!is_critical_native) { 2287 __ z_lg(Z_R1_scratch, Address(Z_thread, JavaThread::active_handles_offset())); 2288 __ clear_mem(Address(Z_R1_scratch, JNIHandleBlock::top_offset_in_bytes()), 4); 2289 2290 // Check for pending exceptions. 2291 __ load_and_test_long(Z_R0, Address(Z_thread, Thread::pending_exception_offset())); 2292 __ z_brne(handle_pending_exception); 2293 } 2294 2295 2296 ////////////////////////////////////////////////////////////////////// 2297 // Return | 1 /* 2 * Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved. 3 * Copyright (c) 2016 SAP SE. 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. 23 * 2255 // exception is set. The forward_exception routine expects to see the 2256 // exception in pending_exception and not in a register. Kind of clumsy, 2257 // since all folks who branch to forward_exception must have tested 2258 // pending_exception first and hence have it in a register already. 2259 __ z_stg(R_exc, Address(Z_thread, Thread::pending_exception_offset())); 2260 restore_native_result(masm, ret_type, workspace_slot_offset); 2261 __ z_bru(done); 2262 __ z_illtrap(0x66); 2263 2264 __ bind(done); 2265 } 2266 2267 2268 //-------------------------------------------------------------------- 2269 // Clear "last Java frame" SP and PC. 2270 //-------------------------------------------------------------------- 2271 __ verify_thread(); // Z_thread must be correct. 2272 2273 __ reset_last_Java_frame(); 2274 2275 // Unpack oop result 2276 if (ret_type == T_OBJECT || ret_type == T_ARRAY) { 2277 NearLabel L; 2278 __ compare64_and_branch(Z_RET, (RegisterOrConstant)0L, Assembler::bcondEqual, L); 2279 __ z_lg(Z_RET, 0, Z_RET); 2280 __ bind(L); 2281 __ verify_oop(Z_RET); 2282 } 2283 2284 if (CheckJNICalls) { 2285 // clear_pending_jni_exception_check 2286 __ clear_mem(Address(Z_thread, JavaThread::pending_jni_exception_check_fn_offset()), sizeof(oop)); 2287 } 2288 2289 // Reset handle block. 2290 if (!is_critical_native) { 2291 __ z_lg(Z_R1_scratch, Address(Z_thread, JavaThread::active_handles_offset())); 2292 __ clear_mem(Address(Z_R1_scratch, JNIHandleBlock::top_offset_in_bytes()), 4); 2293 2294 // Check for pending exceptions. 2295 __ load_and_test_long(Z_R0, Address(Z_thread, Thread::pending_exception_offset())); 2296 __ z_brne(handle_pending_exception); 2297 } 2298 2299 2300 ////////////////////////////////////////////////////////////////////// 2301 // Return |