1.1 --- a/src/cpu/sparc/vm/templateInterpreter_sparc.cpp Thu Nov 05 11:42:42 2015 +0100 1.2 +++ b/src/cpu/sparc/vm/templateInterpreter_sparc.cpp Tue May 07 20:38:26 2019 +0000 1.3 @@ -1,5 +1,5 @@ 1.4 /* 1.5 - * Copyright (c) 1997, 2016, Oracle and/or its affiliates. All rights reserved. 1.6 + * Copyright (c) 1997, 2017, Oracle and/or its affiliates. All rights reserved. 1.7 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 1.8 * 1.9 * This code is free software; you can redistribute it and/or modify it 1.10 @@ -1160,11 +1160,23 @@ 1.11 1.12 __ set((intptr_t)AbstractInterpreter::result_handler(T_OBJECT), G3_scratch); 1.13 __ cmp_and_brx_short(G3_scratch, Lscratch, Assembler::notEqual, Assembler::pt, no_oop); 1.14 - __ addcc(G0, O0, O0); 1.15 - __ brx(Assembler::notZero, true, Assembler::pt, store_result); // if result is not NULL: 1.16 - __ delayed()->ld_ptr(O0, 0, O0); // unbox it 1.17 - __ mov(G0, O0); 1.18 - 1.19 + // Unbox oop result, e.g. JNIHandles::resolve value in O0. 1.20 + __ br_null(O0, false, Assembler::pn, store_result); // Use NULL as-is. 1.21 + __ delayed()->andcc(O0, JNIHandles::weak_tag_mask, G0); // Test for jweak 1.22 + __ brx(Assembler::zero, true, Assembler::pt, store_result); 1.23 + __ delayed()->ld_ptr(O0, 0, O0); // Maybe resolve (untagged) jobject. 1.24 + // Resolve jweak. 1.25 + __ ld_ptr(O0, -JNIHandles::weak_tag_value, O0); 1.26 +#if INCLUDE_ALL_GCS 1.27 + if (UseG1GC) { 1.28 + __ g1_write_barrier_pre(noreg /* obj */, 1.29 + noreg /* index */, 1.30 + 0 /* offset */, 1.31 + O0 /* pre_val */, 1.32 + G3_scratch /* tmp */, 1.33 + true /* preserve_o_regs */); 1.34 + } 1.35 +#endif // INCLUDE_ALL_GCS 1.36 __ bind(store_result); 1.37 // Store it where gc will look for it and result handler expects it. 1.38 __ st_ptr(O0, FP, (frame::interpreter_frame_oop_temp_offset*wordSize) + STACK_BIAS);