Skip to content

disable LOADNIL code generation optimisation#523

Merged
yuin merged 1 commit intoyuin:masterfrom
tul:disable_loadnil_merge
Apr 1, 2026
Merged

disable LOADNIL code generation optimisation#523
yuin merged 1 commit intoyuin:masterfrom
tul:disable_loadnil_merge

Conversation

@tul
Copy link
Copy Markdown
Contributor

@tul tul commented Jan 10, 2025

The AddLoadNil method is used to merge multiple consecutive LOADNIL instructions of consecutive registers into a single LOADNIL instruction, but it caused issues when the merged instructions were JMP targets, and so generated invalid code; so the merging functionality has been removed.

It is safe to merge the LOADNIL instructions under certain conditions, but additional logic / complexity would be needed to determine this, hence simply disabling merging for now.

Fixes #522

The `AddLoadNil` method used to merge multiple consecutive LOADNIL instructions
of consecutive registers into a single LOADNIL instruction, but it
caused issues when the merged instructions were JMP targets, and so
generated invalid code; so the merging functionality has been removed.

It is safe to merge the LOADNIL instructions under certain conditions,
but additional logic / complexity would be needed.
@coveralls
Copy link
Copy Markdown

Coverage Status

coverage: 89.603% (-0.02%) from 89.623%
when pulling b3dcd3f on tul:disable_loadnil_merge
into ccacf66 on yuin:master.

@yuin yuin merged commit 0d1d551 into yuin:master Apr 1, 2026
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.

LOADNIL merging optimisation (still) produces invalid code

3 participants