Commit 2fd99ec9

2fd99ec9f1c1Merged

Yukihiro "Matz" Matsumoto <[email protected]> · 5 months ago · 1 file · ~1 modified

Description

docs(promote): record poly-dispatch arg unbox (8313) + remaining ERR=42 map (between?/clamp arg-hoist, capture-var arith, bound-method args, scattered one-offs)

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

Details

Commit
2fd99ec9f1c1
Parent
bdbf794902b0

docs/promote-mode-plan.mdmodifiedView file

@@ -98,7 +98,12 @@
9898 - **★決め手 = fixpoint 後に `for id: infer_type(c,id)` で node-type cache を再構築**。codegen の `.call` は `comp_ntype(call node)`(node cache)を読むので、proc_ret を更新しても cache が stale だと `.call` が古い int slot 経路を出す。再 infer は scope local 型を読むだけで変えないので widen 不変。
9999 - 結果: proc / proc_closure / case_local_in_lambda / enum_for_each / lowered_block_given が緑、**proc の 6→0 FAIL も解消**。当初推測の「side-channel 非再入」「ABI 全面改修」は**いずれも不要だった**(真因は node-cache の refresh 漏れ)。
100100 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 型依存。中央解決要。
101- 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。
101+ 3. **残 ERR=42(932 時点、`/tmp/perr5.txt`)の散在 one-off / 深い codegen バグ**:
102+ - **poly-receiver dispatch の arg coerce 双方向**: `8313` で poly arg→scalar param の unbox arm 追加済(`<=>` 等、回帰0)。だが user `<=>`(comparable_between_user_type 等 3)は**第2ブロッカー = between?/clamp の arg-hoist g_pre 再入バグ**で残る:`sp_Temp * _t7 = sp_RbVal _t10 = ...`(`Temp.new(5)` の boxed arg hoist が外側 arg-temp decl の初期化子内に混入)。emit_dispatch(codegen_fold.c:3389)で arg を側 buffer 評価→prelude flush 後に temp decl、の順序修正が要る。
103+ - **closure_capture_float 系(3, sp_runtime.h:187 `mrb_int=sp_RbVal`)**: poly cell 導入で capture が通るようになったが、proc 本体の captured 変数の**算術が `sp_int_add(poly cell, 1)`**(comp_ntype が int、cell は poly)。proc 本体 scope の captured-var 型一致が要る。
104+ - **bound-method `.call` 直接 dispatch の raw arg**(method=sp_double / i960=sp_dbl / splat_call=sp_mix / bound_method_single_eval=sp_poly_puts / cvar_method_first_assign=sp_box_int): poly param へ int arg を box せず。
105+ - **B6 poly→int**(bm_instance_eval=ivar-write-as-expr / poly_dispatch_* / instance_exec break/next/trampoline_result / bundle_class_10 等)、**B1 int→poly**(instance_eval_block_params/bundle_misc_b/block2/bundle_classd_04)、binary op(pattern_pin `==`/bundle_class_05 `<<`/lrama_features `<`)、return mismatch(compile_time_define_method_int / multi_return・ptr_array=PolyArray vs IntArray)、invalid init(i916/op_assign_user_operator)、hash key(bundle_class_06=emit_hash_key の comp_ntype stale)、sp_box_str int-conv(recursive_implicit_yield_value)、sp_Integer undeclared(class_method_open_class_call)、float aggregate(float_round_nonliteral)、ld error(fiber_capture_no_leak_to_sibling/i1007)、front-end(clamp_bounds/integer_div_by_zero)。各々 1-2 テスト、個別診断要。
106+ - **FAIL=19** はコンパイル通るが出力差、別途。
102107 - **手法**: `/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)。
103108 - **次の一手**: (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` が既存の中央ヘルパー。**
104109