Skip to content

ZJIT: Support get/set on global variables #13569

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

Merged
merged 1 commit into from
Jun 10, 2025

Conversation

tenderlove
Copy link
Member

Adds support for code like:

$foo
$foo = x

@matzbot matzbot requested a review from a team June 10, 2025 04:14
Copy link

launchable-app bot commented Jun 10, 2025

Tests Failed

✖️no tests failed ✔️61908 tests passed(1 flake)

@tekknolagi
Copy link
Contributor

Please change PR title/commit to "ZJIT: ..."

@tekknolagi
Copy link
Contributor

tekknolagi commented Jun 10, 2025

Great stuff. Thank you

Adds support for code like:

```ruby
$foo
$foo = x
```
@tenderlove tenderlove changed the title [ZJIT] Support get/set on global variables ZJIT: Support get/set on global variables Jun 10, 2025
@tenderlove tenderlove enabled auto-merge (rebase) June 10, 2025 15:25
Copy link
Member

@k0kubun k0kubun left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Both C calls are not leaf and we'll need to do something about it later, but it's good as is for now.

@tenderlove tenderlove merged commit 0f922ed into ruby:master Jun 10, 2025
72 of 87 checks passed
@tekknolagi
Copy link
Contributor

Both C calls are not leaf and we'll need to do something about it later, but it's good as is for now.

Can you say more? What do you mean?

@tenderlove tenderlove deleted the set-and-get-gvar branch June 11, 2025 17:26
@tenderlove
Copy link
Member Author

Can you say more? What do you mean?

I think @k0kubun means that they can raise an exception (they aren't leaf functions). @k0kubun isn't that what the snapshot instructions are for?

@k0kubun
Copy link
Member

k0kubun commented Jun 11, 2025

During a non-leaf C call, it may dispatch a method that looks at the caller's Binding, for example. Because we don't spill locals onto the interpreter stack before the C call here, we need to either (1) spill them before each non-leaf call or (2) lazily move them from the C stack to the interpreter stack when you need to create a Binding.

We'll start from (1) and then optimize it into (2). I'm working on (1) right now, so it's helpful to leave it as is.

@tenderlove
Copy link
Member Author

I guess this is a case where we could hit a tracepoint or warning too. 😢

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.

3 participants