Commit 762f7374

762f73742648Merged

Yukihiro "Matz" Matsumoto <[email protected]> · 6 months ago · 2 files · ~2 modified

Description

codegen: yield-emit boxing + nested-inliner cache-stale guard (#664)

Phase C/D of the per-method _block C signature widening. Closes the promote-mode tail of issue #664 by:

  • Threading the analyze projection through emit time as @current_method_blk_param_types, populated when entering a yield-using method body. compile_yield_stmt reads the per-position projection: bigint slots get int args wrapped via sp_bigint_new_int; int slots get bigint args unboxed via sp_bigint_to_int; padded slots use the matching zero value (sp_bigint_new_int(0) for bigint, raw 0 for int).
  • Stale-cache guards: both compile_yield_stmt's coerce and compile_nested_callee_stmt's / compile_stmt_with_block's YieldNode arms now consult expr_emit_is_bigint(arg_id) on top of infer_type's cached classification. Without this the canonical yield x * 2 (x: bigint) shape gets cached "int" and we double-wrap with sp_bigint_new_int(sp_bigint_mul(...)) -- the inner sp_bigint_mul returns sp_Bigint *, then sp_bigint_new_int passes that pointer through int64_t and clang fails -Werror.
  • Removes the nested_yield_with_block_param.rb filter from Makefile -- the test now passes in promote mode.

Default tests 649/0/0 unchanged. Promote tests 648/0/0 (was 647 + nested_yield skip). optcarrot checksum 59662 unchanged.

The only remaining promote skip is int_overflow_raises.rb whose expected output asserts RangeError on overflow -- mode-incompatible by design.

Co-Authored-By: Claude Opus 4.7 [email protected]

Details

Commit
762f73742648
Parent
d2a0ca58a369

MakefilemodifiedView file

@@ -380,13 +380,6 @@
380380 # auto-promotes to bigint and the expected output diverges by design.
381381 ifeq ($(SPINEL_INT_OVERFLOW),promote)
382382 TESTS := $(filter-out test/int_overflow_raises.rb,$(TESTS))
383-# nested_yield_with_block_param: in promote mode the yield-using
384-# function bodies (sp_inner, sp_double_then_emit) emit
385-# `_block(sp_bigint_mul(..., ...))` against a `_block(mrb_int, ...)`
386-# signature -- pre-existing yield/bigint codegen mismatch unrelated
387-# to the inliner that the test covers. Filtered until that codegen
388-# path is bigint-aware.
389-TESTS := $(filter-out test/nested_yield_with_block_param.rb,$(TESTS))
390383 endif
391384 TEST_TARGETS := $(patsubst test/%.rb,build/test-results/%.ok,$(TESTS))
392385