system: remove dead s_startup_cancelled atomic and its guards
s_startup_cancelled is an atomic_bool static that has been a dead
flag since the swanstation fork's first import. The codebase only
ever:
- Reads it (3 sites: 2 error-report guards, 1 mid-boot bail-out)
- Stores false to it once, in System::Boot()
It is never stored as true anywhere. The flag is therefore
permanently false, every IsStartupCancelled() call always returns
false, every '!IsStartupCancelled()' guard always evaluates true,
and the one positive guard ('if (IsStartupCancelled()) Shutdown()')
is unreachable.
The comment at the unreachable bail-out gives away the origin:
'shading compilers took too long and the user closed the
application'. That refers to upstream DuckStation's native UI,
where a GUI thread could set the flag while shader compilation
ran on the boot thread. swanstation is libretro-only - it has no
equivalent UI thread, no way for a frontend to interrupt boot
mid-flight, and no path that ever flips the flag to true.
Drop the lot:
- s_startup_cancelled static
- IsStartupCancelled() function and its system.h declaration
- s_startup_cancelled.store(false) in Boot()
- The three '!IsStartupCancelled()' / 'IsStartupCancelled()'
guards. The two error-reporting guards become unconditional -
if Boot() or CreateGPU() fails, we always want to surface the
error to the user, which is the behaviour we already had since
the guard was never satisfied. The mid-boot bail-out branch
was unreachable and is removed entirely.
Linux x64 build still warning-clean. .so size drops from 8048544
to 8048432 bytes (-112) from removing the dead branches. 25
retro_* exports unchanged. Behaviour is identical.
This commit is contained in:
parent
9987a7cd74
commit
f2bb58e502
3 changed files with 3 additions and 25 deletions
|
|
@ -62,12 +62,8 @@ bool HostInterface::BootSystem(std::shared_ptr<SystemBootParameters> parameters)
|
|||
|
||||
if (!System::Boot(*parameters))
|
||||
{
|
||||
if (!System::IsStartupCancelled())
|
||||
{
|
||||
ReportError(
|
||||
g_host_interface->TranslateString("System", "System failed to boot. The log may contain more information."));
|
||||
}
|
||||
|
||||
ReportError(
|
||||
g_host_interface->TranslateString("System", "System failed to boot. The log may contain more information."));
|
||||
m_audio_stream.reset();
|
||||
ReleaseHostDisplay();
|
||||
return false;
|
||||
|
|
|
|||
|
|
@ -95,7 +95,6 @@ static void UpdateRunningGame(const char* path, CDImage* image);
|
|||
static bool CheckForSBIFile(CDImage* image);
|
||||
|
||||
static State s_state = State::Shutdown;
|
||||
static std::atomic_bool s_startup_cancelled{false};
|
||||
|
||||
static ConsoleRegion s_region = ConsoleRegion::NTSC_U;
|
||||
TickCount g_ticks_per_second = MASTER_CLOCK;
|
||||
|
|
@ -140,11 +139,6 @@ bool IsValid()
|
|||
return s_state != State::Shutdown && s_state != State::Starting;
|
||||
}
|
||||
|
||||
bool IsStartupCancelled()
|
||||
{
|
||||
return s_startup_cancelled.load();
|
||||
}
|
||||
|
||||
ConsoleRegion GetRegion()
|
||||
{
|
||||
return s_region;
|
||||
|
|
@ -516,9 +510,7 @@ bool RecreateGPU(GPURenderer renderer, bool update_display /* = true*/)
|
|||
g_gpu.reset();
|
||||
if (!CreateGPU(renderer))
|
||||
{
|
||||
if (!IsStartupCancelled())
|
||||
g_host_interface->ReportError("Failed to recreate GPU.");
|
||||
|
||||
g_host_interface->ReportError("Failed to recreate GPU.");
|
||||
System::Shutdown();
|
||||
return false;
|
||||
}
|
||||
|
|
@ -591,7 +583,6 @@ bool ShouldCheckForImagePatches()
|
|||
bool Boot(const SystemBootParameters& params)
|
||||
{
|
||||
s_state = State::Starting;
|
||||
s_startup_cancelled.store(false);
|
||||
s_region = g_settings.region;
|
||||
|
||||
if (params.state_stream)
|
||||
|
|
@ -765,13 +756,6 @@ bool Initialize(bool force_software_renderer)
|
|||
if (g_settings.gpu_pgxp_enable)
|
||||
PGXP::Initialize();
|
||||
|
||||
// Was startup cancelled? (e.g. shading compilers took too long and the user closed the application)
|
||||
if (IsStartupCancelled())
|
||||
{
|
||||
Shutdown();
|
||||
return false;
|
||||
}
|
||||
|
||||
// CPU code cache must happen after GPU, because it might steal our address space.
|
||||
CPU::CodeCache::Initialize();
|
||||
|
||||
|
|
|
|||
|
|
@ -66,8 +66,6 @@ State GetState();
|
|||
bool IsShutdown();
|
||||
bool IsValid();
|
||||
|
||||
bool IsStartupCancelled();
|
||||
|
||||
ConsoleRegion GetRegion();
|
||||
bool IsPALRegion();
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue