1 /* |
1 /* |
2 * Copyright (c) 1997, 2016, Oracle and/or its affiliates. All rights reserved. |
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. |
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
4 * |
4 * |
5 * This code is free software; you can redistribute it and/or modify it |
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 |
6 * under the terms of the GNU General Public License version 2 only, as |
7 * published by the Free Software Foundation. |
7 * published by the Free Software Foundation. |
1514 { |
1514 { |
1515 Label no_oop, store_result; |
1515 Label no_oop, store_result; |
1516 |
1516 |
1517 __ set((intptr_t)AbstractInterpreter::result_handler(T_OBJECT), G3_scratch); |
1517 __ set((intptr_t)AbstractInterpreter::result_handler(T_OBJECT), G3_scratch); |
1518 __ cmp_and_brx_short(G3_scratch, Lscratch, Assembler::notEqual, Assembler::pt, no_oop); |
1518 __ cmp_and_brx_short(G3_scratch, Lscratch, Assembler::notEqual, Assembler::pt, no_oop); |
1519 __ addcc(G0, O0, O0); |
1519 // Unbox oop result, e.g. JNIHandles::resolve value in O0. |
1520 __ brx(Assembler::notZero, true, Assembler::pt, store_result); // if result is not NULL: |
1520 __ br_null(O0, false, Assembler::pn, store_result); // Use NULL as-is. |
1521 __ delayed()->ld_ptr(O0, 0, O0); // unbox it |
1521 __ delayed()->andcc(O0, JNIHandles::weak_tag_mask, G0); // Test for jweak |
1522 __ mov(G0, O0); |
1522 __ brx(Assembler::zero, true, Assembler::pt, store_result); |
1523 |
1523 __ delayed()->ld_ptr(O0, 0, O0); // Maybe resolve (untagged) jobject. |
|
1524 // Resolve jweak. |
|
1525 __ ld_ptr(O0, -JNIHandles::weak_tag_value, O0); |
|
1526 #if INCLUDE_ALL_GCS |
|
1527 if (UseG1GC) { |
|
1528 __ g1_write_barrier_pre(noreg /* obj */, |
|
1529 noreg /* index */, |
|
1530 0 /* offset */, |
|
1531 O0 /* pre_val */, |
|
1532 G3_scratch /* tmp */, |
|
1533 true /* preserve_o_regs */); |
|
1534 } |
|
1535 #endif // INCLUDE_ALL_GCS |
1524 __ bind(store_result); |
1536 __ bind(store_result); |
1525 // Store it where gc will look for it and result handler expects it. |
1537 // Store it where gc will look for it and result handler expects it. |
1526 __ st_ptr(O0, FP, (frame::interpreter_frame_oop_temp_offset*wordSize) + STACK_BIAS); |
1538 __ st_ptr(O0, FP, (frame::interpreter_frame_oop_temp_offset*wordSize) + STACK_BIAS); |
1527 |
1539 |
1528 __ bind(no_oop); |
1540 __ bind(no_oop); |