From 1d775d2ecfe847395e67310d588626962744c2d0 Mon Sep 17 00:00:00 2001 From: Roland Levillain Date: Fri, 7 Sep 2018 13:56:57 +0100 Subject: Check that the String class is not movable in String.equals intrinsics. Test: art/test.py Bug: 68181300 Bug: 67628039 Change-Id: I66afa3ea010f758125f8aec79509f0255cb5ea03 --- compiler/optimizing/intrinsics_mips.cc | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'compiler/optimizing/intrinsics_mips.cc') diff --git a/compiler/optimizing/intrinsics_mips.cc b/compiler/optimizing/intrinsics_mips.cc index 6f7f5e49c1..2ca12b6533 100644 --- a/compiler/optimizing/intrinsics_mips.cc +++ b/compiler/optimizing/intrinsics_mips.cc @@ -1575,8 +1575,16 @@ void IntrinsicCodeGeneratorMIPS::VisitStringEquals(HInvoke* invoke) { // All string objects must have the same type since String cannot be subclassed. // Receiver must be a string object, so its class field is equal to all strings' class fields. // If the argument is a string object, its class field must be equal to receiver's class field. + // + // As the String class is expected to be non-movable, we can read the class + // field from String.equals' arguments without read barriers. + AssertNonMovableStringClass(); + // /* HeapReference */ temp1 = str->klass_ __ Lw(temp1, str, class_offset); + // /* HeapReference */ temp2 = arg->klass_ __ Lw(temp2, arg, class_offset); + // Also, because we use the previously loaded class references only in the + // following comparison, we don't need to unpoison them. __ Bne(temp1, temp2, &return_false); } -- cgit v1.2.3-59-g8ed1b