src/share/vm/gc_implementation/g1/concurrentMark.cpp

Print this page
rev 6068 : 8036673: G1: Abort weak reference processing if mark stack overflows


2511     // oop closures will set the has_overflown flag if we overflow the
2512     // global marking stack.
2513 
2514     assert(_markStack.overflow() || _markStack.isEmpty(),
2515             "mark stack should be empty (unless it overflowed)");
2516 
2517     if (_markStack.overflow()) {
2518       // This should have been done already when we tried to push an
2519       // entry on to the global mark stack. But let's do it again.
2520       set_has_overflown();
2521     }
2522 
2523     assert(rp->num_q() == active_workers, "why not");
2524 
2525     rp->enqueue_discovered_references(executor);
2526 
2527     rp->verify_no_references_recorded();
2528     assert(!rp->discovery_enabled(), "Post condition");
2529   }
2530 





2531   g1h->unlink_string_and_symbol_table(&g1_is_alive,
2532                                       /* process_strings */ false, // currently strings are always roots
2533                                       /* process_symbols */ true);
2534 }
2535 
2536 void ConcurrentMark::swapMarkBitMaps() {
2537   CMBitMapRO* temp = _prevMarkBitMap;
2538   _prevMarkBitMap  = (CMBitMapRO*)_nextMarkBitMap;
2539   _nextMarkBitMap  = (CMBitMap*)  temp;
2540 }
2541 
2542 class CMRemarkTask: public AbstractGangTask {
2543 private:
2544   ConcurrentMark* _cm;
2545   bool            _is_serial;
2546 public:
2547   void work(uint worker_id) {
2548     // Since all available tasks are actually started, we should
2549     // only proceed if we're supposed to be active.
2550     if (worker_id < _cm->active_tasks()) {




2511     // oop closures will set the has_overflown flag if we overflow the
2512     // global marking stack.
2513 
2514     assert(_markStack.overflow() || _markStack.isEmpty(),
2515             "mark stack should be empty (unless it overflowed)");
2516 
2517     if (_markStack.overflow()) {
2518       // This should have been done already when we tried to push an
2519       // entry on to the global mark stack. But let's do it again.
2520       set_has_overflown();
2521     }
2522 
2523     assert(rp->num_q() == active_workers, "why not");
2524 
2525     rp->enqueue_discovered_references(executor);
2526 
2527     rp->verify_no_references_recorded();
2528     assert(!rp->discovery_enabled(), "Post condition");
2529   }
2530 
2531   if (has_overflown()) {
2532     // We can not trust g1_is_alive if the marking stack overflowed
2533     return;
2534   }
2535 
2536   g1h->unlink_string_and_symbol_table(&g1_is_alive,
2537                                       /* process_strings */ false, // currently strings are always roots
2538                                       /* process_symbols */ true);
2539 }
2540 
2541 void ConcurrentMark::swapMarkBitMaps() {
2542   CMBitMapRO* temp = _prevMarkBitMap;
2543   _prevMarkBitMap  = (CMBitMapRO*)_nextMarkBitMap;
2544   _nextMarkBitMap  = (CMBitMap*)  temp;
2545 }
2546 
2547 class CMRemarkTask: public AbstractGangTask {
2548 private:
2549   ConcurrentMark* _cm;
2550   bool            _is_serial;
2551 public:
2552   void work(uint worker_id) {
2553     // Since all available tasks are actually started, we should
2554     // only proceed if we're supposed to be active.
2555     if (worker_id < _cm->active_tasks()) {