fix(llvm): Phase 131-10 - Smart console.log routing(Segfault修正)

## 問題
- Integer値をi8*ポインタに変換 → Segfault(Exit 139)

## 解決策
- String literal → nyash.console.log(i8*)
- Integer/Handle → nyash.console.log_handle(i64)

## 結果
- Case B (loop_min_while): LLVM outputs `0,1,2` 
- VM/LLVM完全パリティ達成

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

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
nyash-codex
2025-12-14 09:19:00 +09:00
parent bfe047840b
commit 18bf35e6d4
8 changed files with 97 additions and 104 deletions

View File

@ -25,12 +25,11 @@ pub extern "C" fn print(ptr: *const i8) -> i64 {
#[export_name = "nyash.console.log_handle"]
pub extern "C" fn nyash_console_log_handle(handle: i64) -> i64 {
use nyash_rust::runtime::host_handles as handles;
eprintln!("DEBUG: handle={}", handle);
if let Some(obj) = handles::get(handle as u64) {
let s = obj.to_string_box().value;
println!("{}", s);
} else {
eprintln!("DEBUG: handle {} not found in registry", handle);
// Fallback: handle is an unboxed integer (Phase 131-10)
println!("{}", handle);
}
0