Remove sorting of bootstrap methods in liveness info.

Bug: 132593519
Change-Id: I4f57c83d0011d9d3a520fae4dcec35ef57d5690f
diff --git a/src/main/java/com/android/tools/r8/ir/optimize/ArgumentRemovalUtils.java b/src/main/java/com/android/tools/r8/ir/optimize/ArgumentRemovalUtils.java
index 5892466..d6f0c77 100644
--- a/src/main/java/com/android/tools/r8/ir/optimize/ArgumentRemovalUtils.java
+++ b/src/main/java/com/android/tools/r8/ir/optimize/ArgumentRemovalUtils.java
@@ -14,7 +14,7 @@
   // remove method arguments.
   public static boolean isPinned(DexEncodedMethod method, AppView<AppInfoWithLiveness> appView) {
     return appView.appInfo().isPinned(method.method)
-        || appView.appInfo().bootstrapMethods.contains(method.method)
+        || appView.appInfo().isBootstrapMethod(method.method)
         || appView.appInfo().failedResolutionTargets.contains(method.method)
         || appView.appInfo().methodsTargetedByInvokeDynamic.contains(method.method)
         || method.accessFlags.isNative();
diff --git a/src/main/java/com/android/tools/r8/shaking/AppInfoWithLiveness.java b/src/main/java/com/android/tools/r8/shaking/AppInfoWithLiveness.java
index 88665e0..305bf9d 100644
--- a/src/main/java/com/android/tools/r8/shaking/AppInfoWithLiveness.java
+++ b/src/main/java/com/android/tools/r8/shaking/AppInfoWithLiveness.java
@@ -107,7 +107,8 @@
   /**
    * Set of program methods that are used as the bootstrap method for an invoke-dynamic instruction.
    */
-  public final SortedSet<DexMethod> bootstrapMethods;
+  private final Set<DexMethod> bootstrapMethods;
+
   /** Set of methods that are the immediate target of an invoke-dynamic. */
   public final SortedSet<DexMethod> methodsTargetedByInvokeDynamic;
   /** Set of virtual methods that are the immediate target of an invoke-direct. */
@@ -207,7 +208,7 @@
       Set<DexType> instantiatedAppServices,
       Set<DexMethod> targetedMethods,
       Set<DexMethod> failedResolutionTargets,
-      SortedSet<DexMethod> bootstrapMethods,
+      Set<DexMethod> bootstrapMethods,
       SortedSet<DexMethod> methodsTargetedByInvokeDynamic,
       SortedSet<DexMethod> virtualMethodsTargetedByInvokeDirect,
       SortedSet<DexMethod> liveMethods,
@@ -290,7 +291,7 @@
       Set<DexType> instantiatedAppServices,
       Set<DexMethod> targetedMethods,
       Set<DexMethod> failedResolutionTargets,
-      SortedSet<DexMethod> bootstrapMethods,
+      Set<DexMethod> bootstrapMethods,
       SortedSet<DexMethod> methodsTargetedByInvokeDynamic,
       SortedSet<DexMethod> virtualMethodsTargetedByInvokeDirect,
       SortedSet<DexMethod> liveMethods,
@@ -630,6 +631,10 @@
     return targetedMethods.contains(method);
   }
 
+  public boolean isBootstrapMethod(DexMethod method) {
+    return bootstrapMethods.contains(method);
+  }
+
   public Collection<DexClass> computeReachableInterfaces() {
     Set<DexClass> interfaces = Sets.newIdentityHashSet();
     WorkList<DexType> worklist = WorkList.newIdentityWorkList();
@@ -1025,7 +1030,7 @@
         lens.rewriteTypes(instantiatedAppServices),
         lens.rewriteMethods(targetedMethods),
         lens.rewriteMethodsSorted(failedResolutionTargets),
-        lens.rewriteMethodsSorted(bootstrapMethods),
+        lens.rewriteMethods(bootstrapMethods),
         lens.rewriteMethodsSorted(methodsTargetedByInvokeDynamic),
         lens.rewriteMethodsSorted(virtualMethodsTargetedByInvokeDirect),
         lens.rewriteMethodsSorted(liveMethods),
diff --git a/src/main/java/com/android/tools/r8/shaking/Enqueuer.java b/src/main/java/com/android/tools/r8/shaking/Enqueuer.java
index 7624a67..6b644bb 100644
--- a/src/main/java/com/android/tools/r8/shaking/Enqueuer.java
+++ b/src/main/java/com/android/tools/r8/shaking/Enqueuer.java
@@ -3176,7 +3176,7 @@
             Collections.unmodifiableSet(instantiatedAppServices),
             Enqueuer.toDescriptorSet(targetedMethods.getItems()),
             Collections.unmodifiableSet(failedResolutionTargets),
-            ImmutableSortedSet.copyOf(DexMethod::slowCompareTo, bootstrapMethods),
+            Collections.unmodifiableSet(bootstrapMethods),
             ImmutableSortedSet.copyOf(DexMethod::slowCompareTo, methodsTargetedByInvokeDynamic),
             ImmutableSortedSet.copyOf(
                 DexMethod::slowCompareTo, virtualMethodsTargetedByInvokeDirect),