Ben Gamari pushed to branch wip/T26053 at Glasgow Haskell Compiler / GHC

Commits:

2 changed files:

Changes:

  • rts/sm/NonMovingMark.c
    ... ... @@ -619,7 +619,7 @@ inline void updateRemembSetPushThunk(Capability *cap, StgThunk *thunk)
    619 619
     {
    
    620 620
         const StgInfoTable *info;
    
    621 621
         do {
    
    622
    -        info = *(StgInfoTable* volatile*) &thunk->header.info;
    
    622
    +        info = (StgInfoTable*) RELAXED_LOAD(&thunk->header.info);
    
    623 623
         } while (info == &stg_WHITEHOLE_info);
    
    624 624
     
    
    625 625
         const StgThunkInfoTable *thunk_info = THUNK_INFO_PTR_TO_STRUCT(info);
    
    ... ... @@ -1343,7 +1343,7 @@ mark_closure (MarkQueue *queue, const StgClosure *p0, StgClosure **origin)
    1343 1343
                 goto done;
    
    1344 1344
     
    
    1345 1345
             case WHITEHOLE:
    
    1346
    -            while (*(StgInfoTable* volatile*) &p->header.info == &stg_WHITEHOLE_info)
    
    1346
    +            while (RELAXED_LOAD(&p->header.info) == &stg_WHITEHOLE_info)
    
    1347 1347
     #if defined(PARALLEL_GC)
    
    1348 1348
                     busy_wait_nop()
    
    1349 1349
     #endif
    
    ... ... @@ -1714,7 +1714,7 @@ mark_closure (MarkQueue *queue, const StgClosure *p0, StgClosure **origin)
    1714 1714
             break;
    
    1715 1715
     
    
    1716 1716
         case WHITEHOLE:
    
    1717
    -        while (*(StgInfoTable* volatile*) &p->header.info == &stg_WHITEHOLE_info);
    
    1717
    +        while ((StgInfoTable *) RELAXED_LOAD(&p->header.info) == &stg_WHITEHOLE_info);
    
    1718 1718
             goto try_again;
    
    1719 1719
     
    
    1720 1720
         case COMPACT_NFDATA:
    

  • rts/sm/Scav.c
    ... ... @@ -1276,6 +1276,7 @@ scavenge_one(StgPtr p)
    1276 1276
         bool no_luck;
    
    1277 1277
         bool saved_eager_promotion;
    
    1278 1278
     
    
    1279
    +try_again:
    
    1279 1280
         saved_eager_promotion = gct->eager_promotion;
    
    1280 1281
     
    
    1281 1282
         ASSERT(LOOKS_LIKE_CLOSURE_PTR(p));
    
    ... ... @@ -1617,6 +1618,13 @@ scavenge_one(StgPtr p)
    1617 1618
             scavenge_continuation((StgContinuation *)p);
    
    1618 1619
             break;
    
    1619 1620
     
    
    1621
    +    case WHITEHOLE:
    
    1622
    +        // This may happen when the nonmoving GC is in use via two paths:
    
    1623
    +        //   1. when an MVAR is being marked concurrently
    
    1624
    +        //   2. when the object belongs to a chain of selectors being short-cutted.
    
    1625
    +        while (get_itbl((StgClosure*) p) == &stg_WHITEHOLE_info);
    
    1626
    +        goto try_again;
    
    1627
    +
    
    1620 1628
         default:
    
    1621 1629
             barf("scavenge_one: strange object %d", (int)(info->type));
    
    1622 1630
         }