ruby/bootstraptest
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
..
pending.rb Moved already resolved test 2020-04-27 10:39:07 +09:00
runner.rb Add Timeout message when bootstraptest times out 2025-07-11 10:20:50 -07:00
test_attr.rb Revert "Revert "This commit implements the Object Shapes technique in CRuby."" 2022-10-11 08:40:56 -07:00
test_autoload.rb Use File.write instead of Kernel#open 2024-07-09 13:01:44 +09:00
test_block.rb
test_class.rb
test_constant_cache.rb Finer-grained constant cache invalidation (take 2) 2022-04-01 14:48:22 -04:00
test_env.rb fallback env encoding to ASCII-8BIT 2018-09-26 17:24:00 +00:00
test_eval.rb Raise a compile error for break/next/redo inside eval in cases where it is optimized away 2024-09-18 16:54:56 -07:00
test_exception.rb Do not include a backtick in error messages and backtraces 2024-02-15 18:42:31 +09:00
test_fiber.rb [Bug #21400] Fix rb_bug() when killing current root fiber in non-main thread (#13526) 2025-06-06 09:31:45 +09:00
test_finalizer.rb Test finalizer is ran in bootstraptest 2024-04-01 10:26:16 -04:00
test_flip.rb
test_flow.rb Ensure test suite is compatible with --frozen-string-literal 2024-03-14 17:56:15 +01:00
test_fork.rb Fail test if child process exists non-zero 2025-03-25 19:14:26 -07:00
test_gc.rb [Feature #21116] Extract RJIT as a third-party gem 2025-02-13 18:01:03 +09:00
test_insns.rb Optimize instructions when creating an array just to call include? (#12123) 2024-11-26 14:31:08 -05:00
test_io.rb Use File.write instead of Kernel#open 2024-07-09 13:01:44 +09:00
test_jump.rb Ensure test suite is compatible with --frozen-string-literal 2024-03-14 17:56:15 +01:00
test_literal.rb Avoid array allocation for *nil, by not calling nil.to_a 2025-03-27 11:17:40 -07:00
test_literal_suffix.rb [PRISM] Enhance syntax error message extraction in test_literal_suffix btest 2024-04-03 17:34:12 -04:00
test_load.rb [Feature #21116] Extract RJIT as a third-party gem 2025-02-13 18:01:03 +09:00
test_marshal.rb
test_massign.rb
test_method.rb Fix assertion failure with anonymous splats 2025-04-02 19:31:05 -07:00
test_objectspace.rb Use a monotonically increasing number for object_id 2019-11-07 09:31:07 -08:00
test_proc.rb Make proc/Proc.new without block an error instead of warning 2020-06-10 17:49:54 -07:00
test_ractor.rb Refactor vm_lookup_cc to allow lock-free lookups in RClass.cc_tbl 2025-08-01 10:42:04 +02:00
test_string.rb
test_struct.rb
test_syntax.rb [Feature #21116] Extract RJIT as a third-party gem 2025-02-13 18:01:03 +09:00
test_thread.rb [Feature #21116] Extract RJIT as a third-party gem 2025-02-13 18:01:03 +09:00
test_yjit.rb YJIT: Fix defined?(yield) and block_given? at top level 2025-08-14 17:01:11 -04:00
test_yjit_30k_ifelse.rb * append newline at EOF. [ci skip] 2021-10-21 08:12:53 +09:00
test_yjit_30k_methods.rb * append newline at EOF. [ci skip] 2021-10-21 08:12:53 +09:00
test_yjit_rust_port.rb Ractor::Port 2025-05-31 04:01:33 +09:00