runner: add NyVM wrapper core_bridge (canonicalize/dump) + opt-in wrapper canary; export module in common_util
This commit is contained in:
@ -37,8 +37,8 @@ static box EmitCallBox {
|
||||
return "\"" + out + "\""
|
||||
}
|
||||
emit_call_int_args(name, args) {
|
||||
name = match name { null => "", _ => name }
|
||||
args = match args { null => [], _ => args }
|
||||
if name == null { name = "" }
|
||||
if args == null { args = [] }
|
||||
// JSON v0 shape (HeaderEmitBox contract): {functions:[{name,params,blocks:[{id,instructions}]}]}
|
||||
// Materialize immediate int args: r1..rN; mir_call Extern(name)(r1..rN)->rK; ret rK
|
||||
local s = "" + args
|
||||
|
||||
@ -54,8 +54,9 @@ static box EmitCompareBox {
|
||||
|
||||
emit_compare_cfg3(lhs, rhs, cmp, materialize, trace) {
|
||||
if trace == 1 { print("[emit] compare lhs=" + lhs + " rhs=" + rhs + " cmp=" + cmp + " mat=" + materialize) }
|
||||
// normalize cmp via match
|
||||
cmp = match cmp { null => "Gt", "" => "Gt", _ => cmp }
|
||||
// normalize cmp (null/empty → Gt)
|
||||
if cmp == null { cmp = "Gt" }
|
||||
if cmp == "" { cmp = "Gt" }
|
||||
// string直組み
|
||||
local lhs_s = EmitCompareBox._to_str(lhs)
|
||||
local rhs_s = EmitCompareBox._to_str(rhs)
|
||||
|
||||
@ -32,8 +32,8 @@ static box EmitMethodBox {
|
||||
return "\"" + out + "\""
|
||||
}
|
||||
emit_method_int_args(method, recv_val, args) {
|
||||
method = match method { null => "", _ => method }
|
||||
args = match args { null => [], _ => args }
|
||||
if method == null { method = "" }
|
||||
if args == null { args = [] }
|
||||
// Shape: const recv->r1; const args r2..rN; mir_call Method(method, r1, r2..)->rK; ret rK
|
||||
local s = "" + args
|
||||
local pos = 0
|
||||
|
||||
@ -10,8 +10,8 @@ using "lang/src/compiler/pipeline_v2/local_ssa_box.hako" as LocalSSABox
|
||||
|
||||
static box EmitNewBoxBox {
|
||||
emit_newbox_int_args(class_name, args) {
|
||||
class_name = match class_name { null => "", _ => class_name }
|
||||
args = match args { null => [], _ => args }
|
||||
if class_name == null { class_name = "" }
|
||||
if args == null { args = [] }
|
||||
// ArgsParserBox 正規化 → BlockBuilder 直結
|
||||
local vals = Stage1ArgsParserBox.parse_ints(args)
|
||||
if vals == null { return null }
|
||||
@ -22,8 +22,8 @@ static box EmitNewBoxBox {
|
||||
|
||||
// JSON v1 (MirCall) emission — experimental, shape-only
|
||||
emit_newbox_int_args_v1(class_name, args) {
|
||||
class_name = match class_name { null => "", _ => class_name }
|
||||
args = match args { null => [], _ => args }
|
||||
if class_name == null { class_name = "" }
|
||||
if args == null { args = [] }
|
||||
// 同形出力(shared builder に一本化)
|
||||
local vals = Stage1ArgsParserBox.parse_ints(args)
|
||||
if vals == null { return null }
|
||||
|
||||
@ -11,8 +11,8 @@ using "lang/src/shared/mir/json_emit_box.hako" as JsonEmitBox
|
||||
static box MirCallBox {
|
||||
// Global(name, args:int[])
|
||||
emit_call_v1(name, args) {
|
||||
name = match name { null => "", _ => name }
|
||||
args = match args { null => [], _ => args }
|
||||
if name == null { name = "" }
|
||||
if args == null { args = [] }
|
||||
local s = "" + args
|
||||
local pos = 0
|
||||
local n = 0
|
||||
@ -36,8 +36,8 @@ static box MirCallBox {
|
||||
|
||||
// Method(method, recv:int, args:int[])
|
||||
emit_method_v1(method, recv_val, args) {
|
||||
method = match method { null => "", _ => method }
|
||||
args = match args { null => [], _ => args }
|
||||
if method == null { method = "" }
|
||||
if args == null { args = [] }
|
||||
local s = "" + args
|
||||
local pos = 0
|
||||
local n = 0
|
||||
@ -63,8 +63,8 @@ static box MirCallBox {
|
||||
|
||||
// Constructor(class, args:int[])
|
||||
emit_newbox_v1(class_name, args) {
|
||||
class_name = match class_name { null => "", _ => class_name }
|
||||
args = match args { null => [], _ => args }
|
||||
if class_name == null { class_name = "" }
|
||||
if args == null { args = [] }
|
||||
local s = "" + args
|
||||
local pos = 0
|
||||
local n = 0
|
||||
|
||||
Reference in New Issue
Block a user