1 /* |
1 /* |
2 * Copyright (c) 2003, 2016, Oracle and/or its affiliates. All rights reserved. |
2 * Copyright (c) 2003, 2017, Oracle and/or its affiliates. All rights reserved. |
3 * Copyright (c) 2014, Red Hat Inc. 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. |
4 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
5 * |
5 * |
6 * This code is free software; you can redistribute it and/or modify it |
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 |
7 * under the terms of the GNU General Public License version 2 only, as |
1397 |
1397 |
1398 // If result is an oop unbox and store it in frame where gc will see it |
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 |
1399 // and result handler will pick it up |
1400 |
1400 |
1401 { |
1401 { |
1402 Label no_oop, store_result; |
1402 Label no_oop, not_weak, store_result; |
1403 __ adr(t, ExternalAddress(AbstractInterpreter::result_handler(T_OBJECT))); |
1403 __ adr(t, ExternalAddress(AbstractInterpreter::result_handler(T_OBJECT))); |
1404 __ cmp(t, result_handler); |
1404 __ cmp(t, result_handler); |
1405 __ br(Assembler::NE, no_oop); |
1405 __ br(Assembler::NE, no_oop); |
1406 // retrieve result |
1406 // Unbox oop result, e.g. JNIHandles::resolve result. |
1407 __ pop(ltos); |
1407 __ pop(ltos); |
1408 __ cbz(r0, store_result); |
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. |
1409 __ ldr(r0, Address(r0, 0)); |
1428 __ ldr(r0, Address(r0, 0)); |
1410 __ bind(store_result); |
1429 __ bind(store_result); |
1411 __ str(r0, Address(rfp, frame::interpreter_frame_oop_temp_offset*wordSize)); |
1430 __ 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 |
1431 // keep stack depth as expected by pushing oop which will eventually be discarded |
1413 __ push(ltos); |
1432 __ push(ltos); |