diff options
| author | 2016-04-07 13:19:19 -0700 | |
|---|---|---|
| committer | 2016-04-08 10:33:00 -0700 | |
| commit | c4ae916def97b9e1ef6df35c8fabb3921a0e380c (patch) | |
| tree | 9423d8a1df2ae043e2a9abb7a20977d849d1b7d6 /compiler/driver/compiler_driver.h | |
| parent | b5d386118334fa5181c31b83b3fee6332537f4b7 (diff) | |
Store precice set of which constructors require barriers
Fixes bugs where things in the boot image might not have been
calculated even though resolved_clases was true. This only occured
for app and test compiles though.
Fixes test 476-checker-ctor-memory-barrier which was failing due to
inlining something in the boot class path and getting a unexpected
barrier since the barrier defaults to enabled.
No measurable increase in RAM usage.
Bug: 28005874
Change-Id: I4a417819aa129c95f4a83c38df1a66eb77824ea9
Diffstat (limited to 'compiler/driver/compiler_driver.h')
| -rw-r--r-- | compiler/driver/compiler_driver.h | 28 |
1 files changed, 14 insertions, 14 deletions
diff --git a/compiler/driver/compiler_driver.h b/compiler/driver/compiler_driver.h index 0ed0bb6af7..905f84dd45 100644 --- a/compiler/driver/compiler_driver.h +++ b/compiler/driver/compiler_driver.h @@ -183,12 +183,15 @@ class CompilerDriver { // Remove and delete a compiled method. void RemoveCompiledMethod(const MethodReference& method_ref) REQUIRES(!compiled_methods_lock_); - void AddRequiresNoConstructorBarrier(Thread* self, const DexFile* dex_file, - uint16_t class_def_index) - REQUIRES(!no_barrier_constructor_classes_lock_); - bool RequiresConstructorBarrier(Thread* self, const DexFile* dex_file, - uint16_t class_def_index) const - REQUIRES(!no_barrier_constructor_classes_lock_); + void SetRequiresConstructorBarrier(Thread* self, + const DexFile* dex_file, + uint16_t class_def_index, + bool requires) + REQUIRES(!requires_constructor_barrier_lock_); + bool RequiresConstructorBarrier(Thread* self, + const DexFile* dex_file, + uint16_t class_def_index) + REQUIRES(!requires_constructor_barrier_lock_); // Callbacks from compiler to see what runtime checks must be generated. @@ -631,14 +634,11 @@ class CompilerDriver { const InstructionSet instruction_set_; const InstructionSetFeatures* const instruction_set_features_; - // All class references that do not require constructor barriers. Only filled in if - // resolved_classes_ is true. - mutable ReaderWriterMutex no_barrier_constructor_classes_lock_ DEFAULT_MUTEX_ACQUIRED_AFTER; - std::set<ClassReference> no_barrier_constructor_classes_ - GUARDED_BY(no_barrier_constructor_classes_lock_); - // resolved_classes_ is true if we performed the resolve phase and filled in - // no_barrier_constructor_classes_. - bool resolved_classes_; + // All class references that require constructor barriers. If the class reference is not in the + // set then the result has not yet been computed. + mutable ReaderWriterMutex requires_constructor_barrier_lock_ DEFAULT_MUTEX_ACQUIRED_AFTER; + std::map<ClassReference, bool> requires_constructor_barrier_ + GUARDED_BY(requires_constructor_barrier_lock_); typedef SafeMap<const ClassReference, CompiledClass*> ClassTable; // All class references that this compiler has compiled. |