mirror of
https://github.com/ruby/ruby.git
synced 2025-08-15 13:39:04 +02:00
![]() 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`. |
||
---|---|---|
.. | ||
pending.rb | ||
runner.rb | ||
test_attr.rb | ||
test_autoload.rb | ||
test_block.rb | ||
test_class.rb | ||
test_constant_cache.rb | ||
test_env.rb | ||
test_eval.rb | ||
test_exception.rb | ||
test_fiber.rb | ||
test_finalizer.rb | ||
test_flip.rb | ||
test_flow.rb | ||
test_fork.rb | ||
test_gc.rb | ||
test_insns.rb | ||
test_io.rb | ||
test_jump.rb | ||
test_literal.rb | ||
test_literal_suffix.rb | ||
test_load.rb | ||
test_marshal.rb | ||
test_massign.rb | ||
test_method.rb | ||
test_objectspace.rb | ||
test_proc.rb | ||
test_ractor.rb | ||
test_string.rb | ||
test_struct.rb | ||
test_syntax.rb | ||
test_thread.rb | ||
test_yjit.rb | ||
test_yjit_30k_ifelse.rb | ||
test_yjit_30k_methods.rb | ||
test_yjit_rust_port.rb |