@scriptc/compiler 0.4.6 → 0.4.8

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 (1082) hide show
  1. package/ambient/node-fallback/child_process.d.ts +71 -22
  2. package/ambient/node-fallback/crypto.d.ts +15 -7
  3. package/ambient/node-fallback/events.d.ts +29 -6
  4. package/ambient/node-fallback/fs-promises.d.ts +1 -1
  5. package/ambient/node-fallback/fs.d.ts +57 -12
  6. package/ambient/node-fallback/http.d.ts +26 -18
  7. package/ambient/node-fallback/https.d.ts +5 -2
  8. package/ambient/node-fallback/net.d.ts +25 -0
  9. package/ambient/node-fallback/os.d.ts +11 -1
  10. package/ambient/node-fallback/path-posix.d.ts +6 -0
  11. package/ambient/node-fallback/path-win32.d.ts +5 -0
  12. package/ambient/node-fallback/path.d.ts +2 -0
  13. package/ambient/node-fallback/querystring.d.ts +3 -3
  14. package/ambient/node-fallback/zlib.d.ts +31 -2
  15. package/ambient/scriptc-node-fallback.d.ts +95 -20
  16. package/ambient/scriptc.d.ts +7 -2
  17. package/dist/backend/executable-features.js +22 -1
  18. package/dist/backend/executable-features.js.map +1 -1
  19. package/dist/backend/immutability.d.ts +12 -1
  20. package/dist/backend/immutability.js +50 -4
  21. package/dist/backend/immutability.js.map +1 -1
  22. package/dist/backend/immutability.test.js +95 -1
  23. package/dist/backend/immutability.test.js.map +1 -1
  24. package/dist/backend/library-pack.d.ts +6 -0
  25. package/dist/backend/library-pack.js +18 -5
  26. package/dist/backend/library-pack.js.map +1 -1
  27. package/dist/backend/library-pack.test.d.ts +1 -0
  28. package/dist/backend/library-pack.test.js +28 -0
  29. package/dist/backend/library-pack.test.js.map +1 -0
  30. package/dist/backend/linker.d.ts +20 -2
  31. package/dist/backend/linker.js +221 -35
  32. package/dist/backend/linker.js.map +1 -1
  33. package/dist/backend/lld.d.ts +15 -6
  34. package/dist/backend/lld.js +24 -16
  35. package/dist/backend/lld.js.map +1 -1
  36. package/dist/backend/lld.test.js +13 -5
  37. package/dist/backend/lld.test.js.map +1 -1
  38. package/dist/backend/llvm/alloc.d.ts +15 -2
  39. package/dist/backend/llvm/alloc.js +172 -36
  40. package/dist/backend/llvm/alloc.js.map +1 -1
  41. package/dist/backend/llvm/alloc.test.js +69 -1
  42. package/dist/backend/llvm/alloc.test.js.map +1 -1
  43. package/dist/backend/llvm/arenas.d.ts +17 -4
  44. package/dist/backend/llvm/arenas.js +105 -10
  45. package/dist/backend/llvm/arenas.js.map +1 -1
  46. package/dist/backend/llvm/arenas.test.js +229 -0
  47. package/dist/backend/llvm/arenas.test.js.map +1 -1
  48. package/dist/backend/llvm/bytes-alias.js +10 -1
  49. package/dist/backend/llvm/bytes-alias.js.map +1 -1
  50. package/dist/backend/llvm/bytes-headers.js +6 -0
  51. package/dist/backend/llvm/bytes-headers.js.map +1 -1
  52. package/dist/backend/llvm/bytes-loop-versions.test.js +25 -0
  53. package/dist/backend/llvm/bytes-loop-versions.test.js.map +1 -1
  54. package/dist/backend/llvm/call-lifetimes.js +10 -0
  55. package/dist/backend/llvm/call-lifetimes.js.map +1 -1
  56. package/dist/backend/llvm/classes.d.ts +16 -9
  57. package/dist/backend/llvm/classes.js +142 -37
  58. package/dist/backend/llvm/classes.js.map +1 -1
  59. package/dist/backend/llvm/classes.test.js +42 -0
  60. package/dist/backend/llvm/classes.test.js.map +1 -1
  61. package/dist/backend/llvm/constant-callbacks.test.js +50 -1
  62. package/dist/backend/llvm/constant-callbacks.test.js.map +1 -1
  63. package/dist/backend/llvm/cpu-dispatch.d.ts +15 -5
  64. package/dist/backend/llvm/cpu-dispatch.js +34 -9
  65. package/dist/backend/llvm/cpu-dispatch.js.map +1 -1
  66. package/dist/backend/llvm/dyn.d.ts +64 -3
  67. package/dist/backend/llvm/dyn.js +251 -15
  68. package/dist/backend/llvm/dyn.js.map +1 -1
  69. package/dist/backend/llvm/emit-function.js +68 -5
  70. package/dist/backend/llvm/emit-function.js.map +1 -1
  71. package/dist/backend/llvm/emit-module.js +226 -77
  72. package/dist/backend/llvm/emit-module.js.map +1 -1
  73. package/dist/backend/llvm/emit-module.test.d.ts +1 -0
  74. package/dist/backend/llvm/emit-module.test.js +52 -0
  75. package/dist/backend/llvm/emit-module.test.js.map +1 -0
  76. package/dist/backend/llvm/emit-statements.js +138 -34
  77. package/dist/backend/llvm/emit-statements.js.map +1 -1
  78. package/dist/backend/llvm/emitter.d.ts +142 -10
  79. package/dist/backend/llvm/emitter.js +523 -73
  80. package/dist/backend/llvm/emitter.js.map +1 -1
  81. package/dist/backend/llvm/emitter.test.js +31 -3
  82. package/dist/backend/llvm/emitter.test.js.map +1 -1
  83. package/dist/backend/llvm/expr-async.js +19 -1
  84. package/dist/backend/llvm/expr-async.js.map +1 -1
  85. package/dist/backend/llvm/expr-bytes.js +16 -1
  86. package/dist/backend/llvm/expr-bytes.js.map +1 -1
  87. package/dist/backend/llvm/expr-calls.d.ts +4 -1
  88. package/dist/backend/llvm/expr-calls.js +38 -6
  89. package/dist/backend/llvm/expr-calls.js.map +1 -1
  90. package/dist/backend/llvm/expr-dynamic.js +237 -23
  91. package/dist/backend/llvm/expr-dynamic.js.map +1 -1
  92. package/dist/backend/llvm/expr-primitives.js +123 -12
  93. package/dist/backend/llvm/expr-primitives.js.map +1 -1
  94. package/dist/backend/llvm/expr-records.d.ts +1 -1
  95. package/dist/backend/llvm/expr-records.js +124 -56
  96. package/dist/backend/llvm/expr-records.js.map +1 -1
  97. package/dist/backend/llvm/expr-stream-bridges.d.ts +8 -0
  98. package/dist/backend/llvm/expr-stream-bridges.js +59 -2
  99. package/dist/backend/llvm/expr-stream-bridges.js.map +1 -1
  100. package/dist/backend/llvm/expr-stream-callbacks.d.ts +16 -0
  101. package/dist/backend/llvm/expr-stream-callbacks.js +206 -20
  102. package/dist/backend/llvm/expr-stream-callbacks.js.map +1 -1
  103. package/dist/backend/llvm/integer-values.d.ts +2 -0
  104. package/dist/backend/llvm/integer-values.js +6 -0
  105. package/dist/backend/llvm/integer-values.js.map +1 -1
  106. package/dist/backend/llvm/js-groups.d.ts +21 -0
  107. package/dist/backend/llvm/js-groups.js +277 -0
  108. package/dist/backend/llvm/js-groups.js.map +1 -0
  109. package/dist/backend/llvm/js-ic.d.ts +57 -1
  110. package/dist/backend/llvm/js-ic.js +389 -22
  111. package/dist/backend/llvm/js-ic.js.map +1 -1
  112. package/dist/backend/llvm/lib-dispatch.js +152 -1
  113. package/dist/backend/llvm/lib-dispatch.js.map +1 -1
  114. package/dist/backend/llvm/lib-filesystem.js +116 -11
  115. package/dist/backend/llvm/lib-filesystem.js.map +1 -1
  116. package/dist/backend/llvm/lib-network.js +33 -6
  117. package/dist/backend/llvm/lib-network.js.map +1 -1
  118. package/dist/backend/llvm/lib-process.js +180 -27
  119. package/dist/backend/llvm/lib-process.js.map +1 -1
  120. package/dist/backend/llvm/lib-shared.js +139 -2
  121. package/dist/backend/llvm/lib-shared.js.map +1 -1
  122. package/dist/backend/llvm/lib-stream.js +67 -0
  123. package/dist/backend/llvm/lib-stream.js.map +1 -1
  124. package/dist/backend/llvm/local-union-storage.test.js +32 -0
  125. package/dist/backend/llvm/local-union-storage.test.js.map +1 -1
  126. package/dist/backend/llvm/loop-entry-versions.d.ts +2 -2
  127. package/dist/backend/llvm/loop-entry-versions.js +43 -21
  128. package/dist/backend/llvm/loop-entry-versions.js.map +1 -1
  129. package/dist/backend/llvm/loop-state.d.ts +7 -1
  130. package/dist/backend/llvm/loop-state.js +26 -3
  131. package/dist/backend/llvm/loop-state.js.map +1 -1
  132. package/dist/backend/llvm/map-entry-fusion.d.ts +8 -0
  133. package/dist/backend/llvm/map-entry-fusion.js +3 -3
  134. package/dist/backend/llvm/map-entry-fusion.js.map +1 -1
  135. package/dist/backend/llvm/map-number-lookup.d.ts +3 -1
  136. package/dist/backend/llvm/map-number-lookup.js +7 -3
  137. package/dist/backend/llvm/map-number-lookup.js.map +1 -1
  138. package/dist/backend/llvm/map-number-lookup.test.js +58 -17
  139. package/dist/backend/llvm/map-number-lookup.test.js.map +1 -1
  140. package/dist/backend/llvm/nullable-unions.js +7 -6
  141. package/dist/backend/llvm/nullable-unions.js.map +1 -1
  142. package/dist/backend/llvm/nullable-unions.test.js +4 -1
  143. package/dist/backend/llvm/nullable-unions.test.js.map +1 -1
  144. package/dist/backend/llvm/receiver-brackets.test.d.ts +1 -0
  145. package/dist/backend/llvm/receiver-brackets.test.js +68 -0
  146. package/dist/backend/llvm/receiver-brackets.test.js.map +1 -0
  147. package/dist/backend/llvm/receivers.js +3 -0
  148. package/dist/backend/llvm/receivers.js.map +1 -1
  149. package/dist/backend/llvm/record-entry-fusion.d.ts +32 -0
  150. package/dist/backend/llvm/record-entry-fusion.js +217 -0
  151. package/dist/backend/llvm/record-entry-fusion.js.map +1 -0
  152. package/dist/backend/llvm/record-results.d.ts +5 -2
  153. package/dist/backend/llvm/record-results.js +13 -12
  154. package/dist/backend/llvm/record-results.js.map +1 -1
  155. package/dist/backend/llvm/record-views.d.ts +22 -2
  156. package/dist/backend/llvm/record-views.js +147 -12
  157. package/dist/backend/llvm/record-views.js.map +1 -1
  158. package/dist/backend/llvm/record-views.test.js +76 -0
  159. package/dist/backend/llvm/record-views.test.js.map +1 -1
  160. package/dist/backend/llvm/reference-effects.js +1 -0
  161. package/dist/backend/llvm/reference-effects.js.map +1 -1
  162. package/dist/backend/llvm/reference-writes.js +4 -0
  163. package/dist/backend/llvm/reference-writes.js.map +1 -1
  164. package/dist/backend/llvm/region-ir.js +1 -0
  165. package/dist/backend/llvm/region-ir.js.map +1 -1
  166. package/dist/backend/llvm/region-sites.d.ts +18 -0
  167. package/dist/backend/llvm/region-sites.js +79 -1
  168. package/dist/backend/llvm/region-sites.js.map +1 -1
  169. package/dist/backend/llvm/runtime-registries.test.js +53 -6
  170. package/dist/backend/llvm/runtime-registries.test.js.map +1 -1
  171. package/dist/backend/llvm/serialized-ir-emission.test.js +3 -1
  172. package/dist/backend/llvm/serialized-ir-emission.test.js.map +1 -1
  173. package/dist/backend/llvm/shapes.d.ts +36 -3
  174. package/dist/backend/llvm/shapes.js +201 -16
  175. package/dist/backend/llvm/shapes.js.map +1 -1
  176. package/dist/backend/llvm/shapes.test.js +4 -0
  177. package/dist/backend/llvm/shapes.test.js.map +1 -1
  178. package/dist/backend/llvm/speculative-integers.d.ts +10 -1
  179. package/dist/backend/llvm/speculative-integers.js +59 -8
  180. package/dist/backend/llvm/speculative-integers.js.map +1 -1
  181. package/dist/backend/llvm/stack-objects.d.ts +1 -2
  182. package/dist/backend/llvm/stack-objects.js +8 -5
  183. package/dist/backend/llvm/stack-objects.js.map +1 -1
  184. package/dist/backend/llvm/unwind-abi.d.ts +3 -3
  185. package/dist/backend/llvm/unwind-abi.js +8 -3
  186. package/dist/backend/llvm/unwind-abi.js.map +1 -1
  187. package/dist/backend/llvm/walkers.d.ts +12 -0
  188. package/dist/backend/llvm/walkers.js +47 -3
  189. package/dist/backend/llvm/walkers.js.map +1 -1
  190. package/dist/backend/may-throw.js +12 -2
  191. package/dist/backend/may-throw.js.map +1 -1
  192. package/dist/backend/may-throw.test.js +13 -0
  193. package/dist/backend/may-throw.test.js.map +1 -1
  194. package/dist/backend/native/contracts.d.ts +94 -0
  195. package/dist/backend/native/executable.js +134 -10
  196. package/dist/backend/native/executable.js.map +1 -1
  197. package/dist/backend/native/helper-identity-record.d.ts +11 -0
  198. package/dist/backend/native/helper-identity-record.js +76 -0
  199. package/dist/backend/native/helper-identity-record.js.map +1 -0
  200. package/dist/backend/native/helper-identity-record.test.d.ts +1 -0
  201. package/dist/backend/native/helper-identity-record.test.js +101 -0
  202. package/dist/backend/native/helper-identity-record.test.js.map +1 -0
  203. package/dist/backend/native/library.js +10 -2
  204. package/dist/backend/native/library.js.map +1 -1
  205. package/dist/backend/native/runtime-inputs.js +8 -1
  206. package/dist/backend/native/runtime-inputs.js.map +1 -1
  207. package/dist/backend/native/vendor.d.ts +1 -1
  208. package/dist/backend/native/vendor.js +1 -1
  209. package/dist/backend/native/vendor.js.map +1 -1
  210. package/dist/backend/native-codegen-core.d.ts +13 -10
  211. package/dist/backend/native-codegen-core.js +26 -13
  212. package/dist/backend/native-codegen-core.js.map +1 -1
  213. package/dist/backend/native-codegen.js +30 -8
  214. package/dist/backend/native-codegen.js.map +1 -1
  215. package/dist/backend/native-codegen.test.js +110 -14
  216. package/dist/backend/native-codegen.test.js.map +1 -1
  217. package/dist/backend/native-link-info-core.d.ts +72 -0
  218. package/dist/backend/native-link-info-core.js.map +1 -1
  219. package/dist/backend/native-link-info.js +1 -0
  220. package/dist/backend/native-link-info.js.map +1 -1
  221. package/dist/backend/native-profile.d.ts +4 -1
  222. package/dist/backend/native-profile.js +12 -1
  223. package/dist/backend/native-profile.js.map +1 -1
  224. package/dist/backend/native-profile.test.js +10 -0
  225. package/dist/backend/native-profile.test.js.map +1 -1
  226. package/dist/backend/publication.d.ts +4 -1
  227. package/dist/backend/publication.js +4 -2
  228. package/dist/backend/publication.js.map +1 -1
  229. package/dist/backend/runtime-abi.d.ts +2 -2
  230. package/dist/backend/runtime-abi.js +2 -2
  231. package/dist/backend/runtime-pack-core.d.ts +46 -7
  232. package/dist/backend/runtime-pack-core.js +37 -2
  233. package/dist/backend/runtime-pack-core.js.map +1 -1
  234. package/dist/backend/runtime-pack-native.d.ts +18 -1
  235. package/dist/backend/runtime-pack-native.js +138 -29
  236. package/dist/backend/runtime-pack-native.js.map +1 -1
  237. package/dist/backend/runtime-pack-native.test.js +166 -4
  238. package/dist/backend/runtime-pack-native.test.js.map +1 -1
  239. package/dist/backend/runtime-pack-targets.test.js +3 -1
  240. package/dist/backend/runtime-pack-targets.test.js.map +1 -1
  241. package/dist/backend/runtime-pack.d.ts +7 -0
  242. package/dist/backend/runtime-pack.js +25 -3
  243. package/dist/backend/runtime-pack.js.map +1 -1
  244. package/dist/backend/runtime-pack.test.js +213 -12
  245. package/dist/backend/runtime-pack.test.js.map +1 -1
  246. package/dist/backend/tree-classes.d.ts +42 -0
  247. package/dist/backend/tree-classes.js +723 -0
  248. package/dist/backend/tree-classes.js.map +1 -0
  249. package/dist/backend/tree-classes.test.d.ts +1 -0
  250. package/dist/backend/tree-classes.test.js +338 -0
  251. package/dist/backend/tree-classes.test.js.map +1 -0
  252. package/dist/backend/vendor-archives.d.ts +8 -1
  253. package/dist/backend/vendor-archives.js +313 -8
  254. package/dist/backend/vendor-archives.js.map +1 -1
  255. package/dist/backend/vendor-inputs.d.ts +60 -3
  256. package/dist/backend/vendor-inputs.js +109 -3
  257. package/dist/backend/vendor-inputs.js.map +1 -1
  258. package/dist/backend/vendor-inputs.test.js +62 -1
  259. package/dist/backend/vendor-inputs.test.js.map +1 -1
  260. package/dist/backend/warm-cache.js +2 -0
  261. package/dist/backend/warm-cache.js.map +1 -1
  262. package/dist/compat/fetch-profile.d.ts +7 -1
  263. package/dist/compat/fetch-profile.js +25 -12
  264. package/dist/compat/fetch-profile.js.map +1 -1
  265. package/dist/compile-types.d.ts +7 -0
  266. package/dist/contracts/check.d.ts +3 -0
  267. package/dist/contracts/check.js +18 -5
  268. package/dist/contracts/check.js.map +1 -1
  269. package/dist/coverage/report.js +47 -0
  270. package/dist/coverage/report.js.map +1 -1
  271. package/dist/coverage/surface-manifest.js +1 -1
  272. package/dist/coverage/surface-manifest.js.map +1 -1
  273. package/dist/diagnostics/codes.d.ts +14 -0
  274. package/dist/diagnostics/codes.js +14 -0
  275. package/dist/diagnostics/codes.js.map +1 -1
  276. package/dist/diagnostics/diagnostic.d.ts +68 -0
  277. package/dist/diagnostics/diagnostic.js +186 -6
  278. package/dist/diagnostics/diagnostic.js.map +1 -1
  279. package/dist/diagnostics/dynamic-tier.js +3 -1
  280. package/dist/diagnostics/dynamic-tier.js.map +1 -1
  281. package/dist/diagnostics/envelope.d.ts +18 -0
  282. package/dist/diagnostics/envelope.js.map +1 -1
  283. package/dist/executable/executable-cache.d.ts +48 -0
  284. package/dist/executable/executable-cache.js +38 -0
  285. package/dist/executable/executable-cache.js.map +1 -1
  286. package/dist/executable/executable-cache.test.js +127 -1
  287. package/dist/executable/executable-cache.test.js.map +1 -1
  288. package/dist/executable/prepare.d.ts +13 -3
  289. package/dist/executable/prepare.js +438 -234
  290. package/dist/executable/prepare.js.map +1 -1
  291. package/dist/frontend/analysis.js +200 -18
  292. package/dist/frontend/analysis.js.map +1 -1
  293. package/dist/frontend/builtin-modules.d.ts +4 -0
  294. package/dist/frontend/builtin-modules.js +10 -0
  295. package/dist/frontend/builtin-modules.js.map +1 -1
  296. package/dist/frontend/early-errors.d.ts +24 -0
  297. package/dist/frontend/early-errors.js +836 -0
  298. package/dist/frontend/early-errors.js.map +1 -0
  299. package/dist/frontend/early-errors.test.d.ts +1 -0
  300. package/dist/frontend/early-errors.test.js +207 -0
  301. package/dist/frontend/early-errors.test.js.map +1 -0
  302. package/dist/frontend/inferred-js-diagnostics.test.js +88 -0
  303. package/dist/frontend/inferred-js-diagnostics.test.js.map +1 -1
  304. package/dist/frontend/input-tracker.d.ts +47 -0
  305. package/dist/frontend/input-tracker.js +173 -36
  306. package/dist/frontend/input-tracker.js.map +1 -1
  307. package/dist/frontend/input-tracker.test.js +86 -2
  308. package/dist/frontend/input-tracker.test.js.map +1 -1
  309. package/dist/frontend/js-inference.d.ts +2 -0
  310. package/dist/frontend/js-inference.js +18 -0
  311. package/dist/frontend/js-inference.js.map +1 -0
  312. package/dist/frontend/jsx-opinion-sites.test.d.ts +1 -0
  313. package/dist/frontend/jsx-opinion-sites.test.js +86 -0
  314. package/dist/frontend/jsx-opinion-sites.test.js.map +1 -0
  315. package/dist/frontend/lib-exports.d.ts +23 -4
  316. package/dist/frontend/lib-exports.js +98 -26
  317. package/dist/frontend/lib-exports.js.map +1 -1
  318. package/dist/frontend/lowering/binding-analysis.d.ts +2 -1
  319. package/dist/frontend/lowering/binding-analysis.js +86 -4
  320. package/dist/frontend/lowering/binding-analysis.js.map +1 -1
  321. package/dist/frontend/lowering/buffers.d.ts +8 -0
  322. package/dist/frontend/lowering/buffers.js +43 -0
  323. package/dist/frontend/lowering/buffers.js.map +1 -0
  324. package/dist/frontend/lowering/builtin-calls.js +13 -0
  325. package/dist/frontend/lowering/builtin-calls.js.map +1 -1
  326. package/dist/frontend/lowering/builtin-namespaces.d.ts +3 -2
  327. package/dist/frontend/lowering/builtin-namespaces.js +41 -3
  328. package/dist/frontend/lowering/builtin-namespaces.js.map +1 -1
  329. package/dist/frontend/lowering/builtin-statics.d.ts +24 -0
  330. package/dist/frontend/lowering/builtin-statics.js +407 -0
  331. package/dist/frontend/lowering/builtin-statics.js.map +1 -0
  332. package/dist/frontend/lowering/builtins/arguments.d.ts +4 -0
  333. package/dist/frontend/lowering/builtins/arguments.js +12 -0
  334. package/dist/frontend/lowering/builtins/arguments.js.map +1 -1
  335. package/dist/frontend/lowering/builtins/atomics.d.ts +6 -1
  336. package/dist/frontend/lowering/builtins/atomics.js +87 -1
  337. package/dist/frontend/lowering/builtins/atomics.js.map +1 -1
  338. package/dist/frontend/lowering/builtins/child-process-methods.d.ts +7 -0
  339. package/dist/frontend/lowering/builtins/child-process-methods.js +52 -12
  340. package/dist/frontend/lowering/builtins/child-process-methods.js.map +1 -1
  341. package/dist/frontend/lowering/builtins/child-process-sync.d.ts +13 -0
  342. package/dist/frontend/lowering/builtins/child-process-sync.js +1 -13
  343. package/dist/frontend/lowering/builtins/child-process-sync.js.map +1 -1
  344. package/dist/frontend/lowering/builtins/child-process.d.ts +10 -4
  345. package/dist/frontend/lowering/builtins/child-process.js +565 -28
  346. package/dist/frontend/lowering/builtins/child-process.js.map +1 -1
  347. package/dist/frontend/lowering/builtins/compression.d.ts +2 -2
  348. package/dist/frontend/lowering/builtins/compression.js +41 -21
  349. package/dist/frontend/lowering/builtins/compression.js.map +1 -1
  350. package/dist/frontend/lowering/builtins/constants.js +7 -2
  351. package/dist/frontend/lowering/builtins/constants.js.map +1 -1
  352. package/dist/frontend/lowering/builtins/dates.d.ts +1 -1
  353. package/dist/frontend/lowering/builtins/dates.js +23 -1
  354. package/dist/frontend/lowering/builtins/dates.js.map +1 -1
  355. package/dist/frontend/lowering/builtins/environment.d.ts +55 -0
  356. package/dist/frontend/lowering/builtins/environment.js +213 -2
  357. package/dist/frontend/lowering/builtins/environment.js.map +1 -1
  358. package/dist/frontend/lowering/builtins/filesystem-calls.d.ts +1 -0
  359. package/dist/frontend/lowering/builtins/filesystem-calls.js +75 -18
  360. package/dist/frontend/lowering/builtins/filesystem-calls.js.map +1 -1
  361. package/dist/frontend/lowering/builtins/filesystem.d.ts +25 -7
  362. package/dist/frontend/lowering/builtins/filesystem.js +185 -16
  363. package/dist/frontend/lowering/builtins/filesystem.js.map +1 -1
  364. package/dist/frontend/lowering/builtins/json.js +4 -0
  365. package/dist/frontend/lowering/builtins/json.js.map +1 -1
  366. package/dist/frontend/lowering/builtins/module-calls.js +42 -3
  367. package/dist/frontend/lowering/builtins/module-calls.js.map +1 -1
  368. package/dist/frontend/lowering/builtins/module-resolution.d.ts +8 -0
  369. package/dist/frontend/lowering/builtins/module-resolution.js +31 -5
  370. package/dist/frontend/lowering/builtins/module-resolution.js.map +1 -1
  371. package/dist/frontend/lowering/builtins/numbers.d.ts +4 -1
  372. package/dist/frontend/lowering/builtins/numbers.js +10 -2
  373. package/dist/frontend/lowering/builtins/numbers.js.map +1 -1
  374. package/dist/frontend/lowering/builtins/operating-system.d.ts +9 -5
  375. package/dist/frontend/lowering/builtins/operating-system.js +101 -20
  376. package/dist/frontend/lowering/builtins/operating-system.js.map +1 -1
  377. package/dist/frontend/lowering/builtins/process.d.ts +18 -2
  378. package/dist/frontend/lowering/builtins/process.js +386 -25
  379. package/dist/frontend/lowering/builtins/process.js.map +1 -1
  380. package/dist/frontend/lowering/builtins/promises.js +169 -8
  381. package/dist/frontend/lowering/builtins/promises.js.map +1 -1
  382. package/dist/frontend/lowering/builtins/properties.js +6 -2
  383. package/dist/frontend/lowering/builtins/properties.js.map +1 -1
  384. package/dist/frontend/lowering/builtins/querystring.d.ts +8 -0
  385. package/dist/frontend/lowering/builtins/querystring.js +202 -18
  386. package/dist/frontend/lowering/builtins/querystring.js.map +1 -1
  387. package/dist/frontend/lowering/builtins/readline.d.ts +6 -4
  388. package/dist/frontend/lowering/builtins/readline.js +200 -38
  389. package/dist/frontend/lowering/builtins/readline.js.map +1 -1
  390. package/dist/frontend/lowering/builtins/reflection.js +60 -1
  391. package/dist/frontend/lowering/builtins/reflection.js.map +1 -1
  392. package/dist/frontend/lowering/builtins/text-codecs.js +208 -59
  393. package/dist/frontend/lowering/builtins/text-codecs.js.map +1 -1
  394. package/dist/frontend/lowering/builtins/url.js +55 -13
  395. package/dist/frontend/lowering/builtins/url.js.map +1 -1
  396. package/dist/frontend/lowering/builtins/v8.d.ts +5 -5
  397. package/dist/frontend/lowering/builtins/v8.js +7 -5
  398. package/dist/frontend/lowering/builtins/v8.js.map +1 -1
  399. package/dist/frontend/lowering/builtins/web-streams-dyn.d.ts +17 -2
  400. package/dist/frontend/lowering/builtins/web-streams-dyn.js +97 -9
  401. package/dist/frontend/lowering/builtins/web-streams-dyn.js.map +1 -1
  402. package/dist/frontend/lowering/builtins/webassembly.js +2 -0
  403. package/dist/frontend/lowering/builtins/webassembly.js.map +1 -1
  404. package/dist/frontend/lowering/call-arguments.d.ts +10 -0
  405. package/dist/frontend/lowering/call-arguments.js +37 -2
  406. package/dist/frontend/lowering/call-arguments.js.map +1 -1
  407. package/dist/frontend/lowering/call-signatures.d.ts +10 -0
  408. package/dist/frontend/lowering/call-signatures.js +180 -0
  409. package/dist/frontend/lowering/call-signatures.js.map +1 -1
  410. package/dist/frontend/lowering/cjs-exports-object.d.ts +3 -0
  411. package/dist/frontend/lowering/cjs-exports-object.js +1 -1
  412. package/dist/frontend/lowering/cjs-exports-object.js.map +1 -1
  413. package/dist/frontend/lowering/cjs-inline-require.js +5 -0
  414. package/dist/frontend/lowering/cjs-inline-require.js.map +1 -1
  415. package/dist/frontend/lowering/class-construction.d.ts +14 -2
  416. package/dist/frontend/lowering/class-construction.js +99 -5
  417. package/dist/frontend/lowering/class-construction.js.map +1 -1
  418. package/dist/frontend/lowering/class-dynamic-dispatch.d.ts +14 -0
  419. package/dist/frontend/lowering/class-dynamic-dispatch.js +1376 -1009
  420. package/dist/frontend/lowering/class-dynamic-dispatch.js.map +1 -1
  421. package/dist/frontend/lowering/class-dynamic-dispatch.test.js +158 -0
  422. package/dist/frontend/lowering/class-dynamic-dispatch.test.js.map +1 -1
  423. package/dist/frontend/lowering/class-protocols.js +59 -10
  424. package/dist/frontend/lowering/class-protocols.js.map +1 -1
  425. package/dist/frontend/lowering/class-prototypes.js +20 -15
  426. package/dist/frontend/lowering/class-prototypes.js.map +1 -1
  427. package/dist/frontend/lowering/class-runtime-statics.d.ts +8 -0
  428. package/dist/frontend/lowering/class-runtime-statics.js +35 -1
  429. package/dist/frontend/lowering/class-runtime-statics.js.map +1 -1
  430. package/dist/frontend/lowering/class-unions.js +21 -4
  431. package/dist/frontend/lowering/class-unions.js.map +1 -1
  432. package/dist/frontend/lowering/class-views.d.ts +13 -0
  433. package/dist/frontend/lowering/class-views.js +51 -0
  434. package/dist/frontend/lowering/class-views.js.map +1 -0
  435. package/dist/frontend/lowering/coercions/function-adapters.d.ts +15 -1
  436. package/dist/frontend/lowering/coercions/function-adapters.js +63 -10
  437. package/dist/frontend/lowering/coercions/function-adapters.js.map +1 -1
  438. package/dist/frontend/lowering/coercions/state.d.ts +15 -0
  439. package/dist/frontend/lowering/coercions/state.js +24 -0
  440. package/dist/frontend/lowering/coercions/state.js.map +1 -1
  441. package/dist/frontend/lowering/coercions/structural-plans.js +75 -3
  442. package/dist/frontend/lowering/coercions/structural-plans.js.map +1 -1
  443. package/dist/frontend/lowering/coercions/structural.js +39 -2
  444. package/dist/frontend/lowering/coercions/structural.js.map +1 -1
  445. package/dist/frontend/lowering/coercions/unions.d.ts +2 -1
  446. package/dist/frontend/lowering/coercions/unions.js +54 -10
  447. package/dist/frontend/lowering/coercions/unions.js.map +1 -1
  448. package/dist/frontend/lowering/constructor-returns.d.ts +23 -2
  449. package/dist/frontend/lowering/constructor-returns.js +284 -58
  450. package/dist/frontend/lowering/constructor-returns.js.map +1 -1
  451. package/dist/frontend/lowering/containers/array-callbacks.d.ts +8 -1
  452. package/dist/frontend/lowering/containers/array-callbacks.js +288 -90
  453. package/dist/frontend/lowering/containers/array-callbacks.js.map +1 -1
  454. package/dist/frontend/lowering/containers/array-construction.js +37 -8
  455. package/dist/frontend/lowering/containers/array-construction.js.map +1 -1
  456. package/dist/frontend/lowering/containers/array-from-async.js +139 -3
  457. package/dist/frontend/lowering/containers/array-from-async.js.map +1 -1
  458. package/dist/frontend/lowering/containers/array-iteration.d.ts +14 -4
  459. package/dist/frontend/lowering/containers/array-iteration.js +24 -7
  460. package/dist/frontend/lowering/containers/array-iteration.js.map +1 -1
  461. package/dist/frontend/lowering/containers/array-methods.js +30 -11
  462. package/dist/frontend/lowering/containers/array-methods.js.map +1 -1
  463. package/dist/frontend/lowering/containers/bytes.d.ts +6 -0
  464. package/dist/frontend/lowering/containers/bytes.js +450 -86
  465. package/dist/frontend/lowering/containers/bytes.js.map +1 -1
  466. package/dist/frontend/lowering/containers/callback-arguments.d.ts +16 -0
  467. package/dist/frontend/lowering/containers/callback-arguments.js +74 -12
  468. package/dist/frontend/lowering/containers/callback-arguments.js.map +1 -1
  469. package/dist/frontend/lowering/containers/collection-grouping.js +421 -2
  470. package/dist/frontend/lowering/containers/collection-grouping.js.map +1 -1
  471. package/dist/frontend/lowering/containers/collection-methods.js +52 -17
  472. package/dist/frontend/lowering/containers/collection-methods.js.map +1 -1
  473. package/dist/frontend/lowering/containers/filter-predicates.d.ts +10 -0
  474. package/dist/frontend/lowering/containers/filter-predicates.js +69 -3
  475. package/dist/frontend/lowering/containers/filter-predicates.js.map +1 -1
  476. package/dist/frontend/lowering/containers/indexed-objects.js +46 -2
  477. package/dist/frontend/lowering/containers/indexed-objects.js.map +1 -1
  478. package/dist/frontend/lowering/containers/iterator-helpers.d.ts +23 -0
  479. package/dist/frontend/lowering/containers/iterator-helpers.js +176 -10
  480. package/dist/frontend/lowering/containers/iterator-helpers.js.map +1 -1
  481. package/dist/frontend/lowering/containers/string-and-regexp.d.ts +5 -2
  482. package/dist/frontend/lowering/containers/string-and-regexp.js +45 -11
  483. package/dist/frontend/lowering/containers/string-and-regexp.js.map +1 -1
  484. package/dist/frontend/lowering/crypto-tables.d.ts +3 -3
  485. package/dist/frontend/lowering/crypto-tables.js +5 -5
  486. package/dist/frontend/lowering/dispatch-sites.js +3 -0
  487. package/dist/frontend/lowering/dispatch-sites.js.map +1 -1
  488. package/dist/frontend/lowering/divergences.d.ts +40 -0
  489. package/dist/frontend/lowering/divergences.js +239 -20
  490. package/dist/frontend/lowering/divergences.js.map +1 -1
  491. package/dist/frontend/lowering/effect-free.d.ts +12 -0
  492. package/dist/frontend/lowering/effect-free.js +44 -0
  493. package/dist/frontend/lowering/effect-free.js.map +1 -0
  494. package/dist/frontend/lowering/expressions/array-literals.d.ts +24 -0
  495. package/dist/frontend/lowering/expressions/array-literals.js +88 -10
  496. package/dist/frontend/lowering/expressions/array-literals.js.map +1 -1
  497. package/dist/frontend/lowering/expressions/binary.js +216 -14
  498. package/dist/frontend/lowering/expressions/binary.js.map +1 -1
  499. package/dist/frontend/lowering/expressions/element-access.js +272 -11
  500. package/dist/frontend/lowering/expressions/element-access.js.map +1 -1
  501. package/dist/frontend/lowering/expressions/hosted-narrowing.d.ts +15 -0
  502. package/dist/frontend/lowering/expressions/hosted-narrowing.js +54 -1
  503. package/dist/frontend/lowering/expressions/hosted-narrowing.js.map +1 -1
  504. package/dist/frontend/lowering/expressions/identifiers.js +173 -4
  505. package/dist/frontend/lowering/expressions/identifiers.js.map +1 -1
  506. package/dist/frontend/lowering/expressions/keyed-field-targets.d.ts +11 -1
  507. package/dist/frontend/lowering/expressions/keyed-field-targets.js +22 -1
  508. package/dist/frontend/lowering/expressions/keyed-field-targets.js.map +1 -1
  509. package/dist/frontend/lowering/expressions/narrowing.d.ts +3 -0
  510. package/dist/frontend/lowering/expressions/narrowing.js +195 -18
  511. package/dist/frontend/lowering/expressions/narrowing.js.map +1 -1
  512. package/dist/frontend/lowering/expressions/object-literals.d.ts +5 -1
  513. package/dist/frontend/lowering/expressions/object-literals.js +951 -240
  514. package/dist/frontend/lowering/expressions/object-literals.js.map +1 -1
  515. package/dist/frontend/lowering/expressions/optional-chains.js +71 -21
  516. package/dist/frontend/lowering/expressions/optional-chains.js.map +1 -1
  517. package/dist/frontend/lowering/expressions/property-access.d.ts +39 -0
  518. package/dist/frontend/lowering/expressions/property-access.js +1141 -87
  519. package/dist/frontend/lowering/expressions/property-access.js.map +1 -1
  520. package/dist/frontend/lowering/expressions/relational.js +262 -4
  521. package/dist/frontend/lowering/expressions/relational.js.map +1 -1
  522. package/dist/frontend/lowering/expressions/typeof.js +25 -0
  523. package/dist/frontend/lowering/expressions/typeof.js.map +1 -1
  524. package/dist/frontend/lowering/expressions/union-fields.d.ts +20 -1
  525. package/dist/frontend/lowering/expressions/union-fields.js +103 -13
  526. package/dist/frontend/lowering/expressions/union-fields.js.map +1 -1
  527. package/dist/frontend/lowering/expressions/updates.js +156 -22
  528. package/dist/frontend/lowering/expressions/updates.js.map +1 -1
  529. package/dist/frontend/lowering/frozen-records.d.ts +6 -0
  530. package/dist/frontend/lowering/frozen-records.js +10 -4
  531. package/dist/frontend/lowering/frozen-records.js.map +1 -1
  532. package/dist/frontend/lowering/frozen-records.test.d.ts +1 -0
  533. package/dist/frontend/lowering/frozen-records.test.js +44 -0
  534. package/dist/frontend/lowering/frozen-records.test.js.map +1 -0
  535. package/dist/frontend/lowering/function-names.d.ts +9 -0
  536. package/dist/frontend/lowering/function-names.js +95 -0
  537. package/dist/frontend/lowering/function-names.js.map +1 -0
  538. package/dist/frontend/lowering/function-returns.js +42 -13
  539. package/dist/frontend/lowering/function-returns.js.map +1 -1
  540. package/dist/frontend/lowering/general-streams.js +5 -0
  541. package/dist/frontend/lowering/general-streams.js.map +1 -1
  542. package/dist/frontend/lowering/generator-delegation.d.ts +15 -7
  543. package/dist/frontend/lowering/generator-delegation.js +301 -118
  544. package/dist/frontend/lowering/generator-delegation.js.map +1 -1
  545. package/dist/frontend/lowering/generic-functions.d.ts +75 -0
  546. package/dist/frontend/lowering/generic-functions.js +790 -18
  547. package/dist/frontend/lowering/generic-functions.js.map +1 -1
  548. package/dist/frontend/lowering/global-function-values.d.ts +25 -0
  549. package/dist/frontend/lowering/global-function-values.js +193 -0
  550. package/dist/frontend/lowering/global-function-values.js.map +1 -0
  551. package/dist/frontend/lowering/global-values.d.ts +15 -4
  552. package/dist/frontend/lowering/global-values.js +67 -9
  553. package/dist/frontend/lowering/global-values.js.map +1 -1
  554. package/dist/frontend/lowering/handle-properties.js +34 -1
  555. package/dist/frontend/lowering/handle-properties.js.map +1 -1
  556. package/dist/frontend/lowering/host-global-values.d.ts +31 -0
  557. package/dist/frontend/lowering/host-global-values.js +121 -0
  558. package/dist/frontend/lowering/host-global-values.js.map +1 -0
  559. package/dist/frontend/lowering/host-globals.d.ts +74 -0
  560. package/dist/frontend/lowering/host-globals.js +344 -0
  561. package/dist/frontend/lowering/host-globals.js.map +1 -0
  562. package/dist/frontend/lowering/http2-constants.js +1 -1
  563. package/dist/frontend/lowering/iterator-adapters.js +46 -17
  564. package/dist/frontend/lowering/iterator-adapters.js.map +1 -1
  565. package/dist/frontend/lowering/iterator-prototype.d.ts +30 -0
  566. package/dist/frontend/lowering/iterator-prototype.js +160 -0
  567. package/dist/frontend/lowering/iterator-prototype.js.map +1 -0
  568. package/dist/frontend/lowering/key-order-witness.d.ts +54 -0
  569. package/dist/frontend/lowering/key-order-witness.js +571 -9
  570. package/dist/frontend/lowering/key-order-witness.js.map +1 -1
  571. package/dist/frontend/lowering/key-order-witness.test.js +1 -0
  572. package/dist/frontend/lowering/key-order-witness.test.js.map +1 -1
  573. package/dist/frontend/lowering/lib-boundary.js +25 -3
  574. package/dist/frontend/lowering/lib-boundary.js.map +1 -1
  575. package/dist/frontend/lowering/lower-assert.js +140 -16
  576. package/dist/frontend/lowering/lower-assert.js.map +1 -1
  577. package/dist/frontend/lowering/lower-async-iteration.d.ts +11 -0
  578. package/dist/frontend/lowering/lower-async-iteration.js +15 -0
  579. package/dist/frontend/lowering/lower-async-iteration.js.map +1 -1
  580. package/dist/frontend/lowering/lower-builtin-values.d.ts +36 -6
  581. package/dist/frontend/lowering/lower-builtin-values.js +342 -58
  582. package/dist/frontend/lowering/lower-builtin-values.js.map +1 -1
  583. package/dist/frontend/lowering/lower-calls.d.ts +47 -1
  584. package/dist/frontend/lowering/lower-calls.js +1354 -273
  585. package/dist/frontend/lowering/lower-calls.js.map +1 -1
  586. package/dist/frontend/lowering/lower-calls.test.d.ts +1 -0
  587. package/dist/frontend/lowering/lower-calls.test.js +121 -0
  588. package/dist/frontend/lowering/lower-calls.test.js.map +1 -0
  589. package/dist/frontend/lowering/lower-classes.d.ts +36 -5
  590. package/dist/frontend/lowering/lower-classes.js +630 -89
  591. package/dist/frontend/lowering/lower-classes.js.map +1 -1
  592. package/dist/frontend/lowering/lower-event-emitter.d.ts +15 -2
  593. package/dist/frontend/lowering/lower-event-emitter.js +610 -98
  594. package/dist/frontend/lowering/lower-event-emitter.js.map +1 -1
  595. package/dist/frontend/lowering/lower-exprs.d.ts +15 -1
  596. package/dist/frontend/lowering/lower-exprs.js +96 -20
  597. package/dist/frontend/lowering/lower-exprs.js.map +1 -1
  598. package/dist/frontend/lowering/lower-functions.js +27 -6
  599. package/dist/frontend/lowering/lower-functions.js.map +1 -1
  600. package/dist/frontend/lowering/lower-generators.js +57 -10
  601. package/dist/frontend/lowering/lower-generators.js.map +1 -1
  602. package/dist/frontend/lowering/lower-global-value.d.ts +6 -0
  603. package/dist/frontend/lowering/lower-global-value.js +14 -5
  604. package/dist/frontend/lowering/lower-global-value.js.map +1 -1
  605. package/dist/frontend/lowering/lower-inspect.d.ts +4 -0
  606. package/dist/frontend/lowering/lower-inspect.js +713 -92
  607. package/dist/frontend/lowering/lower-inspect.js.map +1 -1
  608. package/dist/frontend/lowering/lower-modules.js +135 -27
  609. package/dist/frontend/lowering/lower-modules.js.map +1 -1
  610. package/dist/frontend/lowering/lower-namespaces.js +18 -0
  611. package/dist/frontend/lowering/lower-namespaces.js.map +1 -1
  612. package/dist/frontend/lowering/lower-node-island.d.ts +35 -4
  613. package/dist/frontend/lowering/lower-node-island.js +472 -67
  614. package/dist/frontend/lowering/lower-node-island.js.map +1 -1
  615. package/dist/frontend/lowering/lower-server.js +463 -96
  616. package/dist/frontend/lowering/lower-server.js.map +1 -1
  617. package/dist/frontend/lowering/lower-shared-modules.js +13 -1
  618. package/dist/frontend/lowering/lower-shared-modules.js.map +1 -1
  619. package/dist/frontend/lowering/lower-stdlib.d.ts +3 -2
  620. package/dist/frontend/lowering/lower-stdlib.js +77 -18
  621. package/dist/frontend/lowering/lower-stdlib.js.map +1 -1
  622. package/dist/frontend/lowering/lower-stmts.d.ts +24 -4
  623. package/dist/frontend/lowering/lower-stmts.js +831 -136
  624. package/dist/frontend/lowering/lower-stmts.js.map +1 -1
  625. package/dist/frontend/lowering/lower-stream.js +126 -8
  626. package/dist/frontend/lowering/lower-stream.js.map +1 -1
  627. package/dist/frontend/lowering/lower-timers.js +243 -48
  628. package/dist/frontend/lowering/lower-timers.js.map +1 -1
  629. package/dist/frontend/lowering/lower-url.js +6 -3
  630. package/dist/frontend/lowering/lower-url.js.map +1 -1
  631. package/dist/frontend/lowering/lowerer.d.ts +363 -21
  632. package/dist/frontend/lowering/lowerer.js +1224 -129
  633. package/dist/frontend/lowering/lowerer.js.map +1 -1
  634. package/dist/frontend/lowering/lowerer.test.js +19 -1
  635. package/dist/frontend/lowering/lowerer.test.js.map +1 -1
  636. package/dist/frontend/lowering/lowering-facts.d.ts +110 -0
  637. package/dist/frontend/lowering/lowering-facts.js +323 -0
  638. package/dist/frontend/lowering/lowering-facts.js.map +1 -0
  639. package/dist/frontend/lowering/lowering-facts.test.d.ts +1 -0
  640. package/dist/frontend/lowering/lowering-facts.test.js +100 -0
  641. package/dist/frontend/lowering/lowering-facts.test.js.map +1 -0
  642. package/dist/frontend/lowering/module-namespace-elements.js +15 -0
  643. package/dist/frontend/lowering/module-namespace-elements.js.map +1 -1
  644. package/dist/frontend/lowering/nan-coded-reads.d.ts +27 -4
  645. package/dist/frontend/lowering/nan-coded-reads.js +112 -9
  646. package/dist/frontend/lowering/nan-coded-reads.js.map +1 -1
  647. package/dist/frontend/lowering/new-target.js +2 -2
  648. package/dist/frontend/lowering/nullish-empty-pattern.d.ts +17 -0
  649. package/dist/frontend/lowering/nullish-empty-pattern.js +118 -0
  650. package/dist/frontend/lowering/nullish-empty-pattern.js.map +1 -0
  651. package/dist/frontend/lowering/optional-arguments.d.ts +4 -0
  652. package/dist/frontend/lowering/optional-arguments.js +26 -2
  653. package/dist/frontend/lowering/optional-arguments.js.map +1 -1
  654. package/dist/frontend/lowering/partial-assertions.d.ts +36 -0
  655. package/dist/frontend/lowering/partial-assertions.js +189 -0
  656. package/dist/frontend/lowering/partial-assertions.js.map +1 -0
  657. package/dist/frontend/lowering/primitive-throws.d.ts +100 -0
  658. package/dist/frontend/lowering/primitive-throws.js +241 -0
  659. package/dist/frontend/lowering/primitive-throws.js.map +1 -0
  660. package/dist/frontend/lowering/primitive-wrappers.d.ts +34 -0
  661. package/dist/frontend/lowering/primitive-wrappers.js +221 -0
  662. package/dist/frontend/lowering/primitive-wrappers.js.map +1 -0
  663. package/dist/frontend/lowering/private-statics.d.ts +46 -0
  664. package/dist/frontend/lowering/private-statics.js +322 -0
  665. package/dist/frontend/lowering/private-statics.js.map +1 -0
  666. package/dist/frontend/lowering/record-inherited.d.ts +17 -1
  667. package/dist/frontend/lowering/record-inherited.js +16 -2
  668. package/dist/frontend/lowering/record-inherited.js.map +1 -1
  669. package/dist/frontend/lowering/record-links.d.ts +73 -0
  670. package/dist/frontend/lowering/record-links.js +797 -0
  671. package/dist/frontend/lowering/record-links.js.map +1 -0
  672. package/dist/frontend/lowering/record-sources.d.ts +12 -1
  673. package/dist/frontend/lowering/record-sources.js +60 -0
  674. package/dist/frontend/lowering/record-sources.js.map +1 -1
  675. package/dist/frontend/lowering/runtime-optional-provenance.d.ts +27 -7
  676. package/dist/frontend/lowering/runtime-optional-provenance.js +25 -11
  677. package/dist/frontend/lowering/runtime-optional-provenance.js.map +1 -1
  678. package/dist/frontend/lowering/runtime-optional-report.d.ts +40 -0
  679. package/dist/frontend/lowering/runtime-optional-report.js +300 -0
  680. package/dist/frontend/lowering/runtime-optional-report.js.map +1 -0
  681. package/dist/frontend/lowering/scoped-type-memo.test.d.ts +1 -0
  682. package/dist/frontend/lowering/scoped-type-memo.test.js +86 -0
  683. package/dist/frontend/lowering/scoped-type-memo.test.js.map +1 -0
  684. package/dist/frontend/lowering/static-typeof.d.ts +3 -1
  685. package/dist/frontend/lowering/static-typeof.js +6 -1
  686. package/dist/frontend/lowering/static-typeof.js.map +1 -1
  687. package/dist/frontend/lowering/strict-equality.d.ts +4 -0
  688. package/dist/frontend/lowering/strict-equality.js +14 -0
  689. package/dist/frontend/lowering/strict-equality.js.map +1 -1
  690. package/dist/frontend/lowering/strict-mode.d.ts +1 -5
  691. package/dist/frontend/lowering/strict-mode.js +4 -30
  692. package/dist/frontend/lowering/strict-mode.js.map +1 -1
  693. package/dist/frontend/lowering/structural-instances.d.ts +7 -0
  694. package/dist/frontend/lowering/structural-instances.js +23 -0
  695. package/dist/frontend/lowering/structural-instances.js.map +1 -1
  696. package/dist/frontend/lowering/surfaces.d.ts +42 -1
  697. package/dist/frontend/lowering/surfaces.js +212 -71
  698. package/dist/frontend/lowering/surfaces.js.map +1 -1
  699. package/dist/frontend/lowering/union-retag.d.ts +13 -1
  700. package/dist/frontend/lowering/union-retag.js +55 -1
  701. package/dist/frontend/lowering/union-retag.js.map +1 -1
  702. package/dist/frontend/lowering/union-retag.test.js +51 -0
  703. package/dist/frontend/lowering/union-retag.test.js.map +1 -1
  704. package/dist/frontend/lowering/unit-journal.d.ts +136 -17
  705. package/dist/frontend/lowering/unit-journal.js +324 -53
  706. package/dist/frontend/lowering/unit-journal.js.map +1 -1
  707. package/dist/frontend/lowering/unit-journal.test.js +126 -3
  708. package/dist/frontend/lowering/unit-journal.test.js.map +1 -1
  709. package/dist/frontend/lowering/unit-reuse.d.ts +92 -0
  710. package/dist/frontend/lowering/unit-reuse.js +1008 -0
  711. package/dist/frontend/lowering/unit-reuse.js.map +1 -0
  712. package/dist/frontend/lowering/width-lift.d.ts +12 -0
  713. package/dist/frontend/lowering/zlib-constants.js +3 -2
  714. package/dist/frontend/lowering/zlib-constants.js.map +1 -1
  715. package/dist/frontend/npm-file-import.test.d.ts +1 -0
  716. package/dist/frontend/npm-file-import.test.js +76 -0
  717. package/dist/frontend/npm-file-import.test.js.map +1 -0
  718. package/dist/frontend/npm-static.js +95 -11
  719. package/dist/frontend/npm-static.js.map +1 -1
  720. package/dist/frontend/npm-static.test.js +95 -2
  721. package/dist/frontend/npm-static.test.js.map +1 -1
  722. package/dist/frontend/npm.d.ts +9 -0
  723. package/dist/frontend/npm.js +82 -0
  724. package/dist/frontend/npm.js.map +1 -1
  725. package/dist/frontend/pipeline-native.js +2 -1
  726. package/dist/frontend/pipeline-native.js.map +1 -1
  727. package/dist/frontend/pipeline.d.ts +9 -4
  728. package/dist/frontend/pipeline.js +162 -38
  729. package/dist/frontend/pipeline.js.map +1 -1
  730. package/dist/frontend/pipeline.test.js +68 -11
  731. package/dist/frontend/pipeline.test.js.map +1 -1
  732. package/dist/frontend/program-node.d.ts +3 -0
  733. package/dist/frontend/program-node.js +13 -6
  734. package/dist/frontend/program-node.js.map +1 -1
  735. package/dist/frontend/program.d.ts +71 -2
  736. package/dist/frontend/program.js +836 -411
  737. package/dist/frontend/program.js.map +1 -1
  738. package/dist/frontend/program.test.js +37 -1
  739. package/dist/frontend/program.test.js.map +1 -1
  740. package/dist/frontend/provenance-core.js +4 -0
  741. package/dist/frontend/provenance-core.js.map +1 -1
  742. package/dist/frontend/services-node.d.ts +7 -0
  743. package/dist/frontend/services-node.js +32 -1
  744. package/dist/frontend/services-node.js.map +1 -1
  745. package/dist/frontend/services-node.test.js +51 -0
  746. package/dist/frontend/services-node.test.js.map +1 -1
  747. package/dist/frontend/services.d.ts +14 -0
  748. package/dist/frontend/services.js +52 -2
  749. package/dist/frontend/services.js.map +1 -1
  750. package/dist/frontend/services.test.js +61 -1
  751. package/dist/frontend/services.test.js.map +1 -1
  752. package/dist/frontend/shape-inference/analyze.d.ts +5 -0
  753. package/dist/frontend/shape-inference/analyze.js +104 -4
  754. package/dist/frontend/shape-inference/analyze.js.map +1 -1
  755. package/dist/frontend/shape-inference/domain.js +0 -1
  756. package/dist/frontend/shape-inference/domain.js.map +1 -1
  757. package/dist/frontend/shape-inference/index.js +5 -1
  758. package/dist/frontend/shape-inference/index.js.map +1 -1
  759. package/dist/frontend/shape-inference/memo.d.ts +2 -1
  760. package/dist/frontend/shape-inference/memo.js +6 -2
  761. package/dist/frontend/shape-inference/memo.js.map +1 -1
  762. package/dist/frontend/shape-inference/overlay.d.ts +1 -1
  763. package/dist/frontend/shape-inference/overlay.js +184 -4
  764. package/dist/frontend/shape-inference/overlay.js.map +1 -1
  765. package/dist/frontend/shape-inference/static-objects.js +11 -6
  766. package/dist/frontend/shape-inference/static-objects.js.map +1 -1
  767. package/dist/frontend/source-phase-imports.test.d.ts +1 -0
  768. package/dist/frontend/source-phase-imports.test.js +37 -0
  769. package/dist/frontend/source-phase-imports.test.js.map +1 -0
  770. package/dist/frontend/tier-analysis.d.ts +9 -0
  771. package/dist/frontend/tier-analysis.js +1 -0
  772. package/dist/frontend/tier-analysis.js.map +1 -1
  773. package/dist/frontend/ts7/ast-node.d.ts +6 -1
  774. package/dist/frontend/ts7/ast-node.js +12 -0
  775. package/dist/frontend/ts7/ast-node.js.map +1 -1
  776. package/dist/frontend/ts7/ast-wire-protocols.test.js +11 -3
  777. package/dist/frontend/ts7/ast-wire-protocols.test.js.map +1 -1
  778. package/dist/frontend/ts7/ast-wire.js +3 -5
  779. package/dist/frontend/ts7/ast-wire.js.map +1 -1
  780. package/dist/frontend/ts7/checker-backend.d.ts +13 -0
  781. package/dist/frontend/ts7/checker-backend.js +84 -2
  782. package/dist/frontend/ts7/checker-backend.js.map +1 -1
  783. package/dist/frontend/ts7/checker-backend.test.js +126 -2
  784. package/dist/frontend/ts7/checker-backend.test.js.map +1 -1
  785. package/dist/frontend/ts7/program-host.d.ts +22 -1
  786. package/dist/frontend/ts7/program-host.js +49 -4
  787. package/dist/frontend/ts7/program-host.js.map +1 -1
  788. package/dist/frontend/ts7/program-host.test.js +83 -0
  789. package/dist/frontend/ts7/program-host.test.js.map +1 -1
  790. package/dist/frontend/ts7/rpc-process.d.ts +16 -1
  791. package/dist/frontend/ts7/rpc-process.js +170 -92
  792. package/dist/frontend/ts7/rpc-process.js.map +1 -1
  793. package/dist/frontend/ts7/rpc-process.test.js +49 -21
  794. package/dist/frontend/ts7/rpc-process.test.js.map +1 -1
  795. package/dist/frontend/tsc-codes.d.ts +57 -3
  796. package/dist/frontend/tsc-codes.js +956 -101
  797. package/dist/frontend/tsc-codes.js.map +1 -1
  798. package/dist/frontend/tsc-codes.test.js +221 -12
  799. package/dist/frontend/tsc-codes.test.js.map +1 -1
  800. package/dist/frontend/type-mapper.d.ts +98 -11
  801. package/dist/frontend/type-mapper.js +770 -182
  802. package/dist/frontend/type-mapper.js.map +1 -1
  803. package/dist/index.d.ts +1 -1
  804. package/dist/index.js +224 -15
  805. package/dist/index.js.map +1 -1
  806. package/dist/index.test.d.ts +1 -0
  807. package/dist/index.test.js +60 -0
  808. package/dist/index.test.js.map +1 -0
  809. package/dist/ir/api.d.ts +1 -1
  810. package/dist/ir/api.js +1 -1
  811. package/dist/ir/api.js.map +1 -1
  812. package/dist/ir/build.d.ts +3 -2
  813. package/dist/ir/build.js +4 -2
  814. package/dist/ir/build.js.map +1 -1
  815. package/dist/ir/builtin-effects.js +96 -0
  816. package/dist/ir/builtin-effects.js.map +1 -1
  817. package/dist/ir/builtin-signatures.d.ts +1 -1
  818. package/dist/ir/builtin-signatures.js +453 -26
  819. package/dist/ir/builtin-signatures.js.map +1 -1
  820. package/dist/ir/callback-specialization.d.ts +3 -2
  821. package/dist/ir/callback-specialization.js +35 -25
  822. package/dist/ir/callback-specialization.js.map +1 -1
  823. package/dist/ir/capture-values.d.ts +8 -4
  824. package/dist/ir/capture-values.js +9 -6
  825. package/dist/ir/capture-values.js.map +1 -1
  826. package/dist/ir/char-unit-locals.d.ts +6 -2
  827. package/dist/ir/char-unit-locals.js +11 -2
  828. package/dist/ir/char-unit-locals.js.map +1 -1
  829. package/dist/ir/class-key-index.d.ts +18 -0
  830. package/dist/ir/class-key-index.js +29 -0
  831. package/dist/ir/class-key-index.js.map +1 -0
  832. package/dist/ir/class-key-index.test.d.ts +1 -0
  833. package/dist/ir/class-key-index.test.js +25 -0
  834. package/dist/ir/class-key-index.test.js.map +1 -0
  835. package/dist/ir/codec.d.ts +82 -0
  836. package/dist/ir/codec.generated.d.ts +13 -0
  837. package/dist/ir/codec.generated.js +5350 -0
  838. package/dist/ir/codec.generated.js.map +1 -0
  839. package/dist/ir/codec.js +325 -0
  840. package/dist/ir/codec.js.map +1 -0
  841. package/dist/ir/codec.test.d.ts +1 -0
  842. package/dist/ir/codec.test.js +225 -0
  843. package/dist/ir/codec.test.js.map +1 -0
  844. package/dist/ir/constant-globals.d.ts +5 -2
  845. package/dist/ir/constant-globals.js +25 -27
  846. package/dist/ir/constant-globals.js.map +1 -1
  847. package/dist/ir/expression-inlining.d.ts +4 -2
  848. package/dist/ir/expression-inlining.js +8 -2
  849. package/dist/ir/expression-inlining.js.map +1 -1
  850. package/dist/ir/field-values.d.ts +5 -2
  851. package/dist/ir/field-values.js +32 -21
  852. package/dist/ir/field-values.js.map +1 -1
  853. package/dist/ir/fields.generated.d.ts +29 -10
  854. package/dist/ir/fields.generated.js +1039 -11
  855. package/dist/ir/fields.generated.js.map +1 -1
  856. package/dist/ir/fields.test.js +46 -2
  857. package/dist/ir/fields.test.js.map +1 -1
  858. package/dist/ir/final-fields.js +1 -1
  859. package/dist/ir/final-fields.js.map +1 -1
  860. package/dist/ir/function-references.d.ts +6 -4
  861. package/dist/ir/function-references.js +11 -4
  862. package/dist/ir/function-references.js.map +1 -1
  863. package/dist/ir/function-references.test.js +14 -0
  864. package/dist/ir/function-references.test.js.map +1 -1
  865. package/dist/ir/init-only-globals.d.ts +4 -2
  866. package/dist/ir/init-only-globals.js +17 -18
  867. package/dist/ir/init-only-globals.js.map +1 -1
  868. package/dist/ir/inline-array-sources.js +4 -1
  869. package/dist/ir/inline-array-sources.js.map +1 -1
  870. package/dist/ir/inline-array-views.d.ts +13 -0
  871. package/dist/ir/inline-array-views.js +945 -0
  872. package/dist/ir/inline-array-views.js.map +1 -0
  873. package/dist/ir/inline-arrays.d.ts +7 -0
  874. package/dist/ir/inline-arrays.js +190 -55
  875. package/dist/ir/inline-arrays.js.map +1 -1
  876. package/dist/ir/inline-arrays.test.js +140 -2
  877. package/dist/ir/inline-arrays.test.js.map +1 -1
  878. package/dist/ir/int32-slots.js +7 -0
  879. package/dist/ir/int32-slots.js.map +1 -1
  880. package/dist/ir/integer-ranges.js +16 -6
  881. package/dist/ir/integer-ranges.js.map +1 -1
  882. package/dist/ir/ir.d.ts +130 -44
  883. package/dist/ir/ir.js +7 -0
  884. package/dist/ir/ir.js.map +1 -1
  885. package/dist/ir/js-groups.d.ts +51 -0
  886. package/dist/ir/js-groups.js +394 -0
  887. package/dist/ir/js-groups.js.map +1 -0
  888. package/dist/ir/js-groups.test.d.ts +1 -0
  889. package/dist/ir/js-groups.test.js +555 -0
  890. package/dist/ir/js-groups.test.js.map +1 -0
  891. package/dist/ir/js-ic.d.ts +10 -9
  892. package/dist/ir/js-ic.js +58 -25
  893. package/dist/ir/js-ic.js.map +1 -1
  894. package/dist/ir/js-ic.test.js +37 -3
  895. package/dist/ir/js-ic.test.js.map +1 -1
  896. package/dist/ir/jsval.js +374 -63
  897. package/dist/ir/jsval.js.map +1 -1
  898. package/dist/ir/jsval.test.js +96 -2
  899. package/dist/ir/jsval.test.js.map +1 -1
  900. package/dist/ir/loop-entry-ranges.js +112 -9
  901. package/dist/ir/loop-entry-ranges.js.map +1 -1
  902. package/dist/ir/loop-entry-ranges.test.js +40 -0
  903. package/dist/ir/loop-entry-ranges.test.js.map +1 -1
  904. package/dist/ir/node-index.d.ts +23 -6
  905. package/dist/ir/node-index.js +126 -49
  906. package/dist/ir/node-index.js.map +1 -1
  907. package/dist/ir/numeric-call-specialization.d.ts +4 -2
  908. package/dist/ir/numeric-call-specialization.js +40 -26
  909. package/dist/ir/numeric-call-specialization.js.map +1 -1
  910. package/dist/ir/paired-while-loops.d.ts +4 -2
  911. package/dist/ir/paired-while-loops.js +8 -2
  912. package/dist/ir/paired-while-loops.js.map +1 -1
  913. package/dist/ir/parameter-versions.d.ts +13 -3
  914. package/dist/ir/parameter-versions.js +63 -40
  915. package/dist/ir/parameter-versions.js.map +1 -1
  916. package/dist/ir/property-bags.d.ts +4 -2
  917. package/dist/ir/property-bags.js +22 -17
  918. package/dist/ir/property-bags.js.map +1 -1
  919. package/dist/ir/receiver-readers.js +58 -2
  920. package/dist/ir/receiver-readers.js.map +1 -1
  921. package/dist/ir/row-pairs.d.ts +4 -2
  922. package/dist/ir/row-pairs.js +12 -11
  923. package/dist/ir/row-pairs.js.map +1 -1
  924. package/dist/ir/runtime-features.d.ts +139 -5
  925. package/dist/ir/runtime-features.js +397 -19
  926. package/dist/ir/runtime-features.js.map +1 -1
  927. package/dist/ir/runtime-features.test.js +135 -1
  928. package/dist/ir/runtime-features.test.js.map +1 -1
  929. package/dist/ir/runtime-jam-loops.d.ts +35 -0
  930. package/dist/ir/runtime-jam-loops.js +604 -0
  931. package/dist/ir/runtime-jam-loops.js.map +1 -0
  932. package/dist/ir/runtime-jam-loops.test.d.ts +1 -0
  933. package/dist/ir/runtime-jam-loops.test.js +565 -0
  934. package/dist/ir/runtime-jam-loops.test.js.map +1 -0
  935. package/dist/ir/saturating-loop-jams.d.ts +11 -2
  936. package/dist/ir/saturating-loop-jams.js +56 -16
  937. package/dist/ir/saturating-loop-jams.js.map +1 -1
  938. package/dist/ir/saturating-loop-jams.test.js +39 -1
  939. package/dist/ir/saturating-loop-jams.test.js.map +1 -1
  940. package/dist/ir/scalar-records.d.ts +5 -2
  941. package/dist/ir/scalar-records.js +12 -2
  942. package/dist/ir/scalar-records.js.map +1 -1
  943. package/dist/ir/self-captures.d.ts +4 -2
  944. package/dist/ir/self-captures.js +40 -28
  945. package/dist/ir/self-captures.js.map +1 -1
  946. package/dist/ir/self-captures.test.js +15 -0
  947. package/dist/ir/self-captures.test.js.map +1 -1
  948. package/dist/ir/serialize.d.ts +8 -2
  949. package/dist/ir/serialize.js +92 -24
  950. package/dist/ir/serialize.js.map +1 -1
  951. package/dist/ir/serialize.test.js +26 -0
  952. package/dist/ir/serialize.test.js.map +1 -1
  953. package/dist/ir/tiers.js +1 -0
  954. package/dist/ir/tiers.js.map +1 -1
  955. package/dist/ir/traverse.js +4 -0
  956. package/dist/ir/traverse.js.map +1 -1
  957. package/dist/ir/typed-argument-clones.d.ts +30 -0
  958. package/dist/ir/typed-argument-clones.js +789 -0
  959. package/dist/ir/typed-argument-clones.js.map +1 -0
  960. package/dist/ir/union-arm-loops.d.ts +3 -0
  961. package/dist/ir/union-arm-loops.js +373 -0
  962. package/dist/ir/union-arm-loops.js.map +1 -0
  963. package/dist/ir/union-arm-loops.test.d.ts +1 -0
  964. package/dist/ir/union-arm-loops.test.js +230 -0
  965. package/dist/ir/union-arm-loops.test.js.map +1 -0
  966. package/dist/ir/validate.js +170 -22
  967. package/dist/ir/validate.js.map +1 -1
  968. package/dist/ir/validate.test.js +46 -0
  969. package/dist/ir/validate.test.js.map +1 -1
  970. package/dist/library/compiler-self-identity.d.ts +8 -2
  971. package/dist/library/compiler-self-identity.js +92 -18
  972. package/dist/library/compiler-self-identity.js.map +1 -1
  973. package/dist/library/compiler-self-identity.test.js +150 -3
  974. package/dist/library/compiler-self-identity.test.js.map +1 -1
  975. package/dist/library/int-infer.d.ts +5 -0
  976. package/dist/library/int-infer.js +15 -3
  977. package/dist/library/int-infer.js.map +1 -1
  978. package/dist/library/ir-policy.js +4 -0
  979. package/dist/library/ir-policy.js.map +1 -1
  980. package/dist/library/library-cache.d.ts +4 -0
  981. package/dist/library/library-cache.js +2 -0
  982. package/dist/library/library-cache.js.map +1 -1
  983. package/dist/library/library-cache.test.js +26 -0
  984. package/dist/library/library-cache.test.js.map +1 -1
  985. package/dist/library/prepare.js +99 -31
  986. package/dist/library/prepare.js.map +1 -1
  987. package/dist/native/cache.d.ts +7 -0
  988. package/dist/native/cache.js +49 -0
  989. package/dist/native/cache.js.map +1 -1
  990. package/dist/native/cache.test.js +13 -1
  991. package/dist/native/cache.test.js.map +1 -1
  992. package/dist/native/cli.js +2 -0
  993. package/dist/native/cli.js.map +1 -1
  994. package/dist/native/compiler.js +26 -5
  995. package/dist/native/compiler.js.map +1 -1
  996. package/dist/native/executable-cache-open.test.js +31 -5
  997. package/dist/native/executable-cache-open.test.js.map +1 -1
  998. package/dist/native/executable-cache.d.ts +6 -1
  999. package/dist/native/executable-cache.js +7 -1
  1000. package/dist/native/executable-cache.js.map +1 -1
  1001. package/dist/native/prepare.d.ts +3 -0
  1002. package/dist/native/prepare.js +74 -28
  1003. package/dist/native/prepare.js.map +1 -1
  1004. package/dist/native/prepare.test.js +25 -3
  1005. package/dist/native/prepare.test.js.map +1 -1
  1006. package/dist/native/sanitizer.js +63 -4
  1007. package/dist/native/sanitizer.js.map +1 -1
  1008. package/dist/native/sanitizer.test.js +93 -2
  1009. package/dist/native/sanitizer.test.js.map +1 -1
  1010. package/dist/native/toolchain.js +9 -2
  1011. package/dist/native/toolchain.js.map +1 -1
  1012. package/dist/node-islands/boundary.d.ts +37 -1
  1013. package/dist/node-islands/boundary.js +65 -7
  1014. package/dist/node-islands/boundary.js.map +1 -1
  1015. package/dist/node-islands/boundary.test.d.ts +1 -0
  1016. package/dist/node-islands/boundary.test.js +76 -0
  1017. package/dist/node-islands/boundary.test.js.map +1 -0
  1018. package/dist/node-islands/detect.d.ts +27 -1
  1019. package/dist/node-islands/detect.js +475 -40
  1020. package/dist/node-islands/detect.js.map +1 -1
  1021. package/dist/node-islands/detect.test.js +175 -4
  1022. package/dist/node-islands/detect.test.js.map +1 -1
  1023. package/dist/node-islands/effect-gate.js +30 -20
  1024. package/dist/node-islands/effect-gate.js.map +1 -1
  1025. package/dist/node-islands/effect-gate.test.js +4 -1
  1026. package/dist/node-islands/effect-gate.test.js.map +1 -1
  1027. package/dist/node-islands/graph-islands.d.ts +40 -0
  1028. package/dist/node-islands/graph-islands.js +128 -0
  1029. package/dist/node-islands/graph-islands.js.map +1 -0
  1030. package/dist/node-islands/growth.d.ts +57 -0
  1031. package/dist/node-islands/growth.js +205 -0
  1032. package/dist/node-islands/growth.js.map +1 -0
  1033. package/dist/node-islands/libnode.d.ts +1 -1
  1034. package/dist/node-islands/libnode.js +1 -1
  1035. package/dist/node-islands/libnode.js.map +1 -1
  1036. package/dist/node-islands/modules.d.ts +28 -0
  1037. package/dist/node-islands/modules.js +156 -0
  1038. package/dist/node-islands/modules.js.map +1 -1
  1039. package/dist/node-islands/modules.test.js +105 -1
  1040. package/dist/node-islands/modules.test.js.map +1 -1
  1041. package/dist/node-islands/policy.js +2 -3
  1042. package/dist/node-islands/policy.js.map +1 -1
  1043. package/dist/node-islands/probe-recorder.d.ts +1 -0
  1044. package/dist/node-islands/probe-recorder.js +596 -0
  1045. package/dist/node-islands/probe-recorder.js.map +1 -0
  1046. package/dist/node-islands/probe-recorder.test.d.ts +1 -0
  1047. package/dist/node-islands/probe-recorder.test.js +80 -0
  1048. package/dist/node-islands/probe-recorder.test.js.map +1 -0
  1049. package/dist/node-islands/report.d.ts +12 -0
  1050. package/dist/node-islands/report.js +28 -0
  1051. package/dist/node-islands/report.js.map +1 -1
  1052. package/dist/node-islands/report.test.js +4 -0
  1053. package/dist/node-islands/report.test.js.map +1 -1
  1054. package/dist/node-islands/rules.js +9 -0
  1055. package/dist/node-islands/rules.js.map +1 -1
  1056. package/dist/node-islands/scan.d.ts +16 -1
  1057. package/dist/node-islands/scan.js +110 -9
  1058. package/dist/node-islands/scan.js.map +1 -1
  1059. package/dist/node-islands/snapshot.d.ts +38 -1
  1060. package/dist/node-islands/snapshot.js +165 -161
  1061. package/dist/node-islands/snapshot.js.map +1 -1
  1062. package/dist/node-islands/snapshot.test.js +63 -2
  1063. package/dist/node-islands/snapshot.test.js.map +1 -1
  1064. package/dist/node-islands/summary.js +8 -0
  1065. package/dist/node-islands/summary.js.map +1 -1
  1066. package/dist/node-islands/type-strip.d.ts +11 -0
  1067. package/dist/node-islands/type-strip.js +157 -0
  1068. package/dist/node-islands/type-strip.js.map +1 -0
  1069. package/dist/node-islands/type-strip.test.d.ts +1 -0
  1070. package/dist/node-islands/type-strip.test.js +31 -0
  1071. package/dist/node-islands/type-strip.test.js.map +1 -0
  1072. package/dist/project-config.d.ts +4 -0
  1073. package/dist/project-config.js +19 -0
  1074. package/dist/project-config.js.map +1 -1
  1075. package/dist/project-config.test.js +10 -0
  1076. package/dist/project-config.test.js.map +1 -1
  1077. package/dist/wasm/translate.js +11 -5
  1078. package/dist/wasm/translate.js.map +1 -1
  1079. package/dist/wasm/translate.test.js +35 -0
  1080. package/dist/wasm/translate.test.js.map +1 -1
  1081. package/package.json +20 -20
  1082. package/surface-manifest.json +221 -122
@@ -2,12 +2,12 @@ import { loopEntryInlines } from "./loop-entry-versions.js";
2
2
  import { relieveHeapPressure } from "../../heap-pressure.js";
3
3
  import { analyzeFrameEscapes } from "./frame-escapes.js";
4
4
  import { wasmBoundsChecks } from "./wasm-modules.js";
5
- import { jsTruthy } from "./jsval.js";
5
+ import { jsImmediates, jsTruthy } from "./jsval.js";
6
6
  import { JsIcSites } from "../../ir/js-ic.js";
7
7
  import {} from "./array-search.js";
8
8
  import { emitStringInputs } from "./string-lifetimes.js";
9
9
  import { emitThreadSlotsIntrinsic } from "./thread-slots.js";
10
- import { CYC_BUF, CYC_HDR, FIRST_EMITTED_CYC_KIND, inlineAllocSupported, RECORD_SOURCES_GATE, WEAK_KEYS_GATE, } from "./alloc.js";
10
+ import { CYC_BUF, CYC_HDR, FIRST_EMITTED_CYC_KIND, inlineAllocSupported, RECORD_KEPT_GATE, RECORD_SOURCES_GATE, WEAK_KEYS_GATE, } from "./alloc.js";
11
11
  import { youngNurseryRequested } from "../young-nursery.js";
12
12
  import { llvmBytes as llBytes, wtf8Bytes } from "../literals.js";
13
13
  import { InternalCompilerError } from "../../errors.js";
@@ -27,12 +27,14 @@ import { addRecordResultEntries, resultEntryName } from "./record-results.js";
27
27
  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
+ import { specializeTypedArguments } from "../../ir/typed-argument-clones.js";
30
31
  import { versionLoopBoundParameters } from "../../ir/parameter-versions.js";
31
32
  import { inlineExpressionFunctions } from "../../ir/expression-inlining.js";
32
33
  import { inlineArrayReads, NO_INLINE_ARRAYS, planInlineArrays, } from "../../ir/inline-arrays.js";
33
34
  import { inlineArraysApply, programLifetimeClassOf } from "./inline-arrays.js";
34
35
  import { pairRowSums } from "../../ir/row-pairs.js";
35
36
  import { jamSaturatingLoops } from "../../ir/saturating-loop-jams.js";
37
+ import { jamRuntimeCountLoops } from "../../ir/runtime-jam-loops.js";
36
38
  import { allocatedLiteral, fillAllocationLength, int32ArrayKey, selectInt32Arrays, } from "../../ir/int32-arrays.js";
37
39
  import { everyExpr, everyExprChild, everyStmtChild, everyStmtList } from "../../ir/traverse.js";
38
40
  import { INT32_RANGE, withinInt32, } from "../../ir/integer-ranges.js";
@@ -47,6 +49,7 @@ import { dropUnwrittenPropertyBags } from "../../ir/property-bags.js";
47
49
  import { freezeInitOnlyGlobals } from "../../ir/init-only-globals.js";
48
50
  import { hoistFinalFieldReads } from "../../ir/field-values.js";
49
51
  import { holdCharLocalsAsUnits } from "../../ir/char-unit-locals.js";
52
+ import { versionUnionArmLoops } from "../../ir/union-arm-loops.js";
50
53
  import { unitSafeFunctions } from "./string-unit-versions.js";
51
54
  import { stringScanInline } from "./string-reads.js";
52
55
  import { findInt32Abis, INT32_ABI_SUFFIX, SCALAR_UNION_DUMMY, SCALAR_UNION_RESULT, } from "./int32-abi.js";
@@ -73,6 +76,7 @@ import { borrowsCheckedNarrow, CheckedNarrows } from "./checked-narrows.js";
73
76
  import { emitDenseArraySet, emitDenseSlotUnlink, SCR_ELEM_I32, } from "./dense-array-access.js";
74
77
  import { matchMapRead, pointerMapGet } from "./map-read-lifetimes.js";
75
78
  import {} from "./map-entry-fusion.js";
79
+ import {} from "./record-entry-fusion.js";
76
80
  import { emitBorrowedFieldSequence, guardedValue } from "./borrowed-receivers.js";
77
81
  import { emitBorrowedInputs } from "./borrowed-inputs.js";
78
82
  import { findWalkBorrows } from "./walk-borrows.js";
@@ -96,13 +100,13 @@ import { emitCallExpr } from "./expr-calls.js";
96
100
  import { emitDynamicExpr } from "./expr-dynamic.js";
97
101
  import { emitIntrinsicExpr, emitSerializationExpr, emitAsyncExpr } from "./expr-async.js";
98
102
  import { PublishWalkers } from "./publish.js";
99
- import { computeImmutableFields, stableGlobals } from "../immutability.js";
103
+ import { computeConstructionFacts, computeImmutableFields, stableGlobals, } from "../immutability.js";
100
104
  import { computeCycleMutability, hierarchyUnitOfClass } from "../cycle-mutability.js";
101
105
  import { computePublishedTypes } from "../publication.js";
102
106
  import { emitExpr } from "./expr-dispatch.js";
103
107
  import { LOOPS } from "./loop-state.js";
104
108
  import { dynKind, raceAdapterFor, genResultThunkFor, childExitThunkFor, childExitSignalThunkFor, childDataDynThunkFor, childDataThunkFor, execFileThunkFor, ipcMessageThunkFor, ipcSendThunkFor, emitterFixedAdapter, emitterOnceAdapter, wrapEmitterListener, unwrapNullableClosure, closeBindThunkFor, closeOverrideWrapFor, } from "./expr-callbacks.js";
105
- import { streamDataAdapter, streamDoneFnFor, cryptoBytesThunkFor, cryptoIntThunkFor, fsRenameThunkFor, streamCbThunkFor, zlibBytesThunkFor, } from "./expr-stream-callbacks.js";
109
+ import { streamDataAdapter, streamDoneFnFor, cryptoBytesThunkFor, cryptoIntThunkFor, fsRenameThunkFor, watchNameThunkFor, watchErrorThunkFor, streamCbThunkFor, zlibBytesThunkFor, } from "./expr-stream-callbacks.js";
106
110
  import { emitStableReceiver, resolveThunkFor, tagInSet, arrPush, emitArrayCopyLoop, emitStrIntrinsic, emitArrIntrinsic, wrapNullable, emitMapNew, mapSet, emitMapLikeIntrinsic, emitSetNew, } from "./expr-containers.js";
107
111
  import { emitIntegerLoopIndex, emitBytesIndex, emitBytesData, emitBytesLength, emitBytesGet, emitToUint32, emitBytesSet, emitBytesIntrinsic, } from "./expr-bytes.js";
108
112
  import { borrowedRecordKeyGetOr, emitRecordKeyGet, emitRegexIntrinsic, immortalDefault, keyedRecordReadInto, pointerRecordKeyGet, } from "./expr-records.js";
@@ -114,11 +118,12 @@ import { emitNetworkHttpLibCall } from "./lib-network.js";
114
118
  import { emitAssertInspectLibCall, emitIoLibCall, emitGenericLibCall, emitLibCall, } from "./lib-dispatch.js";
115
119
  import { assignCompactLayouts, buildClassGraph, classFieldTypes, classMembershipIntervals, classFieldIndex, compactRefLoadLines, compactRefStoreLines, classPreLines, classStructSym, programLifetimeClass, } from "./classes.js";
116
120
  import { LifetimeRegions, REGION_TYPES } from "./regions.js";
121
+ import { planTreeClasses } from "../tree-classes.js";
117
122
  import { arenaAware, arenaCurrentAddress, arenaNewSym, arenasRequested, planArenas, } from "./arenas.js";
118
123
  import { children } from "./region-ir.js";
119
124
  import { LlDyn, recordDynKeepsIdentity } from "./dyn.js";
120
125
  import { VirtualBorrows } from "./virtual-borrows.js";
121
- import { planRecordViews, recordViewFieldPtr } from "./record-views.js";
126
+ import { absentTrapLines, planRecordViews, recordViewFieldPtr, recordViewTestLines, } from "./record-views.js";
122
127
  import { LlvmUnsupportedError } from "./unsupported.js";
123
128
  import { LlWalkers } from "./walkers.js";
124
129
  import { isObjectArm, isPayloadTag, NULLABLE_ABSENT, NULLABLE_NULL, NullableUnions, pointerTagFn, } from "./nullable-unions.js";
@@ -171,16 +176,18 @@ export function lowRegionTarget(platform, sanitize) {
171
176
  /** Function versions on loop-bounding number parameters
172
177
  * (ir/parameter-versions.ts). Library builds have no int32 entries, and a
173
178
  * module that observes call stacks could see the version's frame. */
174
- function versionParameters(mod) {
175
- if (mod.lib !== undefined || observesStacks(mod))
179
+ function versionParameters(mod, nodes) {
180
+ if (mod.lib !== undefined || observesStacks(mod, nodes))
176
181
  return mod;
177
- return versionLoopBoundParameters(mod, mangleFunction);
182
+ return versionLoopBoundParameters(mod, mangleFunction, nodes);
178
183
  }
179
184
  /** The int32 slot analysis of `mod`, with the inputs LlEmitter gives it.
180
185
  * With `revise`, the analysis revises the functions of candidates that drop
181
- * (Int32SlotInputs.revise), and `mod` is the module it started from. */
182
- function analyzeModuleInt32Slots(mod, revise) {
183
- const nodeIndex = new IrNodeIndex(mod);
186
+ * (Int32SlotInputs.revise), and `mod` is the module it started from. The
187
+ * node index of `mod` takes the nodes `previous` recorded for the functions
188
+ * both hold. */
189
+ function analyzeModuleInt32Slots(mod, previous, revise) {
190
+ const nodeIndex = new IrNodeIndex(mod, previous);
184
191
  const initializerBindings = findInitializerBindings(mod, nodeIndex);
185
192
  const dynamicStores = dynamicFieldStores(mod, undefined, undefined, nodeIndex);
186
193
  const slots = analyzeInt32Slots(mod, {
@@ -200,7 +207,7 @@ function keptInt32Arrays(analysis) {
200
207
  * node index of `mod`, and its initializer bindings and dynamic stores,
201
208
  * which must be the ones the analysis read. Null when they differ. */
202
209
  function revisedAnalysis(analysis, mod) {
203
- const nodeIndex = new IrNodeIndex(mod);
210
+ const nodeIndex = new IrNodeIndex(mod, analysis.nodeIndex);
204
211
  const initializerBindings = findInitializerBindings(mod, nodeIndex);
205
212
  const dynamicStores = dynamicFieldStores(mod, undefined, undefined, nodeIndex);
206
213
  const read = analysis.initializerBindings;
@@ -249,16 +256,19 @@ function moduleEmitter(input, options) {
249
256
  // Each proof selectInt32Arrays asks for analyzes a marked module; the
250
257
  // emitter of the module it returns reuses the last one. A proof that
251
258
  // revised functions analyzed the module of the functions it ended with.
252
- const rounds = { last: null, functions: null, revising: true };
259
+ // Each round's node index takes the recorded nodes of the functions it
260
+ // shares with the latest index (`nodes`).
261
+ const rounds = { last: null, functions: null, revising: true, nodes: undefined };
253
262
  const proven = (marked, revise) => {
254
263
  rounds.functions = null;
255
264
  if (revise === null || !rounds.revising) {
256
- rounds.last = analyzeModuleInt32Slots(marked);
265
+ rounds.last = analyzeModuleInt32Slots(marked, rounds.nodes);
266
+ rounds.nodes = rounds.last.nodeIndex;
257
267
  return { kept: keptInt32Arrays(rounds.last), functions: null };
258
268
  }
259
269
  const latest = new Map();
260
270
  try {
261
- rounds.last = analyzeModuleInt32Slots(marked, (fnName, dropped) => {
271
+ rounds.last = analyzeModuleInt32Slots(marked, rounds.nodes, (fnName, dropped) => {
262
272
  const fn = revise(fnName, dropped);
263
273
  latest.set(fnName, fn);
264
274
  return fn;
@@ -270,6 +280,7 @@ function moduleEmitter(input, options) {
270
280
  rounds.last = null;
271
281
  return null;
272
282
  }
283
+ rounds.nodes = rounds.last.nodeIndex;
273
284
  if (latest.size === 0)
274
285
  return { kept: keptInt32Arrays(rounds.last), functions: null };
275
286
  rounds.functions = marked.functions.map((fn) => latest.get(fn.name) ?? fn);
@@ -279,7 +290,13 @@ function moduleEmitter(input, options) {
279
290
  if (options.debugSources !== undefined)
280
291
  return new LlEmitter(mod, options, null, null);
281
292
  const timing = options.timing ?? (() => { });
282
- const passed = versionParameters(addRecordResultEntries(scalarizeLiteralResults(scalarizeNumericRecords(specializeCallbackCalls(specializeNumericCalls(pairRowSums(jamSaturatingLoops(inlineArraysPass(options, inlineExpressionFunctions(foldConstantGlobals(copyStableCaptures(resolveSelfCaptures(hoistFinalFieldReads(freezeInitOnlyGlobals(holdCharLocalsAsUnits(dropUnwrittenPropertyBags(runPairedWhileLoopsAsFor(mod)))))))))))), mangleFunction), mangleFunction)))));
293
+ // One index of the module the passes start from. Each pass skips the
294
+ // functions the index records without the node kinds it rewrites, and
295
+ // reads its scans of whole bodies from the index; it walks the functions
296
+ // an earlier pass rewrote, which the index does not record.
297
+ const nodes = new IrNodeIndex(mod);
298
+ 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);
283
300
  timing("llvm-emit-rewrites");
284
301
  let emitted = selectInt32Arrays(passed, proven, resultEntryTargets);
285
302
  let prepared = rounds.last;
@@ -303,7 +320,7 @@ function moduleEmitter(input, options) {
303
320
  if (process.env["SCRIPTC_INT32_VERIFY"] === "1")
304
321
  verifyInt32Selection(passed, emitted, prepared?.mod === emitted ? prepared : null);
305
322
  timing("llvm-emit-int32");
306
- const emitter = new LlEmitter(emitted, options, null, prepared?.mod === emitted ? prepared : null);
323
+ const emitter = new LlEmitter(emitted, options, null, prepared?.mod === emitted ? prepared : null, rounds.nodes);
307
324
  timing("llvm-emit-analyses");
308
325
  return emitter;
309
326
  }
@@ -313,13 +330,13 @@ function moduleEmitter(input, options) {
313
330
  function verifyInt32Selection(passed, emitted, analysis) {
314
331
  let last = null;
315
332
  const reference = selectInt32Arrays(passed, (marked) => {
316
- last = analyzeModuleInt32Slots(marked);
333
+ last = analyzeModuleInt32Slots(marked, undefined);
317
334
  return { kept: keptInt32Arrays(last), functions: null };
318
335
  }, resultEntryTargets);
319
336
  const text = (mod) => serializeModuleParts(mod).join("");
320
337
  if (text(reference) !== text(emitted))
321
338
  throw new InternalCompilerError("int32 selection: the revised module differs from the rounds'");
322
- const facts = (mod, prepared) => (prepared?.mod === mod ? prepared : analyzeModuleInt32Slots(mod)).slots.summary(mod);
339
+ const facts = (mod, prepared) => (prepared?.mod === mod ? prepared : analyzeModuleInt32Slots(mod, undefined)).slots.summary(mod);
323
340
  const expected = facts(reference, last);
324
341
  const actual = facts(emitted, analysis);
325
342
  if (expected !== actual) {
@@ -382,6 +399,7 @@ const GLOBAL_WRITE_KINDS = ["assign", "varDecl", "assignExpr", "incDec"];
382
399
  const POLL_EVERY_ITERATION = "%worker.poll.every";
383
400
  /** Runtime library calls (readsLoopMetrics). */
384
401
  const LIB_CALL_KINDS = ["libCall"];
402
+ const CLOSURE_KINDS = ["closure"];
385
403
  /** [A-Za-z0-9_] */
386
404
  function isIdentifierByte(code) {
387
405
  return ((code >= 48 && code <= 57) ||
@@ -395,6 +413,25 @@ function isIdentifierByte(code) {
395
413
  * to its next suspension, which returns to the caller, and the body's own
396
414
  * bookkeeping calls do not suspend it. */
397
415
  export const SUSPENDS = /@(?:scr_(?:await_|module_await\b|promise_await_settled\b|test_sub\b|gen_yield_|async_gen_(?!new\b|next_|return_|throw\b|hop_done\b)|fiber_)|sc_a[wd]_)/;
416
+ /** The literal text each SUSPENDS alternative starts with. The `@scr_` prefix
417
+ * is joined to each suffix here so that a prefix is not read as an emitted
418
+ * symbol name by the runtime ABI scan. */
419
+ const SUSPEND_PREFIXES = [
420
+ "await_",
421
+ "module_await",
422
+ "promise_await_settled",
423
+ "test_sub",
424
+ "gen_yield_",
425
+ "async_gen_",
426
+ "fiber_",
427
+ ]
428
+ .map((suffix) => `@scr_${suffix}`)
429
+ .concat("@sc_aw_", "@sc_ad_");
430
+ /** Whether `text` mentions a SUSPENDS entry point. The regex runs only on
431
+ * text that holds one of its prefixes, which most function bodies do not. */
432
+ export function mentionsSuspension(text) {
433
+ return SUSPEND_PREFIXES.some((prefix) => text.includes(prefix)) && SUSPENDS.test(text);
434
+ }
398
435
  /** The suspensions of a fiber body's own awaits, which its stackless
399
436
  * coroutine form suspends itself at instead. */
400
437
  const AWAIT_SUSPENSIONS = /@(?:scr_await_(?:void|f64|bool|str|ref|hop|dyn_value)\b|sc_a[wd]_[A-Za-z0-9_]+)/g;
@@ -503,6 +540,10 @@ export class LlEmitter {
503
540
  mod;
504
541
  /** Per-feature state (emitter-state.ts), indexed by each key's slot. */
505
542
  moduleStates = [];
543
+ /** The names of the functions that `versionLoopBoundParameters` versions
544
+ * for int32 loop bounds: the ones that keep their name and call the copy
545
+ * and the fallback. Computed on first use. */
546
+ int32Versioned = null;
506
547
  localArrayReads = new Map();
507
548
  loopArrayBorrows = new Set();
508
549
  scalarStringSlices = new Map();
@@ -526,7 +567,7 @@ export class LlEmitter {
526
567
  fieldAliasTags = new Map();
527
568
  fieldPointerTags = new Map();
528
569
  /** The field pointers (classFieldPtr) of this function whose fields hold
529
- * 32-bit references to compact class instances (LlClassMeta.compressed):
570
+ * 32-bit references (LlClassMeta.compressed):
530
571
  * loadField/loadRef decode them and storeField/storeRef encode them. */
531
572
  compressedFieldPtrs = new Set();
532
573
  /** Compact class instances live in the program-lifetime region below
@@ -534,6 +575,12 @@ export class LlEmitter {
534
575
  * classes): main reserves it before compiled code runs (scr_plr_init), and
535
576
  * fields and arrays of compactRefType hold 32-bit references. */
536
577
  compactRegion = false;
578
+ /** A compact class has a field holding an array, a map, a set or a heap
579
+ * instance (windowRefType), so a reference to it is a 32-bit address of
580
+ * the allocator's window: main requires the window to serve every
581
+ * reference block (scr_sa_require_window), and ends the process when it
582
+ * cannot, rather than hand out an address a field would truncate. */
583
+ windowRefs = false;
537
584
  /** Native class fields with different property names cannot occupy the
538
585
  * same slot of one object. Inherited views of the same property share a
539
586
  * tag. Array storage has its own disjoint categories; untagged runtime
@@ -838,6 +885,9 @@ export class LlEmitter {
838
885
  sanitizeAttributes;
839
886
  /** LlvmTargetOptions.cpuDispatch, where it applies. */
840
887
  cpuDispatch;
888
+ /** How the program's functions are copied (cpu-dispatch.ts): for runtime
889
+ * dispatch, for an x86-64-v3 `targetCpu` ("target"), or not at all. */
890
+ cpuCopies;
841
891
  wasmBoundsChecks;
842
892
  /** Interned string literals: UTF-8 text → { symbol, byte length } —
843
893
  * first-use order, the runtime ABI’s determinism discipline. */
@@ -912,6 +962,10 @@ export class LlEmitter {
912
962
  rcMode;
913
963
  rcHelpersNoinline;
914
964
  fnByName = new Map();
965
+ /** Whether some closure has a jsval body (IrFunction.jsEntry): the
966
+ * dynamic tier's dynCall and dynInvoke sites then call a function value's
967
+ * jsval entry when it has one. */
968
+ jsEntries = false;
915
969
  /** Empty literals that construct with inline slots (appended-array-literals.ts). */
916
970
  appendedArrayLiterals = new Set();
917
971
  /** Emitted LLVM text of every IR function body, by function name: the
@@ -939,6 +993,8 @@ export class LlEmitter {
939
993
  numberMapKeyIntegers = new Map();
940
994
  /** The current function's fused string-key Map get-then-set pairs (map-entry-fusion.ts). */
941
995
  mapEntryFusion = null;
996
+ /** The current function's fused record get-then-set pairs (record-entry-fusion.ts). */
997
+ recordEntryFusion = null;
942
998
  callLifetimes;
943
999
  /** The locals whose value never leaves its frame (frame-escapes.ts), for
944
1000
  * class instances with reference fields in frame storage. */
@@ -1026,6 +1082,9 @@ export class LlEmitter {
1026
1082
  /** Static types whose values can be published (@scriptc/threads): their
1027
1083
  * stores carry the frozen-object guard. Null without publish calls. */
1028
1084
  publishedTypes;
1085
+ /** Constructor stores that write a field's first value (immutability.ts
1086
+ * computeConstructionFacts): they store without releasing an old value. */
1087
+ freshFieldStores;
1029
1088
  /** Construction-only class and record fields (immutability.ts); null
1030
1089
  * where the facts are disabled. */
1031
1090
  immutableFields;
@@ -1097,6 +1156,11 @@ export class LlEmitter {
1097
1156
  arraySearchKinds = new Set();
1098
1157
  /** Typed-ref recipe constants by type key (lazy receivers). */
1099
1158
  typedRefRecipes = new Map();
1159
+ /** The module links narrowed record copies to their sources
1160
+ * (IrModule.recordLinks). */
1161
+ hasRecordLinks() {
1162
+ return (this.mod.recordLinks?.length ?? 0) > 0;
1163
+ }
1100
1164
  /** ReadableStream.from adapters keep typed arrays by reference and box
1101
1165
  * one current element per pull. */
1102
1166
  streamFromArrayAdapters = new Map();
@@ -1132,6 +1196,18 @@ export class LlEmitter {
1132
1196
  * zero-initialized ScrJsIc per site (scr_js.h). */
1133
1197
  jsIcSiteCount = 0;
1134
1198
  jsIcSitesMemo;
1199
+ /** Guard-group records of dynamic-tier functions (js-groups.ts): one
1200
+ * zero-initialized ScrJsGroup per group, and the key arrays the probes
1201
+ * read (scr_js.h). */
1202
+ jsGroupCount = 0;
1203
+ jsGroupKeysCount = 0;
1204
+ jsGroupKeysByName = new Map();
1205
+ jsGroupKeysByText = new Map();
1206
+ /** The guard of each group the function being emitted has entered: the
1207
+ * entry value, and the position of the member that comes next. */
1208
+ groupRuns = new Map();
1209
+ /** The guard groups of the function being emitted (ir/js-groups.ts). */
1210
+ jsGroupPlan = null;
1135
1211
  /** The tier of the function being emitted. */
1136
1212
  currentTier = undefined;
1137
1213
  /** The class graph (buildClassGraph): preorder numbering, hierarchy
@@ -1405,7 +1481,7 @@ export class LlEmitter {
1405
1481
  journaled;
1406
1482
  /** Stack-trace mode: functions no capture can include (no frame push). */
1407
1483
  unframedFunctions;
1408
- constructor(mod, options, journal = null, int32Analysis = null) {
1484
+ constructor(mod, options, journal = null, int32Analysis = null, previousIndex) {
1409
1485
  this.mod = mod;
1410
1486
  this.targetOptions = options;
1411
1487
  this.journal = journal;
@@ -1413,8 +1489,9 @@ export class LlEmitter {
1413
1489
  journal !== null ||
1414
1490
  ((options.functionWorkers ?? 1) > 1 && options.forkPrimitives !== undefined);
1415
1491
  // One walk of every body, which the analyses below read instead of
1416
- // walking the bodies themselves.
1417
- this.nodeIndex = int32Analysis?.nodeIndex ?? new IrNodeIndex(mod);
1492
+ // walking the bodies themselves. The functions `previousIndex` (an index
1493
+ // of an earlier module) recorded are not walked again.
1494
+ this.nodeIndex = int32Analysis?.nodeIndex ?? new IrNodeIndex(mod, previousIndex);
1418
1495
  this.initializerBindings =
1419
1496
  int32Analysis?.initializerBindings ?? findInitializerBindings(mod, this.nodeIndex);
1420
1497
  // One walk finds the dynamic field stores every analysis below consults.
@@ -1482,13 +1559,16 @@ export class LlEmitter {
1482
1559
  this.nodeIslandModuleData = options.nodeIslandModuleData ?? null;
1483
1560
  this.targetCpu = options.targetCpu;
1484
1561
  this.sanitizeAttributes = options.sanitizeAttributes !== false;
1485
- this.cpuDispatch =
1486
- options.cpuDispatch === true &&
1487
- options.targetCpu === undefined &&
1488
- !this.wasi &&
1489
- mod.lib === undefined &&
1490
- this.debug === null &&
1491
- /^(x86_64|amd64|x64)\b/.test(options.targetTriple || process.arch);
1562
+ const copyable = !this.wasi &&
1563
+ mod.lib === undefined &&
1564
+ this.debug === null &&
1565
+ /^(x86_64|amd64|x64)\b/.test(options.targetTriple || process.arch);
1566
+ this.cpuDispatch = options.cpuDispatch === true && options.targetCpu === undefined && copyable;
1567
+ this.cpuCopies = this.cpuDispatch
1568
+ ? "dispatch"
1569
+ : options.targetCpu === "x86-64-v3" && copyable
1570
+ ? "target"
1571
+ : null;
1492
1572
  this.wasmBoundsChecks =
1493
1573
  options.wasmBoundsChecks === true ||
1494
1574
  wasmBoundsChecks({
@@ -1504,8 +1584,11 @@ export class LlEmitter {
1504
1584
  this.ffiCallbackAdapters = allocateFfiCallbackAdapters(mod.ffiImports ?? []);
1505
1585
  this.ffiHasRetainedCallback = hasRetainedFfiCallback(mod.ffiImports ?? []);
1506
1586
  this.ffiHasForeignCallback = hasForeignFfiCallback(mod.ffiImports ?? []);
1507
- for (const fn of mod.functions)
1587
+ for (const fn of mod.functions) {
1508
1588
  this.fnByName.set(fn.name, fn);
1589
+ if (fn.jsEntry !== undefined)
1590
+ this.jsEntries = true;
1591
+ }
1509
1592
  this.appendedArrayLiterals = findAppendedArrayLiterals(mod, this.nodeIndex);
1510
1593
  for (const entry of mod.ffiImports ?? []) {
1511
1594
  this.ffiByName.set(entry.name, entry);
@@ -1514,7 +1597,9 @@ export class LlEmitter {
1514
1597
  // and per async fiber; WASI, Windows and library builds have none.
1515
1598
  const triple = (options.targetTriple ?? "").toLowerCase();
1516
1599
  const windows = triple === "" ? process.platform === "win32" : triple.includes("windows");
1517
- this.publishedTypes = computePublishedTypes(mod, this.nodeIndex);
1600
+ const construction = computeConstructionFacts(mod, this.nodeIndex);
1601
+ this.freshFieldStores = construction.freshStores;
1602
+ this.publishedTypes = computePublishedTypes(mod, this.nodeIndex, construction);
1518
1603
  const mt = computeMayThrow(mod, {
1519
1604
  stackChecks: !this.wasi && mod.lib === undefined && !windows,
1520
1605
  published: this.publishedTypes,
@@ -1674,6 +1759,9 @@ export class LlEmitter {
1674
1759
  // The same holds for a class union's arms (class-unions.ts).
1675
1760
  classUnionHeaders(mod, this.nullableUnions.allClassUnions(), this.tracedShapes, this.tracedUnions);
1676
1761
  this.shapeHost = {
1762
+ ...((mod.recordLinks?.length ?? 0) > 0
1763
+ ? { recordSourcesGate: RECORD_KEPT_GATE, recordLinks: mod.recordLinks }
1764
+ : {}),
1677
1765
  // Journal hooks only on emitters that can emit ranges (chunk
1678
1766
  // emitters, and emitters whose workers take a journal after the
1679
1767
  // fork), so the host's optional calls cost nothing otherwise.
@@ -1689,6 +1777,7 @@ export class LlEmitter {
1689
1777
  ? undefined
1690
1778
  : (table, key, value) => this.journal?.entry(table, key, value),
1691
1779
  compactArrayElem: (elem) => this.compactArrayElem(elem),
1780
+ jsEntryClosures: () => this.jsEntryClosures(),
1692
1781
  compactRegion: () => this.compactRegion,
1693
1782
  sizeType: this.sizeType,
1694
1783
  cycleBufOffset: this.cycleBufOffset,
@@ -1709,6 +1798,8 @@ export class LlEmitter {
1709
1798
  // Worker programs keep one allocator per script thread: the inline
1710
1799
  // paths address its thread-local state.
1711
1800
  threadLocalAlloc: mod.workers === true,
1801
+ // Linux executables find a block's owner in the chunk map.
1802
+ windowMap: options.lowRegion === true,
1712
1803
  rcHelpers: this.rcHelpers,
1713
1804
  ...(this.rcMode !== undefined ? { rcMode: this.rcMode } : {}),
1714
1805
  ...(this.rcHelpersNoinline ? { rcHelpersNoinline: true } : {}),
@@ -1746,6 +1837,7 @@ export class LlEmitter {
1746
1837
  classValueAbiEquals(this.classMetaOf(sub).def, target, this.fnByName));
1747
1838
  },
1748
1839
  pendingTestLines: (dest) => this.pendingTestLines(dest),
1840
+ closureNames: () => this.closureNames(),
1749
1841
  virtualEntry: (implFn) => this.virtualEntry(implFn),
1750
1842
  programLifetime: this.programLifetime,
1751
1843
  regionAliasTag: (word) => this.memoryAliasAttachment(`region.${word}`),
@@ -1871,12 +1963,14 @@ export class LlEmitter {
1871
1963
  // except where regions count them or a slot word follows the header.
1872
1964
  if (this.sizeType === "i64" && mod.lifetimeRegions !== true)
1873
1965
  assignCompactLayouts(this.classMeta, (root) => programLifetimeClass(this.shapeHost, root) && !root.threadSlot, (cls) => classFieldTypes(this.shapeHost, cls, this.int32Slots),
1874
- // Executables whose region lies below 32 GiB hold compact class
1875
- // instances there (scr_plr_alloc), so fields referring to one store
1876
- // a 32-bit reference: the field's type, the class of a
1877
- // `C | undefined` or `C | null` pointer, or the reference arm of a
1878
- // nullable pointer field, is a compact class. `C | null | undefined`
1879
- // keeps the pointer: its null is a sentinel outside the region.
1966
+ // Executables whose window lies below 32 GiB hold compact class
1967
+ // instances there (scr_plr_alloc), and arrays, maps, sets and other
1968
+ // class instances too, so fields referring to one store a 32-bit
1969
+ // reference: the field's type, the class of a `C | undefined` or
1970
+ // `C | null` pointer, or the reference arm of a nullable pointer
1971
+ // field, is a compact class, or windowRefType holds. `C | null |
1972
+ // undefined` keeps the pointer: its null is a sentinel outside the
1973
+ // region.
1880
1974
  mod.lib === undefined && options.lowRegion === true
1881
1975
  ? (cls, i, isCompact) => {
1882
1976
  const f = cls.fields[i];
@@ -1884,6 +1978,10 @@ export class LlEmitter {
1884
1978
  return false;
1885
1979
  if (this.compactRefType(f.type, isCompact))
1886
1980
  return true;
1981
+ if (this.windowRefType(f.type, isCompact)) {
1982
+ this.windowRefs = true;
1983
+ return true;
1984
+ }
1887
1985
  const nullable = f.type.kind === "union" && this.nullableUnions.single(f.type.unionId) === null
1888
1986
  ? this.nullableFields.get(cls.name, f.name)
1889
1987
  : null;
@@ -1894,8 +1992,53 @@ export class LlEmitter {
1894
1992
  mod.lib === undefined &&
1895
1993
  options.lowRegion === true &&
1896
1994
  [...this.classMeta.values()].some((m) => m.compact);
1995
+ for (const [name, rec] of RUNTIME_ERROR_CLASSES) {
1996
+ const meta = this.classMeta.get(name);
1997
+ if (!meta)
1998
+ break; // hand-written IR without the builtin defs: no stamps
1999
+ this.errorIntervals.push({ kind: rec.kind, pre: meta.pre, post: meta.post, lib: rec.lib });
2000
+ }
2001
+ const emMeta = this.classMeta.get(RUNTIME_EMITTER_CLASS);
2002
+ if (emMeta)
2003
+ this.emitterInterval = { pre: emMeta.pre, post: emMeta.post };
2004
+ for (const [name, rec] of RUNTIME_STREAM_CLASSES) {
2005
+ const meta = this.classMeta.get(name);
2006
+ if (!meta)
2007
+ continue;
2008
+ this.streamIntervals.push({
2009
+ vt: `scr_${rec.lib.toLowerCase()}_vt`,
2010
+ pre: meta.pre,
2011
+ post: meta.post,
2012
+ lib: rec.lib,
2013
+ });
2014
+ }
2015
+ this.virtualBorrows = new VirtualBorrows(mod, this.classMeta, this.fnByName, this.callLifetimes.borrowed);
2016
+ // After the vtable slots: borrowing slots exclude their implementations.
2017
+ if (this.debug === null)
2018
+ this.analyzeBorrowedReturns();
2019
+ // Which classes drop their count word: a node of a graph the program
2020
+ // proves acyclic, singly owned and unobserved (backend/tree-classes.ts,
2021
+ // out/unique-ownership/DESIGN.md). The linear-use analysis agrees with
2022
+ // the emitter's own ownership discipline, so it reads the facts above
2023
+ // and nothing else. A debug build skips the borrowed-return analysis
2024
+ // this needs; it keeps every class counted.
2025
+ if (this.debug === null && mod.lib === undefined && mod.lifetimeRegions !== true) {
2026
+ const plan = planTreeClasses(mod, {
2027
+ borrowed: this.callLifetimes.borrowed,
2028
+ borrowedReturns: this.borrowedReturns,
2029
+ traced: { shapes: this.tracedShapes, unions: this.tracedUnions },
2030
+ immutable: this.immutableFields,
2031
+ published: this.publishedTypes,
2032
+ });
2033
+ for (const name of plan.classes)
2034
+ this.classMeta.get(name).tree = true;
2035
+ this.treeMoves = plan.classes.size > 0 ? new Set(plan.moves) : null;
2036
+ }
1897
2037
  // Group arenas: off with lifetime regions, which own their classes'
1898
2038
  // allocation, and in libraries, whose exports any host code calls.
2039
+ // Planned after the tree classes, which keep the general allocator:
2040
+ // their teardown is a plain free, and an arena block's disposal runs
2041
+ // the counted path.
1899
2042
  if (arenasRequested() && mod.lifetimeRegions !== true && mod.lib === undefined) {
1900
2043
  this.arenas = planArenas(mod, {
1901
2044
  shape: (id) => {
@@ -1909,6 +2052,7 @@ export class LlEmitter {
1909
2052
  const meta = this.classMeta.get(def.name);
1910
2053
  return (meta !== undefined &&
1911
2054
  !meta.compact &&
2055
+ !meta.tree &&
1912
2056
  !meta.threadSlot &&
1913
2057
  // An Array subclass's instance is an array (the runtime's header).
1914
2058
  def.arrayElem === undefined &&
@@ -1918,6 +2062,7 @@ export class LlEmitter {
1918
2062
  },
1919
2063
  nullableArm: (unionId) => this.nullableUnions.single(unionId)?.arm ?? null,
1920
2064
  traced: (t) => traceAdapter(this.shapeHost, t) !== null,
2065
+ tree: (def) => this.classMeta.get(def.name)?.tree === true,
1921
2066
  });
1922
2067
  if (this.arenas !== null) {
1923
2068
  this.shapeHost.arenaShapes = this.arenas.shapes;
@@ -1933,30 +2078,6 @@ export class LlEmitter {
1933
2078
  if (arenaShapes !== undefined && viewTargets !== null)
1934
2079
  for (const id of arenaShapes)
1935
2080
  viewTargets.delete(id);
1936
- for (const [name, rec] of RUNTIME_ERROR_CLASSES) {
1937
- const meta = this.classMeta.get(name);
1938
- if (!meta)
1939
- break; // hand-written IR without the builtin defs: no stamps
1940
- this.errorIntervals.push({ kind: rec.kind, pre: meta.pre, post: meta.post, lib: rec.lib });
1941
- }
1942
- const emMeta = this.classMeta.get(RUNTIME_EMITTER_CLASS);
1943
- if (emMeta)
1944
- this.emitterInterval = { pre: emMeta.pre, post: emMeta.post };
1945
- for (const [name, rec] of RUNTIME_STREAM_CLASSES) {
1946
- const meta = this.classMeta.get(name);
1947
- if (!meta)
1948
- continue;
1949
- this.streamIntervals.push({
1950
- vt: `scr_${rec.lib.toLowerCase()}_vt`,
1951
- pre: meta.pre,
1952
- post: meta.post,
1953
- lib: rec.lib,
1954
- });
1955
- }
1956
- this.virtualBorrows = new VirtualBorrows(mod, this.classMeta, this.fnByName, this.callLifetimes.borrowed);
1957
- // After the vtable slots: borrowing slots exclude their implementations.
1958
- if (this.debug === null)
1959
- this.analyzeBorrowedReturns();
1960
2081
  this.int32SlotsValue ??= this.joinInt32Slots();
1961
2082
  }
1962
2083
  /** Computes the int32 slot analysis, or starts it on a forked process.
@@ -2041,9 +2162,62 @@ export class LlEmitter {
2041
2162
  emitParts() {
2042
2163
  const parts = emitParts(this);
2043
2164
  const bridged = this.unwindAbi.size > 0 ? bridgePlainUnwindCalls(parts) : parts;
2044
- const out = this.cpuDispatch ? cloneForCpuDispatch(bridged) : bridged;
2165
+ const out = this.cpuCopies === null ? bridged : cloneForCpuDispatch(bridged, this.cpuCopies);
2045
2166
  return this.heapCensus === null ? out : [...out, this.heapCensus.definitions().join("\n")];
2046
2167
  }
2168
+ /** The entry point and JavaScript name of each named function the
2169
+ * module makes closures of: a declared function's wrapper (its interned
2170
+ * closure's entry) or a lifted function's call target, with its
2171
+ * displayName, else its sourceName. Function boxes without a static name
2172
+ * look the closure's entry up in this table. */
2173
+ closureNameEntries;
2174
+ closureNameByEntry;
2175
+ /** The declared functions `closureNames` lists by their wrapper. A scan
2176
+ * sees closures in statements the emitter never reaches (a statement
2177
+ * after a runtimeFence: the fence always jumps), so some of these names
2178
+ * never enter `fnValues`; emitFnValueDefs defines their wrapper anyway,
2179
+ * because the table's entry has to resolve. */
2180
+ closureWrapperNames = new Set();
2181
+ closureNames() {
2182
+ if (this.closureNameEntries !== undefined)
2183
+ return this.closureNameEntries;
2184
+ const entries = new Map();
2185
+ this.closureNameByEntry = entries;
2186
+ const scan = this.nodeIndex.scan(CLOSURE_KINDS);
2187
+ for (const fn of this.mod.functions) {
2188
+ eachNodeOfKinds(fn, scan, (node) => {
2189
+ if (node.kind !== "closure")
2190
+ return true;
2191
+ const target = this.fnByName.get(node.fnName);
2192
+ const name = target?.displayName ??
2193
+ (target?.sourceName !== "<anonymous>" ? target?.sourceName : undefined);
2194
+ if (target === undefined || name === undefined || name === "")
2195
+ return true;
2196
+ const entry = this.closureEntry(node.fnName, target);
2197
+ if (target.captures === undefined)
2198
+ this.closureWrapperNames.add(node.fnName);
2199
+ if (!entries.has(entry))
2200
+ entries.set(entry, name);
2201
+ return true;
2202
+ });
2203
+ }
2204
+ return (this.closureNameEntries = [...entries].map(([entry, name]) => ({ entry, name })));
2205
+ }
2206
+ /** The entry point of a closure of `fnName` (closureNames). */
2207
+ closureEntry(fnName, target) {
2208
+ return target.captures === undefined ? mangleWrapper(fnName) : this.callTarget(fnName);
2209
+ }
2210
+ /** The name the closure-name table gives a closure made of `fnName`
2211
+ * (null when it has none), which lets a box of a closure made at the site
2212
+ * skip the table lookup; undefined for a function the module does not
2213
+ * define. */
2214
+ closureNameOf(fnName) {
2215
+ const target = this.fnByName.get(fnName);
2216
+ if (target === undefined)
2217
+ return undefined;
2218
+ this.closureNames();
2219
+ return this.closureNameByEntry.get(this.closureEntry(fnName, target)) ?? null;
2220
+ }
2047
2221
  /** The dispose-observer gates the emitted frees and record writers test
2048
2222
  * (alloc.ts): defined after every helper is emitted, because dynCheck
2049
2223
  * builders, JSON schemas and weak collection constructors are requested
@@ -2052,7 +2226,10 @@ export class LlEmitter {
2052
2226
  const weak = [...this.decls].some((d) => d.includes("@scr_weak_map_new(") || d.includes("@scr_weak_set_new("));
2053
2227
  return [
2054
2228
  `${WEAK_KEYS_GATE} = internal constant i1 ${weak}`,
2055
- `${RECORD_SOURCES_GATE} = internal constant i1 ${this.dyn.keepsRecordSources}`,
2229
+ `${RECORD_SOURCES_GATE} = internal constant i1 ${this.dyn.keepsRecordSources || this.hasRecordLinks()}`,
2230
+ ...(this.hasRecordLinks()
2231
+ ? [`${RECORD_KEPT_GATE} = internal constant i1 ${this.dyn.keepsRecordSources}`]
2232
+ : []),
2056
2233
  ``,
2057
2234
  ];
2058
2235
  }
@@ -2088,10 +2265,15 @@ export class LlEmitter {
2088
2265
  }
2089
2266
  /** Env-signature wrappers + interned immortal closures for declared
2090
2267
  * functions used as values (the runtime ABI’s sc_w_/sc_fc_ pair): every
2091
- * mention of `f` yields the same pointer, so `f === f` holds. */
2268
+ * mention of `f` yields the same pointer, so `f === f` holds. The
2269
+ * closure-name table's wrapper entries are included even when their
2270
+ * closure was never emitted (see closureWrapperNames). */
2092
2271
  emitFnValueDefs() {
2093
2272
  const out = [];
2094
- for (const name of this.fnValues) {
2273
+ const names = new Set(this.fnValues);
2274
+ for (const name of this.closureWrapperNames)
2275
+ names.add(name);
2276
+ for (const name of names) {
2095
2277
  const fn = this.fnByName.get(name);
2096
2278
  const params = fn.params.map((p, i) => `${this.llType(p.type)} %a${i}`);
2097
2279
  const args = fn.params.map((p, i) => `${this.llType(p.type)} %a${i}`).join(", ");
@@ -2967,11 +3149,27 @@ export class LlEmitter {
2967
3149
  toFrame(v) {
2968
3150
  this.disownTemp(v);
2969
3151
  }
3152
+ /** Whether a value of `type` is an instance of a tree class, whose retain
3153
+ * is a no-op and whose release destroys the subtree: it has exactly one
3154
+ * owner, so it may only be moved. */
3155
+ isTreeValue(type) {
3156
+ if (this.treeMoves === null)
3157
+ return false;
3158
+ const nullable = this.shapeHost.nullableUnions.of(type);
3159
+ const arm = nullable === null ? type : nullable.repr === "single" ? nullable.arm : null;
3160
+ return (arm !== null && arm.kind === "object" && this.classMeta.get(arm.className)?.tree === true);
3161
+ }
2970
3162
  /** The retained (+1) read of a refcounted value — type-directed through
2971
3163
  * the `_v` table (immortals skip, exactly the C retain calls). */
2972
3164
  retainCall(name, type) {
2973
3165
  if (this.isImmortal(name))
2974
3166
  return name;
3167
+ // A copy of a tree value would be a second owner, and the two would
3168
+ // destroy the same nodes. Every accepted read of one is a move
3169
+ // (takeLastUseMove), so a retain means the plan and the emitter
3170
+ // disagree: fail here rather than corrupt the heap.
3171
+ if (this.isTreeValue(type))
3172
+ throw new InternalCompilerError(`llvm emitter bug: tree value ${name} is copied instead of moved`);
2975
3173
  const t = this.B.tmp();
2976
3174
  this.B.line(`${t} = call ptr ${retainSym(this.shapeHost, type)}(ptr ${name})`);
2977
3175
  return t;
@@ -4027,6 +4225,29 @@ export class LlEmitter {
4027
4225
  single.arm.kind === "object" &&
4028
4226
  isCompact(single.arm.className));
4029
4227
  }
4228
+ /** Whether values of `t` are NULL or a refcounted object that lies in the
4229
+ * allocator's window below 32 GiB, so that a compact class field of type
4230
+ * `t` can store it as a 32-bit reference: an array, map or set, or an
4231
+ * instance of a class that is not compact and that the program allocates
4232
+ * (not the runtime's Error hierarchy, whose instances the runtime
4233
+ * allocates), or one of these or `undefined`/`null` (NULL). Strings keep
4234
+ * 8-byte pointers: literals lie in the executable's image. */
4235
+ windowRefType(t, isCompact) {
4236
+ const target = (u) => {
4237
+ if (u.kind === "array" || u.kind === "map" || u.kind === "set")
4238
+ return true;
4239
+ if (u.kind !== "object" || isCompact(u.className))
4240
+ return false;
4241
+ const meta = this.classMeta.get(u.className);
4242
+ return meta !== undefined && meta.root.def.runtime !== true;
4243
+ };
4244
+ if (target(t))
4245
+ return true;
4246
+ if (t.kind !== "union")
4247
+ return false;
4248
+ const single = this.nullableUnions.single(t.unionId);
4249
+ return single !== null && single.nullTag < 0 && target(single.arm);
4250
+ }
4030
4251
  /** Whether arrays of `elem` hold 32-bit references (SCR_ELEM_CREF). */
4031
4252
  compactArrayElem(elem) {
4032
4253
  return this.compactRegion && this.compactRefType(elem);
@@ -4188,7 +4409,7 @@ export class LlEmitter {
4188
4409
  const base = this.nullableUnions.fieldBase(shapeId);
4189
4410
  let p;
4190
4411
  if (this.shapeHost.recordViews?.targets.has(shapeId) === true) {
4191
- p = recordViewFieldPtr(this.B, this.sizeType, mangleRecordStruct(shapeId), objName, idx + base, idx, (decl) => this.declare(decl), this.rcMode === undefined);
4412
+ p = recordViewFieldPtr(this.B, this.sizeType, mangleRecordStruct(shapeId), objName, idx + base, idx, (decl) => this.declare(decl), this.rcMode === undefined, (text) => this.cstr(text), this.shapeHost.recordViews?.partialTargets.has(shapeId) === true);
4192
4413
  }
4193
4414
  else {
4194
4415
  p = this.B.tmp();
@@ -4197,6 +4418,155 @@ export class LlEmitter {
4197
4418
  const type = shape.fields[idx].type;
4198
4419
  return { ptr: p, type, inline: this.inlineUnions.record(type) };
4199
4420
  }
4421
+ /** Whether a value of `shapeId` may lack field `field`: a PARTIAL record
4422
+ * view (record-views.ts) whose viewed record does not declare it. A field
4423
+ * with no value representation (a unit type) keeps its slot lookup. */
4424
+ partialFieldMissing(shapeId, field) {
4425
+ if (this.shapeHost.recordViews?.partialMissing(shapeId, field) !== true)
4426
+ return false;
4427
+ const type = this.recordShape(shapeId).fields.find((f) => f.name === field)?.type;
4428
+ return type !== undefined && !isUnitType(type);
4429
+ }
4430
+ /** The viewed record's slot for `field` of a partial view, or NULL when
4431
+ * that record does not declare the field. The caller has established that
4432
+ * `obj` is a view. */
4433
+ partialViewSlot(objName, shapeId, field) {
4434
+ const position = this.recordShape(shapeId).fields.findIndex((f) => f.name === field);
4435
+ this.declare(`declare ptr @scr_record_view_slot(ptr, ${this.sizeType})`);
4436
+ const slot = this.B.tmp();
4437
+ this.B.line(`${slot} = call ptr @scr_record_view_slot(ptr ${objName}, ${this.sizeType} ${position})`);
4438
+ return slot;
4439
+ }
4440
+ /** The boxed property a partial view keeps for a field its viewed record
4441
+ * does not declare (NULL until something writes it). */
4442
+ partialViewExtra(objName, field) {
4443
+ this.declare(`declare ptr @scr_record_view_extra(ptr, ptr, ${this.sizeType})`);
4444
+ const extra = this.B.tmp();
4445
+ this.B.line(`${extra} = call ptr @scr_record_view_extra(ptr ${objName}, ptr ${this.cstr(field)}, ${this.sizeType} ${Buffer.byteLength(field, "utf8")})`);
4446
+ return extra;
4447
+ }
4448
+ /** Reads field `field` of `obj` (shape `shapeId`) where a PARTIAL view may
4449
+ * lack it. A view's present field reads through the viewed record's slot;
4450
+ * a field that record does not declare reads the property a write left in
4451
+ * the view's extra store, converted back to the field type; a field
4452
+ * nothing wrote stops the program (the frontend's checked read throws its
4453
+ * TypeError first). The answer is owned, like a checked conversion's. */
4454
+ readPartialField(objName, shapeId, field, type) {
4455
+ const B = this.B;
4456
+ const idx = this.recordShape(shapeId).fields.findIndex((f) => f.name === field);
4457
+ const inline = this.inlineUnions.record(type);
4458
+ const isView = B.tmp();
4459
+ const view = B.newLabel("pf.view");
4460
+ const notView = B.newLabel("pf.slot");
4461
+ const slots = B.newLabel("pf.slots");
4462
+ const extra = B.newLabel("pf.extra");
4463
+ const answer = B.newLabel("pf.answer");
4464
+ for (const line of recordViewTestLines(this.sizeType, objName, isView))
4465
+ B.line(line.trimStart());
4466
+ B.condBr(isView, view, notView);
4467
+ // Not a view: the field's own slot.
4468
+ B.startBlock(notView);
4469
+ const own = B.tmp();
4470
+ B.line(`${own} = getelementptr inbounds %${mangleRecordStruct(shapeId)}, ptr ${objName}, i64 0, i32 ${idx + this.nullableUnions.fieldBase(shapeId)}`);
4471
+ const ownFrom = B.currentLabel();
4472
+ B.br(slots);
4473
+ B.startBlock(view);
4474
+ const slot = this.partialViewSlot(objName, shapeId, field);
4475
+ const present = B.tmp();
4476
+ B.line(`${present} = icmp ne ptr ${slot}, null`);
4477
+ const slotFrom = B.currentLabel();
4478
+ B.condBr(present, slots, extra);
4479
+ B.startBlock(slots);
4480
+ const addr = B.tmp();
4481
+ B.line(`${addr} = phi ptr [ ${own}, %${ownFrom} ], [ ${slot}, %${slotFrom} ]`);
4482
+ // An inline union field answers a private stack box, as a plain read does.
4483
+ const loaded = inline
4484
+ ? this.inlineFieldUnion(addr, type)
4485
+ : this.loadRecordField(addr, type, false);
4486
+ const hit = isRefCounted(type) ? this.retainFrame(loaded, type) : loaded;
4487
+ const hitFrom = B.currentLabel();
4488
+ B.br(answer);
4489
+ B.startBlock(extra);
4490
+ const stored = this.partialViewExtra(objName, field);
4491
+ const absent = B.tmp();
4492
+ B.line(`${absent} = icmp eq ptr ${stored}, null`);
4493
+ const trap = B.newLabel("pf.absent");
4494
+ const convert = B.newLabel("pf.convert");
4495
+ B.condBr(absent, trap, convert);
4496
+ B.startBlock(trap);
4497
+ absentTrapLines(B, (text) => this.cstr(text), (decl) => this.declare(decl));
4498
+ B.startBlock(convert);
4499
+ const path = B.slot();
4500
+ B.entryAllocas.push(`${path} = alloca %ScrDynPath`);
4501
+ const parentPtr = B.tmp();
4502
+ const keyPtr = B.tmp();
4503
+ const indexPtr = B.tmp();
4504
+ B.line(`${parentPtr} = getelementptr inbounds %ScrDynPath, ptr ${path}, i64 0, i32 0`);
4505
+ B.line(`store ptr null, ptr ${parentPtr}`);
4506
+ B.line(`${keyPtr} = getelementptr inbounds %ScrDynPath, ptr ${path}, i64 0, i32 1`);
4507
+ B.line(`store ptr ${this.cstr(field)}, ptr ${keyPtr}`);
4508
+ B.line(`${indexPtr} = getelementptr inbounds %ScrDynPath, ptr ${path}, i64 0, i32 2`);
4509
+ B.line(`store ${this.sizeType} 0, ptr ${indexPtr}`);
4510
+ const helper = this.dyn.dynCheckHelper(type);
4511
+ const ty = this.llType(type);
4512
+ const checked = B.tmp();
4513
+ B.line(`${checked} = call ${ty === "i1" ? "zeroext i1" : ty} @${helper}(ptr ${stored}, ptr ${path})`);
4514
+ const convertFrom = B.currentLabel();
4515
+ B.br(answer);
4516
+ B.startBlock(answer);
4517
+ const value = B.tmp();
4518
+ B.line(`${value} = phi ${ty} [ ${hit}, %${hitFrom} ], [ ${checked}, %${convertFrom} ]`);
4519
+ return { name: value, type };
4520
+ }
4521
+ /** Stores `value` into field `field` of `obj` (shape `shapeId`) where a
4522
+ * PARTIAL view may lack it, calling `storeAt` with the address to write.
4523
+ * A field the viewed record does not declare is kept as a boxed property
4524
+ * in the view's extra store, where reflection and a later read see it;
4525
+ * `released` gives up a caller reference the frame does not own. */
4526
+ storePartialField(objName, shapeId, field, type, value, storeAt, released) {
4527
+ const B = this.B;
4528
+ const idx = this.recordShape(shapeId).fields.findIndex((f) => f.name === field);
4529
+ const isView = B.tmp();
4530
+ const notView = B.newLabel("ps.slot");
4531
+ const view = B.newLabel("ps.view");
4532
+ const present = B.newLabel("ps.present");
4533
+ const store = B.newLabel("ps.store");
4534
+ const extra = B.newLabel("ps.extra");
4535
+ const done = B.newLabel("ps.done");
4536
+ for (const line of recordViewTestLines(this.sizeType, objName, isView))
4537
+ B.line(line.trimStart());
4538
+ B.condBr(isView, view, notView);
4539
+ B.startBlock(notView);
4540
+ const own = B.tmp();
4541
+ B.line(`${own} = getelementptr inbounds %${mangleRecordStruct(shapeId)}, ptr ${objName}, i64 0, i32 ${idx + this.nullableUnions.fieldBase(shapeId)}`);
4542
+ const ownFrom = B.currentLabel();
4543
+ B.br(store);
4544
+ B.startBlock(view);
4545
+ const slot = this.partialViewSlot(objName, shapeId, field);
4546
+ const hasSlot = B.tmp();
4547
+ B.line(`${hasSlot} = icmp ne ptr ${slot}, null`);
4548
+ B.condBr(hasSlot, present, extra);
4549
+ B.startBlock(present);
4550
+ const presentFrom = B.currentLabel();
4551
+ B.br(store);
4552
+ // One store site whichever slot answers: the value's frame ownership
4553
+ // ends in one place, whether the write runs on this program's path or
4554
+ // on the other branch of the test.
4555
+ B.startBlock(store);
4556
+ const addr = B.tmp();
4557
+ B.line(`${addr} = phi ptr [ ${own}, %${ownFrom} ], [ ${slot}, %${presentFrom} ]`);
4558
+ storeAt(addr);
4559
+ B.br(done);
4560
+ B.startBlock(extra);
4561
+ const boxed = B.tmp();
4562
+ const box = this.dyn.toDynHelper(type);
4563
+ B.line(`${boxed} = call ptr @${box}(${this.llType(type)} ${value.name})`);
4564
+ this.declare(`declare void @scr_record_view_extra_set(ptr, ptr, ${this.sizeType}, ptr)`);
4565
+ B.line(`call void @scr_record_view_extra_set(ptr ${objName}, ptr ${this.cstr(field)}, ${this.sizeType} ${Buffer.byteLength(field, "utf8")}, ptr ${boxed})`);
4566
+ released?.();
4567
+ B.br(done);
4568
+ B.startBlock(done);
4569
+ }
4200
4570
  /** The overflow map's slot pointer on an index-signature shape. */
4201
4571
  recordOvfPtr(objName, shapeId) {
4202
4572
  const shape = this.recordShape(shapeId);
@@ -4638,6 +5008,30 @@ export class LlEmitter {
4638
5008
  * the fiber eagerly to its first suspension and returns the promise);
4639
5009
  * generator bodies via theirs (which only ALLOCATES the suspended
4640
5010
  * fiber and returns the generator object). */
5011
+ jsEntryClosureList = null;
5012
+ /** The closures with a jsval body (IrFunction.jsEntry), on targets with
5013
+ * jsval words. */
5014
+ jsEntryClosures() {
5015
+ if (this.jsEntryClosureList !== null)
5016
+ return this.jsEntryClosureList;
5017
+ const list = [];
5018
+ if (this.jsEntries && jsImmediates(this))
5019
+ for (const fn of this.fnByName.values()) {
5020
+ const body = fn.jsEntry === undefined ? undefined : this.fnByName.get(fn.jsEntry);
5021
+ if (body === undefined)
5022
+ continue;
5023
+ list.push({
5024
+ closure: this.callTarget(fn.name),
5025
+ params: fn.params.map((p) => p.type),
5026
+ ret: fn.returnType,
5027
+ body: this.callTarget(body.name),
5028
+ bodyParams: body.params.map((p) => p.type),
5029
+ bodyRet: body.returnType,
5030
+ });
5031
+ }
5032
+ this.jsEntryClosureList = list;
5033
+ return list;
5034
+ }
4641
5035
  callTarget(fnName) {
4642
5036
  const fn = this.fnByName.get(fnName);
4643
5037
  if (fn?.generator !== undefined)
@@ -4974,7 +5368,7 @@ export class LlEmitter {
4974
5368
  /** An emitter for a range of this module's functions: the same facts,
4975
5369
  * empty module-level tables, and a journal of what the range adds. */
4976
5370
  chunkEmitter() {
4977
- const chunk = new LlEmitter(this.mod, { ...this.targetOptions, functionChunks: 1 }, new EmitJournal());
5371
+ const chunk = new LlEmitter(this.mod, { ...this.targetOptions, functionChunks: 1 }, new EmitJournal(), null, this.nodeIndex);
4978
5372
  chunk.debug?.record();
4979
5373
  return chunk;
4980
5374
  }
@@ -5150,7 +5544,8 @@ export class LlEmitter {
5150
5544
  const exception = B.tmp();
5151
5545
  B.line(`${exception} = landingpad { ptr, i32 } cleanup`);
5152
5546
  for (const index of borrowed)
5153
- this.releaseFrame(`%p${index}`, fn.params[index].type);
5547
+ if (!this.isTreeValue(fn.params[index].type))
5548
+ this.releaseFrame(`%p${index}`, fn.params[index].type);
5154
5549
  this.declare(UNWIND_RESUME_DECLARATION);
5155
5550
  B.resumeUnwind(exception);
5156
5551
  B.startBlock(ok);
@@ -5177,8 +5572,10 @@ export class LlEmitter {
5177
5572
  result = B.tmp();
5178
5573
  B.line(`${result} = load ptr, ptr ${slot}`);
5179
5574
  }
5575
+ // A tree value is passed by reference to its owner and never counted,
5576
+ // so the wrapper has nothing to drop for it.
5180
5577
  for (const index of borrowed)
5181
- if (!kept.has(index))
5578
+ if (!kept.has(index) && !this.isTreeValue(fn.params[index].type))
5182
5579
  this.releaseFrame(`%p${index}`, fn.params[index].type);
5183
5580
  B.terminate(ret === "void" ? "ret void" : `ret ${ret} ${result}`);
5184
5581
  const symbol = kept.size > 0 ? `${mangleBorrowedFunction(fn.name)}.virtual` : mangleFunction(fn.name);
@@ -5419,6 +5816,17 @@ export class LlEmitter {
5419
5816
  /** Emits the move of a noted last read: the slot is cleared, so scope
5420
5817
  * exits release nothing and the read's owned temp carries the reference. */
5421
5818
  takeLastUseMove(e, slot, type) {
5819
+ if (this.isTreeValue(e.type)) {
5820
+ // A tree value has one owner and no count: every read of it that the
5821
+ // plan accepted IS its transfer (backend/tree-classes.ts records the
5822
+ // expression), so the read takes the reference exactly as a last-use
5823
+ // move does. A read the plan did not record would copy the node,
5824
+ // which retainCall refuses.
5825
+ if (this.treeMoves?.delete(e) !== true)
5826
+ return false;
5827
+ this.B.line(`store ptr null, ptr ${slot}`);
5828
+ return true;
5829
+ }
5422
5830
  if (this.lastUseMoves.get(e) !== slot || !typeEquals(type, e.type))
5423
5831
  return false;
5424
5832
  this.lastUseMoves.delete(e);
@@ -6503,7 +6911,7 @@ export class LlEmitter {
6503
6911
  * is produced without a union box where the value is a wrap, and as a
6504
6912
  * retained payload of a borrowed box otherwise. Unlink-then-release like
6505
6913
  * every field store. */
6506
- emitNullableFieldStore(obj, className, field, nullable, value) {
6914
+ emitNullableFieldStore(obj, className, field, nullable, value, fresh) {
6507
6915
  let next;
6508
6916
  if (value.kind === "unionWrap" &&
6509
6917
  value.unionId === nullable.unionId &&
@@ -6529,6 +6937,10 @@ export class LlEmitter {
6529
6937
  next = this.unionToNullable(this.emitUnionProjection(value).name, nullable);
6530
6938
  }
6531
6939
  const { ptr } = this.classFieldPtr(obj, className, field, "compressed");
6940
+ if (fresh) {
6941
+ this.storeRef(ptr, next);
6942
+ return;
6943
+ }
6532
6944
  const old = this.loadRef(ptr, false);
6533
6945
  this.storeRef(ptr, next);
6534
6946
  this.releaseHeap(old, nullable.arm);
@@ -6700,6 +7112,11 @@ export class LlEmitter {
6700
7112
  /** Group arenas (arenas.ts): the plan, the list slot of each root and
6701
7113
  * call region, and which locals' scopes drop which roots' arenas. */
6702
7114
  arenas = null;
7115
+ /** The varRef reads the tree-class plan proved move a node out of its
7116
+ * local (backend/tree-classes.ts). Each one emits its own last-use move:
7117
+ * the source slot is nulled and the value taken without a retain, since
7118
+ * a tree instance has no count to raise. */
7119
+ treeMoves = null;
6703
7120
  arenaSlots = new Map();
6704
7121
  /** The frames emitStmtBody opens for whole statements (arenas only). */
6705
7122
  statementFrames = new Set();
@@ -6848,6 +7265,29 @@ export class LlEmitter {
6848
7265
  this.journal?.site(name, "jsIcSite");
6849
7266
  return name;
6850
7267
  }
7268
+ /** A fresh guard-group record (js-groups.ts). */
7269
+ jsGroup() {
7270
+ const name = `@sc_js_group_${this.jsGroupCount++}`;
7271
+ this.journal?.site(name, "jsGroup");
7272
+ return name;
7273
+ }
7274
+ /** The constant key array `keys` (string literal symbols) that a group's
7275
+ * probe reads, shared by every group with the same keys. */
7276
+ jsGroupKeys(keys) {
7277
+ const text = keys.join("\u0000");
7278
+ let name = this.jsGroupKeysByText.get(text);
7279
+ if (name !== undefined)
7280
+ return name;
7281
+ name = `@sc_gkeys_${this.jsGroupKeysCount++}`;
7282
+ this.jsGroupKeysByText.set(text, name);
7283
+ this.jsGroupKeysByName.set(name, keys);
7284
+ this.journal?.site(name, "jsGroupKeys", [keys]);
7285
+ return name;
7286
+ }
7287
+ /** The key array of each of this module's guard groups, by name. */
7288
+ get jsGroupKeysTable() {
7289
+ return this.jsGroupKeysByName;
7290
+ }
6851
7291
  /** A fresh read-site cache for one constant-key dyn read. */
6852
7292
  dynReadIcSite() {
6853
7293
  const name = `@sc_dyn_read_ic_${this.dynReadIcSites++}`;
@@ -6930,6 +7370,12 @@ export class LlEmitter {
6930
7370
  fsRenameThunkFor(cbT) {
6931
7371
  return fsRenameThunkFor(this, cbT);
6932
7372
  }
7373
+ watchNameThunkFor(cbT) {
7374
+ return watchNameThunkFor(this, cbT);
7375
+ }
7376
+ watchErrorThunkFor(cbT) {
7377
+ return watchErrorThunkFor(this, cbT);
7378
+ }
6933
7379
  cryptoBytesThunkFor(cbT, arrayBuffer = false, valueMode = "buffer") {
6934
7380
  return cryptoBytesThunkFor(this, cbT, arrayBuffer, valueMode);
6935
7381
  }
@@ -7067,8 +7513,8 @@ export class LlEmitter {
7067
7513
  emitRecordKeyGet(e) {
7068
7514
  return emitRecordKeyGet(this, e);
7069
7515
  }
7070
- keyedRecordReadInto(slot, join, objName, keyName, shapeId, resultType, overflowOnly, loc, missNaN = false) {
7071
- return keyedRecordReadInto(this, slot, join, objName, keyName, shapeId, resultType, overflowOnly, loc, missNaN);
7516
+ keyedRecordReadInto(slot, join, objName, keyName, shapeId, resultType, overflowOnly, loc, missNaN = false, missInto = null, read = null) {
7517
+ return keyedRecordReadInto(this, slot, join, objName, keyName, shapeId, resultType, overflowOnly, loc, missNaN, missInto, read);
7072
7518
  }
7073
7519
  dynPromiseAdapter(inner) {
7074
7520
  return dynPromiseAdapter(this, inner);
@@ -7185,6 +7631,8 @@ function addNumberedSymbol(into, key, entry, prefix, names) {
7185
7631
  names.set(entry.sym, own.sym);
7186
7632
  }
7187
7633
  registerReplay("jsIcSite", (emitter) => emitter.jsIcSite());
7634
+ registerReplay("jsGroup", (emitter) => emitter.jsGroup());
7635
+ registerReplay("jsGroupKeys", (emitter, args) => emitter.jsGroupKeys(args[0]));
7188
7636
  registerReplay("dynReadIcSite", (emitter) => emitter.dynReadIcSite());
7189
7637
  registerReplay("speculativeLoopSite", (emitter) => emitter.speculativeLoopSite());
7190
7638
  for (const op of [
@@ -7198,6 +7646,8 @@ for (const op of [
7198
7646
  "dyn.promiseDynAdapterHelper",
7199
7647
  "dyn.dynFuncThunkHelper",
7200
7648
  "dyn.dynFuncBoxHelper",
7649
+ "dyn.jsEntryThunk",
7650
+ "dyn.unnamedFuncBoxHelper",
7201
7651
  "dyn.dynFuncAdapterHelper",
7202
7652
  "dyn.dynToStrHelper",
7203
7653
  "dyn.dynIterNHelper",