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

Commits:

1 changed file:

Changes:

  • rts/PrimOps.cmm
    ... ... @@ -2297,13 +2297,8 @@ 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
    +stg_handleIOSubmitResult ( CInt result )
    
    2301 2301
     {
    
    2302
    -    CInt result;
    
    2303
    -
    
    2304
    -    (result) = ccall syncIOWaitReady(Capability_iomgr(MyCapability()) "ptr",
    
    2305
    -                                     CurrentTSO "ptr", rw, fd);
    
    2306
    -
    
    2307 2302
         /* See Note [Encoding of result of I/O manager operations] */
    
    2308 2303
     
    
    2309 2304
         /* case IOSubmitResultAsyncContinue */
    
    ... ... @@ -2313,7 +2308,7 @@ stg_waitReadyFd ( W_ fd, CInt rw )
    2313 2308
         }
    
    2314 2309
     
    
    2315 2310
         /* case IOSubmitResultSyncSuccess*/
    
    2316
    -    if (result == 1::CInt) {
    
    2311
    +    if (result == 1::CInt) (likely: True) {
    
    2317 2312
             /* Success, don't even go via scheduler. */
    
    2318 2313
             return ();
    
    2319 2314
         }
    
    ... ... @@ -2338,12 +2333,24 @@ stg_waitReadyFd ( W_ fd, CInt rw )
    2338 2333
     
    
    2339 2334
     stg_waitReadzh ( W_ fd )
    
    2340 2335
     {
    
    2341
    -    jump stg_waitReadyFd(fd, /* IORead */ 0::CInt);
    
    2336
    +    CInt result;
    
    2337
    +
    
    2338
    +    (result) = ccall syncIOWaitReady(Capability_iomgr(MyCapability()) "ptr",
    
    2339
    +                                     CurrentTSO "ptr",
    
    2340
    +                                     /* IORead */ 0::CInt, fd);
    
    2341
    +
    
    2342
    +    jump stg_handleIOSubmitResult(result);
    
    2342 2343
     }
    
    2343 2344
     
    
    2344 2345
     stg_waitWritezh ( W_ fd )
    
    2345 2346
     {
    
    2346
    -    jump stg_waitReadyFd(fd, /* IOWrite */ 1::CInt);
    
    2347
    +    CInt result;
    
    2348
    +
    
    2349
    +    (result) = ccall syncIOWaitReady(Capability_iomgr(MyCapability()) "ptr",
    
    2350
    +                                     CurrentTSO "ptr",
    
    2351
    +                                     /* IOWrite */ 1::CInt, fd);
    
    2352
    +
    
    2353
    +    jump stg_handleIOSubmitResult(result);
    
    2347 2354
     }
    
    2348 2355
     
    
    2349 2356
     stg_delayzh ( W_ us_delay )