1 /*
2 * Copyright (c) 1997, 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 *
1279 //
1280 __ push(thread);
1281 __ call(RuntimeAddress(CAST_FROM_FN_PTR(address,
1282 JavaThread::check_special_condition_for_native_trans)));
1283 __ increment(rsp, wordSize);
1284 __ get_thread(thread);
1285
1286 __ bind(Continue);
1287 }
1288
1289 // change thread state
1290 __ movl(Address(thread, JavaThread::thread_state_offset()), _thread_in_Java);
1291
1292 __ reset_last_Java_frame(thread, true);
1293
1294 // reset handle block
1295 __ movptr(t, Address(thread, JavaThread::active_handles_offset()));
1296 __ movl(Address(t, JNIHandleBlock::top_offset_in_bytes()), NULL_WORD);
1297
1298 // If result was an oop then unbox and save it in the frame
1299 { Label L;
1300 Label no_oop, store_result;
1301 ExternalAddress handler(AbstractInterpreter::result_handler(T_OBJECT));
1302 __ cmpptr(Address(rbp, frame::interpreter_frame_result_handler_offset*wordSize),
1303 handler.addr());
1304 __ jcc(Assembler::notEqual, no_oop);
1305 __ cmpptr(Address(rsp, 0), (int32_t)NULL_WORD);
1306 __ pop(ltos);
1307 __ testptr(rax, rax);
1308 __ jcc(Assembler::zero, store_result);
1309 // unbox
1310 __ movptr(rax, Address(rax, 0));
1311 __ bind(store_result);
1312 __ movptr(Address(rbp, (frame::interpreter_frame_oop_temp_offset)*wordSize), rax);
1313 // keep stack depth as expected by pushing oop which will eventually be discarded
1314 __ push(ltos);
1315 __ bind(no_oop);
1316 }
1317
1318 {
1319 Label no_reguard;
1320 __ cmpl(Address(thread, JavaThread::stack_guard_state_offset()), JavaThread::stack_guard_yellow_disabled);
1321 __ jcc(Assembler::notEqual, no_reguard);
1322
1323 __ pusha();
1324 __ call(RuntimeAddress(CAST_FROM_FN_PTR(address, SharedRuntime::reguard_yellow_pages)));
1325 __ popa();
1326
1327 __ bind(no_reguard);
1328 }
1329
1330 // restore rsi to have legal interpreter frame,
1331 // i.e., bci == 0 <=> rsi == code_base()
|
1 /*
2 * Copyright (c) 1997, 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 *
1279 //
1280 __ push(thread);
1281 __ call(RuntimeAddress(CAST_FROM_FN_PTR(address,
1282 JavaThread::check_special_condition_for_native_trans)));
1283 __ increment(rsp, wordSize);
1284 __ get_thread(thread);
1285
1286 __ bind(Continue);
1287 }
1288
1289 // change thread state
1290 __ movl(Address(thread, JavaThread::thread_state_offset()), _thread_in_Java);
1291
1292 __ reset_last_Java_frame(thread, true);
1293
1294 // reset handle block
1295 __ movptr(t, Address(thread, JavaThread::active_handles_offset()));
1296 __ movl(Address(t, JNIHandleBlock::top_offset_in_bytes()), NULL_WORD);
1297
1298 // If result was an oop then unbox and save it in the frame
1299 {
1300 Label no_oop;
1301 ExternalAddress handler(AbstractInterpreter::result_handler(T_OBJECT));
1302 __ cmpptr(Address(rbp, frame::interpreter_frame_result_handler_offset*wordSize),
1303 handler.addr());
1304 __ jcc(Assembler::notEqual, no_oop);
1305 __ cmpptr(Address(rsp, 0), (int32_t)NULL_WORD);
1306 __ pop(ltos);
1307 // Unbox oop result, e.g. JNIHandles::resolve value.
1308 __ resolve_jobject(rax /* value */,
1309 thread /* thread */,
1310 t /* tmp */);
1311 __ movptr(Address(rbp, (frame::interpreter_frame_oop_temp_offset)*wordSize), rax);
1312 // keep stack depth as expected by pushing oop which will eventually be discarded
1313 __ push(ltos);
1314 __ bind(no_oop);
1315 }
1316
1317 {
1318 Label no_reguard;
1319 __ cmpl(Address(thread, JavaThread::stack_guard_state_offset()), JavaThread::stack_guard_yellow_disabled);
1320 __ jcc(Assembler::notEqual, no_reguard);
1321
1322 __ pusha();
1323 __ call(RuntimeAddress(CAST_FROM_FN_PTR(address, SharedRuntime::reguard_yellow_pages)));
1324 __ popa();
1325
1326 __ bind(no_reguard);
1327 }
1328
1329 // restore rsi to have legal interpreter frame,
1330 // i.e., bci == 0 <=> rsi == code_base()
|