Suspend around Make...VisiblyInitialized
Remove the workarounds introduced in aosp/2212326, and replace them
with actual fixes. Also requires an additional handle introduction in
UnstartedClassForNameTest.
After this, we no longer disable thread state checking in any
MakeInitializedClassesVisiblyInitialized calls. Remove the mechanism
to do so.
Test: Build and boot AOSP.
Bug: 253691761
Change-Id: I4449c8715e154db504eb94d2da631428bfb52de4
diff --git a/runtime/class_linker.cc b/runtime/class_linker.cc
index 47f3325..f9c1596 100644
--- a/runtime/class_linker.cc
+++ b/runtime/class_linker.cc
@@ -316,20 +316,13 @@
std::forward_list<Barrier*> barriers_;
};
-void ClassLinker::MakeInitializedClassesVisiblyInitialized(Thread* self,
- bool wait,
- bool allowLockChecking) {
+void ClassLinker::MakeInitializedClassesVisiblyInitialized(Thread* self, bool wait) {
if (kRuntimeISA == InstructionSet::kX86 || kRuntimeISA == InstructionSet::kX86_64) {
return; // Nothing to do. Thanks to the x86 memory model classes skip the initialized status.
}
std::optional<Barrier> maybe_barrier; // Avoid constructing the Barrier for `wait == false`.
if (wait) {
- // TODO(b/253691761): The following conditional and the parameter should be removed when
- // possible so that AssertNotHeld() becomes unconditional. Currently EnterTransaction()
- // violates the assertion.
- if (allowLockChecking) {
- Locks::mutator_lock_->AssertNotHeld(self);
- }
+ Locks::mutator_lock_->AssertNotHeld(self);
maybe_barrier.emplace(0);
}
int wait_count = 0;