Skip to content
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

Add support for LexicalScopes, Variables, and SourceCoordinates #32

Merged
merged 6 commits into from
Jul 31, 2024

Conversation

smarr
Copy link
Member

@smarr smarr commented Jul 31, 2024

This PR is adding infrastructure to enable inlining on the bytecode level.

It introduces the notion of LexicalScopes, Variables, and SourceCoordinates.
LexicalScopes encode the info needed about the program structure/relationship between methods and blocks.
Variables encode the location of arguments and locals, in terms of SourceCoordinates.

This PR also reduces the number of symbols that need to be created by relying on std::strings for aspects that won't be exposed to the language level.

There's also a bit extra support here for debugging the GCs and interactive debugging, for instance printing/dumping of methods.

This is split out as a PR to be able to assess the performance impact.

smarr added 6 commits July 31, 2024 23:51
This is in preparation of adding inlining.

- use %.*s to limit the number of characters used in snprintf
- make sure we always have a lexical scope, also for bootstrap frame

Signed-off-by: Stefan Marr <[email protected]>
- this also avoids a lot of symbol creation
- LexicalScopes are owned by VMMethod

Signed-off-by: Stefan Marr <[email protected]>
@smarr
Copy link
Member Author

smarr commented Jul 31, 2024

I think the change is performance neutral: https://rebench.dev/SOMpp/compare/eca9b14ecff2051a5a39ee434eac904f04538972..ed8667ea678d77bde970e95fb83b904506f8ba6c

I hope the performance effects visible are within the error margins. Not clear though.

@smarr smarr merged commit f3758d7 into SOM-st:master Jul 31, 2024
19 checks passed
@smarr smarr deleted the lexer branch July 31, 2024 23:12
smarr added a commit that referenced this pull request Aug 1, 2024
This PR uses the infrastructure introduced previously in #32 to
implement bytecode-level inlining in the same style as in TruffleSOM and
PySOM.

One improvement here is that we remove blocks from the literals, too,
which leads in the tests to use more use of the specialized bytecodes.

Generally, the new introduced bytecodes for jumps have all the same
length, and exist in two variants, one that only uses one byte, i.e.,
shorted jumps, and the other that uses both.

This also introduces keeping track of the last 4 bytecodes, which is
useful for other optimizations later on, too.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant