Interplane page as plain text, for reading tools and agents. English is the reference text: translate it with your own tool. Text in backticks and in ``` blocks (commands, fingerprints, file names) and link targets in <...> are exact: copy them, never translate them. Page: /drakestapleton/omega-mv/blob/main/om/runtime/rx_cortex_rec.om # omega-mv Omega: a language for verified programs, semantic identity and machine realization. Seed-born work and existing implementations have distinct provenance. Brought by drakestapleton Sign in to star 1 stars 0 watching About Files History Releases Proposed changes Issues For developers branch `main` Branches Tags History `omega-mv / om / runtime / rx_cortex_rec.om` 113 lines ยท 2476 bytes Raw Blame History 1 om2 2 note rx_cortex_rec.om -- World crumb to Cortex record classification, 3 note digest packing, and parent-link deduplication in pure OM-2. 4 note Replaces pure logic in src/runtime/rx_cortex_record.c. 5 6 const CX_ENTITY ulong 1 7 const CX_OBSERVATION ulong 3 8 const CX_EXECUTION ulong 4 9 const CX_FAILURE ulong 5 10 11 const CX_K_WORK_ACCEPTED ulong 65537 12 const CX_K_ENTITY_CREATED ulong 65538 13 const CX_K_ENTITY_RETIRED ulong 65539 14 const CX_K_EXEC_COMMIT ulong 65540 15 const CX_K_EXEC_NOOP ulong 65541 16 const CX_K_EXEC_FAILED ulong 65542 17 18 const CX_PROT_AUTHORITY ulong 1 19 const CX_PROT_COMMIT_RECEIPT ulong 2 20 21 note Map RxCrumbKind to (cls, kind, protect) in dst[0..2]. 22 export fn rx_cx_kind_of ckind ulong dst edit ulong 4 to void 23 put dst 2 0 24 if eq ckind 2 25 put dst 0 CX_OBSERVATION 26 put dst 1 CX_K_WORK_ACCEPTED 27 put dst 2 CX_PROT_AUTHORITY 28 ret 29 end 30 if eq ckind 1 31 put dst 0 CX_ENTITY 32 put dst 1 CX_K_ENTITY_CREATED 33 ret 34 end 35 if eq ckind 9 36 put dst 0 CX_ENTITY 37 put dst 1 CX_K_ENTITY_RETIRED 38 ret 39 end 40 if eq ckind 3 41 put dst 0 CX_EXECUTION 42 put dst 1 CX_K_EXEC_COMMIT 43 put dst 2 CX_PROT_COMMIT_RECEIPT 44 ret 45 end 46 if eq ckind 8 47 put dst 0 CX_EXECUTION 48 put dst 1 CX_K_EXEC_NOOP 49 ret 50 end 51 if eq ckind 5 52 put dst 0 CX_FAILURE 53 put dst 1 CX_K_EXEC_FAILED 54 put dst 2 CX_PROT_AUTHORITY 55 ret 56 end 57 put dst 0 CX_FAILURE 58 put dst 1 CX_K_EXEC_FAILED 59 end 60 61 note Pack 32-byte digest into 4 little-endian ulong words. 62 export fn rx_cx_pack_digest dig view uchar 32 dst edit ulong 4 to void 63 for i ulong 4 64 v = ulong 0 65 base = mul i 8 66 for b ulong 8 67 bv = ulong get dig add base b 68 v = or v shl bv mul b 8 69 end 70 put dst i v 71 end 72 end 73 74 note Deduplicate wake cause + parent Cortex IDs into dst[0..max_links-1]. 75 note Returns count written (<= 8). 76 export fn rx_cx_dedup_links cause ulong parents view ulong * dst edit ulong 8 max_links ulong to ulong 77 lim = max_links 78 if gt lim 8 79 lim = ulong 8 80 end 81 nl = ulong 0 82 if ne cause 0 83 if lt nl lim 84 put dst nl cause 85 nl = add nl 1 86 end 87 end 88 np = len parents 89 if gt np 1024 90 np = ulong 1024 91 end 92 for i ulong np bound 1024 93 if ge nl lim 94 break 95 end 96 p = get parents i 97 if eq p 0 98 continue 99 end 100 dup = ulong 0 101 for j ulong nl bound 8 102 if eq get dst j p 103 dup = ulong 1 104 break 105 end 106 end 107 if eq dup 0 108 put dst nl p 109 nl = add nl 1 110 end 111 end 112 ret nl 113 end