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

Promote immediates. #93

Merged
merged 1 commit into from
Oct 28, 2024
Merged

Promote immediates. #93

merged 1 commit into from
Oct 28, 2024

Conversation

ltratt
Copy link
Contributor

@ltratt ltratt commented Oct 24, 2024

This is a conservative use of yk_promote operating on Lua opcodes which themselves use immediates (e.g. OP_ADDI). It does have a small (just over 1% improvement) effect on big_loop.lua, but the main point of this is to show that we can start to move an interpreter in a yk-specific direction.

Please wait until all reviewers have OKed this, as it's important for us to all see what this sort of thing looks like in practise.

@ptersilie
Copy link
Contributor

Any hint what is being promoted here? I assume for OP_EQI it promotes the second argument, e.g. a == promote(b)? But I'm even less sure about the others.

@vext01
Copy link
Contributor

vext01 commented Oct 25, 2024

Any hint what is being promoted here?

It's not very easy to follow, but if you follow the chain of macros it eventually ends up getting an integer value from an address relative to the instruction pointer.

e.g.

 #define sC2int(i)   ((i) - OFFSET_sC)

where i is the current instruction.

This looks feasible to me.

@jacob-hughes
Copy link

This seems sensible to me

@ltratt
Copy link
Contributor Author

ltratt commented Oct 25, 2024

As Edd said, the macros mean that it's a bit hard to see what's going on. I'm not totally certain if/how to document it, either.

@ptersilie
Copy link
Contributor

I guess my question is how did you decide which values to promote?

@ltratt
Copy link
Contributor Author

ltratt commented Oct 25, 2024

I guess my question is how did you decide which values to promote?

Those which are used as immediates in Lua opcodes. Unfortunately you have to do a research hunt to work out how...

@vext01
Copy link
Contributor

vext01 commented Oct 28, 2024

@ptersilie are you happy for me to merge this?

@ptersilie
Copy link
Contributor

Yes, please go ahead.

@vext01 vext01 added this pull request to the merge queue Oct 28, 2024
@github-merge-queue github-merge-queue bot removed this pull request from the merge queue due to failed status checks Oct 28, 2024
@vext01
Copy link
Contributor

vext01 commented Oct 28, 2024

Hrm, yklua failed to link.

@ltratt
Copy link
Contributor Author

ltratt commented Oct 28, 2024

Leave it to me.

@ltratt
Copy link
Contributor Author

ltratt commented Oct 28, 2024

d9a3ce2 guards the changes with USE_YK. I suspect we should move away from USE_YK, but that's something for another PR. Will need squashing if this is acceptable.

@vext01
Copy link
Contributor

vext01 commented Oct 28, 2024

Please squash.

This is a conservative use of `yk_promote` operating on Lua opcodes
which themselves use immediates (e.g. OP_ADDI). It does have a small
(just over 1% improvement) effect on big_loop.lua, but the main point of
this is to show that we can start to move an interpreter in a
yk-specific direction.
@ltratt
Copy link
Contributor Author

ltratt commented Oct 28, 2024

Squashed.

@vext01 vext01 added this pull request to the merge queue Oct 28, 2024
Merged via the queue into ykjit:main with commit fc1df20 Oct 28, 2024
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants