Cheng Shao pushed to branch wip/rts-fix-missing-untag at Glasgow Haskell Compiler / GHC

Commits:

2 changed files:

Changes:

  • rts/ContinuationOps.cmm
    ... ... @@ -108,7 +108,7 @@ stg_control0zh_ll // explicit stack
    108 108
       }
    
    109 109
     
    
    110 110
       W_ apply_mask_frame;
    
    111
    -  apply_mask_frame = StgContinuation_apply_mask_frame(cont);
    
    111
    +  apply_mask_frame = StgContinuation_apply_mask_frame(UNTAG(cont));
    
    112 112
     
    
    113 113
       // The stack has been updated, so it’s time to apply the input function,
    
    114 114
       // passing the captured continuation and a RealWorld token as arguments.
    

  • rts/PrimOps.cmm
    ... ... @@ -1565,7 +1565,10 @@ stg_readTVarIOzh ( P_ tvar /* :: TVar a */ )
    1565 1565
     
    
    1566 1566
     again:
    
    1567 1567
         result = %acquire StgTVar_current_value(tvar);
    
    1568
    -    resultinfo = %INFO_PTR(result);
    
    1568
    +    // when result is stg_TREC_HEADER_info, it's word aligned so UNTAG
    
    1569
    +    // is no-op; if it's a tagged closure we must UNTAG it to avoid an
    
    1570
    +    // unaligned memory access
    
    1571
    +    resultinfo = %INFO_PTR(UNTAG(result));
    
    1569 1572
         if (resultinfo == stg_TREC_HEADER_info) {
    
    1570 1573
             goto again;
    
    1571 1574
         }