diff options
author | Hans Boehm <hboehm@google.com> | 2014-07-11 23:08:14 +0000 |
---|---|---|
committer | Gerrit Code Review <noreply-gerritcodereview@google.com> | 2014-07-11 16:35:27 +0000 |
commit | aebf3cda094f34cf846d19a7724bdc8005267c95 (patch) | |
tree | 9c396a3013f10eb6e996ae57a188699791f0fa80 /compiler/dex/compiler_enums.h | |
parent | 2751ffbe4e3192395e7402f93b597a397f01f889 (diff) | |
parent | 48f5c47907654350ce30a8dfdda0e977f5d3d39f (diff) | |
download | android_art-aebf3cda094f34cf846d19a7724bdc8005267c95.tar.gz android_art-aebf3cda094f34cf846d19a7724bdc8005267c95.tar.bz2 android_art-aebf3cda094f34cf846d19a7724bdc8005267c95.zip |
Merge "Replace memory barriers to better reflect Java needs."
Diffstat (limited to 'compiler/dex/compiler_enums.h')
-rw-r--r-- | compiler/dex/compiler_enums.h | 22 |
1 files changed, 13 insertions, 9 deletions
diff --git a/compiler/dex/compiler_enums.h b/compiler/dex/compiler_enums.h index 799a742032..bdedadbcf8 100644 --- a/compiler/dex/compiler_enums.h +++ b/compiler/dex/compiler_enums.h @@ -440,19 +440,23 @@ std::ostream& operator<<(std::ostream& os, const DividePattern& pattern); /** * @brief Memory barrier types (see "The JSR-133 Cookbook for Compiler Writers"). - * @details Without context sensitive analysis, the most conservative set of barriers - * must be issued to ensure the Java Memory Model. Thus the recipe is as follows: - * -# Use StoreStore barrier before volatile store. - * -# Use StoreLoad barrier after volatile store. - * -# Use LoadLoad and LoadStore barrier after each volatile load. + * @details We define the combined barrier types that are actually required + * by the Java Memory Model, rather than using exactly the terminology from + * the JSR-133 cookbook. These should, in many cases, be replaced by acquire/release + * primitives. Note that the JSR-133 cookbook generally does not deal with + * store atomicity issues, and the recipes there are not always entirely sufficient. + * The current recipe is as follows: + * -# Use AnyStore ~= (LoadStore | StoreStore) ~= release barrier before volatile store. + * -# Use AnyAny barrier after volatile store. (StoreLoad is as expensive.) + * -# Use LoadAny barrier ~= (LoadLoad | LoadStore) ~= acquire barrierafter each volatile load. * -# Use StoreStore barrier after all stores but before return from any constructor whose - * class has final fields. + * class has final fields. */ enum MemBarrierKind { - kLoadStore, - kLoadLoad, + kAnyStore, + kLoadAny, kStoreStore, - kStoreLoad + kAnyAny }; std::ostream& operator<<(std::ostream& os, const MemBarrierKind& kind); |