@scriptc/compiler 0.4.5 → 0.4.6
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.
- package/ambient/node-fallback/assert-strict.d.ts +47 -0
- package/ambient/node-fallback/assert.d.ts +86 -0
- package/ambient/node-fallback/async_hooks.d.ts +41 -0
- package/ambient/node-fallback/buffer.d.ts +23 -0
- package/ambient/node-fallback/child_process.d.ts +242 -0
- package/ambient/node-fallback/cluster.d.ts +17 -0
- package/ambient/node-fallback/constants.d.ts +15 -0
- package/ambient/node-fallback/crypto.d.ts +837 -0
- package/ambient/node-fallback/dgram.d.ts +58 -0
- package/ambient/node-fallback/diagnostics_channel.d.ts +87 -0
- package/ambient/node-fallback/dns-promises.d.ts +27 -0
- package/ambient/node-fallback/dns.d.ts +65 -0
- package/ambient/node-fallback/events.d.ts +60 -0
- package/ambient/node-fallback/fs-promises.d.ts +225 -0
- package/ambient/node-fallback/fs.d.ts +641 -0
- package/ambient/node-fallback/graceful-fs.d.ts +9 -0
- package/ambient/node-fallback/http.d.ts +326 -0
- package/ambient/node-fallback/http2.d.ts +816 -0
- package/ambient/node-fallback/https.d.ts +59 -0
- package/ambient/node-fallback/module.d.ts +10 -0
- package/ambient/node-fallback/net.d.ts +374 -0
- package/ambient/node-fallback/os.d.ts +288 -0
- package/ambient/node-fallback/path-posix.d.ts +22 -0
- package/ambient/node-fallback/path-win32.d.ts +22 -0
- package/ambient/node-fallback/path.d.ts +55 -0
- package/ambient/node-fallback/process.d.ts +11 -0
- package/ambient/node-fallback/punycode.d.ts +18 -0
- package/ambient/node-fallback/querystring.d.ts +55 -0
- package/ambient/node-fallback/stream-consumers.d.ts +21 -0
- package/ambient/node-fallback/stream-promises.d.ts +28 -0
- package/ambient/node-fallback/stream-web.d.ts +36 -0
- package/ambient/node-fallback/stream.d.ts +644 -0
- package/ambient/node-fallback/string_decoder.d.ts +20 -0
- package/ambient/node-fallback/test.d.ts +236 -0
- package/ambient/node-fallback/timers-promises.d.ts +31 -0
- package/ambient/node-fallback/timers.d.ts +28 -0
- package/ambient/node-fallback/tls.d.ts +169 -0
- package/ambient/node-fallback/url.d.ts +95 -0
- package/ambient/node-fallback/util-types.d.ts +50 -0
- package/ambient/node-fallback/util.d.ts +416 -0
- package/ambient/node-fallback/v8.d.ts +43 -0
- package/ambient/node-fallback/worker_threads.d.ts +113 -0
- package/ambient/node-fallback/zlib.d.ts +422 -0
- package/ambient/scriptc-node-fallback.d.ts +224 -6688
- package/dist/backend/cycle-analysis.js +4 -0
- package/dist/backend/cycle-analysis.js.map +1 -1
- package/dist/backend/executable-features.d.ts +1 -1
- package/dist/backend/executable-features.js +15 -2
- package/dist/backend/executable-features.js.map +1 -1
- package/dist/backend/huge-text.d.ts +16 -0
- package/dist/backend/huge-text.js +103 -0
- package/dist/backend/huge-text.js.map +1 -0
- package/dist/backend/huge-text.test.d.ts +1 -0
- package/dist/backend/huge-text.test.js +73 -0
- package/dist/backend/huge-text.test.js.map +1 -0
- package/dist/backend/library-pack.js +1 -1
- package/dist/backend/library-pack.js.map +1 -1
- package/dist/backend/link-plan-core.d.ts +10 -0
- package/dist/backend/link-plan-core.js +14 -2
- package/dist/backend/link-plan-core.js.map +1 -1
- package/dist/backend/link-plan-core.test.d.ts +1 -0
- package/dist/backend/link-plan-core.test.js +20 -0
- package/dist/backend/link-plan-core.test.js.map +1 -0
- package/dist/backend/link-plan.d.ts +8 -0
- package/dist/backend/link-plan.js +7 -0
- package/dist/backend/link-plan.js.map +1 -1
- package/dist/backend/linker.js +37 -14
- package/dist/backend/linker.js.map +1 -1
- package/dist/backend/lld.d.ts +13 -0
- package/dist/backend/lld.js +18 -1
- package/dist/backend/lld.js.map +1 -1
- package/dist/backend/lld.test.js +7 -1
- package/dist/backend/lld.test.js.map +1 -1
- package/dist/backend/llvm/alloc.d.ts +2 -0
- package/dist/backend/llvm/alloc.js +1 -1
- package/dist/backend/llvm/alloc.js.map +1 -1
- package/dist/backend/llvm/arenas.d.ts +78 -0
- package/dist/backend/llvm/arenas.js +313 -0
- package/dist/backend/llvm/arenas.js.map +1 -0
- package/dist/backend/llvm/arenas.test.d.ts +1 -0
- package/dist/backend/llvm/arenas.test.js +140 -0
- package/dist/backend/llvm/arenas.test.js.map +1 -0
- package/dist/backend/llvm/blocks.d.ts +11 -1
- package/dist/backend/llvm/blocks.js +23 -5
- package/dist/backend/llvm/blocks.js.map +1 -1
- package/dist/backend/llvm/bytes-headers.d.ts +19 -0
- package/dist/backend/llvm/bytes-headers.js +55 -0
- package/dist/backend/llvm/bytes-headers.js.map +1 -0
- package/dist/backend/llvm/bytes-loop-versions.d.ts +4 -3
- package/dist/backend/llvm/bytes-loop-versions.js +42 -7
- package/dist/backend/llvm/bytes-loop-versions.js.map +1 -1
- package/dist/backend/llvm/bytes-loop-versions.test.js +39 -4
- package/dist/backend/llvm/bytes-loop-versions.test.js.map +1 -1
- package/dist/backend/llvm/call-lifetimes.d.ts +5 -0
- package/dist/backend/llvm/call-lifetimes.js +43 -8
- package/dist/backend/llvm/call-lifetimes.js.map +1 -1
- package/dist/backend/llvm/call-lifetimes.test.js +26 -0
- package/dist/backend/llvm/call-lifetimes.test.js.map +1 -1
- package/dist/backend/llvm/checked-narrows.d.ts +3 -0
- package/dist/backend/llvm/checked-narrows.js +8 -1
- package/dist/backend/llvm/checked-narrows.js.map +1 -1
- package/dist/backend/llvm/class-unions.d.ts +21 -0
- package/dist/backend/llvm/class-unions.js +141 -0
- package/dist/backend/llvm/class-unions.js.map +1 -0
- package/dist/backend/llvm/class-unions.test.d.ts +1 -0
- package/dist/backend/llvm/class-unions.test.js +137 -0
- package/dist/backend/llvm/class-unions.test.js.map +1 -0
- package/dist/backend/llvm/classes.d.ts +46 -8
- package/dist/backend/llvm/classes.js +259 -32
- package/dist/backend/llvm/classes.js.map +1 -1
- package/dist/backend/llvm/classes.test.js +4 -0
- package/dist/backend/llvm/classes.test.js.map +1 -1
- package/dist/backend/llvm/common.d.ts +23 -0
- package/dist/backend/llvm/common.js +34 -0
- package/dist/backend/llvm/common.js.map +1 -1
- package/dist/backend/llvm/constant-callbacks.test.js +39 -0
- package/dist/backend/llvm/constant-callbacks.test.js.map +1 -1
- package/dist/backend/llvm/constant-choices.d.ts +32 -0
- package/dist/backend/llvm/constant-choices.js +209 -0
- package/dist/backend/llvm/constant-choices.js.map +1 -0
- package/dist/backend/llvm/constant-choices.test.d.ts +1 -0
- package/dist/backend/llvm/constant-choices.test.js +94 -0
- package/dist/backend/llvm/constant-choices.test.js.map +1 -0
- package/dist/backend/llvm/counted-loops.d.ts +14 -2
- package/dist/backend/llvm/counted-loops.js +60 -7
- package/dist/backend/llvm/counted-loops.js.map +1 -1
- package/dist/backend/llvm/counted-loops.test.d.ts +1 -0
- package/dist/backend/llvm/counted-loops.test.js +34 -0
- package/dist/backend/llvm/counted-loops.test.js.map +1 -0
- package/dist/backend/llvm/cpu-dispatch.d.ts +26 -0
- package/dist/backend/llvm/cpu-dispatch.js +279 -0
- package/dist/backend/llvm/cpu-dispatch.js.map +1 -0
- package/dist/backend/llvm/dense-array-access.d.ts +13 -2
- package/dist/backend/llvm/dense-array-access.js +60 -6
- package/dist/backend/llvm/dense-array-access.js.map +1 -1
- package/dist/backend/llvm/dyn-handle-tags.test.js +40 -14
- package/dist/backend/llvm/dyn-handle-tags.test.js.map +1 -1
- package/dist/backend/llvm/dyn.d.ts +28 -2
- package/dist/backend/llvm/dyn.js +176 -27
- package/dist/backend/llvm/dyn.js.map +1 -1
- package/dist/backend/llvm/emit-function.js +25 -3
- package/dist/backend/llvm/emit-function.js.map +1 -1
- package/dist/backend/llvm/emit-journal.d.ts +1 -0
- package/dist/backend/llvm/emit-journal.js.map +1 -1
- package/dist/backend/llvm/emit-module.d.ts +5 -3
- package/dist/backend/llvm/emit-module.js +362 -74
- package/dist/backend/llvm/emit-module.js.map +1 -1
- package/dist/backend/llvm/emit-statements.js +327 -59
- package/dist/backend/llvm/emit-statements.js.map +1 -1
- package/dist/backend/llvm/emitter.d.ts +223 -33
- package/dist/backend/llvm/emitter.js +713 -100
- package/dist/backend/llvm/emitter.js.map +1 -1
- package/dist/backend/llvm/emitter.test.js +20 -1
- package/dist/backend/llvm/emitter.test.js.map +1 -1
- package/dist/backend/llvm/expr-async.js +32 -6
- package/dist/backend/llvm/expr-async.js.map +1 -1
- package/dist/backend/llvm/expr-bytes.d.ts +9 -1
- package/dist/backend/llvm/expr-bytes.js +105 -9
- package/dist/backend/llvm/expr-bytes.js.map +1 -1
- package/dist/backend/llvm/expr-callbacks.d.ts +1 -1
- package/dist/backend/llvm/expr-callbacks.js +29 -22
- package/dist/backend/llvm/expr-callbacks.js.map +1 -1
- package/dist/backend/llvm/expr-calls.d.ts +0 -4
- package/dist/backend/llvm/expr-calls.js +116 -14
- package/dist/backend/llvm/expr-calls.js.map +1 -1
- package/dist/backend/llvm/expr-containers.js +77 -12
- package/dist/backend/llvm/expr-containers.js.map +1 -1
- package/dist/backend/llvm/expr-context.d.ts +22 -0
- package/dist/backend/llvm/expr-control.d.ts +4 -0
- package/dist/backend/llvm/expr-control.js +485 -426
- package/dist/backend/llvm/expr-control.js.map +1 -1
- package/dist/backend/llvm/expr-dispatch.js +4 -0
- package/dist/backend/llvm/expr-dispatch.js.map +1 -1
- package/dist/backend/llvm/expr-dynamic.js +3 -3
- package/dist/backend/llvm/expr-dynamic.js.map +1 -1
- package/dist/backend/llvm/expr-primitives.d.ts +6 -0
- package/dist/backend/llvm/expr-primitives.js +119 -58
- package/dist/backend/llvm/expr-primitives.js.map +1 -1
- package/dist/backend/llvm/expr-primitives.test.js +11 -2
- package/dist/backend/llvm/expr-primitives.test.js.map +1 -1
- package/dist/backend/llvm/expr-records.d.ts +36 -4
- package/dist/backend/llvm/expr-records.js +249 -37
- package/dist/backend/llvm/expr-records.js.map +1 -1
- package/dist/backend/llvm/expr-stream-bridges.js +124 -7
- package/dist/backend/llvm/expr-stream-bridges.js.map +1 -1
- package/dist/backend/llvm/expr-stream-bridges.test.js +1 -1
- package/dist/backend/llvm/expr-stream-bridges.test.js.map +1 -1
- package/dist/backend/llvm/expr-stream-callbacks.js +13 -14
- package/dist/backend/llvm/expr-stream-callbacks.js.map +1 -1
- package/dist/backend/llvm/frame-escapes.d.ts +11 -0
- package/dist/backend/llvm/frame-escapes.js +219 -0
- package/dist/backend/llvm/frame-escapes.js.map +1 -0
- package/dist/backend/llvm/function-layout.d.ts +15 -0
- package/dist/backend/llvm/function-layout.js +40 -0
- package/dist/backend/llvm/function-layout.js.map +1 -0
- package/dist/backend/llvm/heap-census.d.ts +34 -0
- package/dist/backend/llvm/heap-census.js +163 -0
- package/dist/backend/llvm/heap-census.js.map +1 -0
- package/dist/backend/llvm/inline-arrays.d.ts +41 -0
- package/dist/backend/llvm/inline-arrays.js +195 -0
- package/dist/backend/llvm/inline-arrays.js.map +1 -0
- package/dist/backend/llvm/int32-kind-loops.js +2 -0
- package/dist/backend/llvm/int32-kind-loops.js.map +1 -1
- package/dist/backend/llvm/integer-clones.d.ts +32 -5
- package/dist/backend/llvm/integer-clones.js +237 -44
- package/dist/backend/llvm/integer-clones.js.map +1 -1
- package/dist/backend/llvm/integer-clones.test.js +120 -0
- package/dist/backend/llvm/integer-clones.test.js.map +1 -1
- package/dist/backend/llvm/iterative-teardown.test.d.ts +1 -0
- package/dist/backend/llvm/iterative-teardown.test.js +62 -0
- package/dist/backend/llvm/iterative-teardown.test.js.map +1 -0
- package/dist/backend/llvm/js-ic.js +246 -62
- package/dist/backend/llvm/js-ic.js.map +1 -1
- package/dist/backend/llvm/lib-connect.js +1 -1
- package/dist/backend/llvm/lib-connect.js.map +1 -1
- package/dist/backend/llvm/lib-datagram.js +2 -2
- package/dist/backend/llvm/lib-datagram.js.map +1 -1
- package/dist/backend/llvm/lib-dispatch.js +153 -16
- package/dist/backend/llvm/lib-dispatch.js.map +1 -1
- package/dist/backend/llvm/lib-filesystem.d.ts +8 -0
- package/dist/backend/llvm/lib-filesystem.js +48 -4
- package/dist/backend/llvm/lib-filesystem.js.map +1 -1
- package/dist/backend/llvm/lib-http2.js +4 -3
- package/dist/backend/llvm/lib-http2.js.map +1 -1
- package/dist/backend/llvm/lib-lookup.js +1 -1
- package/dist/backend/llvm/lib-lookup.js.map +1 -1
- package/dist/backend/llvm/lib-network.js +15 -1
- package/dist/backend/llvm/lib-network.js.map +1 -1
- package/dist/backend/llvm/lib-process.js +32 -8
- package/dist/backend/llvm/lib-process.js.map +1 -1
- package/dist/backend/llvm/lib-shared.d.ts +3 -0
- package/dist/backend/llvm/lib-shared.js +191 -28
- package/dist/backend/llvm/lib-shared.js.map +1 -1
- package/dist/backend/llvm/lib-stream.js +1 -1
- package/dist/backend/llvm/lib-stream.js.map +1 -1
- package/dist/backend/llvm/local-array-reads.js +15 -1
- package/dist/backend/llvm/local-array-reads.js.map +1 -1
- package/dist/backend/llvm/local-array-reads.test.js +1 -1
- package/dist/backend/llvm/local-array-reads.test.js.map +1 -1
- package/dist/backend/llvm/local-extents.d.ts +22 -0
- package/dist/backend/llvm/local-extents.js +102 -0
- package/dist/backend/llvm/local-extents.js.map +1 -1
- package/dist/backend/llvm/local-union-storage.js +15 -2
- package/dist/backend/llvm/local-union-storage.js.map +1 -1
- package/dist/backend/llvm/local-union-storage.test.js +1 -1
- package/dist/backend/llvm/local-union-storage.test.js.map +1 -1
- package/dist/backend/llvm/loop-callees.d.ts +21 -0
- package/dist/backend/llvm/loop-callees.js +119 -0
- package/dist/backend/llvm/loop-callees.js.map +1 -0
- package/dist/backend/llvm/loop-callees.test.d.ts +1 -0
- package/dist/backend/llvm/loop-callees.test.js +65 -0
- package/dist/backend/llvm/loop-callees.test.js.map +1 -0
- package/dist/backend/llvm/loop-entry-versions.d.ts +17 -0
- package/dist/backend/llvm/loop-entry-versions.js +185 -0
- package/dist/backend/llvm/loop-entry-versions.js.map +1 -0
- package/dist/backend/llvm/map-number-lookup.js.map +1 -1
- package/dist/backend/llvm/map-number-lookup.test.js +13 -4
- package/dist/backend/llvm/map-number-lookup.test.js.map +1 -1
- package/dist/backend/llvm/map-read-lifetimes.d.ts +11 -0
- package/dist/backend/llvm/map-read-lifetimes.js +51 -1
- package/dist/backend/llvm/map-read-lifetimes.js.map +1 -1
- package/dist/backend/llvm/map-read-lifetimes.test.js +6 -3
- package/dist/backend/llvm/map-read-lifetimes.test.js.map +1 -1
- package/dist/backend/llvm/nullable-unions.d.ts +67 -10
- package/dist/backend/llvm/nullable-unions.js +218 -22
- package/dist/backend/llvm/nullable-unions.js.map +1 -1
- package/dist/backend/llvm/nullable-unions.test.js +124 -1
- package/dist/backend/llvm/nullable-unions.test.js.map +1 -1
- package/dist/backend/llvm/periodic-guards.d.ts +16 -0
- package/dist/backend/llvm/periodic-guards.js +91 -0
- package/dist/backend/llvm/periodic-guards.js.map +1 -0
- package/dist/backend/llvm/periodic-guards.test.d.ts +1 -0
- package/dist/backend/llvm/periodic-guards.test.js +64 -0
- package/dist/backend/llvm/periodic-guards.test.js.map +1 -0
- package/dist/backend/llvm/publish.d.ts +12 -2
- package/dist/backend/llvm/publish.js +15 -8
- package/dist/backend/llvm/publish.js.map +1 -1
- package/dist/backend/llvm/rebound-parameters.d.ts +4 -1
- package/dist/backend/llvm/rebound-parameters.js +17 -1
- package/dist/backend/llvm/rebound-parameters.js.map +1 -1
- package/dist/backend/llvm/receivers.d.ts +7 -0
- package/dist/backend/llvm/receivers.js +77 -10
- package/dist/backend/llvm/receivers.js.map +1 -1
- package/dist/backend/llvm/record-union-keys.test.js +29 -0
- package/dist/backend/llvm/record-union-keys.test.js.map +1 -1
- package/dist/backend/llvm/record-views.d.ts +29 -0
- package/dist/backend/llvm/record-views.js +249 -0
- package/dist/backend/llvm/record-views.js.map +1 -0
- package/dist/backend/llvm/record-views.test.d.ts +1 -0
- package/dist/backend/llvm/record-views.test.js +118 -0
- package/dist/backend/llvm/record-views.test.js.map +1 -0
- package/dist/backend/llvm/reference-writes.js +21 -0
- package/dist/backend/llvm/reference-writes.js.map +1 -1
- package/dist/backend/llvm/reference-writes.test.js +42 -0
- package/dist/backend/llvm/reference-writes.test.js.map +1 -1
- package/dist/backend/llvm/regex-matchers.d.ts +5 -1
- package/dist/backend/llvm/regex-matchers.js +173 -21
- package/dist/backend/llvm/regex-matchers.js.map +1 -1
- package/dist/backend/llvm/regex-matchers.test.js +39 -1
- package/dist/backend/llvm/regex-matchers.test.js.map +1 -1
- package/dist/backend/llvm/region-groups.d.ts +67 -0
- package/dist/backend/llvm/region-groups.js +1719 -0
- package/dist/backend/llvm/region-groups.js.map +1 -0
- package/dist/backend/llvm/region-groups.test.d.ts +1 -0
- package/dist/backend/llvm/region-groups.test.js +197 -0
- package/dist/backend/llvm/region-groups.test.js.map +1 -0
- package/dist/backend/llvm/region-ir.d.ts +31 -0
- package/dist/backend/llvm/region-ir.js +256 -0
- package/dist/backend/llvm/region-ir.js.map +1 -0
- package/dist/backend/llvm/region-sites.d.ts +20 -0
- package/dist/backend/llvm/region-sites.js +327 -0
- package/dist/backend/llvm/region-sites.js.map +1 -0
- package/dist/backend/llvm/region-sites.test.d.ts +1 -0
- package/dist/backend/llvm/region-sites.test.js +216 -0
- package/dist/backend/llvm/region-sites.test.js.map +1 -0
- package/dist/backend/llvm/repr-report.d.ts +9 -0
- package/dist/backend/llvm/repr-report.js +143 -0
- package/dist/backend/llvm/repr-report.js.map +1 -0
- package/dist/backend/llvm/repr-report.test.d.ts +1 -0
- package/dist/backend/llvm/repr-report.test.js +62 -0
- package/dist/backend/llvm/repr-report.test.js.map +1 -0
- package/dist/backend/llvm/runtime-registries.test.d.ts +1 -0
- package/dist/backend/llvm/runtime-registries.test.js +88 -0
- package/dist/backend/llvm/runtime-registries.test.js.map +1 -0
- package/dist/backend/llvm/serialized-ir-emission.test.js +1 -0
- package/dist/backend/llvm/serialized-ir-emission.test.js.map +1 -1
- package/dist/backend/llvm/shape-union-tags.test.d.ts +1 -0
- package/dist/backend/llvm/shape-union-tags.test.js +75 -0
- package/dist/backend/llvm/shape-union-tags.test.js.map +1 -0
- package/dist/backend/llvm/shapes.d.ts +60 -10
- package/dist/backend/llvm/shapes.js +233 -51
- package/dist/backend/llvm/shapes.js.map +1 -1
- package/dist/backend/llvm/shapes.test.js +37 -18
- package/dist/backend/llvm/shapes.test.js.map +1 -1
- package/dist/backend/llvm/speculative-integers.d.ts +3 -0
- package/dist/backend/llvm/speculative-integers.js +20 -8
- package/dist/backend/llvm/speculative-integers.js.map +1 -1
- package/dist/backend/llvm/split.js +6 -1
- package/dist/backend/llvm/split.js.map +1 -1
- package/dist/backend/llvm/split.test.js +23 -0
- package/dist/backend/llvm/split.test.js.map +1 -1
- package/dist/backend/llvm/stack-callbacks.js +4 -2
- package/dist/backend/llvm/stack-callbacks.js.map +1 -1
- package/dist/backend/llvm/stack-objects.d.ts +12 -3
- package/dist/backend/llvm/stack-objects.js +110 -22
- package/dist/backend/llvm/stack-objects.js.map +1 -1
- package/dist/backend/llvm/stack-objects.test.js +144 -0
- package/dist/backend/llvm/stack-objects.test.js.map +1 -1
- package/dist/backend/llvm/stack-unions.test.js +24 -1
- package/dist/backend/llvm/stack-unions.test.js.map +1 -1
- package/dist/backend/llvm/string-lifetimes.js +2 -1
- package/dist/backend/llvm/string-lifetimes.js.map +1 -1
- package/dist/backend/llvm/string-lifetimes.test.js +1 -1
- package/dist/backend/llvm/string-lifetimes.test.js.map +1 -1
- package/dist/backend/llvm/string-reads.d.ts +4 -0
- package/dist/backend/llvm/string-reads.js +27 -0
- package/dist/backend/llvm/string-reads.js.map +1 -1
- package/dist/backend/llvm/test-boxed-unions.d.ts +10 -8
- package/dist/backend/llvm/test-boxed-unions.js +20 -25
- package/dist/backend/llvm/test-boxed-unions.js.map +1 -1
- package/dist/backend/llvm/union-repr.js +9 -8
- package/dist/backend/llvm/union-repr.js.map +1 -1
- package/dist/backend/llvm/union-retype.test.js +45 -2
- package/dist/backend/llvm/union-retype.test.js.map +1 -1
- package/dist/backend/llvm/unwind-abi.d.ts +20 -8
- package/dist/backend/llvm/unwind-abi.js +177 -70
- package/dist/backend/llvm/unwind-abi.js.map +1 -1
- package/dist/backend/llvm/unwind-abi.test.js +90 -3
- package/dist/backend/llvm/unwind-abi.test.js.map +1 -1
- package/dist/backend/llvm/walk-borrows.d.ts +3 -2
- package/dist/backend/llvm/walk-borrows.js +2 -2
- package/dist/backend/llvm/walk-borrows.js.map +1 -1
- package/dist/backend/llvm/walk-borrows.test.js +18 -0
- package/dist/backend/llvm/walk-borrows.test.js.map +1 -1
- package/dist/backend/llvm/walkers.d.ts +14 -1
- package/dist/backend/llvm/walkers.js +103 -11
- package/dist/backend/llvm/walkers.js.map +1 -1
- package/dist/backend/llvm/wrapping-sums.d.ts +26 -6
- package/dist/backend/llvm/wrapping-sums.js +64 -12
- package/dist/backend/llvm/wrapping-sums.js.map +1 -1
- package/dist/backend/loop-polls.d.ts +4 -2
- package/dist/backend/loop-polls.js +11 -2
- package/dist/backend/loop-polls.js.map +1 -1
- package/dist/backend/mangle.d.ts +0 -5
- package/dist/backend/mangle.js +0 -9
- package/dist/backend/mangle.js.map +1 -1
- package/dist/backend/may-throw.d.ts +10 -9
- package/dist/backend/may-throw.js +189 -27
- package/dist/backend/may-throw.js.map +1 -1
- package/dist/backend/may-throw.test.js +44 -7
- package/dist/backend/may-throw.test.js.map +1 -1
- package/dist/backend/native/compiler-fingerprint.d.ts +5 -0
- package/dist/backend/native/compiler-fingerprint.js +62 -16
- package/dist/backend/native/compiler-fingerprint.js.map +1 -1
- package/dist/backend/native/contracts.d.ts +31 -8
- package/dist/backend/native/executable.js +56 -32
- package/dist/backend/native/executable.js.map +1 -1
- package/dist/backend/native/library.js +3 -4
- package/dist/backend/native/library.js.map +1 -1
- package/dist/backend/native/object-merge.d.ts +3 -1
- package/dist/backend/native/object-merge.js +24 -11
- package/dist/backend/native/object-merge.js.map +1 -1
- package/dist/backend/native/program-shards.js +6 -3
- package/dist/backend/native/program-shards.js.map +1 -1
- package/dist/backend/native/runtime-inputs.d.ts +1 -1
- package/dist/backend/native/runtime-inputs.js +3 -0
- package/dist/backend/native/runtime-inputs.js.map +1 -1
- package/dist/backend/native/vendor.d.ts +1 -1
- package/dist/backend/native-codegen-core.d.ts +15 -6
- package/dist/backend/native-codegen-core.js +20 -9
- package/dist/backend/native-codegen-core.js.map +1 -1
- package/dist/backend/native-codegen.js +51 -5
- package/dist/backend/native-codegen.js.map +1 -1
- package/dist/backend/native-codegen.test.js +82 -8
- package/dist/backend/native-codegen.test.js.map +1 -1
- package/dist/backend/native-link-info-core.d.ts +30 -0
- package/dist/backend/native-link-info-core.js.map +1 -1
- package/dist/backend/native-profile.d.ts +68 -4
- package/dist/backend/native-profile.js +86 -14
- package/dist/backend/native-profile.js.map +1 -1
- package/dist/backend/native-profile.test.js +127 -4
- package/dist/backend/native-profile.test.js.map +1 -1
- package/dist/backend/native-toolchain.d.ts +1 -1
- package/dist/backend/native-toolchain.js +1 -1
- package/dist/backend/native-toolchain.js.map +1 -1
- package/dist/backend/native-toolchain.test.js +58 -4
- package/dist/backend/native-toolchain.test.js.map +1 -1
- package/dist/backend/native-tools.d.ts +17 -3
- package/dist/backend/native-tools.js +12 -4
- package/dist/backend/native-tools.js.map +1 -1
- package/dist/backend/native-tools.test.d.ts +1 -0
- package/dist/backend/native-tools.test.js +76 -0
- package/dist/backend/native-tools.test.js.map +1 -0
- package/dist/backend/object-localize.js +69 -9
- package/dist/backend/object-localize.js.map +1 -1
- package/dist/backend/object-localize.test.js +99 -10
- package/dist/backend/object-localize.test.js.map +1 -1
- package/dist/backend/publication.d.ts +2 -0
- package/dist/backend/publication.js +4 -0
- package/dist/backend/publication.js.map +1 -1
- package/dist/backend/runtime-abi.d.ts +2 -2
- package/dist/backend/runtime-abi.js +2 -2
- package/dist/backend/runtime-pack-core.d.ts +19 -0
- package/dist/backend/runtime-pack-core.js +23 -3
- package/dist/backend/runtime-pack-core.js.map +1 -1
- package/dist/backend/runtime-pack-targets.test.js +1 -1
- package/dist/backend/runtime-pack.test.js +48 -2
- package/dist/backend/runtime-pack.test.js.map +1 -1
- package/dist/backend/target-cpu.d.ts +2 -0
- package/dist/backend/target-cpu.js +4 -0
- package/dist/backend/target-cpu.js.map +1 -1
- package/dist/backend/target-diagnostics.js +1 -19
- package/dist/backend/target-diagnostics.js.map +1 -1
- package/dist/backend/target-diagnostics.test.js +1 -1
- package/dist/backend/target-diagnostics.test.js.map +1 -1
- package/dist/backend/targets.d.ts +28 -0
- package/dist/backend/targets.js +70 -0
- package/dist/backend/targets.js.map +1 -1
- package/dist/backend/targets.test.js +75 -1
- package/dist/backend/targets.test.js.map +1 -1
- package/dist/backend/vendor-archives.d.ts +1 -1
- package/dist/backend/vendor-archives.js +25 -12
- package/dist/backend/vendor-archives.js.map +1 -1
- package/dist/backend/vendor-inputs.d.ts +15 -2
- package/dist/backend/vendor-inputs.js +59 -3
- package/dist/backend/vendor-inputs.js.map +1 -1
- package/dist/backend/vendor-inputs.test.d.ts +1 -0
- package/dist/backend/vendor-inputs.test.js +74 -0
- package/dist/backend/vendor-inputs.test.js.map +1 -0
- package/dist/cli/command.js +95 -5
- package/dist/cli/command.js.map +1 -1
- package/dist/cli/host.d.ts +3 -0
- package/dist/cli/output-options.d.ts +3 -0
- package/dist/cli/output-options.js +8 -2
- package/dist/cli/output-options.js.map +1 -1
- package/dist/cli/usage.d.ts +28 -1
- package/dist/cli/usage.js +56 -6
- package/dist/cli/usage.js.map +1 -1
- package/dist/compat/fetch-profile.d.ts +3 -0
- package/dist/compat/fetch-profile.js +23 -3
- package/dist/compat/fetch-profile.js.map +1 -1
- package/dist/compile-types.d.ts +45 -0
- package/dist/contracts/check.js +70 -2
- package/dist/contracts/check.js.map +1 -1
- package/dist/contracts/int32-elements.d.ts +2 -1
- package/dist/contracts/int32-elements.js.map +1 -1
- package/dist/coverage/report.d.ts +5 -1
- package/dist/coverage/report.js +83 -2
- package/dist/coverage/report.js.map +1 -1
- package/dist/coverage/verdict-cache.d.ts +2 -0
- package/dist/coverage/verdict-cache.js +5 -10
- package/dist/coverage/verdict-cache.js.map +1 -1
- package/dist/diagnostics/codes.d.ts +145 -0
- package/dist/diagnostics/codes.js +159 -0
- package/dist/diagnostics/codes.js.map +1 -0
- package/dist/diagnostics/codes.test.d.ts +1 -0
- package/dist/diagnostics/codes.test.js +78 -0
- package/dist/diagnostics/codes.test.js.map +1 -0
- package/dist/diagnostics/diagnostic.d.ts +101 -2
- package/dist/diagnostics/diagnostic.js +155 -0
- package/dist/diagnostics/diagnostic.js.map +1 -1
- package/dist/diagnostics/dynamic-slots.d.ts +23 -0
- package/dist/diagnostics/dynamic-slots.js +29 -0
- package/dist/diagnostics/dynamic-slots.js.map +1 -0
- package/dist/diagnostics/dynamic-tier.d.ts +6 -0
- package/dist/diagnostics/dynamic-tier.js +8 -1
- package/dist/diagnostics/dynamic-tier.js.map +1 -1
- package/dist/diagnostics/envelope.d.ts +43 -1
- package/dist/diagnostics/envelope.js +19 -1
- package/dist/diagnostics/envelope.js.map +1 -1
- package/dist/diagnostics/envelope.test.js.map +1 -1
- package/dist/diagnostics/render.d.ts +3 -1
- package/dist/diagnostics/render.js +27 -6
- package/dist/diagnostics/render.js.map +1 -1
- package/dist/executable/executable-cache.d.ts +41 -0
- package/dist/executable/executable-cache.js +39 -1
- package/dist/executable/executable-cache.js.map +1 -1
- package/dist/executable/executable-cache.test.js +4 -1
- package/dist/executable/executable-cache.test.js.map +1 -1
- package/dist/executable/prepare.d.ts +2 -1
- package/dist/executable/prepare.js +421 -10
- package/dist/executable/prepare.js.map +1 -1
- package/dist/frontend/analysis.js +1 -0
- package/dist/frontend/analysis.js.map +1 -1
- package/dist/frontend/canon-map.d.ts +17 -0
- package/dist/frontend/canon-map.js +177 -0
- package/dist/frontend/canon-map.js.map +1 -0
- package/dist/frontend/canon.d.ts +122 -0
- package/dist/frontend/canon.js +462 -0
- package/dist/frontend/canon.js.map +1 -0
- package/dist/frontend/contract-types.d.ts +9 -1
- package/dist/frontend/contract-types.js +46 -4
- package/dist/frontend/contract-types.js.map +1 -1
- package/dist/frontend/decl-projection.d.ts +3 -0
- package/dist/frontend/decl-projection.js +121 -3
- package/dist/frontend/decl-projection.js.map +1 -1
- package/dist/frontend/dts-paths.d.ts +17 -4
- package/dist/frontend/dts-paths.js +149 -5
- package/dist/frontend/dts-paths.js.map +1 -1
- package/dist/frontend/fork-target.js +4 -4
- package/dist/frontend/fork-target.js.map +1 -1
- package/dist/frontend/fork-target.test.js +3 -3
- package/dist/frontend/fork-target.test.js.map +1 -1
- package/dist/frontend/heritage-elements.d.ts +15 -0
- package/dist/frontend/heritage-elements.js +18 -0
- package/dist/frontend/heritage-elements.js.map +1 -0
- package/dist/frontend/heritage-elements.test.d.ts +1 -0
- package/dist/frontend/heritage-elements.test.js +68 -0
- package/dist/frontend/heritage-elements.test.js.map +1 -0
- package/dist/frontend/input-tracker.d.ts +20 -0
- package/dist/frontend/input-tracker.js +74 -4
- package/dist/frontend/input-tracker.js.map +1 -1
- package/dist/frontend/input-tracker.test.js +66 -0
- package/dist/frontend/input-tracker.test.js.map +1 -1
- package/dist/frontend/lowering/any-collection-residue.d.ts +9 -0
- package/dist/frontend/lowering/any-collection-residue.js +42 -0
- package/dist/frontend/lowering/any-collection-residue.js.map +1 -0
- package/dist/frontend/lowering/array-values.d.ts +44 -2
- package/dist/frontend/lowering/array-values.js +193 -3
- package/dist/frontend/lowering/array-values.js.map +1 -1
- package/dist/frontend/lowering/builtin-namespaces.d.ts +6 -2
- package/dist/frontend/lowering/builtin-namespaces.js +28 -6
- package/dist/frontend/lowering/builtin-namespaces.js.map +1 -1
- package/dist/frontend/lowering/builtins/array-classes.d.ts +69 -0
- package/dist/frontend/lowering/builtins/array-classes.js +729 -0
- package/dist/frontend/lowering/builtins/array-classes.js.map +1 -0
- package/dist/frontend/lowering/builtins/callable-aliases.js +4 -0
- package/dist/frontend/lowering/builtins/callable-aliases.js.map +1 -1
- package/dist/frontend/lowering/builtins/child-process-methods.js +34 -0
- package/dist/frontend/lowering/builtins/child-process-methods.js.map +1 -1
- package/dist/frontend/lowering/builtins/disposable-stack.js +1 -3
- package/dist/frontend/lowering/builtins/disposable-stack.js.map +1 -1
- package/dist/frontend/lowering/builtins/errors.d.ts +13 -9
- package/dist/frontend/lowering/builtins/errors.js +136 -56
- package/dist/frontend/lowering/builtins/errors.js.map +1 -1
- package/dist/frontend/lowering/builtins/filesystem-calls.d.ts +1 -0
- package/dist/frontend/lowering/builtins/filesystem-calls.js +85 -4
- package/dist/frontend/lowering/builtins/filesystem-calls.js.map +1 -1
- package/dist/frontend/lowering/builtins/filesystem.d.ts +11 -6
- package/dist/frontend/lowering/builtins/filesystem.js +270 -24
- package/dist/frontend/lowering/builtins/filesystem.js.map +1 -1
- package/dist/frontend/lowering/builtins/json.js +7 -1
- package/dist/frontend/lowering/builtins/json.js.map +1 -1
- package/dist/frontend/lowering/builtins/mime.d.ts +25 -0
- package/dist/frontend/lowering/builtins/mime.js +167 -0
- package/dist/frontend/lowering/builtins/mime.js.map +1 -0
- package/dist/frontend/lowering/builtins/module-bindings.d.ts +3 -0
- package/dist/frontend/lowering/builtins/module-bindings.js +6 -0
- package/dist/frontend/lowering/builtins/module-bindings.js.map +1 -1
- package/dist/frontend/lowering/builtins/module-calls.js +79 -12
- package/dist/frontend/lowering/builtins/module-calls.js.map +1 -1
- package/dist/frontend/lowering/builtins/module-resolution.d.ts +7 -4
- package/dist/frontend/lowering/builtins/module-resolution.js +115 -13
- package/dist/frontend/lowering/builtins/module-resolution.js.map +1 -1
- package/dist/frontend/lowering/builtins/navigator.d.ts +3 -1
- package/dist/frontend/lowering/builtins/navigator.js +22 -8
- package/dist/frontend/lowering/builtins/navigator.js.map +1 -1
- package/dist/frontend/lowering/builtins/process.js +49 -9
- package/dist/frontend/lowering/builtins/process.js.map +1 -1
- package/dist/frontend/lowering/builtins/promises.js +18 -3
- package/dist/frontend/lowering/builtins/promises.js.map +1 -1
- package/dist/frontend/lowering/builtins/promisify-callback.d.ts +6 -2
- package/dist/frontend/lowering/builtins/promisify-callback.js +19 -6
- package/dist/frontend/lowering/builtins/promisify-callback.js.map +1 -1
- package/dist/frontend/lowering/builtins/properties.js +23 -5
- package/dist/frontend/lowering/builtins/properties.js.map +1 -1
- package/dist/frontend/lowering/builtins/web-streams-dyn.d.ts +42 -0
- package/dist/frontend/lowering/builtins/web-streams-dyn.js +321 -0
- package/dist/frontend/lowering/builtins/web-streams-dyn.js.map +1 -0
- package/dist/frontend/lowering/builtins/x509.js +35 -5
- package/dist/frontend/lowering/builtins/x509.js.map +1 -1
- package/dist/frontend/lowering/call-arguments.d.ts +14 -1
- package/dist/frontend/lowering/call-arguments.js +84 -70
- package/dist/frontend/lowering/call-arguments.js.map +1 -1
- package/dist/frontend/lowering/call-signatures.js +108 -24
- package/dist/frontend/lowering/call-signatures.js.map +1 -1
- package/dist/frontend/lowering/class-attributes.js +6 -5
- package/dist/frontend/lowering/class-attributes.js.map +1 -1
- package/dist/frontend/lowering/class-dynamic-dispatch.js +40 -19
- package/dist/frontend/lowering/class-dynamic-dispatch.js.map +1 -1
- package/dist/frontend/lowering/class-dynamic-dispatch.test.js +1 -0
- package/dist/frontend/lowering/class-dynamic-dispatch.test.js.map +1 -1
- package/dist/frontend/lowering/class-protocol-dispatch.js +4 -0
- package/dist/frontend/lowering/class-protocol-dispatch.js.map +1 -1
- package/dist/frontend/lowering/class-protocols.d.ts +61 -1
- package/dist/frontend/lowering/class-protocols.js +297 -21
- package/dist/frontend/lowering/class-protocols.js.map +1 -1
- package/dist/frontend/lowering/class-to-primitive.d.ts +3 -2
- package/dist/frontend/lowering/class-to-primitive.js +15 -5
- package/dist/frontend/lowering/class-to-primitive.js.map +1 -1
- package/dist/frontend/lowering/coercions/asserted.d.ts +16 -0
- package/dist/frontend/lowering/coercions/asserted.js +79 -0
- package/dist/frontend/lowering/coercions/asserted.js.map +1 -0
- package/dist/frontend/lowering/coercions/function-adapters.d.ts +13 -0
- package/dist/frontend/lowering/coercions/function-adapters.js +70 -3
- package/dist/frontend/lowering/coercions/function-adapters.js.map +1 -1
- package/dist/frontend/lowering/coercions/state.d.ts +23 -0
- package/dist/frontend/lowering/coercions/state.js +9 -0
- package/dist/frontend/lowering/coercions/state.js.map +1 -1
- package/dist/frontend/lowering/coercions/structural-plans.js +67 -1
- package/dist/frontend/lowering/coercions/structural-plans.js.map +1 -1
- package/dist/frontend/lowering/coercions/structural.d.ts +10 -0
- package/dist/frontend/lowering/coercions/structural.js +134 -4
- package/dist/frontend/lowering/coercions/structural.js.map +1 -1
- package/dist/frontend/lowering/coercions/unions.d.ts +11 -0
- package/dist/frontend/lowering/coercions/unions.js +83 -4
- package/dist/frontend/lowering/coercions/unions.js.map +1 -1
- package/dist/frontend/lowering/completion-callbacks.js +3 -2
- package/dist/frontend/lowering/completion-callbacks.js.map +1 -1
- package/dist/frontend/lowering/containers/array-callbacks.d.ts +10 -0
- package/dist/frontend/lowering/containers/array-callbacks.js +224 -81
- package/dist/frontend/lowering/containers/array-callbacks.js.map +1 -1
- package/dist/frontend/lowering/containers/array-concat.d.ts +5 -2
- package/dist/frontend/lowering/containers/array-concat.js +76 -7
- package/dist/frontend/lowering/containers/array-concat.js.map +1 -1
- package/dist/frontend/lowering/containers/array-construction.d.ts +9 -4
- package/dist/frontend/lowering/containers/array-construction.js +112 -100
- package/dist/frontend/lowering/containers/array-construction.js.map +1 -1
- package/dist/frontend/lowering/containers/array-methods.js +193 -45
- package/dist/frontend/lowering/containers/array-methods.js.map +1 -1
- package/dist/frontend/lowering/containers/array-pipelines.d.ts +3 -0
- package/dist/frontend/lowering/containers/array-pipelines.js +81 -13
- package/dist/frontend/lowering/containers/array-pipelines.js.map +1 -1
- package/dist/frontend/lowering/containers/callback-arguments.d.ts +1 -0
- package/dist/frontend/lowering/containers/callback-arguments.js +28 -2
- package/dist/frontend/lowering/containers/callback-arguments.js.map +1 -1
- package/dist/frontend/lowering/containers/collection-methods.js +13 -3
- package/dist/frontend/lowering/containers/collection-methods.js.map +1 -1
- package/dist/frontend/lowering/containers/filter-predicates.js +34 -3
- package/dist/frontend/lowering/containers/filter-predicates.js.map +1 -1
- package/dist/frontend/lowering/containers/indexed-objects.d.ts +34 -1
- package/dist/frontend/lowering/containers/indexed-objects.js +131 -72
- package/dist/frontend/lowering/containers/indexed-objects.js.map +1 -1
- package/dist/frontend/lowering/cycle-initialization.js +43 -6
- package/dist/frontend/lowering/cycle-initialization.js.map +1 -1
- package/dist/frontend/lowering/decl-origin.d.ts +49 -0
- package/dist/frontend/lowering/decl-origin.js +402 -0
- package/dist/frontend/lowering/decl-origin.js.map +1 -0
- package/dist/frontend/lowering/deferred-module-initializers.d.ts +2 -0
- package/dist/frontend/lowering/deferred-module-initializers.js +7 -0
- package/dist/frontend/lowering/deferred-module-initializers.js.map +1 -1
- package/dist/frontend/lowering/divergences.js +5 -0
- package/dist/frontend/lowering/divergences.js.map +1 -1
- package/dist/frontend/lowering/dynamic-tier.d.ts +8 -2
- package/dist/frontend/lowering/dynamic-tier.js +111 -3
- package/dist/frontend/lowering/dynamic-tier.js.map +1 -1
- package/dist/frontend/lowering/expressions/array-literals.d.ts +14 -1
- package/dist/frontend/lowering/expressions/array-literals.js +43 -5
- package/dist/frontend/lowering/expressions/array-literals.js.map +1 -1
- package/dist/frontend/lowering/expressions/asserted-receiver.d.ts +48 -0
- package/dist/frontend/lowering/expressions/asserted-receiver.js +233 -0
- package/dist/frontend/lowering/expressions/asserted-receiver.js.map +1 -0
- package/dist/frontend/lowering/expressions/binary.js +136 -1
- package/dist/frontend/lowering/expressions/binary.js.map +1 -1
- package/dist/frontend/lowering/expressions/element-access.d.ts +7 -0
- package/dist/frontend/lowering/expressions/element-access.js +363 -12
- package/dist/frontend/lowering/expressions/element-access.js.map +1 -1
- package/dist/frontend/lowering/expressions/identifiers.d.ts +3 -0
- package/dist/frontend/lowering/expressions/identifiers.js +78 -62
- package/dist/frontend/lowering/expressions/identifiers.js.map +1 -1
- package/dist/frontend/lowering/expressions/message-listeners.d.ts +3 -0
- package/dist/frontend/lowering/expressions/message-listeners.js +19 -0
- package/dist/frontend/lowering/expressions/message-listeners.js.map +1 -0
- package/dist/frontend/lowering/expressions/narrowing.js +224 -6
- package/dist/frontend/lowering/expressions/narrowing.js.map +1 -1
- package/dist/frontend/lowering/expressions/nullish-assignment.js +5 -2
- package/dist/frontend/lowering/expressions/nullish-assignment.js.map +1 -1
- package/dist/frontend/lowering/expressions/object-literals.d.ts +1 -1
- package/dist/frontend/lowering/expressions/object-literals.js +282 -24
- package/dist/frontend/lowering/expressions/object-literals.js.map +1 -1
- package/dist/frontend/lowering/expressions/property-access.d.ts +15 -3
- package/dist/frontend/lowering/expressions/property-access.js +397 -74
- package/dist/frontend/lowering/expressions/property-access.js.map +1 -1
- package/dist/frontend/lowering/expressions/relational.js +202 -70
- package/dist/frontend/lowering/expressions/relational.js.map +1 -1
- package/dist/frontend/lowering/expressions/typeof.js +9 -1
- package/dist/frontend/lowering/expressions/typeof.js.map +1 -1
- package/dist/frontend/lowering/expressions/union-fields.d.ts +28 -8
- package/dist/frontend/lowering/expressions/union-fields.js +168 -14
- package/dist/frontend/lowering/expressions/union-fields.js.map +1 -1
- package/dist/frontend/lowering/frozen-records.d.ts +8 -0
- package/dist/frontend/lowering/frozen-records.js +56 -9
- package/dist/frontend/lowering/frozen-records.js.map +1 -1
- package/dist/frontend/lowering/function-context.d.ts +3 -0
- package/dist/frontend/lowering/function-context.js +4 -1
- package/dist/frontend/lowering/function-context.js.map +1 -1
- package/dist/frontend/lowering/function-returns.d.ts +4 -0
- package/dist/frontend/lowering/function-returns.js +231 -2
- package/dist/frontend/lowering/function-returns.js.map +1 -1
- package/dist/frontend/lowering/generator-delegation.js +3 -2
- package/dist/frontend/lowering/generator-delegation.js.map +1 -1
- package/dist/frontend/lowering/generator-dynamic-dispatch.d.ts +26 -0
- package/dist/frontend/lowering/generator-dynamic-dispatch.js +294 -2
- package/dist/frontend/lowering/generator-dynamic-dispatch.js.map +1 -1
- package/dist/frontend/lowering/generic-functions.d.ts +10 -0
- package/dist/frontend/lowering/generic-functions.js +67 -7
- package/dist/frontend/lowering/generic-functions.js.map +1 -1
- package/dist/frontend/lowering/global-values.d.ts +37 -0
- package/dist/frontend/lowering/global-values.js +395 -0
- package/dist/frontend/lowering/global-values.js.map +1 -0
- package/dist/frontend/lowering/handle-properties.js +3 -2
- package/dist/frontend/lowering/handle-properties.js.map +1 -1
- package/dist/frontend/lowering/handle-properties.test.d.ts +1 -0
- package/dist/frontend/lowering/handle-properties.test.js +25 -0
- package/dist/frontend/lowering/handle-properties.test.js.map +1 -0
- package/dist/frontend/lowering/import-meta.d.ts +3 -0
- package/dist/frontend/lowering/import-meta.js +8 -3
- package/dist/frontend/lowering/import-meta.js.map +1 -1
- package/dist/frontend/lowering/iterator-adapters.js +3 -3
- package/dist/frontend/lowering/iterator-adapters.js.map +1 -1
- package/dist/frontend/lowering/key-order-witness.d.ts +2 -0
- package/dist/frontend/lowering/key-order-witness.js +10 -0
- package/dist/frontend/lowering/key-order-witness.js.map +1 -1
- package/dist/frontend/lowering/lower-array-sort.d.ts +5 -1
- package/dist/frontend/lowering/lower-array-sort.js +16 -2
- package/dist/frontend/lowering/lower-array-sort.js.map +1 -1
- package/dist/frontend/lowering/lower-builtin-values.d.ts +7 -0
- package/dist/frontend/lowering/lower-builtin-values.js +65 -16
- package/dist/frontend/lowering/lower-builtin-values.js.map +1 -1
- package/dist/frontend/lowering/lower-calls.js +222 -24
- package/dist/frontend/lowering/lower-calls.js.map +1 -1
- package/dist/frontend/lowering/lower-classes.d.ts +6 -0
- package/dist/frontend/lowering/lower-classes.js +154 -20
- package/dist/frontend/lowering/lower-classes.js.map +1 -1
- package/dist/frontend/lowering/lower-console.js +25 -2
- package/dist/frontend/lowering/lower-console.js.map +1 -1
- package/dist/frontend/lowering/lower-exprs.d.ts +29 -0
- package/dist/frontend/lowering/lower-exprs.js +544 -24
- package/dist/frontend/lowering/lower-exprs.js.map +1 -1
- package/dist/frontend/lowering/lower-functions.js +93 -18
- package/dist/frontend/lowering/lower-functions.js.map +1 -1
- package/dist/frontend/lowering/lower-global-value.d.ts +4 -1
- package/dist/frontend/lowering/lower-global-value.js +10 -3
- package/dist/frontend/lowering/lower-global-value.js.map +1 -1
- package/dist/frontend/lowering/lower-inspect.d.ts +44 -4
- package/dist/frontend/lowering/lower-inspect.js +723 -26
- package/dist/frontend/lowering/lower-inspect.js.map +1 -1
- package/dist/frontend/lowering/lower-modules.d.ts +3 -1
- package/dist/frontend/lowering/lower-modules.js +189 -24
- package/dist/frontend/lowering/lower-modules.js.map +1 -1
- package/dist/frontend/lowering/lower-namespaces.d.ts +7 -0
- package/dist/frontend/lowering/lower-namespaces.js +23 -0
- package/dist/frontend/lowering/lower-namespaces.js.map +1 -1
- package/dist/frontend/lowering/lower-node-island.d.ts +74 -0
- package/dist/frontend/lowering/lower-node-island.js +1931 -0
- package/dist/frontend/lowering/lower-node-island.js.map +1 -0
- package/dist/frontend/lowering/lower-server.js +44 -0
- package/dist/frontend/lowering/lower-server.js.map +1 -1
- package/dist/frontend/lowering/lower-shared-modules.d.ts +27 -0
- package/dist/frontend/lowering/lower-shared-modules.js +611 -0
- package/dist/frontend/lowering/lower-shared-modules.js.map +1 -0
- package/dist/frontend/lowering/lower-stdlib.js +85 -9
- package/dist/frontend/lowering/lower-stdlib.js.map +1 -1
- package/dist/frontend/lowering/lower-stmts.d.ts +2 -6
- package/dist/frontend/lowering/lower-stmts.js +781 -143
- package/dist/frontend/lowering/lower-stmts.js.map +1 -1
- package/dist/frontend/lowering/lower-stream.js +548 -36
- package/dist/frontend/lowering/lower-stream.js.map +1 -1
- package/dist/frontend/lowering/lower-timers.js +9 -0
- package/dist/frontend/lowering/lower-timers.js.map +1 -1
- package/dist/frontend/lowering/lowerer.d.ts +514 -10
- package/dist/frontend/lowering/lowerer.js +2667 -163
- package/dist/frontend/lowering/lowerer.js.map +1 -1
- package/dist/frontend/lowering/lowerer.test.js +44 -1
- package/dist/frontend/lowering/lowerer.test.js.map +1 -1
- package/dist/frontend/lowering/maybe-promise.d.ts +6 -0
- package/dist/frontend/lowering/maybe-promise.js +13 -0
- package/dist/frontend/lowering/maybe-promise.js.map +1 -1
- package/dist/frontend/lowering/module-namespace-elements.d.ts +12 -0
- package/dist/frontend/lowering/module-namespace-elements.js +114 -18
- package/dist/frontend/lowering/module-namespace-elements.js.map +1 -1
- package/dist/frontend/lowering/nan-coded-reads.d.ts +11 -0
- package/dist/frontend/lowering/nan-coded-reads.js +45 -2
- package/dist/frontend/lowering/nan-coded-reads.js.map +1 -1
- package/dist/frontend/lowering/narrowing-stability.d.ts +4 -0
- package/dist/frontend/lowering/narrowing-stability.js +14 -6
- package/dist/frontend/lowering/narrowing-stability.js.map +1 -1
- package/dist/frontend/lowering/receiver-returns.d.ts +3 -0
- package/dist/frontend/lowering/receiver-returns.js +134 -0
- package/dist/frontend/lowering/receiver-returns.js.map +1 -0
- package/dist/frontend/lowering/record-inherited.d.ts +26 -0
- package/dist/frontend/lowering/record-inherited.js +807 -0
- package/dist/frontend/lowering/record-inherited.js.map +1 -0
- package/dist/frontend/lowering/runtime-optional-elements.d.ts +31 -1
- package/dist/frontend/lowering/runtime-optional-elements.js +105 -13
- package/dist/frontend/lowering/runtime-optional-elements.js.map +1 -1
- package/dist/frontend/lowering/runtime-optional-guards.d.ts +3 -0
- package/dist/frontend/lowering/runtime-optional-guards.js +35 -7
- package/dist/frontend/lowering/runtime-optional-guards.js.map +1 -1
- package/dist/frontend/lowering/runtime-optional-guards.test.js +59 -1
- package/dist/frontend/lowering/runtime-optional-guards.test.js.map +1 -1
- package/dist/frontend/lowering/stable-names.d.ts +8 -0
- package/dist/frontend/lowering/stable-names.js +22 -0
- package/dist/frontend/lowering/stable-names.js.map +1 -1
- package/dist/frontend/lowering/stable-names.test.d.ts +1 -0
- package/dist/frontend/lowering/stable-names.test.js +16 -0
- package/dist/frontend/lowering/stable-names.test.js.map +1 -0
- package/dist/frontend/lowering/static-typeof.d.ts +5 -4
- package/dist/frontend/lowering/static-typeof.js +10 -4
- package/dist/frontend/lowering/static-typeof.js.map +1 -1
- package/dist/frontend/lowering/structural-instances.d.ts +22 -0
- package/dist/frontend/lowering/structural-instances.js +282 -0
- package/dist/frontend/lowering/structural-instances.js.map +1 -0
- package/dist/frontend/lowering/surfaces.d.ts +3 -0
- package/dist/frontend/lowering/surfaces.js +108 -12
- package/dist/frontend/lowering/surfaces.js.map +1 -1
- package/dist/frontend/lowering/symbol-fields.d.ts +7 -0
- package/dist/frontend/lowering/symbol-fields.js +32 -0
- package/dist/frontend/lowering/symbol-fields.js.map +1 -1
- package/dist/frontend/lowering/type-failure.d.ts +17 -0
- package/dist/frontend/lowering/type-failure.js +163 -0
- package/dist/frontend/lowering/type-failure.js.map +1 -0
- package/dist/frontend/lowering/typed-arguments.d.ts +5 -6
- package/dist/frontend/lowering/typed-arguments.js +10 -2
- package/dist/frontend/lowering/typed-arguments.js.map +1 -1
- package/dist/frontend/lowering/union-narrow.d.ts +9 -1
- package/dist/frontend/lowering/union-narrow.js +31 -2
- package/dist/frontend/lowering/union-narrow.js.map +1 -1
- package/dist/frontend/lowering/union-retag.test.js +42 -2
- package/dist/frontend/lowering/union-retag.test.js.map +1 -1
- package/dist/frontend/lowering/unit-journal.d.ts +194 -0
- package/dist/frontend/lowering/unit-journal.js +556 -0
- package/dist/frontend/lowering/unit-journal.js.map +1 -0
- package/dist/frontend/lowering/unit-journal.test.d.ts +1 -0
- package/dist/frontend/lowering/unit-journal.test.js +335 -0
- package/dist/frontend/lowering/unit-journal.test.js.map +1 -0
- package/dist/frontend/lowering/width-lift.d.ts +19 -0
- package/dist/frontend/node-api-import.d.ts +21 -0
- package/dist/frontend/node-api-import.js +88 -0
- package/dist/frontend/node-api-import.js.map +1 -0
- package/dist/frontend/npm-static-type-exports-host.js +4 -3
- package/dist/frontend/npm-static-type-exports-host.js.map +1 -1
- package/dist/frontend/npm-static.js +9 -2
- package/dist/frontend/npm-static.js.map +1 -1
- package/dist/frontend/package-shims.d.ts +6 -2
- package/dist/frontend/package-shims.js +13 -2
- package/dist/frontend/package-shims.js.map +1 -1
- package/dist/frontend/pipeline.d.ts +11 -4
- package/dist/frontend/pipeline.js +249 -26
- package/dist/frontend/pipeline.js.map +1 -1
- package/dist/frontend/process-fork.d.ts +3 -0
- package/dist/frontend/process-fork.js.map +1 -1
- package/dist/frontend/program-analysis.d.ts +6 -0
- package/dist/frontend/program-analysis.js +4 -0
- package/dist/frontend/program-analysis.js.map +1 -1
- package/dist/frontend/program.d.ts +12 -1
- package/dist/frontend/program.js +256 -36
- package/dist/frontend/program.js.map +1 -1
- package/dist/frontend/resolve.js +8 -2
- package/dist/frontend/resolve.js.map +1 -1
- package/dist/frontend/shape-inference/analyze.d.ts +23 -1
- package/dist/frontend/shape-inference/analyze.js +982 -97
- package/dist/frontend/shape-inference/analyze.js.map +1 -1
- package/dist/frontend/shape-inference/constant-graphs.d.ts +2 -0
- package/dist/frontend/shape-inference/constant-graphs.js +39 -4
- package/dist/frontend/shape-inference/constant-graphs.js.map +1 -1
- package/dist/frontend/shape-inference/domain.d.ts +2 -0
- package/dist/frontend/shape-inference/domain.js.map +1 -1
- package/dist/frontend/shape-inference/fallback.d.ts +17 -0
- package/dist/frontend/shape-inference/fallback.js +303 -0
- package/dist/frontend/shape-inference/fallback.js.map +1 -0
- package/dist/frontend/shape-inference/index.d.ts +75 -1
- package/dist/frontend/shape-inference/index.js +531 -2
- package/dist/frontend/shape-inference/index.js.map +1 -1
- package/dist/frontend/shape-inference/inferred-checks.d.ts +2 -0
- package/dist/frontend/shape-inference/inferred-checks.js +90 -0
- package/dist/frontend/shape-inference/inferred-checks.js.map +1 -0
- package/dist/frontend/shape-inference/memo.d.ts +30 -0
- package/dist/frontend/shape-inference/memo.js +99 -0
- package/dist/frontend/shape-inference/memo.js.map +1 -0
- package/dist/frontend/shape-inference/overlay.d.ts +81 -0
- package/dist/frontend/shape-inference/overlay.js +1160 -0
- package/dist/frontend/shape-inference/overlay.js.map +1 -0
- package/dist/frontend/shape-inference/registry.test.d.ts +1 -0
- package/dist/frontend/shape-inference/registry.test.js +34 -0
- package/dist/frontend/shape-inference/registry.test.js.map +1 -0
- package/dist/frontend/shape-inference/report.js +42 -8
- package/dist/frontend/shape-inference/report.js.map +1 -1
- package/dist/frontend/shape-inference/static-objects.d.ts +29 -0
- package/dist/frontend/shape-inference/static-objects.js +1951 -0
- package/dist/frontend/shape-inference/static-objects.js.map +1 -0
- package/dist/frontend/tier-analysis.d.ts +53 -1
- package/dist/frontend/tier-analysis.js +133 -0
- package/dist/frontend/tier-analysis.js.map +1 -1
- package/dist/frontend/ts7/api.js +4 -2
- package/dist/frontend/ts7/api.js.map +1 -1
- package/dist/frontend/ts7/ast-node.d.ts +9 -0
- package/dist/frontend/ts7/ast-node.js +42 -10
- package/dist/frontend/ts7/ast-node.js.map +1 -1
- package/dist/frontend/ts7/ast-node.test.js +23 -0
- package/dist/frontend/ts7/ast-node.test.js.map +1 -1
- package/dist/frontend/ts7/ast-wire-protocols.test.d.ts +1 -0
- package/dist/frontend/ts7/ast-wire-protocols.test.js +93 -0
- package/dist/frontend/ts7/ast-wire-protocols.test.js.map +1 -0
- package/dist/frontend/ts7/ast-wire.d.ts +18 -0
- package/dist/frontend/ts7/ast-wire.js +66 -4
- package/dist/frontend/ts7/ast-wire.js.map +1 -1
- package/dist/frontend/ts7/checker-server.d.ts +12 -11
- package/dist/frontend/ts7/checker-server.js +28 -12
- package/dist/frontend/ts7/checker-server.js.map +1 -1
- package/dist/frontend/ts7/checker-server.test.js +8 -3
- package/dist/frontend/ts7/checker-server.test.js.map +1 -1
- package/dist/frontend/ts7/checker.d.ts +4 -0
- package/dist/frontend/ts7/checker.js +9 -0
- package/dist/frontend/ts7/checker.js.map +1 -1
- package/dist/frontend/ts7/checker.test.js +216 -205
- package/dist/frontend/ts7/checker.test.js.map +1 -1
- package/dist/frontend/ts7/lib-diagnostics.d.ts +71 -4
- package/dist/frontend/ts7/lib-diagnostics.js +337 -20
- package/dist/frontend/ts7/lib-diagnostics.js.map +1 -1
- package/dist/frontend/ts7/lib-diagnostics.test.js +268 -5
- package/dist/frontend/ts7/lib-diagnostics.test.js.map +1 -1
- package/dist/frontend/ts7/native-api.d.ts +4 -0
- package/dist/frontend/ts7/native-api.js +36 -1
- package/dist/frontend/ts7/native-api.js.map +1 -1
- package/dist/frontend/ts7/program-host.d.ts +19 -2
- package/dist/frontend/ts7/program-host.js +69 -9
- package/dist/frontend/ts7/program-host.js.map +1 -1
- package/dist/frontend/ts7/program-host.test.js +42 -1
- package/dist/frontend/ts7/program-host.test.js.map +1 -1
- package/dist/frontend/ts7/rpc-filesystem.d.ts +4 -2
- package/dist/frontend/ts7/rpc-filesystem.js +23 -2
- package/dist/frontend/ts7/rpc-filesystem.js.map +1 -1
- package/dist/frontend/ts7/rpc-filesystem.test.js +28 -2
- package/dist/frontend/ts7/rpc-filesystem.test.js.map +1 -1
- package/dist/frontend/ts7/semantic-checker.js +73 -5
- package/dist/frontend/ts7/semantic-checker.js.map +1 -1
- package/dist/frontend/ts7/semantic-checker.test.js +106 -74
- package/dist/frontend/ts7/semantic-checker.test.js.map +1 -1
- package/dist/frontend/ts7/semantic-json.d.ts +2 -6
- package/dist/frontend/ts7/semantic-model-71.test.d.ts +1 -0
- package/dist/frontend/ts7/semantic-model-71.test.js +131 -0
- package/dist/frontend/ts7/semantic-model-71.test.js.map +1 -0
- package/dist/frontend/ts7/semantic-model.d.ts +121 -3
- package/dist/frontend/ts7/semantic-model.js +245 -8
- package/dist/frontend/ts7/semantic-model.js.map +1 -1
- package/dist/frontend/ts7/session.d.ts +19 -1
- package/dist/frontend/ts7/session.js +111 -11
- package/dist/frontend/ts7/session.js.map +1 -1
- package/dist/frontend/ts7/session.test.js +259 -239
- package/dist/frontend/ts7/session.test.js.map +1 -1
- package/dist/frontend/ts7/test-servers.d.ts +12 -0
- package/dist/frontend/ts7/test-servers.js +16 -0
- package/dist/frontend/ts7/test-servers.js.map +1 -0
- package/dist/frontend/tsc-codes.js +6 -3
- package/dist/frontend/tsc-codes.js.map +1 -1
- package/dist/frontend/type-mapper.d.ts +61 -1
- package/dist/frontend/type-mapper.js +577 -28
- package/dist/frontend/type-mapper.js.map +1 -1
- package/dist/frontend/type-patches/command.d.ts +19 -0
- package/dist/frontend/type-patches/command.js +352 -0
- package/dist/frontend/type-patches/command.js.map +1 -0
- package/dist/frontend/type-patches/layer.d.ts +45 -0
- package/dist/frontend/type-patches/layer.js +409 -0
- package/dist/frontend/type-patches/layer.js.map +1 -0
- package/dist/frontend/type-patches/locate.d.ts +41 -0
- package/dist/frontend/type-patches/locate.js +914 -0
- package/dist/frontend/type-patches/locate.js.map +1 -0
- package/dist/frontend/type-patches/locate.test.d.ts +1 -0
- package/dist/frontend/type-patches/locate.test.js +179 -0
- package/dist/frontend/type-patches/locate.test.js.map +1 -0
- package/dist/frontend/type-patches/selector.d.ts +43 -0
- package/dist/frontend/type-patches/selector.js +126 -0
- package/dist/frontend/type-patches/selector.js.map +1 -0
- package/dist/frontend/type-patches/selector.test.d.ts +1 -0
- package/dist/frontend/type-patches/selector.test.js +56 -0
- package/dist/frontend/type-patches/selector.test.js.map +1 -0
- package/dist/frontend/type-patches/semver.d.ts +19 -0
- package/dist/frontend/type-patches/semver.js +221 -0
- package/dist/frontend/type-patches/semver.js.map +1 -0
- package/dist/frontend/type-patches/semver.test.d.ts +1 -0
- package/dist/frontend/type-patches/semver.test.js +47 -0
- package/dist/frontend/type-patches/semver.test.js.map +1 -0
- package/dist/frontend/worker-target.test.js +2 -2
- package/dist/frontend/worker-target.test.js.map +1 -1
- package/dist/index.d.ts +4 -1
- package/dist/index.js +292 -27
- package/dist/index.js.map +1 -1
- package/dist/ir/builtin-effects.js +51 -5
- package/dist/ir/builtin-effects.js.map +1 -1
- package/dist/ir/builtin-signatures.d.ts +4 -3
- package/dist/ir/builtin-signatures.js +277 -12
- package/dist/ir/builtin-signatures.js.map +1 -1
- package/dist/ir/callback-specialization.js +108 -67
- package/dist/ir/callback-specialization.js.map +1 -1
- package/dist/ir/capture-values.d.ts +7 -1
- package/dist/ir/capture-values.js +28 -5
- package/dist/ir/capture-values.js.map +1 -1
- package/dist/ir/char-unit-locals.js +38 -42
- package/dist/ir/char-unit-locals.js.map +1 -1
- package/dist/ir/expression-inlining.js +12 -6
- package/dist/ir/expression-inlining.js.map +1 -1
- package/dist/ir/fields.generated.d.ts +751 -0
- package/dist/ir/fields.generated.js +2071 -0
- package/dist/ir/fields.generated.js.map +1 -0
- package/dist/ir/fields.test.d.ts +1 -0
- package/dist/ir/fields.test.js +113 -0
- package/dist/ir/fields.test.js.map +1 -0
- package/dist/ir/function-references.js +4 -0
- package/dist/ir/function-references.js.map +1 -1
- package/dist/ir/function-references.test.js +25 -0
- package/dist/ir/function-references.test.js.map +1 -1
- package/dist/ir/inline-array-sources.d.ts +15 -0
- package/dist/ir/inline-array-sources.js +1825 -0
- package/dist/ir/inline-array-sources.js.map +1 -0
- package/dist/ir/inline-arrays.d.ts +41 -0
- package/dist/ir/inline-arrays.js +533 -0
- package/dist/ir/inline-arrays.js.map +1 -0
- package/dist/ir/inline-arrays.test.d.ts +1 -0
- package/dist/ir/inline-arrays.test.js +225 -0
- package/dist/ir/inline-arrays.test.js.map +1 -0
- package/dist/ir/int32-slots.d.ts +6 -0
- package/dist/ir/int32-slots.js +154 -16
- package/dist/ir/int32-slots.js.map +1 -1
- package/dist/ir/int32-slots.test.js +48 -0
- package/dist/ir/int32-slots.test.js.map +1 -1
- package/dist/ir/integer-loops.d.ts +12 -0
- package/dist/ir/integer-loops.js +23 -0
- package/dist/ir/integer-loops.js.map +1 -1
- package/dist/ir/integer-ranges.d.ts +7 -1
- package/dist/ir/integer-ranges.js +29 -2
- package/dist/ir/integer-ranges.js.map +1 -1
- package/dist/ir/intrinsic-signatures.js +2 -1
- package/dist/ir/intrinsic-signatures.js.map +1 -1
- package/dist/ir/ir.d.ts +103 -5
- package/dist/ir/ir.js +38 -4
- package/dist/ir/ir.js.map +1 -1
- package/dist/ir/ir.test.js +134 -1
- package/dist/ir/ir.test.js.map +1 -1
- package/dist/ir/jsval.js +211 -29
- package/dist/ir/jsval.js.map +1 -1
- package/dist/ir/jsval.test.js +120 -0
- package/dist/ir/jsval.test.js.map +1 -1
- package/dist/ir/loop-entry-ranges.d.ts +38 -0
- package/dist/ir/loop-entry-ranges.js +259 -0
- package/dist/ir/loop-entry-ranges.js.map +1 -0
- package/dist/ir/loop-entry-ranges.test.d.ts +1 -0
- package/dist/ir/loop-entry-ranges.test.js +191 -0
- package/dist/ir/loop-entry-ranges.test.js.map +1 -0
- package/dist/ir/node-index.d.ts +3 -0
- package/dist/ir/node-index.js +6 -0
- package/dist/ir/node-index.js.map +1 -1
- package/dist/ir/numeric-call-specialization.d.ts +9 -6
- package/dist/ir/numeric-call-specialization.js +164 -34
- package/dist/ir/numeric-call-specialization.js.map +1 -1
- package/dist/ir/paired-while-loops.js +23 -19
- package/dist/ir/paired-while-loops.js.map +1 -1
- package/dist/ir/parameter-versions.js +6 -3
- package/dist/ir/parameter-versions.js.map +1 -1
- package/dist/ir/receiver-readers.d.ts +10 -0
- package/dist/ir/receiver-readers.js +65 -28
- package/dist/ir/receiver-readers.js.map +1 -1
- package/dist/ir/row-pairs.d.ts +9 -1
- package/dist/ir/row-pairs.js +136 -43
- package/dist/ir/row-pairs.js.map +1 -1
- package/dist/ir/row-pairs.test.js +25 -5
- package/dist/ir/row-pairs.test.js.map +1 -1
- package/dist/ir/runtime-features.d.ts +33 -1
- package/dist/ir/runtime-features.js +104 -6
- package/dist/ir/runtime-features.js.map +1 -1
- package/dist/ir/runtime-features.test.js +13 -0
- package/dist/ir/runtime-features.test.js.map +1 -1
- package/dist/ir/saturating-loop-jams.d.ts +24 -0
- package/dist/ir/saturating-loop-jams.js +420 -0
- package/dist/ir/saturating-loop-jams.js.map +1 -0
- package/dist/ir/saturating-loop-jams.test.d.ts +1 -0
- package/dist/ir/saturating-loop-jams.test.js +196 -0
- package/dist/ir/saturating-loop-jams.test.js.map +1 -0
- package/dist/ir/scalar-records.js +9 -3
- package/dist/ir/scalar-records.js.map +1 -1
- package/dist/ir/self-captures.js +2 -1
- package/dist/ir/self-captures.js.map +1 -1
- package/dist/ir/serialize.d.ts +5 -1
- package/dist/ir/serialize.js +7 -1
- package/dist/ir/serialize.js.map +1 -1
- package/dist/ir/traverse.js +3 -0
- package/dist/ir/traverse.js.map +1 -1
- package/dist/ir/validate.js +91 -9
- package/dist/ir/validate.js.map +1 -1
- package/dist/library/ir-policy.js +1 -0
- package/dist/library/ir-policy.js.map +1 -1
- package/dist/native/cache.js +2 -0
- package/dist/native/cache.js.map +1 -1
- package/dist/native/cli.js +54 -7
- package/dist/native/cli.js.map +1 -1
- package/dist/native/compiler.d.ts +3 -0
- package/dist/native/compiler.js +173 -36
- package/dist/native/compiler.js.map +1 -1
- package/dist/native/compiler.test.js +86 -3
- package/dist/native/compiler.test.js.map +1 -1
- package/dist/native/executable-cache.d.ts +20 -2
- package/dist/native/executable-cache.js +17 -10
- package/dist/native/executable-cache.js.map +1 -1
- package/dist/native/executable-cache.test.js +38 -1
- package/dist/native/executable-cache.test.js.map +1 -1
- package/dist/native/linker-job.d.ts +71 -0
- package/dist/native/linker-job.js +242 -0
- package/dist/native/linker-job.js.map +1 -0
- package/dist/native/linker-job.test.d.ts +1 -0
- package/dist/native/linker-job.test.js +349 -0
- package/dist/native/linker-job.test.js.map +1 -0
- package/dist/native/prepare.js +15 -2
- package/dist/native/prepare.js.map +1 -1
- package/dist/native/sanitizer.js +10 -15
- package/dist/native/sanitizer.js.map +1 -1
- package/dist/native/sanitizer.test.js +152 -66
- package/dist/native/sanitizer.test.js.map +1 -1
- package/dist/native/toolchain.d.ts +11 -2
- package/dist/native/toolchain.js +43 -17
- package/dist/native/toolchain.js.map +1 -1
- package/dist/native/toolchain.test.js +75 -0
- package/dist/native/toolchain.test.js.map +1 -1
- package/dist/node-islands/boundary.d.ts +37 -0
- package/dist/node-islands/boundary.js +135 -0
- package/dist/node-islands/boundary.js.map +1 -0
- package/dist/node-islands/classify.js +1 -1
- package/dist/node-islands/classify.js.map +1 -1
- package/dist/node-islands/effect-gate.d.ts +11 -0
- package/dist/node-islands/effect-gate.js +746 -0
- package/dist/node-islands/effect-gate.js.map +1 -0
- package/dist/node-islands/effect-gate.test.d.ts +1 -0
- package/dist/node-islands/effect-gate.test.js +152 -0
- package/dist/node-islands/effect-gate.test.js.map +1 -0
- package/dist/node-islands/libnode-pack.d.ts +68 -0
- package/dist/node-islands/libnode-pack.js +199 -0
- package/dist/node-islands/libnode-pack.js.map +1 -0
- package/dist/node-islands/libnode-pack.test.d.ts +1 -0
- package/dist/node-islands/libnode-pack.test.js +258 -0
- package/dist/node-islands/libnode-pack.test.js.map +1 -0
- package/dist/node-islands/libnode.d.ts +32 -0
- package/dist/node-islands/libnode.js +212 -0
- package/dist/node-islands/libnode.js.map +1 -0
- package/dist/node-islands/libnode.test.d.ts +1 -0
- package/dist/node-islands/libnode.test.js +170 -0
- package/dist/node-islands/libnode.test.js.map +1 -0
- package/dist/node-islands/modules.d.ts +96 -0
- package/dist/node-islands/modules.js +803 -0
- package/dist/node-islands/modules.js.map +1 -0
- package/dist/node-islands/modules.test.d.ts +1 -0
- package/dist/node-islands/modules.test.js +276 -0
- package/dist/node-islands/modules.test.js.map +1 -0
- package/dist/node-islands/resolve.d.ts +8 -0
- package/dist/node-islands/resolve.js +10 -0
- package/dist/node-islands/resolve.js.map +1 -0
- package/dist/node-islands/snapshot.d.ts +16 -0
- package/dist/node-islands/snapshot.js +486 -0
- package/dist/node-islands/snapshot.js.map +1 -0
- package/dist/node-islands/snapshot.test.d.ts +1 -0
- package/dist/node-islands/snapshot.test.js +56 -0
- package/dist/node-islands/snapshot.test.js.map +1 -0
- package/dist/project-config.d.ts +37 -1
- package/dist/project-config.js +159 -7
- package/dist/project-config.js.map +1 -1
- package/dist/project-config.test.js +153 -0
- package/dist/project-config.test.js.map +1 -1
- package/dist/startup-cache.d.ts +1 -0
- package/dist/startup-cache.js +1 -0
- package/dist/startup-cache.js.map +1 -1
- package/package.json +24 -21
- package/surface-manifest.json +47 -7
|
@@ -1,4 +1,6 @@
|
|
|
1
|
+
import { loopEntryInlines } from "./loop-entry-versions.js";
|
|
1
2
|
import { relieveHeapPressure } from "../../heap-pressure.js";
|
|
3
|
+
import { analyzeFrameEscapes } from "./frame-escapes.js";
|
|
2
4
|
import { wasmBoundsChecks } from "./wasm-modules.js";
|
|
3
5
|
import { jsTruthy } from "./jsval.js";
|
|
4
6
|
import { JsIcSites } from "../../ir/js-ic.js";
|
|
@@ -12,7 +14,7 @@ import { InternalCompilerError } from "../../errors.js";
|
|
|
12
14
|
import { serializeModuleParts } from "../../ir/serialize.js";
|
|
13
15
|
import { createHash } from "node:crypto";
|
|
14
16
|
import { endsWithJump, matchFieldSelfConcat, readsArraySlot, streamTypedRefEligible, undefinedArmTag, } from "../../ir/analysis.js";
|
|
15
|
-
import { loopTestsEveryIteration } from "../loop-polls.js";
|
|
17
|
+
import { containsLoop, loopTestsEveryIteration } from "../loop-polls.js";
|
|
16
18
|
import { isDynTypedRefType, isRefCounted, isUnitType, POINTER_KINDS, RUNTIME_EMITTER_CLASS, RUNTIME_EVENT_CLASS, RUNTIME_EVENT_TARGET_CLASS, RUNTIME_ERROR_CLASSES, RUNTIME_STREAM_CLASSES, typeEquals, typeKey, VOID, classJsName, classValueAbiEquals, } from "../../ir/ir.js";
|
|
17
19
|
import { moduleRuntimeFeatures } from "../../ir/runtime-features.js";
|
|
18
20
|
import { captureFreeFunctions, observesStacks } from "../stack-observations.js";
|
|
@@ -27,7 +29,10 @@ import { EmitJournal, registerReplay, renameChunk, replayJournal, } from "./emit
|
|
|
27
29
|
import { specializeNumericCalls } from "../../ir/numeric-call-specialization.js";
|
|
28
30
|
import { versionLoopBoundParameters } from "../../ir/parameter-versions.js";
|
|
29
31
|
import { inlineExpressionFunctions } from "../../ir/expression-inlining.js";
|
|
32
|
+
import { inlineArrayReads, NO_INLINE_ARRAYS, planInlineArrays, } from "../../ir/inline-arrays.js";
|
|
33
|
+
import { inlineArraysApply, programLifetimeClassOf } from "./inline-arrays.js";
|
|
30
34
|
import { pairRowSums } from "../../ir/row-pairs.js";
|
|
35
|
+
import { jamSaturatingLoops } from "../../ir/saturating-loop-jams.js";
|
|
31
36
|
import { allocatedLiteral, fillAllocationLength, int32ArrayKey, selectInt32Arrays, } from "../../ir/int32-arrays.js";
|
|
32
37
|
import { everyExpr, everyExprChild, everyStmtChild, everyStmtList } from "../../ir/traverse.js";
|
|
33
38
|
import { INT32_RANGE, withinInt32, } from "../../ir/integer-ranges.js";
|
|
@@ -46,13 +51,16 @@ import { unitSafeFunctions } from "./string-unit-versions.js";
|
|
|
46
51
|
import { stringScanInline } from "./string-reads.js";
|
|
47
52
|
import { findInt32Abis, INT32_ABI_SUFFIX, SCALAR_UNION_DUMMY, SCALAR_UNION_RESULT, } from "./int32-abi.js";
|
|
48
53
|
import {} from "./int32-locals.js";
|
|
49
|
-
import { findIntegerClones, NO_INTEGER_CLONES } from "./integer-clones.js";
|
|
54
|
+
import { findIntegerClones, NO_INTEGER_CLONES, } from "./integer-clones.js";
|
|
55
|
+
import { writeRepresentationReport } from "./repr-report.js";
|
|
56
|
+
import { heapCensusOf } from "./heap-census.js";
|
|
50
57
|
import { exactInteger, narrowInteger, widenInteger } from "./integer-values.js";
|
|
51
58
|
import { findInitializerBindings } from "../../ir/initializer-bindings.js";
|
|
52
59
|
import { findConstantNumericTables } from "../../ir/constant-tables.js";
|
|
53
60
|
import { allocateFfiCallbackAdapters, hasForeignFfiCallback, hasRetainedFfiCallback, } from "../ffi-callbacks.js";
|
|
54
61
|
import { computeMayThrow } from "../may-throw.js";
|
|
55
|
-
import { UNWIND_PERSONALITY, UNWIND_RAISE, UNWIND_RAISE_DECLARATION, UNWIND_RESUME, UNWIND_SLOT, UnwindAbiViolation, bridgePlainUnwindCalls, unwindAbiFunctions, } from "./unwind-abi.js";
|
|
62
|
+
import { UNWIND_PERSONALITY, UNWIND_RAISE, UNWIND_RAISE_DECLARATION, UNWIND_RESUME_DECLARATION, UNWIND_RESUME, UNWIND_SLOT, UnwindAbiViolation, bridgePlainUnwindCalls, unwindAbiFunctions, } from "./unwind-abi.js";
|
|
63
|
+
import { cloneForCpuDispatch } from "./cpu-dispatch.js";
|
|
56
64
|
import { mangleAsyncInlineAwaitCall, mangleAsyncSpawn, mangleBorrowedFunction, mangleClassObj, mangleFnClosure, mangleFunction, mangleGenSpawn, mangleGlobal, mangleLocal, mangleRecordStruct, mangleWrapper, mangleBorrowingWrapper, } from "../mangle.js";
|
|
57
65
|
import { analyzeCallLifetimes } from "./call-lifetimes.js";
|
|
58
66
|
import { stackObjectStruct, } from "./stack-objects.js";
|
|
@@ -61,9 +69,9 @@ import { BlockBuilder } from "./blocks.js";
|
|
|
61
69
|
import { NullableRefFields } from "./nullable-fields.js";
|
|
62
70
|
import { InlineUnionFields, loadInlineUnion, presentBits, stackUnionBox, storeInlineUnion, unionBoxBits, } from "./inline-unions.js";
|
|
63
71
|
import { OptionalArrayReads } from "./local-array-reads.js";
|
|
64
|
-
import { CheckedNarrows } from "./checked-narrows.js";
|
|
72
|
+
import { borrowsCheckedNarrow, CheckedNarrows } from "./checked-narrows.js";
|
|
65
73
|
import { emitDenseArraySet, emitDenseSlotUnlink, SCR_ELEM_I32, } from "./dense-array-access.js";
|
|
66
|
-
import { matchMapRead } from "./map-read-lifetimes.js";
|
|
74
|
+
import { matchMapRead, pointerMapGet } from "./map-read-lifetimes.js";
|
|
67
75
|
import {} from "./map-entry-fusion.js";
|
|
68
76
|
import { emitBorrowedFieldSequence, guardedValue } from "./borrowed-receivers.js";
|
|
69
77
|
import { emitBorrowedInputs } from "./borrowed-inputs.js";
|
|
@@ -80,7 +88,7 @@ import { AmbientReceiverReaders, findConstantCallbacks } from "./constant-callba
|
|
|
80
88
|
import { findLentRecordFields, findLentStringParameters, findRecordFieldProducers, } from "./string-slices.js";
|
|
81
89
|
import { LazyCaptures } from "./lazy-captures.js";
|
|
82
90
|
import { StackCaptures } from "./stack-captures.js";
|
|
83
|
-
import { emitFieldAbsentTest, f64Lit, SCR_ARR_FIELD, SCR_ARR_FROZEN } from "./common.js";
|
|
91
|
+
import { CLOSURE_KIND, emitFieldAbsentTest, f64Lit, SCR_ARR_FIELD, SCR_ARR_FROZEN, } from "./common.js";
|
|
84
92
|
import { ffiExtendsNarrowIntegers } from "../targets.js";
|
|
85
93
|
import { emitLiteralExpr, emitOperatorExpr, emitStringExpr, emitContainerExpr, emitRecordExpr, } from "./expr-primitives.js";
|
|
86
94
|
import { emitControlExpr } from "./expr-control.js";
|
|
@@ -97,7 +105,7 @@ import { dynKind, raceAdapterFor, genResultThunkFor, childExitThunkFor, childExi
|
|
|
97
105
|
import { streamDataAdapter, streamDoneFnFor, cryptoBytesThunkFor, cryptoIntThunkFor, fsRenameThunkFor, streamCbThunkFor, zlibBytesThunkFor, } from "./expr-stream-callbacks.js";
|
|
98
106
|
import { emitStableReceiver, resolveThunkFor, tagInSet, arrPush, emitArrayCopyLoop, emitStrIntrinsic, emitArrIntrinsic, wrapNullable, emitMapNew, mapSet, emitMapLikeIntrinsic, emitSetNew, } from "./expr-containers.js";
|
|
99
107
|
import { emitIntegerLoopIndex, emitBytesIndex, emitBytesData, emitBytesLength, emitBytesGet, emitToUint32, emitBytesSet, emitBytesIntrinsic, } from "./expr-bytes.js";
|
|
100
|
-
import {
|
|
108
|
+
import { borrowedRecordKeyGetOr, emitRecordKeyGet, emitRegexIntrinsic, immortalDefault, keyedRecordReadInto, pointerRecordKeyGet, } from "./expr-records.js";
|
|
101
109
|
import { dynPromiseAdapter, streamTypedRefCommitAdapter, liveDynUnionRefAdapter, streamTypedRefBoxValue, streamTypedRefMaterializeAdapter, streamFromArrayAdapter, } from "./expr-stream-bridges.js";
|
|
102
110
|
import { emitWebLibCall, emitDynamicLibCall, emitFilesystemLibCall, emitPathUrlLibCall, emitPrimitiveLibCall, } from "./lib-filesystem.js";
|
|
103
111
|
import { emitChildProcessLibCall, emitAsyncContextLibCall, emitProcessLibCall, emitErrorsEventsLibCall, } from "./lib-process.js";
|
|
@@ -106,14 +114,18 @@ import { emitNetworkHttpLibCall } from "./lib-network.js";
|
|
|
106
114
|
import { emitAssertInspectLibCall, emitIoLibCall, emitGenericLibCall, emitLibCall, } from "./lib-dispatch.js";
|
|
107
115
|
import { assignCompactLayouts, buildClassGraph, classFieldTypes, classMembershipIntervals, classFieldIndex, compactRefLoadLines, compactRefStoreLines, classPreLines, classStructSym, programLifetimeClass, } from "./classes.js";
|
|
108
116
|
import { LifetimeRegions, REGION_TYPES } from "./regions.js";
|
|
117
|
+
import { arenaAware, arenaCurrentAddress, arenaNewSym, arenasRequested, planArenas, } from "./arenas.js";
|
|
118
|
+
import { children } from "./region-ir.js";
|
|
109
119
|
import { LlDyn, recordDynKeepsIdentity } from "./dyn.js";
|
|
110
120
|
import { VirtualBorrows } from "./virtual-borrows.js";
|
|
121
|
+
import { planRecordViews, recordViewFieldPtr } from "./record-views.js";
|
|
111
122
|
import { LlvmUnsupportedError } from "./unsupported.js";
|
|
112
123
|
import { LlWalkers } from "./walkers.js";
|
|
113
|
-
import { isObjectArm, NULLABLE_ABSENT, NULLABLE_NULL, NullableUnions } from "./nullable-unions.js";
|
|
124
|
+
import { isObjectArm, isPayloadTag, NULLABLE_ABSENT, NULLABLE_NULL, NullableUnions, pointerTagFn, } from "./nullable-unions.js";
|
|
125
|
+
import { classUnionHeaders, emitClassUnionHelpers } from "./class-unions.js";
|
|
114
126
|
import { emitNullablePresent, emitUnionPeek, emitUnionTag } from "./union-repr.js";
|
|
115
127
|
import { emitConcatInputs, emitMixedConcat, numberPart, stringParts, } from "./string-construction.js";
|
|
116
|
-
import { arrNewCall, boxAccess, elemAccess, boxNewCall, boxReleaseSym, computeTraced, emitInlineRcHelpers, emitNullableRetainWrappers, emitShapeUnionHelpers, FN_ATTRS, inlineRcDecls, llFieldType, mapFlagsOffset, releaseSym, retainSym, traceArg, vAdapters, } from "./shapes.js";
|
|
128
|
+
import { arrNewCall, boxAccess, elemAccess, boxNewCall, boxReleaseSym, computeTraced, emitInlineRcHelpers, emitNullableRetainWrappers, emitShapeUnionHelpers, FN_ATTRS, inlineRcDecls, llFieldType, mapFlagsOffset, releaseSym, retainSym, traceArg, vAdapters, traceAdapter, } from "./shapes.js";
|
|
117
129
|
import { INLINE_LITERAL_BYTES } from "./string-literal-equality.js";
|
|
118
130
|
import { inlinableNumberFunction, withSpeculativeValue, } from "./speculative-integers.js";
|
|
119
131
|
import { emitFfiCallbackDefs, emitLibDefs, emitModuleParts, emitParts, helperDefs, workerMinFunctions, } from "./emit-module.js";
|
|
@@ -121,6 +133,7 @@ import { forkedAnalysis } from "./forked-analysis.js";
|
|
|
121
133
|
import { emitLoopCopies, emitSpeculativeWrite, emitStmtBody, emitStringSelfConcatAssign, emitSwitch, emitTryCatch, } from "./emit-statements.js";
|
|
122
134
|
import { emitArgPackAndTrampolinePrologue, emitAsyncAwaitCall, emitAsyncScaffolding, emitFunction, emitGenScaffolding, emitWasiFulfill, fiberlessAsyncFunctions, parkingFunctions, } from "./emit-function.js";
|
|
123
135
|
import { analyzeBorrowedReturns, canBorrowCallArgument, canBorrowReceiver, canStackReceiver, emitReadReceiver, fieldAliasMetadata, isStackUnionSource, } from "./receivers.js";
|
|
136
|
+
import { findLoopCallees } from "./loop-callees.js";
|
|
124
137
|
export { LlvmUnsupportedError } from "./unsupported.js";
|
|
125
138
|
export function ffiCallbackDummyLl(callback) {
|
|
126
139
|
switch (callback.returns) {
|
|
@@ -221,6 +234,13 @@ function resultEntryTargets(mod) {
|
|
|
221
234
|
targets.add(name);
|
|
222
235
|
return targets;
|
|
223
236
|
}
|
|
237
|
+
/** The reads and constructions of inline array fields prepared for their
|
|
238
|
+
* layout (ir/inline-arrays.ts), where the target keeps them inline. */
|
|
239
|
+
function inlineArraysPass(options, mod) {
|
|
240
|
+
if (!inlineArraysApply(mod, options))
|
|
241
|
+
return mod;
|
|
242
|
+
return inlineArrayReads(mod, planInlineArrays(mod, programLifetimeClassOf(mod)));
|
|
243
|
+
}
|
|
224
244
|
/** The emitter for `input` after the module passes every emission runs. */
|
|
225
245
|
function moduleEmitter(input, options) {
|
|
226
246
|
// Facts are keyed by node identity: emit the same module whether it was
|
|
@@ -258,7 +278,9 @@ function moduleEmitter(input, options) {
|
|
|
258
278
|
// Keep source storage intact for debugger inspection in dev builds.
|
|
259
279
|
if (options.debugSources !== undefined)
|
|
260
280
|
return new LlEmitter(mod, options, null, null);
|
|
261
|
-
const
|
|
281
|
+
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)))));
|
|
283
|
+
timing("llvm-emit-rewrites");
|
|
262
284
|
let emitted = selectInt32Arrays(passed, proven, resultEntryTargets);
|
|
263
285
|
let prepared = rounds.last;
|
|
264
286
|
// A proof that revised functions analyzed the module of the functions it
|
|
@@ -280,7 +302,10 @@ function moduleEmitter(input, options) {
|
|
|
280
302
|
}
|
|
281
303
|
if (process.env["SCRIPTC_INT32_VERIFY"] === "1")
|
|
282
304
|
verifyInt32Selection(passed, emitted, prepared?.mod === emitted ? prepared : null);
|
|
283
|
-
|
|
305
|
+
timing("llvm-emit-int32");
|
|
306
|
+
const emitter = new LlEmitter(emitted, options, null, prepared?.mod === emitted ? prepared : null);
|
|
307
|
+
timing("llvm-emit-analyses");
|
|
308
|
+
return emitter;
|
|
284
309
|
}
|
|
285
310
|
/** SCRIPTC_INT32_VERIFY=1: throws unless the selection with revisions
|
|
286
311
|
* (`emitted`, and the analysis the emitter takes over) is the one rounds
|
|
@@ -310,7 +335,9 @@ function emitModuleText(input, options) {
|
|
|
310
335
|
for (let excluded = options.unwindExcluded ?? new Set();;) {
|
|
311
336
|
const emitter = moduleEmitter(input, { ...options, unwindExcluded: excluded });
|
|
312
337
|
try {
|
|
313
|
-
|
|
338
|
+
const parts = emitter.emitParts();
|
|
339
|
+
writeRepresentationReport(emitter);
|
|
340
|
+
return parts;
|
|
314
341
|
}
|
|
315
342
|
catch (error) {
|
|
316
343
|
if (!(error instanceof UnwindAbiViolation))
|
|
@@ -350,6 +377,9 @@ export function llStrBytes(text) {
|
|
|
350
377
|
const NO_BORROWED = new Set();
|
|
351
378
|
/** The nodes that write a binding by its id (numberGlobalWriters). */
|
|
352
379
|
const GLOBAL_WRITE_KINDS = ["assign", "varDecl", "assignExpr", "incDec"];
|
|
380
|
+
/** workerLoopBudget's answer for a loop that polls on every iteration
|
|
381
|
+
* instead of counting down in a slot. */
|
|
382
|
+
const POLL_EVERY_ITERATION = "%worker.poll.every";
|
|
353
383
|
/** Runtime library calls (readsLoopMetrics). */
|
|
354
384
|
const LIB_CALL_KINDS = ["libCall"];
|
|
355
385
|
/** [A-Za-z0-9_] */
|
|
@@ -360,14 +390,20 @@ function isIdentifierByte(code) {
|
|
|
360
390
|
code === 95);
|
|
361
391
|
}
|
|
362
392
|
/** Runtime entry points (and await-call entries) that may park the running
|
|
363
|
-
* execution context, as they appear in emitted function text.
|
|
364
|
-
|
|
393
|
+
* execution context, as they appear in emitted function text. An async
|
|
394
|
+
* generator's next, return and throw only queue a request and run its body
|
|
395
|
+
* to its next suspension, which returns to the caller, and the body's own
|
|
396
|
+
* bookkeeping calls do not suspend it. */
|
|
397
|
+
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]_)/;
|
|
365
398
|
/** The suspensions of a fiber body's own awaits, which its stackless
|
|
366
399
|
* coroutine form suspends itself at instead. */
|
|
367
|
-
const AWAIT_SUSPENSIONS = /@(?:scr_await_(?:void|f64|bool|str|ref|hop)\b|sc_a[wd]_[A-Za-z0-9_]+)/g;
|
|
400
|
+
const AWAIT_SUSPENSIONS = /@(?:scr_await_(?:void|f64|bool|str|ref|hop|dyn_value)\b|sc_a[wd]_[A-Za-z0-9_]+)/g;
|
|
401
|
+
/** The suspensions of a fiber generator body's own yields, which its
|
|
402
|
+
* coroutine form also suspends itself at. */
|
|
403
|
+
const YIELD_SUSPENSIONS = /@scr_(?:gen_yield_(?:f64|bool|ref))\b/g;
|
|
368
404
|
/** SUSPENDS in a stackless coroutine body, whose frame bookkeeping reads its
|
|
369
405
|
* own fiber and promise. */
|
|
370
|
-
const COROUTINE_SUSPENDS = /@(?:scr_(?:await_|module_await\b|promise_await_settled\b|test_sub\b|gen_yield_|async_gen_|fiber_(?!self\b|promise\b))|sc_a[wd]_)/;
|
|
406
|
+
const COROUTINE_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_(?!self\b|promise\b))|sc_a[wd]_)/;
|
|
371
407
|
/** Captured bindings (boxes a body declares or receives) from which a
|
|
372
408
|
* function compiles without LLVM optimization (see boxSlotCount). */
|
|
373
409
|
export const UNOPTIMIZED_BOX_SLOTS = 512;
|
|
@@ -770,11 +806,13 @@ export class LlEmitter {
|
|
|
770
806
|
* generator stacks) and so do debug builds (the debugger reads locals
|
|
771
807
|
* from the native frame). */
|
|
772
808
|
stacklessGenerators = false;
|
|
773
|
-
/** Async bodies that suspend only at their own awaits
|
|
774
|
-
* switched coroutines on native
|
|
775
|
-
* generators' conditions;
|
|
809
|
+
/** Async bodies that suspend only at their own awaits (and an async
|
|
810
|
+
* generator's yields) compile to the same switched coroutines on native
|
|
811
|
+
* targets (selectStacklessAsync), under the generators' conditions;
|
|
812
|
+
* library and Windows builds keep fibers. */
|
|
776
813
|
stacklessAsyncAllowed = false;
|
|
777
|
-
/** The async functions
|
|
814
|
+
/** The async functions and async generators selectStacklessAsync lowered
|
|
815
|
+
* as coroutines. */
|
|
778
816
|
stacklessAsync = new Set();
|
|
779
817
|
/** Some function in the module is lowered as a coroutine. */
|
|
780
818
|
usesCoroutines = false;
|
|
@@ -794,7 +832,12 @@ export class LlEmitter {
|
|
|
794
832
|
emitLibraryIdentity;
|
|
795
833
|
runtimeAbiMarker;
|
|
796
834
|
detachedExit;
|
|
835
|
+
nodeIslandModuleData;
|
|
797
836
|
targetCpu;
|
|
837
|
+
/** Emitted functions carry `sanitize_address` (LlvmTargetOptions). */
|
|
838
|
+
sanitizeAttributes;
|
|
839
|
+
/** LlvmTargetOptions.cpuDispatch, where it applies. */
|
|
840
|
+
cpuDispatch;
|
|
798
841
|
wasmBoundsChecks;
|
|
799
842
|
/** Interned string literals: UTF-8 text → { symbol, byte length } —
|
|
800
843
|
* first-use order, the runtime ABI’s determinism discipline. */
|
|
@@ -826,6 +869,9 @@ export class LlEmitter {
|
|
|
826
869
|
* compiles it lazily on first use. The source/flags strings intern at
|
|
827
870
|
* REGISTRATION (bodies emit before the literal table flushes). */
|
|
828
871
|
regexInstances = new Map();
|
|
872
|
+
/** Build-time replacers: one per (pattern, flags, replacement) of a
|
|
873
|
+
* global substitution with a literal replacement (regex-matchers.ts). */
|
|
874
|
+
regexReplacers = new Map();
|
|
829
875
|
/** Interned tagged-template strings objects: per-site key → { symbol,
|
|
830
876
|
* interned cooked-literal refs }. One immortal ScrArr of string slots
|
|
831
877
|
* per template SITE (the spec's per-occurrence identity — the C
|
|
@@ -849,6 +895,8 @@ export class LlEmitter {
|
|
|
849
895
|
dyn;
|
|
850
896
|
/** Explicit callback boundary for standalone layout and walker stages. */
|
|
851
897
|
shapeHost;
|
|
898
|
+
/** The record view plan's target set (record-views.ts), shared by reference. */
|
|
899
|
+
recordViewTargets = null;
|
|
852
900
|
/** External declarations, in first-use order. */
|
|
853
901
|
decls = new Set();
|
|
854
902
|
/** Declared functions referenced as values: each needs an env-signature
|
|
@@ -892,6 +940,9 @@ export class LlEmitter {
|
|
|
892
940
|
/** The current function's fused string-key Map get-then-set pairs (map-entry-fusion.ts). */
|
|
893
941
|
mapEntryFusion = null;
|
|
894
942
|
callLifetimes;
|
|
943
|
+
/** The locals whose value never leaves its frame (frame-escapes.ts), for
|
|
944
|
+
* class instances with reference fields in frame storage. */
|
|
945
|
+
frameEscapes = null;
|
|
895
946
|
constantCallbacks;
|
|
896
947
|
currentConstantCallbacks = new Map();
|
|
897
948
|
/** The current function's running maximum and minimum updates, whose
|
|
@@ -969,6 +1020,9 @@ export class LlEmitter {
|
|
|
969
1020
|
/** Functions that check the native stack guard on entry
|
|
970
1021
|
* (stackCheckedFunctions); null where the runtime has no guard. */
|
|
971
1022
|
stackChecks;
|
|
1023
|
+
/** Small leaf functions called only from loops, whose direct calls are
|
|
1024
|
+
* `alwaysinline` (loop-callees.ts). */
|
|
1025
|
+
loopCallees;
|
|
972
1026
|
/** Static types whose values can be published (@scriptc/threads): their
|
|
973
1027
|
* stores carry the frozen-object guard. Null without publish calls. */
|
|
974
1028
|
publishedTypes;
|
|
@@ -1017,6 +1071,10 @@ export class LlEmitter {
|
|
|
1017
1071
|
/** setTimeout and friends appeared somewhere: main must run the event
|
|
1018
1072
|
* loop even in programs with no async functions. */
|
|
1019
1073
|
usesTimers = false;
|
|
1074
|
+
/** A promise is made somewhere (Promise statics, `new Promise`,
|
|
1075
|
+
* Promise.withResolvers): main runs the event loop, whose end reports an
|
|
1076
|
+
* unhandled rejection as Node does, even without async functions. */
|
|
1077
|
+
usesPromises = false;
|
|
1020
1078
|
/** The program calls mock.timers members (moduleUsesMockTimers): timer
|
|
1021
1079
|
* calls emit scr_test.c's mock-aware entry points. */
|
|
1022
1080
|
mockTimers;
|
|
@@ -1062,6 +1120,8 @@ export class LlEmitter {
|
|
|
1062
1120
|
inlineUnions;
|
|
1063
1121
|
/** Unions whose values are nullable arm pointers (nullable-unions.ts). */
|
|
1064
1122
|
nullableUnions;
|
|
1123
|
+
/** The counters of a build instrumented for the heap census, or null. */
|
|
1124
|
+
heapCensus;
|
|
1065
1125
|
/** The union table without nullable unions: the stack-box analyses. */
|
|
1066
1126
|
boxedUnionsById;
|
|
1067
1127
|
recordsById = new Map();
|
|
@@ -1132,6 +1192,11 @@ export class LlEmitter {
|
|
|
1132
1192
|
* commit back into their objects. Library builds keep their commits:
|
|
1133
1193
|
* their values cross a native boundary. */
|
|
1134
1194
|
liveViewsReadOnly;
|
|
1195
|
+
/** IrModule.sloppyDynWrites: untyped writes in sloppy-mode code. */
|
|
1196
|
+
sloppyDynWrites;
|
|
1197
|
+
/** IrModule.foreignElementKeys: element keys whose arrays can hold
|
|
1198
|
+
* SCR_ARR_FOREIGN elements. */
|
|
1199
|
+
foreignElementKeys;
|
|
1135
1200
|
/** The program freezes, seals or prevents extensions of untyped values
|
|
1136
1201
|
* (IrModule.untypedIntegrity): the commits of class views store the
|
|
1137
1202
|
* view's integrity state in the instance's integrity word. */
|
|
@@ -1140,6 +1205,8 @@ export class LlEmitter {
|
|
|
1140
1205
|
int32Abis;
|
|
1141
1206
|
/** Pure number functions with speculative integer clones. */
|
|
1142
1207
|
integerClones;
|
|
1208
|
+
/** The records integer clones read (64-bit layouts). */
|
|
1209
|
+
cloneReferences;
|
|
1143
1210
|
/** The IR function being emitted. */
|
|
1144
1211
|
currentFunctionName = "";
|
|
1145
1212
|
integerParamRange(fnName, localId) {
|
|
@@ -1151,6 +1218,9 @@ export class LlEmitter {
|
|
|
1151
1218
|
/** ProgramLifetime hierarchy roots (contract types): their instances are
|
|
1152
1219
|
* immortal from construction (classes.ts programLifetimeClass). */
|
|
1153
1220
|
programLifetime;
|
|
1221
|
+
/** Inline array fields this emission may keep inline (ir/inline-arrays.ts);
|
|
1222
|
+
* the classes that do have LlClassMeta.inlineTail. */
|
|
1223
|
+
inlineArrays;
|
|
1154
1224
|
numericLocals = new Map();
|
|
1155
1225
|
captureIds = new Set();
|
|
1156
1226
|
/** Active induction bindings retain their width independently of size_t. */
|
|
@@ -1252,15 +1322,29 @@ export class LlEmitter {
|
|
|
1252
1322
|
/** Worker programs: typed-array accesses whose views an enclosing version
|
|
1253
1323
|
* guard proved thread-owned. */
|
|
1254
1324
|
bytesOwned = new Set();
|
|
1325
|
+
/** Worker programs: the strip-mined counted loop whose body is being
|
|
1326
|
+
* emitted (emitStripMinedCountedLoop), with its counter, its jump target
|
|
1327
|
+
* and its loopDepth. An element access of a view that may be shared, at
|
|
1328
|
+
* the counter and directly in that loop's body, is a plain load or store
|
|
1329
|
+
* (plainSharedElement in expr-bytes.ts). */
|
|
1330
|
+
plainSharedLoop = null;
|
|
1255
1331
|
/** The alias-scope attachment of each typed-array element read and write
|
|
1256
1332
|
* in the current loop version's fast copy (emitVersionedLoop), and the
|
|
1257
1333
|
* one the element access being emitted carries (bytesElementAlias). */
|
|
1258
1334
|
bytesAliasScopes = new Map();
|
|
1259
1335
|
bytesAccessScope = "";
|
|
1336
|
+
/** Header fields a speculative loop's entry read for its views
|
|
1337
|
+
* (bytes-headers.ts), while its copies are emitted. */
|
|
1338
|
+
bytesHeaders = null;
|
|
1339
|
+
/** The parameters of the function being emitted. */
|
|
1340
|
+
currentParameters = new Set();
|
|
1260
1341
|
/** Loop versions with alias scopes in the current function; it names
|
|
1261
1342
|
* their scopes. */
|
|
1262
1343
|
aliasScopedVersions = 0;
|
|
1263
1344
|
integerViews = new Map();
|
|
1345
|
+
/** The i1 slot beside an integer view of a local that only holds exact
|
|
1346
|
+
* integers or NaN: true when the local is not NaN. */
|
|
1347
|
+
orderedViews = new Map();
|
|
1264
1348
|
/** Module globals the current function owns outright (initializer
|
|
1265
1349
|
* bindings): their function-local slot, which stands in for the global. */
|
|
1266
1350
|
privateGlobalSlots = new Map();
|
|
@@ -1295,7 +1379,8 @@ export class LlEmitter {
|
|
|
1295
1379
|
currentUnionResult = false;
|
|
1296
1380
|
/** Active only while emitting a body lowered with LLVM's
|
|
1297
1381
|
* switched-coroutine intrinsics (wasm32 async bodies and generators,
|
|
1298
|
-
* native synchronous generators
|
|
1382
|
+
* native synchronous generators, and the native async bodies
|
|
1383
|
+
* selectStacklessAsync chose; see coroLowered). */
|
|
1299
1384
|
currentCoro = null;
|
|
1300
1385
|
/** Inline generator slot accesses need the %ScrGenHead/%ScrGenSlot
|
|
1301
1386
|
* mirrors in the module header. */
|
|
@@ -1341,7 +1426,10 @@ export class LlEmitter {
|
|
|
1341
1426
|
else
|
|
1342
1427
|
this.startInt32Slots(dynamicStores);
|
|
1343
1428
|
this.stackTraces = observesStacks(mod, this.nodeIndex);
|
|
1344
|
-
this.nullableUnions = new NullableUnions(mod, options.debugSources === undefined, this.nodeIndex);
|
|
1429
|
+
this.nullableUnions = new NullableUnions(mod, options.debugSources === undefined, this.nodeIndex, options.pointerBits !== 32, options.boxedUnions);
|
|
1430
|
+
this.heapCensus = heapCensusOf(mod, this.nullableUnions);
|
|
1431
|
+
for (const decl of this.heapCensus?.declarations() ?? [])
|
|
1432
|
+
this.declare(decl);
|
|
1345
1433
|
this.mockTimers = this.runtimeFeatures.mockTimers;
|
|
1346
1434
|
this.debug =
|
|
1347
1435
|
options.debugSources === undefined
|
|
@@ -1349,11 +1437,13 @@ export class LlEmitter {
|
|
|
1349
1437
|
: new LlvmDebugInfo(mod.sourceFile, options.debugSources, options.pointerBits, mod.unions, this.nullableUnions.armTypes());
|
|
1350
1438
|
this.constantNumericTables = findConstantNumericTables(mod);
|
|
1351
1439
|
this.untypedIntegrity = mod.untypedIntegrity === true;
|
|
1440
|
+
this.sloppyDynWrites = new Set(mod.sloppyDynWrites ?? []);
|
|
1352
1441
|
this.liveViewsReadOnly =
|
|
1353
1442
|
mod.lib === undefined &&
|
|
1354
1443
|
!this.untypedIntegrity &&
|
|
1355
1444
|
!dynamicStores.all &&
|
|
1356
1445
|
dynamicStores.names.size === 0;
|
|
1446
|
+
this.foreignElementKeys = new Set(mod.foreignElementKeys ?? []);
|
|
1357
1447
|
this.int32Abis = this.debug === null ? findInt32Abis(mod, this.int32Slots) : new Map();
|
|
1358
1448
|
this.immortalGlobals = new Set(mod.contracts?.immortalGlobals ?? []);
|
|
1359
1449
|
this.programLifetime = new Set(mod.contracts?.programLifetime ?? []);
|
|
@@ -1389,7 +1479,16 @@ export class LlEmitter {
|
|
|
1389
1479
|
this.emitLibraryIdentity = options.emitLibraryIdentity !== false;
|
|
1390
1480
|
this.runtimeAbiMarker = options.runtimeAbiMarker === true;
|
|
1391
1481
|
this.detachedExit = options.detachedExit === true;
|
|
1482
|
+
this.nodeIslandModuleData = options.nodeIslandModuleData ?? null;
|
|
1392
1483
|
this.targetCpu = options.targetCpu;
|
|
1484
|
+
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);
|
|
1393
1492
|
this.wasmBoundsChecks =
|
|
1394
1493
|
options.wasmBoundsChecks === true ||
|
|
1395
1494
|
wasmBoundsChecks({
|
|
@@ -1430,10 +1529,11 @@ export class LlEmitter {
|
|
|
1430
1529
|
(options.targetTriple
|
|
1431
1530
|
? /-linux-(?:gnu|musl)/.test(options.targetTriple)
|
|
1432
1531
|
: process.platform === "linux")
|
|
1433
|
-
? unwindAbiFunctions(mod, this.mayThrow, options.unwindExcluded)
|
|
1532
|
+
? unwindAbiFunctions(mod, this.mayThrow, options.unwindExcluded, this.nodeIndex, options.rareExceptions === true)
|
|
1434
1533
|
: new Set();
|
|
1435
1534
|
this.workerEntryPolls = mt.workerEntryPolls ?? null;
|
|
1436
1535
|
this.stackChecks = mt.stackChecks ?? null;
|
|
1536
|
+
this.loopCallees = findLoopCallees(mod);
|
|
1437
1537
|
// A stackless call's eager prefix borrows its caller's stack; the
|
|
1438
1538
|
// runtime moves deep prefix nests to a fresh stack using the guard,
|
|
1439
1539
|
// which Windows lacks.
|
|
@@ -1477,6 +1577,12 @@ export class LlEmitter {
|
|
|
1477
1577
|
this.referenceEffects = new ReferenceEffects(this.fnByName, (call) => this.optionalArrayReads.get(call) !== null, mod.classes ?? []);
|
|
1478
1578
|
if (this.debug === null)
|
|
1479
1579
|
this.referenceWrites = new ReferenceWrites(this.fnByName, mod.classes ?? [], (call) => this.optionalArrayReads.get(call) !== null, new Set((mod.globals ?? []).map((g) => g.id)), { unions: mod.unions, records: mod.records }, this.immutableFields, this.nodeIndex);
|
|
1580
|
+
// Inline array fields (ir/inline-arrays.ts), where the module passes
|
|
1581
|
+
// prepared their reads and constructions.
|
|
1582
|
+
this.inlineArrays =
|
|
1583
|
+
options.debugSources === undefined && inlineArraysApply(mod, options)
|
|
1584
|
+
? planInlineArrays(mod, programLifetimeClassOf(mod))
|
|
1585
|
+
: NO_INLINE_ARRAYS;
|
|
1480
1586
|
const walkParameters = new Map();
|
|
1481
1587
|
if (this.debug === null) {
|
|
1482
1588
|
const host = {
|
|
@@ -1508,7 +1614,7 @@ export class LlEmitter {
|
|
|
1508
1614
|
const rebound = findReboundParameters(fn, (type) => this.plainReference(type) &&
|
|
1509
1615
|
type.kind !== "string" &&
|
|
1510
1616
|
(type.kind !== "union" ||
|
|
1511
|
-
this.nullableUnions.single(type.unionId)?.arm.kind !== "string"), this.walkBorrowsByFunction.get(fn.name) ?? new Set());
|
|
1617
|
+
this.nullableUnions.single(type.unionId)?.arm.kind !== "string"), this.walkBorrowsByFunction.get(fn.name) ?? new Set(), this.nodeIndex);
|
|
1512
1618
|
if (rebound.size === 0)
|
|
1513
1619
|
continue;
|
|
1514
1620
|
this.reboundByFunction.set(fn.name, rebound);
|
|
@@ -1527,6 +1633,8 @@ export class LlEmitter {
|
|
|
1527
1633
|
const shape = this.recordsById.get(shapeId);
|
|
1528
1634
|
return shape !== undefined && !recordDynKeepsIdentity(shape);
|
|
1529
1635
|
}, (wrap) => this.borrowableNullableWrap(wrap) === "ref");
|
|
1636
|
+
if (this.stackObjects)
|
|
1637
|
+
this.frameEscapes = analyzeFrameEscapes(this.mod);
|
|
1530
1638
|
if (this.debug === null) {
|
|
1531
1639
|
const strings = findLentStringParameters(this.fnByName, this.callLifetimes);
|
|
1532
1640
|
this.lendingFacts = {
|
|
@@ -1536,24 +1644,6 @@ export class LlEmitter {
|
|
|
1536
1644
|
};
|
|
1537
1645
|
}
|
|
1538
1646
|
this.constantCallbacks = findConstantCallbacks(mod, this.callLifetimes, this.nodeIndex);
|
|
1539
|
-
// Integer clones signal a stack overflow through their result, which
|
|
1540
|
-
// needs the single-threaded guard; worker programs also poll for
|
|
1541
|
-
// termination, and debug builds and stack traces keep every frame.
|
|
1542
|
-
// Clones read number arrays their function borrows (64-bit layouts).
|
|
1543
|
-
this.integerClones =
|
|
1544
|
-
this.debug === null &&
|
|
1545
|
-
this.stackChecks !== null &&
|
|
1546
|
-
mod.workers !== true &&
|
|
1547
|
-
mod.lib === undefined &&
|
|
1548
|
-
!this.stackTraces
|
|
1549
|
-
? findIntegerClones(mod, this.sizeType === "i64"
|
|
1550
|
-
? (fn, index) => this.callLifetimes.borrowed.get(fn)?.has(index) === true
|
|
1551
|
-
: undefined)
|
|
1552
|
-
: NO_INTEGER_CLONES;
|
|
1553
|
-
// Integer clones and their dispatchers call each other through their
|
|
1554
|
-
// own lowering, which keeps plain calls and flag tests.
|
|
1555
|
-
for (const name of this.integerClones.members)
|
|
1556
|
-
this.unwindAbi.delete(name);
|
|
1557
1647
|
this.stackCallbacks = new StackCallbacks(this.fnByName);
|
|
1558
1648
|
this.receiverReaders = new AmbientReceiverReaders(this.fnByName, this.nodeIndex);
|
|
1559
1649
|
this.stackCaptures = new StackCaptures(this.fnByName, this.callLifetimes, this.stackCallbacks);
|
|
@@ -1581,6 +1671,8 @@ export class LlEmitter {
|
|
|
1581
1671
|
}
|
|
1582
1672
|
}
|
|
1583
1673
|
}
|
|
1674
|
+
// The same holds for a class union's arms (class-unions.ts).
|
|
1675
|
+
classUnionHeaders(mod, this.nullableUnions.allClassUnions(), this.tracedShapes, this.tracedUnions);
|
|
1584
1676
|
this.shapeHost = {
|
|
1585
1677
|
// Journal hooks only on emitters that can emit ranges (chunk
|
|
1586
1678
|
// emitters, and emitters whose workers take a journal after the
|
|
@@ -1626,6 +1718,7 @@ export class LlEmitter {
|
|
|
1626
1718
|
declare: (decl) => this.declare(decl),
|
|
1627
1719
|
needOom: () => this.needOom(),
|
|
1628
1720
|
needBadTag: () => this.needBadTag(),
|
|
1721
|
+
mayHoldForeign: (elem) => this.mayHoldForeign(elem),
|
|
1629
1722
|
internLiteral: (text) => this.internLiteral(text),
|
|
1630
1723
|
cstr: (text) => this.cstr(text),
|
|
1631
1724
|
mapOps: (operands) => this.mapOps(operands),
|
|
@@ -1656,7 +1749,73 @@ export class LlEmitter {
|
|
|
1656
1749
|
virtualEntry: (implFn) => this.virtualEntry(implFn),
|
|
1657
1750
|
programLifetime: this.programLifetime,
|
|
1658
1751
|
regionAliasTag: (word) => this.memoryAliasAttachment(`region.${word}`),
|
|
1752
|
+
heapCensus: this.heapCensus,
|
|
1659
1753
|
};
|
|
1754
|
+
// An instance of a class that extends Array is an array: a slot of its
|
|
1755
|
+
// element array type can hold it, and the collector visits it there as
|
|
1756
|
+
// an array, which has a collector header when its element ops trace
|
|
1757
|
+
// (scr_arr_make_ops_kind). Such a class carries a header too, and so
|
|
1758
|
+
// does the rest of its hierarchy. A class whose elements are instances
|
|
1759
|
+
// of another such class follows that class, so repeat until no class
|
|
1760
|
+
// adds one.
|
|
1761
|
+
const arrayClasses = (mod.classes ?? []).filter((c) => c.arrayElem !== undefined);
|
|
1762
|
+
if (arrayClasses.length > 0) {
|
|
1763
|
+
const baseOf = new Map((mod.classes ?? []).map((c) => [c.name, c.base]));
|
|
1764
|
+
const rootOf = (name) => {
|
|
1765
|
+
let root = name;
|
|
1766
|
+
for (let base = baseOf.get(root); base !== undefined && baseOf.has(base); base = baseOf.get(root))
|
|
1767
|
+
root = base;
|
|
1768
|
+
return root;
|
|
1769
|
+
};
|
|
1770
|
+
for (let changed = true; changed;) {
|
|
1771
|
+
changed = false;
|
|
1772
|
+
for (const cls of arrayClasses) {
|
|
1773
|
+
if (this.tracedShapes.has(`object:${cls.name}`))
|
|
1774
|
+
continue;
|
|
1775
|
+
if (traceAdapter(this.shapeHost, { kind: "array", elem: cls.arrayElem }) === null)
|
|
1776
|
+
continue;
|
|
1777
|
+
const root = rootOf(cls.name);
|
|
1778
|
+
for (const member of mod.classes ?? [])
|
|
1779
|
+
if (rootOf(member.name) === root)
|
|
1780
|
+
this.tracedShapes.add(`object:${member.name}`);
|
|
1781
|
+
changed = true;
|
|
1782
|
+
}
|
|
1783
|
+
}
|
|
1784
|
+
}
|
|
1785
|
+
// Planned before any host copies the shape host (record-views.ts).
|
|
1786
|
+
{
|
|
1787
|
+
const views = planRecordViews(mod, {
|
|
1788
|
+
traced: (id) => this.tracedShapes.has(`record:${id}`),
|
|
1789
|
+
// A tagged shape's values share field reads with the other arms of
|
|
1790
|
+
// its shape union.
|
|
1791
|
+
excluded: (id) => this.nullableUnions.shapeNumber(id) !== 0 ||
|
|
1792
|
+
this.publishedTypes?.recordGuarded(id) === true ||
|
|
1793
|
+
mod.workers === true,
|
|
1794
|
+
});
|
|
1795
|
+
this.shapeHost.recordViews = views;
|
|
1796
|
+
this.recordViewTargets = views.targets;
|
|
1797
|
+
}
|
|
1798
|
+
// Integer clones signal a stack overflow through their result. Worker
|
|
1799
|
+
// programs have them only as ELF executables, where the stack guard
|
|
1800
|
+
// and the pending word clones poll for termination are plain
|
|
1801
|
+
// thread-locals; debug builds and stack traces keep every frame.
|
|
1802
|
+
// Clones read number arrays and record graphs their function borrows
|
|
1803
|
+
// (64-bit layouts), but no record that may be a view (planned above).
|
|
1804
|
+
this.cloneReferences = this.sizeType === "i64" ? this.recordCloneReferences() : undefined;
|
|
1805
|
+
this.integerClones =
|
|
1806
|
+
this.debug === null &&
|
|
1807
|
+
this.stackChecks !== null &&
|
|
1808
|
+
(mod.workers !== true || this.executableTls) &&
|
|
1809
|
+
mod.lib === undefined &&
|
|
1810
|
+
!this.stackTraces
|
|
1811
|
+
? findIntegerClones(mod, this.sizeType === "i64"
|
|
1812
|
+
? (fn, index) => this.callLifetimes.borrowed.get(fn)?.has(index) === true
|
|
1813
|
+
: undefined, this.cloneReferences)
|
|
1814
|
+
: NO_INTEGER_CLONES;
|
|
1815
|
+
// Integer clones and their dispatchers call each other through their
|
|
1816
|
+
// own lowering, which keeps plain calls and flag tests.
|
|
1817
|
+
for (const name of this.integerClones.members)
|
|
1818
|
+
this.unwindAbi.delete(name);
|
|
1660
1819
|
this.walkers = new LlWalkers(this.shapeHost);
|
|
1661
1820
|
this.dyn = new LlDyn(this.shapeHost);
|
|
1662
1821
|
for (const g of mod.globals ?? []) {
|
|
@@ -1695,7 +1854,7 @@ export class LlEmitter {
|
|
|
1695
1854
|
// The class graph: base/children links, hierarchy membership, the
|
|
1696
1855
|
// whole-program preorder numbering for instanceof over runtime and
|
|
1697
1856
|
// compiled error objects, and the per-hierarchy virtual slot lists.
|
|
1698
|
-
this.classMeta = buildClassGraph(mod, this.fnByName, this.sizeType);
|
|
1857
|
+
this.classMeta = buildClassGraph(mod, this.fnByName, this.sizeType, this.nullableUnions.taggedClasses());
|
|
1699
1858
|
if (mod.lifetimeRegions === true) {
|
|
1700
1859
|
this.regions = new LifetimeRegions(this.shapeHost, mod, this.classMeta, (meta) => programLifetimeClass(this.shapeHost, meta), this.nullableFields);
|
|
1701
1860
|
const regions = this.regions;
|
|
@@ -1730,11 +1889,50 @@ export class LlEmitter {
|
|
|
1730
1889
|
: null;
|
|
1731
1890
|
return nullable !== null && isCompact(nullable.arm.className);
|
|
1732
1891
|
}
|
|
1733
|
-
: undefined);
|
|
1892
|
+
: undefined, this.inlineArrays.classes);
|
|
1734
1893
|
this.compactRegion =
|
|
1735
1894
|
mod.lib === undefined &&
|
|
1736
1895
|
options.lowRegion === true &&
|
|
1737
1896
|
[...this.classMeta.values()].some((m) => m.compact);
|
|
1897
|
+
// Group arenas: off with lifetime regions, which own their classes'
|
|
1898
|
+
// allocation, and in libraries, whose exports any host code calls.
|
|
1899
|
+
if (arenasRequested() && mod.lifetimeRegions !== true && mod.lib === undefined) {
|
|
1900
|
+
this.arenas = planArenas(mod, {
|
|
1901
|
+
shape: (id) => {
|
|
1902
|
+
const shape = this.recordsById.get(id);
|
|
1903
|
+
return (shape !== undefined &&
|
|
1904
|
+
shape.freezable !== true &&
|
|
1905
|
+
shape.indexValue === undefined &&
|
|
1906
|
+
this.publishedTypes?.recordGuarded(id) !== true);
|
|
1907
|
+
},
|
|
1908
|
+
cls: (def) => {
|
|
1909
|
+
const meta = this.classMeta.get(def.name);
|
|
1910
|
+
return (meta !== undefined &&
|
|
1911
|
+
!meta.compact &&
|
|
1912
|
+
!meta.threadSlot &&
|
|
1913
|
+
// An Array subclass's instance is an array (the runtime's header).
|
|
1914
|
+
def.arrayElem === undefined &&
|
|
1915
|
+
meta.root.def.arrayElem === undefined &&
|
|
1916
|
+
!this.programLifetime.has(def.name) &&
|
|
1917
|
+
this.publishedTypes?.classGuarded(def.name) !== true);
|
|
1918
|
+
},
|
|
1919
|
+
nullableArm: (unionId) => this.nullableUnions.single(unionId)?.arm ?? null,
|
|
1920
|
+
traced: (t) => traceAdapter(this.shapeHost, t) !== null,
|
|
1921
|
+
});
|
|
1922
|
+
if (this.arenas !== null) {
|
|
1923
|
+
this.shapeHost.arenaShapes = this.arenas.shapes;
|
|
1924
|
+
this.shapeHost.arenaClasses = this.arenas.classes;
|
|
1925
|
+
this.shapeHost.arenasClosed = this.arenas.allClosed;
|
|
1926
|
+
}
|
|
1927
|
+
}
|
|
1928
|
+
// Arena shapes are known only now; the plan's target set is shared by
|
|
1929
|
+
// every host that copied the shape host, so dropping them here reaches
|
|
1930
|
+
// all of them.
|
|
1931
|
+
const arenaShapes = this.shapeHost.arenaShapes;
|
|
1932
|
+
const viewTargets = this.recordViewTargets;
|
|
1933
|
+
if (arenaShapes !== undefined && viewTargets !== null)
|
|
1934
|
+
for (const id of arenaShapes)
|
|
1935
|
+
viewTargets.delete(id);
|
|
1738
1936
|
for (const [name, rec] of RUNTIME_ERROR_CLASSES) {
|
|
1739
1937
|
const meta = this.classMeta.get(name);
|
|
1740
1938
|
if (!meta)
|
|
@@ -1842,7 +2040,9 @@ export class LlEmitter {
|
|
|
1842
2040
|
}
|
|
1843
2041
|
emitParts() {
|
|
1844
2042
|
const parts = emitParts(this);
|
|
1845
|
-
|
|
2043
|
+
const bridged = this.unwindAbi.size > 0 ? bridgePlainUnwindCalls(parts) : parts;
|
|
2044
|
+
const out = this.cpuDispatch ? cloneForCpuDispatch(bridged) : bridged;
|
|
2045
|
+
return this.heapCensus === null ? out : [...out, this.heapCensus.definitions().join("\n")];
|
|
1846
2046
|
}
|
|
1847
2047
|
/** The dispose-observer gates the emitted frees and record writers test
|
|
1848
2048
|
* (alloc.ts): defined after every helper is emitted, because dynCheck
|
|
@@ -1882,6 +2082,7 @@ export class LlEmitter {
|
|
|
1882
2082
|
...late,
|
|
1883
2083
|
...emitNullableRetainWrappers(this.shapeHost),
|
|
1884
2084
|
...emitShapeUnionHelpers(this.shapeHost),
|
|
2085
|
+
...emitClassUnionHelpers(this.shapeHost, this.classMeta),
|
|
1885
2086
|
...emitInlineRcHelpers(this.shapeHost),
|
|
1886
2087
|
];
|
|
1887
2088
|
}
|
|
@@ -1900,7 +2101,7 @@ export class LlEmitter {
|
|
|
1900
2101
|
const ret = fn.async === true || fn.generator !== undefined ? "ptr" : this.llType(fn.returnType);
|
|
1901
2102
|
const call = `call ${ret} @${this.callTarget(name)}(${args})`;
|
|
1902
2103
|
const lending = this.lendsEveryArgument(name);
|
|
1903
|
-
out.push(`define internal ${ret} @${mangleWrapper(name)}(ptr %env${params.length ? ", " + params.join(", ") : ""}) ${FN_ATTRS} { ; ${name} as a value`, `entry:`, ret === "void" ? ` ${call}` : ` %r = ${call}`, ret === "void" ? ` ret void` : ` ret ${ret} %r`, `}`, `@${mangleFnClosure(name)} = internal ${this.mod.workers === true || this.mod.lib?.threadInstances === true ? "thread_local " : ""}global %ScrClosure { ${this.sizeType} -1, ptr @${mangleWrapper(name)}, ${this.sizeType} 0, ptr null, i32 ${
|
|
2104
|
+
out.push(`define internal ${ret} @${mangleWrapper(name)}(ptr %env${params.length ? ", " + params.join(", ") : ""}) ${FN_ATTRS} { ; ${name} as a value`, `entry:`, ret === "void" ? ` ${call}` : ` %r = ${call}`, ret === "void" ? ` ret void` : ` ret ${ret} %r`, `}`, `@${mangleFnClosure(name)} = internal ${this.mod.workers === true || this.mod.lib?.threadInstances === true ? "thread_local " : ""}global %ScrClosure { ${this.sizeType} -1, ptr @${mangleWrapper(name)}, ${this.sizeType} 0, ptr null, i32 ${this.closureFunctionKind(fn)}, i32 0, ptr null, ptr ${lending ? `@${mangleBorrowingWrapper(name)}` : "null"} }`, ``);
|
|
1904
2105
|
if (lending)
|
|
1905
2106
|
out.push(`define internal ${ret} @${mangleBorrowingWrapper(name)}(ptr %env${params.length ? ", " + params.join(", ") : ""}) ${FN_ATTRS} { ; ${name} as a value, lending its arguments`, `entry:`, ret === "void"
|
|
1906
2107
|
? ` call void @${mangleBorrowedFunction(name)}(${args})`
|
|
@@ -1992,19 +2193,21 @@ export class LlEmitter {
|
|
|
1992
2193
|
at = text.indexOf("@sc_", end);
|
|
1993
2194
|
}
|
|
1994
2195
|
}
|
|
1995
|
-
/** Chooses the native async functions
|
|
1996
|
-
* coroutines instead of running on a fiber: a
|
|
1997
|
-
* heap frame of the values live across its
|
|
1998
|
-
*
|
|
1999
|
-
*
|
|
2000
|
-
*
|
|
2001
|
-
*
|
|
2002
|
-
*
|
|
2003
|
-
*
|
|
2004
|
-
*
|
|
2005
|
-
*
|
|
2006
|
-
*
|
|
2007
|
-
*
|
|
2196
|
+
/** Chooses the native async functions and async generators whose bodies
|
|
2197
|
+
* compile to switched coroutines instead of running on a fiber: a
|
|
2198
|
+
* suspended call then keeps a heap frame of the values live across its
|
|
2199
|
+
* awaits and yields rather than a fiber and its stack. A body qualifies
|
|
2200
|
+
* when its only suspension points are its own awaits and yields, which
|
|
2201
|
+
* the coroutine form suspends itself at (emitCoroAwait,
|
|
2202
|
+
* emitCoroSuspendPrepared), so nothing it runs can park the stack it
|
|
2203
|
+
* borrows. It is first emitted as usual: that text may suspend only
|
|
2204
|
+
* through await and yield runtime calls and await-call entries, which the
|
|
2205
|
+
* coroutine form replaces, and may call no function that parks. The
|
|
2206
|
+
* coroutine form is then emitted and must pass the same test with no
|
|
2207
|
+
* exceptions (its frame bookkeeping excepted); otherwise the fiber form
|
|
2208
|
+
* stays. Bodies that never suspend stay fiberless, and module evaluation
|
|
2209
|
+
* bodies and async functions with `dyn` results keep fibers as they do
|
|
2210
|
+
* there. The runtime traps if a stackless body ever parks. */
|
|
2008
2211
|
selectStacklessAsync(fnDefs) {
|
|
2009
2212
|
if (!this.stacklessAsyncAllowed)
|
|
2010
2213
|
return;
|
|
@@ -2023,14 +2226,21 @@ export class LlEmitter {
|
|
|
2023
2226
|
return true;
|
|
2024
2227
|
};
|
|
2025
2228
|
this.mod.functions.forEach((fn, index) => {
|
|
2026
|
-
if (fn.async !== true
|
|
2229
|
+
if (fn.async !== true)
|
|
2027
2230
|
return;
|
|
2028
2231
|
if (fn.asyncCacheGlobal !== undefined || fn.asyncCycleCacheGlobal !== undefined)
|
|
2029
2232
|
return;
|
|
2030
|
-
|
|
2233
|
+
// A dyn result may adopt a thenable when it settles the promise; an
|
|
2234
|
+
// async generator's completion value settles its request's record.
|
|
2235
|
+
if (fn.generator === undefined && fn.returnType.kind === "dyn")
|
|
2031
2236
|
return;
|
|
2032
|
-
|
|
2033
|
-
|
|
2237
|
+
if (!parks.has(fn.name))
|
|
2238
|
+
return;
|
|
2239
|
+
// An async generator's body also suspends at its own yields.
|
|
2240
|
+
let fiberText = fnDefs[index].replace(AWAIT_SUSPENSIONS, "");
|
|
2241
|
+
if (fn.generator !== undefined)
|
|
2242
|
+
fiberText = fiberText.replace(YIELD_SUSPENSIONS, "");
|
|
2243
|
+
if (!qualifies(fn, fiberText, SUSPENDS))
|
|
2034
2244
|
return;
|
|
2035
2245
|
this.stacklessAsync.add(fn.name);
|
|
2036
2246
|
const coroText = this.emitFunction(fn);
|
|
@@ -2458,18 +2668,19 @@ export class LlEmitter {
|
|
|
2458
2668
|
if (this.wasi)
|
|
2459
2669
|
return fn.async === true || fn.generator !== undefined;
|
|
2460
2670
|
if (fn.async === true)
|
|
2461
|
-
return
|
|
2671
|
+
return this.stacklessAsync.has(fn.name);
|
|
2462
2672
|
return this.stacklessGenerators && fn.generator !== undefined;
|
|
2463
2673
|
}
|
|
2464
2674
|
emitGenScaffolding() {
|
|
2465
2675
|
return emitGenScaffolding(this);
|
|
2466
2676
|
}
|
|
2467
2677
|
// ── plumbing (frame and scope ownership) ──────
|
|
2468
|
-
/** A symbol derived from
|
|
2469
|
-
* index, so an edit that interns one more string
|
|
2470
|
-
*
|
|
2471
|
-
* native builds reuse the compiled partitions an
|
|
2472
|
-
* collision retries with a counter, still in
|
|
2678
|
+
/** A symbol derived from a constant's text, or a helper's key, rather
|
|
2679
|
+
* than its first-use index, so an edit that interns one more string or
|
|
2680
|
+
* helper leaves every other symbol, and the code referencing it,
|
|
2681
|
+
* unchanged. This lets native builds reuse the compiled partitions an
|
|
2682
|
+
* edit does not touch. A collision retries with a counter, still in
|
|
2683
|
+
* first-use order. */
|
|
2473
2684
|
contentSymbol(prefix, text) {
|
|
2474
2685
|
for (let attempt = 0;; attempt++) {
|
|
2475
2686
|
const digest = createHash("sha256")
|
|
@@ -2588,7 +2799,7 @@ export class LlEmitter {
|
|
|
2588
2799
|
const key = `${unionId}:${tag}`;
|
|
2589
2800
|
let sym = this.unitInstances.get(key);
|
|
2590
2801
|
if (!sym) {
|
|
2591
|
-
sym =
|
|
2802
|
+
sym = this.contentSymbol("sc_unit_", key);
|
|
2592
2803
|
this.unitInstances.set(key, sym);
|
|
2593
2804
|
}
|
|
2594
2805
|
this.journal?.entry("unit", key, sym);
|
|
@@ -2695,9 +2906,14 @@ export class LlEmitter {
|
|
|
2695
2906
|
}
|
|
2696
2907
|
/** Registers a SLOT whose current contents the frame owns (conditional
|
|
2697
2908
|
* results: optional chains, branch joins that park ownership). */
|
|
2698
|
-
ownSlot(slot, type) {
|
|
2909
|
+
ownSlot(slot, type, rarelyFilled = false) {
|
|
2699
2910
|
if (isRefCounted(type))
|
|
2700
|
-
this.currentFrame().push({
|
|
2911
|
+
this.currentFrame().push({
|
|
2912
|
+
name: slot,
|
|
2913
|
+
type,
|
|
2914
|
+
slot: true,
|
|
2915
|
+
...(rarelyFilled ? { rarelyFilled: true } : {}),
|
|
2916
|
+
});
|
|
2701
2917
|
}
|
|
2702
2918
|
/** The innermost lexical scope releases a frame object's reference
|
|
2703
2919
|
* fields when it exits, as it releases its bindings. */
|
|
@@ -2791,12 +3007,25 @@ export class LlEmitter {
|
|
|
2791
3007
|
/** Releases a statement frame's temps and owned slots. */
|
|
2792
3008
|
releaseTemps(frame) {
|
|
2793
3009
|
for (const v of frame) {
|
|
3010
|
+
if (v.arena !== undefined)
|
|
3011
|
+
continue;
|
|
2794
3012
|
if (v.slot) {
|
|
2795
3013
|
const t = this.B.tmp();
|
|
2796
3014
|
this.B.line(`${t} = load ptr, ptr ${v.name}`);
|
|
2797
3015
|
if (v.boxed) {
|
|
2798
3016
|
this.B.line(`call void ${boxReleaseSym(this.shapeHost)}(ptr ${t})`);
|
|
2799
3017
|
}
|
|
3018
|
+
else if (v.rarelyFilled && !this.B.isTerminated()) {
|
|
3019
|
+
// Skip the release call on the common empty path.
|
|
3020
|
+
const filled = this.B.tmp();
|
|
3021
|
+
this.B.line(`${filled} = icmp ne ptr ${t}, null`);
|
|
3022
|
+
const release = this.B.newLabel("slot.release"), join = this.B.newLabel("slot.release.j");
|
|
3023
|
+
this.B.condBr(filled, release, join);
|
|
3024
|
+
this.B.startBlock(release);
|
|
3025
|
+
this.releaseFrame(t, v.type);
|
|
3026
|
+
this.B.br(join);
|
|
3027
|
+
this.B.startBlock(join);
|
|
3028
|
+
}
|
|
2800
3029
|
else {
|
|
2801
3030
|
this.releaseFrame(t, v.type);
|
|
2802
3031
|
}
|
|
@@ -2805,9 +3034,20 @@ export class LlEmitter {
|
|
|
2805
3034
|
this.releaseFrame(v.name, v.type);
|
|
2806
3035
|
}
|
|
2807
3036
|
}
|
|
3037
|
+
// Arena lists last: the frame's temps may be arena objects.
|
|
3038
|
+
for (const v of frame)
|
|
3039
|
+
if (v.arena === "drop")
|
|
3040
|
+
this.B.line(`call void @scr_arena_drop(ptr ${v.name})`);
|
|
3041
|
+
else if (v.arena === "close") {
|
|
3042
|
+
const head = this.B.tmp();
|
|
3043
|
+
this.B.line(`${head} = load ptr, ptr ${v.name}`);
|
|
3044
|
+
this.B.line(`call void @scr_arena_close(ptr ${head})`);
|
|
3045
|
+
}
|
|
2808
3046
|
}
|
|
2809
3047
|
releaseScope(scope) {
|
|
2810
3048
|
for (const e of scope) {
|
|
3049
|
+
if (e.arena === true)
|
|
3050
|
+
continue;
|
|
2811
3051
|
const t = this.B.tmp();
|
|
2812
3052
|
this.B.line(`${t} = load ptr, ptr ${e.slot}`);
|
|
2813
3053
|
if (e.boxed && e.lazy) {
|
|
@@ -2831,6 +3071,10 @@ export class LlEmitter {
|
|
|
2831
3071
|
this.releaseFrame(t, e.type); // runtime releases are NULL-tolerant
|
|
2832
3072
|
}
|
|
2833
3073
|
}
|
|
3074
|
+
// Arena lists last: the scope's bindings may hold arena objects.
|
|
3075
|
+
for (const e of scope)
|
|
3076
|
+
if (e.arena === true)
|
|
3077
|
+
this.B.line(`call void @scr_arena_drop(ptr ${e.slot})`);
|
|
2834
3078
|
}
|
|
2835
3079
|
/** THE release-on-jump path (break/continue/return): pending statement
|
|
2836
3080
|
* frames and entered scopes down to the given depths, innermost first —
|
|
@@ -3018,7 +3262,10 @@ export class LlEmitter {
|
|
|
3018
3262
|
* (function entry or loop budget), whose test must stay ordered. A
|
|
3019
3263
|
* `guard` (an i1) limits the test to the paths where it is true: false
|
|
3020
3264
|
* where the joined call could not have left anything pending. */
|
|
3021
|
-
emitPendingCheck(passThrough, poll = false, guard
|
|
3265
|
+
emitPendingCheck(passThrough, poll = false, guard,
|
|
3266
|
+
/** Runs at the start of the cold unwind block, before the unwind (a
|
|
3267
|
+
* package-declared check's origin note). */
|
|
3268
|
+
onUnwind) {
|
|
3022
3269
|
const through = passThrough !== undefined &&
|
|
3023
3270
|
this.llType(passThrough.type) === this.llType(this.currentReturnType) &&
|
|
3024
3271
|
(passThrough.type.kind === "f64" || passThrough.type.kind === "bool")
|
|
@@ -3042,6 +3289,7 @@ export class LlEmitter {
|
|
|
3042
3289
|
const lk = B.newLabel("exc.k");
|
|
3043
3290
|
B.condBr(p, lu, lk);
|
|
3044
3291
|
B.startBlock(lu);
|
|
3292
|
+
onUnwind?.();
|
|
3045
3293
|
this.emitUnwind(through);
|
|
3046
3294
|
B.startBlock(lk);
|
|
3047
3295
|
if (skip !== undefined) {
|
|
@@ -3122,6 +3370,7 @@ export class LlEmitter {
|
|
|
3122
3370
|
B.condBr(cold, lu, lk);
|
|
3123
3371
|
}
|
|
3124
3372
|
B.startBlock(lu);
|
|
3373
|
+
onUnwind?.();
|
|
3125
3374
|
this.emitUnwind(through);
|
|
3126
3375
|
B.startBlock(lk);
|
|
3127
3376
|
if (skip !== undefined) {
|
|
@@ -3149,6 +3398,17 @@ export class LlEmitter {
|
|
|
3149
3398
|
* calls (unwindAbiFunctions excludes their callees). */
|
|
3150
3399
|
emitDirectCall(line, callee) {
|
|
3151
3400
|
const B = this.B;
|
|
3401
|
+
// A small leaf called only from loops inlines into each of them, past
|
|
3402
|
+
// LLVM's cost threshold (loop-callees.ts), and so does a function called
|
|
3403
|
+
// only from a loop's entry-range version (loop-entry-versions.ts).
|
|
3404
|
+
// Debug builds keep the call.
|
|
3405
|
+
if (this.debug === null && (this.loopCallees.has(callee) || loopEntryInlines(this, callee))) {
|
|
3406
|
+
const comment = line.indexOf(" ; ");
|
|
3407
|
+
line =
|
|
3408
|
+
comment < 0
|
|
3409
|
+
? `${line} alwaysinline`
|
|
3410
|
+
: `${line.slice(0, comment)} alwaysinline${line.slice(comment)}`;
|
|
3411
|
+
}
|
|
3152
3412
|
if (!this.unwindAbi.has(callee) || this.currentCoro !== null || B.isTerminated()) {
|
|
3153
3413
|
B.line(line);
|
|
3154
3414
|
return false;
|
|
@@ -3272,9 +3532,19 @@ export class LlEmitter {
|
|
|
3272
3532
|
workerLoopPolls(loop) {
|
|
3273
3533
|
return (this.mod.workers === true && !loopTestsEveryIteration(loop, (e) => this.callTestsPending(e)));
|
|
3274
3534
|
}
|
|
3535
|
+
/** The countdown slot of `loop`'s cancellation poll (emitWorkerLoopCheck),
|
|
3536
|
+
* or null when the loop does not poll. An ELF worker executable's poll is
|
|
3537
|
+
* one ordered load of the thread's own pending word. A loop nest keeps
|
|
3538
|
+
* one countdown per loop, which its register pressure often leaves in
|
|
3539
|
+
* memory, so the loops of a nest there poll on every iteration and get
|
|
3540
|
+
* POLL_EVERY_ITERATION instead of a slot. A loop on its own keeps its
|
|
3541
|
+
* countdown in a register, which costs less than the load. */
|
|
3275
3542
|
workerLoopBudget(loop) {
|
|
3276
3543
|
if (!this.workerLoopPolls(loop))
|
|
3277
3544
|
return null;
|
|
3545
|
+
if (this.executableTls &&
|
|
3546
|
+
(this.jumpTargets.some((target) => target.kind === "loop") || containsLoop(loop.body)))
|
|
3547
|
+
return POLL_EVERY_ITERATION;
|
|
3278
3548
|
const slot = this.B.slot();
|
|
3279
3549
|
this.B.entryAllocas.push(`${slot} = alloca i32 ; worker cancellation budget`);
|
|
3280
3550
|
this.B.line(`store i32 0, ptr ${slot}`);
|
|
@@ -3368,6 +3638,10 @@ export class LlEmitter {
|
|
|
3368
3638
|
emitWorkerLoopCheck(slot) {
|
|
3369
3639
|
if (slot === null)
|
|
3370
3640
|
return;
|
|
3641
|
+
if (slot === POLL_EVERY_ITERATION) {
|
|
3642
|
+
this.emitWorkerPoll();
|
|
3643
|
+
return;
|
|
3644
|
+
}
|
|
3371
3645
|
const B = this.B;
|
|
3372
3646
|
const budget = B.tmp(), due = B.tmp(), remaining = B.tmp();
|
|
3373
3647
|
const poll = B.newLabel("worker.poll"), next = B.newLabel("worker.next");
|
|
@@ -3383,9 +3657,9 @@ export class LlEmitter {
|
|
|
3383
3657
|
B.startBlock(next);
|
|
3384
3658
|
}
|
|
3385
3659
|
/** The cancellation poll itself. Calls and throwing operations retain
|
|
3386
|
-
* their own checks.
|
|
3387
|
-
* batches of iterations so scalar work does not
|
|
3388
|
-
* every iteration. */
|
|
3660
|
+
* their own checks. Outside ELF worker executables, loops amortize this
|
|
3661
|
+
* extra poll across bounded batches of iterations so scalar work does not
|
|
3662
|
+
* cross the runtime ABI on every iteration. */
|
|
3389
3663
|
emitWorkerPoll() {
|
|
3390
3664
|
this.emitPendingCheck(undefined, true);
|
|
3391
3665
|
}
|
|
@@ -3537,6 +3811,7 @@ export class LlEmitter {
|
|
|
3537
3811
|
case "url":
|
|
3538
3812
|
case "searchParams":
|
|
3539
3813
|
case "stats":
|
|
3814
|
+
case "bigintStats":
|
|
3540
3815
|
case "fileHandle":
|
|
3541
3816
|
case "dir":
|
|
3542
3817
|
case "spawnRes":
|
|
@@ -3683,9 +3958,7 @@ export class LlEmitter {
|
|
|
3683
3958
|
const nullable = this.nullableUnions.get(unionId);
|
|
3684
3959
|
if (nullable) {
|
|
3685
3960
|
// The owned payload IS the nullable union's value.
|
|
3686
|
-
if (nullable
|
|
3687
|
-
? tag !== nullable.refTag
|
|
3688
|
-
: !nullable.arms.some((arm) => arm.tag === tag))
|
|
3961
|
+
if (!isPayloadTag(nullable, tag))
|
|
3689
3962
|
throw new InternalCompilerError(`llvm emitter bug: payload wrap into unit arm ${tag} of ${unionId}`);
|
|
3690
3963
|
return v.name;
|
|
3691
3964
|
}
|
|
@@ -3726,10 +3999,16 @@ export class LlEmitter {
|
|
|
3726
3999
|
* def's [name, message, %code, %cause] order matches the layout). */
|
|
3727
4000
|
classFieldPtr(objName, className, field, refs = "pointer") {
|
|
3728
4001
|
const meta = this.classMetaOf(className);
|
|
4002
|
+
// An inline array field's slot holds its element count: its reads and
|
|
4003
|
+
// writes go through backend/llvm/inline-arrays.ts.
|
|
4004
|
+
const tail = this.inlineTailOf(className);
|
|
4005
|
+
if (tail !== undefined && meta.def.fields[tail.field].name === field)
|
|
4006
|
+
throw new InternalCompilerError(`llvm emitter bug: field pointer to the inline array field ${className}.${field}`);
|
|
3729
4007
|
const { index, type, compressed } = classFieldIndex(meta, field, refs);
|
|
3730
4008
|
const p = this.B.tmp();
|
|
3731
4009
|
this.B.line(`${p} = getelementptr inbounds %${classStructSym(className)}, ptr ${objName}, i64 0, i32 ${index}`);
|
|
3732
4010
|
this.markFieldPointer(p, field);
|
|
4011
|
+
this.heapCensus?.countAccess((line) => this.B.line(line), className, field);
|
|
3733
4012
|
if (compressed)
|
|
3734
4013
|
this.compressedFieldPtrs.add(p);
|
|
3735
4014
|
return { ptr: p, type, inline: this.inlineUnions.classField(className, field), compressed };
|
|
@@ -3855,13 +4134,66 @@ export class LlEmitter {
|
|
|
3855
4134
|
}
|
|
3856
4135
|
/** The field-slot pointer of a record member (rc header at index 0).
|
|
3857
4136
|
* `inline`: the slot stores a scalar union's tag and bits. */
|
|
4137
|
+
/** The record layouts integer clones read in place: record pointers,
|
|
4138
|
+
* `R | null` unions of a record (NULL is `null`), and fields stored as a
|
|
4139
|
+
* double, an i8 boolean or such a pointer. Records that may be views
|
|
4140
|
+
* (record-views.ts) are not among them. */
|
|
4141
|
+
recordCloneReferences() {
|
|
4142
|
+
// A view's fields live in the record it views (recordViewFieldPtr), not
|
|
4143
|
+
// at its own shape's offsets.
|
|
4144
|
+
const plain = (shapeId) => this.recordsById.has(shapeId) && this.shapeHost.recordViews?.targets.has(shapeId) !== true;
|
|
4145
|
+
const nullable = (unionId) => {
|
|
4146
|
+
const single = this.nullableUnions.single(unionId);
|
|
4147
|
+
if (single === null || single.nullTag !== -1 || single.arm.kind !== "record")
|
|
4148
|
+
return null;
|
|
4149
|
+
if (!plain(single.arm.shapeId))
|
|
4150
|
+
return null;
|
|
4151
|
+
const unit = this.unionsById.get(unionId)?.arms[single.unitTag];
|
|
4152
|
+
return unit?.kind === "nullT" ? single : null;
|
|
4153
|
+
};
|
|
4154
|
+
const reference = (type) => type.kind === "record"
|
|
4155
|
+
? plain(type.shapeId)
|
|
4156
|
+
: type.kind === "union" && nullable(type.unionId) !== null;
|
|
4157
|
+
return {
|
|
4158
|
+
reference,
|
|
4159
|
+
arm: (unionId, tag) => {
|
|
4160
|
+
const single = nullable(unionId);
|
|
4161
|
+
if (single === null)
|
|
4162
|
+
return null;
|
|
4163
|
+
return tag === single.refTag ? "record" : tag === single.unitTag ? "null" : null;
|
|
4164
|
+
},
|
|
4165
|
+
field: (shapeId, field) => {
|
|
4166
|
+
const shape = this.recordsById.get(shapeId);
|
|
4167
|
+
const index = shape?.fields.findIndex((f) => f.name === field) ?? -1;
|
|
4168
|
+
if (shape === undefined || index < 0 || !plain(shapeId))
|
|
4169
|
+
return null;
|
|
4170
|
+
const type = shape.fields[index].type;
|
|
4171
|
+
if (this.inlineUnions.record(type))
|
|
4172
|
+
return null;
|
|
4173
|
+
if (type.kind !== "f64" && type.kind !== "bool" && !reference(type))
|
|
4174
|
+
return null;
|
|
4175
|
+
return {
|
|
4176
|
+
struct: mangleRecordStruct(shapeId),
|
|
4177
|
+
index: index + this.nullableUnions.fieldBase(shapeId),
|
|
4178
|
+
type,
|
|
4179
|
+
};
|
|
4180
|
+
},
|
|
4181
|
+
};
|
|
4182
|
+
}
|
|
3858
4183
|
recordFieldPtr(objName, shapeId, field) {
|
|
3859
4184
|
const shape = this.recordShape(shapeId);
|
|
3860
4185
|
const idx = shape.fields.findIndex((f) => f.name === field);
|
|
3861
4186
|
if (idx < 0)
|
|
3862
4187
|
throw new InternalCompilerError(`llvm emitter bug: unknown field ${field} on shape ${shapeId}`);
|
|
3863
|
-
const
|
|
3864
|
-
|
|
4188
|
+
const base = this.nullableUnions.fieldBase(shapeId);
|
|
4189
|
+
let p;
|
|
4190
|
+
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);
|
|
4192
|
+
}
|
|
4193
|
+
else {
|
|
4194
|
+
p = this.B.tmp();
|
|
4195
|
+
this.B.line(`${p} = getelementptr inbounds %${mangleRecordStruct(shapeId)}, ptr ${objName}, i64 0, i32 ${idx + base}`);
|
|
4196
|
+
}
|
|
3865
4197
|
const type = shape.fields[idx].type;
|
|
3866
4198
|
return { ptr: p, type, inline: this.inlineUnions.record(type) };
|
|
3867
4199
|
}
|
|
@@ -4334,7 +4666,7 @@ export class LlEmitter {
|
|
|
4334
4666
|
/** Awaits in the current body suspend its coroutine: every wasm32 async
|
|
4335
4667
|
* body, and native stackless async bodies (selectStacklessAsync). */
|
|
4336
4668
|
get coroAwait() {
|
|
4337
|
-
return this.wasi || this.currentCoro?.
|
|
4669
|
+
return this.wasi || this.currentCoro?.awaits === true;
|
|
4338
4670
|
}
|
|
4339
4671
|
/** Suspends the current coroutine body at an await of `promise` (null: a
|
|
4340
4672
|
* single microtask hop, as for a non-promise operand). A native body
|
|
@@ -4370,7 +4702,7 @@ export class LlEmitter {
|
|
|
4370
4702
|
* coroutine has already suspended until the promise settled, so its
|
|
4371
4703
|
* extraction takes no further turn. */
|
|
4372
4704
|
awaitResultFn(kind) {
|
|
4373
|
-
return !this.wasi && this.currentCoro?.
|
|
4705
|
+
return !this.wasi && this.currentCoro?.awaits === true
|
|
4374
4706
|
? `scr_coro_await_${kind}`
|
|
4375
4707
|
: `scr_await_${kind}`;
|
|
4376
4708
|
}
|
|
@@ -4468,6 +4800,7 @@ export class LlEmitter {
|
|
|
4468
4800
|
flags: {
|
|
4469
4801
|
usesCoroutines: this.usesCoroutines,
|
|
4470
4802
|
usesTimers: this.usesTimers,
|
|
4803
|
+
usesPromises: this.usesPromises,
|
|
4471
4804
|
usesGenSlots: this.usesGenSlots,
|
|
4472
4805
|
needsUnionNone: this.needsUnionNone,
|
|
4473
4806
|
needsNullableAbsent: this.needsNullableAbsent,
|
|
@@ -4504,6 +4837,7 @@ export class LlEmitter {
|
|
|
4504
4837
|
const flags = chunk.flags;
|
|
4505
4838
|
this.usesCoroutines ||= flags.usesCoroutines;
|
|
4506
4839
|
this.usesTimers ||= flags.usesTimers;
|
|
4840
|
+
this.usesPromises ||= flags.usesPromises;
|
|
4507
4841
|
this.usesGenSlots ||= flags.usesGenSlots;
|
|
4508
4842
|
this.needsUnionNone ||= flags.needsUnionNone;
|
|
4509
4843
|
this.needsNullableAbsent ||= flags.needsNullableAbsent;
|
|
@@ -4601,8 +4935,16 @@ export class LlEmitter {
|
|
|
4601
4935
|
case "retainWrapper":
|
|
4602
4936
|
addEntry(this.nullableUnions.retainWrappers, key, value);
|
|
4603
4937
|
return;
|
|
4604
|
-
case "unit":
|
|
4605
|
-
|
|
4938
|
+
case "unit": {
|
|
4939
|
+
let own = this.unitInstances.get(key);
|
|
4940
|
+
if (own === undefined) {
|
|
4941
|
+
own = this.contentSymbol("sc_unit_", key);
|
|
4942
|
+
this.unitInstances.set(key, own);
|
|
4943
|
+
}
|
|
4944
|
+
if (own !== value)
|
|
4945
|
+
names.set(value, own);
|
|
4946
|
+
return;
|
|
4947
|
+
}
|
|
4606
4948
|
case "absent":
|
|
4607
4949
|
return addNumbered(this.absentInstances, key, value, "sc_absent_", names);
|
|
4608
4950
|
case "retype":
|
|
@@ -4610,7 +4952,9 @@ export class LlEmitter {
|
|
|
4610
4952
|
case "slots":
|
|
4611
4953
|
return addNumbered(this.threadSlotsBlocks, key, value, "@sc_slots_", names);
|
|
4612
4954
|
case "regex":
|
|
4613
|
-
return
|
|
4955
|
+
return this.addContentEntry(this.regexInstances, key, value, "sc_re_", names);
|
|
4956
|
+
case "regexReplacer":
|
|
4957
|
+
return this.addContentEntry(this.regexReplacers, key, value, "sc_rr_", names);
|
|
4614
4958
|
case "templateStrings":
|
|
4615
4959
|
return addNumberedSymbol(this.templateStringsInstances, key, value, "sc_tsa_", names);
|
|
4616
4960
|
case "tag": {
|
|
@@ -4807,7 +5151,8 @@ export class LlEmitter {
|
|
|
4807
5151
|
B.line(`${exception} = landingpad { ptr, i32 } cleanup`);
|
|
4808
5152
|
for (const index of borrowed)
|
|
4809
5153
|
this.releaseFrame(`%p${index}`, fn.params[index].type);
|
|
4810
|
-
|
|
5154
|
+
this.declare(UNWIND_RESUME_DECLARATION);
|
|
5155
|
+
B.resumeUnwind(exception);
|
|
4811
5156
|
B.startBlock(ok);
|
|
4812
5157
|
}
|
|
4813
5158
|
else
|
|
@@ -4865,7 +5210,8 @@ export class LlEmitter {
|
|
|
4865
5210
|
const rw = this.referenceWrites;
|
|
4866
5211
|
if (rw === null)
|
|
4867
5212
|
return false;
|
|
4868
|
-
|
|
5213
|
+
// A checked extraction reads nothing besides the union it narrows.
|
|
5214
|
+
const keys = rw.readKeys(e, (call) => borrowsCheckedNarrow(this, call) ? [] : this.borrowedReturnKeys(call.callee));
|
|
4869
5215
|
return keys !== null && !rw.conflicts(keys, writes);
|
|
4870
5216
|
}
|
|
4871
5217
|
/** A stable binding initialized by a projection can borrow it when the
|
|
@@ -5131,7 +5477,25 @@ export class LlEmitter {
|
|
|
5131
5477
|
}
|
|
5132
5478
|
case "fieldGet":
|
|
5133
5479
|
case "recordGet":
|
|
5480
|
+
case "recordKeyGet":
|
|
5134
5481
|
return this.borrowsWithoutOwning(e) && this.unownedWalk(e.obj);
|
|
5482
|
+
// `r[k] ?? inherited(r, k)` whose default is immortal.
|
|
5483
|
+
case "nullish": {
|
|
5484
|
+
const read = borrowedRecordKeyGetOr(this, e);
|
|
5485
|
+
return read !== null && immortalDefault(this, e.right) && this.unownedWalk(read);
|
|
5486
|
+
}
|
|
5487
|
+
case "mapIntrinsic": {
|
|
5488
|
+
// A Map binding's own pointer (maps are not plainReference types).
|
|
5489
|
+
if (!this.borrowsWithoutOwning(e) || e.receiver.kind !== "varRef")
|
|
5490
|
+
return false;
|
|
5491
|
+
const binding = this.binding(e.receiver.localId);
|
|
5492
|
+
return (binding.kind === "global" ||
|
|
5493
|
+
(binding.kind === "local" &&
|
|
5494
|
+
binding.local !== undefined &&
|
|
5495
|
+
!binding.local.boxed &&
|
|
5496
|
+
!binding.local.tdz &&
|
|
5497
|
+
!this.localUnionStorage.has(e.receiver.localId)));
|
|
5498
|
+
}
|
|
5135
5499
|
case "unionNarrow":
|
|
5136
5500
|
case "downcast":
|
|
5137
5501
|
case "upcast":
|
|
@@ -5275,8 +5639,11 @@ export class LlEmitter {
|
|
|
5275
5639
|
const previous = this.B.debugLocation;
|
|
5276
5640
|
this.B.debugLocation = this.debug?.location(s.loc, this.debugScope) ?? null;
|
|
5277
5641
|
const loop = s.kind === "while" || s.kind === "doWhile" || s.kind === "for" || s.kind === "forOf";
|
|
5278
|
-
|
|
5642
|
+
const builder = this.B;
|
|
5643
|
+
if (loop) {
|
|
5279
5644
|
this.loopDepth++;
|
|
5645
|
+
builder.loopDepth++;
|
|
5646
|
+
}
|
|
5280
5647
|
// An int32 kind loop's fast-copy write leaves for its resume point.
|
|
5281
5648
|
const kindResume = this.int32KindResume;
|
|
5282
5649
|
this.int32KindResume = this.int32Kinds?.resume.get(s) ?? null;
|
|
@@ -5286,8 +5653,10 @@ export class LlEmitter {
|
|
|
5286
5653
|
finally {
|
|
5287
5654
|
this.B.debugLocation = previous;
|
|
5288
5655
|
this.int32KindResume = kindResume;
|
|
5289
|
-
if (loop)
|
|
5656
|
+
if (loop) {
|
|
5290
5657
|
this.loopDepth--;
|
|
5658
|
+
builder.loopDepth--;
|
|
5659
|
+
}
|
|
5291
5660
|
}
|
|
5292
5661
|
}
|
|
5293
5662
|
emitStmtBody(s) {
|
|
@@ -5346,6 +5715,7 @@ export class LlEmitter {
|
|
|
5346
5715
|
type: local.type,
|
|
5347
5716
|
slot: true,
|
|
5348
5717
|
...(local.boxed ? { boxed: true } : {}),
|
|
5718
|
+
...(local.arena === true ? { arena: "drop" } : {}),
|
|
5349
5719
|
});
|
|
5350
5720
|
}
|
|
5351
5721
|
return result;
|
|
@@ -5728,6 +6098,12 @@ export class LlEmitter {
|
|
|
5728
6098
|
throw new InternalCompilerError(`llvm emitter bug: unknown intrinsic ${e.name}`);
|
|
5729
6099
|
}
|
|
5730
6100
|
}
|
|
6101
|
+
/** Arrays of this element type can hold SCR_ARR_FOREIGN elements. */
|
|
6102
|
+
mayHoldForeign(elem) {
|
|
6103
|
+
if (this.foreignElementKeys.size === 0)
|
|
6104
|
+
return false;
|
|
6105
|
+
return this.foreignElementKeys.has("*") || this.foreignElementKeys.has(typeKey(elem));
|
|
6106
|
+
}
|
|
5731
6107
|
/** Lifetime regions in modules with lifetimeRegions (llvm/regions.ts).
|
|
5732
6108
|
* Created with the class graph; null elsewhere. */
|
|
5733
6109
|
regions = null;
|
|
@@ -5793,11 +6169,26 @@ export class LlEmitter {
|
|
|
5793
6169
|
const nullable = this.nullableUnions.of(t);
|
|
5794
6170
|
return nullable?.repr === "single" ? nullable.arm : null;
|
|
5795
6171
|
},
|
|
5796
|
-
|
|
6172
|
+
pointerTagFn: (t) => {
|
|
6173
|
+
const nullable = this.nullableUnions.of(t);
|
|
6174
|
+
return nullable === null || nullable.repr === "single" ? null : pointerTagFn(nullable);
|
|
6175
|
+
},
|
|
5797
6176
|
fieldBase: (shapeId) => this.nullableUnions.fieldBase(shapeId),
|
|
5798
6177
|
classInfo: (className) => {
|
|
5799
6178
|
const meta = this.classMetaOf(className);
|
|
6179
|
+
const tail = this.inlineTailOf(className);
|
|
6180
|
+
const tailField = tail === undefined ? undefined : meta.def.fields[tail.field];
|
|
5800
6181
|
return {
|
|
6182
|
+
...(tail !== undefined && tailField !== undefined
|
|
6183
|
+
? {
|
|
6184
|
+
tail: {
|
|
6185
|
+
name: tailField.name,
|
|
6186
|
+
countIndex: meta.compactSlots[tail.field],
|
|
6187
|
+
offset: tail.tailOffset,
|
|
6188
|
+
elem: { kind: "object", className: tail.elemClass },
|
|
6189
|
+
},
|
|
6190
|
+
}
|
|
6191
|
+
: {}),
|
|
5801
6192
|
def: meta.def,
|
|
5802
6193
|
hierarchy: meta.hierarchy,
|
|
5803
6194
|
pre: meta.pre,
|
|
@@ -5805,8 +6196,9 @@ export class LlEmitter {
|
|
|
5805
6196
|
runtimeRooted: meta.root.def.runtime === true,
|
|
5806
6197
|
idInRc: meta.idInRc,
|
|
5807
6198
|
compact: meta.compact,
|
|
5808
|
-
// Inline scalar-union fields are plain bits: nothing to push.
|
|
5809
|
-
fields
|
|
6199
|
+
// Inline scalar-union fields are plain bits: nothing to push. An
|
|
6200
|
+
// inline array field's elements follow the fixed fields (`tail`).
|
|
6201
|
+
fields: meta.def.fields.flatMap((f, i) => this.inlineUnions.classField(className, f.name) || tail?.field === i
|
|
5810
6202
|
? []
|
|
5811
6203
|
: [
|
|
5812
6204
|
{
|
|
@@ -5990,6 +6382,12 @@ export class LlEmitter {
|
|
|
5990
6382
|
emitReadReceiver(e) {
|
|
5991
6383
|
return emitReadReceiver(this, e);
|
|
5992
6384
|
}
|
|
6385
|
+
/** The inline array field of `className`'s instances, where they keep it
|
|
6386
|
+
* inline (LlClassMeta.inlineTail; classes.ts gives their `new` the count). */
|
|
6387
|
+
inlineTailOf(className) {
|
|
6388
|
+
const meta = this.classMeta.get(className);
|
|
6389
|
+
return meta !== undefined && meta.compact && this.compactRegion ? meta.inlineTail : undefined;
|
|
6390
|
+
}
|
|
5993
6391
|
/** The frame slot a reassigned stack-object local keeps for its value. */
|
|
5994
6392
|
stackObjectSlot(localId, type) {
|
|
5995
6393
|
let slot = this.stackObjectSlots.get(localId);
|
|
@@ -6157,6 +6555,14 @@ export class LlEmitter {
|
|
|
6157
6555
|
canBorrowReceiver(e) {
|
|
6158
6556
|
return canBorrowReceiver(this, e);
|
|
6159
6557
|
}
|
|
6558
|
+
/** A read of an inline array field (ir/inline-arrays.ts). It makes a view
|
|
6559
|
+
* of the elements that the read owns: no field holds an array that could
|
|
6560
|
+
* keep a borrowed copy alive. Known before the class layouts are, from
|
|
6561
|
+
* the module's plan; layouts that keep the field an ordinary array only
|
|
6562
|
+
* lose the borrow. */
|
|
6563
|
+
inlineArrayRead(e) {
|
|
6564
|
+
return e.kind === "fieldGet" && this.inlineArrays.classes.get(e.className)?.field === e.field;
|
|
6565
|
+
}
|
|
6160
6566
|
/** A reference held as one plain pointer that emitReadReceiver can read
|
|
6161
6567
|
* without owning: class instances, records, arrays, strings, typed arrays
|
|
6162
6568
|
* and nullable-pointer unions. Tagged union boxes, closures and dynamic
|
|
@@ -6191,9 +6597,16 @@ export class LlEmitter {
|
|
|
6191
6597
|
return false;
|
|
6192
6598
|
switch (e.kind) {
|
|
6193
6599
|
case "fieldGet":
|
|
6194
|
-
return this.nullableFieldGet(e) === null;
|
|
6600
|
+
return this.nullableFieldGet(e) === null && !this.inlineArrayRead(e);
|
|
6195
6601
|
case "recordGet":
|
|
6196
6602
|
return true;
|
|
6603
|
+
// A keyed read whose hits are all the result's own pointer.
|
|
6604
|
+
case "recordKeyGet":
|
|
6605
|
+
return pointerRecordKeyGet(this, e);
|
|
6606
|
+
case "mapIntrinsic":
|
|
6607
|
+
return pointerMapGet(this, e);
|
|
6608
|
+
case "nullish":
|
|
6609
|
+
return borrowedRecordKeyGetOr(this, e) !== null;
|
|
6197
6610
|
// emitReadReceiver lends a required element of a borrowed array when
|
|
6198
6611
|
// computing the index removes no edge.
|
|
6199
6612
|
case "arrayGet":
|
|
@@ -6231,10 +6644,7 @@ export class LlEmitter {
|
|
|
6231
6644
|
return null;
|
|
6232
6645
|
if (isUnitType(e.value.type))
|
|
6233
6646
|
return e.value.kind === "unitLit" ? "unit" : null;
|
|
6234
|
-
|
|
6235
|
-
? e.tag === nullable.refTag
|
|
6236
|
-
: nullable.arms.some((arm) => arm.tag === e.tag);
|
|
6237
|
-
return refArm && isRefCounted(e.value.type) ? "ref" : null;
|
|
6647
|
+
return isPayloadTag(nullable, e.tag) && isRefCounted(e.value.type) ? "ref" : null;
|
|
6238
6648
|
}
|
|
6239
6649
|
materializeSplitLocal(localId) {
|
|
6240
6650
|
const span = this.splitSpans.get(localId);
|
|
@@ -6242,8 +6652,193 @@ export class LlEmitter {
|
|
|
6242
6652
|
materializeSplitPiece(this, localId, span);
|
|
6243
6653
|
}
|
|
6244
6654
|
emitExpr(e) {
|
|
6655
|
+
return this.arenas === null ? emitExpr(this, e) : this.emitArenaExpr(e, this.arenas);
|
|
6656
|
+
}
|
|
6657
|
+
/** emitExpr when group arenas are planned. Kept out of emitExpr, whose
|
|
6658
|
+
* frame each level of a nested expression holds while it is emitted. */
|
|
6659
|
+
emitArenaExpr(e, arenas) {
|
|
6660
|
+
if (arenas.groups.calls.has(e)) {
|
|
6661
|
+
// A call region: everything the call allocates dies when it returns.
|
|
6662
|
+
// The statement drops the arena after its temps, which an
|
|
6663
|
+
// arena-aware caller can have allocated in it while evaluating the
|
|
6664
|
+
// arguments; any other caller drops it as soon as the call returns.
|
|
6665
|
+
const slot = this.arenaSlot(e);
|
|
6666
|
+
this.statementFrame().push({ name: slot, type: e.type, slot: true, arena: "drop" });
|
|
6667
|
+
this.B.line(`call ptr @scr_arena_open(ptr ${slot}, i32 ${this.arenaClosed(e)})`);
|
|
6668
|
+
const value = emitExpr(this, e);
|
|
6669
|
+
if (!arenaAware(arenas, this.fnByName.get(this.currentFunctionName)))
|
|
6670
|
+
this.B.line(`call void @scr_arena_drop(ptr ${slot})`);
|
|
6671
|
+
return value;
|
|
6672
|
+
}
|
|
6673
|
+
if (arenas.sites.heapCalls.has(e) && this.arenaSite(null)) {
|
|
6674
|
+
// A call whose value the group does not keep: everything it allocates
|
|
6675
|
+
// takes the heap.
|
|
6676
|
+
const saved = this.suspendArena();
|
|
6677
|
+
const value = emitExpr(this, e);
|
|
6678
|
+
this.resumeArena(saved);
|
|
6679
|
+
return value;
|
|
6680
|
+
}
|
|
6681
|
+
if (this.opensArena(e)) {
|
|
6682
|
+
// A root: its group lives until the scope holding its value exits
|
|
6683
|
+
// (the statement frame for a value used in place).
|
|
6684
|
+
const slot = this.arenaSlot(e);
|
|
6685
|
+
const local = arenas.groups.drops.get(e) ?? null;
|
|
6686
|
+
this.statementFrame().push({
|
|
6687
|
+
name: slot,
|
|
6688
|
+
type: e.type,
|
|
6689
|
+
slot: true,
|
|
6690
|
+
arena: local === null ? "drop" : "close",
|
|
6691
|
+
});
|
|
6692
|
+
const arena = this.B.tmp();
|
|
6693
|
+
this.B.line(`${arena} = call ptr @scr_arena_open(ptr ${slot}, i32 ${this.arenaClosed(e)})`);
|
|
6694
|
+
const value = emitExpr(this, e);
|
|
6695
|
+
this.B.line(`call void @scr_arena_close(ptr ${arena})`);
|
|
6696
|
+
return value;
|
|
6697
|
+
}
|
|
6245
6698
|
return emitExpr(this, e);
|
|
6246
6699
|
}
|
|
6700
|
+
/** Group arenas (arenas.ts): the plan, the list slot of each root and
|
|
6701
|
+
* call region, and which locals' scopes drop which roots' arenas. */
|
|
6702
|
+
arenas = null;
|
|
6703
|
+
arenaSlots = new Map();
|
|
6704
|
+
/** The frames emitStmtBody opens for whole statements (arenas only). */
|
|
6705
|
+
statementFrames = new Set();
|
|
6706
|
+
/** The frame of the statement being emitted: a nested frame (call
|
|
6707
|
+
* arguments, branches) ends before the values built in it do. */
|
|
6708
|
+
statementFrame() {
|
|
6709
|
+
for (let i = this.frames.length - 1; i >= 0; i--)
|
|
6710
|
+
if (this.statementFrames.has(this.frames[i]))
|
|
6711
|
+
return this.frames[i];
|
|
6712
|
+
return this.currentFrame();
|
|
6713
|
+
}
|
|
6714
|
+
/** The arena list slot of root or call region `e`: allocated, cleared and
|
|
6715
|
+
* (for a root dropped with a local) owned by that local's scope when the
|
|
6716
|
+
* function starts or the local is declared. */
|
|
6717
|
+
arenaSlot(e) {
|
|
6718
|
+
let slot = this.arenaSlots.get(e);
|
|
6719
|
+
if (slot === undefined) {
|
|
6720
|
+
slot = this.B.tmp();
|
|
6721
|
+
this.B.entryAllocas.push(`${slot} = alloca ptr`, `store ptr null, ptr ${slot}`);
|
|
6722
|
+
this.arenaSlots.set(e, slot);
|
|
6723
|
+
this.declare(`declare ptr @scr_arena_open(ptr, i32)`);
|
|
6724
|
+
this.declare(`declare void @scr_arena_close(ptr)`);
|
|
6725
|
+
this.declare(`declare void @scr_arena_drop(ptr)`);
|
|
6726
|
+
}
|
|
6727
|
+
return slot;
|
|
6728
|
+
}
|
|
6729
|
+
/** Whether emitExpr opens an arena for `e`: a root call or `new` of a
|
|
6730
|
+
* counted value. */
|
|
6731
|
+
opensArena(e) {
|
|
6732
|
+
return (this.arenas !== null &&
|
|
6733
|
+
this.arenas.groups.roots.has(e) &&
|
|
6734
|
+
(e.kind === "call" || e.kind === "new") &&
|
|
6735
|
+
isRefCounted(e.type));
|
|
6736
|
+
}
|
|
6737
|
+
/** 1 when the group of root or call region `e` is closed: its objects
|
|
6738
|
+
* hold only each other and immortal values. */
|
|
6739
|
+
arenaClosed(e) {
|
|
6740
|
+
return this.arenas?.groups.closed.has(e) === true ? 1 : 0;
|
|
6741
|
+
}
|
|
6742
|
+
/** Registers on the innermost scope the arena lists of the roots whose
|
|
6743
|
+
* arenas `localId`'s scope drops. */
|
|
6744
|
+
ownArenasOf(localId) {
|
|
6745
|
+
const roots = this.arenaDropsByLocal.get(localId);
|
|
6746
|
+
if (roots === undefined)
|
|
6747
|
+
return;
|
|
6748
|
+
const scope = this.scopes[this.scopes.length - 1];
|
|
6749
|
+
for (const { root, type } of roots)
|
|
6750
|
+
scope.push({ slot: this.arenaSlot(root), type, arena: true });
|
|
6751
|
+
}
|
|
6752
|
+
/** The roots of the function being emitted, by the local that drops
|
|
6753
|
+
* them; set when a function's emission starts. */
|
|
6754
|
+
arenaDropsByLocal = new Map();
|
|
6755
|
+
/** Starts a function's arena bookkeeping: its roots by dropping local,
|
|
6756
|
+
* with the lists of locals the body never declares (parameters, loop
|
|
6757
|
+
* and catch bindings) owned by the function's own scope. */
|
|
6758
|
+
beginArenaFunction(fn) {
|
|
6759
|
+
this.arenaSlots.clear();
|
|
6760
|
+
this.statementFrames.clear();
|
|
6761
|
+
this.arenaDropsByLocal = new Map();
|
|
6762
|
+
const arenas = this.arenas;
|
|
6763
|
+
if (arenas === null)
|
|
6764
|
+
return;
|
|
6765
|
+
const declared = new Set();
|
|
6766
|
+
const visit = (node) => {
|
|
6767
|
+
if (node.kind === "varDecl")
|
|
6768
|
+
declared.add(node.localId);
|
|
6769
|
+
if (this.opensArena(node)) {
|
|
6770
|
+
const local = arenas.groups.drops.get(node);
|
|
6771
|
+
if (local !== undefined && local !== null) {
|
|
6772
|
+
const list = this.arenaDropsByLocal.get(local) ?? [];
|
|
6773
|
+
list.push({ root: node, type: node.type });
|
|
6774
|
+
this.arenaDropsByLocal.set(local, list);
|
|
6775
|
+
}
|
|
6776
|
+
}
|
|
6777
|
+
const kids = [];
|
|
6778
|
+
children(node, kids);
|
|
6779
|
+
for (const kid of kids)
|
|
6780
|
+
visit(kid);
|
|
6781
|
+
};
|
|
6782
|
+
for (const s of fn.body)
|
|
6783
|
+
visit(s);
|
|
6784
|
+
for (const local of [...this.arenaDropsByLocal.keys()])
|
|
6785
|
+
if (!declared.has(local))
|
|
6786
|
+
this.ownArenasOf(local);
|
|
6787
|
+
}
|
|
6788
|
+
/** Whether allocation site `e` (null: any) in the function being
|
|
6789
|
+
* emitted takes the open arena: the function is arena-aware and the group
|
|
6790
|
+
* keeps the site's value (region-sites.ts). */
|
|
6791
|
+
arenaSite(e) {
|
|
6792
|
+
const arenas = this.arenas;
|
|
6793
|
+
if (!arenaAware(arenas, this.fnByName.get(this.currentFunctionName)))
|
|
6794
|
+
return false;
|
|
6795
|
+
return e === null || arenas.sites.arenaSites.has(e);
|
|
6796
|
+
}
|
|
6797
|
+
/** Stops any arena being the allocation target; returns what restores it. */
|
|
6798
|
+
suspendArena() {
|
|
6799
|
+
const saved = this.B.tmp();
|
|
6800
|
+
const cur = this.B.tmp();
|
|
6801
|
+
const lines = arenaCurrentAddress(this.shapeHost, cur);
|
|
6802
|
+
if (lines === null) {
|
|
6803
|
+
this.declare(`declare ptr @scr_arena_suspend()`);
|
|
6804
|
+
this.B.line(`${saved} = call ptr @scr_arena_suspend()`);
|
|
6805
|
+
}
|
|
6806
|
+
else {
|
|
6807
|
+
for (const line of lines)
|
|
6808
|
+
this.B.line(line);
|
|
6809
|
+
this.B.line(`${saved} = load ptr, ptr ${cur}`);
|
|
6810
|
+
this.B.line(`store ptr null, ptr ${cur}`);
|
|
6811
|
+
}
|
|
6812
|
+
return saved;
|
|
6813
|
+
}
|
|
6814
|
+
/** Makes the arena suspendArena stopped (`saved`) the target again. */
|
|
6815
|
+
resumeArena(saved) {
|
|
6816
|
+
const cur = this.B.tmp();
|
|
6817
|
+
const lines = arenaCurrentAddress(this.shapeHost, cur);
|
|
6818
|
+
if (lines === null) {
|
|
6819
|
+
this.declare(`declare void @scr_arena_resume(ptr)`);
|
|
6820
|
+
this.B.line(`call void @scr_arena_resume(ptr ${saved})`);
|
|
6821
|
+
}
|
|
6822
|
+
else {
|
|
6823
|
+
for (const line of lines)
|
|
6824
|
+
this.B.line(line);
|
|
6825
|
+
this.B.line(`store ptr ${saved}, ptr ${cur}`);
|
|
6826
|
+
}
|
|
6827
|
+
}
|
|
6828
|
+
/** The arena-aware constructor of `newSym` for an allocation of a
|
|
6829
|
+
* record shape or class in the function being emitted, or `newSym`. */
|
|
6830
|
+
allocSym(newSym, e) {
|
|
6831
|
+
const arenas = this.arenas;
|
|
6832
|
+
if (arenas === null)
|
|
6833
|
+
return newSym;
|
|
6834
|
+
const planned = e.type.kind === "record"
|
|
6835
|
+
? arenas.shapes.has(e.type.shapeId)
|
|
6836
|
+
: e.kind === "new" && arenas.classes.has(e.className);
|
|
6837
|
+
if (!planned)
|
|
6838
|
+
return newSym;
|
|
6839
|
+
const aware = this.arenaSite(e) || arenas.groups.roots.has(e);
|
|
6840
|
+
return aware ? arenaNewSym(newSym) : newSym;
|
|
6841
|
+
}
|
|
6247
6842
|
/** The helper classification of this module's inline-cache sites. */
|
|
6248
6843
|
get jsIcSites() {
|
|
6249
6844
|
return (this.jsIcSitesMemo ??= new JsIcSites(this.mod));
|
|
@@ -6308,8 +6903,17 @@ export class LlEmitter {
|
|
|
6308
6903
|
wrapEmitterListener(target, adapterFn) {
|
|
6309
6904
|
return wrapEmitterListener(this, target, adapterFn);
|
|
6310
6905
|
}
|
|
6311
|
-
|
|
6312
|
-
|
|
6906
|
+
/** ScrClosure.function_kind for a closure over `fn`: its generator,
|
|
6907
|
+
* async and own prototype bits, and RECEIVER_FREE when its body never
|
|
6908
|
+
* observes the ambient receiver, so indirect callers skip the bracket. */
|
|
6909
|
+
closureFunctionKind(fn) {
|
|
6910
|
+
return ((fn.generator ? CLOSURE_KIND.GENERATOR : 0) +
|
|
6911
|
+
(fn.async ? CLOSURE_KIND.ASYNC : 0) +
|
|
6912
|
+
(fn.ownsPrototype ? CLOSURE_KIND.OWN_PROTOTYPE : 0) +
|
|
6913
|
+
(this.receiverReaders.ignores(fn) ? CLOSURE_KIND.RECEIVER_FREE : 0));
|
|
6914
|
+
}
|
|
6915
|
+
unwrapNullableClosure(u, unionId, funcTag) {
|
|
6916
|
+
return unwrapNullableClosure(this, u, unionId, funcTag);
|
|
6313
6917
|
}
|
|
6314
6918
|
closeBindThunkFor(cbUnion, retServer) {
|
|
6315
6919
|
return closeBindThunkFor(this, cbUnion, retServer);
|
|
@@ -6441,6 +7045,15 @@ export class LlEmitter {
|
|
|
6441
7045
|
return;
|
|
6442
7046
|
const integer = this.emitToUint32(value.name, expr, value.uint32);
|
|
6443
7047
|
this.B.line(`store i32 ${integer}, ptr ${slot}`);
|
|
7048
|
+
const orderedSlot = this.orderedViews.get(localId);
|
|
7049
|
+
if (orderedSlot === undefined)
|
|
7050
|
+
return;
|
|
7051
|
+
let ordered = value.ordered;
|
|
7052
|
+
if (ordered === undefined) {
|
|
7053
|
+
ordered = this.B.tmp();
|
|
7054
|
+
this.B.line(`${ordered} = fcmp ord double ${value.name}, 0.0`);
|
|
7055
|
+
}
|
|
7056
|
+
this.B.line(`store i1 ${ordered}, ptr ${orderedSlot}`);
|
|
6444
7057
|
}
|
|
6445
7058
|
emitBytesSet(elem, receiver, index, value, indexExpr, expr, inBounds = false, owned = false, scope = "") {
|
|
6446
7059
|
return emitBytesSet(this, elem, receiver, index, value, indexExpr, expr, inBounds, owned, scope);
|