The deferred sweep starts every module another module depends on at the
first deferred load of the title. When that first load carries no
argument block (a module the title starts with args 0 and argp null),
the swept modules were started with the same empty block, and a module
that reads *argp in its module_start faulted: Darkest Dungeon II
(PPSA19591) aborted in NativePluginPS5Example a few seconds after start.
A load whose argp is null no longer triggers the sweep and leaves it
pending, so it runs at the next deferred load that carries start
arguments, which is the block the swept modules get when the title
starts them through their dependent. guest_deferred_module_sweep_no_arguments
loads a module with no arguments first and checks that the swept module
is not started, then loads it with arguments and checks that the sweep
ran with them.
Root cause found and reported by JJenkx in #18053.
A swept module whose start throws is skipped with a log line, whatever it throws, and
the load that triggered the sweep, and later loads, still succeed.
A deferred module that only another deferred module names (PSNCommon, needed by
PSNCore) started after the plugins that use it (SPFXUnityPlugin) and crashed
Soul Hackers 2 on Windows. The first title load of any deferred module now starts
every deferred module some module depends on, in dependency order, with that
load's start arguments, and logs the sweep. Boot is unchanged.
Since #12621 a Windows runtime module that another runtime module needs is deferred instead of started at boot, but loading a deferred module only started that module. A Unity plugin such as SPFXUnityPlugin that calls into a deferred module it needs (Il2CppUserAssemblies in Media/Modules) ran against code whose initializers had never run, and PPSA03743 crashed about 2.6 s in.
A deferred module's initialization table now lists the deferred modules it depends on (names, after the initializer array, behind a magic number so older output reads as having none). DynamicLoader starts those first, transitively and once each through the existing per-module state, with the start arguments of the load that began it, then starts the module itself. The module start result stays the module's own. Boot still starts no deferred module.
Linux is unchanged: its deferred modules still start only when loaded.