< prev index next >

src/share/vm/gc/parallel/cardTableExtension.hpp

Print this page
rev 10742 : Make fields used in lock-free algorithms volatile

@@ -72,21 +72,21 @@
   static void verify_all_young_refs_precise();
 
   bool addr_is_marked_imprecise(void *addr);
   bool addr_is_marked_precise(void *addr);
 
-  void set_card_newgen(void* addr)   { jbyte* p = byte_for(addr); *p = verify_card; }
+  void set_card_newgen(void* addr)   { volatile jbyte* p = byte_for(addr); *p = verify_card; }
 
   // Testers for entries
   static bool card_is_dirty(int value)      { return value == dirty_card; }
   static bool card_is_newgen(int value)     { return value == youngergen_card; }
   static bool card_is_clean(int value)      { return value == clean_card; }
   static bool card_is_verify(int value)     { return value == verify_card; }
 
   // Card marking
   void inline_write_ref_field_gc(void* field, oop new_val) {
-    jbyte* byte = byte_for(field);
+    volatile jbyte* byte = byte_for(field);
     *byte = youngergen_card;
   }
 
   // Adaptive size policy support
   // Allows adjustment of the base and size of the covered regions

@@ -101,11 +101,11 @@
   // previous (i.e., lower index) to the covered region with index "ind".
   HeapWord* lowest_prev_committed_start(int ind) const;
 
 #ifdef ASSERT
 
-  bool is_valid_card_address(jbyte* addr) {
+  bool is_valid_card_address(volatile jbyte* addr) {
     return (addr >= _byte_map) && (addr < _byte_map + _byte_map_size);
   }
 
 #endif // ASSERT
 };
< prev index next >