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 *
1176
1177 // change thread state
1178 __ movl(Address(thread, JavaThread::thread_state_offset()), _thread_in_Java);
1179
1180 // reset_last_Java_frame
1181 __ reset_last_Java_frame(thread, true);
1182
1183 if (CheckJNICalls) {
1184 // clear_pending_jni_exception_check
1185 __ movptr(Address(thread, JavaThread::pending_jni_exception_check_fn_offset()), NULL_WORD);
1186 }
1187
1188 // reset handle block
1189 __ movptr(t, Address(thread, JavaThread::active_handles_offset()));
1190 __ movl(Address(t, JNIHandleBlock::top_offset_in_bytes()), (int32_t)NULL_WORD);
1191
1192 // If result is an oop unbox and store it in frame where gc will see it
1193 // and result handler will pick it up
1194
1195 {
1196 Label no_oop, store_result;
1197 __ lea(t, ExternalAddress(AbstractInterpreter::result_handler(T_OBJECT)));
1198 __ cmpptr(t, Address(rbp, frame::interpreter_frame_result_handler_offset*wordSize));
1199 __ jcc(Assembler::notEqual, no_oop);
1200 // retrieve result
1201 __ pop(ltos);
1202 __ testptr(rax, rax);
1203 __ jcc(Assembler::zero, store_result);
1204 __ movptr(rax, Address(rax, 0));
1205 __ bind(store_result);
1206 __ movptr(Address(rbp, frame::interpreter_frame_oop_temp_offset*wordSize), rax);
1207 // keep stack depth as expected by pushing oop which will eventually be discarded
1208 __ push(ltos);
1209 __ bind(no_oop);
1210 }
1211
1212
1213 {
1214 Label no_reguard;
1215 __ cmpl(Address(thread, JavaThread::stack_guard_state_offset()),
1216 JavaThread::stack_guard_yellow_reserved_disabled);
1217 __ jcc(Assembler::notEqual, no_reguard);
1218
1219 __ pusha(); // XXX only save smashed registers
1220 #ifndef _LP64
1221 __ call(RuntimeAddress(CAST_FROM_FN_PTR(address, SharedRuntime::reguard_yellow_pages)));
1222 __ popa();
1223 #else
1224 __ mov(r12, rsp); // remember sp (can only use r12 if not using call_VM)
1225 __ subptr(rsp, frame::arg_reg_save_area_bytes); // windows
|
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 *
1176
1177 // change thread state
1178 __ movl(Address(thread, JavaThread::thread_state_offset()), _thread_in_Java);
1179
1180 // reset_last_Java_frame
1181 __ reset_last_Java_frame(thread, true);
1182
1183 if (CheckJNICalls) {
1184 // clear_pending_jni_exception_check
1185 __ movptr(Address(thread, JavaThread::pending_jni_exception_check_fn_offset()), NULL_WORD);
1186 }
1187
1188 // reset handle block
1189 __ movptr(t, Address(thread, JavaThread::active_handles_offset()));
1190 __ movl(Address(t, JNIHandleBlock::top_offset_in_bytes()), (int32_t)NULL_WORD);
1191
1192 // If result is an oop unbox and store it in frame where gc will see it
1193 // and result handler will pick it up
1194
1195 {
1196 Label no_oop, not_weak, store_result;
1197 __ lea(t, ExternalAddress(AbstractInterpreter::result_handler(T_OBJECT)));
1198 __ cmpptr(t, Address(rbp, frame::interpreter_frame_result_handler_offset*wordSize));
1199 __ jcc(Assembler::notEqual, no_oop);
1200 // retrieve result
1201 __ pop(ltos);
1202 // Unbox oop result, e.g. JNIHandles::resolve value.
1203 __ resolve_jobject(rax /* value */,
1204 thread /* thread */,
1205 t /* tmp */);
1206 __ movptr(Address(rbp, frame::interpreter_frame_oop_temp_offset*wordSize), rax);
1207 // keep stack depth as expected by pushing oop which will eventually be discarded
1208 __ push(ltos);
1209 __ bind(no_oop);
1210 }
1211
1212
1213 {
1214 Label no_reguard;
1215 __ cmpl(Address(thread, JavaThread::stack_guard_state_offset()),
1216 JavaThread::stack_guard_yellow_reserved_disabled);
1217 __ jcc(Assembler::notEqual, no_reguard);
1218
1219 __ pusha(); // XXX only save smashed registers
1220 #ifndef _LP64
1221 __ call(RuntimeAddress(CAST_FROM_FN_PTR(address, SharedRuntime::reguard_yellow_pages)));
1222 __ popa();
1223 #else
1224 __ mov(r12, rsp); // remember sp (can only use r12 if not using call_VM)
1225 __ subptr(rsp, frame::arg_reg_save_area_bytes); // windows
|