Commit 61f81b6c
61f81b6c1563Merged
Yukihiro "Matz" Matsumoto <[email protected]> · 5 months ago · 1 file · ~1 modified
Description
docs(promote): record 937->939 (<=> ret exclusion, typed-array ret follow), remaining ERR=34 incl ptr_array local-type cascade
Co-Authored-By: Claude Opus 4.8 [email protected]
Details
- Commit
- 61f81b6c1563
- Parent
- 4599b32cf20b
docs/promote-mode-plan.mdmodifiedView file
@@ -98,8 +98,9 @@
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. **932→937 の安全グループ landed**: bound-method 直接 `.call` の arg を `emit_arg_or_default` で param 型 coerce(method/i960)/ ClassVariableWriteNode 推論を cvar 型返し=二重 box 解消(cvar_method_first_assign)/ poly-receiver dispatch の poly arg→scalar param unbox(8313, `<=>` 前進)/ splat 展開要素を poly param へ box(splat_call)。各 g_promote_mode gate 内、default 992/0/0+optcarrot 59662 維持。102-
**残 ERR=37(937 時点、`/tmp/perr5.txt` ≈)の散在 one-off / 深い codegen バグ**:101+
3. **932→939 の安全グループ landed**(全 g_promote_mode gate 内、default 992/0/0+optcarrot 59662 維持): bound-method 直接 `.call` の arg を `emit_arg_or_default` で param 型 coerce(method/i960)/ ClassVariableWriteNode 推論を cvar 型返し=二重 box 解消(cvar_method_first_assign)/ poly-receiver dispatch の poly arg→scalar param unbox(8313, `<=>` 前進)/ splat 展開要素を poly param へ box(splat_call)/ **`<=>` を ret widen 除外**(小 int しか返さず overflow 無し→caller の `(a<=>b)<cmp>0` が int 比較で通る、lrama_features)/ **typed-array ret を body の PolyArray に追従**(post-widen fixpoint の loop3=method ret を body 末尾/return の PolyArray から再導出、multi_return)。102+
**残 ERR=34(939 時点)の散在 one-off / 深い codegen バグ**:103+
- **ptr_array**: method ret は PolyArray 化したが caller の `local = method()` の **local slot 型が IntArray のまま**(infer_write_types は widen 前確定)= method-ret→local 型の伝播 cascade 要。103104
- **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、の順序修正が要る。104105
- **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 型一致が要る。105106
- **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 せず。