Files
hakorune/tests/phase33/smoke/mir_call/global_simple.hako
nyash-codex ce7f2d6b9d feat(phase33): mir_call.hako Stage 1 complete - unified Call instruction skeleton
Stage 1 Implementation (208 lines):
- 6 callee types: Global/Method/Constructor/Extern/Closure/Value
- CallEmitBox reuse: 60% of functionality already implemented
- JSON generation only (C++ backend handles LLVM IR)

Builder Integration:
- Added MirCallInst import and delegation methods
- 10 instructions complete: const, binop, compare, ret, branch, jump, copy, phi, loopform, mir_call

Tests (333 lines):
- Unit tests: 6 tests covering all callee types (288 lines)
- Smoke test: Global function call verification (45 lines)

Build Status:
- Rust build: SUCCESS (0 errors)
- Test execution: PENDING (Phase 33 environment setup required)

Code Reduction:
- Python mir_call.py: 641 lines
- Hakorune mir_call.hako: 208 lines
- Reduction: -67.5% (using existing CallEmitBox)

Next Steps:
- Stage 2-6: Complete implementation
- CallEmitBox.make_mir_call_closure/value additions
- C++ backend integration

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

Co-Authored-By: Claude <noreply@anthropic.com>
2025-11-01 08:55:34 +09:00

46 lines
1.1 KiB
Plaintext

// MIR Call Smoke Test 1: Global function call
// Tests basic Global callee type
using "lang/src/llvm_ir/instructions/mir_call.hako" as MirCallInst
static box Main {
main() {
print("=== MIR Call Smoke Test 1: global_simple ===")
// Simulate: print("hello")
local callee = new MapBox()
callee.set("type", "Global")
callee.set("name", "print")
local args = new ArrayBox()
args.push(1) // register ID 1
// Generate mir_call JSON
local json = MirCallInst.lower_mir_call(null, callee, args, 2, null)
// Verify JSON structure
local has_mir_call = json.indexOf("\"op\":\"mir_call\"")
if has_mir_call < 0 {
print("ERROR: op not found")
return 1
}
local has_global = json.indexOf("\"type\":\"Global\"")
if has_global < 0 {
print("ERROR: Global type not found")
return 1
}
local has_name = json.indexOf("\"name\":\"print\"")
if has_name < 0 {
print("ERROR: function name not found")
return 1
}
print("✓ PASS: global_simple mir_call generated")
print("Note: Actual execution requires C++ backend implementation")
return 0
}
}