diff options
author | Calin Juravle <calin@google.com> | 2015-04-17 19:12:31 +0100 |
---|---|---|
committer | Calin Juravle <calin@google.com> | 2015-04-20 14:02:51 +0100 |
commit | 27df758e2e7baebb6e3f393f9732fd0d064420c8 (patch) | |
tree | 261207281fd574deffb4dc1c1bc6bea8f150993e /compiler/driver/compiler_driver.cc | |
parent | f8bdd9f3a002970e4b8fdcf6fe6730116f1626c3 (diff) | |
download | android_art-27df758e2e7baebb6e3f393f9732fd0d064420c8.tar.gz android_art-27df758e2e7baebb6e3f393f9732fd0d064420c8.tar.bz2 android_art-27df758e2e7baebb6e3f393f9732fd0d064420c8.zip |
[optimizing] Add memory barriers in constructors when needed
If a class has final fields we must add a memory barrier before
returning from constructor. This makes sure the fields are visible to
other threads.
Bug: 19851497
Change-Id: If8c485092fc512efb9636cd568cb0543fb27688e
Diffstat (limited to 'compiler/driver/compiler_driver.cc')
-rw-r--r-- | compiler/driver/compiler_driver.cc | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/compiler/driver/compiler_driver.cc b/compiler/driver/compiler_driver.cc index 641d174935..538d969c12 100644 --- a/compiler/driver/compiler_driver.cc +++ b/compiler/driver/compiler_driver.cc @@ -2381,7 +2381,7 @@ void CompilerDriver::AddRequiresConstructorBarrier(Thread* self, const DexFile* } bool CompilerDriver::RequiresConstructorBarrier(Thread* self, const DexFile* dex_file, - uint16_t class_def_index) { + uint16_t class_def_index) const { ReaderMutexLock mu(self, freezing_constructor_lock_); return freezing_constructor_classes_.count(ClassReference(dex_file, class_def_index)) != 0; } |