|
|
44b20bfe28
|
fix(mir): Complete ScopeContext migration (Phase 2-4 補完)
Phase 2-4 で移行漏れがあったファイルを修正。
## Changes
- Fixed all remaining compilation errors from incomplete Phase 2-4 migration
- Updated access sites to use scope_ctx.* for 7 legacy fields:
1. current_function → scope_ctx.current_function
2. lexical_scope_stack → scope_ctx.lexical_scope_stack
3. if_merge_stack → scope_ctx.if_merge_stack
4. debug_scope_stack → scope_ctx.debug_scope_stack
- Updated visibility of ScopeContext to pub(in crate::mir) for cross-module access
- Removed dual-write legacy code in lexical_scope.rs, builder.rs
- Updated documentation comments in phi_helpers.rs
## Files Modified (20 files)
Core access migration:
- src/mir/builder/method_call_handlers.rs
- src/mir/builder/control_flow/joinir/routing.rs
- src/mir/builder/control_flow/joinir/merge/loop_header_phi_builder.rs
- src/mir/builder/if_form.rs
- src/mir/builder/ops.rs (4 occurrences)
- src/mir/builder/observe/resolve.rs (2 occurrences)
- src/mir/builder/observe/ssa.rs
- src/mir/builder/receiver.rs
- src/mir/loop_api.rs (3 occurrences)
- src/mir/region/observer.rs (3 occurrences)
- src/mir/utils/control_flow.rs
- src/mir/utils/phi_helpers.rs (4 occurrences + docs)
Dual-write removal:
- src/mir/builder/vars/lexical_scope.rs (push/pop/declare)
- src/mir/builder.rs (if_merge, debug_scope, emit_instruction)
Visibility updates:
- src/mir/builder/scope_context.rs (struct + fields)
## Tests
- cargo build --release: SUCCESS (0 errors, 191 warnings)
- Phase 2-4 migration now fully complete
- Note: Test failures exist but are unrelated (Phase 2-5 binding_map issue)
Phase 2-4 now fully complete ✅
|
2025-12-16 03:33:56 +09:00 |
|
|
|
2db8ff72d0
|
refactor(mir): Remove CoreContext legacy fields (Phase 2-2/7)
完全移行→削除の安全順序(Option C)に従い、CoreContext の
deprecated フィールドと sync helpers を完全削除。
## Changes
- Migrated all access sites to core_ctx.* (SSOT allocators)
- utils.rs: value_gen (3 sites), block_gen (1 site), temp_slot_counter (1 site)
- loop_api.rs: block_gen (1 site)
- phi_helpers.rs: value_gen (1 site)
- builder.rs: sync helpers (2 methods), test assertions (2 sites)
- Removed 5 deprecated fields from builder.rs
- value_gen: ValueIdGenerator
- block_gen: BasicBlockIdGenerator
- next_binding_id: u32
- temp_slot_counter: u32
- debug_join_counter: u32
- Removed sync helper calls (allocate_binding_id, debug_next_join_id)
- Removed field initializations from MirBuilder::new()
- Maintained Phase 136 P0 SSOT structure (next_value_id() remains as high-level API)
## Tests
- cargo build --release: PASS
- cargo test --release --lib: 1029 passed (4 pre-existing failures)
- Deprecation warnings: 435 → 456 (+21)
Note: Warnings increased due to remaining deprecated field *uses* being exposed
after removing the field *definitions*. This is expected during migration.
## Code metrics
- Net reduction: 40 lines (-56 removed, +16 modifications)
- Files changed: 4 (builder.rs, utils.rs, loop_api.rs, phi_helpers.rs)
Phase 2 Progress: 2/7 contexts complete (MetadataContext ✅, CoreContext ✅)
|
2025-12-15 23:05:36 +09:00 |
|
|
|
a898e99310
|
refactor(mir): Remove MetadataContext legacy fields (Phase 2-1/7)
完全移行→削除の安全順序(Option C)に従い、MetadataContext の
deprecated フィールドと sync helpers を完全削除。
## Changes
- Migrated all access sites to metadata_ctx.* (builder methods)
- current_span → metadata_ctx.current_span() / set_current_span()
- source_file → metadata_ctx.current_source_file() / set_source_file() / clear_source_file()
- hint_sink → metadata_ctx.hint_scope_enter/leave/join_result()
- current_region_stack → metadata_ctx.push_region/pop_region/current_region_stack()
- Removed 4 deprecated fields from MirBuilder
- current_span, source_file, hint_sink, current_region_stack
- Removed 2 sync helpers
- sync_metadata_ctx_to_legacy(), sync_legacy_to_metadata_ctx()
- Updated 10 files with direct field accesses
## Files Modified
- src/mir/builder.rs: -56 lines (fields + sync helpers + initialization)
- src/mir/builder/exprs.rs: metadata_ctx.set_current_span()
- src/mir/builder/exprs_peek.rs: metadata_ctx.current_span()
- src/mir/builder/if_form.rs: metadata_ctx.current_span()
- src/mir/builder/phi.rs: metadata_ctx.current_span()
- src/mir/builder/stmts.rs: metadata_ctx.set_current_span()
- src/mir/builder/utils.rs: metadata_ctx.current_span()
- src/mir/loop_api.rs: metadata_ctx.current_span()
- src/mir/region/observer.rs: metadata_ctx.push/pop_region()
- src/mir/utils/phi_helpers.rs: metadata_ctx.current_span()
## Tests
- cargo build --release: SUCCESS (1m 10s)
- cargo test --release --lib: 1029 PASS, 4 FAIL (pre-existing)
- Deprecation warnings: 469 → 435 (-34 warnings)
## Verification
✅ No direct access to removed fields (grep count: 0)
✅ No sync helper calls (grep count: 0)
✅ Build success
✅ MetadataContext is now complete SSOT (二重管理解消)
Phase 2 Progress: 1/7 contexts complete (MetadataContext ✅)
🎉 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
|
2025-12-15 22:44:38 +09:00 |
|
|
|
da1a5558e5
|
Normalize passes keep spans and clean warnings
|
2025-11-24 15:02:51 +09:00 |
|
|
|
466e636af6
|
Span trace utilities and runner source hint
|
2025-11-24 14:17:02 +09:00 |
|
|
|
eee3dfaa83
|
refactor(builder): 箱理論リファクタリング Phase 1完了
🎯 builder_calls.rs (982行) を箱理論で責務別にモジュール分割
## 成果
✅ builder_calls.rs: 982行 → 766行(-216行、22%削減)
✅ calls/lowering.rs: 354行(新規、箱理論6段階パターン)
✅ calls/utils.rs: 45行(新規、ユーティリティ統一)
✅ ビルド・テスト完全成功(0エラー)
## 箱理論の実装
1. 責務ごとに箱に分離:
- lowering: 関数lowering専用
- utils: ユーティリティ統一
- emit/build: Phase 2で実装予定
2. 境界を明確に:
- mod.rs で公開インターフェース定義
- pub(in crate::mir::builder) で適切な可視性制御
3. いつでも戻せる:
- 段階的移行、各ステップでビルド確認
- 既存API完全保持(互換性100%)
4. 巨大関数は分割:
- lower_static_method_as_function: 125行 → 6段階に分解
- lower_method_as_function: 80行 → 6段階に分解
## 箱理論6段階パターン
1. prepare_lowering_context - Context準備
2. create_function_skeleton - 関数スケルトン作成
3. setup_function_params - パラメータ設定
4. lower_function_body - 本体lowering
5. finalize_function - 関数finalize
6. restore_lowering_context - Context復元
## ファイル構成
src/mir/builder/
├── calls/
│ ├── mod.rs # 公開インターフェース
│ ├── lowering.rs # 関数lowering(354行)
│ └── utils.rs # ユーティリティ(45行)
└── builder_calls.rs # 削減版(766行)
## 次のステップ
Phase 2: emit.rs 作成(~500行移行)
Phase 3: build.rs 作成(~350行移行)
最終目標: builder_calls.rs を200行以内に
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude <noreply@anthropic.com>
Co-Authored-By: Task先生 <task@anthropic.com>
|
2025-11-17 17:02:01 +09:00 |
|
|
|
da78fc174b
|
selfhost/runtime: Stage 0-1 runner + MIR JSON loader (summary) with trace; compiler: scopebox/loopform prepass wiring (flags, child args); libs: add P1 standard boxes (console/string/array/map) as thin wrappers; runner: pass --box-pref via env; ops_calls dispatcher skeleton; docs: selfhost executor roadmap + scopebox/loopform notes; smokes: selfhost runner + identity prepasses; CURRENT_TASK: update plan and box lib schedule
|
2025-09-22 21:52:39 +09:00 |
|
|
|
adbb0201a9
|
chore(fmt): add legacy stubs and strip trailing whitespace to unblock cargo fmt
|
2025-09-17 07:43:07 +09:00 |
|
|
|
3a8f7092e6
|
MIR loop_api: extend facade with CFG/phi helpers (add_predecessor, seal_block, insert_phi_at_block_start) and implement for legacy/modularized builders to prepare SSA loop reintroduction.
|
2025-08-25 22:22:14 +09:00 |
|
|
|
317e6af0bf
|
MIR: add loop_api facade trait and simple lowering helper; implement LoopBuilderApi for legacy MirBuilder to enable adapter-based migration.
|
2025-08-25 20:16:42 +09:00 |
|