src/share/vm/gc_implementation/concurrentMarkSweep/concurrentMarkSweepGeneration.cpp

changeset 5784
190899198332
parent 5694
7944aba7ba41
child 6088
40b8c6bad703
equal deleted inserted replaced
5783:c1fbf21c7397 5784:190899198332
9063 _num_par_pushes -=n; 9063 _num_par_pushes -=n;
9064 #endif 9064 #endif
9065 return !stack->isEmpty(); 9065 return !stack->isEmpty();
9066 } 9066 }
9067 9067
9068 #define BUSY (oop(0x1aff1aff)) 9068 #define BUSY (cast_to_oop<intptr_t>(0x1aff1aff))
9069 // (MT-safe) Get a prefix of at most "num" from the list. 9069 // (MT-safe) Get a prefix of at most "num" from the list.
9070 // The overflow list is chained through the mark word of 9070 // The overflow list is chained through the mark word of
9071 // each object in the list. We fetch the entire list, 9071 // each object in the list. We fetch the entire list,
9072 // break off a prefix of the right size and return the 9072 // break off a prefix of the right size and return the
9073 // remainder. If other threads try to take objects from 9073 // remainder. If other threads try to take objects from
9096 assert(num < work_q->max_elems(), "Can't bite more than we can chew"); 9096 assert(num < work_q->max_elems(), "Can't bite more than we can chew");
9097 if (_overflow_list == NULL) { 9097 if (_overflow_list == NULL) {
9098 return false; 9098 return false;
9099 } 9099 }
9100 // Grab the entire list; we'll put back a suffix 9100 // Grab the entire list; we'll put back a suffix
9101 oop prefix = (oop)Atomic::xchg_ptr(BUSY, &_overflow_list); 9101 oop prefix = cast_to_oop(Atomic::xchg_ptr(BUSY, &_overflow_list));
9102 Thread* tid = Thread::current(); 9102 Thread* tid = Thread::current();
9103 // Before "no_of_gc_threads" was introduced CMSOverflowSpinCount was 9103 // Before "no_of_gc_threads" was introduced CMSOverflowSpinCount was
9104 // set to ParallelGCThreads. 9104 // set to ParallelGCThreads.
9105 size_t CMSOverflowSpinCount = (size_t) no_of_gc_threads; // was ParallelGCThreads; 9105 size_t CMSOverflowSpinCount = (size_t) no_of_gc_threads; // was ParallelGCThreads;
9106 size_t sleep_time_millis = MAX2((size_t)1, num/100); 9106 size_t sleep_time_millis = MAX2((size_t)1, num/100);
9111 if (_overflow_list == NULL) { 9111 if (_overflow_list == NULL) {
9112 // Nothing left to take 9112 // Nothing left to take
9113 return false; 9113 return false;
9114 } else if (_overflow_list != BUSY) { 9114 } else if (_overflow_list != BUSY) {
9115 // Try and grab the prefix 9115 // Try and grab the prefix
9116 prefix = (oop)Atomic::xchg_ptr(BUSY, &_overflow_list); 9116 prefix = cast_to_oop(Atomic::xchg_ptr(BUSY, &_overflow_list));
9117 } 9117 }
9118 } 9118 }
9119 // If the list was found to be empty, or we spun long 9119 // If the list was found to be empty, or we spun long
9120 // enough, we give up and return empty-handed. If we leave 9120 // enough, we give up and return empty-handed. If we leave
9121 // the list in the BUSY state below, it must be the case that 9121 // the list in the BUSY state below, it must be the case that

mercurial