eliscript 0.1.3 → 0.1.4

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 (526) hide show
  1. package/COPYING.RUNTIME +93 -0
  2. package/README.md +15 -3
  3. package/bin/eliscript-test +29 -0
  4. package/bootstrap/backends/README.md +5 -4
  5. package/bootstrap/backends/binary.eli +89 -22
  6. package/bootstrap/backends/capabilities.eli +9 -4
  7. package/bootstrap/backends/managed-layout.eli +93 -81
  8. package/bootstrap/backends/managed.eli +651 -125
  9. package/bootstrap/backends/native.eli +1791 -324
  10. package/bootstrap/backends/numeric.eli +71 -7
  11. package/bootstrap/backends/sha256.eli +165 -68
  12. package/bootstrap/backends/wasm.eli +461 -52
  13. package/bootstrap/compiler/analyzer.eli +692 -2
  14. package/bootstrap/compiler/compiler.eli +16 -3
  15. package/bootstrap/compiler/emitter.eli +80 -35
  16. package/bootstrap/compiler/project.eli +175 -1
  17. package/bootstrap/compiler/transient-analysis.eli +2 -2
  18. package/bootstrap/host/build.eli +1 -0
  19. package/bootstrap/host/build.mjs +1 -1
  20. package/bootstrap/host/build.mjs.map +1 -1
  21. package/bootstrap/host/bun.mjs +7 -9
  22. package/bootstrap/host/bun.mjs.map +1 -1
  23. package/bootstrap/host/check-cli-ground.eli +47 -5
  24. package/bootstrap/host/check-cli-ground.mjs +60 -19
  25. package/bootstrap/host/check-cli-ground.mjs.map +1 -1
  26. package/bootstrap/host/check-cli.mjs +41 -1
  27. package/bootstrap/host/check-cli.mjs.map +1 -1
  28. package/bootstrap/host/compiler-session.eli +136 -22
  29. package/bootstrap/host/eliscript-cli.mjs +1 -1
  30. package/bootstrap/host/eliscript-cli.mjs.map +1 -1
  31. package/bootstrap/host/evaluation-cli.eli +33 -1
  32. package/bootstrap/host/evaluation-cli.mjs +65 -28
  33. package/bootstrap/host/evaluation-cli.mjs.map +1 -1
  34. package/bootstrap/host/evaluation.eli +651 -42
  35. package/bootstrap/host/evaluation.mjs +884 -72
  36. package/bootstrap/host/evaluation.mjs.map +1 -1
  37. package/bootstrap/host/project-cli-ground.eli +6 -1
  38. package/bootstrap/host/project-cli-ground.mjs +33 -32
  39. package/bootstrap/host/project-cli-ground.mjs.map +1 -1
  40. package/bootstrap/host/project-cli.mjs +1 -1
  41. package/bootstrap/host/project-cli.mjs.map +1 -1
  42. package/bootstrap/host/project-ground.eli +266 -45
  43. package/bootstrap/host/project-ground.mjs +429 -159
  44. package/bootstrap/host/project-ground.mjs.map +1 -1
  45. package/bootstrap/host/project.mjs +30 -40
  46. package/bootstrap/host/project.mjs.map +1 -1
  47. package/bootstrap/host/test-cli.eli +379 -0
  48. package/bootstrap/host/test-cli.mjs +494 -0
  49. package/bootstrap/host/test-cli.mjs.map +1 -0
  50. package/browser/README.md +7 -0
  51. package/browser/host.mjs +21 -29
  52. package/browser/host.mjs.map +1 -1
  53. package/browser/worker.mjs +7 -9
  54. package/browser/worker.mjs.map +1 -1
  55. package/compiler/eliscript-analyzer.el +694 -0
  56. package/compiler/eliscript-cli.el +66 -22
  57. package/compiler/eliscript-emitter.el +67 -43
  58. package/compiler/eliscript-ir-emitter.el +71 -36
  59. package/compiler/eliscript-project.el +360 -80
  60. package/compiler/eliscript-transient-analysis.el +5 -5
  61. package/compiler/eliscript.el +6 -0
  62. package/dist/backends/binary.mjs +148 -26
  63. package/dist/backends/binary.mjs.map +1 -1
  64. package/dist/backends/capabilities.mjs +11 -4
  65. package/dist/backends/capabilities.mjs.map +1 -1
  66. package/dist/backends/elf.mjs +4 -4
  67. package/dist/backends/elf.mjs.map +1 -1
  68. package/dist/backends/managed-layout.mjs +53 -56
  69. package/dist/backends/managed-layout.mjs.map +1 -1
  70. package/dist/backends/managed.mjs +1116 -375
  71. package/dist/backends/managed.mjs.map +1 -1
  72. package/dist/backends/memory.mjs +24 -26
  73. package/dist/backends/memory.mjs.map +1 -1
  74. package/dist/backends/native.mjs +2529 -434
  75. package/dist/backends/native.mjs.map +1 -1
  76. package/dist/backends/numeric.mjs +140 -33
  77. package/dist/backends/numeric.mjs.map +1 -1
  78. package/dist/backends/optimize.mjs +2 -2
  79. package/dist/backends/optimize.mjs.map +1 -1
  80. package/dist/backends/regexp.mjs +33 -35
  81. package/dist/backends/regexp.mjs.map +1 -1
  82. package/dist/backends/sha256.mjs +159 -59
  83. package/dist/backends/sha256.mjs.map +1 -1
  84. package/dist/backends/wasm.mjs +609 -73
  85. package/dist/backends/wasm.mjs.map +1 -1
  86. package/dist/bootstrap/analyzer.mjs +1018 -2
  87. package/dist/bootstrap/analyzer.mjs.map +1 -1
  88. package/dist/bootstrap/compiler.mjs +30 -23
  89. package/dist/bootstrap/compiler.mjs.map +1 -1
  90. package/dist/bootstrap/emitter.mjs +206 -161
  91. package/dist/bootstrap/emitter.mjs.macro-origins.json +16 -16
  92. package/dist/bootstrap/emitter.mjs.map +1 -1
  93. package/dist/bootstrap/expander.mjs +27 -31
  94. package/dist/bootstrap/expander.mjs.map +1 -1
  95. package/dist/bootstrap/ir.mjs +22 -24
  96. package/dist/bootstrap/ir.mjs.map +1 -1
  97. package/dist/bootstrap/project.mjs +246 -1
  98. package/dist/bootstrap/project.mjs.map +1 -1
  99. package/dist/bootstrap/reader.mjs +2 -2
  100. package/dist/bootstrap/reader.mjs.map +1 -1
  101. package/dist/bootstrap/source-map.mjs +34 -48
  102. package/dist/bootstrap/source-map.mjs.map +1 -1
  103. package/dist/bootstrap/transient-analysis.mjs +2 -2
  104. package/dist/bootstrap/transient-analysis.mjs.map +1 -1
  105. package/dist/browser/compiler.js +106 -106
  106. package/dist/browser/host.mjs +21 -29
  107. package/dist/browser/loader.js +1 -1
  108. package/dist/browser/worker.mjs +95 -95
  109. package/dist/compiler-artifact.json +1 -1
  110. package/dist/host/compiler-session.mjs +405 -228
  111. package/dist/host/compiler-session.mjs.map +1 -1
  112. package/dist/host/compiler-tools.mjs +44 -46
  113. package/dist/host/compiler-tools.mjs.map +1 -1
  114. package/dist/literal-sources/runtime/core/array-map.eli +45 -0
  115. package/dist/literal-sources/runtime/core/collection-internals.eli +22 -2
  116. package/dist/literal-sources/runtime/core/collection.eli +282 -23
  117. package/dist/literal-sources/runtime/core/data-text.eli +196 -13
  118. package/dist/literal-sources/runtime/core/data.eli +1 -1
  119. package/dist/literal-sources/runtime/core/identifier.eli +1 -1
  120. package/dist/literal-sources/runtime/core/lazy-sequence.eli +822 -44
  121. package/dist/literal-sources/runtime/core/list.eli +1 -1
  122. package/dist/literal-sources/runtime/core/map.eli +1 -1
  123. package/dist/literal-sources/runtime/core/metadata-internals.eli +2 -2
  124. package/dist/literal-sources/runtime/core/metadata.eli +2 -2
  125. package/dist/literal-sources/{stdlib/core/object.eli → runtime/core/object-impl.eli} +6 -6
  126. package/dist/literal-sources/runtime/core/object.eli +1 -1
  127. package/dist/literal-sources/runtime/core/order.eli +3 -3
  128. package/dist/literal-sources/runtime/core/persistent-kind.eli +1 -1
  129. package/dist/literal-sources/{stdlib/core/protocol.eli → runtime/core/protocol-impl.eli} +2 -2
  130. package/dist/literal-sources/runtime/core/protocol.eli +5 -3
  131. package/dist/literal-sources/runtime/core/queue.eli +1 -1
  132. package/dist/literal-sources/runtime/core/record.eli +3 -3
  133. package/dist/literal-sources/runtime/core/regex.eli +2 -2
  134. package/dist/literal-sources/runtime/core/sequence.eli +1 -1
  135. package/dist/literal-sources/runtime/core/set-algebra.eli +1 -1
  136. package/dist/literal-sources/runtime/core/set.eli +1 -1
  137. package/dist/literal-sources/runtime/core/sorted.eli +4 -4
  138. package/dist/literal-sources/{stdlib/core/text.eli → runtime/core/text-impl.eli} +2 -2
  139. package/dist/literal-sources/runtime/core/text.eli +1 -1
  140. package/dist/literal-sources/runtime/core/transducer.eli +24 -2
  141. package/dist/literal-sources/runtime/core/transient.eli +7 -5
  142. package/dist/literal-sources/runtime/core/type.eli +1 -1
  143. package/dist/literal-sources/runtime/core/value-internals.eli +3 -3
  144. package/dist/literal-sources/runtime/core/value.eli +2 -2
  145. package/dist/literal-sources/runtime/core/vector.eli +5 -2
  146. package/dist/literal-sources/{stdlib → runtime/managed}/managed-literal-protocols.eli +100 -34
  147. package/dist/literal-sources/{stdlib → runtime/managed}/managed-literals.eli +406 -81
  148. package/{stdlib → dist/literal-sources/runtime/managed}/managed-queue-state.eli +1 -1
  149. package/{stdlib → dist/literal-sources/runtime/managed}/managed-sorted-state.eli +1 -1
  150. package/dist/literal-sources/runtime/managed/managed-transient-state.eli +1206 -0
  151. package/{stdlib → dist/literal-sources/runtime/managed}/managed-value-state.eli +30 -6
  152. package/dist/literal-sources/{stdlib → runtime/managed}/managed-vector-view-state.eli +1 -1
  153. package/dist/literal-sources/runtime/wire/http-rpc.eli +1 -1
  154. package/dist/literal-sources/runtime/wire/markdown.eli +1 -1
  155. package/dist/literal-sources/runtime/wire/schema.eli +1 -1
  156. package/dist/literal-sources/stdlib/bit.eli +89 -1
  157. package/dist/literal-sources/stdlib/data.eli +522 -0
  158. package/dist/literal-sources/stdlib/interop/object.eli +39 -0
  159. package/dist/literal-sources/stdlib/persistent-list.eli +60 -21
  160. package/dist/literal-sources/stdlib/persistent-map.eli +335 -324
  161. package/dist/literal-sources/stdlib/persistent-set.eli +8 -6
  162. package/dist/literal-sources/stdlib/persistent-vector.eli +18 -18
  163. package/dist/literal-sources/stdlib/protocol.eli +63 -0
  164. package/{stdlib/core → dist/literal-sources/stdlib}/set.eli +8 -8
  165. package/dist/literal-sources/stdlib/string.eli +362 -0
  166. package/dist/runtime/lisp/async-runtime.mjs +55 -59
  167. package/dist/runtime/lisp/async-runtime.mjs.map +1 -1
  168. package/dist/runtime/lisp/builtins.mjs +232 -280
  169. package/dist/runtime/lisp/builtins.mjs.map +1 -1
  170. package/dist/runtime/lisp/cli.mjs +159 -167
  171. package/dist/runtime/lisp/cli.mjs.map +1 -1
  172. package/dist/runtime/lisp/compiler.mjs +359 -419
  173. package/dist/runtime/lisp/compiler.mjs.map +1 -1
  174. package/dist/runtime/lisp/core.mjs +24 -24
  175. package/dist/runtime/lisp/core.mjs.map +1 -1
  176. package/dist/runtime/lisp/evaluator.mjs +315 -385
  177. package/dist/runtime/lisp/evaluator.mjs.map +1 -1
  178. package/dist/runtime/lisp/extensions.mjs +85 -103
  179. package/dist/runtime/lisp/extensions.mjs.map +1 -1
  180. package/dist/runtime/lisp/host-io.mjs +106 -122
  181. package/dist/runtime/lisp/host-io.mjs.map +1 -1
  182. package/dist/runtime/lisp/io-worker.mjs +117 -135
  183. package/dist/runtime/lisp/io-worker.mjs.map +1 -1
  184. package/dist/runtime/lisp/keymap.mjs +5 -5
  185. package/dist/runtime/lisp/keymap.mjs.map +1 -1
  186. package/dist/runtime/lisp/macros-forms.mjs +49 -51
  187. package/dist/runtime/lisp/macros-forms.mjs.map +1 -1
  188. package/dist/runtime/lisp/reader-format.mjs +31 -31
  189. package/dist/runtime/lisp/reader-format.mjs.map +1 -1
  190. package/dist/runtime/lisp/regexp-buffer.mjs +9 -9
  191. package/dist/runtime/lisp/regexp-buffer.mjs.map +1 -1
  192. package/dist/runtime/math.mjs +32 -38
  193. package/dist/runtime/math.mjs.map +1 -1
  194. package/dist/runtime/number-radix.mjs +5 -7
  195. package/dist/runtime/number-radix.mjs.map +1 -1
  196. package/dist/runtime/primitives.mjs +81 -46
  197. package/dist/runtime/primitives.mjs.macro-origins.json +294 -44
  198. package/dist/runtime/primitives.mjs.map +1 -1
  199. package/dist/runtime/unicode-case.mjs +6 -6
  200. package/dist/runtime/unicode-case.mjs.map +1 -1
  201. package/dist/runtime.eli +3068 -1882
  202. package/dist/stage3-release.json +1 -1
  203. package/dist/stdlib/async.mjs +1838 -0
  204. package/dist/stdlib/bit.mjs +116 -0
  205. package/dist/stdlib/collection.mjs +193 -0
  206. package/dist/stdlib/core.mjs +28 -0
  207. package/dist/stdlib/data-text.mjs +54 -0
  208. package/dist/stdlib/data.mjs +601 -0
  209. package/dist/stdlib/devtools.mjs +565 -0
  210. package/dist/stdlib/diff.mjs +180 -0
  211. package/dist/stdlib/fn.mjs +164 -0
  212. package/dist/stdlib/hierarchy.mjs +189 -0
  213. package/dist/stdlib/identifier.mjs +33 -0
  214. package/dist/stdlib/interop/js.mjs +706 -0
  215. package/dist/stdlib/interop/object.mjs +40 -0
  216. package/dist/stdlib/json.mjs +843 -0
  217. package/dist/stdlib/lazy-sequence.mjs +117 -0
  218. package/dist/stdlib/math.mjs +386 -0
  219. package/dist/stdlib/meta.mjs +21 -0
  220. package/dist/stdlib/multimethod.mjs +345 -0
  221. package/dist/stdlib/numeric.mjs +327 -0
  222. package/dist/stdlib/order.mjs +194 -0
  223. package/dist/stdlib/persistent-list.mjs +171 -0
  224. package/dist/stdlib/persistent-map.mjs +781 -0
  225. package/dist/stdlib/persistent-queue.mjs +44 -0
  226. package/dist/stdlib/persistent-set.mjs +225 -0
  227. package/dist/stdlib/persistent-vector.mjs +316 -0
  228. package/dist/stdlib/portable/data-text.mjs +1094 -0
  229. package/dist/stdlib/portable/data.mjs +62 -0
  230. package/dist/stdlib/portable/identifier.mjs +179 -0
  231. package/dist/stdlib/portable/metadata.mjs +63 -0
  232. package/dist/stdlib/portable/object.mjs +140 -0
  233. package/dist/stdlib/portable/sequence.mjs +142 -0
  234. package/dist/stdlib/portable/text.mjs +111 -0
  235. package/dist/stdlib/pprint.mjs +807 -0
  236. package/dist/stdlib/protocol.mjs +61 -0
  237. package/dist/stdlib/record.mjs +25 -0
  238. package/dist/stdlib/regex.mjs +115 -0
  239. package/dist/stdlib/result.mjs +198 -0
  240. package/dist/stdlib/schema.mjs +2828 -0
  241. package/dist/stdlib/seq.mjs +913 -0
  242. package/dist/stdlib/set.mjs +317 -0
  243. package/dist/stdlib/sorted.mjs +56 -0
  244. package/dist/stdlib/state.mjs +451 -0
  245. package/dist/stdlib/string.mjs +494 -0
  246. package/dist/stdlib/tap.mjs +187 -0
  247. package/dist/stdlib/test.mjs +669 -0
  248. package/dist/stdlib/time.mjs +522 -0
  249. package/dist/stdlib/transducer.mjs +85 -0
  250. package/dist/stdlib/transient.mjs +32 -0
  251. package/dist/stdlib/type.mjs +28 -0
  252. package/dist/stdlib/uuid.mjs +377 -0
  253. package/dist/stdlib/value.mjs +334 -0
  254. package/dist/stdlib/walk.mjs +243 -0
  255. package/dist/stdlib/wire/gepo.mjs +28 -0
  256. package/dist/stdlib/wire/mdp.mjs +13 -0
  257. package/dist/stdlib/wire/mds.mjs +10 -0
  258. package/dist/stdlib/zipper.mjs +1025 -0
  259. package/editor/README.md +15 -0
  260. package/editor/eliscript-data.el +221 -8
  261. package/editor/eliscript-mode.el +207 -48
  262. package/editor/eliscript-runtime.el +6 -3
  263. package/package.json +49 -15
  264. package/platform/README.md +6 -0
  265. package/platform/browser.mjs +10 -12
  266. package/platform/browser.mjs.map +1 -1
  267. package/runtime/README.md +12 -5
  268. package/runtime/core/array-map.eli +538 -0
  269. package/runtime/core/array-map.mjs +651 -0
  270. package/runtime/core/array-map.mjs.map +1 -0
  271. package/runtime/core/collection-internals.eli +85 -33
  272. package/runtime/core/collection-internals.mjs +245 -193
  273. package/runtime/core/collection-internals.mjs.map +1 -1
  274. package/runtime/core/collection.eli +105 -3
  275. package/runtime/core/collection.mjs +190 -53
  276. package/runtime/core/collection.mjs.map +1 -1
  277. package/runtime/core/data-text.eli +224 -16
  278. package/runtime/core/data-text.mjs +345 -83
  279. package/runtime/core/data-text.mjs.map +1 -1
  280. package/runtime/core/data.eli +50 -33
  281. package/runtime/core/data.mjs +72 -36
  282. package/runtime/core/data.mjs.map +1 -1
  283. package/runtime/core/identifier.mjs +15 -19
  284. package/runtime/core/identifier.mjs.map +1 -1
  285. package/runtime/core/lazy-sequence.eli +885 -15
  286. package/runtime/core/lazy-sequence.mjs +1265 -38
  287. package/runtime/core/lazy-sequence.mjs.map +1 -1
  288. package/runtime/core/map-internals.eli +209 -1
  289. package/runtime/core/map-internals.mjs +359 -71
  290. package/runtime/core/map-internals.mjs.map +1 -1
  291. package/runtime/core/map.eli +75 -7
  292. package/runtime/core/map.mjs +122 -47
  293. package/runtime/core/map.mjs.map +1 -1
  294. package/{stdlib/core/object.eli → runtime/core/object-impl.eli} +6 -6
  295. package/runtime/core/object-impl.mjs +5 -5
  296. package/runtime/core/object-impl.mjs.map +1 -1
  297. package/runtime/core/order.eli +15 -3
  298. package/runtime/core/order.mjs +23 -8
  299. package/runtime/core/order.mjs.map +1 -1
  300. package/runtime/core/persistent-kind.mjs +9 -13
  301. package/runtime/core/persistent-kind.mjs.map +1 -1
  302. package/runtime/core/protocol-error.mjs +9 -11
  303. package/runtime/core/protocol-error.mjs.map +1 -1
  304. package/{stdlib/core/protocol.eli → runtime/core/protocol-impl.eli} +2 -2
  305. package/runtime/core/protocol-impl.mjs +10 -10
  306. package/runtime/core/protocol-impl.mjs.map +1 -1
  307. package/runtime/core/queue.mjs +14 -16
  308. package/runtime/core/queue.mjs.map +1 -1
  309. package/runtime/core/record.eli +2 -2
  310. package/runtime/core/record.mjs +13 -17
  311. package/runtime/core/record.mjs.map +1 -1
  312. package/runtime/core/regex.mjs +18 -22
  313. package/runtime/core/regex.mjs.map +1 -1
  314. package/runtime/core/sequence.eli +33 -31
  315. package/runtime/core/sequence.mjs +60 -93
  316. package/runtime/core/sequence.mjs.map +1 -1
  317. package/runtime/core/set.eli +53 -27
  318. package/runtime/core/set.mjs +113 -82
  319. package/runtime/core/set.mjs.map +1 -1
  320. package/runtime/core/sorted.mjs +91 -108
  321. package/runtime/core/sorted.mjs.map +1 -1
  322. package/{stdlib/core/text.eli → runtime/core/text-impl.eli} +2 -2
  323. package/runtime/core/text-impl.mjs +1 -1
  324. package/runtime/core/text-impl.mjs.map +1 -1
  325. package/runtime/core/transducer.eli +24 -0
  326. package/runtime/core/transducer.mjs +27 -1
  327. package/runtime/core/transducer.mjs.map +1 -1
  328. package/runtime/core/transient-internals.eli +12 -4
  329. package/runtime/core/transient-internals.mjs +19 -6
  330. package/runtime/core/transient-internals.mjs.map +1 -1
  331. package/runtime/core/transient.eli +31 -0
  332. package/runtime/core/transient.mjs +33 -2
  333. package/runtime/core/transient.mjs.map +1 -1
  334. package/runtime/core/value-internals.mjs +29 -35
  335. package/runtime/core/value-internals.mjs.map +1 -1
  336. package/runtime/core/vector.eli +73 -20
  337. package/runtime/core/vector.mjs +159 -156
  338. package/runtime/core/vector.mjs.map +1 -1
  339. package/runtime/literals.eli +16 -9
  340. package/runtime/literals.mjs +25 -9
  341. package/runtime/literals.mjs.map +1 -1
  342. package/{stdlib → runtime/managed}/managed-literal-protocols.eli +100 -34
  343. package/{stdlib → runtime/managed}/managed-literals.eli +406 -81
  344. package/{dist/literal-sources/stdlib → runtime/managed}/managed-queue-state.eli +1 -1
  345. package/runtime/managed/managed-runtime-array-map.eli +45 -0
  346. package/{stdlib → runtime/managed}/managed-runtime-collection-internals.eli +22 -2
  347. package/{stdlib → runtime/managed}/managed-runtime-collection.eli +282 -23
  348. package/{stdlib → runtime/managed}/managed-runtime-data-text.eli +196 -13
  349. package/{stdlib → runtime/managed}/managed-runtime-data.eli +1 -1
  350. package/{stdlib → runtime/managed}/managed-runtime-identifier.eli +1 -1
  351. package/runtime/managed/managed-runtime-lazy-sequence.eli +935 -0
  352. package/{stdlib → runtime/managed}/managed-runtime-list.eli +1 -1
  353. package/{stdlib → runtime/managed}/managed-runtime-map.eli +1 -1
  354. package/{stdlib → runtime/managed}/managed-runtime-metadata-internals.eli +2 -2
  355. package/{stdlib → runtime/managed}/managed-runtime-metadata.eli +2 -2
  356. package/{stdlib → runtime/managed}/managed-runtime-object.eli +1 -1
  357. package/{stdlib → runtime/managed}/managed-runtime-order.eli +3 -3
  358. package/{stdlib → runtime/managed}/managed-runtime-persistent-kind.eli +1 -1
  359. package/{stdlib → runtime/managed}/managed-runtime-protocol.eli +5 -3
  360. package/{stdlib → runtime/managed}/managed-runtime-queue.eli +1 -1
  361. package/{stdlib → runtime/managed}/managed-runtime-record.eli +3 -3
  362. package/{stdlib → runtime/managed}/managed-runtime-regex.eli +2 -2
  363. package/{stdlib → runtime/managed}/managed-runtime-sequence.eli +1 -1
  364. package/{stdlib → runtime/managed}/managed-runtime-set-algebra.eli +1 -1
  365. package/{stdlib → runtime/managed}/managed-runtime-set.eli +1 -1
  366. package/{stdlib → runtime/managed}/managed-runtime-sorted.eli +4 -4
  367. package/{stdlib → runtime/managed}/managed-runtime-text.eli +1 -1
  368. package/{stdlib → runtime/managed}/managed-runtime-transducer.eli +24 -2
  369. package/{stdlib → runtime/managed}/managed-runtime-transient.eli +7 -5
  370. package/{stdlib → runtime/managed}/managed-runtime-type.eli +1 -1
  371. package/{stdlib → runtime/managed}/managed-runtime-value-internals.eli +3 -3
  372. package/{stdlib → runtime/managed}/managed-runtime-value.eli +2 -2
  373. package/{stdlib → runtime/managed}/managed-runtime-vector.eli +5 -2
  374. package/{dist/literal-sources/stdlib → runtime/managed}/managed-sorted-state.eli +1 -1
  375. package/runtime/managed/managed-transient-state.eli +1206 -0
  376. package/{dist/literal-sources/stdlib → runtime/managed}/managed-value-state.eli +30 -6
  377. package/{stdlib → runtime/managed}/managed-vector-view-state.eli +1 -1
  378. package/{stdlib → runtime/managed}/managed-wire-http-rpc.eli +1 -1
  379. package/{stdlib → runtime/managed}/managed-wire-markdown.eli +1 -1
  380. package/{stdlib → runtime/managed}/managed-wire-schema.eli +1 -1
  381. package/runtime/math.mjs +32 -38
  382. package/runtime/math.mjs.map +1 -1
  383. package/runtime/number-radix.mjs +5 -7
  384. package/runtime/number-radix.mjs.map +1 -1
  385. package/runtime/primitives.eli +19 -6
  386. package/runtime/primitives.mjs +81 -46
  387. package/runtime/primitives.mjs.map +1 -1
  388. package/runtime/source-mapping.mjs +17 -23
  389. package/runtime/source-mapping.mjs.map +1 -1
  390. package/runtime/testing/map.eli +70 -41
  391. package/runtime/testing/map.mjs +57 -34
  392. package/runtime/testing/map.mjs.map +1 -1
  393. package/runtime/unicode-case.mjs +6 -6
  394. package/runtime/unicode-case.mjs.map +1 -1
  395. package/runtime/wire/http-rpc.mjs +12 -18
  396. package/runtime/wire/http-rpc.mjs.map +1 -1
  397. package/runtime/wire/markdown.mjs +42 -42
  398. package/runtime/wire/markdown.mjs.map +1 -1
  399. package/runtime/wire/schema.mjs +13 -13
  400. package/runtime/wire/schema.mjs.map +1 -1
  401. package/runtime/worker-value-codec.mjs +5 -7
  402. package/runtime/worker-value-codec.mjs.map +1 -1
  403. package/runtime/worker-value-stream.mjs +128 -135
  404. package/runtime/worker-value-stream.mjs.map +1 -1
  405. package/runtime/worker.mjs +75 -89
  406. package/runtime/worker.mjs.map +1 -1
  407. package/stdlib/README.md +25 -18
  408. package/stdlib/async.eli +1245 -0
  409. package/stdlib/bit.eli +89 -1
  410. package/stdlib/bit.mjs +89 -2
  411. package/stdlib/bit.mjs.map +1 -1
  412. package/stdlib/{core/collection.eli → collection.eli} +39 -4
  413. package/stdlib/core.eli +956 -0
  414. package/stdlib/data-text.eli +62 -1091
  415. package/stdlib/data.eli +517 -37
  416. package/stdlib/devtools.eli +399 -0
  417. package/stdlib/diff.eli +134 -0
  418. package/stdlib/{function.eli → fn.eli} +1 -1
  419. package/stdlib/identifier.eli +21 -136
  420. package/stdlib/interop/object.eli +39 -0
  421. package/stdlib/{core/lazy-sequence.eli → lazy-sequence.eli} +28 -2
  422. package/stdlib/math.eli +267 -0
  423. package/stdlib/{core/metadata.eli → meta.eli} +2 -2
  424. package/stdlib/{core/order.eli → order.eli} +6 -6
  425. package/stdlib/persistent-list.eli +60 -21
  426. package/stdlib/persistent-map.eli +335 -324
  427. package/stdlib/persistent-set.eli +8 -6
  428. package/stdlib/persistent-vector.eli +18 -18
  429. package/stdlib/portable/data-text.eli +1092 -0
  430. package/stdlib/portable/data.eli +42 -0
  431. package/stdlib/portable/identifier.eli +147 -0
  432. package/stdlib/{metadata.eli → portable/metadata.eli} +5 -5
  433. package/stdlib/{object.eli → portable/object.eli} +1 -1
  434. package/stdlib/{sequence.eli → portable/sequence.eli} +1 -1
  435. package/stdlib/{text.eli → portable/text.eli} +1 -1
  436. package/stdlib/pprint.eli +588 -0
  437. package/stdlib/protocol.eli +63 -0
  438. package/stdlib/{core/record.eli → record.eli} +2 -2
  439. package/stdlib/regex.eli +70 -0
  440. package/stdlib/result.eli +53 -44
  441. package/stdlib/schema.eli +1886 -0
  442. package/stdlib/{core/seq.eli → seq.eli} +97 -90
  443. package/{dist/literal-sources/stdlib/core → stdlib}/set.eli +8 -8
  444. package/stdlib/{core/sorted.eli → sorted.eli} +2 -2
  445. package/stdlib/{state/atom.eli → state.eli} +137 -7
  446. package/stdlib/string.eli +362 -0
  447. package/stdlib/tap.eli +135 -0
  448. package/stdlib/test.eli +566 -0
  449. package/stdlib/time.eli +419 -0
  450. package/stdlib/{core/transducer.eli → transducer.eli} +4 -2
  451. package/stdlib/{core/transient.eli → transient.eli} +11 -5
  452. package/stdlib/{core/type.eli → type.eli} +2 -2
  453. package/stdlib/uuid.eli +288 -0
  454. package/stdlib/{core/walk.eli → walk.eli} +6 -6
  455. package/stdlib/{gepo.eli → wire/gepo.eli} +2 -2
  456. package/stdlib/{mdp.eli → wire/mdp.eli} +2 -2
  457. package/stdlib/{mds.eli → wire/mds.eli} +2 -2
  458. package/stdlib/{core/zipper.eli → zipper.eli} +179 -138
  459. package/tests/helpers/wasm-managed-math-node.mjs +495 -582
  460. package/tools/acceptance/check-ground.mjs +106 -132
  461. package/tools/acceptance/check.mjs +16 -16
  462. package/tools/acceptance/retained-performance-snapshot.mjs +265 -149
  463. package/tools/acceptance/retained-soak.mjs +5 -7
  464. package/tools/acceptance/retained-transient.mjs +5 -7
  465. package/tools/backends/build.mjs +373 -95
  466. package/tools/backends/compiler-bootstrap.mjs +271 -317
  467. package/tools/backends/compiler-browser.mjs +7 -9
  468. package/tools/backends/compiler-build.mjs +77 -97
  469. package/tools/backends/compiler-cli-ground.mjs +47 -47
  470. package/tools/backends/compiler-data-transport.mjs +27 -31
  471. package/tools/backends/compiler-host-iteration.mjs +13 -21
  472. package/tools/backends/compiler-host-record.mjs +28 -34
  473. package/tools/backends/compiler-metadata.mjs +145 -53
  474. package/tools/backends/compiler-package-ground.mjs +39 -47
  475. package/tools/backends/compiler-package-loader.mjs +164 -206
  476. package/tools/backends/compiler-session.mjs +432 -324
  477. package/tools/backends/compiler-worker.mjs +79 -89
  478. package/tools/backends/dist/bootstrap-js-stages.mjs +17 -19
  479. package/tools/backends/dist/bootstrap-js-stages.mjs.map +1 -1
  480. package/tools/backends/dist/managed-ir-inventory.mjs +1 -1
  481. package/tools/backends/dist/managed-ir-inventory.mjs.map +1 -1
  482. package/tools/backends/dist/release-cli.mjs +151 -22
  483. package/tools/backends/dist/release-cli.mjs.map +1 -1
  484. package/tools/backends/dist/run-artifact.mjs +54 -76
  485. package/tools/backends/dist/run-artifact.mjs.map +1 -1
  486. package/tools/backends/managed-foreign-binding.mjs +370 -114
  487. package/tools/backends/managed-host-ground.mjs +14 -17
  488. package/tools/backends/managed-host-lifecycle.mjs +42 -53
  489. package/tools/backends/managed-host-object-realm.mjs +121 -111
  490. package/tools/backends/managed-host-proxy.mjs +5 -7
  491. package/tools/backends/managed-host-runtime.mjs +6295 -4350
  492. package/tools/backends/managed-host.mjs +234 -188
  493. package/tools/backends/managed-layout.mjs +53 -56
  494. package/tools/backends/managed-module-graph-ground.mjs +488 -568
  495. package/tools/backends/managed-module-graph.mjs +62 -76
  496. package/tools/backends/managed-runtime-host-ground.mjs +352 -400
  497. package/tools/backends/managed-runtime.mjs +227 -266
  498. package/tools/backends/managed-source-view-ground.mjs +165 -161
  499. package/tools/backends/managed-source-view.mjs +415 -154
  500. package/tools/backends/native-managed-runtime.mjs +96 -138
  501. package/tools/backends/native-memory.mjs +1122 -742
  502. package/tools/backends/native-node-ffi.mjs +2439 -0
  503. package/tools/backends/native-node-memory.mjs +793 -383
  504. package/tools/backends/native-node-runner.mjs +1458 -579
  505. package/tools/backends/native-node-watchdog.mjs +12 -14
  506. package/tools/backends/native-node-worker.mjs +46 -50
  507. package/tools/backends/stage3-targets.mjs +2 -2
  508. package/tools/bootstrap-runtime.el +4 -4
  509. package/tools/collections/transient-builder-benchmark.mjs +17 -17
  510. package/tools/project/check-cli.eli +27 -3
  511. package/tools/project/project-cli.eli +1 -1
  512. package/tools/testing/maintained-suite-source.mjs +5 -7
  513. package/tools/testing/maintained-suite-source.mjs.map +1 -1
  514. package/dist/literal-sources/stdlib/core/data.eli +0 -306
  515. package/dist/literal-sources/stdlib/managed-transient-state.eli +0 -353
  516. package/stdlib/core/data-text.eli +0 -16
  517. package/stdlib/core/data.eli +0 -306
  518. package/stdlib/core/identifier.eli +0 -32
  519. package/stdlib/core/regex.eli +0 -17
  520. package/stdlib/deferred.eli +0 -70
  521. package/stdlib/managed-runtime-lazy-sequence.eli +0 -157
  522. package/stdlib/managed-transient-state.eli +0 -353
  523. /package/{stdlib → runtime/managed}/managed-protocol-error.eli +0 -0
  524. /package/{stdlib → runtime/managed}/managed-runtime-literals.eli +0 -0
  525. /package/{stdlib → runtime/managed}/managed-runtime-truth.eli +0 -0
  526. /package/{stdlib → runtime/managed}/managed-testing-value.eli +0 -0
@@ -8,6 +8,13 @@ function __eliscript_tdz_write_3(__eliscript_tdz_value_3) { if (__eliscript_tdz_
8
8
  var __eliscript_tdz_ready_4;
9
9
  var __eliscript_tdz_ready_5;
10
10
  var __eliscript_tdz_ready_6;
11
+ var __eliscript_tdz_ready_7;
12
+ function __eliscript_tdz_write_7(__eliscript_tdz_value_7) { if (__eliscript_tdz_ready_7 !== true) __eliscript_tdz_error("next_runtime_id"); return (next_runtime_id = __eliscript_tdz_value_7); }
13
+ var __eliscript_tdz_ready_8;
14
+ var __eliscript_tdz_ready_9;
15
+ var __eliscript_tdz_ready_10;
16
+ var __eliscript_tdz_ready_11;
17
+ var __eliscript_tdz_ready_12;
11
18
  import "eliscript/runtime/unicode-case.mjs";
12
19
  import "eliscript/runtime/math.mjs";
13
20
  import { __eliscript_at, __eliscript_at_direct, __eliscript_to_number, __eliscript_numeric_decrement, __eliscript_numeric_relation, __eliscript_numeric_sub, __eliscript_numeric_mul, __eliscript_numeric_div, __eliscript_numeric_rem, __eliscript_numeric_and, __eliscript_numeric_or, __eliscript_numeric_xor, __eliscript_numeric_shl, __eliscript_numeric_shr, __eliscript_numeric_ushr, __eliscript_numeric_neg, __eliscript_numeric_int32, __eliscript_numeric_uint32, __eliscript_numeric_not, __eliscript_numeric_imul } from "eliscript/runtime/prelude.mjs";
@@ -15,7 +22,7 @@ import { stringToBigint as __eliscript_string_to_bigint, float64Words as __elisc
15
22
  import { valueType as __eliscript_value_type } from "eliscript/runtime/primitives.mjs";
16
23
  const __eliscript_truthy = (value) => value !== false && value != null;
17
24
 
18
- import {backend_fail, find_function} from "./numeric.mjs";
25
+ import {backend_fail, find_function, runtime_body_cache_set, mark_trusted_runtime_program} from "./numeric.mjs";
19
26
  import {lower_async_program} from "./async.mjs";
20
27
  import {prepare_host_capabilities} from "./capabilities.mjs";
21
28
  import {validate_serializable_program} from "../bootstrap/ir.mjs";
@@ -36,20 +43,522 @@ __eliscript_tdz_ready_2 = true;
36
43
  let canonical_string_hash_templates = null;
37
44
  __eliscript_tdz_ready_3 = true;
38
45
  function managed_fail(node, message) {
39
- return (() => {
40
- try {
41
- return backend_fail(node, message);
42
- } catch (error) {
43
- (((error)["eliscriptDiagnostic"])["phase"] = "managed-backend");
44
- return ((__eliscript_value_1) => { throw __eliscript_value_1; })(error);
45
- }
46
- })();
46
+ try {
47
+ return backend_fail(node, message);
48
+ } catch (error) {
49
+ (((error)["eliscriptDiagnostic"])["phase"] = "managed-backend");
50
+ return ((__eliscript_value_1) => { throw __eliscript_value_1; })(error);
51
+ }
47
52
  }
48
53
  function word_node(kind, children, value) {
49
54
  return ({"kind": kind, "type": ((kind === "host-call") ? "v64" : "u32"), "children": children, "value": value});
50
55
  }
51
56
  const managed_static_images = new (globalThis.WeakMap)();
52
57
  __eliscript_tdz_ready_4 = true;
58
+ const lowered_memory_runtime_cache = new (globalThis.WeakMap)();
59
+ __eliscript_tdz_ready_5 = true;
60
+ const unfrozen_memory_runtime_cache = new (globalThis.WeakMap)();
61
+ __eliscript_tdz_ready_6 = true;
62
+ let next_runtime_id = 1;
63
+ __eliscript_tdz_ready_7 = true;
64
+ const runtime_memory_access_ops = new (globalThis.Set)(["load-u8", "load-u16", "load-u32", "load-f64", "load-v64", "load-bits64", "store-u8", "store-u16", "store-u32", "store-f64", "store-v64", "store-bits64"]);
65
+ __eliscript_tdz_ready_8 = true;
66
+ function locals_type_sig(locals) {
67
+ {
68
+ let parts = [];
69
+ let len = ((locals) ?? []).length;
70
+ let i = 0;
71
+ while (__eliscript_numeric_relation("<", i, len)) {
72
+ (parts)["push"]((((((locals) ?? [])[i]) ?? null))["type"]);
73
+ ((i = (i + 1)));
74
+ }
75
+ return __eliscript_at_direct(parts, "join", ",");
76
+ }
77
+ }
78
+ function deep_freeze_runtime_body(body) {
79
+ {
80
+ let seen = new (globalThis.Set)();
81
+ let stack = [body];
82
+ while (__eliscript_numeric_relation(">", ((stack) ?? []).length, 0)) {
83
+ {
84
+ let node = (stack)["pop"]();
85
+ if ((!((node === null)) && (__eliscript_value_type(node) === "object") && !(__eliscript_truthy((seen)["has"](node))))) {
86
+ (seen)["add"](node);
87
+ {
88
+ let children = ((node)["children"] ?? null);
89
+ let param_types = ((node)["parameterTypes"] ?? null);
90
+ let props = ((node)["properties"] ?? null);
91
+ let kind = ((node)["kind"] ?? null);
92
+ let val = ((node)["value"] ?? null);
93
+ if (__eliscript_truthy(Array.isArray(children))) {
94
+ {
95
+ let ci = 0;
96
+ let clen = ((children) ?? []).length;
97
+ while (__eliscript_numeric_relation("<", ci, clen)) {
98
+ (stack)["push"](((((children) ?? [])[ci]) ?? null));
99
+ ((ci = (ci + 1)));
100
+ }
101
+ }
102
+ Object.freeze(children);
103
+ }
104
+ if (__eliscript_truthy(Array.isArray(param_types))) {
105
+ Object.freeze(param_types);
106
+ }
107
+ if ((!((props === null)) && (__eliscript_value_type(props) === "object"))) {
108
+ Object.freeze(props);
109
+ }
110
+ if (((kind === "literal") && !((val === null)) && (__eliscript_value_type(val) === "object"))) {
111
+ Object.freeze(val);
112
+ }
113
+ Object.freeze(node);
114
+ }
115
+ }
116
+ }
117
+ }
118
+ return body;
119
+ }
120
+ }
121
+ const runtime_hot_leaf_names = new (globalThis.Set)(["heap-block", "rt-root-scope-set-abs", "rt-root-scope-get-abs", "heap-ro-block", "heap-value-valid", "value-number-bits", "heap-number-from-word"]);
122
+ __eliscript_tdz_ready_9 = true;
123
+ function inspect_runtime_body(body, fn_index, fn_count, arity, locals, runtime_id, fn_name = null) {
124
+ {
125
+ let has_indirect = false;
126
+ let has_host_call = false;
127
+ let has_data_text = false;
128
+ let has_memory_access = false;
129
+ let call_count = 0;
130
+ let has_self_call = false;
131
+ let has_loop = false;
132
+ let max_call_target = -1;
133
+ let node_count = 0;
134
+ let hot_leaf = ((__eliscript_value_2) => (__eliscript_truthy(__eliscript_value_2) ? ((__eliscript_tdz_ready_9 === true ? runtime_hot_leaf_names : __eliscript_tdz_error("runtime_hot_leaf_names")))["has"](fn_name) : __eliscript_value_2))((__eliscript_value_type(fn_name) === "string"));
135
+ let stack = [body];
136
+ while (__eliscript_numeric_relation(">", ((stack) ?? []).length, 0)) {
137
+ {
138
+ let node = (stack)["pop"]();
139
+ if ((!((node === null)) && (__eliscript_value_type(node) === "object"))) {
140
+ ((node_count = (node_count + 1)));
141
+ {
142
+ let kind = ((node)["kind"] ?? null);
143
+ let children = ((node)["children"] ?? null);
144
+ if ((kind === "call")) {
145
+ ((call_count = (call_count + 1)));
146
+ {
147
+ let target = ((node)["value"] ?? null);
148
+ if ((__eliscript_value_type(target) === "number")) {
149
+ if ((target === fn_index)) {
150
+ ((has_self_call = true));
151
+ }
152
+ ((max_call_target = Math.max(max_call_target, target)));
153
+ }
154
+ }
155
+ } else {
156
+ if ((kind === "call-indirect")) {
157
+ ((has_indirect = true));
158
+ } else {
159
+ if ((kind === "host-call")) {
160
+ ((has_host_call = true));
161
+ } else {
162
+ if (((kind === "data-text") || (kind === "memory-data-copy"))) {
163
+ ((has_data_text = true));
164
+ } else {
165
+ if (((kind === "while") || (kind === "remainder-while") || (kind === "guarded-while"))) {
166
+ ((has_loop = true));
167
+ } else {
168
+ if (((kind === "memory-op") && __eliscript_truthy(((__eliscript_tdz_ready_8 === true ? runtime_memory_access_ops : __eliscript_tdz_error("runtime_memory_access_ops")))["has"](((node)["value"] ?? null))))) {
169
+ ((has_memory_access = true));
170
+ } else {
171
+
172
+ }
173
+ }
174
+ }
175
+ }
176
+ }
177
+ }
178
+ if (__eliscript_truthy(Array.isArray(children))) {
179
+ {
180
+ let ci = 0;
181
+ let clen = ((children) ?? []).length;
182
+ while (__eliscript_numeric_relation("<", ci, clen)) {
183
+ (stack)["push"](((((children) ?? [])[ci]) ?? null));
184
+ ((ci = (ci + 1)));
185
+ }
186
+ }
187
+ }
188
+ }
189
+ }
190
+ }
191
+ }
192
+ {
193
+ let can_freeze = ((!__eliscript_truthy(has_indirect)) && (!__eliscript_truthy(has_host_call)));
194
+ if (__eliscript_truthy(can_freeze)) {
195
+ deep_freeze_runtime_body(body);
196
+ }
197
+ return ({"runtimeId": runtime_id, "runtimeFnCount": fn_count, "fnIndex": fn_index, "arity": arity, "localsSig": locals_type_sig(locals), "hasIndirect": has_indirect, "hasHostCall": has_host_call, "hasDataText": has_data_text, "hasMemoryAccess": has_memory_access, "maxCallTarget": max_call_target, "leafCandidate": ((__eliscript_numeric_relation("<=", ((locals) ?? []).length, 12) && __eliscript_numeric_relation("<=", node_count, (__eliscript_truthy(hot_leaf) ? 120 : 52)) && __eliscript_numeric_relation("<=", call_count, (__eliscript_truthy(hot_leaf) ? 4 : 3)) && !(__eliscript_truthy(has_self_call)) && __eliscript_numeric_relation("<", max_call_target, fn_count) && !(__eliscript_truthy(has_indirect)) && !(__eliscript_truthy(has_host_call)) && !(__eliscript_truthy(has_loop)) && !(__eliscript_truthy(has_data_text))) ? node_count : -1), "frozen": can_freeze, "wasmValidated": false, "nativeValidated": false, "wasmBodies": new (globalThis.Map)(), "nativeBodies": new (globalThis.Map)()});
198
+ }
199
+ }
200
+ }
201
+ function register_lowered_runtime_bodies(lowered) {
202
+ {
203
+ let functions = ((lowered)["functions"] ?? []);
204
+ let len = ((functions) ?? []).length;
205
+ let runtime_id = (__eliscript_tdz_ready_7 === true ? next_runtime_id : __eliscript_tdz_error("next_runtime_id"));
206
+ let i = 0;
207
+ (__eliscript_tdz_write_7(((__eliscript_tdz_ready_7 === true ? next_runtime_id : __eliscript_tdz_error("next_runtime_id")) + 1)));
208
+ while (__eliscript_numeric_relation("<", i, len)) {
209
+ {
210
+ let fn = ((((functions) ?? [])[i]) ?? null);
211
+ if (__eliscript_truthy(fn)) {
212
+ runtime_body_cache_set(((fn)["body"] ?? null), inspect_runtime_body(((fn)["body"] ?? null), i, len, (fn)["arity"], (fn)["locals"], runtime_id, ((fn)["name"] ?? null)));
213
+ }
214
+ }
215
+ ((i = (i + 1)));
216
+ }
217
+ return null;
218
+ }
219
+ }
220
+ const ir_fingerprint_strings = new (globalThis.Map)();
221
+ __eliscript_tdz_ready_10 = true;
222
+ function ir_string_id(s) {
223
+ {
224
+ let existing = ((__eliscript_tdz_ready_10 === true ? ir_fingerprint_strings : __eliscript_tdz_error("ir_fingerprint_strings")))["get"](s);
225
+ if (!((existing === undefined))) {
226
+ return existing;
227
+ } else {
228
+ {
229
+ let slen = ((s) ?? []).length;
230
+ let h = __eliscript_numeric_uint32((slen + 2166136261));
231
+ let si = 0;
232
+ while (__eliscript_numeric_relation("<", si, slen)) {
233
+ ((h = __eliscript_numeric_ushr(__eliscript_numeric_imul(__eliscript_numeric_xor(h, (s).charCodeAt(si)), 16777619), 0)));
234
+ ((si = (si + 1)));
235
+ }
236
+ if (__eliscript_numeric_relation("<", ((__eliscript_tdz_ready_10 === true ? ir_fingerprint_strings : __eliscript_tdz_error("ir_fingerprint_strings")))["size"], 32768)) {
237
+ ((__eliscript_tdz_ready_10 === true ? ir_fingerprint_strings : __eliscript_tdz_error("ir_fingerprint_strings")))["set"](s, h);
238
+ }
239
+ return h;
240
+ }
241
+ }
242
+ }
243
+ }
244
+ function fingerprint_ir_program(program) {
245
+ try {
246
+ {
247
+ let h1 = 2166136261;
248
+ let h2 = 33554467;
249
+ let steps = 0;
250
+ let aborted = false;
251
+ let stack = [program];
252
+ if ((__eliscript_value_type(((program)["filename"] ?? null)) === "string")) {
253
+ {
254
+ let fid = ir_string_id((program)["filename"]);
255
+ ((h1 = __eliscript_numeric_imul(__eliscript_numeric_xor(h1, fid), 16777619)), (h2 = __eliscript_numeric_imul(__eliscript_numeric_xor(h2, fid), 2246822507)));
256
+ }
257
+ }
258
+ while ((!(__eliscript_truthy(aborted)) && __eliscript_numeric_relation(">", ((stack) ?? []).length, 0))) {
259
+ ((steps = (steps + 1)));
260
+ if (__eliscript_numeric_relation(">", steps, 2000000)) {
261
+ ((aborted = true));
262
+ } else {
263
+ {
264
+ let cur = (stack)["pop"]();
265
+ if ((cur === null)) {
266
+ ((h1 = __eliscript_numeric_imul(__eliscript_numeric_xor(h1, 1), 16777619)), (h2 = __eliscript_numeric_imul(__eliscript_numeric_xor(h2, 1), 2246822507)));
267
+ } else {
268
+ if ((cur === undefined)) {
269
+ ((h1 = __eliscript_numeric_imul(__eliscript_numeric_xor(h1, 2), 16777619)), (h2 = __eliscript_numeric_imul(__eliscript_numeric_xor(h2, 2), 2246822507)));
270
+ } else {
271
+ {
272
+ let vt = __eliscript_value_type(cur);
273
+ if ((vt === "string")) {
274
+ {
275
+ let sid = ir_string_id(cur);
276
+ ((h1 = __eliscript_numeric_imul(__eliscript_numeric_xor(h1, sid), 16777619)), (h2 = __eliscript_numeric_imul(__eliscript_numeric_xor(h2, (sid + 3)), 2246822507)));
277
+ }
278
+ } else {
279
+ if ((vt === "number")) {
280
+ if ((__eliscript_truthy(Number.isInteger(cur)) && __eliscript_numeric_relation(">=", cur, -2147483648) && __eliscript_numeric_relation("<=", cur, 2147483647))) {
281
+ {
282
+ let nv = (__eliscript_truthy(Object.is(cur, __eliscript_numeric_neg(0))) ? 4294967299 : (cur + 2147483649));
283
+ ((h1 = __eliscript_numeric_imul(__eliscript_numeric_xor(h1, nv), 16777619)), (h2 = __eliscript_numeric_imul(__eliscript_numeric_xor(h2, (nv + 4)), 2246822507)));
284
+ }
285
+ } else {
286
+ if (__eliscript_truthy(Number.isNaN(cur))) {
287
+ ((h1 = __eliscript_numeric_imul(__eliscript_numeric_xor(h1, 999), 16777619)), (h2 = __eliscript_numeric_imul(__eliscript_numeric_xor(h2, 999), 2246822507)));
288
+ } else {
289
+ {
290
+ let words = __eliscript_number_float64_words(cur);
291
+ ((h1 = __eliscript_numeric_imul(__eliscript_numeric_xor(h1, ((((words) ?? [])[0]) ?? null)), 16777619)), (h2 = __eliscript_numeric_imul(__eliscript_numeric_xor(h2, ((((words) ?? [])[1]) ?? null)), 2246822507)));
292
+ }
293
+ }
294
+ }
295
+ } else {
296
+ if ((vt === "boolean")) {
297
+ {
298
+ let bv = (__eliscript_truthy(cur) ? 5 : 6);
299
+ ((h1 = __eliscript_numeric_imul(__eliscript_numeric_xor(h1, bv), 16777619)), (h2 = __eliscript_numeric_imul(__eliscript_numeric_xor(h2, bv), 2246822507)));
300
+ }
301
+ } else {
302
+ if ((vt === "bigint")) {
303
+ {
304
+ let bid = ir_string_id(globalThis.String(cur));
305
+ ((h1 = __eliscript_numeric_imul(__eliscript_numeric_xor(h1, (bid + 10)), 16777619)), (h2 = __eliscript_numeric_imul(__eliscript_numeric_xor(h2, (bid + 10)), 2246822507)));
306
+ }
307
+ } else {
308
+ if (__eliscript_truthy(Array.isArray(cur))) {
309
+ {
310
+ let alen = ((cur) ?? []).length;
311
+ let ai = __eliscript_numeric_decrement(alen);
312
+ ((h1 = __eliscript_numeric_imul(__eliscript_numeric_xor(h1, (alen + 7)), 16777619)), (h2 = __eliscript_numeric_imul(__eliscript_numeric_xor(h2, (alen + 7)), 2246822507)));
313
+ while (__eliscript_numeric_relation(">=", ai, 0)) {
314
+ {
315
+ let elem = ((((cur) ?? [])[ai]) ?? null);
316
+ if ((__eliscript_value_type(elem) === "string")) {
317
+ {
318
+ let sid = ir_string_id(elem);
319
+ ((h1 = __eliscript_numeric_imul(__eliscript_numeric_xor(h1, sid), 16777619)), (h2 = __eliscript_numeric_imul(__eliscript_numeric_xor(h2, (sid + 3)), 2246822507)));
320
+ }
321
+ } else {
322
+ if ((__eliscript_value_type(elem) === "number")) {
323
+ if ((__eliscript_truthy(Number.isInteger(elem)) && __eliscript_numeric_relation(">=", elem, -2147483648) && __eliscript_numeric_relation("<=", elem, 2147483647))) {
324
+ {
325
+ let nv = (__eliscript_truthy(Object.is(elem, __eliscript_numeric_neg(0))) ? 4294967299 : (elem + 2147483649));
326
+ ((h1 = __eliscript_numeric_imul(__eliscript_numeric_xor(h1, nv), 16777619)), (h2 = __eliscript_numeric_imul(__eliscript_numeric_xor(h2, (nv + 4)), 2246822507)));
327
+ }
328
+ } else {
329
+ (stack)["push"](elem);
330
+ }
331
+ } else {
332
+ (stack)["push"](elem);
333
+ }
334
+ }
335
+ }
336
+ ((ai = __eliscript_numeric_decrement(ai)));
337
+ }
338
+ }
339
+ } else {
340
+ if ((vt === "object")) {
341
+ ((h1 = __eliscript_numeric_imul(__eliscript_numeric_xor(h1, 8), 16777619)), (h2 = __eliscript_numeric_imul(__eliscript_numeric_xor(h2, 8), 2246822507)));
342
+ {
343
+ let k = ((cur)["kind"] ?? undefined);
344
+ if (!((k === undefined))) {
345
+ if ((__eliscript_value_type(k) === "string")) {
346
+ {
347
+ let sid = ir_string_id(k);
348
+ ((h1 = __eliscript_numeric_imul(__eliscript_numeric_xor(h1, sid), 16777619)), (h2 = __eliscript_numeric_imul(__eliscript_numeric_xor(h2, (sid + 3)), 2246822507)));
349
+ }
350
+ } else {
351
+ (stack)["push"](k);
352
+ }
353
+ }
354
+ }
355
+ {
356
+ let v = ((cur)["value"] ?? undefined);
357
+ if ((v === undefined)) {
358
+ if (__eliscript_truthy(Object.hasOwn(cur, "value"))) {
359
+ ((h1 = __eliscript_numeric_imul(__eliscript_numeric_xor(h1, 2), 16777619)), (h2 = __eliscript_numeric_imul(__eliscript_numeric_xor(h2, 2), 2246822507)));
360
+ }
361
+ } else {
362
+ if ((v === null)) {
363
+ ((h1 = __eliscript_numeric_imul(__eliscript_numeric_xor(h1, 1), 16777619)), (h2 = __eliscript_numeric_imul(__eliscript_numeric_xor(h2, 1), 2246822507)));
364
+ } else {
365
+ if ((__eliscript_value_type(v) === "string")) {
366
+ {
367
+ let sid = ir_string_id(v);
368
+ ((h1 = __eliscript_numeric_imul(__eliscript_numeric_xor(h1, sid), 16777619)), (h2 = __eliscript_numeric_imul(__eliscript_numeric_xor(h2, (sid + 3)), 2246822507)));
369
+ }
370
+ } else {
371
+ if ((__eliscript_value_type(v) === "number")) {
372
+ if ((__eliscript_truthy(Number.isInteger(v)) && __eliscript_numeric_relation(">=", v, -2147483648) && __eliscript_numeric_relation("<=", v, 2147483647))) {
373
+ {
374
+ let nv = (__eliscript_truthy(Object.is(v, __eliscript_numeric_neg(0))) ? 4294967299 : (v + 2147483649));
375
+ ((h1 = __eliscript_numeric_imul(__eliscript_numeric_xor(h1, nv), 16777619)), (h2 = __eliscript_numeric_imul(__eliscript_numeric_xor(h2, (nv + 4)), 2246822507)));
376
+ }
377
+ } else {
378
+ (stack)["push"](v);
379
+ }
380
+ } else {
381
+ if ((__eliscript_value_type(v) === "boolean")) {
382
+ {
383
+ let bv = (__eliscript_truthy(v) ? 5 : 6);
384
+ ((h1 = __eliscript_numeric_imul(__eliscript_numeric_xor(h1, bv), 16777619)), (h2 = __eliscript_numeric_imul(__eliscript_numeric_xor(h2, bv), 2246822507)));
385
+ }
386
+ } else {
387
+ (stack)["push"](v);
388
+ }
389
+ }
390
+ }
391
+ }
392
+ }
393
+ }
394
+ {
395
+ let tp = ((cur)["type"] ?? undefined);
396
+ if (!((tp === undefined))) {
397
+ if ((__eliscript_value_type(tp) === "string")) {
398
+ {
399
+ let sid = ir_string_id(tp);
400
+ ((h1 = __eliscript_numeric_imul(__eliscript_numeric_xor(h1, sid), 16777619)), (h2 = __eliscript_numeric_imul(__eliscript_numeric_xor(h2, (sid + 3)), 2246822507)));
401
+ }
402
+ } else {
403
+ (stack)["push"](tp);
404
+ }
405
+ }
406
+ }
407
+ {
408
+ let fn = ((cur)["filename"] ?? undefined);
409
+ if (!((fn === undefined))) {
410
+ if ((__eliscript_value_type(fn) === "string")) {
411
+ {
412
+ let sid = ir_string_id(fn);
413
+ ((h1 = __eliscript_numeric_imul(__eliscript_numeric_xor(h1, sid), 16777619)), (h2 = __eliscript_numeric_imul(__eliscript_numeric_xor(h2, (sid + 3)), 2246822507)));
414
+ }
415
+ } else {
416
+ (stack)["push"](fn);
417
+ }
418
+ }
419
+ }
420
+ {
421
+ let props = ((cur)["properties"] ?? null);
422
+ if ((__eliscript_truthy(props) && (__eliscript_value_type(props) === "object"))) {
423
+ {
424
+ let pkeys = Object.keys(props);
425
+ let pi = 0;
426
+ ((h1 = __eliscript_numeric_imul(__eliscript_numeric_xor(h1, (((pkeys) ?? []).length + 9)), 16777619)), (h2 = __eliscript_numeric_imul(__eliscript_numeric_xor(h2, (((pkeys) ?? []).length + 9)), 2246822507)));
427
+ while (__eliscript_numeric_relation("<", pi, ((pkeys) ?? []).length)) {
428
+ {
429
+ let pk = ((((pkeys) ?? [])[pi]) ?? null);
430
+ let kid = ir_string_id(pk);
431
+ ((h1 = __eliscript_numeric_imul(__eliscript_numeric_xor(h1, kid), 16777619)), (h2 = __eliscript_numeric_imul(__eliscript_numeric_xor(h2, kid), 2246822507)));
432
+ (stack)["push"]((props)[pk]);
433
+ }
434
+ ((pi = (pi + 1)));
435
+ }
436
+ }
437
+ }
438
+ }
439
+ {
440
+ let span = ((cur)["span"] ?? null);
441
+ if ((__eliscript_truthy(span) && (__eliscript_value_type(span) === "object"))) {
442
+ {
443
+ let sl = ((__eliscript_value_3) => (__eliscript_truthy(__eliscript_value_3) ? __eliscript_value_3 : 0))(((span)["line"] ?? 0));
444
+ let sc = ((__eliscript_value_4) => (__eliscript_truthy(__eliscript_value_4) ? __eliscript_value_4 : 0))(((span)["column"] ?? 0));
445
+ ((h1 = __eliscript_numeric_imul(__eliscript_numeric_xor(h1, (sl + sc)), 16777619)), (h2 = __eliscript_numeric_imul(__eliscript_numeric_xor(h2, (sl + sc)), 2246822507)));
446
+ }
447
+ }
448
+ }
449
+ {
450
+ let ch = ((cur)["children"] ?? undefined);
451
+ if (!((ch === undefined))) {
452
+ if (__eliscript_truthy(Array.isArray(ch))) {
453
+ {
454
+ let clen = ((ch) ?? []).length;
455
+ let ci = __eliscript_numeric_decrement(clen);
456
+ ((h1 = __eliscript_numeric_imul(__eliscript_numeric_xor(h1, (clen + 7)), 16777619)), (h2 = __eliscript_numeric_imul(__eliscript_numeric_xor(h2, (clen + 7)), 2246822507)));
457
+ while (__eliscript_numeric_relation(">=", ci, 0)) {
458
+ (stack)["push"](((((ch) ?? [])[ci]) ?? null));
459
+ ((ci = __eliscript_numeric_decrement(ci)));
460
+ }
461
+ }
462
+ } else {
463
+ (stack)["push"](ch);
464
+ }
465
+ }
466
+ }
467
+ {
468
+ let bd = ((cur)["body"] ?? undefined);
469
+ if (!((bd === undefined))) {
470
+ (stack)["push"](bd);
471
+ }
472
+ }
473
+ } else {
474
+ ((aborted = true));
475
+ }
476
+ }
477
+ }
478
+ }
479
+ }
480
+ }
481
+ }
482
+ }
483
+ }
484
+ }
485
+ }
486
+ }
487
+ if (__eliscript_truthy(aborted)) {
488
+ return null;
489
+ } else {
490
+ return (String(__eliscript_numeric_ushr(h1, 0)) + String(":") + String(__eliscript_numeric_ushr(h2, 0)));
491
+ }
492
+ }
493
+ } catch (error) {
494
+ return null;
495
+ }
496
+ }
497
+ function clone_lowered_memory_runtime(lowered) {
498
+ {
499
+ let copy = ({"abi": (lowered)["abi"], "filename": (lowered)["filename"], "functions": ((lowered)["functions"])["map"](((fn) => {
500
+ return Object.assign(({}), fn, ({"locals": ((fn)["locals"])["slice"](), "parameterTypes": ((fn)["parameterTypes"])["slice"]()}));
501
+ })), "exports": ((lowered)["exports"])["slice"]()});
502
+ if (__eliscript_truthy(((lowered)["table"] ?? null))) {
503
+ ((copy)["table"] = ((lowered)["table"])["slice"]());
504
+ }
505
+ if (__eliscript_truthy(((lowered)["indirectSignatures"] ?? null))) {
506
+ ((copy)["indirectSignatures"] = ((lowered)["indirectSignatures"])["map"](((sig) => {
507
+ return Object.assign(({}), sig, ({"parameterTypes": ((sig)["parameterTypes"])["slice"]()}));
508
+ })));
509
+ }
510
+ return copy;
511
+ }
512
+ }
513
+ function cached_lower_memory_program(runtime_program) {
514
+ if (((runtime_program === null) || !((__eliscript_value_type(runtime_program) === "object")))) {
515
+ return lower_memory_program(runtime_program);
516
+ } else {
517
+ if (__eliscript_truthy(Object.isFrozen(runtime_program))) {
518
+ {
519
+ let cached = ((__eliscript_tdz_ready_5 === true ? lowered_memory_runtime_cache : __eliscript_tdz_error("lowered_memory_runtime_cache")))["get"](runtime_program);
520
+ if ((!__eliscript_truthy(cached))) {
521
+ ((cached = lower_memory_program(runtime_program)));
522
+ register_lowered_runtime_bodies(cached);
523
+ ((__eliscript_tdz_ready_5 === true ? lowered_memory_runtime_cache : __eliscript_tdz_error("lowered_memory_runtime_cache")))["set"](runtime_program, cached);
524
+ }
525
+ return clone_lowered_memory_runtime(cached);
526
+ }
527
+ } else {
528
+ {
529
+ let entry = ((__eliscript_tdz_ready_6 === true ? unfrozen_memory_runtime_cache : __eliscript_tdz_error("unfrozen_memory_runtime_cache")))["get"](runtime_program);
530
+ if (__eliscript_truthy(entry)) {
531
+ {
532
+ let hash = fingerprint_ir_program(runtime_program);
533
+ if ((!((hash === null)) && ((entry)["hash"] === hash))) {
534
+ return clone_lowered_memory_runtime((entry)["lowered"]);
535
+ } else {
536
+ {
537
+ let lowered = lower_memory_program(runtime_program);
538
+ let next_hash = fingerprint_ir_program(runtime_program);
539
+ register_lowered_runtime_bodies(lowered);
540
+ if (!((next_hash === null))) {
541
+ ((__eliscript_tdz_ready_6 === true ? unfrozen_memory_runtime_cache : __eliscript_tdz_error("unfrozen_memory_runtime_cache")))["set"](runtime_program, ({"hash": next_hash, "lowered": lowered}));
542
+ }
543
+ return clone_lowered_memory_runtime(lowered);
544
+ }
545
+ }
546
+ }
547
+ } else {
548
+ {
549
+ let lowered = lower_memory_program(runtime_program);
550
+ let hash = fingerprint_ir_program(runtime_program);
551
+ register_lowered_runtime_bodies(lowered);
552
+ if (!((hash === null))) {
553
+ ((__eliscript_tdz_ready_6 === true ? unfrozen_memory_runtime_cache : __eliscript_tdz_error("unfrozen_memory_runtime_cache")))["set"](runtime_program, ({"hash": hash, "lowered": lowered}));
554
+ }
555
+ return clone_lowered_memory_runtime(lowered);
556
+ }
557
+ }
558
+ }
559
+ }
560
+ }
561
+ }
53
562
  function managed_static_image(state) {
54
563
  {
55
564
  let image = ((__eliscript_tdz_ready_4 === true ? managed_static_images : __eliscript_tdz_error("managed_static_images")))["get"]((state)["runtime"]);
@@ -290,13 +799,11 @@ function managed_binding_key(name) {
290
799
  if (!((__eliscript_value_type(name) === "string"))) {
291
800
  return name;
292
801
  } else {
293
- return (() => {
294
- try {
295
- return binding_name(name);
296
- } catch (error) {
297
- return name;
298
- }
299
- })();
802
+ try {
803
+ return binding_name(name);
804
+ } catch (error) {
805
+ return name;
806
+ }
300
807
  }
301
808
  }
302
809
  function find_local(scope, name) {
@@ -355,7 +862,7 @@ function runtime_arguments(state, values) {
355
862
  }
356
863
  }
357
864
  function capture_error(state) {
358
- return managed_guard(state, word_set((state)["error"], runtime_call(state, "last-error", [])));
865
+ return managed_guard(state, word_set((state)["error"], word_node("memory-op", [word_constant(8)], "load-u32")));
359
866
  }
360
867
  function managed_guard(state, expression) {
361
868
  {
@@ -381,9 +888,12 @@ function managed_effect_result(state, name, arguments$) {
381
888
  function managed_private_roots_p(state) {
382
889
  return (((state)["privateRoots"] ?? null) === true);
383
890
  }
891
+ function managed_root_set_at(state, base_local, offset, value) {
892
+ return checked_control(state, "rt-root-scope-set-abs", runtime_arguments(state, [((offset === 0) ? word_local(base_local) : managed_raw_binary(word_local(base_local), word_constant(offset), "+")), value]));
893
+ }
384
894
  function managed_root_set(state, index, value) {
385
895
  if (__eliscript_truthy(managed_private_roots_p(state))) {
386
- return checked_control(state, "root-scope-set-abs", runtime_arguments(state, [managed_raw_binary(word_local((state)["functionBase"]), word_constant(index), "+"), value]));
896
+ return managed_root_set_at(state, (state)["functionBase"], index, value);
387
897
  } else {
388
898
  return checked_control(state, "frame-set", runtime_arguments(state, [word_local((state)["frame"]), word_constant(index), value]));
389
899
  }
@@ -413,7 +923,7 @@ function root_local(state, local) {
413
923
  return managed_root_set(state, (local)["rootIndex"], word_local(local));
414
924
  }
415
925
  function managed_immediate_result_p(expression) {
416
- return ((__eliscript_value_2) => (__eliscript_truthy(__eliscript_value_2) ? ((__eliscript_value_3) => (__eliscript_truthy(__eliscript_value_3) ? __eliscript_value_3 : ((__eliscript_value_4) => (__eliscript_truthy(__eliscript_value_4) ? ((__eliscript_value_5) => (__eliscript_truthy(__eliscript_value_5) ? (__eliscript_numeric_relation(">=", (expression)["value"], 0) && __eliscript_numeric_relation("<=", (expression)["value"], 3)) : __eliscript_value_5))(Number.isInteger((expression)["value"])) : __eliscript_value_4))(((expression)["type"] === "u32"))))(((expression)["type"] === "v64")) : __eliscript_value_2))(((expression)["kind"] === "literal"));
926
+ return ((__eliscript_value_5) => (__eliscript_truthy(__eliscript_value_5) ? ((__eliscript_value_6) => (__eliscript_truthy(__eliscript_value_6) ? __eliscript_value_6 : ((__eliscript_value_7) => (__eliscript_truthy(__eliscript_value_7) ? ((__eliscript_value_8) => (__eliscript_truthy(__eliscript_value_8) ? (__eliscript_numeric_relation(">=", (expression)["value"], 0) && __eliscript_numeric_relation("<=", (expression)["value"], 3)) : __eliscript_value_8))(Number.isInteger((expression)["value"])) : __eliscript_value_7))(((expression)["type"] === "u32"))))(((expression)["type"] === "v64")) : __eliscript_value_5))(((expression)["kind"] === "literal"));
417
927
  }
418
928
  function managed_result(state, expression, allocating) {
419
929
  if (__eliscript_truthy(managed_immediate_result_p(expression))) {
@@ -505,7 +1015,7 @@ function managed_temporary_root_barrier_p(state, node) {
505
1015
  }
506
1016
  }
507
1017
  }
508
- return ((__eliscript_value_6) => (__eliscript_truthy(__eliscript_value_6) ? __eliscript_value_6 : ((__eliscript_value_7) => (__eliscript_truthy(__eliscript_value_7) ? __eliscript_value_7 : ((__eliscript_value_8) => (__eliscript_truthy(__eliscript_value_8) ? __eliscript_value_8 : (memo)["get"](node)))((!__eliscript_truthy((memo)["has"](node))))))((!(__eliscript_value_type(node) === "object")))))((!__eliscript_truthy(node)));
1018
+ return ((__eliscript_value_9) => (__eliscript_truthy(__eliscript_value_9) ? __eliscript_value_9 : ((__eliscript_value_10) => (__eliscript_truthy(__eliscript_value_10) ? __eliscript_value_10 : ((__eliscript_value_11) => (__eliscript_truthy(__eliscript_value_11) ? __eliscript_value_11 : (memo)["get"](node)))((!__eliscript_truthy((memo)["has"](node))))))((!(__eliscript_value_type(node) === "object")))))((!__eliscript_truthy(node)));
509
1019
  }
510
1020
  }
511
1021
  function enter_managed_temporary_root_rhs(state, node) {
@@ -580,22 +1090,18 @@ function lower_managed_sequence(nodes, scope, state, functions) {
580
1090
  {
581
1091
  let first_temporary = managed_temporary_root_count(state);
582
1092
  let previous_barrier = enter_managed_temporary_root_rhs(state, node);
583
- (() => {
584
- try {
585
- {
586
- let lowered = lower_managed_expression(node, scope, state, functions);
587
- let end_temporary = managed_temporary_root_count(state);
588
- (steps)["push"]((lowered)["steps"]);
589
- if (__eliscript_numeric_relation(">", end_temporary, first_temporary)) {
590
- return (steps)["push"](clear_managed_temporary_roots(state, first_temporary, end_temporary));
591
- } else {
592
- return null;
593
- }
1093
+ try {
1094
+ {
1095
+ let lowered = lower_managed_expression(node, scope, state, functions);
1096
+ let end_temporary = managed_temporary_root_count(state);
1097
+ (steps)["push"]((lowered)["steps"]);
1098
+ if (__eliscript_numeric_relation(">", end_temporary, first_temporary)) {
1099
+ (steps)["push"](clear_managed_temporary_roots(state, first_temporary, end_temporary));
594
1100
  }
595
- } finally {
596
- ((state)["temporaryRootCleanupBarrier"] = previous_barrier);
597
1101
  }
598
- })();
1102
+ } finally {
1103
+ ((state)["temporaryRootCleanupBarrier"] = previous_barrier);
1104
+ }
599
1105
  }
600
1106
  } else {
601
1107
  {
@@ -621,7 +1127,7 @@ function binding_read(entry) {
621
1127
  return binding_node("binding-get", entry, []);
622
1128
  }
623
1129
  function resolve_managed_local(scope, state, name) {
624
- return ((__eliscript_value_9) => (__eliscript_truthy(__eliscript_value_9) ? __eliscript_value_9 : ((__eliscript_value_10) => (__eliscript_truthy(__eliscript_value_10) ? __eliscript_value_10 : (__eliscript_truthy(((state)["outerState"] ?? null)) ? ((source) => {
1130
+ return ((__eliscript_value_12) => (__eliscript_truthy(__eliscript_value_12) ? __eliscript_value_12 : ((__eliscript_value_13) => (__eliscript_truthy(__eliscript_value_13) ? __eliscript_value_13 : (__eliscript_truthy(((state)["outerState"] ?? null)) ? ((source) => {
625
1131
  if (__eliscript_truthy(source)) {
626
1132
  ((source)["captured"] = true);
627
1133
  {
@@ -641,7 +1147,7 @@ function resolve_managed_local(scope, state, name) {
641
1147
  })(resolve_managed_local((state)["outerScope"], (state)["outerState"], name)) : null)))(find_local((state)["captures"], name))))(find_local(scope, name));
642
1148
  }
643
1149
  function managed_lexical_this_binding(state) {
644
- return ((__eliscript_value_11) => (__eliscript_truthy(__eliscript_value_11) ? __eliscript_value_11 : ((source) => {
1150
+ return ((__eliscript_value_14) => (__eliscript_truthy(__eliscript_value_14) ? __eliscript_value_14 : ((source) => {
645
1151
  return ((entry) => {
646
1152
  return (() => {
647
1153
  ((entry)["captured"] = true);
@@ -773,10 +1279,10 @@ function finalize_managed_function_types(function$, functions, source = null) {
773
1279
  }
774
1280
  {
775
1281
  let current = id;
776
- while (((__eliscript_value_12, __eliscript_value_13) => (__eliscript_value_12 !== __eliscript_value_13))(current, ((((parents) ?? [])[current]) ?? null))) {
1282
+ while ((current !== ((((parents) ?? [])[current]) ?? null))) {
777
1283
  ((current = ((((parents) ?? [])[current]) ?? null)));
778
1284
  }
779
- while (((__eliscript_value_14, __eliscript_value_15) => (__eliscript_value_14 !== __eliscript_value_15))(id, current)) {
1285
+ while ((id !== current)) {
780
1286
  {
781
1287
  let next = ((((parents) ?? [])[id]) ?? null);
782
1288
  ((parents)[id] = current);
@@ -788,22 +1294,22 @@ function finalize_managed_function_types(function$, functions, source = null) {
788
1294
  }));
789
1295
  (fixed = ((id, type) => {
790
1296
  {
791
- const __eliscript_value_16 = root(id);
1297
+ const __eliscript_value_15 = root(id);
792
1298
  {
793
- let key = __eliscript_value_16;
1299
+ let key = __eliscript_value_15;
794
1300
  {
795
- const __eliscript_value_17 = ((type === "i32") ? "u32" : type);
1301
+ const __eliscript_value_16 = ((type === "i32") ? "u32" : type);
796
1302
  {
797
- let type = __eliscript_value_17;
1303
+ let type = __eliscript_value_16;
798
1304
  {
799
- const __eliscript_value_18 = ((((types) ?? [])[key]) ?? null);
1305
+ const __eliscript_value_17 = ((((types) ?? [])[key]) ?? null);
800
1306
  {
801
- let old = __eliscript_value_18;
1307
+ let old = __eliscript_value_17;
802
1308
  if ((!__eliscript_truthy((["u32", "f64", "v64", "bits64"])["includes"](type)))) {
803
1309
  managed_fail(null, "managed IR lacks an exact type");
804
1310
  }
805
- if ((__eliscript_truthy(old) && ((__eliscript_value_19, __eliscript_value_20) => (__eliscript_value_19 !== __eliscript_value_20))(old, type))) {
806
- managed_fail(((__eliscript_value_21) => (__eliscript_truthy(__eliscript_value_21) ? __eliscript_value_21 : (function$)["body"]))(source), (String("managed storage type conflict: ") + String(old) + String(" / ") + String(type) + String(" in ") + String((function$)["name"]) + String(" at ") + String(storage_label(id)) + String(" while checking ") + String(((active)["kind"] ?? null)) + String(":") + String(((((active)["kind"] ?? null) === "call") ? (((((functions) ?? [])[(active)["value"]]) ?? null))["name"] : ((active)["value"] ?? null)))));
1311
+ if ((__eliscript_truthy(old) && (old !== type))) {
1312
+ managed_fail(((__eliscript_value_18) => (__eliscript_truthy(__eliscript_value_18) ? __eliscript_value_18 : (function$)["body"]))(source), (String("managed storage type conflict: ") + String(old) + String(" / ") + String(type) + String(" in ") + String((function$)["name"]) + String(" at ") + String(storage_label(id)) + String(" while checking ") + String(((active)["kind"] ?? null)) + String(":") + String(((((active)["kind"] ?? null) === "call") ? (((((functions) ?? [])[(active)["value"]]) ?? null))["name"] : ((active)["value"] ?? null)))));
807
1313
  }
808
1314
  return ((types)[key] = type);
809
1315
  }
@@ -821,11 +1327,11 @@ function finalize_managed_function_types(function$, functions, source = null) {
821
1327
  {
822
1328
  let ta = ((((types) ?? [])[a]) ?? null);
823
1329
  let tb = ((((types) ?? [])[b]) ?? null);
824
- if ((__eliscript_truthy(ta) && __eliscript_truthy(tb) && ((__eliscript_value_22, __eliscript_value_23) => (__eliscript_value_22 !== __eliscript_value_23))(ta, tb))) {
825
- managed_fail(((__eliscript_value_24) => (__eliscript_truthy(__eliscript_value_24) ? __eliscript_value_24 : (function$)["body"]))(source), (String("managed storage type conflict: ") + String(ta) + String(" / ") + String(tb) + String(" in ") + String((function$)["name"]) + String(" joining ") + String(storage_label(left)) + String(" / ") + String(storage_label(right))));
1330
+ if ((__eliscript_truthy(ta) && __eliscript_truthy(tb) && (ta !== tb))) {
1331
+ managed_fail(((__eliscript_value_19) => (__eliscript_truthy(__eliscript_value_19) ? __eliscript_value_19 : (function$)["body"]))(source), (String("managed storage type conflict: ") + String(ta) + String(" / ") + String(tb) + String(" in ") + String((function$)["name"]) + String(" joining ") + String(storage_label(left)) + String(" / ") + String(storage_label(right))));
826
1332
  }
827
1333
  ((parents)[b] = a);
828
- return ((types)[a] = ((__eliscript_value_25) => (__eliscript_truthy(__eliscript_value_25) ? __eliscript_value_25 : tb))(ta));
1334
+ return ((types)[a] = ((__eliscript_value_20) => (__eliscript_truthy(__eliscript_value_20) ? __eliscript_value_20 : tb))(ta));
829
1335
  }
830
1336
  } else {
831
1337
  return null;
@@ -857,7 +1363,7 @@ function finalize_managed_function_types(function$, functions, source = null) {
857
1363
  }
858
1364
  ((active = node));
859
1365
  if ((kind === "literal")) {
860
- if (((__eliscript_value_26, __eliscript_value_27) => (__eliscript_value_26 !== __eliscript_value_27))((node)["type"], "u32")) {
1366
+ if (((node)["type"] !== "u32")) {
861
1367
  fixed(id, (node)["type"]);
862
1368
  }
863
1369
  } else {
@@ -916,11 +1422,35 @@ function finalize_managed_function_types(function$, functions, source = null) {
916
1422
  fixed(((((child_vars) ?? [])[1]) ?? null), "v64");
917
1423
  fixed(id, "v64");
918
1424
  } else {
919
- fixed(id, (node)["type"]);
920
- if ((kind === "word-arithmetic")) {
921
- (child_vars)["forEach"](((child) => {
922
- return fixed(child, "u32");
923
- }));
1425
+ if ((kind === "memory-op")) {
1426
+ {
1427
+ let op = (node)["value"];
1428
+ if ((op === "store-v64")) {
1429
+ fixed(((((child_vars) ?? [])[0]) ?? null), "u32");
1430
+ fixed(((((child_vars) ?? [])[1]) ?? null), "v64");
1431
+ fixed(id, "u32");
1432
+ } else {
1433
+ if ((op === "store-bits64")) {
1434
+ fixed(((((child_vars) ?? [])[0]) ?? null), "u32");
1435
+ fixed(((((child_vars) ?? [])[1]) ?? null), "bits64");
1436
+ fixed(id, "u32");
1437
+ } else {
1438
+ if (((op === "load-u32") || (op === "load-u8") || (op === "load-u16"))) {
1439
+ fixed(((((child_vars) ?? [])[0]) ?? null), "u32");
1440
+ fixed(id, "u32");
1441
+ } else {
1442
+ fixed(id, (node)["type"]);
1443
+ }
1444
+ }
1445
+ }
1446
+ }
1447
+ } else {
1448
+ fixed(id, (node)["type"]);
1449
+ if ((kind === "word-arithmetic")) {
1450
+ (child_vars)["forEach"](((child) => {
1451
+ return fixed(child, "u32");
1452
+ }));
1453
+ }
924
1454
  }
925
1455
  }
926
1456
  }
@@ -963,14 +1493,14 @@ function finalize_managed_function_types(function$, functions, source = null) {
963
1493
  fixed(visit((function$)["body"]), (function$)["resultType"]);
964
1494
  ((index = 0));
965
1495
  while (__eliscript_numeric_relation("<", index, ((locals) ?? []).length)) {
966
- ((((((locals) ?? [])[index]) ?? null))["type"] = ((__eliscript_value_28) => (__eliscript_truthy(__eliscript_value_28) ? __eliscript_value_28 : "u32"))(((((types) ?? [])[root(((((local_vars) ?? [])[index]) ?? null))]) ?? null)));
1496
+ ((((((locals) ?? [])[index]) ?? null))["type"] = ((__eliscript_value_21) => (__eliscript_truthy(__eliscript_value_21) ? __eliscript_value_21 : "u32"))(((((types) ?? [])[root(((((local_vars) ?? [])[index]) ?? null))]) ?? null)));
967
1497
  ((index = (index + 1)));
968
1498
  }
969
1499
  (nodes)["forEach"](((node) => {
970
1500
  {
971
- let type = ((__eliscript_value_29) => (__eliscript_truthy(__eliscript_value_29) ? __eliscript_value_29 : "u32"))(((((types) ?? [])[root((variables)["get"](node))]) ?? null));
1501
+ let type = ((__eliscript_value_22) => (__eliscript_truthy(__eliscript_value_22) ? __eliscript_value_22 : "u32"))(((((types) ?? [])[root((variables)["get"](node))]) ?? null));
972
1502
  let kind = (node)["kind"];
973
- if ((__eliscript_truthy((bottoms)["has"](node)) && ((__eliscript_value_30, __eliscript_value_31) => (__eliscript_value_30 !== __eliscript_value_31))(type, "u32"))) {
1503
+ if ((__eliscript_truthy((bottoms)["has"](node)) && (type !== "u32"))) {
974
1504
  {
975
1505
  let call = Object.assign(({}), node);
976
1506
  ((call)["type"] = "u32");
@@ -982,7 +1512,7 @@ function finalize_managed_function_types(function$, functions, source = null) {
982
1512
  } else {
983
1513
  if (((kind === "word-compare") || (kind === "v64-compare"))) {
984
1514
  {
985
- let operand_type = ((__eliscript_value_32) => (__eliscript_truthy(__eliscript_value_32) ? __eliscript_value_32 : "u32"))(((((types) ?? [])[root((variables)["get"]((((((node)["children"]) ?? [])[0]) ?? null)))]) ?? null));
1515
+ let operand_type = ((__eliscript_value_23) => (__eliscript_truthy(__eliscript_value_23) ? __eliscript_value_23 : "u32"))(((((types) ?? [])[root((variables)["get"]((((((node)["children"]) ?? [])[0]) ?? null)))]) ?? null));
986
1516
  ((node)["kind"] = (((operand_type === "v64") || (operand_type === "bits64")) ? "v64-compare" : "word-compare"));
987
1517
  return ((node)["type"] = "i32");
988
1518
  }
@@ -1005,13 +1535,13 @@ function finalize_managed_function_types(function$, functions, source = null) {
1005
1535
  }
1006
1536
  }
1007
1537
  const managed_local_branch_owners = new (globalThis.WeakMap)();
1008
- __eliscript_tdz_ready_5 = true;
1538
+ __eliscript_tdz_ready_11 = true;
1009
1539
  function record_managed_branch_locals(state, first) {
1010
1540
  {
1011
1541
  let locals = (state)["locals"];
1012
1542
  let owner = ({});
1013
1543
  while (__eliscript_numeric_relation("<", first, ((locals) ?? []).length)) {
1014
- ((__eliscript_tdz_ready_5 === true ? managed_local_branch_owners : __eliscript_tdz_error("managed_local_branch_owners")))["set"](((((locals) ?? [])[first]) ?? null), owner);
1544
+ ((__eliscript_tdz_ready_11 === true ? managed_local_branch_owners : __eliscript_tdz_error("managed_local_branch_owners")))["set"](((((locals) ?? [])[first]) ?? null), owner);
1015
1545
  ((first = (first + 1)));
1016
1546
  }
1017
1547
  return null;
@@ -1019,7 +1549,7 @@ function record_managed_branch_locals(state, first) {
1019
1549
  }
1020
1550
  function compact_managed_branch_locals(function$) {
1021
1551
  if (!(__eliscript_truthy(((function$)["locals"])["some"](((entry) => {
1022
- return ((__eliscript_tdz_ready_5 === true ? managed_local_branch_owners : __eliscript_tdz_error("managed_local_branch_owners")))["has"](entry);
1552
+ return ((__eliscript_tdz_ready_11 === true ? managed_local_branch_owners : __eliscript_tdz_error("managed_local_branch_owners")))["has"](entry);
1023
1553
  }))))) {
1024
1554
  return function$;
1025
1555
  } else {
@@ -1033,7 +1563,7 @@ function compact_managed_branch_locals(function$) {
1033
1563
  while (__eliscript_numeric_relation("<", index, ((locals) ?? []).length)) {
1034
1564
  {
1035
1565
  let entry = ((((locals) ?? [])[index]) ?? null);
1036
- let owner = ((__eliscript_tdz_ready_5 === true ? managed_local_branch_owners : __eliscript_tdz_error("managed_local_branch_owners")))["get"](entry);
1566
+ let owner = ((__eliscript_tdz_ready_11 === true ? managed_local_branch_owners : __eliscript_tdz_error("managed_local_branch_owners")))["get"](entry);
1037
1567
  let type = (entry)["type"];
1038
1568
  let target = 0;
1039
1569
  if (!(__eliscript_truthy(owner))) {
@@ -1052,7 +1582,7 @@ function compact_managed_branch_locals(function$) {
1052
1582
  (banks)["set"](type, bank);
1053
1583
  }
1054
1584
  {
1055
- let ordinal = ((__eliscript_value_33) => (__eliscript_truthy(__eliscript_value_33) ? __eliscript_value_33 : 0))((used)["get"](type));
1585
+ let ordinal = ((__eliscript_value_24) => (__eliscript_truthy(__eliscript_value_24) ? __eliscript_value_24 : 0))((used)["get"](type));
1056
1586
  if ((ordinal === ((bank) ?? []).length)) {
1057
1587
  ((target = ((output) ?? []).length));
1058
1588
  (bank)["push"](target);
@@ -1129,7 +1659,7 @@ function compact_managed_function_locals(function$, preferred = null) {
1129
1659
  let kind = (node)["kind"];
1130
1660
  let children = (node)["children"];
1131
1661
  let index = 0;
1132
- let nested = ((__eliscript_value_34) => (__eliscript_truthy(__eliscript_value_34) ? __eliscript_value_34 : managed_local_backedge_p(kind)))(in_loop);
1662
+ let nested = ((__eliscript_value_25) => (__eliscript_truthy(__eliscript_value_25) ? __eliscript_value_25 : managed_local_backedge_p(kind)))(in_loop);
1133
1663
  if ((!(__eliscript_truthy(nested)) && (kind === "sequence") && __eliscript_numeric_relation(">", ((children) ?? []).length, width))) {
1134
1664
  ((candidate = node), (width = ((children) ?? []).length));
1135
1665
  }
@@ -1207,7 +1737,7 @@ function compact_managed_function_locals(function$, preferred = null) {
1207
1737
  }
1208
1738
  ((index = (index + 1)));
1209
1739
  }
1210
- if ((!(__eliscript_truthy(safe)) || ((__eliscript_value_35, __eliscript_value_36) => (__eliscript_value_35 !== __eliscript_value_36))(occurrences, 1))) {
1740
+ if ((!(__eliscript_truthy(safe)) || (occurrences !== 1))) {
1211
1741
  return function$;
1212
1742
  } else {
1213
1743
  {
@@ -1249,7 +1779,7 @@ function compact_managed_function_locals(function$, preferred = null) {
1249
1779
  let entry = ((((locals) ?? [])[old]) ?? null);
1250
1780
  let type = (entry)["type"];
1251
1781
  let bank = (banks)["get"](type);
1252
- let ordinal = ((__eliscript_value_37) => (__eliscript_truthy(__eliscript_value_37) ? __eliscript_value_37 : 0))((used)["get"](type));
1782
+ let ordinal = ((__eliscript_value_26) => (__eliscript_truthy(__eliscript_value_26) ? __eliscript_value_26 : 0))((used)["get"](type));
1253
1783
  if ((!__eliscript_truthy(bank))) {
1254
1784
  ((bank = []));
1255
1785
  (banks)["set"](type, bank);
@@ -1374,9 +1904,9 @@ function managed_pattern_names(node, output) {
1374
1904
  while (__eliscript_numeric_relation("<", index, count)) {
1375
1905
  {
1376
1906
  let entry = ((((children) ?? [])[index]) ?? null);
1377
- let parts = ((__eliscript_value_38) => (__eliscript_truthy(__eliscript_value_38) ? ((entry)["children"] ?? null) : __eliscript_value_38))(entry);
1907
+ let parts = ((__eliscript_value_27) => (__eliscript_truthy(__eliscript_value_27) ? ((entry)["children"] ?? null) : __eliscript_value_27))(entry);
1378
1908
  if ((!(__eliscript_truthy(entry) && ((entry)["kind"] === "map-binding-entry") && __eliscript_truthy(Array.isArray(parts)) && (((parts) ?? []).length === (__eliscript_truthy(((((entry)["properties"] ?? ({})))["default"] ?? null)) ? 3 : 2)) && __eliscript_truthy(((((parts) ?? [])[1]) ?? null)) && (__eliscript_value_type((((((parts) ?? [])[1]) ?? null))["kind"]) === "string") && ((((parts) ?? []).length === 2) || (__eliscript_truthy(((((parts) ?? [])[2]) ?? null)) && (__eliscript_value_type((((((parts) ?? [])[2]) ?? null))["kind"]) === "string")))))) {
1379
- managed_fail(((__eliscript_value_39) => (__eliscript_truthy(__eliscript_value_39) ? __eliscript_value_39 : node))(entry), "invalid managed map binding entry");
1909
+ managed_fail(((__eliscript_value_28) => (__eliscript_truthy(__eliscript_value_28) ? __eliscript_value_28 : node))(entry), "invalid managed map binding entry");
1380
1910
  }
1381
1911
  managed_pattern_names(((((parts) ?? [])[0]) ?? null), output);
1382
1912
  }
@@ -1434,10 +1964,10 @@ function managed_parameter_kinds(node) {
1434
1964
  while (__eliscript_numeric_relation("<", index, arity)) {
1435
1965
  {
1436
1966
  let parameter = ((((children) ?? [])[index]) ?? null);
1437
- let properties = ((__eliscript_value_40) => (__eliscript_truthy(__eliscript_value_40) ? ((parameter)["properties"] ?? ({})) : __eliscript_value_40))(parameter);
1438
- let kind = ((__eliscript_value_41) => (__eliscript_truthy(__eliscript_value_41) ? (properties)["parameterKind"] : __eliscript_value_41))(properties);
1439
- let pattern = ((__eliscript_value_42) => (__eliscript_truthy(__eliscript_value_42) ? ((properties)["pattern"] ?? null) : __eliscript_value_42))(properties);
1440
- let parts = ((__eliscript_value_43) => (__eliscript_truthy(__eliscript_value_43) ? ((parameter)["children"] ?? null) : __eliscript_value_43))(parameter);
1967
+ let properties = ((__eliscript_value_29) => (__eliscript_truthy(__eliscript_value_29) ? ((parameter)["properties"] ?? ({})) : __eliscript_value_29))(parameter);
1968
+ let kind = ((__eliscript_value_30) => (__eliscript_truthy(__eliscript_value_30) ? (properties)["parameterKind"] : __eliscript_value_30))(properties);
1969
+ let pattern = ((__eliscript_value_31) => (__eliscript_truthy(__eliscript_value_31) ? ((properties)["pattern"] ?? null) : __eliscript_value_31))(properties);
1970
+ let parts = ((__eliscript_value_32) => (__eliscript_truthy(__eliscript_value_32) ? ((parameter)["children"] ?? null) : __eliscript_value_32))(parameter);
1441
1971
  if ((!(__eliscript_truthy(parameter) && ((parameter)["kind"] === "parameter-binding") && __eliscript_truthy(Array.isArray(parts)) && __eliscript_truthy((__eliscript_truthy(pattern) ? ((pattern === true) && (((parts) ?? []).length === 1) && ((parameter)["value"] === null)) : ((((parts) ?? []).length === 0) && (__eliscript_value_type((parameter)["value"]) === "string") && __eliscript_numeric_relation(">", (((parameter)["value"]) ?? []).length, 0))))))) {
1442
1972
  managed_fail(parameter, "managed control requires named parameters or binding patterns");
1443
1973
  }
@@ -1493,7 +2023,7 @@ function managed_source_text_node(node, texts) {
1493
2023
  return node;
1494
2024
  } else {
1495
2025
  {
1496
- let copy = (globalThis.Object)["assign"](({}), node, ({"children": ((__eliscript_value_44) => (__eliscript_truthy(__eliscript_value_44) ? __eliscript_value_44 : children))(output), "managedOriginal": ((node)["managedOriginal"] ?? node)}));
2026
+ let copy = (globalThis.Object)["assign"](({}), node, ({"children": ((__eliscript_value_33) => (__eliscript_truthy(__eliscript_value_33) ? __eliscript_value_33 : children))(output), "managedOriginal": ((node)["managedOriginal"] ?? node)}));
1497
2027
  if (__eliscript_truthy((texts)["has"](node))) {
1498
2028
  ((copy)["managedSourceText"] = (texts)["get"](node));
1499
2029
  }
@@ -1589,19 +2119,17 @@ function managed_program_source_texts(program) {
1589
2119
  {
1590
2120
  let children = (node)["children"];
1591
2121
  if ((!(__eliscript_truthy(Array.isArray(children)) && __eliscript_numeric_relation(">=", ((children) ?? []).length, 2) && !((((((children) ?? [])[0]) ?? null) === null)) && !((((((children) ?? [])[1]) ?? null) === null)) && (__eliscript_value_type(((((children) ?? [])[0]) ?? null)) === "object") && (__eliscript_value_type(((((children) ?? [])[1]) ?? null)) === "object") && !(__eliscript_truthy(Array.isArray(((((children) ?? [])[0]) ?? null)))) && !(__eliscript_truthy(Array.isArray(((((children) ?? [])[1]) ?? null))))))) {
1592
- (() => {
1593
- try {
1594
- return managed_fail(node, "managed method call requires a receiver and method key");
1595
- } catch (error) {
1596
- {
1597
- let span = ((node)["span"] ?? null);
1598
- if (__eliscript_truthy(span)) {
1599
- (((error)["eliscriptDiagnostic"])["location"] = ({"file": ((span)["filename"] ?? (program)["filename"]), "start": ({"offset": (span)["start"], "line": (span)["line"], "column": (span)["column"]}), "end": ({"offset": (span)["end"], "line": (span)["endLine"], "column": (span)["endColumn"]})}));
1600
- }
2122
+ try {
2123
+ managed_fail(node, "managed method call requires a receiver and method key");
2124
+ } catch (error) {
2125
+ {
2126
+ let span = ((node)["span"] ?? null);
2127
+ if (__eliscript_truthy(span)) {
2128
+ (((error)["eliscriptDiagnostic"])["location"] = ({"file": ((span)["filename"] ?? (program)["filename"]), "start": ({"offset": (span)["start"], "line": (span)["line"], "column": (span)["column"]}), "end": ({"offset": (span)["end"], "line": (span)["endLine"], "column": (span)["endColumn"]})}));
1601
2129
  }
1602
- return ((__eliscript_value_45) => { throw __eliscript_value_45; })(error);
1603
2130
  }
1604
- })();
2131
+ ((__eliscript_value_34) => { throw __eliscript_value_34; })(error);
2132
+ }
1605
2133
  }
1606
2134
  }
1607
2135
  }
@@ -1669,13 +2197,11 @@ function managed_validate_source_program(program, link_mode = null) {
1669
2197
  if ((!((__eliscript_value_type(name) === "string") && __eliscript_numeric_relation(">", ((name) ?? []).length, 0) && !(__eliscript_truthy((names)["has"](name)))))) {
1670
2198
  managed_fail(node, "invalid or duplicate managed module binding");
1671
2199
  }
1672
- (() => {
1673
- try {
1674
- return binding_name(name);
1675
- } catch (error) {
1676
- return managed_fail(node, ((error)["message"] ?? "invalid managed module binding"));
1677
- }
1678
- })();
2200
+ try {
2201
+ binding_name(name);
2202
+ } catch (error) {
2203
+ managed_fail(node, ((error)["message"] ?? "invalid managed module binding"));
2204
+ }
1679
2205
  (names)["add"](name);
1680
2206
  }
1681
2207
  if ((kind === "variable-declaration")) {
@@ -1701,7 +2227,7 @@ function managed_validate_source_program(program, link_mode = null) {
1701
2227
  {
1702
2228
  let ctor = (((((node)["children"]) ?? [])[0]) ?? null);
1703
2229
  let name = managed_static_reference(ctor);
1704
- let root = ((__eliscript_value_46) => (__eliscript_truthy(__eliscript_value_46) ? (((((name)["split"](".")) ?? [])[0]) ?? null) : __eliscript_value_46))(name);
2230
+ let root = ((__eliscript_value_35) => (__eliscript_truthy(__eliscript_value_35) ? (((((name)["split"](".")) ?? [])[0]) ?? null) : __eliscript_value_35))(name);
1705
2231
  if ((__eliscript_truthy((["Map", "Set", "WeakMap", "WeakSet", "globalThis.Map", "globalThis.Set", "globalThis.WeakMap", "globalThis.WeakSet"])["includes"](name)) && __eliscript_truthy((names)["has"](root)))) {
1706
2232
  if (__eliscript_truthy(link_mode)) {
1707
2233
  managed_link_fail(ctor, "managed collection constructor binding is shadowed");
@@ -1719,32 +2245,28 @@ function managed_validate_source_program(program, link_mode = null) {
1719
2245
  return program;
1720
2246
  }
1721
2247
  function managed_function_source_artifact(program) {
1722
- return (() => {
2248
+ try {
2249
+ return emit_module_function_sources(program);
2250
+ } catch (error) {
1723
2251
  try {
1724
- return emit_module_function_sources(program);
1725
- } catch (error) {
1726
- return (() => {
1727
- try {
1728
- if ((!((error === null)) && (__eliscript_value_type(error) === "object") && (((error)["eliscriptDiagnostic"] ?? null) === null) && __eliscript_truthy((globalThis.Object)["hasOwn"](error, "eliscriptIRSpan")))) {
1729
- {
1730
- let span = ((error)["eliscriptIRSpan"] ?? null);
1731
- let location = ({"file": ((span === null) ? (program)["filename"] : ((span)["filename"] ?? (program)["filename"]))});
1732
- let message = ((error)["message"] ?? "managed source emission failed");
1733
- if ((!(span === null))) {
1734
- ((location)["start"] = ({"offset": (span)["start"], "line": (span)["line"], "column": (span)["column"]}));
1735
- ((location)["end"] = ({"offset": (span)["end"], "line": (span)["endLine"], "column": (span)["endColumn"]}));
1736
- }
1737
- return ((error)["eliscriptDiagnostic"] = ({"format": "eliscript-diagnostic", "code": "ELI-B0001", "severity": "error", "phase": "managed-backend", "message": message, "location": location}));
1738
- }
1739
- } else {
1740
- return null;
2252
+ if ((!((error === null)) && (__eliscript_value_type(error) === "object") && (((error)["eliscriptDiagnostic"] ?? null) === null) && __eliscript_truthy((globalThis.Object)["hasOwn"](error, "eliscriptIRSpan")))) {
2253
+ {
2254
+ let span = ((error)["eliscriptIRSpan"] ?? null);
2255
+ let location = ({"file": ((span === null) ? (program)["filename"] : ((span)["filename"] ?? (program)["filename"]))});
2256
+ let message = ((error)["message"] ?? "managed source emission failed");
2257
+ if ((!(span === null))) {
2258
+ ((location)["start"] = ({"offset": (span)["start"], "line": (span)["line"], "column": (span)["column"]}));
2259
+ ((location)["end"] = ({"offset": (span)["end"], "line": (span)["endLine"], "column": (span)["endColumn"]}));
1741
2260
  }
1742
- } finally {
1743
- ((__eliscript_value_47) => { throw __eliscript_value_47; })(error);
2261
+ return ((error)["eliscriptDiagnostic"] = ({"format": "eliscript-diagnostic", "code": "ELI-B0001", "severity": "error", "phase": "managed-backend", "message": message, "location": location}));
1744
2262
  }
1745
- })();
2263
+ } else {
2264
+ return null;
2265
+ }
2266
+ } finally {
2267
+ ((__eliscript_value_36) => { throw __eliscript_value_36; })(error);
1746
2268
  }
1747
- })();
2269
+ }
1748
2270
  }
1749
2271
  function managed_function_length(function$) {
1750
2272
  {
@@ -1802,7 +2324,7 @@ function managed_static_length_descriptor_value(node) {
1802
2324
  let prop = (((((node)["children"]) ?? [])[index]) ?? null);
1803
2325
  let props = (prop)["properties"];
1804
2326
  let children = (prop)["children"];
1805
- let val_node = ((__eliscript_value_48) => (__eliscript_truthy(__eliscript_value_48) ? ((__eliscript_value_49) => (__eliscript_truthy(__eliscript_value_49) ? ((((children) ?? [])[0]) ?? null) : __eliscript_value_49))((((children) ?? []).length === 1)) : __eliscript_value_48))(Array.isArray(children));
2327
+ let val_node = ((__eliscript_value_37) => (__eliscript_truthy(__eliscript_value_37) ? ((__eliscript_value_38) => (__eliscript_truthy(__eliscript_value_38) ? ((((children) ?? [])[0]) ?? null) : __eliscript_value_38))((((children) ?? []).length === 1)) : __eliscript_value_37))(Array.isArray(children));
1806
2328
  if ((!(((prop)["kind"] === "object-property")) || (__eliscript_truthy(props) && __eliscript_truthy((props)["computed"])) || !(__eliscript_truthy(val_node)) || !(((val_node)["kind"] === "literal")))) {
1807
2329
  ((valid = false));
1808
2330
  } else {
@@ -1833,16 +2355,16 @@ function managed_static_length_definition(node, functions, globals, observed) {
1833
2355
  if ((__eliscript_truthy(node) && __eliscript_truthy(((node)["projectPrepare"] ?? null)) && !(__eliscript_truthy(find_local(globals, "Object"))))) {
1834
2356
  {
1835
2357
  let expr = ((((node)["kind"] === "expression-statement") && __eliscript_truthy(Array.isArray((node)["children"])) && ((((node)["children"]) ?? []).length === 1)) ? (((((node)["children"]) ?? [])[0]) ?? null) : node);
1836
- let children = ((__eliscript_value_50) => (__eliscript_truthy(__eliscript_value_50) ? (expr)["children"] : __eliscript_value_50))(expr);
1837
- let args = ((__eliscript_truthy(expr) && (((expr)["kind"] === "call") || ((expr)["kind"] === "invoke")) && __eliscript_truthy(Array.isArray(children)) && (((children) ?? []).length === 4) && (managed_builtin_operation(((__eliscript_value_51) => (__eliscript_truthy(__eliscript_value_51) ? __eliscript_value_51 : ""))(managed_static_reference(((((children) ?? [])[0]) ?? null)))) === 170)) ? [((((children) ?? [])[1]) ?? null), ((((children) ?? [])[2]) ?? null), ((((children) ?? [])[3]) ?? null)] : ((__eliscript_truthy(expr) && ((expr)["kind"] === "method-call") && __eliscript_truthy(Array.isArray(children)) && (((children) ?? []).length === 5) && (managed_builtin_operation(((__eliscript_value_52) => (__eliscript_truthy(__eliscript_value_52) ? __eliscript_value_52 : ""))(managed_builtin_method(expr))) === 170)) ? [((((children) ?? [])[2]) ?? null), ((((children) ?? [])[3]) ?? null), ((((children) ?? [])[4]) ?? null)] : null));
2358
+ let children = ((__eliscript_value_39) => (__eliscript_truthy(__eliscript_value_39) ? (expr)["children"] : __eliscript_value_39))(expr);
2359
+ let args = ((__eliscript_truthy(expr) && (((expr)["kind"] === "call") || ((expr)["kind"] === "invoke")) && __eliscript_truthy(Array.isArray(children)) && (((children) ?? []).length === 4) && (managed_builtin_operation(((__eliscript_value_40) => (__eliscript_truthy(__eliscript_value_40) ? __eliscript_value_40 : ""))(managed_static_reference(((((children) ?? [])[0]) ?? null)))) === 170)) ? [((((children) ?? [])[1]) ?? null), ((((children) ?? [])[2]) ?? null), ((((children) ?? [])[3]) ?? null)] : ((__eliscript_truthy(expr) && ((expr)["kind"] === "method-call") && __eliscript_truthy(Array.isArray(children)) && (((children) ?? []).length === 5) && (managed_builtin_operation(((__eliscript_value_41) => (__eliscript_truthy(__eliscript_value_41) ? __eliscript_value_41 : ""))(managed_builtin_method(expr))) === 170)) ? [((((children) ?? [])[2]) ?? null), ((((children) ?? [])[3]) ?? null), ((((children) ?? [])[4]) ?? null)] : null));
1838
2360
  if (__eliscript_truthy(args)) {
1839
2361
  {
1840
2362
  let target = ((((args) ?? [])[0]) ?? null);
1841
2363
  let key = ((((args) ?? [])[1]) ?? null);
1842
2364
  let desc = ((((args) ?? [])[2]) ?? null);
1843
- let name = ((__eliscript_value_53) => (__eliscript_truthy(__eliscript_value_53) ? (target)["value"] : __eliscript_value_53))(((target)["kind"] === "reference"));
1844
- let fn = ((__eliscript_value_54) => (__eliscript_truthy(__eliscript_value_54) ? ((__eliscript_value_55) => (__eliscript_truthy(__eliscript_value_55) ? find_function(functions, name) : __eliscript_value_55))((!__eliscript_truthy(find_local(globals, name)))) : __eliscript_value_54))(name);
1845
- let arity = ((__eliscript_value_56) => (__eliscript_truthy(__eliscript_value_56) ? ((__eliscript_value_57) => (__eliscript_truthy(__eliscript_value_57) ? ((__eliscript_value_58) => (__eliscript_truthy(__eliscript_value_58) ? ((__eliscript_value_59) => (__eliscript_truthy(__eliscript_value_59) ? ((__eliscript_value_60) => (__eliscript_truthy(__eliscript_value_60) ? ((__eliscript_value_61) => (__eliscript_truthy(__eliscript_value_61) ? managed_static_length_descriptor_value(desc) : __eliscript_value_61))(((key)["value"] === "length")) : __eliscript_value_60))(((key)["kind"] === "literal")) : __eliscript_value_59))((!__eliscript_truthy((observed)["has"](name)))) : __eliscript_value_58))((!__eliscript_truthy(((fn)["lambda"] ?? null)))) : __eliscript_value_57))((((fn)["builtin"] ?? null) === null)) : __eliscript_value_56))(fn);
2365
+ let name = ((__eliscript_value_42) => (__eliscript_truthy(__eliscript_value_42) ? (target)["value"] : __eliscript_value_42))(((target)["kind"] === "reference"));
2366
+ let fn = ((__eliscript_value_43) => (__eliscript_truthy(__eliscript_value_43) ? ((__eliscript_value_44) => (__eliscript_truthy(__eliscript_value_44) ? find_function(functions, name) : __eliscript_value_44))((!__eliscript_truthy(find_local(globals, name)))) : __eliscript_value_43))(name);
2367
+ let arity = ((__eliscript_value_45) => (__eliscript_truthy(__eliscript_value_45) ? ((__eliscript_value_46) => (__eliscript_truthy(__eliscript_value_46) ? ((__eliscript_value_47) => (__eliscript_truthy(__eliscript_value_47) ? ((__eliscript_value_48) => (__eliscript_truthy(__eliscript_value_48) ? ((__eliscript_value_49) => (__eliscript_truthy(__eliscript_value_49) ? ((__eliscript_value_50) => (__eliscript_truthy(__eliscript_value_50) ? managed_static_length_descriptor_value(desc) : __eliscript_value_50))(((key)["value"] === "length")) : __eliscript_value_49))(((key)["kind"] === "literal")) : __eliscript_value_48))((!__eliscript_truthy((observed)["has"](name)))) : __eliscript_value_47))((!__eliscript_truthy(((fn)["lambda"] ?? null)))) : __eliscript_value_46))((((fn)["builtin"] ?? null) === null)) : __eliscript_value_45))(fn);
1846
2368
  if (__eliscript_truthy(Number.isSafeInteger(arity))) {
1847
2369
  return [fn, arity];
1848
2370
  } else {
@@ -1893,7 +2415,7 @@ function managed_function_reflection_name(function$) {
1893
2415
  if (__eliscript_truthy(name)) {
1894
2416
  return binding_name(name);
1895
2417
  } else {
1896
- return ((__eliscript_value_62) => (__eliscript_truthy(__eliscript_value_62) ? __eliscript_value_62 : (__eliscript_truthy(((function$)["name"] ?? null)) ? binding_name((function$)["name"]) : "")))(((function$)["reflectionName"] ?? null));
2418
+ return ((__eliscript_value_51) => (__eliscript_truthy(__eliscript_value_51) ? __eliscript_value_51 : (__eliscript_truthy(((function$)["name"] ?? null)) ? binding_name((function$)["name"]) : "")))(((function$)["reflectionName"] ?? null));
1897
2419
  }
1898
2420
  } else {
1899
2421
  if ((builtin === 486)) {
@@ -2066,7 +2588,7 @@ function lower_managed_native_initializer_call(value, builtin, state) {
2066
2588
  {
2067
2589
  let initializer = managed_function_native_initializer(builtin, state);
2068
2590
  let arguments$ = managed_result(state, runtime_call(state, "value-refs", runtime_arguments(state, [word_constant(7), word_constant(0)])), true);
2069
- return word_if(word_compare(runtime_call(state, ((builtin === 0) ? "value-function-number-prototype-ready" : "value-function-initialized"), runtime_arguments(state, [value])), word_constant(0), "="), word_sequence([(arguments$)["steps"], managed_guard(state, word_node("call", runtime_arguments(state, [value, (arguments$)["result"], word_constant(0)]), (initializer)["index"])), capture_error(state)]), word_constant(0));
2591
+ return managed_guard(state, word_if(word_compare(runtime_call(state, ((builtin === 0) ? "value-function-number-prototype-ready" : "value-function-initialized"), runtime_arguments(state, [value])), word_constant(0), "="), word_sequence([(arguments$)["steps"], managed_guard(state, word_node("call", runtime_arguments(state, [value, (arguments$)["result"], word_constant(0)]), (initializer)["index"])), capture_error(state)]), word_constant(0)));
2070
2592
  }
2071
2593
  }
2072
2594
  function lower_managed_object_constructor_publication(value, key, state) {
@@ -2095,7 +2617,7 @@ function lower_managed_native_initialization(value, function$, state) {
2095
2617
  let builtin = ((function$)["builtin"] ?? null);
2096
2618
  let error_constructor = ((__eliscript_numeric_relation(">=", builtin, 32) && __eliscript_numeric_relation("<=", builtin, 36)) || (builtin === 70));
2097
2619
  let defer_number_statics = ((builtin === 0) && (!__eliscript_truthy(((state)["forcingNumberNative"] ?? null))));
2098
- let defer_common = ((__eliscript_value_63) => (__eliscript_truthy(__eliscript_value_63) ? __eliscript_value_63 : ((__eliscript_value_66) => (__eliscript_truthy(__eliscript_value_66) ? __eliscript_value_66 : ((builtin === 24) || (builtin === 75) || (builtin === 76) || (__eliscript_numeric_relation(">=", builtin, 12) && __eliscript_numeric_relation("<=", builtin, 18)) || (__eliscript_numeric_relation(">=", builtin, 21) && __eliscript_numeric_relation("<=", builtin, 23)) || (builtin === 27) || (__eliscript_numeric_relation(">=", builtin, 37) && __eliscript_numeric_relation("<=", builtin, 39)) || (__eliscript_numeric_relation(">=", builtin, 163) && __eliscript_numeric_relation("<=", builtin, 179)) || ((builtin === 194) || (builtin === 195)))))(error_constructor)))(((!(builtin === null)) && ((__eliscript_value_64, __eliscript_value_65) => (__eliscript_value_64 !== __eliscript_value_65))(builtin, 77) && (managed_function_constructible(function$) === 0)));
2620
+ let defer_common = ((__eliscript_value_52) => (__eliscript_truthy(__eliscript_value_52) ? __eliscript_value_52 : ((__eliscript_value_53) => (__eliscript_truthy(__eliscript_value_53) ? __eliscript_value_53 : ((builtin === 24) || (builtin === 75) || (builtin === 76) || (__eliscript_numeric_relation(">=", builtin, 12) && __eliscript_numeric_relation("<=", builtin, 18)) || (__eliscript_numeric_relation(">=", builtin, 21) && __eliscript_numeric_relation("<=", builtin, 23)) || (builtin === 27) || (__eliscript_numeric_relation(">=", builtin, 37) && __eliscript_numeric_relation("<=", builtin, 39)) || (__eliscript_numeric_relation(">=", builtin, 163) && __eliscript_numeric_relation("<=", builtin, 179)) || ((builtin === 194) || (builtin === 195)))))(error_constructor)))(((!(builtin === null)) && (builtin !== 77) && (managed_function_constructible(function$) === 0)));
2099
2621
  let describing = ((state)["describingNative"] ?? null);
2100
2622
  if (((builtin === 76) || ((builtin === 24) && !(__eliscript_truthy(((state)["forcingSymbolNative"] ?? null)))) || ((builtin === 75) && !(__eliscript_truthy(((state)["forcingArrayNative"] ?? null))) && !(__eliscript_truthy(((state)["describingNative"] ?? null))) && !((builtin === ((state)["nativeInitializerBody"] ?? null)))))) {
2101
2623
  return word_sequence([((builtin === 76) ? checked_control(state, "value-function-object-prepare", runtime_arguments(state, [value])) : ((builtin === 75) ? checked_control(state, "value-function-array-prepare", runtime_arguments(state, [value])) : word_constant(0))), checked_control(state, "value-function-register-constructor", runtime_arguments(state, [value, word_constant(builtin)]))]);
@@ -2312,7 +2834,7 @@ function lower_managed_native_initialization(value, function$, state) {
2312
2834
  }
2313
2835
  ((state)["describingNative"] = describing);
2314
2836
  }
2315
- return word_if(word_compare(runtime_call(state, (__eliscript_truthy(defer_number_statics) ? "value-function-number-prototype-ready" : "value-function-initialized"), runtime_arguments(state, [value])), word_constant(0), "="), word_sequence(steps), word_constant(0));
2837
+ return managed_guard(state, word_if(word_compare(runtime_call(state, (__eliscript_truthy(defer_number_statics) ? "value-function-number-prototype-ready" : "value-function-initialized"), runtime_arguments(state, [value])), word_constant(0), "="), word_sequence(steps), word_constant(0)));
2316
2838
  }
2317
2839
  }
2318
2840
  }
@@ -2379,7 +2901,7 @@ function lower_managed_realm_initialization(state) {
2379
2901
  }
2380
2902
  }
2381
2903
  function lower_managed_function_value(function$, state) {
2382
- if ((((__eliscript_value_67, __eliscript_value_68) => (__eliscript_value_67 !== __eliscript_value_68))(((function$)["builtin"] ?? -1), 76) && ((__eliscript_value_69, __eliscript_value_70) => (__eliscript_value_69 !== __eliscript_value_70))(((function$)["builtin"] ?? -1), 75))) {
2904
+ if (((((function$)["builtin"] ?? -1) !== 76) && (((function$)["builtin"] ?? -1) !== 75))) {
2383
2905
  return lower_managed_owned_function_value(function$, state);
2384
2906
  } else {
2385
2907
  {
@@ -2412,7 +2934,7 @@ function lower_managed_owned_function_value(function$, state) {
2412
2934
  let described = lower_managed_function_description((value)["result"], function$, state);
2413
2935
  (steps)["push"]((described)["steps"]);
2414
2936
  if ((!(((function$)["builtin"] ?? null) === null))) {
2415
- (steps)["push"](lower_managed_native_initialization((described)["result"], function$, state));
2937
+ (steps)["push"](managed_guard(state, lower_managed_native_initialization((described)["result"], function$, state)));
2416
2938
  }
2417
2939
  {
2418
2940
  let result_local = (((((state)["locals"]) ?? [])[((described)["result"])["value"]]) ?? null);
@@ -2706,9 +3228,9 @@ function lower_managed_static_reflect_reference(operation, state, functions) {
2706
3228
  }
2707
3229
  function lower_managed_static_namespace_reference(operation, namespace, name, state, functions) {
2708
3230
  {
2709
- const __eliscript_value_71 = managed_result(state, runtime_call(state, "heap-native-constructor-existing", runtime_arguments(state, [word_constant(namespace)])), true);
3231
+ const __eliscript_value_54 = managed_result(state, runtime_call(state, "heap-native-constructor-existing", runtime_arguments(state, [word_constant(namespace)])), true);
2710
3232
  {
2711
- let holder = __eliscript_value_71;
3233
+ let holder = __eliscript_value_54;
2712
3234
  {
2713
3235
  let output = new_managed_local(state, "math-method", true);
2714
3236
  let receiver = new_managed_local(state, "math-receiver", true);
@@ -2910,9 +3432,9 @@ function managed_global_primitive(name) {
2910
3432
  function lower_managed_qualified_reference(node, scope, state, functions) {
2911
3433
  {
2912
3434
  let name = managed_static_reference(node);
2913
- let parts = ((__eliscript_value_72) => (__eliscript_truthy(__eliscript_value_72) ? (name)["split"](".") : __eliscript_value_72))(name);
2914
- let root = ((__eliscript_value_73) => (__eliscript_truthy(__eliscript_value_73) ? ((((parts) ?? [])[0]) ?? null) : __eliscript_value_73))(parts);
2915
- let local = ((__eliscript_value_74) => (__eliscript_truthy(__eliscript_value_74) ? ((__eliscript_value_75) => (__eliscript_truthy(__eliscript_value_75) ? __eliscript_value_75 : ((__eliscript_value_76) => (__eliscript_truthy(__eliscript_value_76) ? __eliscript_value_76 : find_function(functions, root)))(managed_global(state, root))))(resolve_managed_local(scope, state, root)) : __eliscript_value_74))(root);
3435
+ let parts = ((__eliscript_value_55) => (__eliscript_truthy(__eliscript_value_55) ? (name)["split"](".") : __eliscript_value_55))(name);
3436
+ let root = ((__eliscript_value_56) => (__eliscript_truthy(__eliscript_value_56) ? ((((parts) ?? [])[0]) ?? null) : __eliscript_value_56))(parts);
3437
+ let local = ((__eliscript_value_57) => (__eliscript_truthy(__eliscript_value_57) ? ((__eliscript_value_58) => (__eliscript_truthy(__eliscript_value_58) ? __eliscript_value_58 : ((__eliscript_value_59) => (__eliscript_truthy(__eliscript_value_59) ? __eliscript_value_59 : find_function(functions, root)))(managed_global(state, root))))(resolve_managed_local(scope, state, root)) : __eliscript_value_57))(root);
2916
3438
  let operation = (__eliscript_truthy(root) ? managed_builtin_operation(root) : -1);
2917
3439
  let primitive = ((__eliscript_truthy(parts) && __eliscript_numeric_relation(">", ((parts) ?? []).length, 1)) ? managed_global_primitive(__eliscript_at_direct((parts)["slice"](0, 2), "join", ".")) : -1);
2918
3440
  let start = 1;
@@ -3014,9 +3536,9 @@ function lower_managed_builtin_reference(node, scope, state, functions) {
3014
3536
  let name = managed_static_reference(node);
3015
3537
  let operation = managed_builtin_operation(name);
3016
3538
  let prototype = managed_standard_prototype(name);
3017
- let parts = ((__eliscript_value_77) => (__eliscript_truthy(__eliscript_value_77) ? (name)["split"](".") : __eliscript_value_77))(name);
3018
- let root = ((__eliscript_value_78) => (__eliscript_truthy(__eliscript_value_78) ? ((((parts) ?? [])[0]) ?? null) : __eliscript_value_78))(parts);
3019
- let shadow = ((__eliscript_value_79) => (__eliscript_truthy(__eliscript_value_79) ? ((__eliscript_value_80) => (__eliscript_truthy(__eliscript_value_80) ? __eliscript_value_80 : ((__eliscript_value_81) => (__eliscript_truthy(__eliscript_value_81) ? __eliscript_value_81 : find_function(functions, root)))(managed_global(state, root))))(resolve_managed_local(scope, state, root)) : __eliscript_value_79))(root);
3539
+ let parts = ((__eliscript_value_60) => (__eliscript_truthy(__eliscript_value_60) ? (name)["split"](".") : __eliscript_value_60))(name);
3540
+ let root = ((__eliscript_value_61) => (__eliscript_truthy(__eliscript_value_61) ? ((((parts) ?? [])[0]) ?? null) : __eliscript_value_61))(parts);
3541
+ let shadow = ((__eliscript_value_62) => (__eliscript_truthy(__eliscript_value_62) ? ((__eliscript_value_63) => (__eliscript_truthy(__eliscript_value_63) ? __eliscript_value_63 : ((__eliscript_value_64) => (__eliscript_truthy(__eliscript_value_64) ? __eliscript_value_64 : find_function(functions, root)))(managed_global(state, root))))(resolve_managed_local(scope, state, root)) : __eliscript_value_62))(root);
3020
3542
  if ((!(__eliscript_truthy(shadow)) && __eliscript_truthy(parts) && (root === "globalThis") && __eliscript_numeric_relation(">", ((parts) ?? []).length, 1) && (((((parts) ?? [])[1]) ?? null) === "Array"))) {
3021
3543
  ((managed_builtin_function(75, state, functions))["hostArrayIdentity"] = true);
3022
3544
  }
@@ -3093,7 +3615,7 @@ function managed_builtin_method(node) {
3093
3615
  let children = (node)["children"];
3094
3616
  let name = managed_static_reference(((((children) ?? [])[0]) ?? null));
3095
3617
  let method = managed_static_method(((((children) ?? [])[1]) ?? null));
3096
- let full = ((__eliscript_value_82) => (__eliscript_truthy(__eliscript_value_82) ? ((__eliscript_value_83) => (__eliscript_truthy(__eliscript_value_83) ? (String(name) + String(".") + String(method)) : __eliscript_value_83))(method) : __eliscript_value_82))(name);
3618
+ let full = ((__eliscript_value_65) => (__eliscript_truthy(__eliscript_value_65) ? ((__eliscript_value_66) => (__eliscript_truthy(__eliscript_value_66) ? (String(name) + String(".") + String(method)) : __eliscript_value_66))(method) : __eliscript_value_65))(name);
3097
3619
  if ((__eliscript_numeric_relation(">=", managed_builtin_operation(full), 0) || __eliscript_numeric_relation(">=", managed_well_known_symbol(full), 0) || __eliscript_numeric_relation(">=", managed_standard_prototype(full), 0))) {
3098
3620
  return full;
3099
3621
  } else {
@@ -3230,7 +3752,7 @@ function managed_qualified_owner_p(name, scope, state, functions) {
3230
3752
  {
3231
3753
  let parts = (name)["split"](".");
3232
3754
  let root = ((((parts) ?? [])[0]) ?? null);
3233
- let found = ((__eliscript_value_84) => (__eliscript_truthy(__eliscript_value_84) ? __eliscript_value_84 : ((__eliscript_value_85) => (__eliscript_truthy(__eliscript_value_85) ? __eliscript_value_85 : find_function(functions, root)))(managed_global(state, root))))(resolve_managed_local(scope, state, root));
3755
+ let found = ((__eliscript_value_67) => (__eliscript_truthy(__eliscript_value_67) ? __eliscript_value_67 : ((__eliscript_value_68) => (__eliscript_truthy(__eliscript_value_68) ? __eliscript_value_68 : find_function(functions, root)))(managed_global(state, root))))(resolve_managed_local(scope, state, root));
3234
3756
  let length = ((parts) ?? []).length;
3235
3757
  while ((!(__eliscript_truthy(found)) && __eliscript_numeric_relation(">", length, 0))) {
3236
3758
  {
@@ -3342,7 +3864,7 @@ function managed_slot_dispatch_fallback(state, callee, arg_base, count, result)
3342
3864
  let argv = new_managed_local(state, "dispatch-argv", true);
3343
3865
  let cursor = new_managed_local(state, "dispatch-index", null);
3344
3866
  let receiver = new_managed_local(state, "dispatch-receiver", true);
3345
- return word_sequence([managed_guard(state, word_set(receiver, runtime_call(state, "value-function-current-this", runtime_arguments(state, [])))), capture_error(state), root_local(state, receiver), managed_guard(state, word_set(argv, runtime_call(state, "value-refs", runtime_arguments(state, [word_constant(7), word_local(count)])))), capture_error(state), root_local(state, argv), managed_guard(state, word_set(cursor, word_constant(0))), ({"kind": "while", "type": "i32", "value": null, "children": [word_compare(word_if(word_compare(word_local((state)["error"]), word_constant(0), "="), word_compare(word_local(cursor), word_local(count), "<"), word_constant(0)), word_constant(0), "/="), word_sequence([checked_control(state, "value-set", runtime_arguments(state, [word_local(argv), word_local(cursor), runtime_call(state, "root-scope-get-abs", runtime_arguments(state, [managed_raw_binary(word_local(arg_base), word_local(cursor), "+")]))])), managed_guard(state, word_set(cursor, managed_raw_binary(word_local(cursor), word_constant(1), "+")))])]}), managed_guard(state, word_set(result, runtime_call(state, "value-source-invoke-rooted-with-this", runtime_arguments(state, [word_local(callee), word_local(receiver), word_local(argv), word_local(count)])))), capture_error(state), root_local(state, result), managed_root_set(state, (argv)["rootIndex"], word_constant(0)), managed_root_set(state, (receiver)["rootIndex"], word_constant(0))]);
3867
+ return word_sequence([managed_guard(state, word_set(receiver, runtime_call(state, "value-function-current-this", runtime_arguments(state, [])))), capture_error(state), root_local(state, receiver), managed_guard(state, word_set(argv, runtime_call(state, "value-refs", runtime_arguments(state, [word_constant(7), word_local(count)])))), capture_error(state), root_local(state, argv), managed_guard(state, word_set(cursor, word_constant(0))), ({"kind": "while", "type": "i32", "value": null, "children": [word_compare(word_if(word_compare(word_local((state)["error"]), word_constant(0), "="), word_compare(word_local(cursor), word_local(count), "<"), word_constant(0)), word_constant(0), "/="), word_sequence([checked_control(state, "value-set", runtime_arguments(state, [word_local(argv), word_local(cursor), runtime_call(state, "rt-root-scope-get-abs", runtime_arguments(state, [managed_raw_binary(word_local(arg_base), word_local(cursor), "+")]))])), managed_guard(state, word_set(cursor, managed_raw_binary(word_local(cursor), word_constant(1), "+")))])]}), managed_guard(state, word_set(result, runtime_call(state, "value-source-invoke-rooted-with-this", runtime_arguments(state, [word_local(callee), word_local(receiver), word_local(argv), word_local(count)])))), capture_error(state), root_local(state, result), managed_root_set(state, (argv)["rootIndex"], word_constant(0)), managed_root_set(state, (receiver)["rootIndex"], word_constant(0))]);
3346
3868
  }
3347
3869
  }
3348
3870
  function managed_slot_dispatch_leaf(state, callee, arg_base, count, result, entry, fallback) {
@@ -3379,15 +3901,15 @@ function managed_slot_dispatch_call(state, target, values, dispatch) {
3379
3901
  let entered = new_managed_local(state, "dispatch-entered", null);
3380
3902
  let call = managed_result(state, word_node("call", runtime_arguments(state, [(target)["callee"], word_local(arg_base), word_constant(count)]), (dispatch)["index"]), true);
3381
3903
  let steps = [];
3382
- (steps)["push"](managed_guard(state, word_set(arg_scope, word_constant(0))), managed_guard(state, word_set(arg_scope, runtime_call(state, "root-scope-enter", runtime_arguments(state, [word_constant(count)])))), capture_error(state), managed_guard(state, word_set(arg_base, runtime_call(state, "root-scope-base", runtime_arguments(state, [])))), capture_error(state));
3904
+ (steps)["push"](managed_guard(state, word_set(arg_scope, word_constant(0))), managed_guard(state, word_set(arg_base, runtime_call(state, "rt-scope-enter", runtime_arguments(state, [word_constant(count)])))), capture_error(state), managed_guard(state, word_set(arg_scope, word_local(arg_base))));
3383
3905
  {
3384
3906
  let slot = 0;
3385
3907
  while (__eliscript_numeric_relation("<", slot, count)) {
3386
- (steps)["push"](checked_control(state, "root-scope-set-abs", runtime_arguments(state, [managed_raw_binary(word_local(arg_base), word_constant(slot), "+"), ((((values) ?? [])[slot]) ?? null)])));
3908
+ (steps)["push"](managed_root_set_at(state, arg_base, slot, ((((values) ?? [])[slot]) ?? null)));
3387
3909
  ((slot = (slot + 1)));
3388
3910
  }
3389
3911
  }
3390
- (steps)["push"]((previous)["steps"], checked_control(state, "value-call-restore", runtime_arguments(state, [((__eliscript_value_86) => (__eliscript_truthy(__eliscript_value_86) ? __eliscript_value_86 : word_constant(3)))((target)["receiver"])])), managed_guard(state, word_set(entered, word_constant(1))), (call)["steps"], word_if(word_compare(word_local(entered), word_constant(0), "/="), word_sequence([runtime_call(state, "value-call-restore", runtime_arguments(state, [(previous)["result"]])), word_if(word_compare(word_local((state)["error"]), word_constant(0), "/="), runtime_call(state, "fail", [word_local((state)["error"])]), word_constant(0))]), word_constant(0)), word_if(word_compare(word_local(arg_scope), word_constant(0), "/="), runtime_call(state, "root-scope-exit", runtime_arguments(state, [])), word_constant(0)));
3912
+ (steps)["push"]((previous)["steps"], checked_control(state, "value-call-restore", runtime_arguments(state, [((__eliscript_value_69) => (__eliscript_truthy(__eliscript_value_69) ? __eliscript_value_69 : word_constant(3)))((target)["receiver"])])), managed_guard(state, word_set(entered, word_constant(1))), (call)["steps"], word_if(word_compare(word_local(entered), word_constant(0), "/="), word_sequence([runtime_call(state, "value-call-restore", runtime_arguments(state, [(previous)["result"]])), word_if(word_compare(word_local((state)["error"]), word_constant(0), "/="), runtime_call(state, "fail", [word_local((state)["error"])]), word_constant(0))]), word_constant(0)), word_if(word_compare(word_local(arg_scope), word_constant(0), "/="), runtime_call(state, "rt-scope-exit", runtime_arguments(state, [])), word_constant(0)));
3391
3913
  {
3392
3914
  let local = (((((state)["locals"]) ?? [])[((previous)["result"])["value"]]) ?? null);
3393
3915
  (steps)["push"](managed_root_set(state, (local)["rootIndex"], word_constant(0)));
@@ -3399,15 +3921,15 @@ function managed_slot_dispatch_call(state, target, values, dispatch) {
3399
3921
  function lower_managed_call_target(callee, scope, state, functions) {
3400
3922
  {
3401
3923
  let name = managed_static_reference(callee);
3402
- let parts = ((__eliscript_value_87) => (__eliscript_truthy(__eliscript_value_87) ? (name)["split"](".") : __eliscript_value_87))(name);
3403
- let owner_name = ((__eliscript_value_88) => (__eliscript_truthy(__eliscript_value_88) ? ((__eliscript_value_89) => (__eliscript_truthy(__eliscript_value_89) ? __eliscript_at_direct((parts)["slice"](0, -1), "join", ".") : __eliscript_value_89))(__eliscript_numeric_relation(">", ((parts) ?? []).length, 1)) : __eliscript_value_88))(parts);
3924
+ let parts = ((__eliscript_value_70) => (__eliscript_truthy(__eliscript_value_70) ? (name)["split"](".") : __eliscript_value_70))(name);
3925
+ let owner_name = ((__eliscript_value_71) => (__eliscript_truthy(__eliscript_value_71) ? ((__eliscript_value_72) => (__eliscript_truthy(__eliscript_value_72) ? __eliscript_at_direct((parts)["slice"](0, -1), "join", ".") : __eliscript_value_72))(__eliscript_numeric_relation(">", ((parts) ?? []).length, 1)) : __eliscript_value_71))(parts);
3404
3926
  let math = managed_static_math_operation(name);
3405
3927
  let json = managed_static_json_operation(name);
3406
3928
  let reflect = managed_static_reflect_operation(name);
3407
3929
  let number_op = managed_static_number_operation(name);
3408
3930
  let symbol_op = managed_static_symbol_operation(name);
3409
- let root = ((__eliscript_value_90) => (__eliscript_truthy(__eliscript_value_90) ? ((((parts) ?? [])[0]) ?? null) : __eliscript_value_90))(parts);
3410
- let shadow = ((__eliscript_value_91) => (__eliscript_truthy(__eliscript_value_91) ? ((__eliscript_value_92) => (__eliscript_truthy(__eliscript_value_92) ? ((__eliscript_value_93) => (__eliscript_truthy(__eliscript_value_93) ? __eliscript_value_93 : ((__eliscript_value_94) => (__eliscript_truthy(__eliscript_value_94) ? __eliscript_value_94 : find_function(functions, root)))(managed_global(state, root))))(resolve_managed_local(scope, state, root)) : __eliscript_value_92))(root) : __eliscript_value_91))((__eliscript_numeric_relation(">=", math, 0) || __eliscript_numeric_relation(">=", json, 0) || __eliscript_numeric_relation(">=", reflect, 0) || __eliscript_numeric_relation(">=", number_op, 0) || __eliscript_numeric_relation(">=", symbol_op, 0)));
3931
+ let root = ((__eliscript_value_73) => (__eliscript_truthy(__eliscript_value_73) ? ((((parts) ?? [])[0]) ?? null) : __eliscript_value_73))(parts);
3932
+ let shadow = ((__eliscript_value_74) => (__eliscript_truthy(__eliscript_value_74) ? ((__eliscript_value_75) => (__eliscript_truthy(__eliscript_value_75) ? ((__eliscript_value_76) => (__eliscript_truthy(__eliscript_value_76) ? __eliscript_value_76 : ((__eliscript_value_77) => (__eliscript_truthy(__eliscript_value_77) ? __eliscript_value_77 : find_function(functions, root)))(managed_global(state, root))))(resolve_managed_local(scope, state, root)) : __eliscript_value_75))(root) : __eliscript_value_74))((__eliscript_numeric_relation(">=", math, 0) || __eliscript_numeric_relation(">=", json, 0) || __eliscript_numeric_relation(">=", reflect, 0) || __eliscript_numeric_relation(">=", number_op, 0) || __eliscript_numeric_relation(">=", symbol_op, 0)));
3411
3933
  if ((((callee)["kind"] === "property-read") && ((((callee)["children"]) ?? []).length === 2))) {
3412
3934
  {
3413
3935
  let value = lower_managed_access(callee, scope, state, functions);
@@ -3443,13 +3965,13 @@ function lower_managed_call(node, scope, state, functions) {
3443
3965
  let callee = ((((children) ?? [])[0]) ?? null);
3444
3966
  let raw_op = managed_iteration_operation(callee);
3445
3967
  let direct_helper = ((((raw_op === 480) || (raw_op === 482) || (raw_op === 483)) && (__eliscript_numeric_decrement(((children) ?? []).length) === 2)) || ((raw_op === 485) && (__eliscript_numeric_decrement(((children) ?? []).length) === 1)));
3446
- let name = ((__eliscript_value_95) => (__eliscript_truthy(__eliscript_value_95) ? ((__eliscript_value_96) => (__eliscript_truthy(__eliscript_value_96) ? (callee)["value"] : __eliscript_value_96))(((callee)["kind"] === "reference")) : __eliscript_value_95))((!__eliscript_truthy(direct_helper)));
3447
- let global = ((__eliscript_value_97) => (__eliscript_truthy(__eliscript_value_97) ? managed_global(state, name) : __eliscript_value_97))(name);
3448
- let function$ = ((__eliscript_value_98) => (__eliscript_truthy(__eliscript_value_98) ? ((__eliscript_value_99) => (__eliscript_truthy(__eliscript_value_99) ? find_function(functions, name) : __eliscript_value_99))((!__eliscript_truthy(resolve_managed_local(scope, state, name)))) : __eliscript_value_98))(name);
3449
- let direct_declaration = ((__eliscript_value_100) => (__eliscript_truthy(__eliscript_value_100) ? ((!__eliscript_truthy(global)) && (!__eliscript_truthy(((function$)["lambda"] ?? null))) && (((function$)["builtin"] ?? null) === null) && (!__eliscript_truthy(((function$)["outerState"] ?? null))) && (((function$)["source"])["kind"] === "function-declaration") && (!(__eliscript_truthy(((state)["tailCalls"] ?? null)) && __eliscript_truthy(((state)["tailCalls"])["has"](node))))) : __eliscript_value_100))(function$);
3450
- let direct_uniform = ((__eliscript_value_101) => (__eliscript_truthy(__eliscript_value_101) ? ((function$)["uniform"] ?? null) : __eliscript_value_101))(direct_declaration);
3451
- let direct = ((__eliscript_value_102) => (__eliscript_truthy(__eliscript_value_102) ? ((!__eliscript_truthy(global)) && (!__eliscript_truthy(((function$)["uniform"] ?? null))) && (!(__eliscript_truthy(((state)["tailCalls"] ?? null)) && __eliscript_truthy(((state)["tailCalls"])["has"](node)))) && (__eliscript_numeric_decrement(((children) ?? []).length) === (function$)["publicArity"])) : __eliscript_value_102))(function$);
3452
- let target = ((__eliscript_value_103) => (__eliscript_truthy(__eliscript_value_103) ? ((__eliscript_value_104) => (__eliscript_truthy(__eliscript_value_104) ? ((__eliscript_value_105) => (__eliscript_truthy(__eliscript_value_105) ? lower_managed_call_target(callee, scope, state, functions) : __eliscript_value_105))((!__eliscript_truthy(direct_helper))) : __eliscript_value_104))((!__eliscript_truthy(direct_uniform))) : __eliscript_value_103))((!__eliscript_truthy(direct)));
3968
+ let name = ((__eliscript_value_78) => (__eliscript_truthy(__eliscript_value_78) ? ((__eliscript_value_79) => (__eliscript_truthy(__eliscript_value_79) ? (callee)["value"] : __eliscript_value_79))(((callee)["kind"] === "reference")) : __eliscript_value_78))((!__eliscript_truthy(direct_helper)));
3969
+ let global = ((__eliscript_value_80) => (__eliscript_truthy(__eliscript_value_80) ? managed_global(state, name) : __eliscript_value_80))(name);
3970
+ let function$ = ((__eliscript_value_81) => (__eliscript_truthy(__eliscript_value_81) ? ((__eliscript_value_82) => (__eliscript_truthy(__eliscript_value_82) ? find_function(functions, name) : __eliscript_value_82))((!__eliscript_truthy(resolve_managed_local(scope, state, name)))) : __eliscript_value_81))(name);
3971
+ let direct_declaration = ((__eliscript_value_83) => (__eliscript_truthy(__eliscript_value_83) ? ((!__eliscript_truthy(global)) && (!__eliscript_truthy(((function$)["lambda"] ?? null))) && (((function$)["builtin"] ?? null) === null) && (!__eliscript_truthy(((function$)["outerState"] ?? null))) && (((function$)["source"])["kind"] === "function-declaration") && (!(__eliscript_truthy(((state)["tailCalls"] ?? null)) && __eliscript_truthy(((state)["tailCalls"])["has"](node))))) : __eliscript_value_83))(function$);
3972
+ let direct_uniform = ((__eliscript_value_84) => (__eliscript_truthy(__eliscript_value_84) ? ((function$)["uniform"] ?? null) : __eliscript_value_84))(direct_declaration);
3973
+ let direct = ((__eliscript_value_85) => (__eliscript_truthy(__eliscript_value_85) ? ((!__eliscript_truthy(global)) && (!__eliscript_truthy(((function$)["uniform"] ?? null))) && (!(__eliscript_truthy(((state)["tailCalls"] ?? null)) && __eliscript_truthy(((state)["tailCalls"])["has"](node)))) && (__eliscript_numeric_decrement(((children) ?? []).length) === (function$)["publicArity"])) : __eliscript_value_85))(function$);
3974
+ let target = ((__eliscript_value_86) => (__eliscript_truthy(__eliscript_value_86) ? ((__eliscript_value_87) => (__eliscript_truthy(__eliscript_value_87) ? ((__eliscript_value_88) => (__eliscript_truthy(__eliscript_value_88) ? lower_managed_call_target(callee, scope, state, functions) : __eliscript_value_88))((!__eliscript_truthy(direct_helper))) : __eliscript_value_87))((!__eliscript_truthy(direct_uniform))) : __eliscript_value_86))((!__eliscript_truthy(direct)));
3453
3975
  let steps = (__eliscript_truthy(target) ? [(target)["steps"]] : []);
3454
3976
  let values = [];
3455
3977
  let index = 1;
@@ -3477,7 +3999,7 @@ function lower_managed_call(node, scope, state, functions) {
3477
3999
  if ((__eliscript_truthy(direct) || __eliscript_truthy(direct_uniform))) {
3478
4000
  {
3479
4001
  let slot_index = (__eliscript_truthy(direct_uniform) ? ((function$)["slotEntry"] ?? null) : null);
3480
- let use_slots = ((__eliscript_value_106) => (__eliscript_truthy(__eliscript_value_106) ? Number.isInteger(slot_index) : __eliscript_value_106))(direct_uniform);
4002
+ let use_slots = ((__eliscript_value_89) => (__eliscript_truthy(__eliscript_value_89) ? Number.isInteger(slot_index) : __eliscript_value_89))(direct_uniform);
3481
4003
  let list = ((__eliscript_truthy(direct_uniform) && !(__eliscript_truthy(use_slots))) ? managed_values_arguments(state, values) : null);
3482
4004
  let arg_scope = (__eliscript_truthy(use_slots) ? new_managed_local(state, "argument-scope", null) : null);
3483
4005
  let arg_base = (__eliscript_truthy(use_slots) ? new_managed_local(state, "argument-base", null) : null);
@@ -3490,18 +4012,18 @@ function lower_managed_call(node, scope, state, functions) {
3490
4012
  }
3491
4013
  if (__eliscript_truthy(use_slots)) {
3492
4014
  (steps)["push"](managed_guard(state, word_set(arg_scope, word_constant(0))));
3493
- (steps)["push"](managed_guard(state, word_set(arg_scope, runtime_call(state, "root-scope-enter", runtime_arguments(state, [word_constant(((values) ?? []).length)])))), capture_error(state), managed_guard(state, word_set(arg_base, runtime_call(state, "root-scope-base", runtime_arguments(state, [])))), capture_error(state));
4015
+ (steps)["push"](managed_guard(state, word_set(arg_base, runtime_call(state, "rt-scope-enter", runtime_arguments(state, [word_constant(((values) ?? []).length)])))), capture_error(state), managed_guard(state, word_set(arg_scope, word_local(arg_base))));
3494
4016
  {
3495
4017
  let slot = 0;
3496
4018
  while (__eliscript_numeric_relation("<", slot, ((values) ?? []).length)) {
3497
- (steps)["push"](checked_control(state, "root-scope-set-abs", runtime_arguments(state, [managed_raw_binary(word_local(arg_base), word_constant(slot), "+"), ((((values) ?? [])[slot]) ?? null)])));
4019
+ (steps)["push"](managed_root_set_at(state, arg_base, slot, ((((values) ?? [])[slot]) ?? null)));
3498
4020
  ((slot = (slot + 1)));
3499
4021
  }
3500
4022
  }
3501
4023
  }
3502
4024
  (steps)["push"]((previous)["steps"], checked_control(state, "value-call-restore", runtime_arguments(state, [word_constant(3)])), managed_guard(state, word_set(entered, word_constant(1))), (result)["steps"], word_if(word_compare(word_local(entered), word_constant(0), "/="), word_sequence([runtime_call(state, "value-call-restore", runtime_arguments(state, [(previous)["result"]])), word_if(word_compare(word_local((state)["error"]), word_constant(0), "/="), runtime_call(state, "fail", [word_local((state)["error"])]), word_constant(0))]), word_constant(0)));
3503
4025
  if (__eliscript_truthy(use_slots)) {
3504
- (steps)["push"](word_if(word_compare(word_local(arg_scope), word_constant(0), "/="), runtime_call(state, "root-scope-exit", runtime_arguments(state, [])), word_constant(0)));
4026
+ (steps)["push"](word_if(word_compare(word_local(arg_scope), word_constant(0), "/="), runtime_call(state, "rt-scope-exit", runtime_arguments(state, [])), word_constant(0)));
3505
4027
  }
3506
4028
  if (__eliscript_truthy(list)) {
3507
4029
  {
@@ -3518,9 +4040,9 @@ function lower_managed_call(node, scope, state, functions) {
3518
4040
  }
3519
4041
  } else {
3520
4042
  {
3521
- let tail_call = ((__eliscript_value_107) => (__eliscript_truthy(__eliscript_value_107) ? ((state)["tailCalls"])["has"](node) : __eliscript_value_107))(((state)["tailCalls"] ?? null));
3522
- let dispatch = ((__eliscript_value_108) => (__eliscript_truthy(__eliscript_value_108) ? (((state)["functions"])["slotDispatch"] ?? null) : __eliscript_value_108))((!__eliscript_truthy(tail_call)));
3523
- let fast = ((__eliscript_value_109) => (__eliscript_truthy(__eliscript_value_109) ? managed_slot_arity_p(managed_slot_dispatch_entries((state)["functions"]), ((values) ?? []).length) : __eliscript_value_109))(dispatch);
4043
+ let tail_call = ((__eliscript_value_90) => (__eliscript_truthy(__eliscript_value_90) ? ((state)["tailCalls"])["has"](node) : __eliscript_value_90))(((state)["tailCalls"] ?? null));
4044
+ let dispatch = ((__eliscript_value_91) => (__eliscript_truthy(__eliscript_value_91) ? (((state)["functions"])["slotDispatch"] ?? null) : __eliscript_value_91))((!__eliscript_truthy(tail_call)));
4045
+ let fast = ((__eliscript_value_92) => (__eliscript_truthy(__eliscript_value_92) ? managed_slot_arity_p(managed_slot_dispatch_entries((state)["functions"]), ((values) ?? []).length) : __eliscript_value_92))(dispatch);
3524
4046
  if (__eliscript_truthy(fast)) {
3525
4047
  {
3526
4048
  let result = managed_slot_dispatch_call(state, target, values, dispatch);
@@ -3626,7 +4148,7 @@ function managed_bigint_literal(node) {
3626
4148
  }
3627
4149
  }
3628
4150
  }
3629
- if (((__eliscript_value_110, __eliscript_value_111) => (__eliscript_value_110 !== __eliscript_value_111))(radix, 10)) {
4151
+ if ((radix !== 10)) {
3630
4152
  ((index = 2), (text = (source)["slice"](0, 2)));
3631
4153
  }
3632
4154
  }
@@ -3800,11 +4322,11 @@ function managed_binding_shapes(node) {
3800
4322
  while (__eliscript_numeric_relation("<", index, count)) {
3801
4323
  {
3802
4324
  let binding = ((((children) ?? [])[index]) ?? null);
3803
- let parts = ((__eliscript_value_112) => (__eliscript_truthy(__eliscript_value_112) ? ((binding)["children"] ?? null) : __eliscript_value_112))(binding);
3804
- let pattern = ((__eliscript_value_113) => (__eliscript_truthy(__eliscript_value_113) ? ((((binding)["properties"] ?? ({})))["pattern"] ?? null) : __eliscript_value_113))(binding);
4325
+ let parts = ((__eliscript_value_93) => (__eliscript_truthy(__eliscript_value_93) ? ((binding)["children"] ?? null) : __eliscript_value_93))(binding);
4326
+ let pattern = ((__eliscript_value_94) => (__eliscript_truthy(__eliscript_value_94) ? ((((binding)["properties"] ?? ({})))["pattern"] ?? null) : __eliscript_value_94))(binding);
3805
4327
  let start = (__eliscript_truthy(pattern) ? 1 : 0);
3806
4328
  if ((!(__eliscript_truthy(binding) && ((binding)["kind"] === "lexical-binding") && __eliscript_truthy(Array.isArray(parts)) && __eliscript_truthy((__eliscript_truthy(pattern) ? ((pattern === true) && ((binding)["value"] === null) && __eliscript_numeric_relation(">=", ((parts) ?? []).length, 1) && __eliscript_numeric_relation("<=", ((parts) ?? []).length, 2)) : ((__eliscript_value_type((binding)["value"]) === "string") && __eliscript_numeric_relation(">", (((binding)["value"]) ?? []).length, 0) && __eliscript_numeric_relation("<=", ((parts) ?? []).length, 1)))) && ((((parts) ?? []).length === start) || (__eliscript_truthy(((((parts) ?? [])[start]) ?? null)) && (__eliscript_value_type((((((parts) ?? [])[start]) ?? null))["kind"]) === "string")))))) {
3807
- managed_fail(((__eliscript_value_114) => (__eliscript_truthy(__eliscript_value_114) ? __eliscript_value_114 : node))(binding), "managed control requires valid lexical bindings with at most one initializer");
4329
+ managed_fail(((__eliscript_value_95) => (__eliscript_truthy(__eliscript_value_95) ? __eliscript_value_95 : node))(binding), "managed control requires valid lexical bindings with at most one initializer");
3808
4330
  }
3809
4331
  if (__eliscript_truthy(pattern)) {
3810
4332
  managed_pattern_names(((((parts) ?? [])[0]) ?? null), []);
@@ -3867,27 +4389,23 @@ function lower_managed_scalar_bindings(node, scope, state, functions) {
3867
4389
  let initializer = managed_binding_initializer(binding);
3868
4390
  let first_temporary = managed_temporary_root_count(state);
3869
4391
  let previous_barrier = enter_managed_temporary_root_rhs(state, initializer);
3870
- (() => {
3871
- try {
3872
- {
3873
- let value = (__eliscript_truthy(initializer) ? lower_managed_expression(initializer, (__eliscript_truthy((properties)["sequential"]) ? inner : scope), state, functions) : lower_managed_binding_default(binding, state));
3874
- let end_temporary = managed_temporary_root_count(state);
3875
- let local = new_managed_local(state, (binding)["value"], true);
3876
- if (__eliscript_truthy(managed_readonly_capture_p(state, (binding)["value"]))) {
3877
- ((local)["capturedByValue"] = true);
3878
- }
3879
- (steps)["push"]((value)["steps"], managed_guard(state, binding_node("binding-init", local, [(value)["result"]])), root_local(state, local), clear_managed_temporary_roots(state, first_temporary, end_temporary));
3880
- (pending)["push"](local);
3881
- if (__eliscript_truthy((properties)["sequential"])) {
3882
- return (inner)["push"](local);
3883
- } else {
3884
- return null;
3885
- }
4392
+ try {
4393
+ {
4394
+ let value = (__eliscript_truthy(initializer) ? lower_managed_expression(initializer, (__eliscript_truthy((properties)["sequential"]) ? inner : scope), state, functions) : lower_managed_binding_default(binding, state));
4395
+ let end_temporary = managed_temporary_root_count(state);
4396
+ let local = new_managed_local(state, (binding)["value"], true);
4397
+ if (__eliscript_truthy(managed_readonly_capture_p(state, (binding)["value"]))) {
4398
+ ((local)["capturedByValue"] = true);
4399
+ }
4400
+ (steps)["push"]((value)["steps"], managed_guard(state, binding_node("binding-init", local, [(value)["result"]])), root_local(state, local), clear_managed_temporary_roots(state, first_temporary, end_temporary));
4401
+ (pending)["push"](local);
4402
+ if (__eliscript_truthy((properties)["sequential"])) {
4403
+ (inner)["push"](local);
3886
4404
  }
3887
- } finally {
3888
- ((state)["temporaryRootCleanupBarrier"] = previous_barrier);
3889
4405
  }
3890
- })();
4406
+ } finally {
4407
+ ((state)["temporaryRootCleanupBarrier"] = previous_barrier);
4408
+ }
3891
4409
  }
3892
4410
  ((index = (index + 1)));
3893
4411
  }
@@ -4076,7 +4594,7 @@ function lower_managed_pattern(node, source, scope, state, functions, assignment
4076
4594
  while (__eliscript_numeric_relation("<", index, count)) {
4077
4595
  {
4078
4596
  let child = ((((children) ?? [])[index]) ?? null);
4079
- let tail = ((__eliscript_value_115) => (__eliscript_truthy(__eliscript_value_115) ? (index === __eliscript_numeric_decrement(count)) : __eliscript_value_115))(rest);
4597
+ let tail = ((__eliscript_value_96) => (__eliscript_truthy(__eliscript_value_96) ? (index === __eliscript_numeric_decrement(count)) : __eliscript_value_96))(rest);
4080
4598
  let value = managed_result(state, runtime_call(state, (__eliscript_truthy(tail) ? "value-binding-iterator-rest" : "value-binding-iterator-step"), runtime_arguments(state, (__eliscript_truthy(tail) ? [(iterator)["result"]] : [(iterator)["result"], word_constant((((child)["kind"] === "binding-hole") ? 0 : 1))]))), true);
4081
4599
  (steps)["push"](managed_guard(state, word_set(active, word_constant(0))), (value)["steps"]);
4082
4600
  if ((!__eliscript_truthy(tail))) {
@@ -4086,7 +4604,7 @@ function lower_managed_pattern(node, source, scope, state, functions, assignment
4086
4604
  }
4087
4605
  ((index = (index + 1)));
4088
4606
  }
4089
- (steps)["push"](word_if(word_compare(word_local(active), word_constant(0), "/="), word_sequence([runtime_call(state, "value-source-iterator-close", runtime_arguments(state, [(iterator)["result"], word_local((state)["error"])])), word_set((state)["error"], runtime_call(state, "last-error", []))]), word_constant(0)));
4607
+ (steps)["push"](word_if(word_compare(word_local(active), word_constant(0), "/="), word_sequence([runtime_call(state, "value-source-iterator-close", runtime_arguments(state, [(iterator)["result"], word_local((state)["error"])])), word_set((state)["error"], word_node("memory-op", [word_constant(8)], "load-u32"))]), word_constant(0)));
4090
4608
  }
4091
4609
  } else {
4092
4610
  if ((kind === "map-binding-pattern")) {
@@ -4339,7 +4857,7 @@ function lower_managed_try(node, scope, state, functions) {
4339
4857
  }
4340
4858
  {
4341
4859
  let body = lower_managed_sequence((parts)["slice"](1), inner, state, functions);
4342
- (steps)["push"](word_if(word_compare(runtime_call(state, "value-exception-match", runtime_arguments(state, [word_local((state)["error"])])), word_constant(0), "/="), word_sequence([word_set(caught, runtime_call(state, "value-exception-catch", runtime_arguments(state, [word_local((state)["error"])]))), word_set((state)["error"], runtime_call(state, "last-error", [])), root_local(state, caught), setup, binding_steps, (body)["steps"], managed_guard(state, word_set(output, (body)["result"])), root_local(state, output)]), word_constant(0)));
4860
+ (steps)["push"](word_if(word_compare(runtime_call(state, "value-exception-match", runtime_arguments(state, [word_local((state)["error"])])), word_constant(0), "/="), word_sequence([word_set(caught, runtime_call(state, "value-exception-catch", runtime_arguments(state, [word_local((state)["error"])]))), word_set((state)["error"], word_node("memory-op", [word_constant(8)], "load-u32")), root_local(state, caught), setup, binding_steps, (body)["steps"], managed_guard(state, word_set(output, (body)["result"])), root_local(state, output)]), word_constant(0)));
4343
4861
  }
4344
4862
  }
4345
4863
  }
@@ -4409,7 +4927,7 @@ function snapshot_managed(lowered, state) {
4409
4927
  let owner = ((state)["snapshotOwnerToken"] ?? null);
4410
4928
  let result = (lowered)["result"];
4411
4929
  let cleared = ((state)["snapshotRootClearedAt"] ?? null);
4412
- if ((__eliscript_truthy(managed_immediate_result_p(result)) || (__eliscript_truthy(root) && __eliscript_truthy(owner) && __eliscript_truthy(((root)["stable"] ?? null)) && __eliscript_truthy(Object.is((root)["owner"], owner)) && (__eliscript_value_type((root)["epoch"]) === "number") && __eliscript_numeric_relation("<=", (root)["epoch"], ((state)["snapshotRootEpoch"] ?? 0)) && __eliscript_numeric_relation(">=", (root)["epoch"], (__eliscript_truthy(cleared) ? ((__eliscript_value_116) => (__eliscript_truthy(__eliscript_value_116) ? __eliscript_value_116 : 0))((cleared)["get"]((root)["rootIndex"])) : 0)) && __eliscript_truthy(Object.is((root)["result"], result)) && ((result)["kind"] === "local") && ((result)["type"] === "v64") && ((result)["value"] === (root)["index"]) && __eliscript_truthy(Object.is((((((state)["locals"]) ?? [])[(root)["index"]]) ?? null), (root)["local"])) && (((root)["local"])["rootIndex"] === (root)["rootIndex"])))) {
4930
+ if ((__eliscript_truthy(managed_immediate_result_p(result)) || (__eliscript_truthy(root) && __eliscript_truthy(owner) && __eliscript_truthy(((root)["stable"] ?? null)) && __eliscript_truthy(Object.is((root)["owner"], owner)) && (__eliscript_value_type((root)["epoch"]) === "number") && __eliscript_numeric_relation("<=", (root)["epoch"], ((state)["snapshotRootEpoch"] ?? 0)) && __eliscript_numeric_relation(">=", (root)["epoch"], (__eliscript_truthy(cleared) ? ((__eliscript_value_97) => (__eliscript_truthy(__eliscript_value_97) ? __eliscript_value_97 : 0))((cleared)["get"]((root)["rootIndex"])) : 0)) && __eliscript_truthy(Object.is((root)["result"], result)) && ((result)["kind"] === "local") && ((result)["type"] === "v64") && ((result)["value"] === (root)["index"]) && __eliscript_truthy(Object.is((((((state)["locals"]) ?? [])[(root)["index"]]) ?? null), (root)["local"])) && (((root)["local"])["rootIndex"] === (root)["rootIndex"])))) {
4413
4931
  return lowered;
4414
4932
  } else {
4415
4933
  {
@@ -4435,7 +4953,7 @@ function lower_managed_arithmetic(node, scope, state, functions) {
4435
4953
  let result = null;
4436
4954
  let index = 1;
4437
4955
  let operation = (((operator === "+") || (operator === "1+")) ? 0 : (((operator === "-") || (operator === "1-")) ? 1 : ((operator === "*") ? 2 : (((operator === "%") || (operator === "mod")) ? 4 : 3))));
4438
- if ((((count === 0) && !(((operator === "+") || (operator === "*")))) || (((operator === "1+") || (operator === "1-")) && ((__eliscript_value_117, __eliscript_value_118) => (__eliscript_value_117 !== __eliscript_value_118))(count, 1)))) {
4956
+ if ((((count === 0) && !(((operator === "+") || (operator === "*")))) || (((operator === "1+") || (operator === "1-")) && (count !== 1)))) {
4439
4957
  managed_fail(node, "invalid managed arithmetic arity");
4440
4958
  }
4441
4959
  if (((operation === 4) && __eliscript_numeric_relation("<", count, 2))) {
@@ -4519,7 +5037,7 @@ function lower_managed_comparison(node, scope, state, functions) {
4519
5037
  if (__eliscript_numeric_relation("<", count, 2)) {
4520
5038
  managed_fail(node, "managed comparisons require at least two operands");
4521
5039
  }
4522
- if (((operator === "eq") && ((__eliscript_value_119, __eliscript_value_120) => (__eliscript_value_119 !== __eliscript_value_120))(count, 2))) {
5040
+ if (((operator === "eq") && (count !== 2))) {
4523
5041
  managed_fail(node, "managed eq requires two operands");
4524
5042
  }
4525
5043
  while (__eliscript_numeric_relation("<", index, count)) {
@@ -4565,31 +5083,14 @@ function lower_managed_key(node, scope, state, functions) {
4565
5083
  }
4566
5084
  }
4567
5085
  function lower_managed_access_key(node, receiver, scope, state, functions) {
4568
- {
4569
- let text = managed_static_method(node);
4570
- if ((__eliscript_truthy(text) && __eliscript_numeric_relation("<=", ((text) ?? []).length, 20))) {
4571
- {
4572
- let arguments$ = [receiver, word_constant(((text) ?? []).length)];
4573
- let index = 0;
4574
- let local = new_managed_temporary_local(state, "literal-property-key");
4575
- let fallback = lower_managed_key(node, scope, state, functions);
4576
- while (__eliscript_numeric_relation("<", index, 20)) {
4577
- {
4578
- let low = (__eliscript_numeric_relation("<", index, ((text) ?? []).length) ? (text).charCodeAt(index) : 0);
4579
- let high = (__eliscript_numeric_relation("<", (index + 1), ((text) ?? []).length) ? (text).charCodeAt((index + 1)) : 0);
4580
- (arguments$)["push"](word_constant((low + __eliscript_numeric_mul(high, 65536))));
4581
- }
4582
- ((index = (index + 2)));
4583
- }
4584
- return ({"steps": word_sequence([managed_guard(state, word_set(local, runtime_call(state, "value-property-literal-key", runtime_arguments(state, arguments$)))), capture_error(state), managed_guard(state, word_if(word_compare(word_local(local), word_constant(0), "="), word_sequence([(fallback)["steps"], managed_guard(state, word_set(local, (fallback)["result"]))]), word_constant(0))), root_local(state, local)]), "result": word_local(local)});
4585
- }
4586
- } else {
4587
- {
4588
- let operand = snapshot_managed(lower_managed_raw_key(node, scope, state, functions), state);
4589
- let result = managed_result(state, runtime_call(state, "value-source-access-key", runtime_arguments(state, [receiver, (operand)["result"]])), true);
4590
- ((result)["steps"] = word_sequence([(operand)["steps"], (result)["steps"]]));
4591
- return result;
4592
- }
5086
+ if (__eliscript_truthy(managed_static_method(node))) {
5087
+ return lower_managed_key(node, scope, state, functions);
5088
+ } else {
5089
+ {
5090
+ let operand = snapshot_managed(lower_managed_raw_key(node, scope, state, functions), state);
5091
+ let result = managed_result(state, runtime_call(state, "value-source-access-key", runtime_arguments(state, [receiver, (operand)["result"]])), true);
5092
+ ((result)["steps"] = word_sequence([(operand)["steps"], (result)["steps"]]));
5093
+ return result;
4593
5094
  }
4594
5095
  }
4595
5096
  }
@@ -4623,41 +5124,121 @@ function lower_managed_array(node, scope, state, functions) {
4623
5124
  function lower_managed_static_key(property, state) {
4624
5125
  return lower_managed_literal(({"kind": "literal", "value": (property)["value"], "children": []}), state);
4625
5126
  }
5127
+ function managed_object_capacity(count) {
5128
+ if (typeof count === "number") {
5129
+ {
5130
+ let cap = 4;
5131
+ let target = ((count > 1024) ? 1024 : count);
5132
+ while ((cap < target)) {
5133
+ ((cap = (cap * 2)));
5134
+ }
5135
+ return cap;
5136
+ }
5137
+ } else {
5138
+ {
5139
+ let cap = 4;
5140
+ let target = (__eliscript_numeric_relation(">", count, 1024) ? 1024 : count);
5141
+ while (__eliscript_numeric_relation("<", cap, target)) {
5142
+ ((cap = __eliscript_numeric_mul(cap, 2)));
5143
+ }
5144
+ return cap;
5145
+ }
5146
+ }
5147
+ }
4626
5148
  function lower_managed_object(node, scope, state, functions) {
4627
5149
  {
4628
5150
  let properties = (node)["children"];
4629
- let clone_source = ((((properties) ?? []).length === 0) ? ((state)["managedCloneSource"] ?? null) : null);
4630
- let result = managed_result(state, (__eliscript_truthy(clone_source) ? runtime_call(state, "value-collection-clone-new", runtime_arguments(state, [word_local(clone_source)])) : runtime_call(state, "value-object-new", runtime_arguments(state, [word_constant(3)]))), true);
5151
+ let prop_count = ((properties) ?? []).length;
5152
+ let clone_source = ((prop_count === 0) ? ((state)["managedCloneSource"] ?? null) : null);
5153
+ let result = managed_result(state, (__eliscript_truthy(clone_source) ? runtime_call(state, "value-collection-clone-new", runtime_arguments(state, [word_local(clone_source)])) : ((__eliscript_numeric_relation(">", prop_count, 4) || (prop_count === 1) || (prop_count === 2)) ? runtime_call(state, "value-object-new-capacity", runtime_arguments(state, [word_constant(3), word_constant((__eliscript_numeric_relation("<=", prop_count, 2) ? 2 : managed_object_capacity(prop_count)))])) : runtime_call(state, "value-object-new", runtime_arguments(state, [word_constant(3)])))), true);
4631
5154
  let steps = [(result)["steps"]];
4632
5155
  let i = 0;
4633
5156
  let prototype_seen = null;
5157
+ let all_static_distinct = (__eliscript_numeric_relation(">=", prop_count, 1) && __eliscript_numeric_relation("<=", prop_count, 1024));
5158
+ let seen_static = new (globalThis.Set)();
4634
5159
  while (__eliscript_numeric_relation("<", i, ((properties) ?? []).length)) {
4635
5160
  {
4636
5161
  let property = ((((properties) ?? [])[i]) ?? null);
4637
- if ((!(((property)["kind"] === "object-property") && __eliscript_truthy((property)["children"]) && ((((property)["children"]) ?? []).length === (__eliscript_truthy(((property)["properties"])["computed"]) ? 2 : 1))))) {
5162
+ let props = (property)["properties"];
5163
+ let computed = (props)["computed"];
5164
+ let key_name = (property)["value"];
5165
+ if ((!(((property)["kind"] === "object-property") && __eliscript_truthy((property)["children"]) && ((((property)["children"]) ?? []).length === (__eliscript_truthy(computed) ? 2 : 1))))) {
4638
5166
  managed_fail(property, "invalid managed object property");
4639
5167
  }
5168
+ if (__eliscript_truthy(all_static_distinct)) {
5169
+ if ((__eliscript_truthy(computed) || !((__eliscript_value_type(key_name) === "string")) || (key_name === "__proto__") || __eliscript_truthy((seen_static)["has"](key_name)))) {
5170
+ ((all_static_distinct = false));
5171
+ } else {
5172
+ (seen_static)["add"](key_name);
5173
+ }
5174
+ }
4640
5175
  }
4641
5176
  ((i = (i + 1)));
4642
5177
  }
4643
5178
  ((i = 0));
4644
- while (__eliscript_numeric_relation("<", i, ((properties) ?? []).length)) {
5179
+ if (__eliscript_truthy(all_static_distinct)) {
4645
5180
  {
4646
- let property = ((((properties) ?? [])[i]) ?? null);
4647
- let children = (property)["children"];
4648
- let computed = ((property)["properties"])["computed"];
4649
- let prototype = ((!__eliscript_truthy(computed)) && ((property)["value"] === "__proto__"));
4650
- let key = snapshot_managed((__eliscript_truthy(computed) ? lower_managed_key(((((children) ?? [])[0]) ?? null), scope, state, functions) : lower_managed_static_key(property, state)), state);
4651
- let value = snapshot_managed(lower_managed_expression(((((children) ?? [])[(__eliscript_truthy(computed) ? 1 : 0)]) ?? null), scope, state, functions), state);
4652
- if (__eliscript_truthy(prototype)) {
4653
- if (__eliscript_truthy(prototype_seen)) {
4654
- managed_fail(property, "duplicate object prototype setter");
5181
+ let static_keys = [];
5182
+ let static_vals = [];
5183
+ while (__eliscript_numeric_relation("<", i, prop_count)) {
5184
+ {
5185
+ let property = ((((properties) ?? [])[i]) ?? null);
5186
+ let children = (property)["children"];
5187
+ let key = snapshot_managed(lower_managed_static_key(property, state), state);
5188
+ let value = snapshot_managed(lower_managed_expression(((((children) ?? [])[0]) ?? null), scope, state, functions), state);
5189
+ (steps)["push"]((key)["steps"], (value)["steps"]);
5190
+ (static_keys)["push"]((key)["result"]);
5191
+ (static_vals)["push"]((value)["result"]);
5192
+ }
5193
+ ((i = (i + 1)));
5194
+ }
5195
+ ((i = 0));
5196
+ while (__eliscript_numeric_relation("<", i, prop_count)) {
5197
+ {
5198
+ let rem = __eliscript_numeric_sub(prop_count, i);
5199
+ if (__eliscript_numeric_relation(">=", rem, 4)) {
5200
+ (steps)["push"](checked_control(state, "value-object-init-4", runtime_arguments(state, [(result)["result"], ((((static_keys) ?? [])[i]) ?? null), ((((static_vals) ?? [])[i]) ?? null), ((((static_keys) ?? [])[(i + 1)]) ?? null), ((((static_vals) ?? [])[(i + 1)]) ?? null), ((((static_keys) ?? [])[(i + 2)]) ?? null), ((((static_vals) ?? [])[(i + 2)]) ?? null), ((((static_keys) ?? [])[(i + 3)]) ?? null), ((((static_vals) ?? [])[(i + 3)]) ?? null)])));
5201
+ ((i = (i + 4)));
5202
+ } else {
5203
+ if ((rem === 3)) {
5204
+ (steps)["push"](checked_control(state, "value-object-init-3", runtime_arguments(state, [(result)["result"], ((((static_keys) ?? [])[i]) ?? null), ((((static_vals) ?? [])[i]) ?? null), ((((static_keys) ?? [])[(i + 1)]) ?? null), ((((static_vals) ?? [])[(i + 1)]) ?? null), ((((static_keys) ?? [])[(i + 2)]) ?? null), ((((static_vals) ?? [])[(i + 2)]) ?? null)])));
5205
+ ((i = (i + 3)));
5206
+ } else {
5207
+ if ((rem === 2)) {
5208
+ (steps)["push"](checked_control(state, "value-object-init-2", runtime_arguments(state, [(result)["result"], ((((static_keys) ?? [])[i]) ?? null), ((((static_vals) ?? [])[i]) ?? null), ((((static_keys) ?? [])[(i + 1)]) ?? null), ((((static_vals) ?? [])[(i + 1)]) ?? null)])));
5209
+ ((i = (i + 2)));
5210
+ } else {
5211
+ (steps)["push"](checked_control(state, "value-object-init-static", runtime_arguments(state, [(result)["result"], ((((static_keys) ?? [])[i]) ?? null), ((((static_vals) ?? [])[i]) ?? null)])));
5212
+ ((i = (i + 1)));
5213
+ }
5214
+ }
5215
+ }
4655
5216
  }
4656
- ((prototype_seen = true));
4657
5217
  }
4658
- (steps)["push"]((key)["steps"], checked_control(state, "value-property-key-check", runtime_arguments(state, [(result)["result"], (key)["result"]])), (value)["steps"], checked_control(state, "value-object-put", runtime_arguments(state, [(result)["result"], (key)["result"], (value)["result"], word_constant((__eliscript_truthy(prototype) ? 1 : 2))])));
4659
5218
  }
4660
- ((i = (i + 1)));
5219
+ } else {
5220
+ while (__eliscript_numeric_relation("<", i, ((properties) ?? []).length)) {
5221
+ {
5222
+ let property = ((((properties) ?? [])[i]) ?? null);
5223
+ let children = (property)["children"];
5224
+ let computed = ((property)["properties"])["computed"];
5225
+ let prototype = ((!__eliscript_truthy(computed)) && ((property)["value"] === "__proto__"));
5226
+ let key = snapshot_managed((__eliscript_truthy(computed) ? lower_managed_key(((((children) ?? [])[0]) ?? null), scope, state, functions) : lower_managed_static_key(property, state)), state);
5227
+ let value = snapshot_managed(lower_managed_expression(((((children) ?? [])[(__eliscript_truthy(computed) ? 1 : 0)]) ?? null), scope, state, functions), state);
5228
+ if (__eliscript_truthy(prototype)) {
5229
+ if (__eliscript_truthy(prototype_seen)) {
5230
+ managed_fail(property, "duplicate object prototype setter");
5231
+ }
5232
+ ((prototype_seen = true));
5233
+ }
5234
+ (steps)["push"]((key)["steps"]);
5235
+ if ((__eliscript_truthy(computed) || __eliscript_truthy(prototype))) {
5236
+ (steps)["push"](checked_control(state, "value-property-key-check", runtime_arguments(state, [(result)["result"], (key)["result"]])));
5237
+ }
5238
+ (steps)["push"]((value)["steps"], checked_control(state, "value-object-put", runtime_arguments(state, [(result)["result"], (key)["result"], (value)["result"], word_constant((__eliscript_truthy(prototype) ? 1 : 2))])));
5239
+ }
5240
+ ((i = (i + 1)));
5241
+ }
4661
5242
  }
4662
5243
  ((result)["steps"] = word_sequence(steps));
4663
5244
  return result;
@@ -4685,7 +5266,7 @@ function lower_managed_object_operation(node, scope, state, functions) {
4685
5266
  }
4686
5267
  } else {
4687
5268
  {
4688
- let copy = ((__eliscript_value_121) => (__eliscript_truthy(__eliscript_value_121) ? managed_result(state, runtime_call(state, "value-object-copy", runtime_arguments(state, [(receiver)["result"]])), true) : __eliscript_value_121))(assoc);
5269
+ let copy = ((__eliscript_value_98) => (__eliscript_truthy(__eliscript_value_98) ? managed_result(state, runtime_call(state, "value-object-copy", runtime_arguments(state, [(receiver)["result"]])), true) : __eliscript_value_98))(assoc);
4689
5270
  let key = snapshot_managed(lower_managed_key(((((children) ?? [])[1]) ?? null), scope, state, functions), state);
4690
5271
  if (__eliscript_truthy(assoc)) {
4691
5272
  (steps)["push"]((copy)["steps"]);
@@ -4771,7 +5352,7 @@ function lower_managed_array_method(node, scope, state, functions) {
4771
5352
  let children = (node)["children"];
4772
5353
  let count = ((children) ?? []).length;
4773
5354
  let key = ((((children) ?? [])[1]) ?? null);
4774
- let method = ((__eliscript_value_122) => (__eliscript_truthy(__eliscript_value_122) ? ((__eliscript_value_123) => (__eliscript_truthy(__eliscript_value_123) ? (key)["value"] : __eliscript_value_123))(((key)["kind"] === "literal")) : __eliscript_value_122))(key);
5355
+ let method = ((__eliscript_value_99) => (__eliscript_truthy(__eliscript_value_99) ? ((__eliscript_value_100) => (__eliscript_truthy(__eliscript_value_100) ? (key)["value"] : __eliscript_value_100))(((key)["kind"] === "literal")) : __eliscript_value_99))(key);
4775
5356
  if ((!(__eliscript_numeric_relation(">=", count, 2) && ((method === "push") || (method === "pop") || (method === "slice"))))) {
4776
5357
  managed_fail(node, "managed arrays require a supported static method");
4777
5358
  }
@@ -4823,7 +5404,7 @@ function managed_invoke_arguments(state, callee, values, receiver = null, tail =
4823
5404
  {
4824
5405
  let list = managed_values_arguments(state, values);
4825
5406
  let previous = ((!__eliscript_truthy(tail)) ? managed_result(state, runtime_call(state, "value-function-current-this", runtime_arguments(state, [])), true) : null);
4826
- let result = managed_result(state, runtime_call(state, (__eliscript_truthy(tail) ? "value-source-tail-call" : "value-source-invoke-rooted-with-this"), runtime_arguments(state, [callee, ((__eliscript_value_124) => (__eliscript_truthy(__eliscript_value_124) ? __eliscript_value_124 : word_constant(3)))(receiver), (list)["result"], word_constant(((values) ?? []).length)])), true);
5407
+ let result = managed_result(state, runtime_call(state, (__eliscript_truthy(tail) ? "value-source-tail-call" : "value-source-invoke-rooted-with-this"), runtime_arguments(state, [callee, ((__eliscript_value_101) => (__eliscript_truthy(__eliscript_value_101) ? __eliscript_value_101 : word_constant(3)))(receiver), (list)["result"], word_constant(((values) ?? []).length)])), true);
4827
5408
  let list_local = (((((state)["locals"]) ?? [])[((list)["result"])["value"]]) ?? null);
4828
5409
  let previous_local = (__eliscript_truthy(previous) ? (((((state)["locals"]) ?? [])[((previous)["result"])["value"]]) ?? null) : null);
4829
5410
  ((result)["steps"] = word_sequence([(list)["steps"], (__eliscript_truthy(previous) ? (previous)["steps"] : word_constant(0)), (result)["steps"], managed_root_set(state, (list_local)["rootIndex"], word_constant(0)), (__eliscript_truthy(previous_local) ? managed_root_set(state, (previous_local)["rootIndex"], word_constant(0)) : word_constant(0))]));
@@ -4833,9 +5414,9 @@ function managed_invoke_arguments(state, callee, values, receiver = null, tail =
4833
5414
  function lower_managed_callback_loop(node, scope, state, functions, method, receiver, arguments$) {
4834
5415
  ((state)["callable"] = true);
4835
5416
  {
4836
- const __eliscript_value_125 = (["map", "filter", "forEach", "some", "every", "find", "findIndex", "findLast", "findLastIndex", "reduce", "reduceRight"])["indexOf"](method);
5417
+ const __eliscript_value_102 = (["map", "filter", "forEach", "some", "every", "find", "findIndex", "findLast", "findLastIndex", "reduce", "reduceRight"])["indexOf"](method);
4837
5418
  {
4838
- let operation = __eliscript_value_125;
5419
+ let operation = __eliscript_value_102;
4839
5420
  if (__eliscript_numeric_relation("<", operation, 0)) {
4840
5421
  managed_fail(node, "unknown managed Array callback method");
4841
5422
  }
@@ -5288,13 +5869,11 @@ function managed_typeof_index(source, index) {
5288
5869
  }
5289
5870
  }
5290
5871
  if (__eliscript_truthy(closed)) {
5291
- (() => {
5292
- try {
5293
- return ((key = JSON.parse((source)["slice"](start, index))));
5294
- } catch (error) {
5295
- return ((valid = false));
5296
- }
5297
- })();
5872
+ try {
5873
+ ((key = JSON.parse((source)["slice"](start, index))));
5874
+ } catch (error) {
5875
+ ((valid = false));
5876
+ }
5298
5877
  } else {
5299
5878
  ((valid = false));
5300
5879
  }
@@ -5666,7 +6245,7 @@ function lower_managed_bound_capture(node, scope, state, functions) {
5666
6245
  let receiver = snapshot_managed(lower_managed_expression(((((children) ?? [])[0]) ?? null), scope, state, functions), state);
5667
6246
  let key = lower_managed_key(((((children) ?? [])[1]) ?? null), scope, state, functions);
5668
6247
  let family = managed_bound_method_family(method);
5669
- let function$ = ((__eliscript_value_126) => (__eliscript_truthy(__eliscript_value_126) ? ((__eliscript_value_127) => (__eliscript_truthy(__eliscript_value_127) ? managed_bound_method(method, state, functions) : __eliscript_value_127))(__eliscript_numeric_relation(">", ((((family) ?? [])[0]) ?? null), 0)) : __eliscript_value_126))(method);
6248
+ let function$ = ((__eliscript_value_103) => (__eliscript_truthy(__eliscript_value_103) ? ((__eliscript_value_104) => (__eliscript_truthy(__eliscript_value_104) ? managed_bound_method(method, state, functions) : __eliscript_value_104))(__eliscript_numeric_relation(">", ((((family) ?? [])[0]) ?? null), 0)) : __eliscript_value_103))(method);
5670
6249
  let result = managed_result(state, runtime_call(state, "value-async-method-capture", runtime_arguments(state, [(receiver)["result"], (key)["result"], word_constant((__eliscript_truthy(function$) ? (function$)["tableSlot"] : 0)), word_constant(((((family) ?? [])[0]) ?? null)), word_constant(((((family) ?? [])[1]) ?? null))])), true);
5671
6250
  ((result)["steps"] = word_sequence([(receiver)["steps"], (key)["steps"], (result)["steps"]]));
5672
6251
  return result;
@@ -5918,7 +6497,7 @@ function lower_managed_async_intrinsic(node, scope, state, functions) {
5918
6497
  function lower_managed_promise_constructor(node, scope, state, functions, operation = null) {
5919
6498
  {
5920
6499
  let children = (node)["children"];
5921
- let callee = lower_managed_function_value(managed_builtin_function(((__eliscript_value_128) => (__eliscript_truthy(__eliscript_value_128) ? __eliscript_value_128 : 69))(operation), state, functions), state);
6500
+ let callee = lower_managed_function_value(managed_builtin_function(((__eliscript_value_105) => (__eliscript_truthy(__eliscript_value_105) ? __eliscript_value_105 : 69))(operation), state, functions), state);
5922
6501
  let steps = [(callee)["steps"]];
5923
6502
  let arguments$ = [];
5924
6503
  let index = 1;
@@ -6043,7 +6622,7 @@ function lower_managed_constructor(node, scope, state, functions) {
6043
6622
  {
6044
6623
  let ctor = (((((node)["children"]) ?? [])[0]) ?? null);
6045
6624
  let name = managed_static_reference(ctor);
6046
- let root = ((__eliscript_value_129) => (__eliscript_truthy(__eliscript_value_129) ? (((((name)["split"](".")) ?? [])[0]) ?? null) : __eliscript_value_129))(name);
6625
+ let root = ((__eliscript_value_106) => (__eliscript_truthy(__eliscript_value_106) ? (((((name)["split"](".")) ?? [])[0]) ?? null) : __eliscript_value_106))(name);
6047
6626
  if ((__eliscript_truthy((["Map", "Set", "WeakMap", "WeakSet", "globalThis.Map", "globalThis.Set", "globalThis.WeakMap", "globalThis.WeakSet"])["includes"](name)) && (__eliscript_truthy(managed_global(state, root)) || __eliscript_truthy(find_function(functions, root))))) {
6048
6627
  managed_fail(ctor, "managed collection constructor binding is shadowed");
6049
6628
  }
@@ -6134,7 +6713,97 @@ function managed_host_capability_node(node) {
6134
6713
  }
6135
6714
  }
6136
6715
  function managed_host_capabilities(functions) {
6137
- return prepare_host_capabilities(({"abi": "memory-u32", "functions": functions}));
6716
+ return prepare_host_capabilities(mark_trusted_runtime_program(({"abi": "memory-u32", "functions": functions})));
6717
+ }
6718
+ function has_managed_local_p(scope, state, name) {
6719
+ return ((__eliscript_value_107) => (__eliscript_truthy(__eliscript_value_107) ? __eliscript_value_107 : ((__eliscript_value_108) => (__eliscript_truthy(__eliscript_value_108) ? __eliscript_value_108 : ((__eliscript_value_109) => (__eliscript_truthy(__eliscript_value_109) ? has_managed_local_p((state)["outerScope"], (state)["outerState"], name) : __eliscript_value_109))(((state)["outerState"] ?? null))))(find_local((state)["captures"], name))))(find_local(scope, name));
6720
+ }
6721
+ function managed_outer_local_ref_p(node, idx, scope, state) {
6722
+ return ((__eliscript_value_110) => (__eliscript_truthy(__eliscript_value_110) ? ((__eliscript_value_111) => (__eliscript_truthy(__eliscript_value_111) ? ((__eliscript_value_112) => (__eliscript_truthy(__eliscript_value_112) ? ((__eliscript_value_113) => (__eliscript_truthy(__eliscript_value_113) ? ((__eliscript_value_114) => (__eliscript_truthy(__eliscript_value_114) ? has_managed_local_p(scope, state, (node)["value"]) : __eliscript_value_114))((!(managed_binding_key((node)["value"]) === managed_binding_key(idx)))) : __eliscript_value_113))((__eliscript_value_type((node)["value"]) === "string")) : __eliscript_value_112))(((((node)["children"]) ?? []).length === 0)) : __eliscript_value_111))(((node)["kind"] === "reference")) : __eliscript_value_110))(node);
6723
+ }
6724
+ function managed_param_ref_p(node, idx) {
6725
+ return ((__eliscript_value_115) => (__eliscript_truthy(__eliscript_value_115) ? (((node)["kind"] === "reference") && ((((node)["children"]) ?? []).length === 0) && (__eliscript_value_type((node)["value"]) === "string") && (managed_binding_key((node)["value"]) === managed_binding_key(idx))) : __eliscript_value_115))(node);
6726
+ }
6727
+ function managed_same_ref_p(left, right) {
6728
+ return ((__eliscript_value_116) => (__eliscript_truthy(__eliscript_value_116) ? ((__eliscript_value_117) => (__eliscript_truthy(__eliscript_value_117) ? (((left)["kind"] === "reference") && ((right)["kind"] === "reference") && (managed_binding_key((left)["value"]) === managed_binding_key((right)["value"]))) : __eliscript_value_117))(right) : __eliscript_value_116))(left);
6729
+ }
6730
+ function match_managed_array_build_copy(builder, scope, state) {
6731
+ {
6732
+ let props = (__eliscript_truthy(builder) ? (builder)["properties"] : null);
6733
+ if ((__eliscript_truthy(builder) && ((builder)["kind"] === "function-expression") && __eliscript_truthy(props) && !(__eliscript_truthy(((props)["async"] ?? null))) && (((props)["parameterCount"] ?? null) === 1) && ((((builder)["children"]) ?? []).length === 2))) {
6734
+ {
6735
+ let param = (((((builder)["children"]) ?? [])[0]) ?? null);
6736
+ let pprops = (__eliscript_truthy(param) ? (param)["properties"] : null);
6737
+ let body = (((((builder)["children"]) ?? [])[1]) ?? null);
6738
+ if ((__eliscript_truthy(param) && ((param)["kind"] === "parameter-binding") && __eliscript_truthy(pprops) && (((pprops)["parameterKind"] ?? null) === "required") && (__eliscript_value_type((param)["value"]) === "string") && __eliscript_truthy(body))) {
6739
+ {
6740
+ let idx = (param)["value"];
6741
+ let bkind = (body)["kind"];
6742
+ let bval = (body)["value"];
6743
+ let bch = (body)["children"];
6744
+ if (((bkind === "property-read") && (bval === "get") && (((bch) ?? []).length === 2) && __eliscript_truthy(managed_outer_local_ref_p(((((bch) ?? [])[0]) ?? null), idx, scope, state)) && __eliscript_truthy(managed_param_ref_p(((((bch) ?? [])[1]) ?? null), idx)))) {
6745
+ return ({"op": "value-array-copy-prefix", "source": ((((bch) ?? [])[0]) ?? null)});
6746
+ } else {
6747
+ if (((bkind === "property-read") && (bval === "get") && (((bch) ?? []).length === 2) && __eliscript_truthy(managed_outer_local_ref_p(((((bch) ?? [])[0]) ?? null), idx, scope, state)) && __eliscript_truthy(((sel) => {
6748
+ return ((__eliscript_value_118) => (__eliscript_truthy(__eliscript_value_118) ? (((sel)["kind"] === "conditional") && ((sel)["value"] === "if") && ((((sel)["children"]) ?? []).length === 3)) : __eliscript_value_118))(sel);
6749
+ })(((((bch) ?? [])[1]) ?? null))))) {
6750
+ {
6751
+ let sel = ((((bch) ?? [])[1]) ?? null);
6752
+ let sch = (sel)["children"];
6753
+ let cnd = ((((sch) ?? [])[0]) ?? null);
6754
+ let thn = ((((sch) ?? [])[1]) ?? null);
6755
+ let els = ((((sch) ?? [])[2]) ?? null);
6756
+ if ((__eliscript_truthy(cnd) && ((cnd)["kind"] === "intrinsic") && ((((cnd)["children"]) ?? []).length === 2) && __eliscript_truthy(managed_param_ref_p((((((cnd)["children"]) ?? [])[0]) ?? null), idx)) && __eliscript_truthy(managed_outer_local_ref_p((((((cnd)["children"]) ?? [])[1]) ?? null), idx, scope, state)))) {
6757
+ if ((((cnd)["value"] === ">=") && __eliscript_truthy(thn) && ((thn)["kind"] === "intrinsic") && ((thn)["value"] === "1+") && ((((thn)["children"]) ?? []).length === 1) && __eliscript_truthy(managed_param_ref_p((((((thn)["children"]) ?? [])[0]) ?? null), idx)) && __eliscript_truthy(managed_param_ref_p(els, idx)))) {
6758
+ return ({"op": "value-array-copy-remove", "source": ((((bch) ?? [])[0]) ?? null), "index": (((((cnd)["children"]) ?? [])[1]) ?? null)});
6759
+ } else {
6760
+ if ((((cnd)["value"] === "<") && __eliscript_truthy(managed_param_ref_p(thn, idx)) && __eliscript_truthy(els) && ((els)["kind"] === "intrinsic") && ((els)["value"] === "1+") && ((((els)["children"]) ?? []).length === 1) && __eliscript_truthy(managed_param_ref_p((((((els)["children"]) ?? [])[0]) ?? null), idx)))) {
6761
+ return ({"op": "value-array-copy-remove", "source": ((((bch) ?? [])[0]) ?? null), "index": (((((cnd)["children"]) ?? [])[1]) ?? null)});
6762
+ } else {
6763
+ return null;
6764
+ }
6765
+ }
6766
+ } else {
6767
+ return null;
6768
+ }
6769
+ }
6770
+ } else {
6771
+ if (((bkind === "conditional") && (bval === "if") && (((bch) ?? []).length === 3))) {
6772
+ {
6773
+ let cnd = ((((bch) ?? [])[0]) ?? null);
6774
+ let thn = ((((bch) ?? [])[1]) ?? null);
6775
+ let els = ((((bch) ?? [])[2]) ?? null);
6776
+ if ((__eliscript_truthy(cnd) && ((cnd)["kind"] === "intrinsic") && ((cnd)["value"] === "=") && ((((cnd)["children"]) ?? []).length === 2) && __eliscript_truthy(managed_param_ref_p((((((cnd)["children"]) ?? [])[0]) ?? null), idx)) && __eliscript_truthy(managed_outer_local_ref_p((((((cnd)["children"]) ?? [])[1]) ?? null), idx, scope, state)) && __eliscript_truthy(managed_outer_local_ref_p(thn, idx, scope, state)) && __eliscript_truthy(els) && ((els)["kind"] === "property-read") && ((els)["value"] === "get") && ((((els)["children"]) ?? []).length === 2) && __eliscript_truthy(managed_outer_local_ref_p((((((els)["children"]) ?? [])[0]) ?? null), idx, scope, state)))) {
6777
+ {
6778
+ let wref = (((((cnd)["children"]) ?? [])[1]) ?? null);
6779
+ let sel = (((((els)["children"]) ?? [])[1]) ?? null);
6780
+ let sch = (__eliscript_truthy(sel) ? (sel)["children"] : null);
6781
+ if ((__eliscript_truthy(sel) && ((sel)["kind"] === "conditional") && ((sel)["value"] === "if") && (((sch) ?? []).length === 3) && __eliscript_truthy(((c2, t2, e2) => {
6782
+ return ((__eliscript_value_119) => (__eliscript_truthy(__eliscript_value_119) ? ((__eliscript_value_120) => (__eliscript_truthy(__eliscript_value_120) ? ((__eliscript_value_121) => (__eliscript_truthy(__eliscript_value_121) ? ((__eliscript_value_122) => (__eliscript_truthy(__eliscript_value_122) ? ((__eliscript_value_123) => (__eliscript_truthy(__eliscript_value_123) ? ((__eliscript_value_124) => (__eliscript_truthy(__eliscript_value_124) ? ((__eliscript_value_125) => (__eliscript_truthy(__eliscript_value_125) ? ((__eliscript_value_126) => (__eliscript_truthy(__eliscript_value_126) ? ((__eliscript_value_127) => (__eliscript_truthy(__eliscript_value_127) ? ((__eliscript_value_128) => (__eliscript_truthy(__eliscript_value_128) ? ((__eliscript_value_129) => (__eliscript_truthy(__eliscript_value_129) ? managed_param_ref_p((((((e2)["children"]) ?? [])[0]) ?? null), idx) : __eliscript_value_129))(((((e2)["children"]) ?? []).length === 1)) : __eliscript_value_128))(((e2)["value"] === "1-")) : __eliscript_value_127))(((e2)["kind"] === "intrinsic")) : __eliscript_value_126))(e2) : __eliscript_value_125))(managed_param_ref_p(t2, idx)) : __eliscript_value_124))(managed_same_ref_p((((((c2)["children"]) ?? [])[1]) ?? null), wref)) : __eliscript_value_123))(managed_param_ref_p((((((c2)["children"]) ?? [])[0]) ?? null), idx)) : __eliscript_value_122))(((((c2)["children"]) ?? []).length === 2)) : __eliscript_value_121))(((c2)["value"] === "<")) : __eliscript_value_120))(((c2)["kind"] === "intrinsic")) : __eliscript_value_119))(c2);
6783
+ })(((((sch) ?? [])[0]) ?? null), ((((sch) ?? [])[1]) ?? null), ((((sch) ?? [])[2]) ?? null))))) {
6784
+ return ({"op": "value-array-copy-insert", "source": (((((els)["children"]) ?? [])[0]) ?? null), "index": wref, "replacement": thn});
6785
+ } else {
6786
+ return null;
6787
+ }
6788
+ }
6789
+ } else {
6790
+ return null;
6791
+ }
6792
+ }
6793
+ } else {
6794
+ return null;
6795
+ }
6796
+ }
6797
+ }
6798
+ }
6799
+ } else {
6800
+ return null;
6801
+ }
6802
+ }
6803
+ } else {
6804
+ return null;
6805
+ }
6806
+ }
6138
6807
  }
6139
6808
  function lower_managed_expression(node, scope, state, functions) {
6140
6809
  {
@@ -6293,11 +6962,43 @@ function lower_managed_expression_dispatch(node, scope, state, functions) {
6293
6962
  managed_fail(node, "invalid private array builder arity");
6294
6963
  }
6295
6964
  {
6296
- let count = snapshot_managed(lower_managed_expression(((((children) ?? [])[0]) ?? null), scope, state, functions), state);
6297
- let builder = snapshot_managed(lower_managed_expression(((((children) ?? [])[1]) ?? null), scope, state, functions), state);
6298
- let result = managed_result(state, runtime_call(state, "value-array-build", runtime_arguments(state, [(count)["result"], (builder)["result"]])), true);
6299
- ((result)["steps"] = word_sequence([(count)["steps"], (builder)["steps"], (result)["steps"]]));
6300
- return result;
6965
+ let fast = match_managed_array_build_copy(((((children) ?? [])[1]) ?? null), scope, state);
6966
+ if (__eliscript_truthy(fast)) {
6967
+ {
6968
+ let count = snapshot_managed(lower_managed_expression(((((children) ?? [])[0]) ?? null), scope, state, functions), state);
6969
+ let source = snapshot_managed(lower_managed_expression((fast)["source"], scope, state, functions), state);
6970
+ let steps = [(count)["steps"], (source)["steps"]];
6971
+ let args = [(count)["result"], (source)["result"]];
6972
+ if (__eliscript_truthy(((fast)["index"] ?? null))) {
6973
+ {
6974
+ let idx = snapshot_managed(lower_managed_expression((fast)["index"], scope, state, functions), state);
6975
+ (steps)["push"]((idx)["steps"]);
6976
+ (args)["push"]((idx)["result"]);
6977
+ }
6978
+ }
6979
+ if (__eliscript_truthy(((fast)["replacement"] ?? null))) {
6980
+ {
6981
+ let rep = snapshot_managed(lower_managed_expression((fast)["replacement"], scope, state, functions), state);
6982
+ (steps)["push"]((rep)["steps"]);
6983
+ (args)["push"]((rep)["result"]);
6984
+ }
6985
+ }
6986
+ {
6987
+ let result = managed_result(state, runtime_call(state, (fast)["op"], runtime_arguments(state, args)), true);
6988
+ (steps)["push"]((result)["steps"]);
6989
+ ((result)["steps"] = word_sequence(steps));
6990
+ return result;
6991
+ }
6992
+ }
6993
+ } else {
6994
+ {
6995
+ let count = snapshot_managed(lower_managed_expression(((((children) ?? [])[0]) ?? null), scope, state, functions), state);
6996
+ let builder = snapshot_managed(lower_managed_expression(((((children) ?? [])[1]) ?? null), scope, state, functions), state);
6997
+ let result = managed_result(state, runtime_call(state, "value-array-build", runtime_arguments(state, [(count)["result"], (builder)["result"]])), true);
6998
+ ((result)["steps"] = word_sequence([(count)["steps"], (builder)["steps"], (result)["steps"]]));
6999
+ return result;
7000
+ }
7001
+ }
6301
7002
  }
6302
7003
  } else {
6303
7004
  if (((kind === "intrinsic") && (value === "__eliscript_array_copy_assoc"))) {
@@ -6385,7 +7086,7 @@ function lower_managed_expression_dispatch(node, scope, state, functions) {
6385
7086
  let entered = new_managed_local(state, "bigint-conversion-entered", null);
6386
7087
  let result = managed_result(state, word_if(word_compare(runtime_call(state, "value-kind", runtime_arguments(state, [(operand)["result"]])), word_constant(5), "="), runtime_call(state, "value-bigint-try-parse", runtime_arguments(state, [(operand)["result"]])), runtime_call(state, "value-source-bigint", runtime_arguments(state, [(operand)["result"]]))), true);
6387
7088
  let local = ((result)["snapshotRoot"])["local"];
6388
- ((result)["steps"] = word_sequence([word_set(entered, word_constant(0)), (operand)["steps"], managed_guard(state, word_set(entered, word_constant(1))), (result)["steps"], word_if(word_compare(word_local(entered), word_constant(1), "="), word_if(word_compare(word_local((state)["error"]), word_constant(0), "/="), word_if(word_compare(runtime_call(state, "value-exception-match", runtime_arguments(state, [word_local((state)["error"])])), word_constant(1), "="), word_sequence([runtime_call(state, "value-exception-clear", runtime_arguments(state, [])), word_set((state)["error"], runtime_call(state, "last-error", [])), word_set(local, word_constant(0)), root_local(state, local)]), word_constant(0)), word_constant(0)), word_constant(0))]));
7089
+ ((result)["steps"] = word_sequence([word_set(entered, word_constant(0)), (operand)["steps"], managed_guard(state, word_set(entered, word_constant(1))), (result)["steps"], word_if(word_compare(word_local(entered), word_constant(1), "="), word_if(word_compare(word_local((state)["error"]), word_constant(0), "/="), word_if(word_compare(runtime_call(state, "value-exception-match", runtime_arguments(state, [word_local((state)["error"])])), word_constant(1), "="), word_sequence([runtime_call(state, "value-exception-clear", runtime_arguments(state, [])), word_set((state)["error"], word_node("memory-op", [word_constant(8)], "load-u32")), word_set(local, word_constant(0)), root_local(state, local)]), word_constant(0)), word_constant(0)), word_constant(0))]));
6389
7090
  return result;
6390
7091
  }
6391
7092
  } else {
@@ -6575,28 +7276,26 @@ function lower_managed_expression_core(node, scope, state, functions) {
6575
7276
  let first_temporary = managed_temporary_root_count(state);
6576
7277
  let rhs_node = (((((pair)["children"]) ?? [])[0]) ?? null);
6577
7278
  let previous_barrier = enter_managed_temporary_root_rhs(state, rhs_node);
6578
- (() => {
6579
- try {
6580
- {
6581
- let rhs = lower_managed_expression(rhs_node, scope, state, functions);
6582
- let end_temporary = managed_temporary_root_count(state);
6583
- (steps)["push"]((rhs)["steps"]);
6584
- if (__eliscript_truthy(local)) {
6585
- (steps)["push"](managed_guard(state, binding_node("binding-set", local, [(rhs)["result"]])), root_local(state, local));
6586
- ((result = binding_read(local)));
6587
- } else {
6588
- {
6589
- let stored = managed_result(state, runtime_call(state, "value-module-set", runtime_arguments(state, [word_constant((global)["index"]), (rhs)["result"]])), true);
6590
- (steps)["push"]((stored)["steps"]);
6591
- ((result = (stored)["result"]));
6592
- }
7279
+ try {
7280
+ {
7281
+ let rhs = lower_managed_expression(rhs_node, scope, state, functions);
7282
+ let end_temporary = managed_temporary_root_count(state);
7283
+ (steps)["push"]((rhs)["steps"]);
7284
+ if (__eliscript_truthy(local)) {
7285
+ (steps)["push"](managed_guard(state, binding_node("binding-set", local, [(rhs)["result"]])), root_local(state, local));
7286
+ ((result = binding_read(local)));
7287
+ } else {
7288
+ {
7289
+ let stored = managed_result(state, runtime_call(state, "value-module-set", runtime_arguments(state, [word_constant((global)["index"]), (rhs)["result"]])), true);
7290
+ (steps)["push"]((stored)["steps"]);
7291
+ ((result = (stored)["result"]));
6593
7292
  }
6594
- return (steps)["push"](clear_managed_temporary_roots(state, first_temporary, end_temporary));
6595
7293
  }
6596
- } finally {
6597
- ((state)["temporaryRootCleanupBarrier"] = previous_barrier);
7294
+ (steps)["push"](clear_managed_temporary_roots(state, first_temporary, end_temporary));
6598
7295
  }
6599
- })();
7296
+ } finally {
7297
+ ((state)["temporaryRootCleanupBarrier"] = previous_barrier);
7298
+ }
6600
7299
  }
6601
7300
  }
6602
7301
  }
@@ -7420,7 +8119,7 @@ function managed_rest_read_projection(nodes, name, start) {
7420
8119
  }
7421
8120
  }
7422
8121
  } else {
7423
- if ((__eliscript_truthy(reference_p(node)) || __eliscript_truthy(qualified_reference_p(node)) || (((__eliscript_value_147, __eliscript_value_148) => (__eliscript_value_147 !== __eliscript_value_148))(kind, "literal") && (__eliscript_value_type(value) === "string") && (managed_binding_key(value) === managed_binding_key(name))))) {
8122
+ if ((__eliscript_truthy(reference_p(node)) || __eliscript_truthy(qualified_reference_p(node)) || ((kind !== "literal") && (__eliscript_value_type(value) === "string") && (managed_binding_key(value) === managed_binding_key(name))))) {
7424
8123
  ((valid = null));
7425
8124
  } else {
7426
8125
  if (((kind === "conditional") && ((((children) ?? []).length === 2) || (((children) ?? []).length === 3)))) {
@@ -7458,7 +8157,7 @@ function managed_rest_read_projection(nodes, name, start) {
7458
8157
  }
7459
8158
  } else {
7460
8159
  while (__eliscript_numeric_relation("<", index, ((children) ?? []).length)) {
7461
- push(((((children) ?? [])[index]) ?? null), lower, ((__eliscript_value_149) => (__eliscript_truthy(__eliscript_value_149) ? __eliscript_value_149 : ((kind === "function-expression") || (kind === "function-declaration"))))(nested), ((index === 0) && ((kind === "call") || (kind === "invoke") || (kind === "apply-call") || (kind === "constructor-call"))));
8160
+ push(((((children) ?? [])[index]) ?? null), lower, ((__eliscript_value_147) => (__eliscript_truthy(__eliscript_value_147) ? __eliscript_value_147 : ((kind === "function-expression") || (kind === "function-declaration"))))(nested), ((index === 0) && ((kind === "call") || (kind === "invoke") || (kind === "apply-call") || (kind === "constructor-call"))));
7462
8161
  ((index = (index + 1)));
7463
8162
  }
7464
8163
  }
@@ -7587,20 +8286,25 @@ function lower_managed_function(function$, functions, runtime) {
7587
8286
  let captures = (state)["captures"];
7588
8287
  let result = new_managed_local(state, "result", null);
7589
8288
  let steps = [];
7590
- (steps)["push"](runtime_call(state, "begin-operation", []), runtime_call(state, "heap-check", runtime_arguments(state, [])), capture_error(state));
7591
- (steps)["push"](lower_managed_array_initializer_registration(state));
7592
- if (__eliscript_truthy(((state)["module"] ?? null))) {
7593
- (steps)["push"](checked_control(state, "value-module-check", runtime_arguments(state, [])));
8289
+ let internal_fast = ((__eliscript_value_148) => (__eliscript_truthy(__eliscript_value_148) ? ((__eliscript_value_149) => (__eliscript_truthy(__eliscript_value_149) ? ((__eliscript_value_150) => (__eliscript_truthy(__eliscript_value_150) ? ((__eliscript_value_151) => (__eliscript_truthy(__eliscript_value_151) ? ((__eliscript_value_152) => (__eliscript_truthy(__eliscript_value_152) ? ((__eliscript_value_153) => (__eliscript_truthy(__eliscript_value_153) ? ((__eliscript_value_154) => (__eliscript_truthy(__eliscript_value_154) ? ((__eliscript_value_155) => (__eliscript_truthy(__eliscript_value_155) ? ((__eliscript_value_156) => (__eliscript_truthy(__eliscript_value_156) ? __eliscript_value_156 : ((__eliscript_value_157) => (__eliscript_truthy(__eliscript_value_157) ? __eliscript_value_157 : ((__eliscript_value_158) => (__eliscript_truthy(__eliscript_value_158) ? __eliscript_value_158 : ((function$)["lambda"] ?? null)))(((function$)["slotDispatch"] ?? null))))((((function$)["parameterSource"] ?? null) === "slots"))))((!__eliscript_truthy(uniform))) : __eliscript_value_155))((!__eliscript_truthy(((function$)["literalBrandProbe"] ?? null)))) : __eliscript_value_154))((!__eliscript_truthy(((function$)["boundMethod"] ?? null)))) : __eliscript_value_153))((((function$)["builtin"] ?? null) === null)) : __eliscript_value_152))((((function$)["nativeInitializer"] ?? null) === null)) : __eliscript_value_151))((!__eliscript_truthy(((function$)["descriptionInitializer"] ?? null)))) : __eliscript_value_150))((!__eliscript_truthy(((function$)["realmInitializer"] ?? null)))) : __eliscript_value_149))((!__eliscript_truthy(((function$)["initializer"] ?? null)))) : __eliscript_value_148))((!__eliscript_truthy(((function$)["isExported"] ?? null))));
8290
+ if ((!__eliscript_truthy(internal_fast))) {
8291
+ (steps)["push"](runtime_call(state, "begin-operation", []), runtime_call(state, "heap-check", runtime_arguments(state, [])), capture_error(state));
8292
+ (steps)["push"](lower_managed_array_initializer_registration(state));
8293
+ if (__eliscript_truthy(((state)["module"] ?? null))) {
8294
+ (steps)["push"](checked_control(state, "value-module-check", runtime_arguments(state, [])));
8295
+ }
7594
8296
  }
7595
8297
  if (__eliscript_truthy(uniform)) {
7596
- (steps)["push"](checked_control(state, "heap-reference-check", runtime_arguments(state, [word_local((state)["function"])])));
7597
- if ((!(((state)["parameterSource"] ?? null) === "slots"))) {
7598
- (steps)["push"](checked_control(state, "heap-reference-check", runtime_arguments(state, [word_local((state)["arguments"])])), checked_control(state, "value-call-arguments-check", runtime_arguments(state, [word_local((state)["arguments"]), word_local((state)["count"])])));
8298
+ if ((!__eliscript_truthy(internal_fast))) {
8299
+ (steps)["push"](checked_control(state, "heap-reference-check", runtime_arguments(state, [word_local((state)["function"])])));
8300
+ if ((!(((state)["parameterSource"] ?? null) === "slots"))) {
8301
+ (steps)["push"](checked_control(state, "heap-reference-check", runtime_arguments(state, [word_local((state)["arguments"])])), checked_control(state, "value-call-arguments-check", runtime_arguments(state, [word_local((state)["arguments"]), word_local((state)["count"])])));
8302
+ }
7599
8303
  }
7600
8304
  ((index = 0));
7601
8305
  while (__eliscript_numeric_relation("<", index, arity)) {
7602
8306
  if ((!(((((kinds) ?? [])[index]) ?? null) === "rest"))) {
7603
- (steps)["push"](managed_guard(state, word_set(((((scope) ?? [])[index]) ?? null), word_if(word_compare(word_local((state)["count"]), word_constant(index), ">"), ((((state)["parameterSource"] ?? null) === "slots") ? runtime_call(state, "root-scope-get-abs", runtime_arguments(state, [managed_raw_binary(word_local((state)["arguments"]), word_constant(index), "+")])) : runtime_call(state, "value-get", runtime_arguments(state, [word_local((state)["arguments"]), word_constant(index)]))), word_constant(3)))), capture_error(state));
8307
+ (steps)["push"](managed_guard(state, word_set(((((scope) ?? [])[index]) ?? null), word_if(word_compare(word_local((state)["count"]), word_constant(index), ">"), ((((state)["parameterSource"] ?? null) === "slots") ? runtime_call(state, "rt-root-scope-get-abs", runtime_arguments(state, [managed_raw_binary(word_local((state)["arguments"]), word_constant(index), "+")])) : runtime_call(state, "value-get", runtime_arguments(state, [word_local((state)["arguments"]), word_constant(index)]))), word_constant(3)))), capture_error(state));
7604
8308
  if (((((((kinds) ?? [])[index]) ?? null) === "optional") && !(__eliscript_truthy(patterns)))) {
7605
8309
  (steps)["push"](managed_guard(state, word_if(word_compare(word_local(((((scope) ?? [])[index]) ?? null)), word_constant(3), "="), word_set(((((scope) ?? [])[index]) ?? null), word_constant(0)), word_constant(0))));
7606
8310
  }
@@ -7608,26 +8312,26 @@ function lower_managed_function(function$, functions, runtime) {
7608
8312
  ((index = (index + 1)));
7609
8313
  }
7610
8314
  }
7611
- ((index = 0));
7612
- while (__eliscript_numeric_relation("<", index, arity)) {
7613
- (steps)["push"](checked_control(state, "heap-reference-check", runtime_arguments(state, [word_local(((((scope) ?? [])[index]) ?? null))])));
7614
- ((index = (index + 1)));
8315
+ if ((!__eliscript_truthy(internal_fast))) {
8316
+ ((index = 0));
8317
+ while (__eliscript_numeric_relation("<", index, arity)) {
8318
+ (steps)["push"](checked_control(state, "heap-reference-check", runtime_arguments(state, [word_local(((((scope) ?? [])[index]) ?? null))])));
8319
+ ((index = (index + 1)));
8320
+ }
8321
+ (steps)["push"](checked_control(state, "value-exception-class-set", runtime_arguments(state, [word_constant(0)])));
7615
8322
  }
7616
- (steps)["push"](checked_control(state, "value-exception-class-set", runtime_arguments(state, [word_constant(0)])));
7617
8323
  {
7618
- let reader = ((__eliscript_value_150) => (__eliscript_truthy(__eliscript_value_150) ? ((__eliscript_value_151) => (__eliscript_truthy(__eliscript_value_151) ? ((__eliscript_value_152) => (__eliscript_truthy(__eliscript_value_152) ? managed_direct_reader(children, arity, scope, state) : __eliscript_value_152))((!__eliscript_truthy(uniform))) : __eliscript_value_151))((!__eliscript_truthy(function_recur))) : __eliscript_value_150))((!__eliscript_truthy(patterns)));
7619
- let query = ((__eliscript_value_153) => (__eliscript_truthy(__eliscript_value_153) ? ((__eliscript_value_154) => (__eliscript_truthy(__eliscript_value_154) ? ((__eliscript_value_155) => (__eliscript_truthy(__eliscript_value_155) ? managed_direct_collection_query(children, arity, scope, state) : __eliscript_value_155))((!__eliscript_truthy(uniform))) : __eliscript_value_154))((!__eliscript_truthy(function_recur))) : __eliscript_value_153))((!__eliscript_truthy(patterns)));
8324
+ let reader = ((__eliscript_value_159) => (__eliscript_truthy(__eliscript_value_159) ? ((__eliscript_value_160) => (__eliscript_truthy(__eliscript_value_160) ? ((__eliscript_value_161) => (__eliscript_truthy(__eliscript_value_161) ? managed_direct_reader(children, arity, scope, state) : __eliscript_value_161))((!__eliscript_truthy(uniform))) : __eliscript_value_160))((!__eliscript_truthy(function_recur))) : __eliscript_value_159))((!__eliscript_truthy(patterns)));
8325
+ let query = ((__eliscript_value_162) => (__eliscript_truthy(__eliscript_value_162) ? ((__eliscript_value_163) => (__eliscript_truthy(__eliscript_value_163) ? ((__eliscript_value_164) => (__eliscript_truthy(__eliscript_value_164) ? managed_direct_collection_query(children, arity, scope, state) : __eliscript_value_164))((!__eliscript_truthy(uniform))) : __eliscript_value_163))((!__eliscript_truthy(function_recur))) : __eliscript_value_162))((!__eliscript_truthy(patterns)));
7620
8326
  if (__eliscript_truthy(reader)) {
7621
8327
  (steps)["push"](managed_guard(state, word_set(result, reader)), capture_error(state));
7622
8328
  } else {
7623
8329
  {
7624
8330
  let frame_steps = [];
7625
8331
  if (__eliscript_truthy(managed_private_roots_p(state))) {
7626
- (frame_steps)["push"](word_set((state)["functionBase"], word_constant(0)));
7627
- }
7628
- (frame_steps)["push"](managed_guard(state, word_set((state)["frame"], (__eliscript_truthy(managed_private_roots_p(state)) ? runtime_call(state, "root-scope-enter", runtime_arguments(state, [word_constant((state)["roots"])])) : runtime_call(state, "frame-new", runtime_arguments(state, [word_constant((state)["roots"])]))))), capture_error(state));
7629
- if (__eliscript_truthy(managed_private_roots_p(state))) {
7630
- (frame_steps)["push"](managed_guard(state, word_set((state)["functionBase"], runtime_call(state, "root-scope-base", runtime_arguments(state, [])))), capture_error(state));
8332
+ (frame_steps)["push"](word_set((state)["functionBase"], word_constant(0)), managed_guard(state, word_set((state)["functionBase"], runtime_call(state, "rt-scope-enter", runtime_arguments(state, [word_constant((state)["roots"])])))), capture_error(state), managed_guard(state, word_set((state)["frame"], word_local((state)["functionBase"]))));
8333
+ } else {
8334
+ (frame_steps)["push"](managed_guard(state, word_set((state)["frame"], runtime_call(state, "frame-new", runtime_arguments(state, [word_constant((state)["roots"])])))), capture_error(state));
7631
8335
  }
7632
8336
  if (__eliscript_truthy(uniform)) {
7633
8337
  (frame_steps)["push"](root_local(state, (state)["function"]));
@@ -7689,7 +8393,7 @@ function lower_managed_function(function$, functions, runtime) {
7689
8393
  ((index = (index + 1)));
7690
8394
  }
7691
8395
  (frame_steps)["push"]((body)["steps"], managed_guard(state, word_set(result, (body)["result"])));
7692
- (frame_steps)["push"](word_if(word_compare(word_local((state)["frame"]), word_constant(0), "/="), (__eliscript_truthy(managed_private_roots_p(state)) ? runtime_call(state, "root-scope-exit", runtime_arguments(state, [])) : runtime_call(state, "frame-pop", runtime_arguments(state, [word_local((state)["frame"])]))), word_constant(0)));
8396
+ (frame_steps)["push"](word_if(word_compare(word_local((state)["frame"]), word_constant(0), "/="), (__eliscript_truthy(managed_private_roots_p(state)) ? runtime_call(state, "rt-scope-exit", runtime_arguments(state, [])) : runtime_call(state, "frame-pop", runtime_arguments(state, [word_local((state)["frame"])]))), word_constant(0)));
7693
8397
  (steps)["push"]((__eliscript_truthy(((function$)["canonicalStringHash"] ?? null)) ? word_sequence([managed_guard(state, word_set(result, runtime_call(state, "value-canonical-string-hash-try", runtime_arguments(state, [word_local((state)["arguments"]), word_local((state)["count"])])))), capture_error(state), managed_guard(state, word_if(word_compare(word_local(result), word_constant(0), "="), word_sequence(frame_steps), word_constant(0)))]) : (__eliscript_truthy(query) ? word_if((query)["condition"], word_sequence([managed_guard(state, word_set(result, (query)["result"])), capture_error(state)]), word_sequence(frame_steps)) : word_sequence(frame_steps))));
7694
8398
  }
7695
8399
  }
@@ -7740,7 +8444,7 @@ function managed_call_wrapper(function$, index, runtime) {
7740
8444
  }
7741
8445
  }
7742
8446
  function managed_global(state, name) {
7743
- return find_local(((__eliscript_value_156) => (__eliscript_truthy(__eliscript_value_156) ? __eliscript_value_156 : []))(((state)["globals"] ?? null)), name);
8447
+ return find_local(((__eliscript_value_165) => (__eliscript_truthy(__eliscript_value_165) ? __eliscript_value_165 : []))(((state)["globals"] ?? null)), name);
7744
8448
  }
7745
8449
  function lower_managed_external_global_init(entry, state) {
7746
8450
  {
@@ -7755,8 +8459,8 @@ function lower_managed_external_global_init(entry, state) {
7755
8459
  function lower_managed_global_init(node, scope, state, functions) {
7756
8460
  {
7757
8461
  let entry = ((node)["globalEntry"] ?? null);
7758
- let declaration = ((__eliscript_value_157) => (__eliscript_truthy(__eliscript_value_157) ? ((entry)["source"] ?? null) : __eliscript_value_157))(entry);
7759
- let properties = ((__eliscript_value_158) => (__eliscript_truthy(__eliscript_value_158) ? ((declaration)["properties"] ?? null) : __eliscript_value_158))(declaration);
8462
+ let declaration = ((__eliscript_value_166) => (__eliscript_truthy(__eliscript_value_166) ? ((entry)["source"] ?? null) : __eliscript_value_166))(entry);
8463
+ let properties = ((__eliscript_value_167) => (__eliscript_truthy(__eliscript_value_167) ? ((declaration)["properties"] ?? null) : __eliscript_value_167))(declaration);
7760
8464
  if ((!(__eliscript_truthy(((state)["initializer"] ?? null)) && __eliscript_truthy(entry) && __eliscript_truthy(((state)["globals"])["includes"](entry))))) {
7761
8465
  managed_fail(node, "invalid managed module initializer");
7762
8466
  }
@@ -8063,6 +8767,28 @@ function managed_module_code_invoker(index, runtime, function_count, functions)
8063
8767
  }
8064
8768
  }
8065
8769
  }
8770
+ function managed_module_code_batch_invoker(index, runtime, function_count, functions) {
8771
+ {
8772
+ let function$ = managed_module_wrapper("__eliscript_module_invoke_batch", index, runtime, 7);
8773
+ let state = (function$)["state"];
8774
+ let arguments$ = (function$)["arguments"];
8775
+ let error = new_managed_local(state, "error", null);
8776
+ let code = word_local(((((arguments$) ?? [])[0]) ?? null));
8777
+ ((state)["error"] = error);
8778
+ ((state)["functions"] = functions);
8779
+ ((((((arguments$) ?? [])[1]) ?? null))["type"] = "v64");
8780
+ ((((((arguments$) ?? [])[2]) ?? null))["type"] = "v64");
8781
+ ((((((arguments$) ?? [])[3]) ?? null))["type"] = "v64");
8782
+ ((((((arguments$) ?? [])[4]) ?? null))["type"] = "v64");
8783
+ ((((((arguments$) ?? [])[5]) ?? null))["type"] = "v64");
8784
+ {
8785
+ let result = managed_finish_wrapper(function$, word_node("sequence", [runtime_call(state, "begin-operation", []), checked_control(state, "value-module-check", runtime_arguments(state, [])), lower_managed_array_initializer_registration(state), word_if(word_compare(word_local(error), word_constant(0), "="), word_if(word_compare(code, word_constant(function_count), "<"), runtime_call(state, "heap-host-call-code-invoke", runtime_arguments(state, [code, word_local(((((arguments$) ?? [])[1]) ?? null)), word_local(((((arguments$) ?? [])[2]) ?? null)), word_local(((((arguments$) ?? [])[3]) ?? null)), word_local(((((arguments$) ?? [])[4]) ?? null)), word_local(((((arguments$) ?? [])[5]) ?? null))])), runtime_call(state, "fail-v64", [word_constant(3)])), runtime_call(state, "fail-v64", [word_local(error)]))], null));
8786
+ ((result)["parameterTypes"] = ["u32", "u32", "v64", "v64", "v64", "v64", "v64"]);
8787
+ ((result)["resultType"] = "v64");
8788
+ return result;
8789
+ }
8790
+ }
8791
+ }
8066
8792
  function managed_module_binding_wrapper(index, runtime) {
8067
8793
  {
8068
8794
  let function$ = managed_module_wrapper((String("__eliscript_binding_") + String(index)), index, runtime, 4);
@@ -8092,7 +8818,7 @@ function managed_host_identity_nodes(nodes) {
8092
8818
  }
8093
8819
  }
8094
8820
  {
8095
- let original = ((__eliscript_value_159) => (__eliscript_truthy(__eliscript_value_159) ? __eliscript_value_159 : node))(((node)["managedAsyncOriginal"] ?? null));
8821
+ let original = ((__eliscript_value_168) => (__eliscript_truthy(__eliscript_value_168) ? __eliscript_value_168 : node))(((node)["managedAsyncOriginal"] ?? null));
8096
8822
  if ((!__eliscript_truthy((found)["includes"](original)))) {
8097
8823
  (found)["push"](original);
8098
8824
  }
@@ -8133,7 +8859,7 @@ function managed_annotate_function_names(node, inferred, portable_declaration =
8133
8859
  return node;
8134
8860
  } else {
8135
8861
  {
8136
- let copy = (globalThis.Object)["assign"](({}), node, ({"children": ((__eliscript_value_160) => (__eliscript_truthy(__eliscript_value_160) ? __eliscript_value_160 : children))(output), "managedOriginal": ((node)["managedOriginal"] ?? node)}));
8862
+ let copy = (globalThis.Object)["assign"](({}), node, ({"children": ((__eliscript_value_169) => (__eliscript_truthy(__eliscript_value_169) ? __eliscript_value_169 : children))(output), "managedOriginal": ((node)["managedOriginal"] ?? node)}));
8137
8863
  if (((kind === "function-expression") && !((inferred === null)))) {
8138
8864
  ((copy)["managedFunctionName"] = inferred);
8139
8865
  }
@@ -8149,12 +8875,12 @@ function managed_literal_key_position(node, index) {
8149
8875
  if (((kind === "map-binding-entry") && (index === 1))) {
8150
8876
  return "pattern";
8151
8877
  } else {
8152
- return ((__eliscript_value_161) => (__eliscript_truthy(__eliscript_value_161) ? __eliscript_value_161 : ((__eliscript_value_163) => (__eliscript_truthy(__eliscript_value_163) ? __eliscript_value_163 : ((__eliscript_value_166) => (__eliscript_truthy(__eliscript_value_166) ? __eliscript_value_166 : ((__eliscript_value_167) => (__eliscript_truthy(__eliscript_value_167) ? ((__eliscript_value_168) => (__eliscript_truthy(__eliscript_value_168) ? ((((node)["properties"] ?? ({})))["computed"] ?? false) : __eliscript_value_168))((index === 0)) : __eliscript_value_167))((kind === "object-property"))))(((kind === "intrinsic") && (index === 0) && (name === "js-nth")))))(((__eliscript_value_164) => (__eliscript_truthy(__eliscript_value_164) ? ((__eliscript_value_165) => (__eliscript_truthy(__eliscript_value_165) ? (["aref", "object-has?", "object-assoc"])["includes"](name) : __eliscript_value_165))((index === 1)) : __eliscript_value_164))((kind === "intrinsic")))))(((__eliscript_value_162) => (__eliscript_truthy(__eliscript_value_162) ? (["property-read", "property-write", "method-call"])["includes"](kind) : __eliscript_value_162))((index === 1)));
8878
+ return ((__eliscript_value_170) => (__eliscript_truthy(__eliscript_value_170) ? __eliscript_value_170 : ((__eliscript_value_172) => (__eliscript_truthy(__eliscript_value_172) ? __eliscript_value_172 : ((__eliscript_value_175) => (__eliscript_truthy(__eliscript_value_175) ? __eliscript_value_175 : ((__eliscript_value_176) => (__eliscript_truthy(__eliscript_value_176) ? ((__eliscript_value_177) => (__eliscript_truthy(__eliscript_value_177) ? ((((node)["properties"] ?? ({})))["computed"] ?? false) : __eliscript_value_177))((index === 0)) : __eliscript_value_176))((kind === "object-property"))))(((kind === "intrinsic") && (index === 0) && (name === "js-nth")))))(((__eliscript_value_173) => (__eliscript_truthy(__eliscript_value_173) ? ((__eliscript_value_174) => (__eliscript_truthy(__eliscript_value_174) ? (["aref", "object-has?", "object-assoc"])["includes"](name) : __eliscript_value_174))((index === 1)) : __eliscript_value_173))((kind === "intrinsic")))))(((__eliscript_value_171) => (__eliscript_truthy(__eliscript_value_171) ? (["property-read", "property-write", "method-call"])["includes"](kind) : __eliscript_value_171))((index === 1)));
8153
8879
  }
8154
8880
  }
8155
8881
  }
8156
8882
  function managed_literal_key_literal_p(node, position) {
8157
- return ((__eliscript_value_169) => (__eliscript_truthy(__eliscript_value_169) ? ((((node)["kind"] === "literal") && (((((node)["properties"] ?? ({})))["literalKind"] ?? null) === "keyword")) || ((position === "pattern") && ((node)["kind"] === "quoted-literal") && ((((node)["value"])["kind"] ?? null) === "symbol"))) : __eliscript_value_169))(position);
8883
+ return ((__eliscript_value_178) => (__eliscript_truthy(__eliscript_value_178) ? ((((node)["kind"] === "literal") && (((((node)["properties"] ?? ({})))["literalKind"] ?? null) === "keyword")) || ((position === "pattern") && ((node)["kind"] === "quoted-literal") && ((((node)["value"])["kind"] ?? null) === "symbol"))) : __eliscript_value_178))(position);
8158
8884
  }
8159
8885
  function managed_literal_datum_required(datum) {
8160
8886
  {
@@ -8172,9 +8898,9 @@ function managed_literal_required(node, key_position = null) {
8172
8898
  if (((kind === "lexical-bindings") || (kind === "binding-loop"))) {
8173
8899
  managed_binding_shapes(node);
8174
8900
  }
8175
- return ((__eliscript_value_170) => (__eliscript_truthy(__eliscript_value_170) ? __eliscript_value_170 : ((__eliscript_value_174) => (__eliscript_truthy(__eliscript_value_174) ? __eliscript_value_174 : ((__eliscript_value_175) => (__eliscript_truthy(__eliscript_value_175) ? __eliscript_value_175 : ((__eliscript_value_177) => (__eliscript_truthy(__eliscript_value_177) ? (children)["some"](((child, index) => {
8901
+ return ((__eliscript_value_179) => (__eliscript_truthy(__eliscript_value_179) ? __eliscript_value_179 : ((__eliscript_value_183) => (__eliscript_truthy(__eliscript_value_183) ? __eliscript_value_183 : ((__eliscript_value_184) => (__eliscript_truthy(__eliscript_value_184) ? __eliscript_value_184 : ((__eliscript_value_186) => (__eliscript_truthy(__eliscript_value_186) ? (children)["some"](((child, index) => {
8176
8902
  return managed_literal_required(child, managed_literal_key_position(node, index));
8177
- })) : __eliscript_value_177))(Array.isArray(children))))(((__eliscript_value_176) => (__eliscript_truthy(__eliscript_value_176) ? (["length", "nth", "car", "cdr", "cons", "equal"])["includes"]((node)["value"]) : __eliscript_value_176))((kind === "intrinsic")))))((["persistent-list-literal", "persistent-vector-literal", "persistent-map-literal", "persistent-set-literal", "persistent-queue-literal"])["includes"](kind))))(((__eliscript_value_171) => (__eliscript_truthy(__eliscript_value_171) ? ((__eliscript_value_172) => (__eliscript_truthy(__eliscript_value_172) ? __eliscript_value_172 : ((kind === "literal") && (((((node)["properties"] ?? ({})))["literalKind"] ?? null) === "keyword"))))(((__eliscript_value_173) => (__eliscript_truthy(__eliscript_value_173) ? managed_literal_datum_required((node)["value"]) : __eliscript_value_173))((kind === "quoted-literal"))) : __eliscript_value_171))((!__eliscript_truthy(managed_literal_key_literal_p(node, key_position)))));
8903
+ })) : __eliscript_value_186))(Array.isArray(children))))(((__eliscript_value_185) => (__eliscript_truthy(__eliscript_value_185) ? (["length", "nth", "car", "cdr", "cons", "equal"])["includes"]((node)["value"]) : __eliscript_value_185))((kind === "intrinsic")))))((["persistent-list-literal", "persistent-vector-literal", "persistent-map-literal", "persistent-set-literal", "persistent-queue-literal"])["includes"](kind))))(((__eliscript_value_180) => (__eliscript_truthy(__eliscript_value_180) ? ((__eliscript_value_181) => (__eliscript_truthy(__eliscript_value_181) ? __eliscript_value_181 : ((kind === "literal") && (((((node)["properties"] ?? ({})))["literalKind"] ?? null) === "keyword"))))(((__eliscript_value_182) => (__eliscript_truthy(__eliscript_value_182) ? managed_literal_datum_required((node)["value"]) : __eliscript_value_182))((kind === "quoted-literal"))) : __eliscript_value_180))((!__eliscript_truthy(managed_literal_key_literal_p(node, key_position)))));
8178
8904
  }
8179
8905
  }
8180
8906
  }
@@ -8217,12 +8943,12 @@ function managed_literal_runtime_imports(program, id) {
8217
8943
  }
8218
8944
  }
8219
8945
  function managed_literal_program_required(program, id = null) {
8220
- return ((__eliscript_value_178) => (__eliscript_truthy(__eliscript_value_178) ? ((__eliscript_value_179) => (__eliscript_truthy(__eliscript_value_179) ? __eliscript_value_179 : __eliscript_numeric_relation(">", ((managed_literal_runtime_imports(program, ((__eliscript_value_180) => (__eliscript_truthy(__eliscript_value_180) ? __eliscript_value_180 : "__eliscript_input__.mjs"))(id))) ?? []).length, 0)))(((program)["body"])["some"](((node) => {
8946
+ return ((__eliscript_value_187) => (__eliscript_truthy(__eliscript_value_187) ? ((__eliscript_value_188) => (__eliscript_truthy(__eliscript_value_188) ? __eliscript_value_188 : __eliscript_numeric_relation(">", ((managed_literal_runtime_imports(program, ((__eliscript_value_189) => (__eliscript_truthy(__eliscript_value_189) ? __eliscript_value_189 : "__eliscript_input__.mjs"))(id))) ?? []).length, 0)))(((program)["body"])["some"](((node) => {
8221
8947
  return managed_literal_required(node, false);
8222
- }))) : __eliscript_value_178))(Array.isArray((program)["body"]));
8948
+ }))) : __eliscript_value_187))(Array.isArray((program)["body"]));
8223
8949
  }
8224
8950
  const private_literal_exports = new (globalThis.WeakMap)();
8225
- __eliscript_tdz_ready_6 = true;
8951
+ __eliscript_tdz_ready_12 = true;
8226
8952
  function managed_literal_node(source, kind, value, children, properties) {
8227
8953
  return ({"kind": kind, "value": value, "children": children, "properties": properties, "span": ((source)["span"] ?? null)});
8228
8954
  }
@@ -8243,7 +8969,7 @@ function managed_literal_call(source, context, method, arguments$) {
8243
8969
  function managed_literal_datum(datum, source, context) {
8244
8970
  {
8245
8971
  let type = __eliscript_value_type(datum);
8246
- let kind = ((__eliscript_value_181) => (__eliscript_truthy(__eliscript_value_181) ? ((__eliscript_value_182) => (__eliscript_truthy(__eliscript_value_182) ? ((datum)["kind"] ?? null) : __eliscript_value_182))((type === "object")) : __eliscript_value_181))(datum);
8972
+ let kind = ((__eliscript_value_190) => (__eliscript_truthy(__eliscript_value_190) ? ((__eliscript_value_191) => (__eliscript_truthy(__eliscript_value_191) ? ((datum)["kind"] ?? null) : __eliscript_value_191))((type === "object")) : __eliscript_value_190))(datum);
8247
8973
  if ((datum === null)) {
8248
8974
  return managed_literal_call(source, context, "literal-list", []);
8249
8975
  } else {
@@ -8384,7 +9110,7 @@ function managed_literal_relative(from, target) {
8384
9110
  }
8385
9111
  function managed_literal_resolve(id, specifier, node, provided) {
8386
9112
  {
8387
- let target = ((__eliscript_value_183) => (__eliscript_truthy(__eliscript_value_183) ? __eliscript_value_183 : managed_link_target(id, specifier, node)))(managed_literal_runtime_target(id, specifier, node));
9113
+ let target = ((__eliscript_value_192) => (__eliscript_truthy(__eliscript_value_192) ? __eliscript_value_192 : managed_link_target(id, specifier, node)))(managed_literal_runtime_target(id, specifier, node));
8388
9114
  let resolved = (__eliscript_truthy((provided)["has"](target)) ? target : (__eliscript_truthy((target)["endsWith"](".eli")) ? (String((target)["slice"](0, -4)) + String(".mjs")) : target));
8389
9115
  if ((!__eliscript_truthy((provided)["has"](resolved)))) {
8390
9116
  managed_fail(node, (String("missing persistent literal dependency: ") + String(target)));
@@ -8393,7 +9119,7 @@ function managed_literal_resolve(id, specifier, node, provided) {
8393
9119
  }
8394
9120
  }
8395
9121
  function managed_literal_host_import_p(specifier, id, node) {
8396
- return ((__eliscript_value_184) => (__eliscript_truthy(__eliscript_value_184) ? __eliscript_value_184 : ((__eliscript_value_185) => (__eliscript_truthy(__eliscript_value_185) ? __eliscript_value_185 : ((__eliscript_value_186) => (__eliscript_truthy(__eliscript_value_186) ? ((__eliscript_value_187) => (__eliscript_truthy(__eliscript_value_187) ? ((__eliscript_value_188) => (__eliscript_truthy(__eliscript_value_188) ? (managed_link_target(id, specifier, node) === "platform/http.mjs") : __eliscript_value_188))(((__eliscript_value_189) => (__eliscript_truthy(__eliscript_value_189) ? __eliscript_value_189 : (specifier)["startsWith"]("../")))((specifier)["startsWith"]("./"))) : __eliscript_value_187))((__eliscript_value_type(specifier) === "string")) : __eliscript_value_186))((id === "runtime/wire/http-rpc.mjs"))))((specifier === "eliscript/platform/http"))))((specifier === "eliscript/platform/http.mjs"));
9122
+ return ((__eliscript_value_193) => (__eliscript_truthy(__eliscript_value_193) ? __eliscript_value_193 : ((__eliscript_value_194) => (__eliscript_truthy(__eliscript_value_194) ? __eliscript_value_194 : ((__eliscript_value_195) => (__eliscript_truthy(__eliscript_value_195) ? ((__eliscript_value_196) => (__eliscript_truthy(__eliscript_value_196) ? ((__eliscript_value_197) => (__eliscript_truthy(__eliscript_value_197) ? (managed_link_target(id, specifier, node) === "platform/http.mjs") : __eliscript_value_197))(((__eliscript_value_198) => (__eliscript_truthy(__eliscript_value_198) ? __eliscript_value_198 : (specifier)["startsWith"]("../")))((specifier)["startsWith"]("./"))) : __eliscript_value_196))((__eliscript_value_type(specifier) === "string")) : __eliscript_value_195))((id === "runtime/wire/http-rpc.mjs"))))((specifier === "eliscript/platform/http"))))((specifier === "eliscript/platform/http.mjs"));
8397
9123
  }
8398
9124
  function managed_protocol_private_declaration(node) {
8399
9125
  {
@@ -8464,37 +9190,37 @@ function managed_protocol_ir_equal(left, right) {
8464
9190
  if (__eliscript_truthy(Object.is(left, right))) {
8465
9191
  return true;
8466
9192
  } else {
8467
- if (((left === null) || (right === null) || ((__eliscript_value_190, __eliscript_value_191) => (__eliscript_value_190 !== __eliscript_value_191))(__eliscript_value_type(left), "object") || ((__eliscript_value_192, __eliscript_value_193) => (__eliscript_value_192 !== __eliscript_value_193))(__eliscript_value_type(right), "object") || ((__eliscript_value_194, __eliscript_value_195) => (__eliscript_value_194 !== __eliscript_value_195))(Array.isArray(left), Array.isArray(right)))) {
9193
+ if (((left === null) || (right === null) || (__eliscript_value_type(left) !== "object") || (__eliscript_value_type(right) !== "object") || (Array.isArray(left) !== Array.isArray(right)))) {
8468
9194
  return false;
8469
9195
  } else {
8470
9196
  {
8471
9197
  let keys = Object.getOwnPropertyNames(left);
8472
9198
  let other = Object.getOwnPropertyNames(right);
8473
- return ((__eliscript_value_196) => (__eliscript_truthy(__eliscript_value_196) ? ((__eliscript_value_197) => (__eliscript_truthy(__eliscript_value_197) ? ((__eliscript_value_198) => (__eliscript_truthy(__eliscript_value_198) ? (keys)["every"](((key) => {
9199
+ return ((__eliscript_value_199) => (__eliscript_truthy(__eliscript_value_199) ? ((__eliscript_value_200) => (__eliscript_truthy(__eliscript_value_200) ? ((__eliscript_value_201) => (__eliscript_truthy(__eliscript_value_201) ? (keys)["every"](((key) => {
8474
9200
  {
8475
9201
  let a = Object.getOwnPropertyDescriptor(left, key);
8476
9202
  let b = Object.getOwnPropertyDescriptor(right, key);
8477
- return ((__eliscript_value_199) => (__eliscript_truthy(__eliscript_value_199) ? ((__eliscript_value_200) => (__eliscript_truthy(__eliscript_value_200) ? ((__eliscript_value_201) => (__eliscript_truthy(__eliscript_value_201) ? managed_protocol_ir_equal((a)["value"], (b)["value"]) : __eliscript_value_201))(Object.hasOwn(b, "value")) : __eliscript_value_200))(Object.hasOwn(a, "value")) : __eliscript_value_199))(b);
9203
+ return ((__eliscript_value_202) => (__eliscript_truthy(__eliscript_value_202) ? ((__eliscript_value_203) => (__eliscript_truthy(__eliscript_value_203) ? ((__eliscript_value_204) => (__eliscript_truthy(__eliscript_value_204) ? managed_protocol_ir_equal((a)["value"], (b)["value"]) : __eliscript_value_204))(Object.hasOwn(b, "value")) : __eliscript_value_203))(Object.hasOwn(a, "value")) : __eliscript_value_202))(b);
8478
9204
  }
8479
- })) : __eliscript_value_198))((((Object.getOwnPropertySymbols(right)) ?? []).length === 0)) : __eliscript_value_197))((((Object.getOwnPropertySymbols(left)) ?? []).length === 0)) : __eliscript_value_196))((((keys) ?? []).length === ((other) ?? []).length));
9205
+ })) : __eliscript_value_201))((((Object.getOwnPropertySymbols(right)) ?? []).length === 0)) : __eliscript_value_200))((((Object.getOwnPropertySymbols(left)) ?? []).length === 0)) : __eliscript_value_199))((((keys) ?? []).length === ((other) ?? []).length));
8480
9206
  }
8481
9207
  }
8482
9208
  }
8483
9209
  }
8484
9210
  function managed_canonical_protocol_program_p(id, program, options) {
8485
- if (((id === "stdlib/core/protocol.mjs") || (id === "stdlib/core/protocol-impl.mjs"))) {
9211
+ if (((id === "runtime/core/protocol-impl.mjs") || (id === "stdlib/protocol-impl.mjs"))) {
8486
9212
  {
8487
- let provided = ((((__eliscript_value_202) => (__eliscript_truthy(__eliscript_value_202) ? __eliscript_value_202 : ({})))(options))["literalModules"] ?? null);
8488
- return ((__eliscript_value_203) => (__eliscript_truthy(__eliscript_value_203) ? (provided)["some"](((item) => {
8489
- return ((__eliscript_value_204) => (__eliscript_truthy(__eliscript_value_204) ? managed_protocol_ir_equal(program, (item)["program"]) : __eliscript_value_204))(((item)["id"] === "stdlib/core/protocol.mjs"));
8490
- })) : __eliscript_value_203))(Array.isArray(provided));
9213
+ let provided = ((((__eliscript_value_205) => (__eliscript_truthy(__eliscript_value_205) ? __eliscript_value_205 : ({})))(options))["literalModules"] ?? null);
9214
+ return ((__eliscript_value_206) => (__eliscript_truthy(__eliscript_value_206) ? (provided)["some"](((item) => {
9215
+ return ((__eliscript_value_207) => (__eliscript_truthy(__eliscript_value_207) ? managed_protocol_ir_equal(program, (item)["program"]) : __eliscript_value_207))(((item)["id"] === "runtime/core/protocol-impl.mjs"));
9216
+ })) : __eliscript_value_206))(Array.isArray(provided));
8491
9217
  }
8492
9218
  } else {
8493
9219
  return null;
8494
9220
  }
8495
9221
  }
8496
9222
  function managed_string_hash_shape(value) {
8497
- if (((value === null) || ((__eliscript_value_205, __eliscript_value_206) => (__eliscript_value_205 !== __eliscript_value_206))(__eliscript_value_type(value), "object"))) {
9223
+ if (((value === null) || (__eliscript_value_type(value) !== "object"))) {
8498
9224
  return value;
8499
9225
  } else {
8500
9226
  if (__eliscript_truthy(Array.isArray(value))) {
@@ -8538,7 +9264,7 @@ function managed_string_hash_expected() {
8538
9264
  function managed_canonical_string_hash_p(id, program, context) {
8539
9265
  {
8540
9266
  let canonical_id = ((__eliscript_truthy(context) && __eliscript_truthy((id)["startsWith"]((context)["prefix"]))) ? (id)["slice"]((((context)["prefix"]) ?? []).length) : id);
8541
- if ((canonical_id === "stdlib/managed-value-state.mjs")) {
9267
+ if ((canonical_id === "runtime/managed/managed-value-state.mjs")) {
8542
9268
  {
8543
9269
  let expected = managed_string_hash_expected();
8544
9270
  let definitions = new (globalThis.Map)();
@@ -8669,7 +9395,7 @@ function managed_literal_dependency(node, id, context) {
8669
9395
  }
8670
9396
  }
8671
9397
  }
8672
- if ((id === "stdlib/core/protocol.mjs")) {
9398
+ if ((id === "runtime/core/protocol-impl.mjs")) {
8673
9399
  {
8674
9400
  let copy = managed_protocol_private_declaration((__eliscript_truthy(output) ? Object.assign(({}), node, ({"children": output})) : node));
8675
9401
  if ((!(copy === node))) {
@@ -8694,7 +9420,7 @@ function managed_literal_dependency(node, id, context) {
8694
9420
  if ((!(__eliscript_truthy(output)) && (value === (node)["value"]))) {
8695
9421
  return node;
8696
9422
  } else {
8697
- return (globalThis.Object)["assign"](({}), node, ({"value": value, "children": ((__eliscript_value_207) => (__eliscript_truthy(__eliscript_value_207) ? __eliscript_value_207 : children))(output)}));
9423
+ return (globalThis.Object)["assign"](({}), node, ({"value": value, "children": ((__eliscript_value_208) => (__eliscript_truthy(__eliscript_value_208) ? __eliscript_value_208 : children))(output)}));
8698
9424
  }
8699
9425
  }
8700
9426
  }
@@ -8858,11 +9584,11 @@ function managed_literal_context(modules, options) {
8858
9584
  return managed_literal_program_required((item)["program"], (item)["id"]);
8859
9585
  })))) {
8860
9586
  {
8861
- let provided = ((((__eliscript_value_208) => (__eliscript_truthy(__eliscript_value_208) ? __eliscript_value_208 : ({})))(options))["literalModules"] ?? null);
9587
+ let provided = ((((__eliscript_value_209) => (__eliscript_truthy(__eliscript_value_209) ? __eliscript_value_209 : ({})))(options))["literalModules"] ?? null);
8862
9588
  let ids = new (globalThis.Set)();
8863
9589
  let by_id = new (globalThis.Map)();
8864
9590
  let selected = new (globalThis.Set)();
8865
- let pending = ["stdlib/managed-literals.mjs"];
9591
+ let pending = ["runtime/managed/managed-literals.mjs"];
8866
9592
  let aliases = new (globalThis.Set)();
8867
9593
  let _aliases = (() => {
8868
9594
  managed_literal_json_aliases(modules, aliases);
@@ -8882,7 +9608,7 @@ function managed_literal_context(modules, options) {
8882
9608
  (ids)["add"]((item)["id"]);
8883
9609
  return (by_id)["set"]((item)["id"], item);
8884
9610
  }));
8885
- if ((!__eliscript_truthy((ids)["has"]("stdlib/managed-literals.mjs")))) {
9611
+ if ((!__eliscript_truthy((ids)["has"]("runtime/managed/managed-literals.mjs")))) {
8886
9612
  managed_fail(null, "persistent literal adapter module is missing");
8887
9613
  }
8888
9614
  managed_literal_binding_names(modules, binding_names);
@@ -8918,7 +9644,7 @@ function managed_literal_context(modules, options) {
8918
9644
  }
8919
9645
  return ({"alias": alias, "prefix": prefix, "provided": ids, "modules": (provided)["filter"](((item) => {
8920
9646
  return (selected)["has"]((item)["id"]);
8921
- })), "adapter": (String(prefix) + String("stdlib/managed-literals.mjs"))});
9647
+ })), "adapter": (String(prefix) + String("runtime/managed/managed-literals.mjs"))});
8922
9648
  }
8923
9649
  } else {
8924
9650
  return null;
@@ -8983,7 +9709,7 @@ function managed_literal_program(program, id, context) {
8983
9709
  ((local)["helpers"])["forEach"](((binding, method) => {
8984
9710
  {
8985
9711
  let specifier = managed_literal_node(source, "import-named", binding, [], null);
8986
- ((__eliscript_tdz_ready_6 === true ? private_literal_exports : __eliscript_tdz_error("private_literal_exports")))["set"](specifier, method);
9712
+ ((__eliscript_tdz_ready_12 === true ? private_literal_exports : __eliscript_tdz_error("private_literal_exports")))["set"](specifier, method);
8987
9713
  return (specifiers)["push"](specifier);
8988
9714
  }
8989
9715
  }));
@@ -9128,7 +9854,7 @@ function lower_managed_program_core(program, runtime_program, module_mode = null
9128
9854
  return managed_annotate_function_names(node, null, ((program)["managedPortableDeclaration"] ?? null));
9129
9855
  }))}))));
9130
9856
  {
9131
- let runtime = lower_memory_program(runtime_program);
9857
+ let runtime = cached_lower_memory_program(runtime_program);
9132
9858
  let runtime_functions = (runtime)["functions"];
9133
9859
  let declarations = collect_managed_declarations((program)["body"], []);
9134
9860
  let functions = [];
@@ -9137,7 +9863,7 @@ function lower_managed_program_core(program, runtime_program, module_mode = null
9137
9863
  let initializers = [];
9138
9864
  let names = new (globalThis.Set)();
9139
9865
  let positions = new (globalThis.Map)();
9140
- let module = ((__eliscript_value_209) => (__eliscript_truthy(__eliscript_value_209) ? __eliscript_value_209 : null))(module_mode);
9866
+ let module = ((__eliscript_value_210) => (__eliscript_truthy(__eliscript_value_210) ? __eliscript_value_210 : null))(module_mode);
9141
9867
  let index = 0;
9142
9868
  ((__eliscript_tdz_ready_4 === true ? managed_static_images : __eliscript_tdz_error("managed_static_images")))["set"](runtime_functions, ({"imageSlot": managed_image_slot(program), "entries": [], "strings": new (globalThis.Map)(), "numbers": new (globalThis.Map)(), "metas": [], "metaIndices": new (globalThis.WeakMap)(), "functions": functions}));
9143
9869
  while (__eliscript_numeric_relation("<", index, ((declarations) ?? []).length)) {
@@ -9162,12 +9888,12 @@ function lower_managed_program_core(program, runtime_program, module_mode = null
9162
9888
  {
9163
9889
  let kinds = managed_parameter_kinds(node);
9164
9890
  let patterns = managed_function_patterns_p(node);
9165
- let uniform = ((__eliscript_value_210) => (__eliscript_truthy(__eliscript_value_210) ? __eliscript_value_210 : (kinds)["some"](((kind) => {
9891
+ let uniform = ((__eliscript_value_211) => (__eliscript_truthy(__eliscript_value_211) ? __eliscript_value_211 : (kinds)["some"](((kind) => {
9166
9892
  return (!(kind === "required"));
9167
9893
  }))))(patterns);
9168
9894
  let machine = ((functions) ?? []).length;
9169
9895
  let slot = managed_dense_table_slot(functions);
9170
- (functions)["push"](({"name": name, "internalName": (String("__eliscript_managed_") + String(machine)), "index": (((runtime_functions) ?? []).length + machine), "arity": (__eliscript_truthy(uniform) ? 4 : (((kinds) ?? []).length + 1)), "publicArity": ((kinds) ?? []).length, "parameterKinds": kinds, "uniform": uniform, "tableSlot": slot, "source": node, "slotCallable": ((__eliscript_value_211) => (__eliscript_truthy(__eliscript_value_211) ? ((!__eliscript_truthy(patterns)) && (!__eliscript_truthy((kinds)["includes"]("rest")))) : __eliscript_value_211))(uniform), "canonicalStringHash": ((__eliscript_value_212) => (__eliscript_truthy(__eliscript_value_212) ? (string_hash_bindings)["has"](name) : __eliscript_value_212))(string_hash_bindings)}));
9896
+ (functions)["push"](({"name": name, "internalName": (String("__eliscript_managed_") + String(machine)), "index": (((runtime_functions) ?? []).length + machine), "arity": (__eliscript_truthy(uniform) ? 4 : (((kinds) ?? []).length + 1)), "publicArity": ((kinds) ?? []).length, "parameterKinds": kinds, "uniform": uniform, "tableSlot": slot, "source": node, "slotCallable": ((__eliscript_value_212) => (__eliscript_truthy(__eliscript_value_212) ? ((!__eliscript_truthy(patterns)) && (!__eliscript_truthy((kinds)["includes"]("rest")))) : __eliscript_value_212))(uniform), "canonicalStringHash": ((__eliscript_value_213) => (__eliscript_truthy(__eliscript_value_213) ? (string_hash_bindings)["has"](name) : __eliscript_value_213))(string_hash_bindings)}));
9171
9897
  }
9172
9898
  } else {
9173
9899
  if ((kind === "variable-declaration")) {
@@ -9337,6 +10063,17 @@ function lower_managed_program_core(program, runtime_program, module_mode = null
9337
10063
  }
9338
10064
  }
9339
10065
  ((index = 0));
10066
+ while (__eliscript_numeric_relation("<", index, ((exports) ?? []).length)) {
10067
+ {
10068
+ let exp = ((((exports) ?? [])[index]) ?? null);
10069
+ let exp_fn = find_function(functions, (exp)["value"]);
10070
+ if (__eliscript_truthy(exp_fn)) {
10071
+ ((exp_fn)["isExported"] = true);
10072
+ }
10073
+ }
10074
+ ((index = (index + 1)));
10075
+ }
10076
+ ((index = 0));
9340
10077
  while (__eliscript_numeric_relation("<", index, ((functions) ?? []).length)) {
9341
10078
  {
9342
10079
  let function$ = ((((functions) ?? [])[index]) ?? null);
@@ -9425,6 +10162,7 @@ function lower_managed_program_core(program, runtime_program, module_mode = null
9425
10162
  (combined)["push"](managed_module_initializer(((combined) ?? []).length, runtime_functions, globals, initializer));
9426
10163
  (combined)["push"](managed_module_getter(((combined) ?? []).length, runtime_functions, function_count, functions));
9427
10164
  (combined)["push"](managed_module_code_invoker(((combined) ?? []).length, runtime_functions, function_count, functions));
10165
+ (combined)["push"](managed_module_code_batch_invoker(((combined) ?? []).length, runtime_functions, function_count, functions));
9428
10166
  (combined)["push"](managed_module_runtime_wrapper("__eliscript_module_status", ((combined) ?? []).length, runtime_functions, "value-module-status", 1));
9429
10167
  (combined)["push"](managed_module_runtime_wrapper("__eliscript_module_close", ((combined) ?? []).length, runtime_functions, "value-module-close", 1));
9430
10168
  (combined)["push"](managed_module_runtime_wrapper("__eliscript_module_abort", ((combined) ?? []).length, runtime_functions, "value-module-abort", 2));
@@ -9444,7 +10182,7 @@ function lower_managed_program_core(program, runtime_program, module_mode = null
9444
10182
  }
9445
10183
  }
9446
10184
  }
9447
- append_managed(bindings, ["__eliscript_module_init", "__eliscript_module_get", "__eliscript_module_invoke", "__eliscript_module_status", "__eliscript_module_close", "__eliscript_module_abort"]);
10185
+ append_managed(bindings, ["__eliscript_module_init", "__eliscript_module_get", "__eliscript_module_invoke", "__eliscript_module_invoke_batch", "__eliscript_module_status", "__eliscript_module_close", "__eliscript_module_abort"]);
9448
10186
  ((index = 0));
9449
10187
  while (__eliscript_numeric_relation("<", index, ((bindings) ?? []).length)) {
9450
10188
  {
@@ -9466,6 +10204,7 @@ function lower_managed_program_core(program, runtime_program, module_mode = null
9466
10204
  {
9467
10205
  let callable = module;
9468
10206
  let table = ((runtime)["table"] ?? null);
10207
+ let cached_caps = null;
9469
10208
  ((index = 0));
9470
10209
  while (__eliscript_numeric_relation("<", index, ((functions) ?? []).length)) {
9471
10210
  if (__eliscript_truthy(((((((functions) ?? [])[index]) ?? null))["callable"] ?? null))) {
@@ -9492,7 +10231,9 @@ function lower_managed_program_core(program, runtime_program, module_mode = null
9492
10231
  }
9493
10232
  }
9494
10233
  {
9495
- let external = ((__eliscript_value_213) => (__eliscript_truthy(__eliscript_value_213) ? __eliscript_value_213 : ((__eliscript_value_215) => (__eliscript_truthy(__eliscript_value_215) ? __eliscript_value_215 : __eliscript_numeric_relation(">", ((managed_host_capabilities(combined)) ?? []).length, 0)))(((__eliscript_value_216) => (__eliscript_truthy(__eliscript_value_216) ? __eliscript_numeric_relation(">", ((host_modules) ?? []).length, 0) : __eliscript_value_216))(host_modules))))(((__eliscript_value_214) => (__eliscript_truthy(__eliscript_value_214) ? await_host_capability : __eliscript_value_214))(module));
10234
+ let base_external = ((__eliscript_value_214) => (__eliscript_truthy(__eliscript_value_214) ? __eliscript_value_214 : ((__eliscript_value_216) => (__eliscript_truthy(__eliscript_value_216) ? __eliscript_numeric_relation(">", ((host_modules) ?? []).length, 0) : __eliscript_value_216))(host_modules)))(((__eliscript_value_215) => (__eliscript_truthy(__eliscript_value_215) ? await_host_capability : __eliscript_value_215))(module));
10235
+ let _caps = ((!__eliscript_truthy(base_external)) ? ((cached_caps = managed_host_capabilities(combined))) : null);
10236
+ let external = ((__eliscript_value_217) => (__eliscript_truthy(__eliscript_value_217) ? __eliscript_value_217 : __eliscript_numeric_relation(">", ((cached_caps) ?? []).length, 0)))(base_external);
9496
10237
  if ((__eliscript_truthy(external) || (foreign_entry === true))) {
9497
10238
  {
9498
10239
  let stub = find_function(combined, "host-source-operation");
@@ -9515,6 +10256,12 @@ function lower_managed_program_core(program, runtime_program, module_mode = null
9515
10256
  ((stub)["body"] = word_node("call", [word_local(((((locals) ?? [])[0]) ?? null)), word_local(((((locals) ?? [])[1]) ?? null)), word_local(((((locals) ?? [])[2]) ?? null))], (find_function(combined, "value-project-binding-notify"))["index"]));
9516
10257
  }
9517
10258
  }
10259
+ if ((__eliscript_truthy(external) || (foreign_entry === true))) {
10260
+ ((cached_caps = null));
10261
+ }
10262
+ }
10263
+ if ((!__eliscript_truthy(cached_caps))) {
10264
+ ((cached_caps = managed_host_capabilities(combined)));
9518
10265
  }
9519
10266
  ((index = ((runtime_functions) ?? []).length));
9520
10267
  while (__eliscript_numeric_relation("<", index, ((combined) ?? []).length)) {
@@ -9595,20 +10342,18 @@ function lower_managed_program_core(program, runtime_program, module_mode = null
9595
10342
  }))});
9596
10343
  }))}));
9597
10344
  }
9598
- {
9599
- let capabilities = managed_host_capabilities(combined);
9600
- if (__eliscript_numeric_relation(">", ((capabilities) ?? []).length, 0)) {
9601
- ((descriptor)["hostCapabilities"] = capabilities);
9602
- }
10345
+ if (__eliscript_numeric_relation(">", ((cached_caps) ?? []).length, 0)) {
10346
+ ((descriptor)["hostCapabilities"] = (cached_caps)["map"](((c) => {
10347
+ return Object.assign(({}), c);
10348
+ })));
9603
10349
  }
9604
10350
  if (__eliscript_truthy(module)) {
9605
10351
  ((descriptor)["module"] = ({"initialize": "__eliscript_module_init", "get": "__eliscript_module_get", "invoke": "__eliscript_module_invoke", "status": "__eliscript_module_status", "close": "__eliscript_module_close", "abort": "__eliscript_module_abort", "bindingCount": ((globals) ?? []).length, "functionCount": function_count, "exports": module_exports}));
9606
10352
  }
9607
10353
  {
9608
10354
  let typed = ({"abi": "memory-u32", "filename": (program)["filename"], "functions": combined, "exports": (runtime)["exports"], "aliases": aliases, "table": table, "indirectSignatures": ((runtime)["indirectSignatures"] ?? [])});
9609
- let capabilities = managed_host_capabilities(combined);
9610
- if (__eliscript_numeric_relation(">", ((capabilities) ?? []).length, 0)) {
9611
- ((typed)["hostCapabilities"] = capabilities);
10355
+ if (__eliscript_numeric_relation(">", ((cached_caps) ?? []).length, 0)) {
10356
+ ((typed)["hostCapabilities"] = cached_caps);
9612
10357
  }
9613
10358
  {
9614
10359
  let signatures = ({});
@@ -9648,15 +10393,15 @@ function lower_managed_program_core(program, runtime_program, module_mode = null
9648
10393
  }
9649
10394
  function emit_managed_wasm(program, runtime_program, options = null) {
9650
10395
  {
9651
- let requested = ((((__eliscript_value_217) => (__eliscript_truthy(__eliscript_value_217) ? __eliscript_value_217 : ({})))(options))["abi"] ?? null);
9652
- let lowered = lower_managed_program(program, runtime_program, (requested === "managed-module"), null, null, null, null, null, null, ((((__eliscript_value_218) => (__eliscript_truthy(__eliscript_value_218) ? __eliscript_value_218 : ({})))(options))["literalModules"] ?? null));
10396
+ let requested = ((((__eliscript_value_218) => (__eliscript_truthy(__eliscript_value_218) ? __eliscript_value_218 : ({})))(options))["abi"] ?? null);
10397
+ let lowered = lower_managed_program(program, runtime_program, (requested === "managed-module"), null, null, null, null, null, null, ((((__eliscript_value_219) => (__eliscript_truthy(__eliscript_value_219) ? __eliscript_value_219 : ({})))(options))["literalModules"] ?? null));
9653
10398
  if ((!((requested === null)) && !(((requested === "managed-control") || (requested === "managed-module"))))) {
9654
10399
  managed_fail(program, "unknown managed ABI");
9655
10400
  }
9656
10401
  if ((!((requested === null)) && !((requested === ((lowered)["descriptor"])["abi"])))) {
9657
10402
  managed_fail(program, "top-level bindings require managed-module");
9658
10403
  }
9659
- return append_metadata_section(emit_owned_memory_wasm((lowered)["typed"], ((__eliscript_value_219) => (__eliscript_truthy(__eliscript_value_219) ? __eliscript_value_219 : ({})))(options)), "eliscript-managed-control", JSON.stringify((lowered)["descriptor"]));
10404
+ return append_metadata_section(emit_owned_memory_wasm(mark_trusted_runtime_program((lowered)["typed"]), ((__eliscript_value_220) => (__eliscript_truthy(__eliscript_value_220) ? __eliscript_value_220 : ({})))(options)), "eliscript-managed-control", JSON.stringify((lowered)["descriptor"]));
9660
10405
  }
9661
10406
  }
9662
10407
  function lower_managed_namespace(node, state, functions) {
@@ -9718,14 +10463,12 @@ function managed_link_qualified(node, record, scope, records) {
9718
10463
  }
9719
10464
  }
9720
10465
  function managed_link_fail(node, message) {
9721
- return (() => {
9722
- try {
9723
- return backend_fail(node, message);
9724
- } catch (error) {
9725
- (((error)["eliscriptDiagnostic"])["phase"] = "managed-link");
9726
- return ((__eliscript_value_220) => { throw __eliscript_value_220; })(error);
9727
- }
9728
- })();
10466
+ try {
10467
+ return backend_fail(node, message);
10468
+ } catch (error) {
10469
+ (((error)["eliscriptDiagnostic"])["phase"] = "managed-link");
10470
+ return ((__eliscript_value_221) => { throw __eliscript_value_221; })(error);
10471
+ }
9729
10472
  }
9730
10473
  function managed_link_id_p(value) {
9731
10474
  return ((__eliscript_value_type(value) === "string") && __eliscript_numeric_relation(">", ((value) ?? []).length, 0) && (!__eliscript_truthy((value)["startsWith"]("/"))) && (!__eliscript_truthy((value)["includes"]("\\"))) && (!__eliscript_truthy((value)["includes"](":"))) && (!__eliscript_truthy((value)["includes"]("\u0000"))) && (!__eliscript_truthy((value)["includes"]("?"))) && (!__eliscript_truthy((value)["includes"]("#"))) && (!__eliscript_truthy(((value)["split"]("/"))["some"](((part) => {
@@ -9772,13 +10515,11 @@ function managed_link_target(id, specifier, node) {
9772
10515
  }
9773
10516
  }
9774
10517
  function managed_link_name(name, node) {
9775
- return (() => {
9776
- try {
9777
- return binding_name(name);
9778
- } catch (error) {
9779
- return managed_link_fail(node, ((error)["message"] ?? "invalid managed project binding name"));
9780
- }
9781
- })();
10518
+ try {
10519
+ return binding_name(name);
10520
+ } catch (error) {
10521
+ return managed_link_fail(node, ((error)["message"] ?? "invalid managed project binding name"));
10522
+ }
9782
10523
  }
9783
10524
  function managed_link_add_binding(record, name, binding, node) {
9784
10525
  if ((!((__eliscript_value_type(name) === "string") && __eliscript_numeric_relation(">", ((name) ?? []).length, 0) && !(__eliscript_truthy(((record)["bindings"])["has"](name)))))) {
@@ -9962,7 +10703,7 @@ function managed_link_copy_node(node, record, scope, records, depth) {
9962
10703
  }
9963
10704
  }));
9964
10705
  }
9965
- (output)["push"]((globalThis.Object)["assign"](({}), ((((children) ?? [])[0]) ?? null), ({"value": (String("`${") + String(binding_name(managed_link_reference(record, ((__eliscript_value_221) => (__eliscript_truthy(__eliscript_value_221) ? __eliscript_value_221 : binding))(local), scope, records, node))) + String("}`"))})));
10706
+ (output)["push"]((globalThis.Object)["assign"](({}), ((((children) ?? [])[0]) ?? null), ({"value": (String("`${") + String(binding_name(managed_link_reference(record, ((__eliscript_value_222) => (__eliscript_truthy(__eliscript_value_222) ? __eliscript_value_222 : binding))(local), scope, records, node))) + String("}`"))})));
9966
10707
  }
9967
10708
  } else {
9968
10709
  if (__eliscript_truthy(managed_js_truth_name(node))) {
@@ -9979,7 +10720,7 @@ function managed_link_copy_node(node, record, scope, records, depth) {
9979
10720
  }
9980
10721
  }));
9981
10722
  }
9982
- (output)["push"]((globalThis.Object)["assign"](({}), ((((children) ?? [])[0]) ?? null), ({"value": (String("!!") + String(binding_name(managed_link_reference(record, ((__eliscript_value_222) => (__eliscript_truthy(__eliscript_value_222) ? __eliscript_value_222 : binding))(local), scope, records, node))))})));
10723
+ (output)["push"]((globalThis.Object)["assign"](({}), ((((children) ?? [])[0]) ?? null), ({"value": (String("!!") + String(binding_name(managed_link_reference(record, ((__eliscript_value_223) => (__eliscript_truthy(__eliscript_value_223) ? __eliscript_value_223 : binding))(local), scope, records, node))))})));
9983
10724
  }
9984
10725
  } else {
9985
10726
  if (__eliscript_truthy(managed_typeof_path(node))) {
@@ -10000,7 +10741,7 @@ function managed_link_copy_node(node, record, scope, records, depth) {
10000
10741
  {
10001
10742
  let source = (((managed_static_reference(node))["trim"]())["slice"](6))["trim"]();
10002
10743
  let suffix = (source)["slice"](((name) ?? []).length);
10003
- let root = binding_name(managed_link_reference(record, ((__eliscript_value_223) => (__eliscript_truthy(__eliscript_value_223) ? __eliscript_value_223 : binding))(local), scope, records, node));
10744
+ let root = binding_name(managed_link_reference(record, ((__eliscript_value_224) => (__eliscript_truthy(__eliscript_value_224) ? __eliscript_value_224 : binding))(local), scope, records, node));
10004
10745
  let literal = (globalThis.Object)["assign"](({}), ((((children) ?? [])[0]) ?? null), ({"value": (String("typeof ") + String(root) + String(suffix))}));
10005
10746
  (output)["push"](literal);
10006
10747
  }
@@ -10058,7 +10799,7 @@ function managed_link_copy_node(node, record, scope, records, depth) {
10058
10799
  {
10059
10800
  let inner = new (globalThis.Set)(scope);
10060
10801
  let count = (properties)["bindingCount"];
10061
- let sequential = ((__eliscript_value_224) => (__eliscript_truthy(__eliscript_value_224) ? ((properties)["sequential"] ?? null) : __eliscript_value_224))((kind === "lexical-bindings"));
10802
+ let sequential = ((__eliscript_value_225) => (__eliscript_truthy(__eliscript_value_225) ? ((properties)["sequential"] ?? null) : __eliscript_value_225))((kind === "lexical-bindings"));
10062
10803
  if ((!__eliscript_truthy(sequential))) {
10063
10804
  while (__eliscript_numeric_relation("<", index, count)) {
10064
10805
  managed_link_pattern_scope(inner, ((((children) ?? [])[index]) ?? null));
@@ -10316,10 +11057,10 @@ function link_managed_project(modules, entry, options = null) {
10316
11057
  if ((kind === "import-declaration")) {
10317
11058
  {
10318
11059
  let target = managed_link_target((record)["id"], name, node);
10319
- let declaration = (((((__eliscript_value_225) => (__eliscript_truthy(__eliscript_value_225) ? __eliscript_value_225 : ({})))(options))["hostModules"] ?? []))["find"](((item) => {
11060
+ let declaration = (((((__eliscript_value_226) => (__eliscript_truthy(__eliscript_value_226) ? __eliscript_value_226 : ({})))(options))["hostModules"] ?? []))["find"](((item) => {
10320
11061
  return (((item)["referrer"] === (record)["id"]) && ((item)["specifier"] === name));
10321
11062
  }));
10322
- let external = ((__eliscript_value_226) => (__eliscript_truthy(__eliscript_value_226) ? __eliscript_value_226 : (!(__eliscript_truthy((name)["startsWith"]("./")) || __eliscript_truthy((name)["startsWith"]("../"))))))(declaration);
11063
+ let external = ((__eliscript_value_227) => (__eliscript_truthy(__eliscript_value_227) ? __eliscript_value_227 : (!(__eliscript_truthy((name)["startsWith"]("./")) || __eliscript_truthy((name)["startsWith"]("../"))))))(declaration);
10323
11064
  let children = (node)["children"];
10324
11065
  let i = 0;
10325
11066
  let host = null;
@@ -10372,7 +11113,7 @@ function link_managed_project(modules, entry, options = null) {
10372
11113
  (((records)["get"](target))["namespaceBinding"] = ({"canonical": (String(prefix) + String(counter)), "namespaceValue": true, "source": specifier}));
10373
11114
  ((counter = (counter + 1)));
10374
11115
  }
10375
- managed_link_add_binding(record, local, ({"imported": true, "namespace": (mode === "import-namespace"), "target": target, "exportName": ((__eliscript_value_227) => (__eliscript_truthy(__eliscript_value_227) ? __eliscript_value_227 : local))(((__eliscript_tdz_ready_6 === true ? private_literal_exports : __eliscript_tdz_error("private_literal_exports")))["get"](specifier)), "defaultImport": (mode === "import-default"), "source": specifier}), specifier);
11116
+ managed_link_add_binding(record, local, ({"imported": true, "namespace": (mode === "import-namespace"), "target": target, "exportName": ((__eliscript_value_228) => (__eliscript_truthy(__eliscript_value_228) ? __eliscript_value_228 : local))(((__eliscript_tdz_ready_12 === true ? private_literal_exports : __eliscript_tdz_error("private_literal_exports")))["get"](specifier)), "defaultImport": (mode === "import-default"), "source": specifier}), specifier);
10376
11117
  }
10377
11118
  }
10378
11119
  ((i = (i + 1)));
@@ -10452,10 +11193,10 @@ function link_managed_project(modules, entry, options = null) {
10452
11193
  }
10453
11194
  }));
10454
11195
  {
10455
- let phased = ((__eliscript_value_228) => (__eliscript_truthy(__eliscript_value_228) ? __eliscript_value_228 : (ids)["some"](((id) => {
11196
+ let phased = ((__eliscript_value_229) => (__eliscript_truthy(__eliscript_value_229) ? __eliscript_value_229 : (ids)["some"](((id) => {
10456
11197
  return __eliscript_numeric_relation(">", (((((records)["get"](id))["hostModules"] ?? [])) ?? []).length, 0);
10457
- }))))(((((__eliscript_value_229) => (__eliscript_truthy(__eliscript_value_229) ? __eliscript_value_229 : ({})))(options))["phased"] ?? false));
10458
- let roots = (__eliscript_truthy(phased) ? ((((__eliscript_value_230) => (__eliscript_truthy(__eliscript_value_230) ? __eliscript_value_230 : ({})))(options))["entries"] ?? ([entry])["concat"]((ids)["filter"](((id) => {
11198
+ }))))(((((__eliscript_value_230) => (__eliscript_truthy(__eliscript_value_230) ? __eliscript_value_230 : ({})))(options))["phased"] ?? false));
11199
+ let roots = (__eliscript_truthy(phased) ? ((((__eliscript_value_231) => (__eliscript_truthy(__eliscript_value_231) ? __eliscript_value_231 : ({})))(options))["entries"] ?? ([entry])["concat"]((ids)["filter"](((id) => {
10459
11200
  return (!((id === entry) || (__eliscript_truthy(literal_context) && __eliscript_truthy((id)["startsWith"]((literal_context)["prefix"])))));
10460
11201
  })))) : [entry]);
10461
11202
  let plan = project_plan(roots, ((id) => {
@@ -10580,15 +11321,15 @@ function link_managed_project(modules, entry, options = null) {
10580
11321
  let definitions = new (globalThis.Map)();
10581
11322
  (["avalancheHash", "mixHash", "finishHash", "hashString"])["forEach"](((name) => {
10582
11323
  {
10583
- const __eliscript_value_231 = (managed_link_binding(owner, name, records, (owner)["program"]))["canonical"];
11324
+ const __eliscript_value_232 = (managed_link_binding(owner, name, records, (owner)["program"]))["canonical"];
10584
11325
  {
10585
- let canonical = __eliscript_value_231;
11326
+ let canonical = __eliscript_value_232;
10586
11327
  {
10587
- const __eliscript_value_232 = (body)["find"](((node) => {
11328
+ const __eliscript_value_233 = (body)["find"](((node) => {
10588
11329
  return (((node)["kind"] === "function-declaration") && ((node)["value"] === canonical));
10589
11330
  }));
10590
11331
  {
10591
- let node = __eliscript_value_232;
11332
+ let node = __eliscript_value_233;
10592
11333
  return (definitions)["set"](canonical, managed_string_hash_shape(node));
10593
11334
  }
10594
11335
  }
@@ -10736,7 +11477,7 @@ function lower_managed_project(modules, entry, runtime_program, options = null)
10736
11477
  let names = ((linked)["exports"])["map"](((item) => {
10737
11478
  return (item)["name"];
10738
11479
  }));
10739
- let lowered = lower_managed_program((linked)["program"], runtime_program, true, names, (linked)["namespaces"], (linked)["hostIdentities"], (linked)["hostModules"], (linked)["sourceModules"], ((((__eliscript_value_233) => (__eliscript_truthy(__eliscript_value_233) ? __eliscript_value_233 : ({})))(options))["phased"] ?? false), null, foreign_entry);
11480
+ let lowered = lower_managed_program((linked)["program"], runtime_program, true, names, (linked)["namespaces"], (linked)["hostIdentities"], (linked)["hostModules"], (linked)["sourceModules"], ((((__eliscript_value_234) => (__eliscript_truthy(__eliscript_value_234) ? __eliscript_value_234 : ({})))(options))["phased"] ?? false), null, foreign_entry);
10740
11481
  ((lowered)["modules"] = (linked)["modules"]);
10741
11482
  if (__eliscript_numeric_relation(">", (((linked)["privateModules"]) ?? []).length, 0)) {
10742
11483
  ((lowered)["privateModules"] = (linked)["privateModules"]);
@@ -10746,12 +11487,12 @@ function lower_managed_project(modules, entry, runtime_program, options = null)
10746
11487
  }
10747
11488
  function emit_managed_project_wasm(modules, entry, runtime_program, options = null) {
10748
11489
  {
10749
- let requested = ((((__eliscript_value_234) => (__eliscript_truthy(__eliscript_value_234) ? __eliscript_value_234 : ({})))(options))["abi"] ?? null);
11490
+ let requested = ((((__eliscript_value_235) => (__eliscript_truthy(__eliscript_value_235) ? __eliscript_value_235 : ({})))(options))["abi"] ?? null);
10750
11491
  let lowered = lower_managed_project(modules, entry, runtime_program, options);
10751
11492
  if ((!((requested === null)) && !((requested === "managed-module")))) {
10752
11493
  managed_link_fail(null, "managed projects require managed-module");
10753
11494
  }
10754
- return append_metadata_section(emit_owned_memory_wasm((lowered)["typed"], ((__eliscript_value_235) => (__eliscript_truthy(__eliscript_value_235) ? __eliscript_value_235 : ({})))(options)), "eliscript-managed-control", JSON.stringify((lowered)["descriptor"]));
11495
+ return append_metadata_section(emit_owned_memory_wasm(mark_trusted_runtime_program((lowered)["typed"]), ((__eliscript_value_236) => (__eliscript_truthy(__eliscript_value_236) ? __eliscript_value_236 : ({})))(options)), "eliscript-managed-control", JSON.stringify((lowered)["descriptor"]));
10755
11496
  }
10756
11497
  }
10757
11498
  function managed_well_known_symbol(name) {