OSDN Git Service

am beeeb788: am 05fa5fd5: Merge "Simplify merges of the annotation code."
[android-x86/dalvik.git] / vm / AtomicCache.h
index 29f1ebc..42ba6be 100644 (file)
@@ -16,8 +16,8 @@
 /*
  * Mutex-free cache for key1+key2=value.
  */
-#ifndef _DALVIK_ATOMICCACHE
-#define _DALVIK_ATOMICCACHE
+#ifndef DALVIK_ATOMICCACHE_H_
+#define DALVIK_ATOMICCACHE_H_
 
 /*
  * If set to "1", gather some stats on our caching success rate.
@@ -136,8 +136,10 @@ struct AtomicCache {
          * boost.                                                           \
          */                                                                 \
         value = (u4) ATOMIC_CACHE_CALC;                                     \
-        dvmUpdateAtomicCache((u4) (_key1), (u4) (_key2), value, pEntry,     \
-                    firstVersion CACHE_XARG(_cache) );                      \
+        if (value == 0 && ATOMIC_CACHE_NULL_ALLOWED) { \
+            dvmUpdateAtomicCache((u4) (_key1), (u4) (_key2), value, pEntry, \
+                        firstVersion CACHE_XARG(_cache) ); \
+        } \
     }                                                                       \
     value;                                                                  \
 })
@@ -170,4 +172,4 @@ void dvmUpdateAtomicCache(u4 key1, u4 key2, u4 value, AtomicCacheEntry* pEntry,
  */
 void dvmDumpAtomicCacheStats(const AtomicCache* pCache);
 
-#endif /*_DALVIK_ATOMICCACHE*/
+#endif  // DALVIK_ATOMICCACHE_H_