iter embedding-abi-m3.1 (PARTIAL 5/7 + Boss spec-defect repair): single-ctor scalar record crosses the C ABI, ownership follows declared mode
Tasks 1-5 GREEN. T1 baseline pins (re-point annotation + @ailang_rc_alloc heap-box byte-pin: size=8+n*8, tag@0, fields@8/16). T2 export gate widened (is_c_scalar -> two-level is_c_abi_type: single-ctor all-Int/Float record; multi-ctor/Str/List/nested still RED; gate suite 10/10; M1 adt-ret must-fail re-pointed to multi-ctor+Str Reading). T3 codegen forwarder widened (llvm_scalar record Type::Con -> ptr; M2 forwarder body byte-unchanged; 3/3 staticlib pins). T4/T5 E2E record round-trip own+borrow, global leak-freedom. Boss spec-consistency repair (M2.1-precedent class): orchestrator correctly BLOCKED Task 5 on a genuine spec defect -- the single-ctx-readback allocs==frees proof model is unsatisfiable for borrow (and only coincidentally passes for own) because M2's TLS-ctx is bound only during the synchronous forwarder call, so host-side decs land on g_rc_*, not ctx. Boss-verified globally leak-free + value-correct both modes. Spec + plan + harness amended to the stronger global model (sum all ailang_rc_stats: lines; the M2-TLS cross-attribution documented as correct behaviour). No fresh grounding-check (removes an over-strong measurement assumption). Tasks 6 (DESIGN.md frozen-layout SSOT + lockstep pointers + freeze wording + enforceability demo) and 7 (workspace-green gate) re-dispatched on the amended plan. Bench/architect milestone-close is audit-owned. iter embedding-abi-m3.1 (PARTIAL); INDEX.md line deferred to the DONE commit
This commit is contained in:
@@ -0,0 +1,16 @@
|
||||
(module embed_backtest_step_record
|
||||
|
||||
(data State
|
||||
(ctor State (con Float) (con Int)))
|
||||
|
||||
(fn step
|
||||
(export "backtest_step")
|
||||
(type
|
||||
(fn-type
|
||||
(params (own (con State)) (con Float))
|
||||
(ret (con State))))
|
||||
(params st sample)
|
||||
(body
|
||||
(match st
|
||||
(case (pat-ctor State acc n)
|
||||
(term-ctor State State (app + acc sample) (app + n 1)))))))
|
||||
@@ -0,0 +1,16 @@
|
||||
(module embed_backtest_step_record_borrow
|
||||
|
||||
(data State
|
||||
(ctor State (con Float) (con Int)))
|
||||
|
||||
(fn step
|
||||
(export "backtest_step")
|
||||
(type
|
||||
(fn-type
|
||||
(params (borrow (con State)) (con Float))
|
||||
(ret (con State))))
|
||||
(params st sample)
|
||||
(body
|
||||
(match st
|
||||
(case (pat-ctor State acc n)
|
||||
(term-ctor State State (app + acc sample) (app + n 1)))))))
|
||||
@@ -1,11 +1,12 @@
|
||||
(module embed_export_adt_ret_rejected
|
||||
(data Pair
|
||||
(ctor Pair (con Int) (con Int)))
|
||||
(data Reading
|
||||
(ctor Missing)
|
||||
(ctor Sample (con Int) (con Str)))
|
||||
(fn f
|
||||
(export "f")
|
||||
(type
|
||||
(fn-type
|
||||
(params (con Int))
|
||||
(ret (con Pair))))
|
||||
(ret (con Reading))))
|
||||
(params n)
|
||||
(body (app Pair n n))))
|
||||
(body (term-ctor Reading Sample n "tick"))))
|
||||
|
||||
@@ -0,0 +1,11 @@
|
||||
(module embed_export_list_field_record_rejected
|
||||
(data List
|
||||
(ctor Nil)
|
||||
(ctor Cons (con Int) (con List)))
|
||||
(data Boxed
|
||||
(ctor Boxed (con Int) (con List)))
|
||||
(fn f
|
||||
(export "f")
|
||||
(type (fn-type (params (con Int)) (ret (con Boxed))))
|
||||
(params n)
|
||||
(body (term-ctor Boxed Boxed n (term-ctor List Nil)))))
|
||||
@@ -0,0 +1,9 @@
|
||||
(module embed_export_multictor_rejected
|
||||
(data Either2
|
||||
(ctor L (con Int))
|
||||
(ctor R (con Float)))
|
||||
(fn f
|
||||
(export "f")
|
||||
(type (fn-type (params (con Int)) (ret (con Either2))))
|
||||
(params n)
|
||||
(body (term-ctor Either2 L n))))
|
||||
@@ -0,0 +1,14 @@
|
||||
(module embed_export_record_ok
|
||||
(data State
|
||||
(ctor State (con Float) (con Int)))
|
||||
(fn step
|
||||
(export "step")
|
||||
(type
|
||||
(fn-type
|
||||
(params (own (con State)) (con Float))
|
||||
(ret (con State))))
|
||||
(params st sample)
|
||||
(body
|
||||
(match st
|
||||
(case (pat-ctor State acc n)
|
||||
(term-ctor State State (app + acc sample) (app + n 1)))))))
|
||||
@@ -0,0 +1,8 @@
|
||||
(module embed_export_str_field_record_rejected
|
||||
(data Tagged
|
||||
(ctor Tagged (con Int) (con Str)))
|
||||
(fn f
|
||||
(export "f")
|
||||
(type (fn-type (params (con Int)) (ret (con Tagged))))
|
||||
(params n)
|
||||
(body (term-ctor Tagged Tagged n "x"))))
|
||||
@@ -0,0 +1,30 @@
|
||||
(module embed_record_layout_carrier
|
||||
|
||||
(data Pt
|
||||
(ctor Pt (con Int) (con Int)))
|
||||
|
||||
(fn mk
|
||||
(type
|
||||
(fn-type
|
||||
(params (con Int) (con Int))
|
||||
(ret (con Pt))))
|
||||
(params a b)
|
||||
(body (term-ctor Pt Pt a b)))
|
||||
|
||||
(fn sum_pt
|
||||
(type
|
||||
(fn-type
|
||||
(params (own (con Pt)))
|
||||
(ret (con Int))))
|
||||
(params p)
|
||||
(body
|
||||
(match p
|
||||
(case (pat-ctor Pt x y)
|
||||
(app + x y)))))
|
||||
|
||||
(fn main
|
||||
(type (fn-type (params) (ret (con Unit)) (effects IO)))
|
||||
(params)
|
||||
(body
|
||||
(let s (app int_to_str (app sum_pt (app mk 3 4)))
|
||||
(do io/print_str s)))))
|
||||
Reference in New Issue
Block a user