feat(phase-9.77): Implement BoxCall instructions and fix wasmtime version

Phase 9.77 WASM Emergency Recovery Progress:
-  Task 1.1: Implement BoxCall instruction for toString(), print(), equals(), clone(), log()
-  Task 1.2: Update wasmtime 18.0 → 35.0.0 and add runtime imports
- 🔄 Task 1.3: Working on UTF-8 encoding error fix

Changes:
- Add generate_box_call() method in codegen.rs with 5 helper methods
- Update wasmtime dependency to 35.0.0 for AOT compatibility
- Add BoxCall runtime imports (box_to_string, box_print, box_equals, box_clone)
- Implement wat_to_wasm() with UTF-8 validation and debug output
- Update CURRENT_TASK.md with Copilot handoff notes

Current issue: 'Generated WASM is not valid UTF-8' error source unknown
Next: Copilot to investigate error origin and complete Task 1.3

🤖 Generated with Claude Code

Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
Moe Charm
2025-08-16 21:21:51 +09:00
parent fa1a3ad644
commit cde961defc
9 changed files with 288 additions and 5 deletions

View File

@ -0,0 +1,8 @@
// 🧪 最も単純なWASM生成テスト
// 変数操作も避けて、純粋な計算のみ
static box Main {
main() {
return "成功"
}
}

View File

@ -0,0 +1,17 @@
// 🧪 MIR → WASM変換テスト最小版
// メソッド呼び出しを避けて基本演算のみテスト
static box Main {
init { result }
main() {
// 基本演算のみ(メソッド呼び出しなし)
local a = 10
local b = 20
local sum = a + b
local product = sum * 3
me.result = product
return "計算完了"
}
}

View File

@ -0,0 +1,28 @@
// 🧪 MIR → WASM変換テスト用シンプルプログラム
// 基本的な演算とBox操作をテスト
static box Main {
init { console, result }
main() {
me.console = new ConsoleBox()
me.console.log("🚀 MIR → WASM変換テスト開始")
// 基本演算テスト
local a = 10
local b = 20
local sum = a + b
me.console.log("計算結果: " + sum.toString())
// StringBox操作テスト
local greeting = "Hello"
local name = "WASM"
local message = greeting + " " + name + "!"
me.console.log("メッセージ: " + message)
me.result = sum
return "MIR → WASM変換テスト完了"
}
}

View File

@ -0,0 +1 @@
local result = 42