Skip to content

ZJIT: Limit local reloads after send to ones syntactically written to - #17417

Merged
XrXr merged 2 commits into
ruby:masterfrom
Shopify:zjit-filter-send-with-block-local-reloads
Jul 6, 2026
Merged

ZJIT: Limit local reloads after send to ones syntactically written to#17417
XrXr merged 2 commits into
ruby:masterfrom
Shopify:zjit-filter-send-with-block-local-reloads

Conversation

@alanwu-shopify-inc

@alanwu-shopify-inc alanwu-shopify-inc commented Jun 20, 2026

Copy link
Copy Markdown
Contributor

A step towards addressing Shopify#976, but not fixed in general even though the particular instance in the issue is fixed.

You can still trick ZJIT into issuing a reload without a matching dominating store with a trivially inlined setlocal in a block:

# --zjit-call-threshold=2
def foo(&) = 1

def test
  a = 1
  foo { a = "the surrounding block is dead code" }
  a
end

p [test, test]

We'll add matching stores visible in HIR as part of using stack maps for locals. This is a step towards that, too.

@alanwu-shopify-inc
alanwu-shopify-inc force-pushed the zjit-filter-send-with-block-local-reloads branch 2 times, most recently from de62fb7 to ee0cbf2 Compare June 26, 2026 17:10
alanwu-shopify-inc pushed a commit to Shopify/ruby that referenced this pull request Jun 30, 2026
…ir-opt`

I had a go trying to fix these at
<ruby#17417>, but the full fix is quite
involved. Let's skip for now since filtering local reloads fixes
correctness issues with inlining in the default configuration.
@alanwu-shopify-inc
alanwu-shopify-inc force-pushed the zjit-filter-send-with-block-local-reloads branch from 506a8ec to 061e1a5 Compare June 30, 2026 17:50
@alanwu-shopify-inc
alanwu-shopify-inc marked this pull request as ready for review June 30, 2026 17:50
@matzbot
matzbot requested a review from a team June 30, 2026 17:50
k0kubun pushed a commit to k0kubun/ruby that referenced this pull request Jul 1, 2026
…ir-opt`

I had a go trying to fix these at
<ruby#17417>, but the full fix is quite
involved. Let's skip for now since filtering local reloads fixes
correctness issues with inlining in the default configuration.
Comment thread zjit/src/hir/tests.rs
k0kubun pushed a commit to k0kubun/ruby that referenced this pull request Jul 2, 2026
…ir-opt`

I had a go trying to fix these at
<ruby#17417>, but the full fix is quite
involved. Let's skip for now since filtering local reloads fixes
correctness issues with inlining in the default configuration.
k0kubun pushed a commit to k0kubun/ruby that referenced this pull request Jul 2, 2026
…ir-opt`

I had a go trying to fix these at
<ruby#17417>, but the full fix is quite
involved. Let's skip for now since filtering local reloads fixes
correctness issues with inlining in the default configuration.
XrXr added 2 commits July 6, 2026 13:35
…ir-opt`

I had a go trying to fix these at
<ruby#17417>, but the full fix is quite
involved. Let's skip for now since filtering local reloads fixes
correctness issues with inlining in the default configuration.
@alanwu-shopify-inc
alanwu-shopify-inc force-pushed the zjit-filter-send-with-block-local-reloads branch from 09df5d6 to 4da9273 Compare July 6, 2026 17:36
@XrXr
XrXr merged commit 14a0afd into ruby:master Jul 6, 2026
129 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.

ZJIT: Avoid reloading locals on send that are not referenced by blockiseq

4 participants