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
    ... ... @@ -892,22 +892,6 @@ to pass in R2 we have to use a dummy first argument which will be passed in R1
    892 892
     (and ignored).
    
    893 893
     */
    
    894 894
     
    
    895
    -/* Blocking for I/O primops with result IO ().
    
    896
    - * See Note [Thread blocking for new I/O primops].
    
    897
    - */
    
    898
    -stg_block_io_unit
    
    899
    -{
    
    900
    -    /* Fill out the stack frame with dummy values. The IO manager will
    
    901
    -     * overwrite these with the actual results when the I/O operation
    
    902
    -     * completes, fails, or is cancelled.
    
    903
    -     */
    
    904
    -    Sp_adj(-3);
    
    905
    -    Sp(0) = stg_block_io_unit_info;
    
    906
    -    Sp(1) = 0;                    // outcome: 0 indicates IOOpOutcomeInFlight
    
    907
    -    Sp(2) = 0;                    // result/errno
    
    908
    -    BLOCK_GENERIC;
    
    909
    -}
    
    910
    -
    
    911 895
     /* stg_block_io_unit_info : the return info table for stg_block_io_unit */
    
    912 896
     INFO_TABLE_RET ( stg_block_io_unit, RET_SMALL, W_ info_ptr,
    
    913 897
                      W_ outcome, W_ result )
    
    ... ... @@ -925,17 +909,17 @@ INFO_TABLE_RET ( stg_block_io_unit, RET_SMALL, W_ info_ptr,
    925 909
         }
    
    926 910
     }
    
    927 911
     
    
    928
    -/* Blocking for I/O primops with result IO Int or Word (or rather Int#/Word#).
    
    912
    +/* Blocking for I/O primops with result IO ().
    
    929 913
      * See Note [Thread blocking for new I/O primops].
    
    930 914
      */
    
    931
    -stg_block_io_int
    
    915
    +stg_block_io_unit
    
    932 916
     {
    
    933 917
         /* Fill out the stack frame with dummy values. The IO manager will
    
    934 918
          * overwrite these with the actual results when the I/O operation
    
    935 919
          * completes, fails, or is cancelled.
    
    936 920
          */
    
    937 921
         Sp_adj(-3);
    
    938
    -    Sp(0) = stg_block_io_int_info;
    
    922
    +    Sp(0) = stg_block_io_unit_info;
    
    939 923
         Sp(1) = 0;                    // outcome: 0 indicates IOOpOutcomeInFlight
    
    940 924
         Sp(2) = 0;                    // result/errno
    
    941 925
         BLOCK_GENERIC;
    
    ... ... @@ -957,3 +941,19 @@ INFO_TABLE_RET ( stg_block_io_int, RET_SMALL, W_ info_ptr,
    957 941
             return (result);
    
    958 942
         }
    
    959 943
     }
    
    944
    +
    
    945
    +/* Blocking for I/O primops with result IO Int or Word (or rather Int#/Word#).
    
    946
    + * See Note [Thread blocking for new I/O primops].
    
    947
    + */
    
    948
    +stg_block_io_int
    
    949
    +{
    
    950
    +    /* Fill out the stack frame with dummy values. The IO manager will
    
    951
    +     * overwrite these with the actual results when the I/O operation
    
    952
    +     * completes, fails, or is cancelled.
    
    953
    +     */
    
    954
    +    Sp_adj(-3);
    
    955
    +    Sp(0) = stg_block_io_int_info;
    
    956
    +    Sp(1) = 0;                    // outcome: 0 indicates IOOpOutcomeInFlight
    
    957
    +    Sp(2) = 0;                    // result/errno
    
    958
    +    BLOCK_GENERIC;
    
    959
    +}

  • rts/PrimOps.cmm
    ... ... @@ -2297,16 +2297,6 @@ stg_whereFromzh (P_ clos, W_ buf)
    2297 2297
        Thread I/O blocking primitives
    
    2298 2298
        -------------------------------------------------------------------------- */
    
    2299 2299
     
    
    2300
    -stg_waitReadzh ( W_ fd )
    
    2301
    -{
    
    2302
    -    jump stg_waitReadyFd(fd, /* IORead */ 0::CInt);
    
    2303
    -}
    
    2304
    -
    
    2305
    -stg_waitWritezh ( W_ fd )
    
    2306
    -{
    
    2307
    -    jump stg_waitReadyFd(fd, /* IOWrite */ 1::CInt);
    
    2308
    -}
    
    2309
    -
    
    2310 2300
     stg_waitReadyFd ( W_ fd, CInt rw )
    
    2311 2301
     {
    
    2312 2302
         CInt result;
    
    ... ... @@ -2346,6 +2336,16 @@ stg_waitReadyFd ( W_ fd, CInt rw )
    2346 2336
         ccall sbarf("syncIOWaitReady result encoding error") never returns;
    
    2347 2337
     }
    
    2348 2338
     
    
    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 2349
     stg_delayzh ( W_ us_delay )
    
    2350 2350
     {
    
    2351 2351
         CBool ok; /* Ok, or heap alloc failure. */