Add reachabilityFence intrinsics
Add intrinsics that generate no code or do nothing for all architectures
and for the interpreter. The only impact is to keep the argument live at
all suspend points preceding the call. We ensure that the code is not
moved across other memory accesses by declaring it to have write side-effects.
Add a minimal test.
Modify 036-finalizer to use a reachabilityFence, hopefully making it
more robust to dead refererence elimination.
Bug: 72698200
Test: Build and boot AOSP.
art/test.py --host -r -t 072-reachability-fence
Look at generated code.
Change-Id: I0f298bf5cc375d8ebc19bb791cc05a8490d55430
diff --git a/compiler/optimizing/intrinsics_arm_vixl.cc b/compiler/optimizing/intrinsics_arm_vixl.cc
index e61a0b0..29aecbc 100644
--- a/compiler/optimizing/intrinsics_arm_vixl.cc
+++ b/compiler/optimizing/intrinsics_arm_vixl.cc
@@ -3028,6 +3028,14 @@
}
}
+void IntrinsicLocationsBuilderARMVIXL::VisitReachabilityFence(HInvoke* invoke) {
+ LocationSummary* locations =
+ new (allocator_) LocationSummary(invoke, LocationSummary::kNoCall, kIntrinsified);
+ locations->SetInAt(0, Location::Any());
+}
+
+void IntrinsicCodeGeneratorARMVIXL::VisitReachabilityFence(HInvoke* invoke ATTRIBUTE_UNUSED) { }
+
UNIMPLEMENTED_INTRINSIC(ARMVIXL, MathRoundDouble) // Could be done by changing rounding mode, maybe?
UNIMPLEMENTED_INTRINSIC(ARMVIXL, UnsafeCASLong) // High register pressure.
UNIMPLEMENTED_INTRINSIC(ARMVIXL, SystemArrayCopyChar)