< prev index next >

src/hotspot/share/gc/cms/concurrentMarkSweepGeneration.cpp

Print this page

        

*** 7777,7787 **** size_t i = num; oop cur = _overflow_list; const markWord proto = markWord::prototype(); NOT_PRODUCT(ssize_t n = 0;) for (oop next; i > 0 && cur != NULL; cur = next, i--) { ! next = oop((void*)cur->mark_raw().value()); cur->set_mark_raw(proto); // until proven otherwise assert(oopDesc::is_oop(cur), "Should be an oop"); bool res = stack->push(cur); assert(res, "Bit off more than can chew?"); NOT_PRODUCT(n++;) --- 7777,7787 ---- size_t i = num; oop cur = _overflow_list; const markWord proto = markWord::prototype(); NOT_PRODUCT(ssize_t n = 0;) for (oop next; i > 0 && cur != NULL; cur = next, i--) { ! next = oop(cur->mark_raw().to_pointer()); cur->set_mark_raw(proto); // until proven otherwise assert(oopDesc::is_oop(cur), "Should be an oop"); bool res = stack->push(cur); assert(res, "Bit off more than can chew?"); NOT_PRODUCT(n++;)
*** 7861,7884 **** } assert(prefix != NULL && prefix != BUSY, "Error"); size_t i = num; oop cur = prefix; // Walk down the first "num" objects, unless we reach the end. ! for (; i > 1 && cur->mark_raw().value() != 0; cur = oop((void*)cur->mark_raw().value()), i--); ! if (cur->mark_raw().value() == 0) { // We have "num" or fewer elements in the list, so there // is nothing to return to the global list. // Write back the NULL in lieu of the BUSY we wrote // above, if it is still the same value. if (_overflow_list == BUSY) { Atomic::cmpxchg((oopDesc*)NULL, &_overflow_list, (oopDesc*)BUSY); } } else { // Chop off the suffix and return it to the global list. ! assert(cur->mark_raw().value() != (uintptr_t)(void*)BUSY, "Error"); ! oop suffix_head = oop((void*)cur->mark_raw().value()); // suffix will be put back on global list ! cur->set_mark_raw(markWord(0)); // 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 without incurring the cost // of a walk down the list. oop observed_overflow_list = _overflow_list; --- 7861,7884 ---- } assert(prefix != NULL && prefix != BUSY, "Error"); size_t i = num; oop cur = prefix; // Walk down the first "num" objects, unless we reach the end. ! for (; i > 1 && cur->mark_raw().to_pointer() != NULL; cur = oop(cur->mark_raw().to_pointer()), i--); ! if (cur->mark_raw().to_pointer() == NULL) { // We have "num" or fewer elements in the list, so there // is nothing to return to the global list. // Write back the NULL in lieu of the BUSY we wrote // above, if it is still the same value. if (_overflow_list == BUSY) { Atomic::cmpxchg((oopDesc*)NULL, &_overflow_list, (oopDesc*)BUSY); } } else { // Chop off the suffix and return it to the global list. ! assert(cur->mark_raw().to_pointer() != (void*)BUSY, "Error"); ! oop suffix_head = oop(cur->mark_raw().to_pointer()); // suffix will be put back on global list ! cur->set_mark_raw(markWord::from_pointer(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 without incurring the cost // of a walk down the list. oop observed_overflow_list = _overflow_list;
*** 7894,7915 **** } if (!attached) { // Too bad, someone else sneaked in (at least) an element; we'll need // to do a splice. Find tail of suffix so we can prepend suffix to global // list. ! for (cur = suffix_head; cur->mark_raw().value() != 0; cur = (oop)((void*)cur->mark_raw().value())); oop suffix_tail = cur; ! assert(suffix_tail != NULL && suffix_tail->mark_raw().value() == 0, "Tautology"); observed_overflow_list = _overflow_list; do { cur_overflow_list = observed_overflow_list; if (cur_overflow_list != BUSY) { // Do the splice ... ! suffix_tail->set_mark_raw(markWord((uintptr_t)(void*)cur_overflow_list)); } else { // cur_overflow_list == BUSY ! suffix_tail->set_mark_raw(markWord(0)); } // ... and try to place spliced list back on overflow_list ... observed_overflow_list = Atomic::cmpxchg((oopDesc*)suffix_head, &_overflow_list, (oopDesc*)cur_overflow_list); } while (cur_overflow_list != observed_overflow_list); --- 7894,7915 ---- } if (!attached) { // Too bad, someone else sneaked in (at least) an element; we'll need // to do a splice. Find tail of suffix so we can prepend suffix to global // list. ! for (cur = suffix_head; cur->mark_raw().to_pointer() != NULL; cur = (oop)(cur->mark_raw().to_pointer())); oop suffix_tail = cur; ! assert(suffix_tail != NULL && suffix_tail->mark_raw().to_pointer() == NULL, "Tautology"); observed_overflow_list = _overflow_list; do { cur_overflow_list = observed_overflow_list; if (cur_overflow_list != BUSY) { // Do the splice ... ! suffix_tail->set_mark_raw(markWord::from_pointer((void*)cur_overflow_list)); } else { // cur_overflow_list == BUSY ! suffix_tail->set_mark_raw(markWord::from_pointer(NULL)); } // ... and try to place spliced list back on overflow_list ... observed_overflow_list = Atomic::cmpxchg((oopDesc*)suffix_head, &_overflow_list, (oopDesc*)cur_overflow_list); } while (cur_overflow_list != observed_overflow_list);
*** 7921,7931 **** assert(prefix != NULL, "control point invariant"); const markWord proto = markWord::prototype(); oop next; NOT_PRODUCT(ssize_t n = 0;) for (cur = prefix; cur != NULL; cur = next) { ! next = oop((void*)cur->mark_raw().value()); cur->set_mark_raw(proto); // until proven otherwise assert(oopDesc::is_oop(cur), "Should be an oop"); bool res = work_q->push(cur); assert(res, "Bit off more than we can chew?"); NOT_PRODUCT(n++;) --- 7921,7931 ---- assert(prefix != NULL, "control point invariant"); const markWord proto = markWord::prototype(); oop next; NOT_PRODUCT(ssize_t n = 0;) for (cur = prefix; cur != NULL; cur = next) { ! next = oop(cur->mark_raw().to_pointer()); cur->set_mark_raw(proto); // until proven otherwise assert(oopDesc::is_oop(cur), "Should be an oop"); bool res = work_q->push(cur); assert(res, "Bit off more than we can chew?"); NOT_PRODUCT(n++;)
*** 7954,7966 **** oop observed_overflow_list = _overflow_list; oop cur_overflow_list; do { cur_overflow_list = observed_overflow_list; if (cur_overflow_list != BUSY) { ! p->set_mark_raw(markWord((uintptr_t)(void*)cur_overflow_list)); } else { ! p->set_mark_raw(markWord(0)); } observed_overflow_list = Atomic::cmpxchg((oopDesc*)p, &_overflow_list, (oopDesc*)cur_overflow_list); } while (cur_overflow_list != observed_overflow_list); } --- 7954,7966 ---- oop observed_overflow_list = _overflow_list; oop cur_overflow_list; do { cur_overflow_list = observed_overflow_list; if (cur_overflow_list != BUSY) { ! p->set_mark_raw(markWord::from_pointer((void*)cur_overflow_list)); } else { ! p->set_mark_raw(markWord::from_pointer(NULL)); } observed_overflow_list = Atomic::cmpxchg((oopDesc*)p, &_overflow_list, (oopDesc*)cur_overflow_list); } while (cur_overflow_list != observed_overflow_list); }
< prev index next >