Reduce class loader updating overhead.
Avoid unnecessary read barrier for comparing class loader agianst
null. Avoid transaction check.
Deleted the helper class to simplify the code.
The time goes from ~3.8ms to ~2.9ms on Maps.
Test: test-art-host
Bug: 116052292
Change-Id: I4a966a9bb39400ba58d7cf3e0b2c8ab4747d65ed
diff --git a/runtime/mirror/class.h b/runtime/mirror/class.h
index bb54b3d..c38cc86 100644
--- a/runtime/mirror/class.h
+++ b/runtime/mirror/class.h
@@ -628,6 +628,7 @@
ReadBarrierOption kReadBarrierOption = kWithReadBarrier>
ClassLoader* GetClassLoader() ALWAYS_INLINE REQUIRES_SHARED(Locks::mutator_lock_);
+ template <bool kCheckTransaction = true>
void SetClassLoader(ObjPtr<ClassLoader> new_cl) REQUIRES_SHARED(Locks::mutator_lock_);
static constexpr MemberOffset DexCacheOffset() {