Commit b79049c0
b79049c02a8cMerged
Yukihiro "Matz" Matsumoto <[email protected]> · 5 months ago · 1 file · ~1 modified
Description
docs(promote): record self-drive batch to 927, the emit_tail_value double-box trap, and structural blockers (proc mrb_int ABI, stale node-cache)
Co-Authored-By: Claude Opus 4.8 [email protected]
Details
- Commit
- b79049c02a8c
- Parent
- 574c1a525953
docs/promote-mode-plan.mdmodifiedView file
@@ -79,7 +79,13 @@
7979
- **poly→scalar unbox(29dbedea, 901→909)**: block-param を int に保ったことで、poly source(widen された yield 値・ivar・trampoline temp)を int block-param へ束縛する逆方向が必要に。emit_block_invoke の yield 束縛 + instance_exec の is_exec/tramp 束縛に `bt scalar && at poly → emit_unbox_text` arm を追加(box arm の対称)。yield/forward_args_block/block_forward_*/inlined_yield_self_locals/instance_exec_mixed_args 緑。8080
- **残 ERR=64 / FAIL=20(`/tmp/perr2.txt` の手法で再取得)**: **B4 builtin-arg coerce(~19)**= poly arg を builtin の int/typed param へ(`sp_bigint_new_int`/`sp_range_include`/`sp_str_sub_range(_r)`/user `<=>`=`_lt_set_gt`/`sp_collect_s` 等、call-arg site で散在 coerce)。**B6 残(poly→int 代入)**= まだ拾い切れてない束縛 site。**B1 残(int→poly 代入、8)**。**closure capture(front-end, 5)**=`unsupported closure capturing a non-integer variable`(widen で capture 変数が poly 化→closure が非 int capture 非対応、front-end 制限)。他に return mismatch(3)/invalid binary operands(4)/invalid initializer(2)/`unsupported p argument`(clamp)等。**FAIL=20** はコンパイル通るが出力差(例: `proc` が proc 戻り値で `6`→`0`)、別途調査。8181
- **range/string builtin の poly arg coerce(17fa2d32, 909→912)**: `sp_range_include`(include?/case-as-value/when range-membership の 3 site)と string slice/index(`sp_str_sub_range[_r]`/`sp_str_char_at_or_nil`)の int 引数を poly のとき `sp_poly_to_i`(string 側は `emit_int_expr` で一律 coerce)。range/case/truncate_module_method 緑。**poly 経路のみ変化、default 不変**。82-
- **残 ERR=60 / FAIL=21**: B4 builtin-arg coerce の残り = **散在 one-off**(`sp_bigint_new_int(poly)`→本来 `sp_poly_as_bigint`、codegen_stmt.c:510/563/634 の bigint-cell arm / `sp_IntArray_index_poly` arg2 / user `<=>`=`sp_*__lt_set_gt`(構造的に `expected expression before sp_RbVal` も伴う)/ `sp_collect_s` / bound-method `.call` が raw arg を widen poly param へ=codegen_call の bound-method dispatch)。closure-capture front-end(5)。FAIL=21(出力差、proc 6→0 等)。82+
- **自走バッチ(912→927、+15)**: masgn/pattern 系の box(pattern-match destructure+capture、leading-splat、cvar op-assign→`sp_poly_<op>`+inference 修正、begin/rescue tail box)+ **index/count 引数の一括 `emit_int_expr` 化**(array/string index・fetch・count・op-assign の `mrb_int _t=<idx>` 約25 site、poly のみ coerce で default 不変)+ bigint slot poly 代入→`sp_poly_as_bigint` + range/string-index builtin の poly arg coerce。各 commit は `g_promote_mode` 経路のみ変化、default 992/0/0 + optcarrot 59662 維持。83+
- **★罠(記録)**: `emit_tail_value` の `g_ret_type==POLY` 無条件 box は **explicit-return 経路と二重 box** で begin_rescue/forward_args_block を回帰(spot-test では PASS だが full-suite で発覚)→ revert。**共有 tail/return 経路の変更は full-suite 必須**(spot-test 不可)。84+
- **残 ERR=44 / FAIL=22 の構造的ブロッカー**:85+
1. **proc/closure の mrb_int ABI(closure-capture ~5 ERR + proc 6→0 等 FAIL)**: `sp_proc_call` の戻り値・args が mrb_int 固定。poly 値が proc 境界で truncate。poly-cell(sp_RbVal セル+`sp_cell_scan_rbval`)は実装途中まで行ったが、proc ABI 全体が mrb_int 前提なので **ABI を sp_RbVal 化する大改修が必要**(別案件、incremental coercion では不可)。試行ブランチ無し=未コミット破棄済。86+
2. **node-cache stale**: `emit_hash_key` 等が `comp_ntype(key)` の widen 前 int を読み coerce を飛ばす(int-keyed hash の poly key=bundle_class_06)。local read は `scope_local()->type` が正、generic ヘルパーは node 型依存。中央解決要。87+
3. **散在 one-off**: user `<=>`(`sp_*__lt_set_gt` の arg、`expected expression before sp_RbVal` 構造的)、bound-method `.call` 直接 dispatch の raw arg(sp_double/dbl/mix)、instance_exec break/next/trampoline_result の poly 結果→int、各種 builtin arg。88+
- **手法**: `/tmp/ptest.sh <name>`(単体)、`/tmp/perragg.sh`→`/tmp/perr4.txt`(全 ERR first-error)、`/tmp/ptest_lastc`(最後の cfile)。中央 coerce=`emit_int_expr`(poly→int)/`emit_float_expr`/`sp_poly_as_bigint`/`emit_boxed`+`emit_boxed_text`(→poly)/`emit_unbox_text`(poly→scalar)。8389
- **次の一手**: (1) 残 B4 one-off を `emit_int_expr`/`sp_poly_as_bigint` で個別 coerce(中央化できる site は emit_int_expr に寄せる)。(2) closure-capture front-end(capture 変数 poly 対応 or widen 除外)。(3) FAIL=21 の出力差(proc 等)。手法=`/tmp/ptest.sh <name>`、`/tmp/perragg.sh`→`/tmp/perr2.txt`、`/tmp/ptest_lastc` に最後の cfile。**poly→int は `emit_int_expr`、poly→float は `emit_float_expr`、poly→bigint は `sp_poly_as_bigint` が既存の中央ヘルパー。**8490
8591
### (参考)legacy 方式