xbintsc 0.6.23 → 0.6.28

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (249) hide show
  1. package/AGENTS.md +1 -1
  2. package/dist/src/cli/extensions.js +11 -3
  3. package/dist/src/cli/extensions.js.map +1 -1
  4. package/dist/src/cli/help.d.ts +1 -1
  5. package/dist/src/cli/help.js +1 -1
  6. package/dist/src/codegen/generator/state.js +7 -0
  7. package/dist/src/codegen/generator/state.js.map +1 -1
  8. package/dist/src/codegen/generator/tables.js +19 -1
  9. package/dist/src/codegen/generator/tables.js.map +1 -1
  10. package/dist/src/driver/bundler/concatenate.d.ts +23 -0
  11. package/dist/src/driver/bundler/concatenate.js +210 -0
  12. package/dist/src/driver/bundler/concatenate.js.map +1 -0
  13. package/dist/src/driver/bundler/graph.js +9 -5
  14. package/dist/src/driver/bundler/graph.js.map +1 -1
  15. package/dist/src/driver/bundler/merge.d.ts +4 -4
  16. package/dist/src/driver/bundler/merge.js +24 -207
  17. package/dist/src/driver/bundler/merge.js.map +1 -1
  18. package/dist/src/driver/bundler/{namespace-import.d.ts → namespace-object.d.ts} +5 -1
  19. package/dist/src/driver/bundler/{namespace-import.js → namespace-object.js} +6 -2
  20. package/dist/src/driver/bundler/namespace-object.js.map +1 -0
  21. package/dist/src/driver/bundler/{reexport-fixup.d.ts → reexport-resolution.d.ts} +9 -3
  22. package/dist/src/driver/bundler/{reexport-fixup.js → reexport-resolution.js} +16 -6
  23. package/dist/src/driver/bundler/reexport-resolution.js.map +1 -0
  24. package/dist/src/driver/fingerprint.d.ts +2 -2
  25. package/dist/src/driver/fingerprint.js +3 -3
  26. package/dist/src/driver/fingerprint.js.map +1 -1
  27. package/dist/src/driver/link-features.js +1 -1
  28. package/dist/src/driver/link-features.js.map +1 -1
  29. package/dist/src/driver/modules.d.ts +12 -5
  30. package/dist/src/driver/modules.js +12 -5
  31. package/dist/src/driver/modules.js.map +1 -1
  32. package/dist/src/driver/paths.js +8 -4
  33. package/dist/src/driver/paths.js.map +1 -1
  34. package/dist/src/driver/runtime-objects.d.ts +1 -1
  35. package/dist/src/driver/runtime-objects.js +13 -1
  36. package/dist/src/driver/runtime-objects.js.map +1 -1
  37. package/dist/src/driver/version.d.ts +1 -1
  38. package/dist/src/driver/version.js +1 -1
  39. package/dist/src/extensions/catalog.js +5 -1
  40. package/dist/src/extensions/catalog.js.map +1 -1
  41. package/dist/src/extensions/gui/index.js +0 -1
  42. package/dist/src/extensions/gui/index.js.map +1 -1
  43. package/dist/src/extensions/link-feature.d.ts +8 -0
  44. package/dist/src/extensions/node/stream-web/index.d.ts +6 -1
  45. package/dist/src/extensions/node/stream-web/index.js +59 -4
  46. package/dist/src/extensions/node/stream-web/index.js.map +1 -1
  47. package/dist/src/extensions/node/worker_threads/index.d.ts +14 -4
  48. package/dist/src/extensions/node/worker_threads/index.js +24 -11
  49. package/dist/src/extensions/node/worker_threads/index.js.map +1 -1
  50. package/dist/src/extensions/registry.d.ts +9 -1
  51. package/dist/src/extensions/registry.js +4 -1
  52. package/dist/src/extensions/registry.js.map +1 -1
  53. package/dist/src/extensions/wasm-asset.d.ts +16 -0
  54. package/dist/src/extensions/wasm-asset.js +28 -0
  55. package/dist/src/extensions/wasm-asset.js.map +1 -0
  56. package/dist/src/extensions/wasm.d.ts +17 -0
  57. package/dist/src/extensions/wasm.js +68 -0
  58. package/dist/src/extensions/wasm.js.map +1 -0
  59. package/dist/src/extensions/webworker/index.d.ts +24 -0
  60. package/dist/src/extensions/webworker/index.js +54 -0
  61. package/dist/src/extensions/webworker/index.js.map +1 -0
  62. package/dist/src/index.d.ts +1 -0
  63. package/dist/src/index.js +1 -0
  64. package/dist/src/index.js.map +1 -1
  65. package/dist/tests/driver/deferred-reexport.test.js +25 -0
  66. package/dist/tests/driver/deferred-reexport.test.js.map +1 -1
  67. package/dist/tests/driver/link-features.test.js +9 -0
  68. package/dist/tests/driver/link-features.test.js.map +1 -1
  69. package/dist/tests/e2e/async-fs.test.js +44 -0
  70. package/dist/tests/e2e/async-fs.test.js.map +1 -1
  71. package/dist/tests/e2e/harness.d.ts +6 -0
  72. package/dist/tests/e2e/harness.js +13 -1
  73. package/dist/tests/e2e/harness.js.map +1 -1
  74. package/dist/tests/e2e/node-crypto-random.test.d.ts +8 -0
  75. package/dist/tests/e2e/node-crypto-random.test.js +148 -0
  76. package/dist/tests/e2e/node-crypto-random.test.js.map +1 -0
  77. package/dist/tests/e2e/node-modules.test.js +1 -1
  78. package/dist/tests/e2e/node-modules.test.js.map +1 -1
  79. package/dist/tests/e2e/web-streams.test.d.ts +8 -0
  80. package/dist/tests/e2e/web-streams.test.js +274 -0
  81. package/dist/tests/e2e/web-streams.test.js.map +1 -0
  82. package/dist/tests/e2e/web-worker.test.d.ts +7 -0
  83. package/dist/tests/e2e/web-worker.test.js +74 -0
  84. package/dist/tests/e2e/web-worker.test.js.map +1 -0
  85. package/dist/tests/e2e/webassembly.test.d.ts +8 -0
  86. package/dist/tests/e2e/webassembly.test.js +113 -0
  87. package/dist/tests/e2e/webassembly.test.js.map +1 -0
  88. package/dist/tests/e2e/worker-api.test.d.ts +14 -0
  89. package/dist/tests/e2e/worker-api.test.js +460 -0
  90. package/dist/tests/e2e/worker-api.test.js.map +1 -0
  91. package/dist/tests/e2e/worker-threads.test.d.ts +8 -0
  92. package/dist/tests/e2e/worker-threads.test.js +160 -0
  93. package/dist/tests/e2e/worker-threads.test.js.map +1 -0
  94. package/dist/tests/extensions/wasm.test.d.ts +1 -0
  95. package/dist/tests/extensions/wasm.test.js +53 -0
  96. package/dist/tests/extensions/wasm.test.js.map +1 -0
  97. package/doc/ai/cli.md +1 -1
  98. package/doc/ai/contributing.md +11 -4
  99. package/doc/ai/extensions.md +25 -2
  100. package/doc/ai/language-support.md +14 -2
  101. package/doc/ai/zh-CN/cli.md +1 -1
  102. package/doc/ai/zh-CN/contributing.md +8 -3
  103. package/doc/ai/zh-CN/extensions.md +23 -2
  104. package/doc/ai/zh-CN/language-support.md +13 -2
  105. package/doc/gui/api.md +1 -1
  106. package/doc/implemented/cli.md +1 -1
  107. package/doc/implemented/extensions.md +6 -5
  108. package/doc/implemented/node/stream-web.md +31 -0
  109. package/doc/implemented/node/worker-threads.md +88 -5
  110. package/doc/implemented/node.md +2 -1
  111. package/doc/implemented/streams.md +82 -0
  112. package/doc/implemented/wasm.md +80 -18
  113. package/doc/implemented/web-worker.md +84 -0
  114. package/doc/implemented.md +6 -2
  115. package/doc/unimplemented/deviations.md +1 -0
  116. package/doc/unimplemented/node/worker-threads.md +23 -0
  117. package/doc/unimplemented/node.md +1 -0
  118. package/doc/unimplemented/stdlib.md +2 -1
  119. package/doc/unimplemented/wasm.md +21 -9
  120. package/doc/unimplemented.md +1 -1
  121. package/doc/zh-CN/gui/api.md +1 -1
  122. package/doc/zh-CN/implemented/cli.md +1 -1
  123. package/doc/zh-CN/implemented/extensions.md +7 -6
  124. package/doc/zh-CN/implemented/node/stream-web.md +24 -0
  125. package/doc/zh-CN/implemented/node/worker-threads.md +77 -4
  126. package/doc/zh-CN/implemented/node.md +2 -1
  127. package/doc/zh-CN/implemented/streams.md +60 -0
  128. package/doc/zh-CN/implemented/wasm.md +73 -16
  129. package/doc/zh-CN/implemented/web-worker.md +79 -0
  130. package/doc/zh-CN/implemented.md +6 -2
  131. package/doc/zh-CN/unimplemented/deviations.md +1 -0
  132. package/doc/zh-CN/unimplemented/node/worker-threads.md +20 -0
  133. package/doc/zh-CN/unimplemented/node.md +1 -0
  134. package/doc/zh-CN/unimplemented/stdlib.md +2 -1
  135. package/doc/zh-CN/unimplemented/wasm.md +16 -8
  136. package/doc/zh-CN/unimplemented.md +1 -1
  137. package/llms.txt +2 -0
  138. package/package.json +8 -7
  139. package/runtime/ext_gui/browser.cpp +1 -1
  140. package/runtime/ext_node/stream_web/stream_web.c +20 -6
  141. package/runtime/worker/worker_api.c +422 -0
  142. package/runtime/worker/worker_codec.c +489 -0
  143. package/runtime/worker/worker_core.c +445 -0
  144. package/runtime/worker/worker_internal.h +223 -0
  145. package/runtime/worker/worker_platform.c +344 -0
  146. package/runtime/worker/worker_ports.c +203 -0
  147. package/runtime/worker/worker_transport.c +464 -0
  148. package/runtime/worker/worker_wire.c +150 -0
  149. package/runtime/xt_builtins.c +15 -0
  150. package/runtime/xt_constructors.c +49 -2
  151. package/runtime/xt_stdlib2/error.inc +4 -0
  152. package/runtime/xt_streams/common.inc +232 -0
  153. package/runtime/xt_streams/constructors.inc +232 -0
  154. package/runtime/xt_streams/encoding.inc +124 -0
  155. package/runtime/xt_streams/readable-extra.inc +372 -0
  156. package/runtime/xt_streams/readable.inc +415 -0
  157. package/runtime/xt_streams/transform.inc +195 -0
  158. package/runtime/xt_streams/writable.inc +542 -0
  159. package/runtime/xt_streams.c +30 -0
  160. package/runtime/xt_wasm/wasm.h +148 -0
  161. package/runtime/xt_wasm/wasm_api.c +357 -0
  162. package/runtime/xt_wasm/wasm_api.h +37 -0
  163. package/runtime/xt_wasm/wasm_bridge.c +30 -0
  164. package/runtime/xt_wasm/wasm_instance.c +591 -0
  165. package/runtime/xt_wasm/wasm_module.c +270 -0
  166. package/runtime/xt_wasm/wasm_values.c +177 -0
  167. package/runtime/xt_webassembly.c +15 -4
  168. package/scripts/fetch-vendored.ts +187 -20
  169. package/scripts/package-release.ts +3 -2
  170. package/src/cli/extensions.ts +11 -3
  171. package/src/cli/help.ts +1 -1
  172. package/src/codegen/generator/state.ts +7 -0
  173. package/src/codegen/generator/tables.ts +19 -1
  174. package/src/driver/bundler/README.md +55 -0
  175. package/src/driver/bundler/concatenate.ts +244 -0
  176. package/src/driver/bundler/graph.ts +9 -5
  177. package/src/driver/bundler/merge.ts +24 -215
  178. package/src/driver/bundler/{namespace-import.ts → namespace-object.ts} +5 -1
  179. package/src/driver/bundler/{reexport-fixup.ts → reexport-resolution.ts} +15 -5
  180. package/src/driver/fingerprint.ts +3 -3
  181. package/src/driver/link-features.ts +1 -1
  182. package/src/driver/modules.ts +12 -5
  183. package/src/driver/paths.ts +8 -4
  184. package/src/driver/runtime-objects.ts +13 -1
  185. package/src/driver/version.ts +1 -1
  186. package/src/extensions/catalog.ts +5 -1
  187. package/src/extensions/gui/index.ts +0 -1
  188. package/src/extensions/link-feature.ts +8 -0
  189. package/src/extensions/node/stream-web/index.ts +59 -4
  190. package/src/extensions/node/worker_threads/index.ts +24 -11
  191. package/src/extensions/registry.ts +13 -2
  192. package/src/extensions/wasm-asset.ts +32 -0
  193. package/src/extensions/wasm.ts +74 -0
  194. package/src/extensions/webworker/index.ts +58 -0
  195. package/src/index.ts +1 -0
  196. package/vendor/wasm3/.pin +1 -0
  197. package/vendor/wasm3/LICENSE +21 -0
  198. package/vendor/wasm3/m3_api_libc.c +265 -0
  199. package/vendor/wasm3/m3_api_libc.h +19 -0
  200. package/vendor/wasm3/m3_api_meta_wasi.c +1107 -0
  201. package/vendor/wasm3/m3_api_tracer.c +173 -0
  202. package/vendor/wasm3/m3_api_tracer.h +19 -0
  203. package/vendor/wasm3/m3_api_uvwasi.c +1290 -0
  204. package/vendor/wasm3/m3_api_wasi.c +1207 -0
  205. package/vendor/wasm3/m3_api_wasi.h +74 -0
  206. package/vendor/wasm3/m3_api_wasi_host.h +137 -0
  207. package/vendor/wasm3/m3_api_wasi_posix.h +979 -0
  208. package/vendor/wasm3/m3_api_wasi_win32.h +1093 -0
  209. package/vendor/wasm3/m3_atomic.h +114 -0
  210. package/vendor/wasm3/m3_bind.c +174 -0
  211. package/vendor/wasm3/m3_bind.h +20 -0
  212. package/vendor/wasm3/m3_code.c +232 -0
  213. package/vendor/wasm3/m3_code.h +74 -0
  214. package/vendor/wasm3/m3_compile.c +6603 -0
  215. package/vendor/wasm3/m3_compile.h +354 -0
  216. package/vendor/wasm3/m3_config.h +448 -0
  217. package/vendor/wasm3/m3_config_platforms.h +345 -0
  218. package/vendor/wasm3/m3_core.c +1034 -0
  219. package/vendor/wasm3/m3_core.h +526 -0
  220. package/vendor/wasm3/m3_deterministic.c +65 -0
  221. package/vendor/wasm3/m3_deterministic.h +59 -0
  222. package/vendor/wasm3/m3_env.c +3146 -0
  223. package/vendor/wasm3/m3_env.h +748 -0
  224. package/vendor/wasm3/m3_exception.h +33 -0
  225. package/vendor/wasm3/m3_exec.c +8 -0
  226. package/vendor/wasm3/m3_exec.h +4110 -0
  227. package/vendor/wasm3/m3_exec_atomic.h +146 -0
  228. package/vendor/wasm3/m3_exec_defs.h +76 -0
  229. package/vendor/wasm3/m3_function.c +278 -0
  230. package/vendor/wasm3/m3_function.h +244 -0
  231. package/vendor/wasm3/m3_host.h +226 -0
  232. package/vendor/wasm3/m3_host_none.h +76 -0
  233. package/vendor/wasm3/m3_host_posix.h +543 -0
  234. package/vendor/wasm3/m3_host_win32.h +253 -0
  235. package/vendor/wasm3/m3_info.c +616 -0
  236. package/vendor/wasm3/m3_info.h +38 -0
  237. package/vendor/wasm3/m3_math_utils.h +560 -0
  238. package/vendor/wasm3/m3_module.c +431 -0
  239. package/vendor/wasm3/m3_parse.c +1549 -0
  240. package/vendor/wasm3/m3_snapshot.c +3825 -0
  241. package/vendor/wasm3/m3_validate.c +1770 -0
  242. package/vendor/wasm3/m3_validate.h +25 -0
  243. package/vendor/wasm3/m3_wasi.h +10 -0
  244. package/vendor/wasm3/m3_xxh64.c +211 -0
  245. package/vendor/wasm3/wasm3.h +684 -0
  246. package/vendor/wasm3/wasm3_defs.h +350 -0
  247. package/dist/src/driver/bundler/namespace-import.js.map +0 -1
  248. package/dist/src/driver/bundler/reexport-fixup.js.map +0 -1
  249. package/runtime/ext_node/worker_threads/worker_threads.c +0 -214
@@ -0,0 +1,526 @@
1
+ //
2
+ // m3_core.h
3
+ //
4
+ // Created by Steven Massey on 4/15/19.
5
+ // Copyright © 2019 Steven Massey. All rights reserved.
6
+ //
7
+
8
+ #ifndef m3_core_h
9
+ #define m3_core_h
10
+
11
+ #include <stdio.h>
12
+ #include <stdlib.h>
13
+ #include <stdbool.h>
14
+ #include <string.h>
15
+ #include <assert.h>
16
+
17
+ #include "wasm3.h"
18
+ #include "m3_config.h"
19
+
20
+ #if defined(__cplusplus)
21
+ # define d_m3BeginExternC extern "C" {
22
+ # define d_m3EndExternC }
23
+ #else
24
+ # define d_m3BeginExternC
25
+ # define d_m3EndExternC
26
+ #endif
27
+
28
+ d_m3BeginExternC
29
+
30
+ #define d_m3ImplementFloat (d_m3HasFloat || d_m3NoFloatDynamic)
31
+
32
+ #if !defined(d_m3ShortTypesDefined)
33
+
34
+ typedef uint64_t u64;
35
+ typedef int64_t i64;
36
+ typedef uint32_t u32;
37
+ typedef int32_t i32;
38
+ typedef uint16_t u16;
39
+ typedef int16_t i16;
40
+ typedef uint8_t u8;
41
+ typedef int8_t i8;
42
+
43
+ # if d_m3ImplementFloat
44
+ typedef double f64;
45
+ typedef float f32;
46
+ # endif
47
+
48
+ #endif // d_m3ShortTypesDefined
49
+
50
+ #define PRIf32 "f"
51
+ #define PRIf64 "lf"
52
+
53
+ typedef const void* m3ret_t;
54
+ typedef const void* voidptr_t;
55
+ typedef const char* cstr_t;
56
+ typedef const char* const ccstr_t;
57
+ typedef const u8* bytes_t;
58
+ typedef const u8* const cbytes_t;
59
+
60
+ typedef u16 m3opcode_t;
61
+ #if d_m3HasTypedRefs
62
+ typedef u16 m3type_t; // a value type, see the d_m3Type_* bits below
63
+ #else
64
+ typedef u8 m3type_t; // only plain M3ValueType values exist
65
+ #endif
66
+
67
+ typedef i64 m3reg_t;
68
+
69
+ #if d_m3Use32BitSlots
70
+ typedef u32 m3slot_t;
71
+ #else
72
+ typedef u64 m3slot_t;
73
+ #endif
74
+
75
+ typedef m3slot_t* m3stack_t;
76
+
77
+ #define c_ioSlotCount ((u16)(sizeof(u64) / sizeof(m3slot_t)))
78
+
79
+ typedef const void* const cvptr_t;
80
+
81
+ #if defined(DEBUG)
82
+
83
+ # define d_m3Log(CATEGORY, FMT, ...) printf (" %8s | " FMT, #CATEGORY, ##__VA_ARGS__);
84
+
85
+ # if d_m3LogParse
86
+ # define m3log_parse(CATEGORY, FMT, ...) d_m3Log(CATEGORY, FMT, ##__VA_ARGS__)
87
+ # else
88
+ # define m3log_parse(...) {}
89
+ # endif
90
+
91
+ # if d_m3LogCompile
92
+ # define m3log_compile(CATEGORY, FMT, ...) d_m3Log(CATEGORY, FMT, ##__VA_ARGS__)
93
+ # else
94
+ # define m3log_compile(...) {}
95
+ # endif
96
+
97
+ # if d_m3LogEmit
98
+ # define m3log_emit(CATEGORY, FMT, ...) d_m3Log(CATEGORY, FMT, ##__VA_ARGS__)
99
+ # else
100
+ # define m3log_emit(...) {}
101
+ # endif
102
+
103
+ # if d_m3LogCodePages
104
+ # define m3log_code(CATEGORY, FMT, ...) d_m3Log(CATEGORY, FMT, ##__VA_ARGS__)
105
+ # else
106
+ # define m3log_code(...) {}
107
+ # endif
108
+
109
+ # if d_m3LogModule
110
+ # define m3log_module(CATEGORY, FMT, ...) d_m3Log(CATEGORY, FMT, ##__VA_ARGS__)
111
+ # else
112
+ # define m3log_module(...) {}
113
+ # endif
114
+
115
+ # if d_m3LogRuntime
116
+ # define m3log_runtime(CATEGORY, FMT, ...) d_m3Log(CATEGORY, FMT, ##__VA_ARGS__)
117
+ # else
118
+ # define m3log_runtime(...) {}
119
+ # endif
120
+
121
+ # define m3log(CATEGORY, FMT, ...) m3log_##CATEGORY (CATEGORY, FMT "\n", ##__VA_ARGS__)
122
+ #else
123
+ # define d_m3Log(CATEGORY, FMT, ...) {}
124
+ # define m3log(CATEGORY, FMT, ...) {}
125
+ #endif
126
+
127
+
128
+ #if defined(ASSERTS) || (defined(DEBUG) && !defined(NASSERTS))
129
+ # define d_m3Assert(ASS) if (!(ASS)) { printf("Assertion failed at %s:%d : %s\n", __FILE__, __LINE__, #ASS); fflush(stdout); abort(); }
130
+ #else
131
+ # define d_m3Assert(ASS)
132
+ #endif
133
+
134
+ typedef void /*const*/* code_t;
135
+ typedef code_t const* /*__restrict__*/ pc_t;
136
+
137
+
138
+ // Sits immediately before the linear memory it describes, so m3MemData() is
139
+ // just (header + 1). The interpreter carries a pointer to one of these in the
140
+ // _mem pseudo-register, and reaches everything else about the memory - its page
141
+ // counts, its owning runtime - through the back-pointers here. 'memory' is what
142
+ // makes that possible without going through the runtime, which is the
143
+ // prerequisite for a runtime holding more than one memory.
144
+ typedef struct M3MemoryHeader {
145
+ IM3Runtime runtime;
146
+ void* maxStack;
147
+ size_t length;
148
+ struct M3Memory* memory; // the M3Memory this block belongs to
149
+ } M3MemoryHeader;
150
+
151
+ struct M3CodeMappingPage;
152
+
153
+ typedef struct M3CodePageHeader {
154
+ struct M3CodePage* next;
155
+
156
+ u32 lineIndex;
157
+ u32 numLines;
158
+ u32 sequence; // this is just used for debugging; could be removed
159
+ u32 usageCount;
160
+
161
+ #if d_m3RecordBacktraces
162
+ struct M3CodeMappingPage* mapping;
163
+ #endif // d_m3RecordBacktraces
164
+ } M3CodePageHeader;
165
+
166
+
167
+ #define d_m3CodePageFreeLinesThreshold 7+2 // max is: ReturnCallIndirect (op + 6 immediates) + 2 for bridge
168
+
169
+ #define d_m3DefaultMemPageSize 65536
170
+
171
+ // The ceiling on a linear memory address, and so on the size of a linear
172
+ // memory. No allocator reaches anywhere near it - a memory is one contiguous
173
+ // realloc'd block, and d_m3MaxLinearMemoryPages caps it far lower - so an
174
+ // address at or above this is out of bounds no matter which memory it names.
175
+ //
176
+ // That is what a 64-bit address is checked against before anything is added to
177
+ // it. Once both the address and the memarg offset are known to be below 2^52,
178
+ // their sum is below 2^53 and cannot wrap, so the u65 effective address the
179
+ // spec calls for can be computed in a plain u64 - and stays well inside the
180
+ // positive range of m3reg_t, which is signed. Anything at or above the limit
181
+ // traps, which is what an address that far out would do anyway.
182
+ #define d_m3AddressLimitBits 52
183
+ #define d_m3AddressLimit (UINT64_C(1) << d_m3AddressLimitBits)
184
+
185
+ #define d_m3Reg0SlotAlias 60000
186
+ #define d_m3Fp0SlotAlias (d_m3Reg0SlotAlias + 2)
187
+
188
+ #if d_m3HasTypedRefs
189
+ // a heap type index has to fit in the spare bits of an m3type_t, see below
190
+ # define d_m3MaxSaneTypesCount 4094
191
+ #else
192
+ // M3Environment.numFuncTypes is the u16 that hands out M3FuncType.canonicalIndex,
193
+ // so the count has to stay below 65536 here as well
194
+ # define d_m3MaxSaneTypesCount 65500
195
+ #endif
196
+ #define d_m3MaxSaneFunctionsCount 1000000
197
+ #define d_m3MaxSaneImportsCount 100000
198
+ #define d_m3MaxSaneExportsCount 100000
199
+ #define d_m3MaxSaneGlobalsCount 1000000
200
+ #define d_m3MaxSaneTagsCount 100000
201
+ #define d_m3MaxSaneElementSegments 10000000
202
+ #define d_m3MaxSaneDataSegments 100000
203
+ #define d_m3MaxSaneTableSize 10000000
204
+ #define d_m3MaxSaneMemoriesCount 10000
205
+ #if d_m3HasRefTypes
206
+ # define d_m3MaxSaneTableCount 1000
207
+ #else
208
+ # define d_m3MaxSaneTableCount 1 // MVP: a single table
209
+ #endif
210
+ #define d_m3MaxSaneUtf8Length 10000
211
+ #define d_m3MaxSaneFunctionArgRetCount 1000 // still insane, but whatever
212
+
213
+ #define d_externalKind_function 0
214
+ #define d_externalKind_table 1
215
+ #define d_externalKind_memory 2
216
+ #define d_externalKind_global 3
217
+ #define d_externalKind_tag 4
218
+
219
+ // compact-import-section: these stand where an externtype would, after an empty
220
+ // item name, and introduce a run of imports sharing one module name. 0x7f gives
221
+ // each item its own externtype, 0x7e shares a single one across the whole run.
222
+ #define d_compactImports_perItemType 0x7f
223
+ #define d_compactImports_sharedType 0x7e
224
+
225
+ // the negated wasm encodings of the abstract reference types, as NormalizeType()
226
+ // stores them
227
+ #define d_waType_funcref 16
228
+ #define d_waType_externref 17
229
+
230
+ // exception handling: exnref is wasm-encoded as -0x17
231
+ #define d_waType_exnref 23
232
+
233
+ // stack switching: cont type form is -0x23 (35); heap types: cont is -0x18 (24), nocont is -0x0b (11)
234
+ #define d_waType_cont 35
235
+ #define d_waType_heap_cont 24
236
+ #define d_waType_heap_nocont 11
237
+
238
+ // function-references: a reference type spelled out as (ref ht) / (ref null ht),
239
+ // where the abstract heap types reuse the funcref and externref encodings
240
+ #define d_waEncode_ref 0x64
241
+ #define d_waEncode_refNull 0x63
242
+
243
+ // indexed by M3ValueType: c_m3Type_count entries for the concrete types, plus
244
+ // one more for c_m3Type_unknown, which sits right after them
245
+ static const char* const c_waTypes[] = { "nil", "i32", "i64", "f32", "f64", "v128", "funcref", "externref", "exnref", "contref", "unknown" };
246
+ static const char* const c_waCompactTypes[] = { "_", "i", "I", "f", "F", "V", "r", "R", "e", "c", "?" };
247
+
248
+
249
+ #if d_m3VerboseErrorMessages
250
+
251
+ M3Result m3Error (M3Result i_result, IM3Runtime i_runtime, IM3Module i_module, IM3Function i_function,
252
+ const char* const i_file, u32 i_lineNum, const char* const i_errorMessage, ...);
253
+
254
+ # define _m3Error(RESULT, RT, MOD, FUN, FILE, LINE, FORMAT, ...) \
255
+ m3Error (RESULT, RT, MOD, FUN, FILE, LINE, FORMAT, ##__VA_ARGS__)
256
+
257
+ #else
258
+ # define _m3Error(RESULT, RT, MOD, FUN, FILE, LINE, FORMAT, ...) (RESULT)
259
+ #endif
260
+
261
+ #define ErrorRuntime(RESULT, RUNTIME, FORMAT, ...) _m3Error (RESULT, RUNTIME, NULL, NULL, __FILE__, __LINE__, FORMAT, ##__VA_ARGS__)
262
+ #define ErrorModule(RESULT, MOD, FORMAT, ...) _m3Error (RESULT, MOD->runtime, MOD, NULL, __FILE__, __LINE__, FORMAT, ##__VA_ARGS__)
263
+ #define ErrorCompile(RESULT, COMP, FORMAT, ...) _m3Error (RESULT, COMP->runtime, COMP->module, NULL, __FILE__, __LINE__, FORMAT, ##__VA_ARGS__)
264
+
265
+ #if d_m3GuardedMemory
266
+
267
+ // How much address space a linear memory's bytes are given: everything a Wasm access
268
+ // can name. A 32-bit address plus a 32-bit memarg offset reaches just under 2^33, and
269
+ // the access itself a few bytes further, which the page of slack in a slot covers.
270
+ # define d_m3GuardedDataBytes (UINT64_C(1) << 33)
271
+
272
+ // Take one slot of the guarded arena, or NULL when the arena has none left or could
273
+ // not be reserved at all. What comes back is the base of the slot: the memory's
274
+ // M3MemoryHeader sits at the end of its first page, and the bytes the guest addresses
275
+ // begin on the page after that.
276
+ void* Guard_TakeSlot (void);
277
+
278
+ // The header of a slot, which is also what the guest's memory starts right after
279
+ M3MemoryHeader* Guard_SlotHeader (void* i_slot);
280
+
281
+ // Make the first i_dataBytes of the slot's data reachable. Only ever asked to grow,
282
+ // and asking for what is already there costs nothing.
283
+ bool Guard_CommitSlot (void* i_slot, size_t i_dataBytes);
284
+
285
+ // Give a slot back, dropping everything committed in it. The next taker gets it
286
+ // zeroed, as a fresh linear memory has to be.
287
+ void Guard_GiveSlot (void* i_slot);
288
+
289
+ // The whole arena, for a fault to be held against - see m3_HostProtectedCall. Answers
290
+ // (NULL, 0) before anything has asked for a slot.
291
+ void Guard_ArenaRange (void** o_low, size_t* o_bytes);
292
+
293
+ #endif // d_m3GuardedMemory
294
+
295
+ #if d_m3MaxNativeStack > 0
296
+ // The native-stack low-water mark for a top-level call that came in at i_stackPtr,
297
+ // clamped to what the calling thread's stack really is where that can be measured.
298
+ // See d_m3MaxNativeStack and d_m3StackLimitEnter.
299
+ void* m3_NativeStackLimit (void* i_stackPtr, size_t i_budget);
300
+ #endif
301
+
302
+ #if d_m3LogNativeStack
303
+ void m3StackCheckInit ();
304
+ void m3StackCheck ();
305
+ int m3StackGetMax ();
306
+ #else
307
+ # define m3StackCheckInit()
308
+ # define m3StackCheck()
309
+ # define m3StackGetMax() 0
310
+ #endif
311
+
312
+ #if d_m3LogTimestamps
313
+ # define PRIts "%llu"
314
+ uint64_t m3_GetTimestamp ();
315
+ #else
316
+ # define PRIts "%s"
317
+ # define m3_GetTimestamp() ""
318
+ #endif
319
+
320
+ void m3_Abort (const char* message);
321
+ void* m3_Malloc_Impl (size_t i_size);
322
+ void* m3_Realloc_Impl (void* i_ptr, size_t i_newSize, size_t i_oldSize);
323
+ void m3_Free_Impl (void* i_ptr);
324
+ void* m3_CopyMem (const void* i_from, size_t i_size);
325
+
326
+ #if d_m3LogHeapOps
327
+
328
+ // Tracing format: timestamp;heap:OpCode;name;size(bytes);new items;new ptr;old items;old ptr
329
+
330
+ static inline
331
+ void* m3_AllocStruct_Impl (ccstr_t name, size_t i_size)
332
+ {
333
+ void* result = m3_Malloc_Impl(i_size);
334
+ fprintf(stderr, PRIts ";heap:AllocStruct;%s;%zu;;%p;;\n", m3_GetTimestamp(), name, i_size, result);
335
+ return result;
336
+ }
337
+
338
+ static inline
339
+ void* m3_AllocArray_Impl (ccstr_t name, size_t i_num, size_t i_size)
340
+ {
341
+ void* result = m3_Malloc_Impl(i_size * i_num);
342
+ fprintf(stderr, PRIts ";heap:AllocArr;%s;%zu;%zu;%p;;\n", m3_GetTimestamp(), name, i_size, i_num, result);
343
+ return result;
344
+ }
345
+
346
+ static inline
347
+ void* m3_ReallocArray_Impl (ccstr_t name, void* i_ptr_old, size_t i_num_new, size_t i_num_old, size_t i_size)
348
+ {
349
+ void* result = m3_Realloc_Impl(i_ptr_old, i_size * i_num_new, i_size * i_num_old);
350
+ fprintf(stderr, PRIts ";heap:ReallocArr;%s;%zu;%zu;%p;%zu;%p\n", m3_GetTimestamp(), name, i_size, i_num_new, result, i_num_old, i_ptr_old);
351
+ return result;
352
+ }
353
+
354
+ static inline
355
+ void* m3_Malloc (ccstr_t name, size_t i_size)
356
+ {
357
+ void* result = m3_Malloc_Impl(i_size);
358
+ fprintf(stderr, PRIts ";heap:AllocMem;%s;%zu;;%p;;\n", m3_GetTimestamp(), name, i_size, result);
359
+ return result;
360
+ }
361
+ static inline
362
+ void* m3_Realloc (ccstr_t name, void* i_ptr, size_t i_newSize, size_t i_oldSize)
363
+ {
364
+ void* result = m3_Realloc_Impl(i_ptr, i_newSize, i_oldSize);
365
+ fprintf(stderr, PRIts ";heap:ReallocMem;%s;;%zu;%p;%zu;%p\n", m3_GetTimestamp(), name, i_newSize, result, i_oldSize, i_ptr);
366
+ return result;
367
+ }
368
+
369
+ # define m3_AllocStruct(STRUCT) (STRUCT *)m3_AllocStruct_Impl (#STRUCT, sizeof (STRUCT))
370
+ # define m3_AllocArray(STRUCT, NUM) (STRUCT *)m3_AllocArray_Impl (#STRUCT, NUM, sizeof (STRUCT))
371
+ # define m3_ReallocArray(STRUCT, PTR, NEW, OLD) (STRUCT *)m3_ReallocArray_Impl (#STRUCT, (void *)(PTR), (NEW), (OLD), sizeof (STRUCT))
372
+ # define m3_Free(P) do { void* p = (void*)(P); \
373
+ if (p) { fprintf(stderr, PRIts ";heap:FreeMem;;;;%p;\n", m3_GetTimestamp(), p); } \
374
+ m3_Free_Impl (p); (P) = NULL; } while(0)
375
+ #else
376
+ # define m3_Malloc(NAME, SIZE) m3_Malloc_Impl(SIZE)
377
+ # define m3_Realloc(NAME, PTR, NEW, OLD) m3_Realloc_Impl(PTR, NEW, OLD)
378
+ # define m3_AllocStruct(STRUCT) (STRUCT *)m3_Malloc_Impl (sizeof (STRUCT))
379
+ # define m3_AllocArray(STRUCT, NUM) (STRUCT *)m3_Malloc_Impl (sizeof (STRUCT) * (NUM))
380
+ # define m3_ReallocArray(STRUCT, PTR, NEW, OLD) (STRUCT *)m3_Realloc_Impl ((void *)(PTR), sizeof (STRUCT) * (NEW), sizeof (STRUCT) * (OLD))
381
+ # define m3_Free(P) do { m3_Free_Impl ((void*)(P)); (P) = NULL; } while(0)
382
+ #endif
383
+
384
+ // A value type as the parser, compiler and validator carry it. The plain
385
+ // M3ValueType values keep their encoding, so every comparison against a
386
+ // c_m3Type_* constant still means exactly what it did. Only a typed function
387
+ // reference - (ref $t) or (ref null $t) - needs more room, and it spends it on
388
+ // the canonical index of the function type it points at. Fitting that index
389
+ // here is why d_m3MaxSaneTypesCount is 8190 rather than something rounder.
390
+ //
391
+ // bit 15 spelled-out reference type rather than a plain M3ValueType
392
+ // bit 14 non-null, i.e. (ref ht) rather than (ref null ht)
393
+ // bit 13 heap type extern rather than func
394
+ // bit 12 heap type cont rather than func
395
+ // bits 11-0 canonical function type index, or d_m3Type_heapAbstract
396
+
397
+ #if d_m3HasTypedRefs
398
+
399
+ # define d_m3Type_ref 0x8000u
400
+ # define d_m3Type_refNonNull 0x4000u
401
+ # define d_m3Type_refExtern 0x2000u
402
+ # define d_m3Type_refCont 0x1000u
403
+ # define d_m3Type_heapMask 0x0FFFu
404
+ # define d_m3Type_heapAbstract 0x0FFFu // plain 'func', 'extern', or 'cont'
405
+ // 'nocont', the bottom of the continuation types: a reference to it is a
406
+ // reference to every one of them, which is what makes ref.null nocont usable
407
+ // wherever a particular continuation is expected. One below heapAbstract, and
408
+ // so out of reach of d_m3MaxSaneTypesCount.
409
+ # define d_m3Type_heapNone 0x0FFEu
410
+
411
+ // The storage type a value of this type occupies: a reference of any shape is
412
+ // just a funcref or an externref once the type checking is done with.
413
+ u8 BaseTypeOf (m3type_t i_type);
414
+ bool IsSubTypeOf (m3type_t i_sub, m3type_t i_super);
415
+
416
+ static inline
417
+ bool IsSpelledRefType (m3type_t i_type)
418
+ {
419
+ return (i_type & d_m3Type_ref) != 0;
420
+ }
421
+ static inline
422
+ bool IsNullableRef (m3type_t i_type)
423
+ {
424
+ return (i_type & d_m3Type_refNonNull) == 0;
425
+ }
426
+ static inline
427
+ u32 HeapTypeOf (m3type_t i_type)
428
+ {
429
+ return IsSpelledRefType(i_type) ? (i_type & d_m3Type_heapMask) : d_m3Type_heapAbstract;
430
+ }
431
+
432
+ #else // no spelled-out reference types, so every value type is its own storage
433
+ // type and subtyping collapses back to equality
434
+
435
+ static inline
436
+ u8 BaseTypeOf (m3type_t i_type)
437
+ {
438
+ return (u8)i_type;
439
+ }
440
+ static inline
441
+ bool IsSubTypeOf (m3type_t i_sub, m3type_t i_super)
442
+ {
443
+ return i_sub == i_super;
444
+ }
445
+ static inline
446
+ bool IsSpelledRefType (m3type_t i_type)
447
+ {
448
+ (void)i_type;
449
+ return false;
450
+ }
451
+ static inline
452
+ bool IsNullableRef (m3type_t i_type)
453
+ {
454
+ (void)i_type;
455
+ return true;
456
+ }
457
+
458
+ #endif // d_m3HasTypedRefs
459
+
460
+ M3Result NormalizeType (u8* o_type, i8 i_convolutedWasmType);
461
+
462
+ // These all speak in terms of how a value is stored, so they reduce a
463
+ // spelled-out reference type to its funcref / externref base first.
464
+ bool IsIntType (m3type_t i_wasmType);
465
+ bool IsFpType (m3type_t i_wasmType);
466
+ bool IsRefType (m3type_t i_m3Type);
467
+ bool Is64BitType (m3type_t i_m3Type);
468
+ u32 SizeOfType (m3type_t i_m3Type);
469
+
470
+ M3Result Read_u64 (u64* o_value, bytes_t* io_bytes, cbytes_t i_end);
471
+ M3Result Read_u32 (u32* o_value, bytes_t* io_bytes, cbytes_t i_end);
472
+ #if d_m3ImplementFloat
473
+ M3Result Read_f64 (f64* o_value, bytes_t* io_bytes, cbytes_t i_end);
474
+ M3Result Read_f32 (f32* o_value, bytes_t* io_bytes, cbytes_t i_end);
475
+ #endif
476
+ M3Result Read_u8 (u8* o_value, bytes_t* io_bytes, cbytes_t i_end);
477
+ M3Result Read_opcode (m3opcode_t* o_value, bytes_t* io_bytes, cbytes_t i_end);
478
+
479
+ M3Result ReadLebUnsigned (u64* o_value, u32 i_maxNumBits, bytes_t* io_bytes, cbytes_t i_end);
480
+ M3Result ReadLebSigned (i64* o_value, u32 i_maxNumBits, bytes_t* io_bytes, cbytes_t i_end);
481
+ M3Result ReadLEB_u32 (u32* o_value, bytes_t* io_bytes, cbytes_t i_end);
482
+
483
+ // The memarg immediate of a load or store: an alignment hint, then a static
484
+ // offset. Multi-memory reinterprets the alignment as a bitfield -- bit 6 says a
485
+ // memory index sits between the two -- so the hint is returned with that bit
486
+ // masked off and the index defaults to 0 when it is clear.
487
+ M3Result ReadMemoryArg (u32* o_align, u32* o_memoryIdx, u64* o_offset, bytes_t* io_bytes, cbytes_t i_end);
488
+ M3Result ReadLEB_u7 (u8* o_value, bytes_t* io_bytes, cbytes_t i_end);
489
+ M3Result ReadLEB_i7 (i8* o_value, bytes_t* io_bytes, cbytes_t i_end);
490
+ M3Result ReadLEB_i32 (i32* o_value, bytes_t* io_bytes, cbytes_t i_end);
491
+ M3Result ReadLEB_i64 (i64* o_value, bytes_t* io_bytes, cbytes_t i_end);
492
+ M3Result Read_utf8 (cstr_t* o_utf8, bytes_t* io_bytes, cbytes_t i_end);
493
+
494
+ #if d_m3HasSnapshots
495
+ // XXH64, in m3_xxh64.c. Initialize a state, feed it the input in any number of
496
+ // pieces, then read the digest out. The digest depends only on the bytes fed in
497
+ // - not on how they were split up, nor on the host's byte order, pointer width
498
+ // or compiler - and matches the reference xxHash implementation, so anything
499
+ // else that speaks XXH64 computes the same value. Reading the digest does not
500
+ // consume the state.
501
+ typedef struct Xxh64 {
502
+ u64 acc[4]; // the four accumulator lanes; acc[2] still holds the seed
503
+ u64 totalLength; // input bytes seen so far
504
+ u8 buffer[32]; // input past the last stripe the accumulators took
505
+ u32 bufferLength;
506
+ } Xxh64;
507
+
508
+ void Xxh64_Init (Xxh64* o_state, u64 i_seed);
509
+ void Xxh64_Update (Xxh64* io_state, const void* i_data, size_t i_size);
510
+ u64 Xxh64_Digest (const Xxh64* i_state);
511
+ #endif // d_m3HasSnapshots
512
+
513
+ cstr_t SPrintValue (void* i_value, m3type_t i_type);
514
+ size_t SPrintArg (char* o_string, size_t i_stringBufferSize, voidptr_t i_sp, m3type_t i_type);
515
+
516
+ void ReportError (IM3Runtime io_runtime, IM3Module i_module, IM3Function i_function, ccstr_t i_errorMessage, ccstr_t i_file, u32 i_lineNum);
517
+
518
+ #if d_m3RecordBacktraces
519
+ void PushBacktraceFrame (IM3Runtime io_runtime, pc_t i_pc);
520
+ void FillBacktraceFunctionInfo (IM3Runtime io_runtime, IM3Function i_function);
521
+ void ClearBacktrace (IM3Runtime io_runtime);
522
+ #endif
523
+
524
+ d_m3EndExternC
525
+
526
+ #endif // m3_core_h
@@ -0,0 +1,65 @@
1
+ //
2
+ // m3_deterministic.c
3
+ //
4
+ // Copyright © 2026 Volodymyr Shymanskyy. All rights reserved.
5
+ //
6
+
7
+ #include "m3_deterministic.h"
8
+
9
+ #if d_m3DeterministicProfile
10
+
11
+ void Deterministic_InitRuntime (IM3Runtime io_runtime)
12
+ {
13
+ io_runtime->virtualTimeNs = 0;
14
+ io_runtime->randomState = d_m3DeterministicSeed;
15
+ }
16
+
17
+ u64 Deterministic_Time (IM3Runtime io_runtime)
18
+ {
19
+ u64 now = io_runtime->virtualTimeNs;
20
+
21
+ Deterministic_Advance(io_runtime, d_m3DeterministicTickNs);
22
+
23
+ return now;
24
+ }
25
+
26
+ void Deterministic_Advance (IM3Runtime io_runtime, u64 i_nanoseconds)
27
+ {
28
+ // Saturating: a guest may ask to wait longer than the clock can express, and
29
+ // going backwards is the one thing this clock must never do
30
+ if (io_runtime->virtualTimeNs > UINT64_MAX - i_nanoseconds) {
31
+ io_runtime->virtualTimeNs = UINT64_MAX;
32
+ } else {
33
+ io_runtime->virtualTimeNs += i_nanoseconds;
34
+ }
35
+ }
36
+
37
+ // SplitMix64, which is a few lines and passes the usual test suites. Nothing here
38
+ // wants unpredictability - the point is the opposite - so the only property that
39
+ // matters is that the same seed gives the same bytes on every machine, which fixed
40
+ // width arithmetic and no floating point are enough for.
41
+ void Deterministic_Random (IM3Runtime io_runtime, void* o_buf, size_t i_length)
42
+ {
43
+ u8* out = (u8*)o_buf;
44
+
45
+ while (i_length) {
46
+ io_runtime->randomState += UINT64_C(0x9E3779B97F4A7C15);
47
+
48
+ u64 z = io_runtime->randomState;
49
+ z = (z ^ (z >> 30)) * UINT64_C(0xBF58476D1CE4E5B9);
50
+ z = (z ^ (z >> 27)) * UINT64_C(0x94D049BB133111EB);
51
+ z = z ^ (z >> 31);
52
+
53
+ size_t chunk = M3_MIN(i_length, sizeof(z));
54
+
55
+ // one byte at a time, so the stream does not depend on the host's byte order
56
+ for (size_t i = 0; i < chunk; ++i) {
57
+ out[i] = (u8)(z >> (8 * i));
58
+ }
59
+
60
+ out += chunk;
61
+ i_length -= chunk;
62
+ }
63
+ }
64
+
65
+ #endif // d_m3DeterministicProfile
@@ -0,0 +1,59 @@
1
+ //
2
+ // m3_deterministic.h
3
+ //
4
+ // Copyright © 2026 Volodymyr Shymanskyy. All rights reserved.
5
+ //
6
+
7
+ #ifndef m3_deterministic_h
8
+ #define m3_deterministic_h
9
+
10
+ #include "m3_env.h"
11
+
12
+ d_m3BeginExternC
13
+
14
+ // The clock and the entropy the host APIs answer out of under
15
+ // d_m3DeterministicProfile, instead of out of the machine they happen to be
16
+ // running on. Both live on M3Runtime, so two runtimes replay independently and a
17
+ // fresh one replays the same way as the last.
18
+ //
19
+ // The profile itself is the language half - see d_m3DeterministicProfile in
20
+ // m3_config.h. This is the other half, what a module reads through its imports,
21
+ // and it is wasm3's own rather than the proposal's.
22
+
23
+ // How far the clock moves on each reading, and so the finest interval it can tell
24
+ // apart. A guest that waits by watching the clock has to see it move, and this is
25
+ // how fast it does.
26
+ #define d_m3DeterministicTickNs UINT64_C(1000000) // 1ms
27
+
28
+ // Where the entropy stream starts. Nothing about the value matters except that it
29
+ // is written down, since a replay has to produce the same bytes.
30
+ #define d_m3DeterministicSeed UINT64_C(0x9E3779B97F4A7C15)
31
+
32
+ // Where the deterministic wall clock starts: 2020-01-01T00:00:00Z. Any fixed instant
33
+ // would do; a real one keeps a guest that formats the date from printing something
34
+ // absurd. The monotonic clocks start at zero, as they would anyway.
35
+ #define d_m3WasiDeterministicEpochNs UINT64_C(1577836800000000000)
36
+
37
+ #if d_m3DeterministicProfile
38
+
39
+ // Start a runtime's clock and entropy where every other runtime starts them, which
40
+ // is what makes a run replayable by making a fresh runtime.
41
+ void Deterministic_InitRuntime (IM3Runtime io_runtime);
42
+
43
+ // The clock counts from the moment the runtime was made, leaving it to the host API
44
+ // to say what instant that was. Reading it advances it, so that a guest spinning
45
+ // until time passes gets there.
46
+ u64 Deterministic_Time (IM3Runtime io_runtime);
47
+ void Deterministic_Advance (IM3Runtime io_runtime, u64 i_nanoseconds);
48
+ void Deterministic_Random (IM3Runtime io_runtime, void* o_buf, size_t i_length);
49
+
50
+ #else
51
+
52
+ // Nothing to seed: the fields these would set are not on M3Runtime in this build
53
+ # define Deterministic_InitRuntime(RT) do {} while (0)
54
+
55
+ #endif
56
+
57
+ d_m3EndExternC
58
+
59
+ #endif /* m3_deterministic_h */