Skip to content

Bundle the engine without the Lua parser - #236

Merged
rixnobis merged 2 commits into
mainfrom
engine-noparser
Oct 21, 2026
Merged

rixnobis merged 2 commits into
mainfrom
engine-noparser

Conversation

@rixnobis

Copy link
Copy Markdown
Contributor

The editor already exports scripts as bytecode, so the bundled engines are now built without the Lua parser: all 10 variants build with NOPARSER=1, which gives 28,672 B of RAM back to each game. splashpack-cli build now writes bytecode too, and the RAM budget's heap figure comes from the parser-free CD engine (0x80200000 - 0x8009ec70).

A script that calls load, loadstring, dofile, loadfile or string.dump gets a warning in Problems and on the CLI (core/luascan): without the parser, loadstring of Lua text returns nil, "parser not loaded" and string.dump fails. None of the bundled projects calls them.

Checked in Redux: lamplighter and courtyard, pcdrv and disc, next to the engine with the parser: the same title menu, Cross into the valley and intro text; frames match except a frame of timing during camera moves.

Part of #211.

SplashEdit always hands the engine compiled Lua (Play, disc), so the
parser only cost RAM: NOPARSER=1 frees 28,672 B of static image. CI now
builds all ten engines with it, rebuilding psxlua's liblua-noparser.a
after each make clean, and fails a variant that lacks the parser stub.
splashpack-cli build always stores bytecode, as Play does; --lua-bytecode
is still accepted. kEngineHeapBytes is now the NOPARSER disc engine's
heap (__stack_start - __heap_start, psxsplash d2c232c).
The bundled engines have no parser: load/loadstring of Lua text return
"parser not loaded", string.dump fails with "dumper not loaded", and
psxlua has no dofile or loadfile. Export now scans every script (and
block script's Lua) for those globals, skipping strings, comments,
fields, table keys and names the script defines itself, and adds one
warning per script naming each function's first line and the fix. It
lands in Problems through the live export and on the CLI's stderr.
@rixnobis
rixnobis merged commit 6aa0f5f into main Oct 21, 2026
5 checks passed
@rixnobis
rixnobis deleted the engine-noparser branch October 21, 2026 15:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant