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/compiler/osc_trace.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 / compiler / osc_trace.om` 88 lines ยท 2509 bytes Raw Blame History 1 note SPDX-License-Identifier: Apache-2.0 2 note OSC ownership trace. Object and borrow arguments are zero-based checker 3 note IDs or -1. Region, slot and handle arguments already use model IDs. 4 note bridge c-type trinput OscTraceInput 5 om2 6 7 layout trinput 48 8 field op uchar at 0 little 9 field refused uchar at 1 little 10 field func ushort at 2 little 11 field line uint at 4 little 12 field kind uint at 8 little 13 field obj int at 12 little 14 field obj2 int at 16 little 15 field borrow int at 20 little 16 field via int at 24 little 17 field region uint at 28 little 18 field slot uint at 32 little 19 field handle uint at 36 little 20 field rights ulong at 40 little 21 end 22 23 const prefix ulong 8 24 const entry_size ulong 88 25 const capacity ulong 16384 26 27 fn store_bytes trace edit uchar * pos ulong count ulong value ulong to void 28 for j ulong count 29 put trace add pos j uchar and shr value mul j 8 255 30 end 31 end 32 33 fn model_id id int to ulong 34 if lt id 0 35 ret 0 36 end 37 ret add ulong id 1 38 end 39 40 fn exceeds_model event view trinput to bool 41 if or ge get event obj 64 ge get event obj2 64 42 ret true 43 end 44 if or ge get event borrow 64 ge get event via 64 45 ret true 46 end 47 if or gt get event region 16 gt get event slot 16 48 ret true 49 end 50 ret gt get event handle 64 51 end 52 53 export fn osc_trace_record trace edit uchar * event view trinput to void 54 requires eq len trace add prefix mul capacity entry_size 55 n = ulong 0 56 for j ulong 4 57 n = or n shl ulong get trace j mul j 8 58 end 59 if ge n capacity 60 put trace 4 1 61 ret 62 end 63 base = add prefix mul n entry_size 64 store_bytes trace 0 4 add n 1 65 put trace base get event op 66 put trace add base 1 get event refused 67 store_bytes trace add base 2 2 ulong get event func 68 store_bytes trace add base 4 4 ulong get event line 69 store_bytes trace add base 8 4 ulong get event kind 70 store_bytes trace add base 12 4 model_id get event obj 71 store_bytes trace add base 16 4 model_id get event obj2 72 store_bytes trace add base 20 4 model_id get event borrow 73 store_bytes trace add base 24 4 model_id get event via 74 store_bytes trace add base 28 4 ulong get event region 75 store_bytes trace add base 32 4 ulong get event slot 76 store_bytes trace add base 36 4 ulong get event handle 77 note This checker emits neither model cell/token fields nor generations. 78 for unused ulong 40 79 put trace add add base 40 unused 0 80 end 81 store_bytes trace add base 80 8 get event rights 82 if exceeds_model event 83 put trace 4 1 84 end 85 if ne get event refused 0 86 put trace 5 1 87 end 88 end