< prev index next >

src/share/vm/gc/cms/parNewGeneration.cpp

Print this page
rev 11970 : imported patch overflow_list

@@ -1261,11 +1261,11 @@
 // overflow stack draining strategy. If/when we start using fat
 // stacks here, we can go back to using (fat) pointer chains
 // (although some performance comparisons would be useful since
 // single global lists have their own performance disadvantages
 // as we were made painfully aware not long ago, see 6786503).
-#define BUSY (cast_to_oop<intptr_t>(0x1aff1aff))
+#define BUSY ((HeapWord*)(0x1aff1aff))
 void ParNewGeneration::push_on_overflow_list(oop from_space_obj, ParScanThreadState* par_scan_state) {
   assert(is_in_reserved(from_space_obj), "Should be from this generation");
   if (ParGCUseLocalOverflow) {
     // In the case of compressed oops, we use a private, not-shared
     // overflow stack.

@@ -1284,21 +1284,21 @@
     if (from_space_obj->forwardee() == from_space_obj) {
       oopDesc* listhead = NEW_C_HEAP_ARRAY(oopDesc, 1, mtGC);
       listhead->forward_to(from_space_obj);
       from_space_obj = listhead;
     }
-    oop observed_overflow_list = _overflow_list;
-    oop cur_overflow_list;
+    HeapWord* observed_overflow_list = _overflow_list;
+    HeapWord* cur_overflow_list;
     do {
       cur_overflow_list = observed_overflow_list;
       if (cur_overflow_list != BUSY) {
-        from_space_obj->set_klass_to_list_ptr(cur_overflow_list);
+        from_space_obj->set_klass_to_list_ptr(cast_to_oop<HeapWord*>(cur_overflow_list));
       } else {
         from_space_obj->set_klass_to_list_ptr(NULL);
       }
       observed_overflow_list =
-        (oop)Atomic::cmpxchg_ptr(from_space_obj, &_overflow_list, cur_overflow_list);
+        (HeapWord*)Atomic::cmpxchg_ptr(cast_from_oop<HeapWord*>(from_space_obj), &_overflow_list, cur_overflow_list);
     } while (cur_overflow_list != observed_overflow_list);
   }
 }
 
 bool ParNewGeneration::take_from_overflow_list(ParScanThreadState* par_scan_state) {

@@ -1337,11 +1337,11 @@
   assert(!UseCompressedOops, "Error");
   assert(par_scan_state->overflow_stack() == NULL, "Error");
   if (_overflow_list == NULL) return false;
 
   // Otherwise, there was something there; try claiming the list.
-  oop prefix = cast_to_oop(Atomic::xchg_ptr(BUSY, &_overflow_list));
+  HeapWord* prefix = (HeapWord*)Atomic::xchg_ptr(BUSY, &_overflow_list);
   // Trim off a prefix of at most objsFromOverflow items
   Thread* tid = Thread::current();
   size_t spin_count = ParallelGCThreads;
   size_t sleep_time_millis = MAX2((size_t)1, objsFromOverflow/100);
   for (size_t spin = 0; prefix == BUSY && spin < spin_count; spin++) {

@@ -1351,11 +1351,11 @@
     if (_overflow_list == NULL) {
       // nothing left to take
       return false;
     } else if (_overflow_list != BUSY) {
      // try and grab the prefix
-     prefix = cast_to_oop(Atomic::xchg_ptr(BUSY, &_overflow_list));
+      prefix = (HeapWord*)Atomic::xchg_ptr(BUSY, &_overflow_list);
     }
   }
   if (prefix == NULL || prefix == BUSY) {
      // Nothing to take or waited long enough
      if (prefix == NULL) {

@@ -1365,11 +1365,11 @@
      }
      return false;
   }
   assert(prefix != NULL && prefix != BUSY, "Error");
   size_t i = 1;
-  oop cur = prefix;
+  oop cur = cast_to_oop<HeapWord*>(prefix);
   while (i < objsFromOverflow && cur->klass_or_null() != NULL) {
     i++; cur = cur->list_ptr_from_klass();
   }
 
   // Reattach remaining (suffix) to overflow list

@@ -1384,16 +1384,16 @@
     oop suffix = cur->list_ptr_from_klass();       // suffix will be put back on global list
     cur->set_klass_to_list_ptr(NULL);     // break off suffix
     // It's possible that the list is still in the empty(busy) state
     // we left it in a short while ago; in that case we may be
     // able to place back the suffix.
-    oop observed_overflow_list = _overflow_list;
-    oop cur_overflow_list = observed_overflow_list;
+    HeapWord* observed_overflow_list = _overflow_list;
+    HeapWord* cur_overflow_list = observed_overflow_list;
     bool attached = false;
     while (observed_overflow_list == BUSY || observed_overflow_list == NULL) {
       observed_overflow_list =
-        (oop) Atomic::cmpxchg_ptr(suffix, &_overflow_list, cur_overflow_list);
+        (HeapWord*)Atomic::cmpxchg_ptr(suffix, &_overflow_list, cur_overflow_list);
       if (cur_overflow_list == observed_overflow_list) {
         attached = true;
         break;
       } else cur_overflow_list = observed_overflow_list;
     }

@@ -1408,23 +1408,23 @@
       observed_overflow_list = _overflow_list;
       do {
         cur_overflow_list = observed_overflow_list;
         if (cur_overflow_list != BUSY) {
           // Do the splice ...
-          last->set_klass_to_list_ptr(cur_overflow_list);
+          last->set_klass_to_list_ptr(cast_to_oop<HeapWord*>(cur_overflow_list));
         } else { // cur_overflow_list == BUSY
           last->set_klass_to_list_ptr(NULL);
         }
         observed_overflow_list =
-          (oop)Atomic::cmpxchg_ptr(suffix, &_overflow_list, cur_overflow_list);
+          (HeapWord*)Atomic::cmpxchg_ptr(cast_from_oop<HeapWord*>(suffix), &_overflow_list, cur_overflow_list);
       } while (cur_overflow_list != observed_overflow_list);
     }
   }
 
   // Push objects on prefix list onto this thread's work queue
   assert(prefix != NULL && prefix != BUSY, "program logic");
-  cur = prefix;
+  cur = cast_to_oop<HeapWord*>(prefix);
   ssize_t n = 0;
   while (cur != NULL) {
     oop obj_to_push = cur->forwardee();
     oop next        = cur->list_ptr_from_klass();
     cur->set_klass(obj_to_push->klass());
< prev index next >