Fix String.equals() for moveable String.class.
If the String.class is moveable (i.e. running without boot
image), the instanceof check emitted by the JIT in the
String.equals() intrinsic would require read barriers.
As we do not really care about the performance of running
without the boot image, disable the intrinsic in this case.
Test: 669-moveable-string-class-equals (--jit)
Bug: 68181300
Change-Id: I39c9f9935e0482b3b30f1ae5cd23515cbda0603b
diff --git a/compiler/optimizing/intrinsics_x86.cc b/compiler/optimizing/intrinsics_x86.cc
index 8a0b6ae..baa410b 100644
--- a/compiler/optimizing/intrinsics_x86.cc
+++ b/compiler/optimizing/intrinsics_x86.cc
@@ -1345,6 +1345,13 @@
}
void IntrinsicLocationsBuilderX86::VisitStringEquals(HInvoke* invoke) {
+ if (kEmitCompilerReadBarrier &&
+ !StringEqualsOptimizations(invoke).GetArgumentIsString() &&
+ !StringEqualsOptimizations(invoke).GetNoReadBarrierForStringClass()) {
+ // No support for this odd case (String class is moveable, not in the boot image).
+ return;
+ }
+
LocationSummary* locations =
new (allocator_) LocationSummary(invoke, LocationSummary::kNoCall, kIntrinsified);
locations->SetInAt(0, Location::RequiresRegister());