Files
hakorune/src/backend/llvm/compiler/codegen/instructions/mod.rs
Selfhosting Dev 3bef7e8608 feat(llvm): Implement Context Boxing pattern for cleaner APIs
Major improvement to reduce parameter explosion (15+ args → 3-4 contexts):
- Add LowerFnCtx/BlockCtx for grouping related parameters
- Add lightweight StrHandle/StrPtr newtypes for string safety
- Implement boxed API wrappers for boxcall/fields/invoke
- Add dev checks infrastructure (NYASH_DEV_CHECK_DISPATCH_ONLY_PHI)

Key achievements:
- lower_boxcall: 16 args → 7 args via boxed API
- fields/invoke: Similar parameter reduction
- BuilderCursor discipline enforced throughout
- String handle invariant: i64 across blocks, i8* only at call sites

Status:
- Internal migration in progress (fields → invoke → marshal)
- Full cutover pending due to borrow checker constraints
- dep_tree_min_string.o generation successful (sealed=ON)

Next: Complete internal migration before flipping to boxed APIs

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

Co-Authored-By: Claude <noreply@anthropic.com>
2025-09-13 00:07:38 +09:00

34 lines
931 B
Rust

mod blocks;
pub mod builder_cursor;
pub mod flow;
mod externcall;
mod newbox;
mod boxcall;
pub mod ctx;
pub mod string_ops;
mod arith;
mod mem;
mod consts;
mod strings;
mod arrays;
mod maps;
mod arith_ops;
mod call;
mod loopform;
mod resolver;
pub(super) use blocks::{create_basic_blocks, precreate_phis};
pub(super) use flow::{emit_branch, emit_jump, emit_return};
pub(super) use externcall::lower_externcall;
pub(super) use newbox::lower_newbox;
pub(super) use boxcall::{lower_boxcall, lower_boxcall_boxed};
pub(super) use arith::lower_compare;
pub(super) use mem::{lower_load, lower_store};
pub(super) use consts::lower_const;
pub(super) use arith_ops::{lower_binop, lower_unary};
pub(super) use call::lower_call;
pub(super) use loopform::{LoopFormContext, lower_while_loopform};
pub(super) use loopform::normalize_header_phis_for_latch;
pub(super) use loopform::dev_check_dispatch_only_phi;
pub(super) use resolver::Resolver;