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/seed/omc/tests/pools/g9.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 / seed / omc / tests / pools / g9.om` 87 lines ยท 1380 bytes Raw Blame History 1 note gate-pools 9: a 2 GiB pool with one page touched adds about one page of VmRSS. Prints the length, 2 note then VmRSS (kB) before the grow, after touching one page, and after touching 1024 more (the control). 3 global P uchar * 4 global sb uchar 4096 5 global ob uchar 24 6 text pth "/proc/self/status" 7 fn pnum v ulong to void 8 put ob 23 10 9 i = ulong 23 10 x = v 11 go = true 12 while go bound 21 13 i = sub i 1 14 put ob i uchar add rem x 10 48 15 x = div x 10 16 go = ne x 0 17 end 18 k = write 1 ob i sub 24 i 19 end 20 fn plong v long to void 21 if lt v 0 22 put ob 0 uchar 45 23 k = write 1 ob 0 1 24 pnum ulong neg v 25 else 26 pnum ulong v 27 end 28 end 29 fn hit i ulong to bool 30 a = and eq get sb i 86 eq get sb add i 1 109 31 b = and eq get sb add i 2 82 eq get sb add i 5 58 32 ret and a b 33 end 34 fn rss to ulong 35 fd = fopen pth 0 len pth 0 0 36 if lt fd 0 37 ret 0 38 end 39 n = read int fd sb 0 4096 40 fd = fclose int fd 41 if le n 0 42 ret 0 43 end 44 lim = ulong n 45 i = ulong 0 46 while lt add i 6 lim bound 4096 47 if hit i 48 break 49 end 50 i = add i 1 51 end 52 i = add i 6 53 v = ulong 0 54 while lt i lim bound 4096 55 ch = get sb i 56 if and ge ch 48 le ch 57 57 v = add mul v 10 ulong sub ch 48 58 else 59 if and ne ch 32 ne ch 9 60 break 61 end 62 end 63 i = add i 1 64 end 65 ret v 66 end 67 fn main to int 68 a = rss 69 a = rss 70 r = enlarge P ulong `2147483648` 71 if ne r 0 72 ret 3 73 end 74 put P `12345678` 1 75 b = rss 76 i = ulong 0 77 while lt i 1024 78 put P add `1000000000` mul i 4096 1 79 i = add i 1 80 end 81 c = rss 82 pnum len P 83 pnum a 84 pnum b 85 pnum c 86 ret 0 87 end