Revert "Don't wait with mutator lock"

This reverts commit d2de05d5a441cb99b8c2ec1eb4ed0e9f4804fe7a.

Bug: 243086427

Reason for revert: Fails gtests and run-test

Change-Id: I7740cd971058ae01bdc62920ccc2098dbb5039ea
diff --git a/runtime/class_linker.cc b/runtime/class_linker.cc
index 2582d82..dc67dca 100644
--- a/runtime/class_linker.cc
+++ b/runtime/class_linker.cc
@@ -322,7 +322,6 @@
   }
   std::optional<Barrier> maybe_barrier;  // Avoid constructing the Barrier for `wait == false`.
   if (wait) {
-    Locks::mutator_lock_->AssertNotHeld(self);
     maybe_barrier.emplace(0);
   }
   int wait_count = 0;
diff --git a/runtime/class_linker.h b/runtime/class_linker.h
index 9098c71..eb97140 100644
--- a/runtime/class_linker.h
+++ b/runtime/class_linker.h
@@ -807,7 +807,7 @@
     return cha_.get();
   }
 
-  void MakeInitializedClassesVisiblyInitialized(Thread* self, bool wait /* ==> no locks held */);
+  void MakeInitializedClassesVisiblyInitialized(Thread* self, bool wait);
 
   // Registers the native method and returns the new entry point. NB The returned entry point
   // might be different from the native_method argument if some MethodCallback modifies it.
diff --git a/runtime/runtime.cc b/runtime/runtime.cc
index 880deb0..b291e7d 100644
--- a/runtime/runtime.cc
+++ b/runtime/runtime.cc
@@ -753,16 +753,13 @@
     GetJit()->PreZygoteFork();
   }
   if (!heap_->HasZygoteSpace()) {
-    Thread* self = Thread::Current();
     // This is the first fork. Update ArtMethods in the boot classpath now to
     // avoid having forked apps dirty the memory.
-
+    ScopedObjectAccess soa(Thread::Current());
     // Ensure we call FixupStaticTrampolines on all methods that are
     // initialized.
-    class_linker_->MakeInitializedClassesVisiblyInitialized(self, /*wait=*/ true);
-
-    ScopedObjectAccess soa(self);
-    UpdateMethodsPreFirstForkVisitor visitor(self, class_linker_);
+    class_linker_->MakeInitializedClassesVisiblyInitialized(soa.Self(), /*wait=*/ true);
+    UpdateMethodsPreFirstForkVisitor visitor(soa.Self(), class_linker_);
     class_linker_->VisitClasses(&visitor);
   }
   heap_->PreZygoteFork();