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. |
1158 { |
1158 { |
1159 Label no_oop, store_result; |
1159 Label no_oop, store_result; |
1160 |
1160 |
1161 __ set((intptr_t)AbstractInterpreter::result_handler(T_OBJECT), G3_scratch); |
1161 __ set((intptr_t)AbstractInterpreter::result_handler(T_OBJECT), G3_scratch); |
1162 __ cmp_and_brx_short(G3_scratch, Lscratch, Assembler::notEqual, Assembler::pt, no_oop); |
1162 __ cmp_and_brx_short(G3_scratch, Lscratch, Assembler::notEqual, Assembler::pt, no_oop); |
1163 __ addcc(G0, O0, O0); |
1163 // Unbox oop result, e.g. JNIHandles::resolve value in O0. |
1164 __ brx(Assembler::notZero, true, Assembler::pt, store_result); // if result is not NULL: |
1164 __ br_null(O0, false, Assembler::pn, store_result); // Use NULL as-is. |
1165 __ delayed()->ld_ptr(O0, 0, O0); // unbox it |
1165 __ delayed()->andcc(O0, JNIHandles::weak_tag_mask, G0); // Test for jweak |
1166 __ mov(G0, O0); |
1166 __ brx(Assembler::zero, true, Assembler::pt, store_result); |
1167 |
1167 __ delayed()->ld_ptr(O0, 0, O0); // Maybe resolve (untagged) jobject. |
|
1168 // Resolve jweak. |
|
1169 __ ld_ptr(O0, -JNIHandles::weak_tag_value, O0); |
|
1170 #if INCLUDE_ALL_GCS |
|
1171 if (UseG1GC) { |
|
1172 __ g1_write_barrier_pre(noreg /* obj */, |
|
1173 noreg /* index */, |
|
1174 0 /* offset */, |
|
1175 O0 /* pre_val */, |
|
1176 G3_scratch /* tmp */, |
|
1177 true /* preserve_o_regs */); |
|
1178 } |
|
1179 #endif // INCLUDE_ALL_GCS |
1168 __ bind(store_result); |
1180 __ bind(store_result); |
1169 // Store it where gc will look for it and result handler expects it. |
1181 // Store it where gc will look for it and result handler expects it. |
1170 __ st_ptr(O0, FP, (frame::interpreter_frame_oop_temp_offset*wordSize) + STACK_BIAS); |
1182 __ st_ptr(O0, FP, (frame::interpreter_frame_oop_temp_offset*wordSize) + STACK_BIAS); |
1171 |
1183 |
1172 __ bind(no_oop); |
1184 __ bind(no_oop); |