fix(phase-4.3c-3): Fix StringBox literal handling in MIR builder

Phase 4-3c-3 Complete: WASM host functions now correctly output string content

## Changes:
- Fixed MIR builder to handle StringBox with string literal arguments
- Special case for  to generate proper string constants
- Removed debug output after successful verification
- WASM now correctly outputs "Hello MIR!" instead of "StringBox"

## Test Results:
- MIR generation:  Generates  correctly
- WASM compilation:  String data correctly placed at offset 4096
- WASM execution:  Outputs "Hello MIR\!" as expected

## Technical Details:
- Modified build_new_expression() to detect StringBox with literal arguments
- Generates Const instruction with actual string content
- Host function reads StringBox memory layout correctly

This completes the WASM string output functionality for Phase 4.

🤖 Generated with Claude Code
Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
Moe Charm
2025-08-17 13:49:35 +09:00
parent bb3f2e8032
commit 3df87fb1ce
41 changed files with 4444 additions and 68 deletions

View File

@ -371,6 +371,39 @@ impl MirPrinter {
format!("extern_call {}.{}({}) [effects: {}]", iface_name, method_name, args_str, effects)
}
},
// Phase 8.5: MIR 26-instruction reduction (NEW)
MirInstruction::BoxFieldLoad { dst, box_val, field } => {
format!("{} = {}.{}", dst, box_val, field)
},
MirInstruction::BoxFieldStore { box_val, field, value } => {
format!("{}.{} = {}", box_val, field, value)
},
MirInstruction::WeakCheck { dst, weak_ref } => {
format!("{} = weak_check {}", dst, weak_ref)
},
MirInstruction::Send { data, target } => {
format!("send {} -> {}", data, target)
},
MirInstruction::Recv { dst, source } => {
format!("{} = recv {}", dst, source)
},
MirInstruction::TailCall { func, args, effects } => {
let args_str = args.iter().map(|v| format!("{}", v)).collect::<Vec<_>>().join(", ");
format!("tail_call {}({}) [effects: {}]", func, args_str, effects)
},
MirInstruction::Adopt { parent, child } => {
format!("adopt {} <- {}", parent, child)
},
MirInstruction::Release { reference } => {
format!("release {}", reference)
},
MirInstruction::MemCopy { dst, src, size } => {
format!("memcopy {} <- {}, {}", dst, src, size)
},
MirInstruction::AtomicFence { ordering } => {
format!("atomic_fence {:?}", ordering)
},
}
}