diff -r deab1e2f0ebf -r fb5421685295 hotspot/src/cpu/aarch64/vm/templateInterpreterGenerator_aarch64.cpp --- a/hotspot/src/cpu/aarch64/vm/templateInterpreterGenerator_aarch64.cpp Tue Feb 28 10:10:14 2017 +0530 +++ b/hotspot/src/cpu/aarch64/vm/templateInterpreterGenerator_aarch64.cpp Fri Feb 17 13:16:54 2017 +0100 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2016, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2017, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 2014, Red Hat Inc. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * @@ -1399,13 +1399,32 @@ // and result handler will pick it up { - Label no_oop, store_result; + Label no_oop, not_weak, store_result; __ adr(t, ExternalAddress(AbstractInterpreter::result_handler(T_OBJECT))); __ cmp(t, result_handler); __ br(Assembler::NE, no_oop); - // retrieve result + // Unbox oop result, e.g. JNIHandles::resolve result. __ pop(ltos); - __ cbz(r0, store_result); + __ cbz(r0, store_result); // Use NULL as-is. + STATIC_ASSERT(JNIHandles::weak_tag_mask == 1u); + __ tbz(r0, 0, not_weak); // Test for jweak tag. + // Resolve jweak. + __ ldr(r0, Address(r0, -JNIHandles::weak_tag_value)); +#if INCLUDE_ALL_GCS + if (UseG1GC) { + __ enter(); // Barrier may call runtime. + __ g1_write_barrier_pre(noreg /* obj */, + r0 /* pre_val */, + rthread /* thread */, + t /* tmp */, + true /* tosca_live */, + true /* expand_call */); + __ leave(); + } +#endif // INCLUDE_ALL_GCS + __ b(store_result); + __ bind(not_weak); + // Resolve (untagged) jobject. __ ldr(r0, Address(r0, 0)); __ bind(store_result); __ str(r0, Address(rfp, frame::interpreter_frame_oop_temp_offset*wordSize));