< prev index next >

src/share/vm/jvmci/jvmciCompilerToVM.cpp

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

@@ -145,13 +145,13 @@
 uintptr_t CompilerToVM::Data::Universe_verify_oop_mask;
 uintptr_t CompilerToVM::Data::Universe_verify_oop_bits;
 
 bool       CompilerToVM::Data::_supports_inline_contig_alloc;
 HeapWord** CompilerToVM::Data::_heap_end_addr;
-HeapWord** CompilerToVM::Data::_heap_top_addr;
+HeapWord* volatile* CompilerToVM::Data::_heap_top_addr;
 
-jbyte* CompilerToVM::Data::cardtable_start_address;
+volatile jbyte* CompilerToVM::Data::cardtable_start_address;
 int CompilerToVM::Data::cardtable_shift;
 
 int CompilerToVM::Data::vm_page_size;
 
 void CompilerToVM::Data::initialize() {

@@ -177,20 +177,20 @@
   Universe_verify_oop_mask = Universe::verify_oop_mask();
   Universe_verify_oop_bits = Universe::verify_oop_bits();
 
   _supports_inline_contig_alloc = Universe::heap()->supports_inline_contig_alloc();
   _heap_end_addr = _supports_inline_contig_alloc ? Universe::heap()->end_addr() : (HeapWord**) -1;
-  _heap_top_addr = _supports_inline_contig_alloc ? Universe::heap()->top_addr() : (HeapWord**) -1;
+  _heap_top_addr = _supports_inline_contig_alloc ? Universe::heap()->top_addr() : (HeapWord* volatile*) -1;
 
   BarrierSet* bs = Universe::heap()->barrier_set();
   switch (bs->kind()) {
   case BarrierSet::CardTableModRef:
   case BarrierSet::CardTableForRS:
   case BarrierSet::CardTableExtension:
   case BarrierSet::G1SATBCT:
   case BarrierSet::G1SATBCTLogging: {
-    jbyte* base = barrier_set_cast<CardTableModRefBS>(bs)->byte_map_base;
+    volatile jbyte* base = barrier_set_cast<CardTableModRefBS>(bs)->byte_map_base;
     assert(base != 0, "unexpected byte_map_base");
     cardtable_start_address = base;
     cardtable_shift = CardTableModRefBS::card_shift;
     break;
   }

@@ -1338,11 +1338,11 @@
   // Check if the range is valid.
   if ((((unsigned int) length + (unsigned int) offset) > (unsigned int) array->length())) {
     THROW(vmSymbols::java_lang_ArrayIndexOutOfBoundsException());
   }
   while (length > 0) {
-    jbyte* start = array->byte_at_addr(offset);
+    volatile jbyte* start = array->byte_at_addr(offset);
     tty->write((char*) start, MIN2(length, O_BUFLEN));
     length -= O_BUFLEN;
     offset += O_BUFLEN;
   }
 C2V_END

@@ -1490,6 +1490,5 @@
 };
 
 int CompilerToVM::methods_count() {
   return sizeof(methods) / sizeof(JNINativeMethod);
 }
-
< prev index next >