feat(llvm): Phase 131-15 - print/concat segfault 根治修正
## P1-1/P1-2: TypeFacts 優先化 - binop.py: operand facts が dst_type ヒントより優先 - mir_json_emit.rs: Unknown 時に dst_type を出さない - function_lower.py: value_types を metadata から読み込み ## P2: handle concat 統一(根治) - print シグネチャ修正: i64(i64) → void(i8*) - Mixed concat を handle ベースに統一: - concat_si/concat_is → concat_hh - box.from_i64 で integer を handle 化 - Everything is Box 哲学に統一 - legacy 関数は互換性のために保持 ## 結果 - ✅ print("Result: " + 3) → Result: 3 - ✅ segfault 解消 - ✅ Everything is Box 統一 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
This commit is contained in:
@ -119,7 +119,6 @@ pub extern "C" fn nyash_string_concat_hh_export(a_h: i64, b_h: i64) -> i64 {
|
||||
nyash_rust::runtime::global_hooks::gc_alloc(s.len() as u64);
|
||||
let arc: std::sync::Arc<dyn NyashBox> = std::sync::Arc::new(StringBox::new(s));
|
||||
let h = handles::to_handle_arc(arc) as i64;
|
||||
eprintln!("[TRACE] concat_hh -> {}", h);
|
||||
h
|
||||
}
|
||||
|
||||
@ -239,7 +238,6 @@ pub extern "C" fn nyash_box_from_i8_string(ptr: *const i8) -> i64 {
|
||||
let arc: std::sync::Arc<dyn NyashBox> = std::sync::Arc::new(StringBox::new(s.clone()));
|
||||
nyash_rust::runtime::global_hooks::gc_alloc(s.len() as u64);
|
||||
let h = handles::to_handle_arc(arc) as i64;
|
||||
eprintln!("[TRACE] from_i8_string -> {}", h);
|
||||
h
|
||||
}
|
||||
|
||||
@ -263,7 +261,8 @@ pub extern "C" fn nyash_box_from_i64(val: i64) -> i64 {
|
||||
};
|
||||
let arc: std::sync::Arc<dyn NyashBox> = std::sync::Arc::new(IntegerBox::new(val));
|
||||
nyash_rust::runtime::global_hooks::gc_alloc(8);
|
||||
handles::to_handle_arc(arc) as i64
|
||||
let h = handles::to_handle_arc(arc) as i64;
|
||||
h
|
||||
}
|
||||
|
||||
// integer.get_h(handle) -> i64
|
||||
|
||||
@ -44,6 +44,8 @@ pub extern "C" fn nyash_string_concat_ss(a: *const i8, b: *const i8) -> *mut i8
|
||||
}
|
||||
|
||||
// Exported as: nyash.string.concat_si(i8* a, i64 b) -> i8*
|
||||
// NOTE: Phase 131-15-P1 - Kept for diagnostic/compatibility purposes
|
||||
// LLVM backend now uses concat_hh(handle, handle) for all mixed concatenations
|
||||
#[export_name = "nyash.string.concat_si"]
|
||||
pub extern "C" fn nyash_string_concat_si(a: *const i8, b: i64) -> *mut i8 {
|
||||
let mut s = String::new();
|
||||
@ -63,6 +65,8 @@ pub extern "C" fn nyash_string_concat_si(a: *const i8, b: i64) -> *mut i8 {
|
||||
}
|
||||
|
||||
// Exported as: nyash.string.concat_is(i64 a, i8* b) -> i8*
|
||||
// NOTE: Phase 131-15-P1 - Kept for diagnostic/compatibility purposes
|
||||
// LLVM backend now uses concat_hh(handle, handle) for all mixed concatenations
|
||||
#[export_name = "nyash.string.concat_is"]
|
||||
pub extern "C" fn nyash_string_concat_is(a: i64, b: *const i8) -> *mut i8 {
|
||||
let mut s = a.to_string();
|
||||
|
||||
Reference in New Issue
Block a user