Make ScopedAssertNoThreadSuspension no overhead for non-debug
Previously it required Thread::Current() which may not be free.
The plan is to add a lot more ScopedAssertNoThreadSuspension in
the codebase.
Also cleaned up callers.
Bug: 31458474
Change-Id: I5a1621a5435476504d22266cc01a9bf26aab7568
diff --git a/compiler/image_writer.cc b/compiler/image_writer.cc
index 7634510..6d86f7d 100644
--- a/compiler/image_writer.cc
+++ b/compiler/image_writer.cc
@@ -868,7 +868,7 @@
// Clear references to removed classes from the DexCaches.
ArtMethod* resolution_method = runtime->GetResolutionMethod();
- ScopedAssertNoThreadSuspension sa(self, __FUNCTION__);
+ ScopedAssertNoThreadSuspension sa(__FUNCTION__);
ReaderMutexLock mu(self, *Locks::classlinker_classes_lock_); // For ClassInClassTable
ReaderMutexLock mu2(self, *class_linker->DexLock());
for (const ClassLinker::DexCacheData& data : class_linker->GetDexCachesData()) {