Files
hakorune/local_tests/benchmark_filebox_simple.nyash
Moe Charm 3df87fb1ce 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>
2025-08-17 13:49:35 +09:00

47 lines
1.4 KiB
Plaintext

// FileBox シンプルパフォーマンステスト
// 動的版と静的版の速度比較用
static box Main {
init { console }
main() {
me.console = new ConsoleBox()
me.console.log("📊 FileBox パフォーマンステスト")
// テスト設定
local iterations
iterations = 100 // 少なめにして手動計測
me.console.log("🔧 Test: FileBox作成・読み書き x " + iterations.toString())
me.console.log("⏱️ 開始時刻を記録してください...")
// FileBox作成・読み書きテスト
local i
i = 0
loop(i < iterations) {
local file
file = new FileBox("perf_test_" + i.toString() + ".txt")
// 書き込み
file.write("Performance test data " + i.toString())
// 読み込み
local content
content = file.read()
// 存在確認
local exists
exists = file.exists()
i = i + 1
}
me.console.log("⏱️ 終了!経過時間を確認してください")
me.console.log("✅ " + iterations.toString() + " 個のファイル操作完了")
// クリーンアップ用コメント
me.console.log("\n🧹 クリーンアップ: rm -f perf_test_*.txt")
return "done"
}
}