[luajit] Fix G-finding heuristic on aarch64#236
Merged
Merged
Conversation
gnurizen
approved these changes
Mar 11, 2026
I can't figure out why at some point we thought that r7 holds the dispatch table on ARM, but as far as I can tell, that's not the case. What is, however, the case, is that r22 holds G; see here: https://github.com/LuaJIT/LuaJIT/blob/659a61693aa3b87661864ad0f12eee14c865cd7f/src/lj_target_arm64.h#L41 And this is the register we load `g` from, e.g. when entering `lj_gc_step_jit`.
umanwizard
added a commit
that referenced
this pull request
Apr 28, 2026
I can't figure out why at some point we thought that r7 holds the dispatch table on ARM, but as far as I can tell, that's not the case. What is, however, the case, is that r22 holds G; see here: https://github.com/LuaJIT/LuaJIT/blob/659a61693aa3b87661864ad0f12eee14c865cd7f/src/lj_target_arm64.h#L41 And this is the register we load `g` from, e.g. when entering `lj_gc_step_jit`.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
I can't figure out why at some point we thought that r7 holds the dispatch table on ARM, but as far as I can tell, that's not the case.
What is, however, the case, is that r22 holds G; see here:
https://github.com/LuaJIT/LuaJIT/blob/659a61693aa3b87661864ad0f12eee14c865cd7f/src/lj_target_arm64.h#L41
And this is the register we load
gfrom, e.g. when enteringlj_gc_step_jit.