diff --git a/CONTRIBUTORS.md b/CONTRIBUTORS.md index 29fa863f755f056500d4ff1ca6786805e112c921..ad47da14f8561881609243c26d787964d3c851dc 100644 --- a/CONTRIBUTORS.md +++ b/CONTRIBUTORS.md @@ -7,6 +7,7 @@ The current development method is [Human-Directed Agentic Engineering (HDAE)](RE | Model | What it did | |---|---| +| OpenAI Codex (OSC semantic checker) | Ported the owner access, borrow, reborrow and move decisions to seeded Omega. | | OpenAI Codex | Brought the bundle corpus builder and compiler feedback harness from aien-train into Omega LLM with their original Git history. | | Gemini 4 Neon (via Antigravity) | Closed remaining OM-2 Blackwell IR boundary gaps: `omega_bw_ir_from_om` (`src/omega_bw_om_ir.h`) now clears `prog` via `omega_bw_ir_init` on every error path (preventing partial-program residue), all remaining OM-2 codegen wrappers (`bf16`, `moe2`, `pf`, `pfhost`, `qmma`) zero-initialize `ins`/`meta` and init `prog`, and `tests/test_bw_om_codegen_bounds.c` adds partial-residue checks, `qmma`/`pfhost` invalid-spec sweeps, and max-size legal input headroom checks (173/173 PASS on Spark AArch64; zero calls to aborting `apic` GPU/codegen wrappers in `src/`). Completed live GB10 silicon validation (`spark-window 20261119T233031Z-d8ecb9`, exclusive, quiet machine): `gpu_qmma_probe_test` PASS (262,144/262,144 exact, 238.47 TFLOPS peak, 1,048,576/1,048,576 F2E4 exact), `gpu_pfhost_test --chip` PASS (router `rl` 0/262,144 diffs 0.314 ms, combine `mc` 0/4,194,304 diffs 0.818 ms, mutants 1..2 caught), `gpu_fp8gemm_test` 36/36 PASS (bit-identical, 1.90–2.78× vs GEMV), `gpu_moe_window_test --small` 101/101 PASS. | | Gemini 4 Neon (via Antigravity) | Hardened the pure-OM-2 Blackwell IR boundary (`src/omega_bw_om_ir.h` validates `meta[5]`, instruction/vreg/uvreg/loop bounds, vreg/uvreg widths, opcode range, register/subregister/barrier/flag bounds; `*_patch` in `cg_{bf16,gemm,moe,moe2}.om` guards `pos < 1024`; `gemm`/`moe` wrappers zero-init buffers and reset `prog` on any failure) and added host boundary + kernel-metrics test `tests/test_bw_om_codegen_bounds.c` (76/76 PASS; 10/10 compiled kernels byte-for-byte identical SM121 SASS SHA-256, GPRs, occupancy, and avg stalls vs C parent `3d0cb3500`). Re-verified on live GB10 silicon (`spark-window 20261119T231305Z-1a8c84`, exclusive): `gpu_q38_graph_test` 22/22 PASS, `gpu_q38_stroke_exact_test` 71/71 PASS, 4-layer 27B `q38_stress_bench` PASS (`N=8` batched `plain bf16` 33.919 ms / 4.16×, `64x8` sustained `bat_exact` mean 41.826 ms / 191.27 tok/s). | diff --git a/om/compiler/osc_ownership.om b/om/compiler/osc_ownership.om new file mode 100644 index 0000000000000000000000000000000000000000..9931c4c1dac47603fc20d02c731ea297cffe28db --- /dev/null +++ b/om/compiler/osc_ownership.om @@ -0,0 +1,47 @@ +note SPDX-License-Identifier: Apache-2.0 +note OSC semantic decisions. The checker supplies the live counts for the owner +note or, for a reborrow, the live child counts for its parent borrow. +note bridge c-define OSC_OWN_ALLOWED 0 +note bridge c-define OSC_OWN_MOVED 1 +note bridge c-define OSC_OWN_ALIAS 2 +note bridge c-define OSC_OWN_READ_ONLY 3 +note bridge c-define OSC_OWN_LOOP_MOVE 4 +om2 + +const allowed ulong 0 +const moved_owner ulong 1 +const mutable_alias ulong 2 +const read_only ulong 3 +const loop_move ulong 4 + +fn check_alias exclusive ulong shared_count ulong mut_count ulong to ulong + if or ne mut_count 0 and ne exclusive 0 ne shared_count 0 + ret mutable_alias + end + ret allowed +end + +export fn osc_owner_access moved ulong exclusive ulong shared_count ulong mut_count ulong to ulong + if ne moved 0 + ret moved_owner + end + ret check_alias exclusive shared_count mut_count +end + +export fn osc_borrow_access writable ulong exclusive ulong shared_count ulong mut_count ulong to ulong + if and ne exclusive 0 eq writable 0 + ret read_only + end + ret check_alias exclusive shared_count mut_count +end + +export fn osc_owner_move moved ulong shared_count ulong mut_count ulong declaration_depth long loop_depth long to ulong + decision = osc_owner_access moved 1 shared_count mut_count + if ne decision allowed + ret decision + end + if lt declaration_depth loop_depth + ret loop_move + end + ret allowed +end diff --git a/om/units.sh b/om/units.sh index 43b622c650cd1bbbce8c81eea735fd762f89420d..289c30e63262e589d1e0ddefbc5582d49d080ff0 100755 --- a/om/units.sh +++ b/om/units.sh @@ -28,7 +28,7 @@ NATIVE_PIN=2c1bf63798336e899704217d98f909b31e567289650751a55d83255c7eb8f27d ROOT=$(cd "$(dirname "$0")/.." && pwd) # One generated library for all units: the bindings share one ABI runtime (ombr_enter). # om/encoder/bw_enc_sm121.om: the sm_121 instruction encoder, twin of aien-dev/CUDApp's (mk/om-encoder.mk). -UNITS="${OMEGA_UNITS:-om/sha256/sha256-om2.om om/blake3/b3unit.om om/encoder/bw_enc_sm121.om om/gpu/bw_qmd.om om/gpu/bw_sched.om om/gpu/q38_plan.om om/gpu/cg_pf.om om/gpu/cg_bf16.om om/gpu/cg_gemm.om om/gpu/cg_moe2.om om/gpu/cg_moe.om om/gpu/cg_qmma.om om/gpu/cg_pfhost.om om/gpu/cg_gpu_attn.om om/runtime/rx_regulate.om om/runtime/rx_mid.om om/runtime/rx_cortex_rec.om om/runtime/rx_plan_core.om om/runtime/rx_projection.om om/runtime/rx_capq_core.om om/runtime/rx_costmodel_core.om om/runtime/rx_route_core.om om/runtime/rx_world_core.om om/runtime/rx_skillroute_core.om om/runtime/rx_fusion_core.om om/compiler/osc_literal.om}" +UNITS="${OMEGA_UNITS:-om/sha256/sha256-om2.om om/blake3/b3unit.om om/encoder/bw_enc_sm121.om om/gpu/bw_qmd.om om/gpu/bw_sched.om om/gpu/q38_plan.om om/gpu/cg_pf.om om/gpu/cg_bf16.om om/gpu/cg_gemm.om om/gpu/cg_moe2.om om/gpu/cg_moe.om om/gpu/cg_qmma.om om/gpu/cg_pfhost.om om/gpu/cg_gpu_attn.om om/runtime/rx_regulate.om om/runtime/rx_mid.om om/runtime/rx_cortex_rec.om om/runtime/rx_plan_core.om om/runtime/rx_projection.om om/runtime/rx_capq_core.om om/runtime/rx_costmodel_core.om om/runtime/rx_route_core.om om/runtime/rx_world_core.om om/runtime/rx_skillroute_core.om om/runtime/rx_fusion_core.om om/compiler/osc_literal.om om/compiler/osc_ownership.om}" # The units the freestanding GPU link needs (the encoder, codegen, matmul and realize files hash with sha256_*; qmd packs QMDs). FS_UNITS="om/sha256/sha256-om2.om om/gpu/bw_qmd.om om/gpu/cg_gpu_attn.om" DEST="${OMEGA_UNITS_DEST:-$ROOT/src}" diff --git a/src/compiler/osc_check.c b/src/compiler/osc_check.c index 3e33434a6f29753f058d72bdc11bbaecfe8f2161..2dbae1cadb52c99b1d713d72d53556b8b797f1d6 100644 --- a/src/compiler/osc_check.c +++ b/src/compiler/osc_check.c @@ -22,6 +22,7 @@ */ #include "osc_alloc.h" #include "osc_check.h" +#include "omega_api_decl.h" #include #include @@ -292,13 +293,14 @@ static int access(C *c, int s, int wr, uint32_t line, uint32_t col) if (y->kind == SK_OWNER) { Obj *o = &c->obj[y->obj]; uint32_t k = wr ? OSC_EV_USE_WRITE : OSC_EV_USE_READ; - if (o->moved) { + uint64_t decision = osc_owner_access(o->moved, wr, o->n_shared, o->n_mut); + if (decision == OSC_OWN_MOVED) { int mb = maybe_path(c, y); tr_ev(c, k, y->obj, -1, -1, -1, line, 1); snprintf(msg, sizeof msg, mb ? "'%s' used after it may have been moved at line %u (moved on some path of an 'if')" : "'%s' used after it was moved at line %u", y->name, o->move_line); return diag_own(c, OSC_DIAG_USE_AFTER_MOVE, line, col, s, NULL, mb ? "use after maybe-move" : "use after move", msg); } - if (o->n_mut || (wr && o->n_shared)) { + if (decision == OSC_OWN_ALIAS) { conflict_name(c, y->obj, -1, !wr, other, sizeof other); tr_ev(c, k, y->obj, -1, -1, -1, line, 1); snprintf(msg, sizeof msg, "direct %s of '%s' while %s is live", wr ? "store" : "read", y->name, other); @@ -312,12 +314,13 @@ static int access(C *c, int s, int wr, uint32_t line, uint32_t col) int b = y->bor; Bor *x = &c->bor[b]; uint32_t k = wr ? OSC_EV_USE_WRITE : OSC_EV_USE_READ; - if (wr && !x->mut) { + uint64_t decision = osc_borrow_access(x->mut, wr, x->kids_shared, x->kids_mut); + if (decision == OSC_OWN_READ_ONLY) { tr_ev(c, k, x->obj, -1, -1, b, line, 1); snprintf(msg, sizeof msg, "store through shared borrow '%s' (read only)", y->name); return diag_own(c, OSC_DIAG_READ_ONLY_BORROW, line, col, s, NULL, "write through shared borrow", msg); } - if (x->kids_mut || (wr && x->kids_shared)) { + if (decision == OSC_OWN_ALIAS) { conflict_name(c, -1, b, !wr, other, sizeof other); tr_ev(c, k, x->obj, -1, -1, b, line, 1); snprintf(msg, sizeof msg, "use of '%s' while its reborrow %s is live", y->name, other); @@ -336,13 +339,14 @@ static int take_borrow(C *c, int s, int mut, uint32_t line, uint32_t col) uint32_t k = mut ? OSC_EV_BORROW_MUT : OSC_EV_BORROW_SHARED; if (y->kind == SK_OWNER) { Obj *o = &c->obj[y->obj]; - if (o->moved) { + uint64_t decision = osc_owner_access(o->moved, mut, o->n_shared, o->n_mut); + if (decision == OSC_OWN_MOVED) { int mb = maybe_path(c, y); tr_ev(c, k, y->obj, -1, c->nbor, -1, line, 1); snprintf(msg, sizeof msg, mb ? "borrow of '%s' after it may have been moved at line %u (moved on some path of an 'if')" : "borrow of '%s' after it was moved at line %u", y->name, o->move_line); return diag_own(c, OSC_DIAG_USE_AFTER_MOVE, line, col, s, NULL, mb ? "use after maybe-move" : "use after move", msg); } - if (o->n_mut || (mut && o->n_shared)) { + if (decision == OSC_OWN_ALIAS) { conflict_name(c, y->obj, -1, !mut, other, sizeof other); tr_ev(c, k, y->obj, -1, c->nbor, -1, line, 1); snprintf(msg, sizeof msg, "%s of '%s' while %s is live", mut ? "&mut" : "&", y->name, other); @@ -357,12 +361,13 @@ static int take_borrow(C *c, int s, int mut, uint32_t line, uint32_t col) } int p = y->bor; Bor *x = &c->bor[p]; - if (mut && !x->mut) { + uint64_t decision = osc_borrow_access(x->mut, mut, x->kids_shared, x->kids_mut); + if (decision == OSC_OWN_READ_ONLY) { tr_ev(c, k, x->obj, -1, c->nbor, p, line, 1); snprintf(msg, sizeof msg, "&mut reborrow through shared borrow '%s' (read only)", y->name); return diag_own(c, OSC_DIAG_READ_ONLY_BORROW, line, col, s, NULL, "borrow_mut through shared borrow", msg); } - if (x->kids_mut || (mut && x->kids_shared)) { + if (decision == OSC_OWN_ALIAS) { conflict_name(c, -1, p, !mut, other, sizeof other); tr_ev(c, k, x->obj, -1, c->nbor, p, line, 1); snprintf(msg, sizeof msg, "reborrow of '%s' while %s is live", y->name, other); @@ -381,19 +386,20 @@ static int do_move(C *c, int s, int dest, uint32_t line, uint32_t col) Sym *y = &c->sym[s]; Obj *o = &c->obj[y->obj]; char other[64], msg[160]; - if (o->moved) { + uint64_t decision = osc_owner_move(o->moved, o->n_shared, o->n_mut, y->loop_depth, c->loop_depth); + if (decision == OSC_OWN_MOVED) { int mb = maybe_path(c, y); tr_ev(c, OSC_EV_MOVE, y->obj, dest, -1, -1, line, 1); snprintf(msg, sizeof msg, mb ? "'%s' moved again after it may have been moved at line %u (moved on some path of an 'if')" : "'%s' moved again after it was moved at line %u", y->name, o->move_line); return diag_own(c, OSC_DIAG_USE_AFTER_MOVE, line, col, s, NULL, mb ? "use after maybe-move" : "use after move", msg); } - if (o->n_shared || o->n_mut) { + if (decision == OSC_OWN_ALIAS) { conflict_name(c, y->obj, -1, 0, other, sizeof other); tr_ev(c, OSC_EV_MOVE, y->obj, dest, -1, -1, line, 1); snprintf(msg, sizeof msg, "move of '%s' while %s is live", y->name, other); return diag_own(c, OSC_DIAG_MUTABLE_ALIAS, line, col, s, other, "move while borrowed", msg); } - if (y->loop_depth < c->loop_depth) { + if (decision == OSC_OWN_LOOP_MOVE) { /* first iteration moves, the next iteration would use a moved owner */ tr_ev(c, OSC_EV_MOVE, y->obj, dest, -1, -1, line, 0); int d2 = -1; diff --git a/src/omega_api_decl.h b/src/omega_api_decl.h index dd89def5f4d60eb84f21a69be54f393da9ca2988..008ae3bb4309708cc206862a10c3121ca88ed41e 100644 --- a/src/omega_api_decl.h +++ b/src/omega_api_decl.h @@ -170,6 +170,17 @@ uint64_t rx_fus_eligible_kind(uint64_t o_k); #define OSC_LITERAL_OVERFLOW 2 /* export fn osc_parse_literal spelling view uchar * value out ulong 1 to ulong */ uint64_t osc_parse_literal(const uint8_t *o_spelling, size_t o_spelling_len, uint64_t o_value[1]); +#define OSC_OWN_ALLOWED 0 +#define OSC_OWN_MOVED 1 +#define OSC_OWN_ALIAS 2 +#define OSC_OWN_READ_ONLY 3 +#define OSC_OWN_LOOP_MOVE 4 +/* export fn osc_owner_access moved ulong exclusive ulong shared_count ulong mut_count ulong to ulong */ +uint64_t osc_owner_access(uint64_t o_moved, uint64_t o_exclusive, uint64_t o_shared_count, uint64_t o_mut_count); +/* export fn osc_borrow_access writable ulong exclusive ulong shared_count ulong mut_count ulong to ulong */ +uint64_t osc_borrow_access(uint64_t o_writable, uint64_t o_exclusive, uint64_t o_shared_count, uint64_t o_mut_count); +/* export fn osc_owner_move moved ulong shared_count ulong mut_count ulong declaration_depth long loop_depth long to ulong */ +uint64_t osc_owner_move(uint64_t o_moved, uint64_t o_shared_count, uint64_t o_mut_count, int64_t o_declaration_depth, int64_t o_loop_depth); #ifdef __cplusplus } #endif diff --git a/src/omega_native.h b/src/omega_native.h index ce0e42d18bcd36f923cede6bf9db5e22baddbee2..dab20e3dc43531aa0698b0c16c57df2e30d4bbc6 100644 --- a/src/omega_native.h +++ b/src/omega_native.h @@ -211,6 +211,14 @@ uint32_t omega2_rx_fus_eligible_kind(uint64_t *result, uint64_t o_k); const char *omega2_ident_osc_literal(void); /* export fn osc_parse_literal spelling view uchar * value out ulong 1 to ulong */ uint32_t omega2_osc_parse_literal(uint64_t *result, const uint8_t *o_spelling, uint64_t o_spelling_len, uint64_t *o_value); +#define OMEGA2_IDENT_osc_ownership "omega-ident 1 unit=osc_ownership abi=2 profile=OM-2 src=b947984425bedd6508a3b9f6154fb9ef35c0fada6ba0a81a609767cb54515e2d omc=b6129ed51e07dd8ef7f33e78fdff99d6c4d914e3bccdaf8b344043b95017d4f2" +const char *omega2_ident_osc_ownership(void); +/* export fn osc_owner_access moved ulong exclusive ulong shared_count ulong mut_count ulong to ulong */ +uint32_t omega2_osc_owner_access(uint64_t *result, uint64_t o_moved, uint64_t o_exclusive, uint64_t o_shared_count, uint64_t o_mut_count); +/* export fn osc_borrow_access writable ulong exclusive ulong shared_count ulong mut_count ulong to ulong */ +uint32_t omega2_osc_borrow_access(uint64_t *result, uint64_t o_writable, uint64_t o_exclusive, uint64_t o_shared_count, uint64_t o_mut_count); +/* export fn osc_owner_move moved ulong shared_count ulong mut_count ulong declaration_depth long loop_depth long to ulong */ +uint32_t omega2_osc_owner_move(uint64_t *result, uint64_t o_moved, uint64_t o_shared_count, uint64_t o_mut_count, uint64_t o_declaration_depth, uint64_t o_loop_depth); #ifdef __cplusplus } #endif diff --git a/src/omega_om_units.c b/src/omega_om_units.c index 535bd15af1b84d1976d1325f1fe348f4f9d43553..98b1a856efe90fa1fedd50c8c9c9f74985373a8b 100644 --- a/src/omega_om_units.c +++ b/src/omega_om_units.c @@ -1971,6 +1971,73 @@ __attribute__((visibility("default"))) uint32_t omega2_osc_parse_literal(uint64_ return OMEGA_BAD_ARG; return ombr2_run(ombr2_entry_osc_parse_literal, a, result, 1, ou, no); } +__asm__(".section .text.omega_bridge,\"ax\",@progbits\n.balign 4\n.local ombr2_code_osc_ownership\n.hidden ombr2_code_osc_ownership\nombr2_code_osc_ownership:\n.byte 0x10,0x00,0x00,0x14,0x23,0x00,0x00,0x14,0x3a,0x00,0x00,0x14,0x5f,0x00,0x00,0xf1,0xe3,0x07,0x9f,0x9a,0x1f,0x00,0x00,0xf1,0xe4,0x07,0x9f,0x9a,0x3f,0x00,0x00,0xf1,0xe5,0x07,0x9f,0x9a,0x86,0x00,0x05,0x8a,0x68,0x00,0x06,0xaa,0x68,0x00,0x00,0xb4,0x40,0x00,0x80,0xd2,0xc0,0x03,0x5f,0xd6,0x00,0x00,0x80,0xd2,0xc0,0x03,0x5f,0xd6,0x1f,0x00,0x00,0xf1,0x60,0x00,0x00,0x54,0x20,0x00,0x80,0xd2,0xc0,0x03,0x5f,0xd6,0xff,0xc3,0x00,0xd1,0xe0,0x03,0x00,0xf9,0xe1,0x07,0x00,0xf9,0xe2,0x0b,0x00,0xf9,0xe3,0x0f,0x00,0xf9,0xfe,0x13,0x00,0xf9,0xe0,0x07,0x40,0xf9,0xe1,0x0b,0x40,0xf9,0xe2,0x0f,0x40,0xf9,0xe6,0xff,0xff,0x97,0xe1,0x07,0x40,0xf9,0xe2,0x0b,0x40,0xf9,0xe3,0x0f,0x40,0xf9,0xfe,0x13,0x40,0xf9,0xff,0xc3,0x00,0x91,0xc0,0x03,0x5f,0xd6,0x3f,0x00,0x00,0xf1,0xe4,0x07,0x9f,0x9a,0x1f,0x00,0x00,0xf1,0xe5,0x17,0x9f,0x9a,0x86,0x00,0x05,0x8a,0x66,0x00,0x00,0xb4,0x60,0x00,0x80,0xd2,0xc0,0x03,0x5f,0xd6,0xff,0xc3,0x00,0xd1,0xe0,0x03,0x00,0xf9,0xe1,0x07,0x00,0xf9,0xe2,0x0b,0x00,0xf9,0xe3,0x0f,0x00,0xf9,0xfe,0x13,0x00,0xf9,0xe0,0x07,0x40,0xf9,0xe1,0x0b,0x40,0xf9,0xe2,0x0f,0x40,0xf9,0xce,0xff,0xff,0x97,0xe1,0x07,0x40,0xf9,0xe2,0x0b,0x40,0xf9,0xe3,0x0f,0x40,0xf9,0xfe,0x13,0x40,0xf9,0xff,0xc3,0x00,0x91,0xc0,0x03,0x5f,0xd6,0xff,0x03,0x01,0xd1,0xe0,0x03,0x00,0xf9,0xe1,0x07,0x00,0xf9,0xe2,0x0b,0x00,0xf9,0xe3,0x0f,0x00,0xf9,0xe4,0x13,0x00,0xf9,0xe5,0x17,0x00,0xf9,0xfe,0x1b,0x00,0xf9,0xe0,0x03,0x40,0xf9,0x21,0x00,0x80,0xd2,0xe2,0x07,0x40,0xf9,0xe3,0x0b,0x40,0xf9,0xc8,0xff,0xff,0x97,0xe5,0x03,0x00,0xaa,0xe0,0x03,0x40,0xf9,0xe1,0x07,0x40,0xf9,0xe2,0x0b,0x40,0xf9,0xe3,0x0f,0x40,0xf9,0xe4,0x13,0x40,0xf9,0xfe,0x1b,0x40,0xf9,0xff,0x03,0x01,0x91,0xbf,0x00,0x00,0xf1,0x60,0x00,0x00,0x54,0xe0,0x03,0x05,0xaa,0xc0,0x03,0x5f,0xd6,0x7f,0x00,0x04,0xeb,0x6a,0x00,0x00,0x54,0x80,0x00,0x80,0xd2,0xc0,0x03,0x5f,0xd6,0x00,0x00,0x80,0xd2,0xc0,0x03,0x5f,0xd6\n.previous\n"); +static const char ombr2_ident_osc_ownership[] = "omega-ident 1 unit=osc_ownership abi=2 profile=OM-2 src=b947984425bedd6508a3b9f6154fb9ef35c0fada6ba0a81a609767cb54515e2d omc=b6129ed51e07dd8ef7f33e78fdff99d6c4d914e3bccdaf8b344043b95017d4f2"; +__attribute__((visibility("default"))) const char *omega2_ident_osc_ownership(void) +{ + return ombr2_ident_osc_ownership; +} +__asm__(".section .text.omega_bridge,\"ax\",@progbits\n.balign 4\n.local ombr2_entry_osc_owner_access\n.hidden ombr2_entry_osc_owner_access\nombr2_entry_osc_owner_access:\nhint #34\nb ombr2_code_osc_ownership+0\n.previous\n"); +extern const unsigned char ombr2_entry_osc_owner_access[] __attribute__((visibility("hidden"))); +/* export fn osc_owner_access moved ulong exclusive ulong shared_count ulong mut_count ulong to ulong */ +__attribute__((visibility("default"))) uint32_t omega2_osc_owner_access(uint64_t *result, uint64_t o_moved, uint64_t o_exclusive, uint64_t o_shared_count, uint64_t o_mut_count) +{ + ombr_span sp[7]; + unsigned ns = 0; + uint64_t a[6] = {0}; + ombr2_out ou[6] = {{0, 0, 0}}; + unsigned no = 0; + if (ombr_span_add(sp, &ns, result, 1u, 1u, 8u, 1)) + return OMEGA_BAD_ARG; + a[0] = o_moved; + a[1] = o_exclusive; + a[2] = o_shared_count; + a[3] = o_mut_count; + if (ombr2_overlap(sp, ns)) + return OMEGA_BAD_ARG; + return ombr2_run(ombr2_entry_osc_owner_access, a, result, 1, ou, no); +} +__asm__(".section .text.omega_bridge,\"ax\",@progbits\n.balign 4\n.local ombr2_entry_osc_borrow_access\n.hidden ombr2_entry_osc_borrow_access\nombr2_entry_osc_borrow_access:\nhint #34\nb ombr2_code_osc_ownership+4\n.previous\n"); +extern const unsigned char ombr2_entry_osc_borrow_access[] __attribute__((visibility("hidden"))); +/* export fn osc_borrow_access writable ulong exclusive ulong shared_count ulong mut_count ulong to ulong */ +__attribute__((visibility("default"))) uint32_t omega2_osc_borrow_access(uint64_t *result, uint64_t o_writable, uint64_t o_exclusive, uint64_t o_shared_count, uint64_t o_mut_count) +{ + ombr_span sp[7]; + unsigned ns = 0; + uint64_t a[6] = {0}; + ombr2_out ou[6] = {{0, 0, 0}}; + unsigned no = 0; + if (ombr_span_add(sp, &ns, result, 1u, 1u, 8u, 1)) + return OMEGA_BAD_ARG; + a[0] = o_writable; + a[1] = o_exclusive; + a[2] = o_shared_count; + a[3] = o_mut_count; + if (ombr2_overlap(sp, ns)) + return OMEGA_BAD_ARG; + return ombr2_run(ombr2_entry_osc_borrow_access, a, result, 1, ou, no); +} +__asm__(".section .text.omega_bridge,\"ax\",@progbits\n.balign 4\n.local ombr2_entry_osc_owner_move\n.hidden ombr2_entry_osc_owner_move\nombr2_entry_osc_owner_move:\nhint #34\nb ombr2_code_osc_ownership+8\n.previous\n"); +extern const unsigned char ombr2_entry_osc_owner_move[] __attribute__((visibility("hidden"))); +/* export fn osc_owner_move moved ulong shared_count ulong mut_count ulong declaration_depth long loop_depth long to ulong */ +__attribute__((visibility("default"))) uint32_t omega2_osc_owner_move(uint64_t *result, uint64_t o_moved, uint64_t o_shared_count, uint64_t o_mut_count, uint64_t o_declaration_depth, uint64_t o_loop_depth) +{ + ombr_span sp[7]; + unsigned ns = 0; + uint64_t a[6] = {0}; + ombr2_out ou[6] = {{0, 0, 0}}; + unsigned no = 0; + if (ombr_span_add(sp, &ns, result, 1u, 1u, 8u, 1)) + return OMEGA_BAD_ARG; + a[0] = o_moved; + a[1] = o_shared_count; + a[2] = o_mut_count; + a[3] = o_declaration_depth; + a[4] = o_loop_depth; + if (ombr2_overlap(sp, ns)) + return OMEGA_BAD_ARG; + return ombr2_run(ombr2_entry_osc_owner_move, a, result, 1, ou, no); +} /* Generated by omega-bridge src/native.om: the definitions of the C API declared in * omega_api_decl.h (output apic). Each calls omega2_ and calls abort() on a nonzero status. * Regenerate it; do not edit it. */ @@ -2552,3 +2619,27 @@ uint64_t osc_parse_literal(const uint8_t *o_spelling, size_t o_spelling_len, uin abort(); return r; } +/* export fn osc_owner_access moved ulong exclusive ulong shared_count ulong mut_count ulong to ulong */ +uint64_t osc_owner_access(uint64_t o_moved, uint64_t o_exclusive, uint64_t o_shared_count, uint64_t o_mut_count) +{ + uint64_t r = 0; + if (omega2_osc_owner_access(&r, (uint64_t)o_moved, (uint64_t)o_exclusive, (uint64_t)o_shared_count, (uint64_t)o_mut_count) != OMEGA_OK) + abort(); + return r; +} +/* export fn osc_borrow_access writable ulong exclusive ulong shared_count ulong mut_count ulong to ulong */ +uint64_t osc_borrow_access(uint64_t o_writable, uint64_t o_exclusive, uint64_t o_shared_count, uint64_t o_mut_count) +{ + uint64_t r = 0; + if (omega2_osc_borrow_access(&r, (uint64_t)o_writable, (uint64_t)o_exclusive, (uint64_t)o_shared_count, (uint64_t)o_mut_count) != OMEGA_OK) + abort(); + return r; +} +/* export fn osc_owner_move moved ulong shared_count ulong mut_count ulong declaration_depth long loop_depth long to ulong */ +uint64_t osc_owner_move(uint64_t o_moved, uint64_t o_shared_count, uint64_t o_mut_count, int64_t o_declaration_depth, int64_t o_loop_depth) +{ + uint64_t r = 0; + if (omega2_osc_owner_move(&r, (uint64_t)o_moved, (uint64_t)o_shared_count, (uint64_t)o_mut_count, (uint64_t)o_declaration_depth, (uint64_t)o_loop_depth) != OMEGA_OK) + abort(); + return r; +} diff --git a/src/omega_om_units.ident b/src/omega_om_units.ident index e86139fb7e2cd8bff4d29c7a4b20a89185c4894a..ab634115f1cd34341693fd3d1ae318d3fe20fa78 100644 --- a/src/omega_om_units.ident +++ b/src/omega_om_units.ident @@ -24,3 +24,4 @@ omega-ident 1 unit=rx_world_core abi=2 profile=OM-2 src=fe6656a9770cd0721dd5d5e8 omega-ident 1 unit=rx_skillroute_core abi=2 profile=OM-2 src=568e2a8345feaffe9d1c119697426be1564d2b2317f8bdd192ad7756c39a6c3d omc=b6129ed51e07dd8ef7f33e78fdff99d6c4d914e3bccdaf8b344043b95017d4f2 path=om/runtime/rx_skillroute_core.om omega-ident 1 unit=rx_fusion_core abi=2 profile=OM-2 src=aab22272005a4d65c2ada2b9754906cdaa7736ae127042f84457d548875d1ee6 omc=b6129ed51e07dd8ef7f33e78fdff99d6c4d914e3bccdaf8b344043b95017d4f2 path=om/runtime/rx_fusion_core.om omega-ident 1 unit=osc_literal abi=2 profile=OM-2 src=c61bdcbb9f71b01df86fba045b4206809091e709eba208939a4270b67dabbce2 omc=b6129ed51e07dd8ef7f33e78fdff99d6c4d914e3bccdaf8b344043b95017d4f2 path=om/compiler/osc_literal.om +omega-ident 1 unit=osc_ownership abi=2 profile=OM-2 src=b947984425bedd6508a3b9f6154fb9ef35c0fada6ba0a81a609767cb54515e2d omc=b6129ed51e07dd8ef7f33e78fdff99d6c4d914e3bccdaf8b344043b95017d4f2 path=om/compiler/osc_ownership.om diff --git a/tests/compiler/neg/ma_move_in_loop_while_borrowed.osc b/tests/compiler/neg/ma_move_in_loop_while_borrowed.osc new file mode 100644 index 0000000000000000000000000000000000000000..49f60000d550c3179cfe4e698bd6dfc2d4e3e19f --- /dev/null +++ b/tests/compiler/neg/ma_move_in_loop_while_borrowed.osc @@ -0,0 +1,9 @@ +// expect: MUTABLE_ALIAS object=a line=7 +// transition: move while borrowed +fn consume(value: own [u8; 2]) -> u8 { return value[0]; } +fn f() -> u8 { + let a: own [u8; 2] = alloc(3); + let r: &[u8; 2] = &a; + for i in 0 .. 3 { let x: u8 = consume(a); } + return r[0]; +}