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

Implement inlining for #ifNil:*, #ifNotNil:* selectors #59

Merged
merged 5 commits into from
Feb 21, 2025

Conversation

smarr
Copy link
Member

@smarr smarr commented Feb 19, 2025

This PR uses the existing support for inlining of ifTrue: etc to also support ifNil: etc.

The inlining logic is mostly unchanged, just generalized to support the different bytecodes.

The new bytecodes are, incl. JUMP2 omitted here:

BC_JUMP_ON_NOT_NIL_POP     50
BC_JUMP_ON_NIL_POP         51
BC_JUMP_ON_NOT_NIL_TOP_TOP 52
BC_JUMP_ON_NIL_TOP_TOP     53

The bytecodes check for nil and may keep the top element (TOP_TOP to be read as top is set to top), or pop it on success.

The PR also resolves some lint issues and improve the disassembler.

When integers are not tagged, BC_INC now needs a GC check, to avoid running out of memory on the IfNil benchmark.

@smarr smarr changed the title Update core-lib and implement inlining for #ifNil:*, #ifNotNil:* selectors Implement inlining for #ifNil:*, #ifNotNil:* selectors Feb 20, 2025
smarr added a commit that referenced this pull request Feb 20, 2025
Adopts the changes of SOM-st/SOM#123 and
SOM-st/SOM#124.

This does not add any changes in SOM++ itself though.
They are separate in #59.
Still not complete, but now supports the different types of invokables and some more bytecodes.

Signed-off-by: Stefan Marr <[email protected]>
It can allocate, and the IfNil benchmark runs out of memory.
Ooops.

Signed-off-by: Stefan Marr <[email protected]>
@smarr smarr merged commit 4d7cb15 into SOM-st:master Feb 21, 2025
19 checks passed
@smarr smarr deleted the if-nil branch February 21, 2025 00:56
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