[Git][ghc/ghc][wip/dcoutts/io-manager-io-primop-exceptions] FIXUP: factor the read/write primops differently
Duncan Coutts pushed to branch wip/dcoutts/io-manager-io-primop-exceptions at Glasgow Haskell Compiler / GHC Commits: dddc9414 by Duncan Coutts at 2026-09-02T22:56:53+01:00 FIXUP: factor the read/write primops differently should be more reusable for new I/O primops later - - - - - 1 changed file: - rts/PrimOps.cmm Changes: ===================================== rts/PrimOps.cmm ===================================== @@ -2297,13 +2297,8 @@ stg_whereFromzh (P_ clos, W_ buf) Thread I/O blocking primitives -------------------------------------------------------------------------- */ -stg_waitReadyFd ( W_ fd, CInt rw ) +stg_handleIOSubmitResult ( CInt result ) { - CInt result; - - (result) = ccall syncIOWaitReady(Capability_iomgr(MyCapability()) "ptr", - CurrentTSO "ptr", rw, fd); - /* See Note [Encoding of result of I/O manager operations] */ /* case IOSubmitResultAsyncContinue */ @@ -2313,7 +2308,7 @@ stg_waitReadyFd ( W_ fd, CInt rw ) } /* case IOSubmitResultSyncSuccess*/ - if (result == 1::CInt) { + if (result == 1::CInt) (likely: True) { /* Success, don't even go via scheduler. */ return (); } @@ -2338,12 +2333,24 @@ stg_waitReadyFd ( W_ fd, CInt rw ) stg_waitReadzh ( W_ fd ) { - jump stg_waitReadyFd(fd, /* IORead */ 0::CInt); + CInt result; + + (result) = ccall syncIOWaitReady(Capability_iomgr(MyCapability()) "ptr", + CurrentTSO "ptr", + /* IORead */ 0::CInt, fd); + + jump stg_handleIOSubmitResult(result); } stg_waitWritezh ( W_ fd ) { - jump stg_waitReadyFd(fd, /* IOWrite */ 1::CInt); + CInt result; + + (result) = ccall syncIOWaitReady(Capability_iomgr(MyCapability()) "ptr", + CurrentTSO "ptr", + /* IOWrite */ 1::CInt, fd); + + jump stg_handleIOSubmitResult(result); } stg_delayzh ( W_ us_delay ) View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/dddc9414ee0f0fbeb4f1e58c9625ec7d... -- View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/dddc9414ee0f0fbeb4f1e58c9625ec7d... You're receiving this email because of your account on gitlab.haskell.org. Manage all notifications: https://gitlab.haskell.org/-/profile/notifications | Help: https://gitlab.haskell.org/help
participants (1)
-
Duncan Coutts (@dcoutts)