New faster interpreter based on instruction objects and operands. - #2426
Draft
aardvark179 wants to merge 55 commits into
Draft
aardvark179 wants to merge 55 commits into
aardvark179 wants to merge 55 commits into
Conversation
aardvark179
force-pushed
the
aardvark179-interpreterv2
branch
2 times, most recently
from
June 6, 2026 21:02
9d1fbcb to
65e41ce
Compare
aardvark179
force-pushed
the
aardvark179-interpreterv2
branch
from
June 10, 2026 10:48
65e41ce to
f61759b
Compare
aardvark179
force-pushed
the
aardvark179-interpreterv2
branch
from
June 15, 2026 09:10
f61759b to
7f70f9b
Compare
aardvark179
force-pushed
the
aardvark179-interpreterv2
branch
from
June 17, 2026 09:56
386c662 to
3699113
Compare
This was referenced Jun 18, 2026
aardvark179
force-pushed
the
aardvark179-interpreterv2
branch
4 times, most recently
from
June 24, 2026 13:38
9f5cb25 to
b81c666
Compare
aardvark179
force-pushed
the
aardvark179-interpreterv2
branch
from
June 30, 2026 11:20
b81c666 to
70c3b25
Compare
aardvark179
force-pushed
the
aardvark179-interpreterv2
branch
3 times, most recently
from
July 21, 2026 17:15
fc7afed to
418d2c9
Compare
aardvark179
force-pushed
the
aardvark179-interpreterv2
branch
3 times, most recently
from
August 2, 2026 19:35
29fa1d7 to
f9ab208
Compare
aardvark179
force-pushed
the
aardvark179-interpreterv2
branch
from
August 26, 2026 14:39
f9ab208 to
301a01e
Compare
aardvark179
force-pushed
the
aardvark179-interpreterv2
branch
3 times, most recently
from
September 14, 2026 10:40
94f7455 to
2dc09ee
Compare
Contributor
Author
|
So the test failure appears to be due to some refactoring in the V2 compiler just pushing it over the edge in terms of stack usage. It passes on my local machine, but increasing the size of the expression a little bit pushes it over the edge. I'm going to try a couple of approaches to refactoring the compiler to avoid this, but from some experimentation it's clear we've always been sailing close to the wind in terms of stack depth and this test. |
aardvark179
force-pushed
the
aardvark179-interpreterv2
branch
from
September 15, 2026 15:36
ad8ba09 to
8893380
Compare
aardvark179
force-pushed
the
aardvark179-interpreterv2
branch
from
September 28, 2026 16:23
428a86c to
cd2fd9c
Compare
aardvark179
force-pushed
the
aardvark179-interpreterv2
branch
from
September 28, 2026 16:51
cd2fd9c to
73e8be5
Compare
This branch has not been deployed
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.
This change implements a new interpreter based on
Instructionobjects rather than byte codes. Instructions generally have one or two operands which express where they get their data from (literal values, variables, or the stack). Currently all instructions that produce results put those results on the stack, but in the future the operands concept could be extended to where the result is placed and provide further improvements.This design provides significant performance improvements over the old interpreter (see benchmarks in #2416 ) in return for a slightly increased memory overhead. This overhead is less than might be expected because operand objects can be heavily reused, fewer instructions are usually required for the V2 interpreter, and the byte code itself is often only a portion of the overall foot print of interpreted functions compared to constants, metadata, etc.
While upstreaming this work I've taken the opportunity to remove a lot of duplication between the two interpreters as inconsistencies between these were the source of a few issues while rebasing this work.