Commits on Source (14)
-
Rather than each I/O manager adding things into the Capability structure ad-hoc, we should have a common CapIOManager iomgr member of the Capability structure, with a common interface to initialise etc. The content of the CapIOManager struct will be defined differently for each I/O manager implementation. Eventually we should be able to have the CapIOManager be opaque to the rest of the RTS, and known just to the I/O manager implementation. We plan for that by making the Capability contain a pointer to the CapIOManager rather than containing the structure directly. Initially just move the Unix threaded I/O manager's control FD.
bc7e0ffd -
To allow I/O managers to have GC roots in the Capability, within the CapIOManager structure. Not yet used in this patch.
a6a4d218 -
The I/O and delay blocking primitives for the non-threaded way currently access the blocked_queue and sleeping_queue directly. We want to move where those queues are to make their ownership clearer: to have them clearly belong to the I/O manager impls rather than to the scheduler. Ultimately we will want to change their representation too. It's inconvenient to do that if these queues are accessed directly from cmm code. So as a first step, replace the APPEND_TO_BLOCKED_QUEUE with a C version appendToIOBlockedQueue(), and replace the open-coded sleeping_queue insertion with insertIntoSleepingQueue().
b11cf279 -
The blocked_queue_{hd,tl} and the sleeping_queue are currently cooperatively managed between the scheduler and (some but not all of) the non-threaded I/O manager implementations. They lived as global vars with the scheduler, but are poked by I/O primops and the I/O manager backends. This patch is a step on the path towards making the management of I/O or timer blocking belong to the I/O managers and not the scheduler. Specifically, this patch moves the {blocked,sleeping}_queue from being global vars in the scheduler to being members of the CapIOManager struct within each Capability. They are not yet exclusively used by the I/O managers: they are still poked from a couple other places, notably in the scheduler before calling awaitEvent.
33459873 -
The global vars {blocked,sleeping}_queue are now in the Capability and so get marked there via markCapabilityIOManager.
dac811e1 -
from Schedule.h to Schedule.c and IOManager.h This is just moving, the next step will be to rejig them slightly. For the non-threaded RTS the scheduler needs to be able to test for there being pending I/O operation or pending timers. The implementation of these tests should really be considered to be part of the I/O managers and not part of the scheduler.
fcca3a83 -
These are the macros originaly from Scheduler.h, previously moved to IOManager.h, and now replaced with a single inline function anyPendingTimeoutsOrIO(). We can use a single function since the two macros were always checked together. Note that since anyPendingTimeoutsOrIO is defined for all IO manager cases, including threaded, we do not need to guard its use by cpp #if !defined(THREADED_RTS)
6d52b9cd -
It was not really adding anything. The name no longer meant anything since those I/O and timeout queues do not belong to the scheuler. In one of the two places it was used, the comments already had to explain what it did, whereas now the code matches the comment nicely.
d8fed59e -
And add or adjust comments at the use sites of awaitEvent.
12d0291f -
It is currently only used in the non-threaded RTS so it works to use MainCapability, but it's a bit nicer to pass the cap anyway. It's certainly shorter.
8d22839e -
And to insertIntoSleepingQueue. Again, it's a bit cleaner and simpler though not strictly necessary given that these primops are currently only used in the non-threaded RTS.
01440674 -
The one about the nonsense (const False) test on WinIO for there being any IO or timers pending, leading to unnecessary complication later in the scheduler.
60de539f -
Avoid the intermediate data structures allocated by splitTyConApp. This avoids ~0.5% of allocations for a build using -O2. Fixes #22254
d6f4019c -
06f37deb
Showing
- compiler/GHC/Core/Type.hs 8 additions, 3 deletionscompiler/GHC/Core/Type.hs
- hadrian/src/Settings/Builders/RunTest.hs 4 additions, 1 deletionhadrian/src/Settings/Builders/RunTest.hs
- rts/AwaitEvent.h 0 additions, 21 deletionsrts/AwaitEvent.h
- rts/Capability.c 4 additions, 3 deletionsrts/Capability.c
- rts/Capability.h 4 additions, 4 deletionsrts/Capability.h
- rts/IOManager.c 72 additions, 2 deletionsrts/IOManager.c
- rts/IOManager.h 133 additions, 1 deletionrts/IOManager.h
- rts/PrimOps.cmm 7 additions, 35 deletionsrts/PrimOps.cmm
- rts/RaiseAsync.c 3 additions, 2 deletionsrts/RaiseAsync.c
- rts/Schedule.c 36 additions, 40 deletionsrts/Schedule.c
- rts/Schedule.h 0 additions, 48 deletionsrts/Schedule.h
- rts/posix/Select.c 31 additions, 23 deletionsrts/posix/Select.c
- rts/posix/Signals.c 2 additions, 2 deletionsrts/posix/Signals.c
- rts/sm/Compact.c 0 additions, 3 deletionsrts/sm/Compact.c
- rts/sm/GC.c 0 additions, 2 deletionsrts/sm/GC.c
- rts/sm/NonMoving.c 0 additions, 2 deletionsrts/sm/NonMoving.c
- rts/win32/AsyncMIO.c 7 additions, 4 deletionsrts/win32/AsyncMIO.c
- rts/win32/AwaitEvent.c 4 additions, 4 deletionsrts/win32/AwaitEvent.c
rts/AwaitEvent.h
deleted
100644 → 0