With the VU1 thread running VU1, path 1's packets are counted as unread
in gifPathReadAmount, where the space checks look, instead of the path's
own count, which nothing that checks for space reads. Path 1's buffer
could be written over packets the GS thread had yet to send, and a
realign's skipped end, with no packet data to hand over, was waited on
for good: the copy now hands such a skip to the GS on its own, and a
realign of a packet already at the start of the buffer returns, there
being nothing to move.
A savestate path whose sizes and packet do not agree -- more buffered
than the buffer holds, the tag past the data, a packet that starts
before the buffer -- fails the load and leaves the path empty, where it
realigned from outside the buffer. tests/eegifunit checks all of these,
the unending VU1 stream that deadlocked included, under a watchdog. The
stack frame check makes the sources the Makefile generates before it
compiles them, so it runs from a fresh checkout.
Buffers of a path's size or more that sat in a function's frame - or in
a callee's, once inlined - live elsewhere:
- on the heap: the gzip index builder's input and window, the gzip
extractor's (kept with its state), the CHD reader's feed buffer (made
on first use), the gzip index name and its template, the M3U reader's
paths, a cue's directory, the PGS log line past 512 bytes, and in
libretro-common the copy's destination directory, the dirent stat's
joined path, the abbreviated-or-relative working paths and the CPU
class values;
- static, where one thread uses them one call at a time: the default
and runtime Pcsx2Config (25 KB each), the IOP HLE host-file paths, and
the VU flag pass's visited set, one per VU since VU0 and VU1 may
compile at once;
- shared: the NVRAM and MEC file paths take turns in one buffer, and an
extra ROM's name is built in a std::string.
The runtime config LoadSettings carries over is moved rather than
copied.
tests/stackframe compiles every first-party source the Makefile builds,
with its flags, under -Werror=frame-larger-than=4096 (2048 for
libretro-common).