summaryrefslogtreecommitdiffstats
path: root/runtime/mirror/class-inl.h
diff options
context:
space:
mode:
authorMathieu Chartier <mathieuc@google.com>2015-08-18 18:35:52 -0700
committerMathieu Chartier <mathieuc@google.com>2015-08-21 10:25:36 -0700
commit52a7f5caebdf359ab877f1928aad59f1e9ad29fa (patch)
treefe23aeb3682128a31c62324e427b906c9804afd3 /runtime/mirror/class-inl.h
parent944973e56fd3c04c92d902b05d0148f77ed28a78 (diff)
downloadart-52a7f5caebdf359ab877f1928aad59f1e9ad29fa.tar.gz
art-52a7f5caebdf359ab877f1928aad59f1e9ad29fa.tar.bz2
art-52a7f5caebdf359ab877f1928aad59f1e9ad29fa.zip
Add class flags to class to help GC scanning
Reduces GC time and pauses by reducing the number of loads required to scan an object. Average total GC time before on EvaluateAndApplyChanges (EAAC): 7.452s After: 7.144s Average GC pause times before on EAAC: 860.67us After: 722.75us Adding the class flags field cause a memory increase of ~24k system wide on low memory devices. Change-Id: I3f04212d5787bfbf5e55026584d149f55476105e
Diffstat (limited to 'runtime/mirror/class-inl.h')
-rw-r--r--runtime/mirror/class-inl.h13
1 files changed, 11 insertions, 2 deletions
diff --git a/runtime/mirror/class-inl.h b/runtime/mirror/class-inl.h
index cd678f670b..b2c6e4da12 100644
--- a/runtime/mirror/class-inl.h
+++ b/runtime/mirror/class-inl.h
@@ -547,6 +547,7 @@ inline uint32_t Class::GetAccessFlags() {
inline String* Class::GetName() {
return GetFieldObject<String>(OFFSET_OF_OBJECT_MEMBER(Class, name_));
}
+
inline void Class::SetName(String* name) {
if (Runtime::Current()->IsActiveTransaction()) {
SetFieldObject<true>(OFFSET_OF_OBJECT_MEMBER(Class, name_), name);
@@ -784,9 +785,17 @@ inline void Class::InitializeClassVisitor::operator()(
inline void Class::SetAccessFlags(uint32_t new_access_flags) {
// Called inside a transaction when setting pre-verified flag during boot image compilation.
if (Runtime::Current()->IsActiveTransaction()) {
- SetField32<true>(OFFSET_OF_OBJECT_MEMBER(Class, access_flags_), new_access_flags);
+ SetField32<true>(AccessFlagsOffset(), new_access_flags);
+ } else {
+ SetField32<false>(AccessFlagsOffset(), new_access_flags);
+ }
+}
+
+inline void Class::SetClassFlags(uint32_t new_flags) {
+ if (Runtime::Current()->IsActiveTransaction()) {
+ SetField32<true>(OFFSET_OF_OBJECT_MEMBER(Class, class_flags_), new_flags);
} else {
- SetField32<false>(OFFSET_OF_OBJECT_MEMBER(Class, access_flags_), new_access_flags);
+ SetField32<false>(OFFSET_OF_OBJECT_MEMBER(Class, class_flags_), new_flags);
}
}