@scriptc/compiler 0.4.8 → 0.4.9

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 (536) hide show
  1. package/ambient/node-fallback/buffer.d.ts +2 -0
  2. package/ambient/node-fallback/child_process.d.ts +9 -3
  3. package/ambient/node-fallback/dns-promises.d.ts +25 -0
  4. package/ambient/node-fallback/dns.d.ts +29 -0
  5. package/ambient/node-fallback/test.d.ts +7 -0
  6. package/ambient/scriptc-node-fallback.d.ts +145 -2
  7. package/ambient/scriptc-overrides.d.ts +22 -13
  8. package/dist/backend/build-cache.d.ts +1 -1
  9. package/dist/backend/build-cache.js +1 -1
  10. package/dist/backend/build-cache.js.map +1 -1
  11. package/dist/backend/cache-root.d.ts +7 -0
  12. package/dist/backend/cache-root.js +27 -0
  13. package/dist/backend/cache-root.js.map +1 -1
  14. package/dist/backend/executable-features.js +5 -1
  15. package/dist/backend/executable-features.js.map +1 -1
  16. package/dist/backend/link-plan.js +7 -1
  17. package/dist/backend/link-plan.js.map +1 -1
  18. package/dist/backend/llvm/bytes-loop-versions.d.ts +12 -1
  19. package/dist/backend/llvm/bytes-loop-versions.js +107 -30
  20. package/dist/backend/llvm/bytes-loop-versions.js.map +1 -1
  21. package/dist/backend/llvm/bytes-loop-versions.test.js +96 -0
  22. package/dist/backend/llvm/bytes-loop-versions.test.js.map +1 -1
  23. package/dist/backend/llvm/checked-value-lifetimes.js +1 -0
  24. package/dist/backend/llvm/checked-value-lifetimes.js.map +1 -1
  25. package/dist/backend/llvm/classes.d.ts +16 -5
  26. package/dist/backend/llvm/classes.js +34 -6
  27. package/dist/backend/llvm/classes.js.map +1 -1
  28. package/dist/backend/llvm/classes.test.js +21 -2
  29. package/dist/backend/llvm/classes.test.js.map +1 -1
  30. package/dist/backend/llvm/common.d.ts +9 -0
  31. package/dist/backend/llvm/common.js +9 -0
  32. package/dist/backend/llvm/common.js.map +1 -1
  33. package/dist/backend/llvm/cpu-dispatch.d.ts +36 -2
  34. package/dist/backend/llvm/cpu-dispatch.js +96 -2
  35. package/dist/backend/llvm/cpu-dispatch.js.map +1 -1
  36. package/dist/backend/llvm/dense-array-access.d.ts +5 -2
  37. package/dist/backend/llvm/dense-array-access.js +16 -12
  38. package/dist/backend/llvm/dense-array-access.js.map +1 -1
  39. package/dist/backend/llvm/dense-array-access.test.js +3 -1
  40. package/dist/backend/llvm/dense-array-access.test.js.map +1 -1
  41. package/dist/backend/llvm/dyn.d.ts +24 -0
  42. package/dist/backend/llvm/dyn.js +117 -3
  43. package/dist/backend/llvm/dyn.js.map +1 -1
  44. package/dist/backend/llvm/emit-function.js +6 -0
  45. package/dist/backend/llvm/emit-function.js.map +1 -1
  46. package/dist/backend/llvm/emit-journal.d.ts +1 -0
  47. package/dist/backend/llvm/emit-journal.js.map +1 -1
  48. package/dist/backend/llvm/emit-module.js +48 -5
  49. package/dist/backend/llvm/emit-module.js.map +1 -1
  50. package/dist/backend/llvm/emit-module.test.js +41 -0
  51. package/dist/backend/llvm/emit-module.test.js.map +1 -1
  52. package/dist/backend/llvm/emit-statements.js +11 -0
  53. package/dist/backend/llvm/emit-statements.js.map +1 -1
  54. package/dist/backend/llvm/emitter.d.ts +87 -7
  55. package/dist/backend/llvm/emitter.js +136 -15
  56. package/dist/backend/llvm/emitter.js.map +1 -1
  57. package/dist/backend/llvm/expr-async.js +28 -6
  58. package/dist/backend/llvm/expr-async.js.map +1 -1
  59. package/dist/backend/llvm/expr-containers.js +19 -5
  60. package/dist/backend/llvm/expr-containers.js.map +1 -1
  61. package/dist/backend/llvm/expr-dynamic.js +29 -1
  62. package/dist/backend/llvm/expr-dynamic.js.map +1 -1
  63. package/dist/backend/llvm/expr-primitives.js +104 -6
  64. package/dist/backend/llvm/expr-primitives.js.map +1 -1
  65. package/dist/backend/llvm/expr-records.js +15 -1
  66. package/dist/backend/llvm/expr-records.js.map +1 -1
  67. package/dist/backend/llvm/expr-stream-bridges.js +53 -5
  68. package/dist/backend/llvm/expr-stream-bridges.js.map +1 -1
  69. package/dist/backend/llvm/inline-arrays.js +1 -1
  70. package/dist/backend/llvm/inline-arrays.js.map +1 -1
  71. package/dist/backend/llvm/js-ic.js +126 -2
  72. package/dist/backend/llvm/js-ic.js.map +1 -1
  73. package/dist/backend/llvm/lanes.d.ts +38 -0
  74. package/dist/backend/llvm/lanes.js +778 -0
  75. package/dist/backend/llvm/lanes.js.map +1 -0
  76. package/dist/backend/llvm/lanes.test.d.ts +1 -0
  77. package/dist/backend/llvm/lanes.test.js +402 -0
  78. package/dist/backend/llvm/lanes.test.js.map +1 -0
  79. package/dist/backend/llvm/lib-dispatch.js +9 -4
  80. package/dist/backend/llvm/lib-dispatch.js.map +1 -1
  81. package/dist/backend/llvm/lib-network.js +20 -0
  82. package/dist/backend/llvm/lib-network.js.map +1 -1
  83. package/dist/backend/llvm/lib-shared.js +27 -0
  84. package/dist/backend/llvm/lib-shared.js.map +1 -1
  85. package/dist/backend/llvm/lib-test.js +11 -0
  86. package/dist/backend/llvm/lib-test.js.map +1 -1
  87. package/dist/backend/llvm/local-array-reads.js +2 -2
  88. package/dist/backend/llvm/local-array-reads.js.map +1 -1
  89. package/dist/backend/llvm/map-number-lookup.js +8 -2
  90. package/dist/backend/llvm/map-number-lookup.js.map +1 -1
  91. package/dist/backend/llvm/nullable-unions.js +5 -2
  92. package/dist/backend/llvm/nullable-unions.js.map +1 -1
  93. package/dist/backend/llvm/publish.d.ts +3 -0
  94. package/dist/backend/llvm/publish.js +2 -2
  95. package/dist/backend/llvm/publish.js.map +1 -1
  96. package/dist/backend/llvm/reference-writes.js +1 -0
  97. package/dist/backend/llvm/reference-writes.js.map +1 -1
  98. package/dist/backend/llvm/region-groups.js +43 -4
  99. package/dist/backend/llvm/region-groups.js.map +1 -1
  100. package/dist/backend/llvm/region-groups.test.js +79 -0
  101. package/dist/backend/llvm/region-groups.test.js.map +1 -1
  102. package/dist/backend/llvm/runtime-registries.test.js +32 -1
  103. package/dist/backend/llvm/runtime-registries.test.js.map +1 -1
  104. package/dist/backend/llvm/shapes.js +10 -1
  105. package/dist/backend/llvm/shapes.js.map +1 -1
  106. package/dist/backend/llvm/string-reads.d.ts +1 -1
  107. package/dist/backend/llvm/string-reads.js +1 -1
  108. package/dist/backend/llvm/string-reads.js.map +1 -1
  109. package/dist/backend/llvm/unwind-abi.js +24 -2
  110. package/dist/backend/llvm/unwind-abi.js.map +1 -1
  111. package/dist/backend/llvm/unwind-abi.test.js +38 -0
  112. package/dist/backend/llvm/unwind-abi.test.js.map +1 -1
  113. package/dist/backend/llvm/walkers.d.ts +3 -0
  114. package/dist/backend/llvm/walkers.js +20 -2
  115. package/dist/backend/llvm/walkers.js.map +1 -1
  116. package/dist/backend/native/contracts.d.ts +15 -3
  117. package/dist/backend/native/executable.js +19 -5
  118. package/dist/backend/native/executable.js.map +1 -1
  119. package/dist/backend/native-codegen-core.d.ts +20 -0
  120. package/dist/backend/native-codegen-core.js +15 -0
  121. package/dist/backend/native-codegen-core.js.map +1 -1
  122. package/dist/backend/native-codegen.d.ts +5 -0
  123. package/dist/backend/native-codegen.js +62 -8
  124. package/dist/backend/native-codegen.js.map +1 -1
  125. package/dist/backend/native-codegen.test.js +48 -8
  126. package/dist/backend/native-codegen.test.js.map +1 -1
  127. package/dist/backend/native-link-info-core.d.ts +27 -3
  128. package/dist/backend/native-link-info-core.js.map +1 -1
  129. package/dist/backend/native-link-info.test.js +17 -1
  130. package/dist/backend/native-link-info.test.js.map +1 -1
  131. package/dist/backend/native-toolchain.d.ts +1 -1
  132. package/dist/backend/native-toolchain.js +1 -1
  133. package/dist/backend/native-toolchain.js.map +1 -1
  134. package/dist/backend/native-toolchain.test.js +14 -1
  135. package/dist/backend/native-toolchain.test.js.map +1 -1
  136. package/dist/backend/runtime-pack-core.d.ts +9 -3
  137. package/dist/backend/runtime-pack-core.js +6 -1
  138. package/dist/backend/runtime-pack-core.js.map +1 -1
  139. package/dist/backend/runtime-pack.test.js +32 -1
  140. package/dist/backend/runtime-pack.test.js.map +1 -1
  141. package/dist/backend/targets.d.ts +9 -1
  142. package/dist/backend/targets.js +11 -2
  143. package/dist/backend/targets.js.map +1 -1
  144. package/dist/backend/targets.test.js +6 -0
  145. package/dist/backend/targets.test.js.map +1 -1
  146. package/dist/cli/command.js +15 -1
  147. package/dist/cli/command.js.map +1 -1
  148. package/dist/cli/host.d.ts +6 -0
  149. package/dist/cli/mcp.d.ts +72 -0
  150. package/dist/cli/mcp.js +601 -0
  151. package/dist/cli/mcp.js.map +1 -0
  152. package/dist/cli/mcp.test.d.ts +1 -0
  153. package/dist/cli/mcp.test.js +380 -0
  154. package/dist/cli/mcp.test.js.map +1 -0
  155. package/dist/cli/output-options.d.ts +1 -0
  156. package/dist/cli/output-options.js +3 -0
  157. package/dist/cli/output-options.js.map +1 -1
  158. package/dist/cli/usage.d.ts +51 -1
  159. package/dist/cli/usage.js +709 -186
  160. package/dist/cli/usage.js.map +1 -1
  161. package/dist/compat/fetch-profile.js +9 -4
  162. package/dist/compat/fetch-profile.js.map +1 -1
  163. package/dist/compile-types.d.ts +17 -0
  164. package/dist/coverage/report.d.ts +5 -9
  165. package/dist/coverage/report.js.map +1 -1
  166. package/dist/executable/executable-cache.d.ts +17 -3
  167. package/dist/executable/executable-cache.js +17 -3
  168. package/dist/executable/executable-cache.js.map +1 -1
  169. package/dist/executable/prepare.js +87 -10
  170. package/dist/executable/prepare.js.map +1 -1
  171. package/dist/frontend/analysis.js +3 -2
  172. package/dist/frontend/analysis.js.map +1 -1
  173. package/dist/frontend/canon-map.js +13 -8
  174. package/dist/frontend/canon-map.js.map +1 -1
  175. package/dist/frontend/decl-projection.d.ts +18 -0
  176. package/dist/frontend/decl-projection.js +90 -22
  177. package/dist/frontend/decl-projection.js.map +1 -1
  178. package/dist/frontend/decl-projection.test.js +47 -1
  179. package/dist/frontend/decl-projection.test.js.map +1 -1
  180. package/dist/frontend/default-library.d.ts +10 -0
  181. package/dist/frontend/default-library.js +43 -0
  182. package/dist/frontend/default-library.js.map +1 -0
  183. package/dist/frontend/fork-target.js +54 -9
  184. package/dist/frontend/fork-target.js.map +1 -1
  185. package/dist/frontend/fork-target.test.js +82 -0
  186. package/dist/frontend/fork-target.test.js.map +1 -1
  187. package/dist/frontend/inferred-js-diagnostics.test.js +73 -0
  188. package/dist/frontend/inferred-js-diagnostics.test.js.map +1 -1
  189. package/dist/frontend/lowering/abstract-equality.d.ts +2 -1
  190. package/dist/frontend/lowering/abstract-equality.js +7 -1
  191. package/dist/frontend/lowering/abstract-equality.js.map +1 -1
  192. package/dist/frontend/lowering/array-values.js +2 -2
  193. package/dist/frontend/lowering/array-values.js.map +1 -1
  194. package/dist/frontend/lowering/assertion-members.js +52 -2
  195. package/dist/frontend/lowering/assertion-members.js.map +1 -1
  196. package/dist/frontend/lowering/builtin-namespaces.d.ts +5 -0
  197. package/dist/frontend/lowering/builtin-namespaces.js +19 -12
  198. package/dist/frontend/lowering/builtin-namespaces.js.map +1 -1
  199. package/dist/frontend/lowering/builtins/callable-aliases.js +42 -6
  200. package/dist/frontend/lowering/builtins/callable-aliases.js.map +1 -1
  201. package/dist/frontend/lowering/builtins/child-process.d.ts +12 -11
  202. package/dist/frontend/lowering/builtins/child-process.js +235 -38
  203. package/dist/frontend/lowering/builtins/child-process.js.map +1 -1
  204. package/dist/frontend/lowering/builtins/compression.d.ts +6 -1
  205. package/dist/frontend/lowering/builtins/compression.js +3 -3
  206. package/dist/frontend/lowering/builtins/compression.js.map +1 -1
  207. package/dist/frontend/lowering/builtins/constants.js +2 -2
  208. package/dist/frontend/lowering/builtins/constants.js.map +1 -1
  209. package/dist/frontend/lowering/builtins/crypto.d.ts +3 -1
  210. package/dist/frontend/lowering/builtins/crypto.js +9 -1
  211. package/dist/frontend/lowering/builtins/crypto.js.map +1 -1
  212. package/dist/frontend/lowering/builtins/dates.js +26 -6
  213. package/dist/frontend/lowering/builtins/dates.js.map +1 -1
  214. package/dist/frontend/lowering/builtins/environment.d.ts +13 -1
  215. package/dist/frontend/lowering/builtins/environment.js +15 -4
  216. package/dist/frontend/lowering/builtins/environment.js.map +1 -1
  217. package/dist/frontend/lowering/builtins/module-bindings.d.ts +33 -0
  218. package/dist/frontend/lowering/builtins/module-bindings.js +213 -11
  219. package/dist/frontend/lowering/builtins/module-bindings.js.map +1 -1
  220. package/dist/frontend/lowering/builtins/module-resolution.d.ts +9 -2
  221. package/dist/frontend/lowering/builtins/module-resolution.js +187 -19
  222. package/dist/frontend/lowering/builtins/module-resolution.js.map +1 -1
  223. package/dist/frontend/lowering/builtins/performance.js +1 -1
  224. package/dist/frontend/lowering/builtins/performance.js.map +1 -1
  225. package/dist/frontend/lowering/builtins/process.js +40 -2
  226. package/dist/frontend/lowering/builtins/process.js.map +1 -1
  227. package/dist/frontend/lowering/builtins/promises.js +33 -0
  228. package/dist/frontend/lowering/builtins/promises.js.map +1 -1
  229. package/dist/frontend/lowering/builtins/readline.d.ts +9 -5
  230. package/dist/frontend/lowering/builtins/readline.js +184 -75
  231. package/dist/frontend/lowering/builtins/readline.js.map +1 -1
  232. package/dist/frontend/lowering/builtins/url.d.ts +4 -0
  233. package/dist/frontend/lowering/builtins/url.js +6 -0
  234. package/dist/frontend/lowering/builtins/url.js.map +1 -1
  235. package/dist/frontend/lowering/call-arguments.js +15 -0
  236. package/dist/frontend/lowering/call-arguments.js.map +1 -1
  237. package/dist/frontend/lowering/callable-properties.d.ts +34 -0
  238. package/dist/frontend/lowering/callable-properties.js +210 -0
  239. package/dist/frontend/lowering/callable-properties.js.map +1 -0
  240. package/dist/frontend/lowering/cjs-inline-require.d.ts +16 -0
  241. package/dist/frontend/lowering/cjs-inline-require.js +105 -0
  242. package/dist/frontend/lowering/cjs-inline-require.js.map +1 -1
  243. package/dist/frontend/lowering/cjs-inline-require.test.d.ts +1 -0
  244. package/dist/frontend/lowering/cjs-inline-require.test.js +61 -0
  245. package/dist/frontend/lowering/cjs-inline-require.test.js.map +1 -0
  246. package/dist/frontend/lowering/class-dynamic-dispatch.js +82 -2
  247. package/dist/frontend/lowering/class-dynamic-dispatch.js.map +1 -1
  248. package/dist/frontend/lowering/class-protocols.d.ts +57 -4
  249. package/dist/frontend/lowering/class-protocols.js +597 -30
  250. package/dist/frontend/lowering/class-protocols.js.map +1 -1
  251. package/dist/frontend/lowering/class-unions.js +2 -2
  252. package/dist/frontend/lowering/class-unions.js.map +1 -1
  253. package/dist/frontend/lowering/coercions/function-adapters.d.ts +12 -0
  254. package/dist/frontend/lowering/coercions/function-adapters.js +62 -0
  255. package/dist/frontend/lowering/coercions/function-adapters.js.map +1 -1
  256. package/dist/frontend/lowering/coercions/structural-plans.js +56 -1
  257. package/dist/frontend/lowering/coercions/structural-plans.js.map +1 -1
  258. package/dist/frontend/lowering/coercions/structural.js +9 -4
  259. package/dist/frontend/lowering/coercions/structural.js.map +1 -1
  260. package/dist/frontend/lowering/collection-ingestion.d.ts +9 -0
  261. package/dist/frontend/lowering/collection-ingestion.js +115 -41
  262. package/dist/frontend/lowering/collection-ingestion.js.map +1 -1
  263. package/dist/frontend/lowering/containers/array-callbacks.js +16 -0
  264. package/dist/frontend/lowering/containers/array-callbacks.js.map +1 -1
  265. package/dist/frontend/lowering/containers/bytes.js +66 -10
  266. package/dist/frontend/lowering/containers/bytes.js.map +1 -1
  267. package/dist/frontend/lowering/containers/collection-methods.js +61 -5
  268. package/dist/frontend/lowering/containers/collection-methods.js.map +1 -1
  269. package/dist/frontend/lowering/containers/filter-predicates.js +11 -0
  270. package/dist/frontend/lowering/containers/filter-predicates.js.map +1 -1
  271. package/dist/frontend/lowering/containers/indexed-objects.d.ts +15 -0
  272. package/dist/frontend/lowering/containers/indexed-objects.js +213 -30
  273. package/dist/frontend/lowering/containers/indexed-objects.js.map +1 -1
  274. package/dist/frontend/lowering/error-name-order.d.ts +16 -0
  275. package/dist/frontend/lowering/error-name-order.js +61 -0
  276. package/dist/frontend/lowering/error-name-order.js.map +1 -1
  277. package/dist/frontend/lowering/expressions/asserted-receiver.d.ts +17 -0
  278. package/dist/frontend/lowering/expressions/asserted-receiver.js +123 -1
  279. package/dist/frontend/lowering/expressions/asserted-receiver.js.map +1 -1
  280. package/dist/frontend/lowering/expressions/binary.js +147 -20
  281. package/dist/frontend/lowering/expressions/binary.js.map +1 -1
  282. package/dist/frontend/lowering/expressions/element-access.js +63 -14
  283. package/dist/frontend/lowering/expressions/element-access.js.map +1 -1
  284. package/dist/frontend/lowering/expressions/erased-delete.d.ts +59 -0
  285. package/dist/frontend/lowering/expressions/erased-delete.js +247 -0
  286. package/dist/frontend/lowering/expressions/erased-delete.js.map +1 -0
  287. package/dist/frontend/lowering/expressions/hosted-narrowing.d.ts +10 -0
  288. package/dist/frontend/lowering/expressions/hosted-narrowing.js +48 -1
  289. package/dist/frontend/lowering/expressions/hosted-narrowing.js.map +1 -1
  290. package/dist/frontend/lowering/expressions/identifiers.js +20 -0
  291. package/dist/frontend/lowering/expressions/identifiers.js.map +1 -1
  292. package/dist/frontend/lowering/expressions/narrowing.d.ts +7 -2
  293. package/dist/frontend/lowering/expressions/narrowing.js +77 -45
  294. package/dist/frontend/lowering/expressions/narrowing.js.map +1 -1
  295. package/dist/frontend/lowering/expressions/object-literals.js +62 -19
  296. package/dist/frontend/lowering/expressions/object-literals.js.map +1 -1
  297. package/dist/frontend/lowering/expressions/optional-chains.js +19 -0
  298. package/dist/frontend/lowering/expressions/optional-chains.js.map +1 -1
  299. package/dist/frontend/lowering/expressions/property-access.d.ts +7 -7
  300. package/dist/frontend/lowering/expressions/property-access.js +247 -48
  301. package/dist/frontend/lowering/expressions/property-access.js.map +1 -1
  302. package/dist/frontend/lowering/expressions/relational.d.ts +1 -0
  303. package/dist/frontend/lowering/expressions/relational.js +18 -8
  304. package/dist/frontend/lowering/expressions/relational.js.map +1 -1
  305. package/dist/frontend/lowering/expressions/union-fields.js +11 -5
  306. package/dist/frontend/lowering/expressions/union-fields.js.map +1 -1
  307. package/dist/frontend/lowering/expressions/updates.js +121 -11
  308. package/dist/frontend/lowering/expressions/updates.js.map +1 -1
  309. package/dist/frontend/lowering/function-context.d.ts +10 -0
  310. package/dist/frontend/lowering/function-context.js +36 -0
  311. package/dist/frontend/lowering/function-context.js.map +1 -1
  312. package/dist/frontend/lowering/function-returns.js +8 -8
  313. package/dist/frontend/lowering/function-returns.js.map +1 -1
  314. package/dist/frontend/lowering/handle-properties.d.ts +62 -3
  315. package/dist/frontend/lowering/handle-properties.js +674 -26
  316. package/dist/frontend/lowering/handle-properties.js.map +1 -1
  317. package/dist/frontend/lowering/handle-properties.test.js +95 -2
  318. package/dist/frontend/lowering/handle-properties.test.js.map +1 -1
  319. package/dist/frontend/lowering/lower-builtin-values.d.ts +12 -0
  320. package/dist/frontend/lowering/lower-builtin-values.js +44 -0
  321. package/dist/frontend/lowering/lower-builtin-values.js.map +1 -1
  322. package/dist/frontend/lowering/lower-calls.js +328 -136
  323. package/dist/frontend/lowering/lower-calls.js.map +1 -1
  324. package/dist/frontend/lowering/lower-classes.js +82 -17
  325. package/dist/frontend/lowering/lower-classes.js.map +1 -1
  326. package/dist/frontend/lowering/lower-event-emitter.js +113 -9
  327. package/dist/frontend/lowering/lower-event-emitter.js.map +1 -1
  328. package/dist/frontend/lowering/lower-expando.d.ts +13 -21
  329. package/dist/frontend/lowering/lower-expando.js +90 -126
  330. package/dist/frontend/lowering/lower-expando.js.map +1 -1
  331. package/dist/frontend/lowering/lower-exprs.js +2 -2
  332. package/dist/frontend/lowering/lower-exprs.js.map +1 -1
  333. package/dist/frontend/lowering/lower-functions.js +65 -0
  334. package/dist/frontend/lowering/lower-functions.js.map +1 -1
  335. package/dist/frontend/lowering/lower-inspect.js +471 -0
  336. package/dist/frontend/lowering/lower-inspect.js.map +1 -1
  337. package/dist/frontend/lowering/lower-modules.js +36 -10
  338. package/dist/frontend/lowering/lower-modules.js.map +1 -1
  339. package/dist/frontend/lowering/lower-node-island.js +28 -0
  340. package/dist/frontend/lowering/lower-node-island.js.map +1 -1
  341. package/dist/frontend/lowering/lower-server.d.ts +53 -7
  342. package/dist/frontend/lowering/lower-server.js +213 -42
  343. package/dist/frontend/lowering/lower-server.js.map +1 -1
  344. package/dist/frontend/lowering/lower-stdlib.js +50 -7
  345. package/dist/frontend/lowering/lower-stdlib.js.map +1 -1
  346. package/dist/frontend/lowering/lower-stmts.d.ts +24 -0
  347. package/dist/frontend/lowering/lower-stmts.js +463 -220
  348. package/dist/frontend/lowering/lower-stmts.js.map +1 -1
  349. package/dist/frontend/lowering/lower-stream.js +2 -2
  350. package/dist/frontend/lowering/lower-stream.js.map +1 -1
  351. package/dist/frontend/lowering/lower-test.js +71 -2
  352. package/dist/frontend/lowering/lower-test.js.map +1 -1
  353. package/dist/frontend/lowering/lowerer.d.ts +81 -10
  354. package/dist/frontend/lowering/lowerer.js +319 -72
  355. package/dist/frontend/lowering/lowerer.js.map +1 -1
  356. package/dist/frontend/lowering/new-target.js +10 -2
  357. package/dist/frontend/lowering/new-target.js.map +1 -1
  358. package/dist/frontend/lowering/nullish-empty-pattern.js +3 -3
  359. package/dist/frontend/lowering/nullish-empty-pattern.js.map +1 -1
  360. package/dist/frontend/lowering/partial-assertions.js +30 -5
  361. package/dist/frontend/lowering/partial-assertions.js.map +1 -1
  362. package/dist/frontend/lowering/primitive-throws.js +91 -1
  363. package/dist/frontend/lowering/primitive-throws.js.map +1 -1
  364. package/dist/frontend/lowering/primitive-wrappers.d.ts +9 -0
  365. package/dist/frontend/lowering/primitive-wrappers.js +2 -2
  366. package/dist/frontend/lowering/primitive-wrappers.js.map +1 -1
  367. package/dist/frontend/lowering/promise-executor-adapter.js +5 -2
  368. package/dist/frontend/lowering/promise-executor-adapter.js.map +1 -1
  369. package/dist/frontend/lowering/record-links.js +7 -2
  370. package/dist/frontend/lowering/record-links.js.map +1 -1
  371. package/dist/frontend/lowering/surfaces.d.ts +4 -0
  372. package/dist/frontend/lowering/surfaces.js +118 -2
  373. package/dist/frontend/lowering/surfaces.js.map +1 -1
  374. package/dist/frontend/lowering/surfaces.test.d.ts +1 -0
  375. package/dist/frontend/lowering/surfaces.test.js +31 -0
  376. package/dist/frontend/lowering/surfaces.test.js.map +1 -0
  377. package/dist/frontend/mock-shapes.js +3 -3
  378. package/dist/frontend/mock-shapes.js.map +1 -1
  379. package/dist/frontend/npm-static-ladder.d.ts +21 -0
  380. package/dist/frontend/npm-static-ladder.js +2 -0
  381. package/dist/frontend/npm-static-ladder.js.map +1 -0
  382. package/dist/frontend/npm-static-ladder.test.d.ts +1 -0
  383. package/dist/frontend/npm-static-ladder.test.js +138 -0
  384. package/dist/frontend/npm-static-ladder.test.js.map +1 -0
  385. package/dist/frontend/npm-static-status.d.ts +15 -0
  386. package/dist/frontend/npm-static-status.js +2 -0
  387. package/dist/frontend/npm-static-status.js.map +1 -0
  388. package/dist/frontend/package-shims.js +1 -1
  389. package/dist/frontend/package-shims.js.map +1 -1
  390. package/dist/frontend/pipeline.d.ts +1 -1
  391. package/dist/frontend/pipeline.js +222 -25
  392. package/dist/frontend/pipeline.js.map +1 -1
  393. package/dist/frontend/program-analysis.d.ts +4 -0
  394. package/dist/frontend/program-analysis.js +6 -0
  395. package/dist/frontend/program-analysis.js.map +1 -1
  396. package/dist/frontend/program.js +258 -32
  397. package/dist/frontend/program.js.map +1 -1
  398. package/dist/frontend/program.test.js +30 -0
  399. package/dist/frontend/program.test.js.map +1 -1
  400. package/dist/frontend/resolve.js +29 -5
  401. package/dist/frontend/resolve.js.map +1 -1
  402. package/dist/frontend/resolve.test.js +40 -0
  403. package/dist/frontend/resolve.test.js.map +1 -1
  404. package/dist/frontend/services.d.ts +8 -0
  405. package/dist/frontend/services.js +7 -0
  406. package/dist/frontend/services.js.map +1 -1
  407. package/dist/frontend/ts7/checker.d.ts +7 -0
  408. package/dist/frontend/ts7/checker.js +12 -0
  409. package/dist/frontend/ts7/checker.js.map +1 -1
  410. package/dist/frontend/ts7/checker.test.js +1 -0
  411. package/dist/frontend/ts7/checker.test.js.map +1 -1
  412. package/dist/frontend/ts7/program-host.d.ts +39 -2
  413. package/dist/frontend/ts7/program-host.js +62 -8
  414. package/dist/frontend/ts7/program-host.js.map +1 -1
  415. package/dist/frontend/ts7/program-host.test.js +33 -0
  416. package/dist/frontend/ts7/program-host.test.js.map +1 -1
  417. package/dist/frontend/ts7/session-cache.d.ts +5 -1
  418. package/dist/frontend/ts7/session-cache.js +7 -1
  419. package/dist/frontend/ts7/session-cache.js.map +1 -1
  420. package/dist/frontend/ts7/session-cache.test.js +37 -0
  421. package/dist/frontend/ts7/session-cache.test.js.map +1 -1
  422. package/dist/frontend/ts7/session.js +19 -1
  423. package/dist/frontend/ts7/session.js.map +1 -1
  424. package/dist/frontend/ts7/source-parser.d.ts +17 -2
  425. package/dist/frontend/ts7/source-parser.js +61 -2
  426. package/dist/frontend/ts7/source-parser.js.map +1 -1
  427. package/dist/frontend/ts7/source-parser.test.js +55 -2
  428. package/dist/frontend/ts7/source-parser.test.js.map +1 -1
  429. package/dist/frontend/tsc-codes.d.ts +3 -2
  430. package/dist/frontend/tsc-codes.js +129 -22
  431. package/dist/frontend/tsc-codes.js.map +1 -1
  432. package/dist/frontend/type-mapper.d.ts +5 -11
  433. package/dist/frontend/type-mapper.js +380 -70
  434. package/dist/frontend/type-mapper.js.map +1 -1
  435. package/dist/index.d.ts +1 -1
  436. package/dist/index.js +67 -7
  437. package/dist/index.js.map +1 -1
  438. package/dist/ir/builtin-effects.js +29 -0
  439. package/dist/ir/builtin-effects.js.map +1 -1
  440. package/dist/ir/builtin-signatures.d.ts +1 -1
  441. package/dist/ir/builtin-signatures.js +72 -6
  442. package/dist/ir/builtin-signatures.js.map +1 -1
  443. package/dist/ir/codec.generated.d.ts +1 -1
  444. package/dist/ir/codec.generated.js +321 -263
  445. package/dist/ir/codec.generated.js.map +1 -1
  446. package/dist/ir/constant-length-clones.d.ts +26 -0
  447. package/dist/ir/constant-length-clones.js +589 -0
  448. package/dist/ir/constant-length-clones.js.map +1 -0
  449. package/dist/ir/constant-length-clones.test.d.ts +1 -0
  450. package/dist/ir/constant-length-clones.test.js +292 -0
  451. package/dist/ir/constant-length-clones.test.js.map +1 -0
  452. package/dist/ir/constant-tables.d.ts +10 -5
  453. package/dist/ir/constant-tables.js +83 -17
  454. package/dist/ir/constant-tables.js.map +1 -1
  455. package/dist/ir/constant-tables.test.js +58 -1
  456. package/dist/ir/constant-tables.test.js.map +1 -1
  457. package/dist/ir/fields.generated.js +5 -2
  458. package/dist/ir/fields.generated.js.map +1 -1
  459. package/dist/ir/function-references.js +2 -0
  460. package/dist/ir/function-references.js.map +1 -1
  461. package/dist/ir/function-references.test.js +13 -0
  462. package/dist/ir/function-references.test.js.map +1 -1
  463. package/dist/ir/integer-loops.js +1 -0
  464. package/dist/ir/integer-loops.js.map +1 -1
  465. package/dist/ir/integer-loops.test.js +16 -0
  466. package/dist/ir/integer-loops.test.js.map +1 -1
  467. package/dist/ir/ir.d.ts +50 -6
  468. package/dist/ir/ir.js +44 -2
  469. package/dist/ir/ir.js.map +1 -1
  470. package/dist/ir/ir.test.js +83 -1
  471. package/dist/ir/ir.test.js.map +1 -1
  472. package/dist/ir/js-groups.js +5 -1
  473. package/dist/ir/js-groups.js.map +1 -1
  474. package/dist/ir/js-ic.d.ts +20 -0
  475. package/dist/ir/js-ic.js +81 -4
  476. package/dist/ir/js-ic.js.map +1 -1
  477. package/dist/ir/js-ic.test.js +8 -1
  478. package/dist/ir/js-ic.test.js.map +1 -1
  479. package/dist/ir/lane-plans.d.ts +86 -0
  480. package/dist/ir/lane-plans.js +589 -0
  481. package/dist/ir/lane-plans.js.map +1 -0
  482. package/dist/ir/lane-plans.test.d.ts +1 -0
  483. package/dist/ir/lane-plans.test.js +549 -0
  484. package/dist/ir/lane-plans.test.js.map +1 -0
  485. package/dist/ir/runtime-features.d.ts +68 -10
  486. package/dist/ir/runtime-features.js +285 -17
  487. package/dist/ir/runtime-features.js.map +1 -1
  488. package/dist/ir/runtime-features.test.js +190 -1
  489. package/dist/ir/runtime-features.test.js.map +1 -1
  490. package/dist/ir/validate.js +61 -24
  491. package/dist/ir/validate.js.map +1 -1
  492. package/dist/native/cache.d.ts +5 -0
  493. package/dist/native/cache.js +23 -1
  494. package/dist/native/cache.js.map +1 -1
  495. package/dist/native/cache.test.js +29 -1
  496. package/dist/native/cache.test.js.map +1 -1
  497. package/dist/native/cli.js +4 -2
  498. package/dist/native/cli.js.map +1 -1
  499. package/dist/native/compiler.d.ts +11 -3
  500. package/dist/native/compiler.js +102 -16
  501. package/dist/native/compiler.js.map +1 -1
  502. package/dist/native/compiler.test.js +244 -2
  503. package/dist/native/compiler.test.js.map +1 -1
  504. package/dist/native/prepare.d.ts +14 -1
  505. package/dist/native/prepare.js +79 -29
  506. package/dist/native/prepare.js.map +1 -1
  507. package/dist/native/sanitizer.test.js +3 -0
  508. package/dist/native/sanitizer.test.js.map +1 -1
  509. package/dist/native/unchanged.d.ts +80 -0
  510. package/dist/native/unchanged.js +301 -0
  511. package/dist/native/unchanged.js.map +1 -0
  512. package/dist/native/unchanged.test.d.ts +1 -0
  513. package/dist/native/unchanged.test.js +249 -0
  514. package/dist/native/unchanged.test.js.map +1 -0
  515. package/dist/node-islands/boundary.d.ts +16 -0
  516. package/dist/node-islands/boundary.js +70 -7
  517. package/dist/node-islands/boundary.js.map +1 -1
  518. package/dist/node-islands/boundary.test.js +59 -14
  519. package/dist/node-islands/boundary.test.js.map +1 -1
  520. package/dist/node-islands/detect.js +203 -47
  521. package/dist/node-islands/detect.js.map +1 -1
  522. package/dist/node-islands/detect.test.js +45 -0
  523. package/dist/node-islands/detect.test.js.map +1 -1
  524. package/dist/node-islands/growth.js +4 -16
  525. package/dist/node-islands/growth.js.map +1 -1
  526. package/dist/node-islands/modules.d.ts +3 -0
  527. package/dist/node-islands/modules.js +143 -12
  528. package/dist/node-islands/modules.js.map +1 -1
  529. package/dist/node-islands/modules.test.js +125 -0
  530. package/dist/node-islands/modules.test.js.map +1 -1
  531. package/dist/node-islands/report.d.ts +1 -1
  532. package/dist/node-islands/report.js +2 -1
  533. package/dist/node-islands/report.js.map +1 -1
  534. package/package.json +20 -20
  535. package/shims/undici/core/request.ts +7 -1
  536. package/surface-manifest.json +380 -2
@@ -56,6 +56,10 @@ import { type Node } from "./region-ir.js";
56
56
  import { LlDyn, type DynHost, type JsEntryClosure } from "./dyn.js";
57
57
  import { LlWalkers } from "./walkers.js";
58
58
  import { NullableUnions } from "./nullable-unions.js";
59
+ /** The ABSENT marker of an optional checked-dynamic record field: an
60
+ * immortal ScrDyn of kind SCR_DYN_UNDEF that is address-distinct from
61
+ * scr_dyn_undefined(). Emitted only when a program references it. */
62
+ export declare const DYN_ABSENT = "@sc_dyn_absent";
59
63
  import { type InlineRcMode, type MapKeyAccess } from "./shapes.js";
60
64
  import type { ExprOf, LibCallExpr, LlStreamTypedRefAdapter, LlValue } from "./expr-context.js";
61
65
  import { type SpeculationContext, type SpeculativeValue } from "./speculative-integers.js";
@@ -161,6 +165,11 @@ export interface LlvmTargetOptions {
161
165
  * teardown after `process.exit` to a helper process (`--detached-exit`).
162
166
  * Executables only; the runtime's weak default keeps it off. */
163
167
  detachedExit?: boolean;
168
+ /** Define `scr_stdout_buffering` so the runtime keeps JavaScript-visible
169
+ * stdout in its 64 KiB buffer when fd 1 is not a terminal
170
+ * (`--stdout-buffering`). Executables only; the runtime's weak default
171
+ * keeps the per-call policy. */
172
+ stdoutBuffering?: boolean;
164
173
  /** The files of the program's Node island module tree, in manifest order
165
174
  * (node-islands/modules.ts), when the executable carries the tree. */
166
175
  nodeIslandModuleData?: Uint8Array;
@@ -182,16 +191,28 @@ export interface LlvmTargetOptions {
182
191
  * runs on any x86-64 CPU. */
183
192
  targetCpu?: TargetCpu;
184
193
  /** Give an x86-64 executable without a `targetCpu` an x86-64-v3 copy of
185
- * each program function, which it runs on CPUs at that level
186
- * (cpu-dispatch.ts). Ignored for other targets, libraries and builds
187
- * with debug information. */
194
+ * the program functions whose loop x86-64-v3 widens (cpu-dispatch.ts),
195
+ * which it runs on CPUs at that level. Ignored for other targets,
196
+ * libraries, builds with debug information and profile-recording builds. */
188
197
  cpuDispatch?: boolean;
198
+ /** The build records a profile: a dispatching build emits one body per
199
+ * function and keeps the functions a copy takes out of line, so the
200
+ * profile names the functions a `--profile-use` build copies. */
201
+ profileGenerate?: boolean;
202
+ /** The functions the build's profile names, when it uses one: the copies
203
+ * are limited to the functions among them that have a loop. */
204
+ cpuCopyFunctions?: ReadonlySet<string>;
205
+ /** The most program text the copies may take (cpu-dispatch.ts
206
+ * cpuCopyBudget by default): lowers the set for a build or a test that
207
+ * wants fewer copies. */
208
+ cpuCopyCapBytes?: number;
189
209
  }
190
210
  /** LlvmTargetOptions.lowRegion for an executable: Linux targets without
191
211
  * sanitizers, whose address space below 32 GiB is free (ASan keeps its
192
- * shadow memory there; other systems map their own images and libraries
193
- * there). `platform` is a target platform (`linux`, `darwin`, `win32`,
194
- * `wasi`). */
212
+ * shadow memory there), and macOS targets without sanitizers, which keep the
213
+ * window at a fixed base instead (classes.ts compactRefBaseOf). Other systems
214
+ * map their own images and libraries below 32 GiB. `platform` is a target
215
+ * platform (`linux`, `darwin`, `win32`, `wasi`). */
195
216
  export declare function lowRegionTarget(platform: string, sanitize: boolean): boolean;
196
217
  /** The int32 slot analysis of one module and the inputs it read: the
197
218
  * constructor's own analyses of that module, which LlEmitter takes over
@@ -331,6 +352,10 @@ export declare class LlEmitter {
331
352
  * 32-bit references (LlClassMeta.compressed):
332
353
  * loadField/loadRef decode them and storeField/storeRef encode them. */
333
354
  readonly compressedFieldPtrs: Set<string>;
355
+ /** The window base that 32-bit references are offsets from (classes.ts
356
+ * compactRefBaseOf): 0 unless the low region applies on a target that
357
+ * places the window at a base. */
358
+ readonly compactRefBase: bigint;
334
359
  /** Compact class instances live in the program-lifetime region below
335
360
  * 32 GiB (LlvmTargetOptions.lowRegion, and the program has compact
336
361
  * classes): main reserves it before compiled code runs (scr_plr_init), and
@@ -408,7 +433,9 @@ export declare class LlEmitter {
408
433
  arrayAccess(arr: IrExpr, elem: IrType): ArrayAccess;
409
434
  /** Whether an element access at `index` of `arr` lies in the hole-free
410
435
  * prefix: a counter of a dense array loop's fast copy indexing one of the
411
- * arrays its entry test covered. */
436
+ * arrays its entry test covered, or an index proven in range of a parameter
437
+ * whose every call passes an array of that many present elements
438
+ * (IrParam.constLength). */
412
439
  provenDenseIndex(arr: IrExpr, index: IrExpr): boolean;
413
440
  fieldAliasAttachment(ptr: string): string;
414
441
  fieldAliasMetadata(): string[];
@@ -455,12 +482,22 @@ export declare class LlEmitter {
455
482
  readonly emitLibraryIdentity: boolean;
456
483
  readonly runtimeAbiMarker: boolean;
457
484
  readonly detachedExit: boolean;
485
+ readonly stdoutBuffering: boolean;
458
486
  readonly nodeIslandModuleData: Uint8Array | null;
459
487
  readonly targetCpu: TargetCpu | undefined;
488
+ /** LlvmTargetOptions.targetTriple, or "" for the host's ABI. */
489
+ readonly targetTriple: string;
460
490
  /** Emitted functions carry `sanitize_address` (LlvmTargetOptions). */
461
491
  readonly sanitizeAttributes: boolean;
462
492
  /** LlvmTargetOptions.cpuDispatch, where it applies. */
463
493
  readonly cpuDispatch: boolean;
494
+ /** LlvmTargetOptions.cpuCopyFunctions. */
495
+ private readonly cpuCopyFunctions;
496
+ /** LlvmTargetOptions.cpuCopyCapBytes. */
497
+ private readonly cpuCopyCapBytes;
498
+ /** Whether emission keeps the functions a dispatching build would copy out
499
+ * of line, so a recorded profile names them. */
500
+ private readonly keepCopyBodiesOutOfLine;
464
501
  /** How the program's functions are copied (cpu-dispatch.ts): for runtime
465
502
  * dispatch, for an x86-64-v3 `targetCpu` ("target"), or not at all. */
466
503
  readonly cpuCopies: CpuCopies | null;
@@ -494,6 +531,8 @@ export declare class LlEmitter {
494
531
  readonly retypeGuards: Map<string, string>;
495
532
  /** The nullable-union ABSENT sentinel was referenced (absentInstanceRef). */
496
533
  needsNullableAbsent: boolean;
534
+ /** The optional-dyn ABSENT marker was referenced (dynAbsentRef). */
535
+ needsDynAbsent: boolean;
497
536
  private readonly immortalValues;
498
537
  /** Regex literal templates: "<flags>/<pattern>" → { symbol, interned
499
538
  * source/flags literal refs } — one immortal ScrRegex template per distinct
@@ -531,6 +570,17 @@ export declare class LlEmitter {
531
570
  }>;
532
571
  /** Interned ScrMapOps descriptors (scr_map.h): initializer → symbol. */
533
572
  readonly mapOpsConsts: Map<string, string>;
573
+ /** Element data of the numeric array literals that become static tables
574
+ * (arrayLit, expr-primitives.ts): "<i32|double>:<literal location>" → the
575
+ * private constant's symbol, element type and the elements as their
576
+ * rendered literals. The array works from that data in place, so each
577
+ * entry also places the header in static storage (`<sym>_h`), initialized
578
+ * with the same table. */
579
+ readonly arrayConstData: Map<string, {
580
+ sym: string;
581
+ type: "i32" | "double";
582
+ values: readonly string[];
583
+ }>;
534
584
  /** Method-id slots of checked-dynamic method calls
535
585
  * (scr_dyn_invoke_prepared_id): method name → symbol of an i32 the
536
586
  * runtime fills with the name's id on the first call. */
@@ -661,6 +711,9 @@ export declare class LlEmitter {
661
711
  readonly nodeIndex: IrNodeIndex;
662
712
  private readonly tdzGlobals;
663
713
  readonly constantNumericTables: ReadonlyMap<string, ConstantNumericTable>;
714
+ /** Module-level numeric tables the emitter places in the program image,
715
+ * by their initializing array literal (ir/constant-tables.ts). */
716
+ readonly staticArrayTables: ReadonlySet<IrExpr>;
664
717
  /** Constant-key reads on checked-dynamic objects, each with its own
665
718
  * zero-initialized ScrDynReadIc (scr_runtime.h). */
666
719
  dynReadIcSites: number;
@@ -753,6 +806,8 @@ export declare class LlEmitter {
753
806
  /** Whether timer and tick scheduling goes through the *_als entry
754
807
  * points (RuntimeFeatures asyncContext). */
755
808
  get schedulesInContext(): boolean;
809
+ /** The JavaScript object model build is on (jsObjectModelFact). */
810
+ get jsObjectModel(): boolean;
756
811
  /** Emitted ref-kind resolve thunks for new Promise, interned per inner
757
812
  * typeKey → thunk symbol. */
758
813
  readonly resolveThunks: Map<string, string>;
@@ -1022,6 +1077,9 @@ export declare class LlEmitter {
1022
1077
  * not a constructor (where they change), not async or a generator. */
1023
1078
  finalFieldBorrows: boolean;
1024
1079
  integerRanges: IntegerRanges;
1080
+ /** The current function's parameters whose every call passes an array of a
1081
+ * known number of present elements (IrParam.constLength). */
1082
+ constLengthParams: Map<string, number>;
1025
1083
  /** The current function's bounded for-loop cursors (integer-ranges.ts). */
1026
1084
  integerLoopRanges: ReadonlyMap<IrStmt, ReadonlyMap<string, IntegerRange>>;
1027
1085
  /** Number arrays of the current function whose every present element is
@@ -1181,6 +1239,9 @@ export declare class LlEmitter {
1181
1239
  globals: string[];
1182
1240
  defs: string[];
1183
1241
  };
1242
+ /** What a dispatching build copies: the profile's functions, when it uses
1243
+ * one, within the text budget. */
1244
+ private copySelection;
1184
1245
  emit(): string;
1185
1246
  emitParts(): string[];
1186
1247
  /** The entry point and JavaScript name of each named function the
@@ -1348,6 +1409,20 @@ export declare class LlEmitter {
1348
1409
  * throws as usual). BigInt here is the same StringToBigInt as the
1349
1410
  * program's, so every accepted spelling folds to the value Node gives. */
1350
1411
  internBigIntLiteral(text: string): string | null;
1412
+ /** The element data of the static array table at `at`
1413
+ * (ir/constant-tables.ts), which the array itself holds: the emitter also
1414
+ * places the header, `<sym>_h`, in static storage. Each table gets its own
1415
+ * pair, so two tables with equal elements stay distinct arrays —
1416
+ * `@`-refs, first-use order.
1417
+ *
1418
+ * The elements are rendered to their literals here, not in the module
1419
+ * writer: a chunk's result crosses a JSON boundary (emit-module.ts), and
1420
+ * JSON turns NaN and the infinities into null and negative zero into zero.
1421
+ * `f64Lit` is the exact bit pattern, so every element survives it. */
1422
+ staticArrayData(at: IrExpr, values: readonly number[], type: "i32" | "double"): {
1423
+ data: string;
1424
+ header: string;
1425
+ };
1351
1426
  /** Interned NUL-terminated C-string constant (the scr_jb_puts /
1352
1427
  * stringify-indent currency) — `@`-ref, first-use order. */
1353
1428
  cstr(text: string): string;
@@ -1367,6 +1442,11 @@ export declare class LlEmitter {
1367
1442
  /** The immortal ABSENT state of an undefined-armed record field slot
1368
1443
  * (IR fieldAbsent). */
1369
1444
  absentInstanceRef(unionId: string): string;
1445
+ /** The ABSENT marker of an optional checked-dynamic record field slot
1446
+ * (IR fieldAbsent without a union). Address-compared, never dereferenced
1447
+ * by compiled code: reads select it to scr_dyn_undefined, presence tests
1448
+ * compare against it, and boxing omits it. */
1449
+ dynAbsentRef(): string;
1370
1450
  /** i1: a union value loaded from a field slot is the ABSENT state — the
1371
1451
  * undefined arm's tag with the absent payload marker. */
1372
1452
  fieldAbsentTest(value: string, unionId: string): string;
@@ -16,7 +16,7 @@ import { createHash } from "node:crypto";
16
16
  import { endsWithJump, matchFieldSelfConcat, readsArraySlot, streamTypedRefEligible, undefinedArmTag, } from "../../ir/analysis.js";
17
17
  import { containsLoop, loopTestsEveryIteration } from "../loop-polls.js";
18
18
  import { isDynTypedRefType, isRefCounted, isUnitType, POINTER_KINDS, RUNTIME_EMITTER_CLASS, RUNTIME_EVENT_CLASS, RUNTIME_EVENT_TARGET_CLASS, RUNTIME_ERROR_CLASSES, RUNTIME_STREAM_CLASSES, typeEquals, typeKey, VOID, classJsName, classValueAbiEquals, } from "../../ir/ir.js";
19
- import { moduleRuntimeFeatures } from "../../ir/runtime-features.js";
19
+ import { jsObjectModelFact, moduleRuntimeFeatures, } from "../../ir/runtime-features.js";
20
20
  import { captureFreeFunctions, observesStacks } from "../stack-observations.js";
21
21
  import { findInitializedByteLoopBindings } from "./byte-windows.js";
22
22
  import { matchBytesLoopVersion } from "./bytes-loop-versions.js";
@@ -28,6 +28,7 @@ import { specializeCallbackCalls } from "../../ir/callback-specialization.js";
28
28
  import { EmitJournal, registerReplay, renameChunk, replayJournal, } from "./emit-journal.js";
29
29
  import { specializeNumericCalls } from "../../ir/numeric-call-specialization.js";
30
30
  import { specializeTypedArguments } from "../../ir/typed-argument-clones.js";
31
+ import { specializeConstantArrayLengths } from "../../ir/constant-length-clones.js";
31
32
  import { versionLoopBoundParameters } from "../../ir/parameter-versions.js";
32
33
  import { inlineExpressionFunctions } from "../../ir/expression-inlining.js";
33
34
  import { inlineArrayReads, NO_INLINE_ARRAYS, planInlineArrays, } from "../../ir/inline-arrays.js";
@@ -59,11 +60,11 @@ import { writeRepresentationReport } from "./repr-report.js";
59
60
  import { heapCensusOf } from "./heap-census.js";
60
61
  import { exactInteger, narrowInteger, widenInteger } from "./integer-values.js";
61
62
  import { findInitializerBindings } from "../../ir/initializer-bindings.js";
62
- import { findConstantNumericTables } from "../../ir/constant-tables.js";
63
+ import { findConstantNumericTables, findStaticArrayTables, } from "../../ir/constant-tables.js";
63
64
  import { allocateFfiCallbackAdapters, hasForeignFfiCallback, hasRetainedFfiCallback, } from "../ffi-callbacks.js";
64
65
  import { computeMayThrow } from "../may-throw.js";
65
66
  import { UNWIND_PERSONALITY, UNWIND_RAISE, UNWIND_RAISE_DECLARATION, UNWIND_RESUME_DECLARATION, UNWIND_RESUME, UNWIND_SLOT, UnwindAbiViolation, bridgePlainUnwindCalls, unwindAbiFunctions, } from "./unwind-abi.js";
66
- import { cloneForCpuDispatch } from "./cpu-dispatch.js";
67
+ import { cloneForCpuDispatch, keepCopiedBodiesOutOfLine, } from "./cpu-dispatch.js";
67
68
  import { mangleAsyncInlineAwaitCall, mangleAsyncSpawn, mangleBorrowedFunction, mangleClassObj, mangleFnClosure, mangleFunction, mangleGenSpawn, mangleGlobal, mangleLocal, mangleRecordStruct, mangleWrapper, mangleBorrowingWrapper, } from "../mangle.js";
68
69
  import { analyzeCallLifetimes } from "./call-lifetimes.js";
69
70
  import { stackObjectStruct, } from "./stack-objects.js";
@@ -116,7 +117,7 @@ import { emitChildProcessLibCall, emitAsyncContextLibCall, emitProcessLibCall, e
116
117
  import { emitStreamLibCall } from "./lib-stream.js";
117
118
  import { emitNetworkHttpLibCall } from "./lib-network.js";
118
119
  import { emitAssertInspectLibCall, emitIoLibCall, emitGenericLibCall, emitLibCall, } from "./lib-dispatch.js";
119
- import { assignCompactLayouts, buildClassGraph, classFieldTypes, classMembershipIntervals, classFieldIndex, compactRefLoadLines, compactRefStoreLines, classPreLines, classStructSym, programLifetimeClass, } from "./classes.js";
120
+ import { assignCompactLayouts, buildClassGraph, classFieldTypes, classMembershipIntervals, classFieldIndex, compactRefBaseOf, compactRefLoadLines, compactRefStoreLines, classPreLines, classStructSym, programLifetimeClass, } from "./classes.js";
120
121
  import { LifetimeRegions, REGION_TYPES } from "./regions.js";
121
122
  import { planTreeClasses } from "../tree-classes.js";
122
123
  import { arenaAware, arenaCurrentAddress, arenaNewSym, arenasRequested, planArenas, } from "./arenas.js";
@@ -128,6 +129,10 @@ import { LlvmUnsupportedError } from "./unsupported.js";
128
129
  import { LlWalkers } from "./walkers.js";
129
130
  import { isObjectArm, isPayloadTag, NULLABLE_ABSENT, NULLABLE_NULL, NullableUnions, pointerTagFn, } from "./nullable-unions.js";
130
131
  import { classUnionHeaders, emitClassUnionHelpers } from "./class-unions.js";
132
+ /** The ABSENT marker of an optional checked-dynamic record field: an
133
+ * immortal ScrDyn of kind SCR_DYN_UNDEF that is address-distinct from
134
+ * scr_dyn_undefined(). Emitted only when a program references it. */
135
+ export const DYN_ABSENT = "@sc_dyn_absent";
131
136
  import { emitNullablePresent, emitUnionPeek, emitUnionTag } from "./union-repr.js";
132
137
  import { emitConcatInputs, emitMixedConcat, numberPart, stringParts, } from "./string-construction.js";
133
138
  import { arrNewCall, boxAccess, elemAccess, boxNewCall, boxReleaseSym, computeTraced, emitInlineRcHelpers, emitNullableRetainWrappers, emitShapeUnionHelpers, FN_ATTRS, inlineRcDecls, llFieldType, mapFlagsOffset, releaseSym, retainSym, traceArg, vAdapters, traceAdapter, } from "./shapes.js";
@@ -167,11 +172,12 @@ export function ffiCallbackDummyLl(callback) {
167
172
  }
168
173
  /** LlvmTargetOptions.lowRegion for an executable: Linux targets without
169
174
  * sanitizers, whose address space below 32 GiB is free (ASan keeps its
170
- * shadow memory there; other systems map their own images and libraries
171
- * there). `platform` is a target platform (`linux`, `darwin`, `win32`,
172
- * `wasi`). */
175
+ * shadow memory there), and macOS targets without sanitizers, which keep the
176
+ * window at a fixed base instead (classes.ts compactRefBaseOf). Other systems
177
+ * map their own images and libraries below 32 GiB. `platform` is a target
178
+ * platform (`linux`, `darwin`, `win32`, `wasi`). */
173
179
  export function lowRegionTarget(platform, sanitize) {
174
- return platform === "linux" && !sanitize;
180
+ return (platform === "linux" || platform === "darwin") && !sanitize;
175
181
  }
176
182
  /** Function versions on loop-bounding number parameters
177
183
  * (ir/parameter-versions.ts). Library builds have no int32 entries, and a
@@ -296,7 +302,7 @@ function moduleEmitter(input, options) {
296
302
  // an earlier pass rewrote, which the index does not record.
297
303
  const nodes = new IrNodeIndex(mod);
298
304
  rounds.nodes = nodes;
299
- const passed = versionUnionArmLoops(versionParameters(addRecordResultEntries(scalarizeLiteralResults(scalarizeNumericRecords(specializeCallbackCalls(specializeNumericCalls(specializeTypedArguments(pairRowSums(jamRuntimeCountLoops(jamSaturatingLoops(inlineArraysPass(options, inlineExpressionFunctions(foldConstantGlobals(copyStableCaptures(resolveSelfCaptures(hoistFinalFieldReads(freezeInitOnlyGlobals(holdCharLocalsAsUnits(dropUnwrittenPropertyBags(runPairedWhileLoopsAsFor(mod, nodes), nodes), nodes), nodes), nodes), nodes), nodes), nodes), nodes)), nodes), nodes), nodes), mangleFunction, nodes), mangleFunction, nodes), mangleFunction, nodes)), nodes), nodes), nodes), nodes);
305
+ const passed = versionUnionArmLoops(versionParameters(addRecordResultEntries(scalarizeLiteralResults(scalarizeNumericRecords(specializeCallbackCalls(specializeNumericCalls(specializeConstantArrayLengths(specializeTypedArguments(pairRowSums(jamRuntimeCountLoops(jamSaturatingLoops(inlineArraysPass(options, inlineExpressionFunctions(foldConstantGlobals(copyStableCaptures(resolveSelfCaptures(hoistFinalFieldReads(freezeInitOnlyGlobals(holdCharLocalsAsUnits(dropUnwrittenPropertyBags(runPairedWhileLoopsAsFor(mod, nodes), nodes), nodes), nodes), nodes), nodes), nodes), nodes), nodes)), nodes), nodes), nodes), mangleFunction, nodes), mangleFunction, nodes), mangleFunction, nodes), mangleFunction, nodes)), nodes), nodes), nodes), nodes);
300
306
  timing("llvm-emit-rewrites");
301
307
  let emitted = selectInt32Arrays(passed, proven, resultEntryTargets);
302
308
  let prepared = rounds.last;
@@ -570,6 +576,10 @@ export class LlEmitter {
570
576
  * 32-bit references (LlClassMeta.compressed):
571
577
  * loadField/loadRef decode them and storeField/storeRef encode them. */
572
578
  compressedFieldPtrs = new Set();
579
+ /** The window base that 32-bit references are offsets from (classes.ts
580
+ * compactRefBaseOf): 0 unless the low region applies on a target that
581
+ * places the window at a base. */
582
+ compactRefBase;
573
583
  /** Compact class instances live in the program-lifetime region below
574
584
  * 32 GiB (LlvmTargetOptions.lowRegion, and the program has compact
575
585
  * classes): main reserves it before compiled code runs (scr_plr_init), and
@@ -819,8 +829,23 @@ export class LlEmitter {
819
829
  }
820
830
  /** Whether an element access at `index` of `arr` lies in the hole-free
821
831
  * prefix: a counter of a dense array loop's fast copy indexing one of the
822
- * arrays its entry test covered. */
832
+ * arrays its entry test covered, or an index proven in range of a parameter
833
+ * whose every call passes an array of that many present elements
834
+ * (IrParam.constLength). */
823
835
  provenDenseIndex(arr, index) {
836
+ if (arr.kind === "varRef") {
837
+ const length = this.constLengthParams.get(arr.localId);
838
+ if (length !== undefined) {
839
+ if (index.kind === "numLit" &&
840
+ Number.isInteger(index.value) &&
841
+ index.value >= 0 &&
842
+ index.value < length)
843
+ return true;
844
+ const range = this.integerRanges.get(index);
845
+ if (range !== null && range !== undefined && range.min >= 0 && range.max < length)
846
+ return true;
847
+ }
848
+ }
824
849
  const loop = LOOPS.of(this).denseLoop;
825
850
  return (loop !== null &&
826
851
  arr.kind === "varRef" &&
@@ -879,12 +904,22 @@ export class LlEmitter {
879
904
  emitLibraryIdentity;
880
905
  runtimeAbiMarker;
881
906
  detachedExit;
907
+ stdoutBuffering;
882
908
  nodeIslandModuleData;
883
909
  targetCpu;
910
+ /** LlvmTargetOptions.targetTriple, or "" for the host's ABI. */
911
+ targetTriple;
884
912
  /** Emitted functions carry `sanitize_address` (LlvmTargetOptions). */
885
913
  sanitizeAttributes;
886
914
  /** LlvmTargetOptions.cpuDispatch, where it applies. */
887
915
  cpuDispatch;
916
+ /** LlvmTargetOptions.cpuCopyFunctions. */
917
+ cpuCopyFunctions;
918
+ /** LlvmTargetOptions.cpuCopyCapBytes. */
919
+ cpuCopyCapBytes;
920
+ /** Whether emission keeps the functions a dispatching build would copy out
921
+ * of line, so a recorded profile names them. */
922
+ keepCopyBodiesOutOfLine;
888
923
  /** How the program's functions are copied (cpu-dispatch.ts): for runtime
889
924
  * dispatch, for an x86-64-v3 `targetCpu` ("target"), or not at all. */
890
925
  cpuCopies;
@@ -912,6 +947,8 @@ export class LlEmitter {
912
947
  retypeGuards = new Map();
913
948
  /** The nullable-union ABSENT sentinel was referenced (absentInstanceRef). */
914
949
  needsNullableAbsent = false;
950
+ /** The optional-dyn ABSENT marker was referenced (dynAbsentRef). */
951
+ needsDynAbsent = false;
915
952
  immortalValues = new Set();
916
953
  /** Regex literal templates: "<flags>/<pattern>" → { symbol, interned
917
954
  * source/flags literal refs } — one immortal ScrRegex template per distinct
@@ -932,6 +969,13 @@ export class LlEmitter {
932
969
  cstrs = new Map();
933
970
  /** Interned ScrMapOps descriptors (scr_map.h): initializer → symbol. */
934
971
  mapOpsConsts = new Map();
972
+ /** Element data of the numeric array literals that become static tables
973
+ * (arrayLit, expr-primitives.ts): "<i32|double>:<literal location>" → the
974
+ * private constant's symbol, element type and the elements as their
975
+ * rendered literals. The array works from that data in place, so each
976
+ * entry also places the header in static storage (`<sym>_h`), initialized
977
+ * with the same table. */
978
+ arrayConstData = new Map();
935
979
  /** Method-id slots of checked-dynamic method calls
936
980
  * (scr_dyn_invoke_prepared_id): method name → symbol of an i32 the
937
981
  * runtime fills with the name's id on the first call. */
@@ -1057,6 +1101,9 @@ export class LlEmitter {
1057
1101
  nodeIndex;
1058
1102
  tdzGlobals = new Map();
1059
1103
  constantNumericTables;
1104
+ /** Module-level numeric tables the emitter places in the program image,
1105
+ * by their initializing array literal (ir/constant-tables.ts). */
1106
+ staticArrayTables;
1060
1107
  /** Constant-key reads on checked-dynamic objects, each with its own
1061
1108
  * zero-initialized ScrDynReadIc (scr_runtime.h). */
1062
1109
  dynReadIcSites = 0;
@@ -1148,6 +1195,10 @@ export class LlEmitter {
1148
1195
  get schedulesInContext() {
1149
1196
  return this.runtimeFeatures.asyncContext;
1150
1197
  }
1198
+ /** The JavaScript object model build is on (jsObjectModelFact). */
1199
+ get jsObjectModel() {
1200
+ return jsObjectModelFact(this.runtimeFeatures);
1201
+ }
1151
1202
  /** Emitted ref-kind resolve thunks for new Promise, interned per inner
1152
1203
  * typeKey → thunk symbol. */
1153
1204
  resolveThunks = new Map();
@@ -1374,6 +1425,9 @@ export class LlEmitter {
1374
1425
  * not a constructor (where they change), not async or a generator. */
1375
1426
  finalFieldBorrows = false;
1376
1427
  integerRanges = new Map();
1428
+ /** The current function's parameters whose every call passes an array of a
1429
+ * known number of present elements (IrParam.constLength). */
1430
+ constLengthParams = new Map();
1377
1431
  /** The current function's bounded for-loop cursors (integer-ranges.ts). */
1378
1432
  integerLoopRanges = new Map();
1379
1433
  /** Number arrays of the current function whose every present element is
@@ -1513,6 +1567,7 @@ export class LlEmitter {
1513
1567
  ? null
1514
1568
  : new LlvmDebugInfo(mod.sourceFile, options.debugSources, options.pointerBits, mod.unions, this.nullableUnions.armTypes());
1515
1569
  this.constantNumericTables = findConstantNumericTables(mod);
1570
+ this.staticArrayTables = findStaticArrayTables(mod);
1516
1571
  this.untypedIntegrity = mod.untypedIntegrity === true;
1517
1572
  this.sloppyDynWrites = new Set(mod.sloppyDynWrites ?? []);
1518
1573
  this.liveViewsReadOnly =
@@ -1539,6 +1594,7 @@ export class LlEmitter {
1539
1594
  (options.targetTriple
1540
1595
  ? /^(x86_64|amd64)\b/i.test(options.targetTriple)
1541
1596
  : process.arch === "x64");
1597
+ this.compactRefBase = options.lowRegion === true ? compactRefBaseOf(options.targetTriple) : 0n;
1542
1598
  this.executableTls =
1543
1599
  mod.workers === true &&
1544
1600
  mod.lib === undefined &&
@@ -1556,14 +1612,24 @@ export class LlEmitter {
1556
1612
  this.emitLibraryIdentity = options.emitLibraryIdentity !== false;
1557
1613
  this.runtimeAbiMarker = options.runtimeAbiMarker === true;
1558
1614
  this.detachedExit = options.detachedExit === true;
1615
+ this.stdoutBuffering = options.stdoutBuffering === true;
1559
1616
  this.nodeIslandModuleData = options.nodeIslandModuleData ?? null;
1560
1617
  this.targetCpu = options.targetCpu;
1618
+ this.targetTriple = options.targetTriple ?? "";
1561
1619
  this.sanitizeAttributes = options.sanitizeAttributes !== false;
1562
1620
  const copyable = !this.wasi &&
1563
1621
  mod.lib === undefined &&
1564
1622
  this.debug === null &&
1565
1623
  /^(x86_64|amd64|x64)\b/.test(options.targetTriple || process.arch);
1566
- this.cpuDispatch = options.cpuDispatch === true && options.targetCpu === undefined && copyable;
1624
+ this.cpuDispatch =
1625
+ options.cpuDispatch === true &&
1626
+ options.targetCpu === undefined &&
1627
+ copyable &&
1628
+ options.profileGenerate !== true;
1629
+ this.cpuCopyFunctions = options.cpuCopyFunctions;
1630
+ this.cpuCopyCapBytes = options.cpuCopyCapBytes;
1631
+ this.keepCopyBodiesOutOfLine =
1632
+ options.cpuDispatch === true && options.profileGenerate === true && copyable;
1567
1633
  this.cpuCopies = this.cpuDispatch
1568
1634
  ? "dispatch"
1569
1635
  : options.targetCpu === "x86-64-v3" && copyable
@@ -1798,8 +1864,9 @@ export class LlEmitter {
1798
1864
  // Worker programs keep one allocator per script thread: the inline
1799
1865
  // paths address its thread-local state.
1800
1866
  threadLocalAlloc: mod.workers === true,
1801
- // Linux executables find a block's owner in the chunk map.
1802
- windowMap: options.lowRegion === true,
1867
+ // Linux executables find a block's owner in the chunk map, which
1868
+ // indexes the low 32 GiB by address; a window with a base has none.
1869
+ windowMap: options.lowRegion === true && compactRefBaseOf(options.targetTriple) === 0n,
1803
1870
  rcHelpers: this.rcHelpers,
1804
1871
  ...(this.rcMode !== undefined ? { rcMode: this.rcMode } : {}),
1805
1872
  ...(this.rcHelpersNoinline ? { rcHelpersNoinline: true } : {}),
@@ -1817,8 +1884,10 @@ export class LlEmitter {
1817
1884
  retypeGuardRef: (unionId) => this.retypeGuardRef(unionId),
1818
1885
  fieldAbsentTestIn: (B, value, unionId) => this.fieldAbsentTestIn(B, value, unionId),
1819
1886
  absentInstanceRef: (unionId) => this.absentInstanceRef(unionId),
1887
+ dynAbsentRef: () => this.dynAbsentRef(),
1820
1888
  liveDynRefAdapter: (type) => this.liveDynRefAdapter(type),
1821
1889
  usesDynBuiltinStream: () => this.usesDynBuiltinStream,
1890
+ jsObjectModel: () => jsObjectModelFact(this.runtimeFeatures),
1822
1891
  liveDynUnionRefAdapter: (type) => this.liveDynUnionRefAdapter(type),
1823
1892
  declBoundary: () => this.mod.declBoundary === true,
1824
1893
  dynPromiseAdapter: (type) => this.dynPromiseAdapter(type),
@@ -2156,13 +2225,26 @@ export class LlEmitter {
2156
2225
  emitFfiCallbackDefs() {
2157
2226
  return emitFfiCallbackDefs(this);
2158
2227
  }
2228
+ /** What a dispatching build copies: the profile's functions, when it uses
2229
+ * one, within the text budget. */
2230
+ copySelection() {
2231
+ const selection = {};
2232
+ if (this.cpuCopyFunctions !== undefined)
2233
+ selection.hot = this.cpuCopyFunctions;
2234
+ if (this.cpuCopyCapBytes !== undefined)
2235
+ selection.capBytes = this.cpuCopyCapBytes;
2236
+ return selection;
2237
+ }
2159
2238
  emit() {
2160
2239
  return this.emitParts().join("\n");
2161
2240
  }
2162
2241
  emitParts() {
2163
2242
  const parts = emitParts(this);
2164
2243
  const bridged = this.unwindAbi.size > 0 ? bridgePlainUnwindCalls(parts) : parts;
2165
- const out = this.cpuCopies === null ? bridged : cloneForCpuDispatch(bridged, this.cpuCopies);
2244
+ const profiled = this.keepCopyBodiesOutOfLine ? keepCopiedBodiesOutOfLine(bridged) : bridged;
2245
+ const out = this.cpuCopies === null
2246
+ ? profiled
2247
+ : cloneForCpuDispatch(profiled, this.cpuCopies, this.cpuCopies === "dispatch" ? this.copySelection() : undefined);
2166
2248
  return this.heapCensus === null ? out : [...out, this.heapCensus.definitions().join("\n")];
2167
2249
  }
2168
2250
  /** The entry point and JavaScript name of each named function the
@@ -2926,6 +3008,30 @@ export class LlEmitter {
2926
3008
  this.immortalValues.add(name);
2927
3009
  return name;
2928
3010
  }
3011
+ /** The element data of the static array table at `at`
3012
+ * (ir/constant-tables.ts), which the array itself holds: the emitter also
3013
+ * places the header, `<sym>_h`, in static storage. Each table gets its own
3014
+ * pair, so two tables with equal elements stay distinct arrays —
3015
+ * `@`-refs, first-use order.
3016
+ *
3017
+ * The elements are rendered to their literals here, not in the module
3018
+ * writer: a chunk's result crosses a JSON boundary (emit-module.ts), and
3019
+ * JSON turns NaN and the infinities into null and negative zero into zero.
3020
+ * `f64Lit` is the exact bit pattern, so every element survives it. */
3021
+ staticArrayData(at, values, type) {
3022
+ const key = `${type}:${at.loc?.file}:${at.loc?.start}:${at.loc?.end}`;
3023
+ let c = this.arrayConstData.get(key);
3024
+ if (!c) {
3025
+ c = {
3026
+ sym: this.contentSymbol("sc_arr_const_", key),
3027
+ type,
3028
+ values: values.map((v) => (type === "i32" ? String(v) : f64Lit(v))),
3029
+ };
3030
+ this.arrayConstData.set(key, c);
3031
+ }
3032
+ this.journal?.entry("arrayConst", key, c);
3033
+ return { data: `@${c.sym}`, header: `@${c.sym}_h` };
3034
+ }
2929
3035
  /** Interned NUL-terminated C-string constant (the scr_jb_puts /
2930
3036
  * stringify-indent currency) — `@`-ref, first-use order. */
2931
3037
  cstr(text) {
@@ -3021,6 +3127,15 @@ export class LlEmitter {
3021
3127
  this.immortalValues.add(name);
3022
3128
  return name;
3023
3129
  }
3130
+ /** The ABSENT marker of an optional checked-dynamic record field slot
3131
+ * (IR fieldAbsent without a union). Address-compared, never dereferenced
3132
+ * by compiled code: reads select it to scr_dyn_undefined, presence tests
3133
+ * compare against it, and boxing omits it. */
3134
+ dynAbsentRef() {
3135
+ this.needsDynAbsent = true;
3136
+ this.immortalValues.add(DYN_ABSENT);
3137
+ return DYN_ABSENT;
3138
+ }
3024
3139
  /** i1: a union value loaded from a field slot is the ABSENT state — the
3025
3140
  * undefined arm's tag with the absent payload marker. */
3026
3141
  fieldAbsentTest(value, unionId) {
@@ -4265,7 +4380,7 @@ export class LlEmitter {
4265
4380
  }
4266
4381
  const idx = B.tmp();
4267
4382
  B.line(`${idx} = load i32, ptr ${ptr}${tags}`);
4268
- for (const line of compactRefLoadLines(idx, v, `${v}.r`))
4383
+ for (const line of compactRefLoadLines(this.compactRefBase, idx, v, `${v}.r`))
4269
4384
  B.line(line.trimStart());
4270
4385
  return v;
4271
4386
  }
@@ -5198,6 +5313,7 @@ export class LlEmitter {
5198
5313
  usesGenSlots: this.usesGenSlots,
5199
5314
  needsUnionNone: this.needsUnionNone,
5200
5315
  needsNullableAbsent: this.needsNullableAbsent,
5316
+ needsDynAbsent: this.needsDynAbsent,
5201
5317
  needsOom: this.needsOom,
5202
5318
  needsBadTag: this.needsBadTag,
5203
5319
  needsBadKey: this.needsBadKey,
@@ -5235,6 +5351,7 @@ export class LlEmitter {
5235
5351
  this.usesGenSlots ||= flags.usesGenSlots;
5236
5352
  this.needsUnionNone ||= flags.needsUnionNone;
5237
5353
  this.needsNullableAbsent ||= flags.needsNullableAbsent;
5354
+ this.needsDynAbsent ||= flags.needsDynAbsent;
5238
5355
  this.needsOom ||= flags.needsOom;
5239
5356
  this.needsBadTag ||= flags.needsBadTag;
5240
5357
  this.needsBadKey ||= flags.needsBadKey;
@@ -5303,6 +5420,9 @@ export class LlEmitter {
5303
5420
  case "cstr":
5304
5421
  this.addContentEntry(this.cstrs, key, value, "sc_cs_", names);
5305
5422
  return;
5423
+ case "arrayConst":
5424
+ this.addContentEntry(this.arrayConstData, key, value, "sc_arr_const_", names);
5425
+ return;
5306
5426
  case "mapOps": {
5307
5427
  let own = this.mapOpsConsts.get(key);
5308
5428
  if (own === undefined) {
@@ -6568,6 +6688,7 @@ export class LlEmitter {
6568
6688
  declare: (decl) => this.declare(decl),
6569
6689
  cstr: (text) => this.cstr(text),
6570
6690
  sizeType: this.sizeType,
6691
+ compactRefBase: this.compactRefBase,
6571
6692
  rcAudit: this.shapeHost.objectAudit !== false,
6572
6693
  tracedShapes: this.tracedShapes,
6573
6694
  unionsById: this.unionsById,