-
Notifications
You must be signed in to change notification settings - Fork 14
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Revise message dispatch and primitives #177
Closed
Closed
Conversation
This file contains 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
and increase PERFORM_SELECTOR_CACHE_LIMIT from 2 to 4
This reverts commit 86b417e.
fniephaus
force-pushed
the
wip/revise-dispatch-prims
branch
5 times, most recently
from
January 14, 2025 15:24
7f74a51
to
44dcfec
Compare
fniephaus
force-pushed
the
wip/revise-dispatch-prims
branch
2 times, most recently
from
January 14, 2025 20:46
df27eab
to
7ad3018
Compare
fniephaus
force-pushed
the
wip/revise-dispatch-prims
branch
from
January 20, 2025 08:34
7ad3018
to
cc4067d
Compare
fniephaus
force-pushed
the
wip/revise-dispatch-prims
branch
from
January 20, 2025 08:37
cc4067d
to
63b3193
Compare
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 PR revises the message dispatch in TruffleSqueak significantly: most importantly, primitives are now always being tried a direct or indirect call happens (which brings TS closer to the reference implementation). Previously, primitives were tried before a call but from the moment a primitive failed once, it was replaced with a call in which the primitive was tried (again) right before the bytecode loop. This had two downsides:
primitiveCopyBits
, for example, typically fails at startup a bunch of times until forms are uncompressed. The call overhead is now avoid if a primitive succeeds.Another major change is that there are now separate dispatch nodes for different numbers of arguments. This way, method calls with up to five arguments (the majority of calls) no longer create a lot of
Object[]
to pass around arguments. There are new interfaces such asPrimitive0
andPrimitive5WithFallback
withexecute
methods with different signatures. For primitive calls, it is therefore no longer necessary to pass the arguments via anObject[]
. The reduction ofObject[]
improves interpreter performance significantly and reduces memory pressure in the interpreter, while also increasing the amount of code a bit. This can be observed in something as simple astinyBenchmarks
:Before:
72,000,000 bytecodes/sec; 3,400,000 sends/sec; 168 GCs for 10x tinyBenchmarks
After:
87,000,000 bytecodes/sec; 4,300,000 sends/sec; 89 GCs for 10x tinyBenchmarks
That's roughly +20% bytecodes/sec and +26% sends/sec at only 52% of GCs.
At the same time, peak performance has not really changed, at least for
tinyBenchmarks
:Before:
~10,000,000,000 bytecodes/sec; ~340,000,000 sends/sec
After:
~10,000,000,000 bytecodes/sec; ~340,000,000 sends/sec
Nonetheless, we should run the full benchmark suite before this gets merged.