Duncan Coutts pushed to branch wip/dcoutts/io-manager-io-primop-exceptions at Glasgow Haskell Compiler / GHC

Commits:

2 changed files:

Changes:

  • rts/HeapStackCheck.cmm
    ... ... @@ -20,6 +20,7 @@ import ReleaseSRWLockExclusives;
    20 20
     #if !defined(UnregisterisedCompiler)
    
    21 21
     import CLOSURE g0;
    
    22 22
     import CLOSURE large_alloc_lim;
    
    23
    +import CLOSURE ghc_hs_iface;
    
    23 24
     import CLOSURE stg_MSG_THROWTO_info;
    
    24 25
     import CLOSURE stg_MVAR_DIRTY_info;
    
    25 26
     import CLOSURE stg_WHITEHOLE_info;
    

  • rts/PrimOps.cmm
    ... ... @@ -2297,7 +2297,31 @@ stg_whereFromzh (P_ clos, W_ buf)
    2297 2297
        Thread I/O blocking primitives
    
    2298 2298
        -------------------------------------------------------------------------- */
    
    2299 2299
     
    
    2300
    -stg_waitReadyFd ( W_ fd, CInt rw )
    
    2300
    +import stg_handleIOSubmitResult; // Forward decl
    
    2301
    +
    
    2302
    +stg_waitReadzh ( W_ fd )
    
    2303
    +{
    
    2304
    +    CInt result;
    
    2305
    +
    
    2306
    +    (result) = ccall syncIOWaitReady(Capability_iomgr(MyCapability()) "ptr",
    
    2307
    +                                     CurrentTSO "ptr",
    
    2308
    +                                     /* IORead */ 0::CInt, fd);
    
    2309
    +
    
    2310
    +    jump stg_handleIOSubmitResult(result);
    
    2311
    +}
    
    2312
    +
    
    2313
    +stg_waitWritezh ( W_ fd )
    
    2314
    +{
    
    2315
    +    CInt result;
    
    2316
    +
    
    2317
    +    (result) = ccall syncIOWaitReady(Capability_iomgr(MyCapability()) "ptr",
    
    2318
    +                                     CurrentTSO "ptr",
    
    2319
    +                                     /* IOWrite */ 1::CInt, fd);
    
    2320
    +
    
    2321
    +    jump stg_handleIOSubmitResult(result);
    
    2322
    +}
    
    2323
    +
    
    2324
    +stg_handleIOSubmitResult ( W_ fd, CInt rw )
    
    2301 2325
     {
    
    2302 2326
         CInt result;
    
    2303 2327
     
    
    ... ... @@ -2313,7 +2337,7 @@ stg_waitReadyFd ( W_ fd, CInt rw )
    2313 2337
         }
    
    2314 2338
     
    
    2315 2339
         /* case IOSubmitResultSyncSuccess*/
    
    2316
    -    if (result == 1::CInt) {
    
    2340
    +    if (result == 1::CInt) (likely: True) {
    
    2317 2341
             /* Success, don't even go via scheduler. */
    
    2318 2342
             return ();
    
    2319 2343
         }
    
    ... ... @@ -2336,16 +2360,6 @@ stg_waitReadyFd ( W_ fd, CInt rw )
    2336 2360
         ccall sbarf("syncIOWaitReady result encoding error") never returns;
    
    2337 2361
     }
    
    2338 2362
     
    
    2339
    -stg_waitReadzh ( W_ fd )
    
    2340
    -{
    
    2341
    -    jump stg_waitReadyFd(fd, /* IORead */ 0::CInt);
    
    2342
    -}
    
    2343
    -
    
    2344
    -stg_waitWritezh ( W_ fd )
    
    2345
    -{
    
    2346
    -    jump stg_waitReadyFd(fd, /* IOWrite */ 1::CInt);
    
    2347
    -}
    
    2348
    -
    
    2349 2363
     stg_delayzh ( W_ us_delay )
    
    2350 2364
     {
    
    2351 2365
         CBool ok; /* Ok, or heap alloc failure. */