Abstract SetField functions with Transaction check
Abstracted several functions which set objects' fields with a check to
test whether transaction is active to determine one template argument,
this make more object modification operations support transaction.
Replaced some function calls with transaction checking version to
support clinit for app image to run under transaction.
Tests shows not breaking anything, testcase cover this situation will be
added shortly.
Test: make test-art-host -j64
Change-Id: Ic15a4428a7c7cce6832651e1894eb760354de009
diff --git a/runtime/mirror/class.cc b/runtime/mirror/class.cc
index e4b5320..b0e5b6a 100644
--- a/runtime/mirror/class.cc
+++ b/runtime/mirror/class.cc
@@ -191,7 +191,7 @@
}
void Class::SetDexCache(ObjPtr<DexCache> new_dex_cache) {
- SetFieldObject<false>(OFFSET_OF_OBJECT_MEMBER(Class, dex_cache_), new_dex_cache);
+ SetFieldObjectTransaction(OFFSET_OF_OBJECT_MEMBER(Class, dex_cache_), new_dex_cache);
}
void Class::SetClassSize(uint32_t new_class_size) {
@@ -200,8 +200,7 @@
LOG(FATAL_WITHOUT_ABORT) << new_class_size << " vs " << GetClassSize();
LOG(FATAL) << "class=" << PrettyTypeOf();
}
- // Not called within a transaction.
- SetField32<false>(OFFSET_OF_OBJECT_MEMBER(Class, class_size_), new_class_size);
+ SetField32Transaction(OFFSET_OF_OBJECT_MEMBER(Class, class_size_), new_class_size);
}
// Return the class' name. The exact format is bizarre, but it's the specified behavior for