Files
hakorune/docs/development/mir/MIR_BUILDER_MODULES.md
Moe Charm 53d88157aa Phase 12: 統一TypeBox ABI実装開始 - ChatGPT5による極小コアABI基盤構築
- TypeBox ABI雛形: メソッドスロット管理システム追加
- Type Registry: Array/Map/StringBoxの基本メソッド定義
- Host API: C ABI逆呼び出しシステム実装
- Phase 12ドキュメント整理: 設計文書統合・アーカイブ化
- MIR Builder: クリーンアップと分離実装完了

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-09-03 05:04:56 +09:00

32 lines
1.7 KiB
Markdown
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

# MIR Builder Modules (Current Split)
This note summarizes the current split of the MIR builder to keep `builder.rs` thin and maintainable.
Paths:
- `src/mir/builder.rs`: Thin hub for MIR building; owns state (generators, maps) and highlevel coordination.
- `src/mir/builder/stmts.rs`: Statement builders
- `build_print_statement`, `build_block`, `build_if_statement`, `build_loop_statement`,
`build_try_catch_statement`, `build_throw_statement`, `build_local_statement`,
`build_return_statement`, `build_nowait_statement`, `build_await_expression`, `build_me_expression`.
- `src/mir/builder/ops.rs`: Expression ops
- `build_binary_op`, `build_unary_op`, `convert_binary_operator`, `convert_unary_operator`.
- `src/mir/builder/utils.rs`: Shared utilities
- `resolve_include_path_builder`, `builder_debug_enabled`, `builder_debug_log`, `infer_type_from_phi`.
- Calls: `src/mir/builder/builder_calls.rs`
- `build_function_call`, `build_method_call`, `build_from_expression`,
`lower_method_as_function`, `lower_static_method_as_function`,
`parse_type_name_to_mir`, `extract_string_literal`.
Notes:
- `builder.rs` now stays < 1,000 LOC by delegating to the above modules.
- No behavior change intended; only mechanical movement. jitdirect smokes remain green.
- Debug logs remain gated by `NYASH_BUILDER_DEBUG=1`.
Run checks:
- Build (JIT): `cargo build --release --features cranelift-jit`
- jitdirect smokes:
- `NYASH_JIT_THRESHOLD=1 ./target/release/nyash --jit-direct apps/tests/mir-branch-ret/main.nyash`
- `NYASH_JIT_THRESHOLD=1 ./target/release/nyash --jit-direct apps/tests/mir-phi-min/main.nyash`
- `NYASH_JIT_THRESHOLD=1 ./target/release/nyash --jit-direct apps/tests/mir-branch-multi/main.nyash`