< prev index next >
src/hotspot/cpu/aarch64/jniFastGetField_aarch64.cpp
Print this page
rev 55759 : 8227680: FastJNIAccessors: Check for JVMTI field access event requests at runtime
Summary: Check JvmtiExport::_field_access_count != 0 at runtime
Reviewed-by:
*** 1,7 ****
/*
! * Copyright (c) 2004, 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.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
--- 1,7 ----
/*
! * Copyright (c) 2004, 2019, 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.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
*** 77,91 ****
--- 77,110 ----
__ adrp(rcounter_addr,
SafepointSynchronize::safepoint_counter_addr(), offset);
Address safepoint_counter_addr(rcounter_addr, offset);
__ ldrw(rcounter, safepoint_counter_addr);
__ tbnz(rcounter, 0, slow);
+
+ if (JvmtiExport::can_post_field_access()) {
+ // Using barrier to order wrt. JVMTI check and load of result.
+ __ membar(Assembler::LoadLoad);
+
+ // Check to see if a field access watch has been set before we
+ // take the fast path.
+ unsigned long offset2;
+ __ adrp(result,
+ ExternalAddress((address) JvmtiExport::get_field_access_count_addr()),
+ offset2);
+ __ ldrw(result, Address(result, offset2));
+ __ cbnzw(result, slow);
+
+ __ mov(robj, c_rarg1);
+ } else {
+ // Using address dependency to order wrt. load of result.
__ eor(robj, c_rarg1, rcounter);
__ eor(robj, robj, rcounter); // obj, since
// robj ^ rcounter ^ rcounter == robj
// robj is address dependent on rcounter.
+ }
+ // Both robj and rscratch1 are clobbered by try_resolve_jobject_in_native.
BarrierSetAssembler* bs = BarrierSet::barrier_set()->barrier_set_assembler();
bs->try_resolve_jobject_in_native(masm, c_rarg0, robj, rscratch1, slow);
__ lsr(roffset, c_rarg2, 2); // offset
*** 101,113 ****
--- 120,138 ----
case T_DOUBLE:
case T_LONG: __ ldr (result, Address(robj, roffset)); break;
default: ShouldNotReachHere();
}
+ if (JvmtiExport::can_post_field_access()) {
+ // Order JVMTI check and load of result wrt. succeeding check.
+ __ membar(Assembler::LoadLoad);
+ } else {
// counter_addr is address dependent on result.
__ eor(rcounter_addr, rcounter_addr, result);
__ eor(rcounter_addr, rcounter_addr, result);
+ }
+
__ ldrw(rscratch1, safepoint_counter_addr);
__ cmpw(rcounter, rscratch1);
__ br (Assembler::NE, slow);
switch (type) {
< prev index next >