1 /*
2 * Copyright (c) 2003, 2017, Oracle and/or its affiliates. All rights reserved.
3 * Copyright (c) 2014, 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.
1382 __ mov(rscratch1, _thread_in_Java);
1383 __ lea(rscratch2, Address(rthread, JavaThread::thread_state_offset()));
1384 __ stlrw(rscratch1, rscratch2);
1385
1386 // reset_last_Java_frame
1387 __ reset_last_Java_frame(true);
1388
1389 if (CheckJNICalls) {
1390 // clear_pending_jni_exception_check
1391 __ str(zr, Address(rthread, JavaThread::pending_jni_exception_check_fn_offset()));
1392 }
1393
1394 // reset handle block
1395 __ ldr(t, Address(rthread, JavaThread::active_handles_offset()));
1396 __ str(zr, Address(t, JNIHandleBlock::top_offset_in_bytes()));
1397
1398 // If result is an oop unbox and store it in frame where gc will see it
1399 // and result handler will pick it up
1400
1401 {
1402 Label no_oop, not_weak, store_result;
1403 __ adr(t, ExternalAddress(AbstractInterpreter::result_handler(T_OBJECT)));
1404 __ cmp(t, result_handler);
1405 __ br(Assembler::NE, no_oop);
1406 // Unbox oop result, e.g. JNIHandles::resolve result.
1407 __ pop(ltos);
1408 __ cbz(r0, store_result); // Use NULL as-is.
1409 STATIC_ASSERT(JNIHandles::weak_tag_mask == 1u);
1410 __ tbz(r0, 0, not_weak); // Test for jweak tag.
1411 // Resolve jweak.
1412 __ ldr(r0, Address(r0, -JNIHandles::weak_tag_value));
1413 #if INCLUDE_ALL_GCS
1414 if (UseG1GC) {
1415 __ enter(); // Barrier may call runtime.
1416 __ g1_write_barrier_pre(noreg /* obj */,
1417 r0 /* pre_val */,
1418 rthread /* thread */,
1419 t /* tmp */,
1420 true /* tosca_live */,
1421 true /* expand_call */);
1422 __ leave();
1423 }
1424 #endif // INCLUDE_ALL_GCS
1425 __ b(store_result);
1426 __ bind(not_weak);
1427 // Resolve (untagged) jobject.
1428 __ ldr(r0, Address(r0, 0));
1429 __ bind(store_result);
1430 __ str(r0, Address(rfp, frame::interpreter_frame_oop_temp_offset*wordSize));
1431 // keep stack depth as expected by pushing oop which will eventually be discarded
1432 __ push(ltos);
1433 __ bind(no_oop);
1434 }
1435
1436 {
1437 Label no_reguard;
1438 __ lea(rscratch1, Address(rthread, in_bytes(JavaThread::stack_guard_state_offset())));
1439 __ ldrw(rscratch1, Address(rscratch1));
1440 __ cmp(rscratch1, JavaThread::stack_guard_yellow_reserved_disabled);
1441 __ br(Assembler::NE, no_reguard);
1442
1443 __ pusha(); // XXX only save smashed registers
1444 __ mov(c_rarg0, rthread);
1445 __ mov(rscratch2, CAST_FROM_FN_PTR(address, SharedRuntime::reguard_yellow_pages));
1446 __ blrt(rscratch2, 0, 0, 0);
1447 __ popa(); // XXX only restore smashed registers
|
1 /*
2 * Copyright (c) 2003, 2016, Oracle and/or its affiliates. All rights reserved.
3 * Copyright (c) 2014, 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.
1382 __ mov(rscratch1, _thread_in_Java);
1383 __ lea(rscratch2, Address(rthread, JavaThread::thread_state_offset()));
1384 __ stlrw(rscratch1, rscratch2);
1385
1386 // reset_last_Java_frame
1387 __ reset_last_Java_frame(true);
1388
1389 if (CheckJNICalls) {
1390 // clear_pending_jni_exception_check
1391 __ str(zr, Address(rthread, JavaThread::pending_jni_exception_check_fn_offset()));
1392 }
1393
1394 // reset handle block
1395 __ ldr(t, Address(rthread, JavaThread::active_handles_offset()));
1396 __ str(zr, Address(t, JNIHandleBlock::top_offset_in_bytes()));
1397
1398 // If result is an oop unbox and store it in frame where gc will see it
1399 // and result handler will pick it up
1400
1401 {
1402 Label no_oop, store_result;
1403 __ adr(t, ExternalAddress(AbstractInterpreter::result_handler(T_OBJECT)));
1404 __ cmp(t, result_handler);
1405 __ br(Assembler::NE, no_oop);
1406 // retrieve result
1407 __ pop(ltos);
1408 __ cbz(r0, store_result);
1409 __ ldr(r0, Address(r0, 0));
1410 __ bind(store_result);
1411 __ str(r0, Address(rfp, frame::interpreter_frame_oop_temp_offset*wordSize));
1412 // keep stack depth as expected by pushing oop which will eventually be discarded
1413 __ push(ltos);
1414 __ bind(no_oop);
1415 }
1416
1417 {
1418 Label no_reguard;
1419 __ lea(rscratch1, Address(rthread, in_bytes(JavaThread::stack_guard_state_offset())));
1420 __ ldrw(rscratch1, Address(rscratch1));
1421 __ cmp(rscratch1, JavaThread::stack_guard_yellow_reserved_disabled);
1422 __ br(Assembler::NE, no_reguard);
1423
1424 __ pusha(); // XXX only save smashed registers
1425 __ mov(c_rarg0, rthread);
1426 __ mov(rscratch2, CAST_FROM_FN_PTR(address, SharedRuntime::reguard_yellow_pages));
1427 __ blrt(rscratch2, 0, 0, 0);
1428 __ popa(); // XXX only restore smashed registers
|