ruby/yjit
Alan Wu 38558dd95e YJIT: Fix defined?(yield) and block_given? at top level
Previously, YJIT returned truthy for the block given query at the top
level. That's incorrect because the top level script never receives a
block, and `yield` is a syntax error there.

Inside methods, the number of hops to get from `iseq` to
`iseq->body->local_iseq` is the same as the number of
`VM_ENV_PREV_EP(ep)` hops to get to an environment with
`VM_ENV_FLAG_LOCAL`. YJIT and the interpreter both rely on this as can
be seen in get_lvar_level(). However, this identity does not hold for
the top level frame because of vm_set_eval_stack(), which sets up
`TOPLEVEL_BINDING`.

Since only methods can take a block that `yield` goes to, have ISEQs
that are the child of a non-method ISEQ return falsy for the block given
query. This fixes the issue for the top level script and is an
optimization for non-method contexts such as inside `ISEQ_TYPE_CLASS`.
2025-08-14 17:01:11 -04:00
..
bindgen YJIT: Call YJIT hooks before enabling YJIT (#14032) 2025-07-28 15:17:45 -07:00
src YJIT: Fix defined?(yield) and block_given? at top level 2025-08-14 17:01:11 -04:00
.gitignore
Cargo.lock Bump capstone from 0.12.0 to 0.13.0 in /yjit 2025-02-05 11:37:34 +09:00
Cargo.toml YJIT: ZJIT: Allow both JITs in the same build 2025-05-15 00:39:03 +09:00
not_gmake.mk Define ZJIT libs for non-gmake 2025-04-18 21:52:55 +09:00
yjit.mk DRY up CARGO_VERBOSE for JITs 2025-07-16 19:50:30 -04:00