Finish processor link changes optimization#12232
Open
cardillan wants to merge 1 commit into
Open
Conversation
1ue999
reviewed
Jun 16, 2026
| stop = false; | ||
| nameMap = null; | ||
| vars = builder.vars.values().toSeq().retainAll(var -> !var.constant).toArray(LVar.class); | ||
| vars = builder.vars.values().toSeq().retainAll(var -> !var.constant || var.name.charAt(0) != '_' && var.name.charAt(0) != '@').toArray(LVar.class); |
Contributor
Author
There was a problem hiding this comment.
I want to add only the constants representing the linked variables here, to keep the array small. Before, all constants were excluded. Now I'm excluding the constants representing mlog literals (triple underscore) and builtin variables (@this, @links, etc.). What remains should be the constants representing linked blocks.
I could include the builtins as well, and they would be remotely readable, but the only really useful one is @links, and since links can't be read remotely anyway, its utility is limited. I'd probably add them in #11838.
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.
Commit d13afc1 contains changes to optimize processor link changes, but the job wasn't finished. The new code only runs when a linked block is deleted. When links to existing blocks are added/removed via GUI, the code is still recompiled from scratch.
I've updated the code which manages adding/removing links to use the new system. For this to work, the variables representing linked blocks must exist in the executor (so that they're available via
optionalVar()), so I'm copying them from the assembler to the executor as well - built-ins and literals are still excluded to keep the array small.As a side effect, it is now possible to read linked blocks which also exist as a variable in the code via the
readinstruction. This is a bit inconsistent, as blocks that are linked but not referenced from the code can't be read that way. There's the #11838 PR for that; if you accept this PR, I'll update that one to be compatible.If your pull request is not translation or serverlist-related, read the list of requirements below and check each box: