summaryrefslogtreecommitdiffstats
path: root/runtime/mirror/class.cc
diff options
context:
space:
mode:
authorIan Rogers <irogers@google.com>2014-06-02 14:24:56 -0700
committerIan Rogers <irogers@google.com>2014-06-02 16:15:27 -0700
commit03dbc04d1d5a3bd62801989b16e994a9ed0dafb5 (patch)
treebe9bffd095457a060dc8a23b9405d725e542cdff /runtime/mirror/class.cc
parent502a1975e146b288356e49a3af82629637da5ece (diff)
downloadart-03dbc04d1d5a3bd62801989b16e994a9ed0dafb5.zip
art-03dbc04d1d5a3bd62801989b16e994a9ed0dafb5.tar.gz
art-03dbc04d1d5a3bd62801989b16e994a9ed0dafb5.tar.bz2
Make class status volatile.
Discourage loads and stores from reordering around the status being updated. Bug: 15347354 Change-Id: Ice805cb834617747c8209e98a142d3e5c7585719
Diffstat (limited to 'runtime/mirror/class.cc')
-rw-r--r--runtime/mirror/class.cc6
1 files changed, 3 insertions, 3 deletions
diff --git a/runtime/mirror/class.cc b/runtime/mirror/class.cc
index 4869b45..4b02c0f 100644
--- a/runtime/mirror/class.cc
+++ b/runtime/mirror/class.cc
@@ -105,11 +105,11 @@ void Class::SetStatus(Status new_status, Thread* self) {
self->SetException(gc_safe_throw_location, old_exception.Get());
}
- CHECK(sizeof(Status) == sizeof(uint32_t)) << PrettyClass(this);
+ COMPILE_ASSERT(sizeof(Status) == sizeof(uint32_t), size_of_status_not_uint32);
if (Runtime::Current()->IsActiveTransaction()) {
- SetField32<true>(OFFSET_OF_OBJECT_MEMBER(Class, status_), new_status);
+ SetField32Volatile<true>(OFFSET_OF_OBJECT_MEMBER(Class, status_), new_status);
} else {
- SetField32<false>(OFFSET_OF_OBJECT_MEMBER(Class, status_), new_status);
+ SetField32Volatile<false>(OFFSET_OF_OBJECT_MEMBER(Class, status_), new_status);
}
// Classes that are being resolved or initialized need to notify waiters that the class status
// changed. See ClassLinker::EnsureResolved and ClassLinker::WaitForInitializeClass.