@scriptc/compiler 0.3.2 → 0.3.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/ambient/scriptc-node-fallback.d.ts +1202 -64
- package/dist/backend/cycle-analysis.js +6 -1
- package/dist/backend/cycle-analysis.js.map +1 -1
- package/dist/backend/cycle-mutability.d.ts +5 -0
- package/dist/backend/cycle-mutability.js +62 -3
- package/dist/backend/cycle-mutability.js.map +1 -1
- package/dist/backend/executable-features.js +1 -0
- package/dist/backend/executable-features.js.map +1 -1
- package/dist/backend/library-pack.js +1 -0
- package/dist/backend/library-pack.js.map +1 -1
- package/dist/backend/llvm/alloc.js +24 -10
- package/dist/backend/llvm/alloc.js.map +1 -1
- package/dist/backend/llvm/alloc.test.js +47 -1
- package/dist/backend/llvm/alloc.test.js.map +1 -1
- package/dist/backend/llvm/array-search.d.ts +8 -0
- package/dist/backend/llvm/array-search.js +52 -0
- package/dist/backend/llvm/array-search.js.map +1 -0
- package/dist/backend/llvm/array-search.test.d.ts +1 -0
- package/dist/backend/llvm/array-search.test.js +72 -0
- package/dist/backend/llvm/array-search.test.js.map +1 -0
- package/dist/backend/llvm/call-lifetimes.d.ts +12 -1
- package/dist/backend/llvm/call-lifetimes.js +41 -11
- package/dist/backend/llvm/call-lifetimes.js.map +1 -1
- package/dist/backend/llvm/call-lifetimes.test.js +85 -1
- package/dist/backend/llvm/call-lifetimes.test.js.map +1 -1
- package/dist/backend/llvm/classes.js +87 -36
- package/dist/backend/llvm/classes.js.map +1 -1
- package/dist/backend/llvm/common.d.ts +6 -1
- package/dist/backend/llvm/common.js +8 -1
- package/dist/backend/llvm/common.js.map +1 -1
- package/dist/backend/llvm/dense-array-access.d.ts +5 -0
- package/dist/backend/llvm/dense-array-access.js +3 -3
- package/dist/backend/llvm/dense-array-access.js.map +1 -1
- package/dist/backend/llvm/dyn.d.ts +44 -1
- package/dist/backend/llvm/dyn.js +251 -36
- package/dist/backend/llvm/dyn.js.map +1 -1
- package/dist/backend/llvm/emitter.d.ts +77 -14
- package/dist/backend/llvm/emitter.js +461 -108
- package/dist/backend/llvm/emitter.js.map +1 -1
- package/dist/backend/llvm/emitter.test.js +26 -3
- package/dist/backend/llvm/emitter.test.js.map +1 -1
- package/dist/backend/llvm/expr-async.js +52 -1
- package/dist/backend/llvm/expr-async.js.map +1 -1
- package/dist/backend/llvm/expr-bytes.d.ts +9 -0
- package/dist/backend/llvm/expr-bytes.js +169 -63
- package/dist/backend/llvm/expr-bytes.js.map +1 -1
- package/dist/backend/llvm/expr-callbacks.js +16 -2
- package/dist/backend/llvm/expr-callbacks.js.map +1 -1
- package/dist/backend/llvm/expr-calls.d.ts +3 -1
- package/dist/backend/llvm/expr-calls.js +57 -2
- package/dist/backend/llvm/expr-calls.js.map +1 -1
- package/dist/backend/llvm/expr-containers.js +57 -19
- package/dist/backend/llvm/expr-containers.js.map +1 -1
- package/dist/backend/llvm/expr-dynamic.js +19 -8
- package/dist/backend/llvm/expr-dynamic.js.map +1 -1
- package/dist/backend/llvm/expr-primitives.js +28 -30
- package/dist/backend/llvm/expr-primitives.js.map +1 -1
- package/dist/backend/llvm/expr-records.js +8 -4
- package/dist/backend/llvm/expr-records.js.map +1 -1
- package/dist/backend/llvm/expr-stream-bridges.js +35 -32
- package/dist/backend/llvm/expr-stream-bridges.js.map +1 -1
- package/dist/backend/llvm/expr-stream-callbacks.d.ts +13 -2
- package/dist/backend/llvm/expr-stream-callbacks.js +80 -5
- package/dist/backend/llvm/expr-stream-callbacks.js.map +1 -1
- package/dist/backend/llvm/inline-unions.d.ts +48 -0
- package/dist/backend/llvm/inline-unions.js +134 -0
- package/dist/backend/llvm/inline-unions.js.map +1 -0
- package/dist/backend/llvm/inline-unions.test.d.ts +1 -0
- package/dist/backend/llvm/inline-unions.test.js +124 -0
- package/dist/backend/llvm/inline-unions.test.js.map +1 -0
- package/dist/backend/llvm/integer-remainder.d.ts +28 -5
- package/dist/backend/llvm/integer-remainder.js +80 -9
- package/dist/backend/llvm/integer-remainder.js.map +1 -1
- package/dist/backend/llvm/intern-tables.test.d.ts +1 -0
- package/dist/backend/llvm/intern-tables.test.js +77 -0
- package/dist/backend/llvm/intern-tables.test.js.map +1 -0
- package/dist/backend/llvm/lib-datagram.js +10 -0
- package/dist/backend/llvm/lib-datagram.js.map +1 -1
- package/dist/backend/llvm/lib-dispatch.js +255 -29
- package/dist/backend/llvm/lib-dispatch.js.map +1 -1
- package/dist/backend/llvm/lib-filesystem.js +176 -7
- package/dist/backend/llvm/lib-filesystem.js.map +1 -1
- package/dist/backend/llvm/lib-network.js +25 -6
- package/dist/backend/llvm/lib-network.js.map +1 -1
- package/dist/backend/llvm/lib-process.js +2 -2
- package/dist/backend/llvm/lib-process.js.map +1 -1
- package/dist/backend/llvm/lib-shared.d.ts +5 -0
- package/dist/backend/llvm/lib-shared.js +212 -1
- package/dist/backend/llvm/lib-shared.js.map +1 -1
- package/dist/backend/llvm/lib-stream.js +184 -0
- package/dist/backend/llvm/lib-stream.js.map +1 -1
- package/dist/backend/llvm/lib-test.js +9 -0
- package/dist/backend/llvm/lib-test.js.map +1 -1
- package/dist/backend/llvm/local-array-reads.js +7 -3
- package/dist/backend/llvm/local-array-reads.js.map +1 -1
- package/dist/backend/llvm/local-array-reads.test.js +6 -3
- package/dist/backend/llvm/local-array-reads.test.js.map +1 -1
- package/dist/backend/llvm/local-union-storage.d.ts +2 -0
- package/dist/backend/llvm/local-union-storage.js +5 -0
- package/dist/backend/llvm/local-union-storage.js.map +1 -1
- package/dist/backend/llvm/local-union-storage.test.js +1 -0
- package/dist/backend/llvm/local-union-storage.test.js.map +1 -1
- package/dist/backend/llvm/loop-array-borrows.d.ts +8 -2
- package/dist/backend/llvm/loop-array-borrows.js +93 -13
- package/dist/backend/llvm/loop-array-borrows.js.map +1 -1
- package/dist/backend/llvm/map-number-lookup.d.ts +24 -0
- package/dist/backend/llvm/map-number-lookup.js +88 -0
- package/dist/backend/llvm/map-number-lookup.js.map +1 -1
- package/dist/backend/llvm/map-number-lookup.test.d.ts +1 -0
- package/dist/backend/llvm/map-number-lookup.test.js +158 -0
- package/dist/backend/llvm/map-number-lookup.test.js.map +1 -0
- package/dist/backend/llvm/map-read-lifetimes.d.ts +9 -0
- package/dist/backend/llvm/map-read-lifetimes.js +90 -1
- package/dist/backend/llvm/map-read-lifetimes.js.map +1 -1
- package/dist/backend/llvm/map-read-lifetimes.test.js +129 -1
- package/dist/backend/llvm/map-read-lifetimes.test.js.map +1 -1
- package/dist/backend/llvm/publish.d.ts +9 -0
- package/dist/backend/llvm/publish.js +25 -4
- package/dist/backend/llvm/publish.js.map +1 -1
- package/dist/backend/llvm/record-results.d.ts +8 -5
- package/dist/backend/llvm/record-results.js +20 -12
- package/dist/backend/llvm/record-results.js.map +1 -1
- package/dist/backend/llvm/reference-effects.js +13 -0
- package/dist/backend/llvm/reference-effects.js.map +1 -1
- package/dist/backend/llvm/reference-writes.js +19 -2
- package/dist/backend/llvm/reference-writes.js.map +1 -1
- package/dist/backend/llvm/regions.d.ts +5 -1
- package/dist/backend/llvm/regions.js +24 -10
- package/dist/backend/llvm/regions.js.map +1 -1
- package/dist/backend/llvm/serialized-ir-emission.test.js +2 -0
- package/dist/backend/llvm/serialized-ir-emission.test.js.map +1 -1
- package/dist/backend/llvm/shapes.d.ts +56 -10
- package/dist/backend/llvm/shapes.js +178 -39
- package/dist/backend/llvm/shapes.js.map +1 -1
- package/dist/backend/llvm/shapes.test.js +61 -3
- package/dist/backend/llvm/shapes.test.js.map +1 -1
- package/dist/backend/llvm/stack-objects.js +16 -4
- package/dist/backend/llvm/stack-objects.js.map +1 -1
- package/dist/backend/llvm/stack-objects.test.js +3 -0
- package/dist/backend/llvm/stack-objects.test.js.map +1 -1
- package/dist/backend/llvm/string-reads.js +2 -2
- package/dist/backend/llvm/string-reads.js.map +1 -1
- package/dist/backend/llvm/string-slices.js +2 -2
- package/dist/backend/llvm/string-slices.js.map +1 -1
- package/dist/backend/llvm/walkers.d.ts +11 -0
- package/dist/backend/llvm/walkers.js +106 -10
- package/dist/backend/llvm/walkers.js.map +1 -1
- package/dist/backend/may-throw.js +13 -4
- package/dist/backend/may-throw.js.map +1 -1
- package/dist/backend/native/contracts.d.ts +5 -2
- package/dist/backend/native/executable.js +27 -8
- package/dist/backend/native/executable.js.map +1 -1
- package/dist/backend/native/runtime-inputs.d.ts +1 -1
- package/dist/backend/native/runtime-inputs.js +2 -0
- package/dist/backend/native/runtime-inputs.js.map +1 -1
- package/dist/backend/native-codegen-core.d.ts +4 -4
- package/dist/backend/native-codegen-core.js +4 -6
- package/dist/backend/native-codegen-core.js.map +1 -1
- package/dist/backend/native-codegen.test.js +7 -8
- package/dist/backend/native-codegen.test.js.map +1 -1
- package/dist/backend/native-link-info-core.d.ts +3 -0
- package/dist/backend/native-link-info-core.js.map +1 -1
- package/dist/backend/native-toolchain.test.js +1 -1
- package/dist/backend/native-toolchain.test.js.map +1 -1
- package/dist/backend/publication.js +3 -1
- 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-targets.test.js +2 -1
- package/dist/backend/runtime-pack-targets.test.js.map +1 -1
- package/dist/backend/runtime-pack.test.js +2 -1
- package/dist/backend/runtime-pack.test.js.map +1 -1
- package/dist/backend/target-diagnostics.js +11 -1
- package/dist/backend/target-diagnostics.js.map +1 -1
- package/dist/backend/target-diagnostics.test.js +4 -1
- package/dist/backend/target-diagnostics.test.js.map +1 -1
- package/dist/backend/warm-cache.js +1 -0
- package/dist/backend/warm-cache.js.map +1 -1
- package/dist/compat/fetch-profile.js +4 -4
- package/dist/compat/fetch-profile.js.map +1 -1
- package/dist/contracts/check.js +2 -0
- package/dist/contracts/check.js.map +1 -1
- package/dist/coverage/report.js +1 -1
- package/dist/coverage/report.js.map +1 -1
- package/dist/diagnostics/diagnostic.d.ts +6 -5
- package/dist/diagnostics/diagnostic.js +7 -6
- package/dist/diagnostics/diagnostic.js.map +1 -1
- package/dist/executable/executable-cache.d.ts +1 -0
- package/dist/executable/executable-cache.js +1 -0
- package/dist/executable/executable-cache.js.map +1 -1
- package/dist/executable/executable-cache.test.js +1 -0
- package/dist/executable/executable-cache.test.js.map +1 -1
- package/dist/frontend/builtin-modules.d.ts +1 -1
- package/dist/frontend/builtin-modules.js +1 -0
- package/dist/frontend/builtin-modules.js.map +1 -1
- package/dist/frontend/comptime-node.js +2 -2
- package/dist/frontend/comptime-node.js.map +1 -1
- package/dist/frontend/experimental-import.d.ts +5 -1
- package/dist/frontend/experimental-import.js +28 -3
- package/dist/frontend/experimental-import.js.map +1 -1
- package/dist/frontend/lowering/assert-instances.d.ts +38 -0
- package/dist/frontend/lowering/assert-instances.js +269 -0
- package/dist/frontend/lowering/assert-instances.js.map +1 -0
- package/dist/frontend/lowering/binding-analysis.d.ts +1 -1
- package/dist/frontend/lowering/binding-analysis.js +1 -1
- package/dist/frontend/lowering/builtins/arguments.d.ts +4 -0
- package/dist/frontend/lowering/builtins/arguments.js +8 -4
- package/dist/frontend/lowering/builtins/arguments.js.map +1 -1
- package/dist/frontend/lowering/builtins/blob.d.ts +20 -0
- package/dist/frontend/lowering/builtins/blob.js +167 -0
- package/dist/frontend/lowering/builtins/blob.js.map +1 -0
- package/dist/frontend/lowering/builtins/child-process-async.d.ts +2 -2
- package/dist/frontend/lowering/builtins/child-process-async.js +2 -2
- package/dist/frontend/lowering/builtins/child-process-methods.js +1 -1
- package/dist/frontend/lowering/builtins/child-process-methods.js.map +1 -1
- package/dist/frontend/lowering/builtins/child-process-sync.js +1 -1
- package/dist/frontend/lowering/builtins/child-process-sync.js.map +1 -1
- package/dist/frontend/lowering/builtins/compression.d.ts +18 -0
- package/dist/frontend/lowering/builtins/compression.js +178 -4
- package/dist/frontend/lowering/builtins/compression.js.map +1 -1
- package/dist/frontend/lowering/builtins/constants.js +7 -2
- package/dist/frontend/lowering/builtins/constants.js.map +1 -1
- package/dist/frontend/lowering/builtins/crypto.d.ts +6 -0
- package/dist/frontend/lowering/builtins/crypto.js +526 -121
- package/dist/frontend/lowering/builtins/crypto.js.map +1 -1
- package/dist/frontend/lowering/builtins/errors.js +23 -0
- package/dist/frontend/lowering/builtins/errors.js.map +1 -1
- package/dist/frontend/lowering/builtins/filesystem-calls.d.ts +10 -0
- package/dist/frontend/lowering/builtins/filesystem-calls.js +89 -1
- package/dist/frontend/lowering/builtins/filesystem-calls.js.map +1 -1
- package/dist/frontend/lowering/builtins/filesystem.d.ts +16 -7
- package/dist/frontend/lowering/builtins/filesystem.js +97 -15
- package/dist/frontend/lowering/builtins/filesystem.js.map +1 -1
- package/dist/frontend/lowering/builtins/fs-glob.d.ts +23 -0
- package/dist/frontend/lowering/builtins/fs-glob.js +224 -0
- package/dist/frontend/lowering/builtins/fs-glob.js.map +1 -0
- package/dist/frontend/lowering/builtins/key-object.d.ts +13 -0
- package/dist/frontend/lowering/builtins/key-object.js +56 -0
- package/dist/frontend/lowering/builtins/key-object.js.map +1 -0
- package/dist/frontend/lowering/builtins/module-calls.js +44 -11
- package/dist/frontend/lowering/builtins/module-calls.js.map +1 -1
- package/dist/frontend/lowering/builtins/performance.d.ts +25 -3
- package/dist/frontend/lowering/builtins/performance.js +340 -5
- package/dist/frontend/lowering/builtins/performance.js.map +1 -1
- package/dist/frontend/lowering/builtins/process.d.ts +2 -2
- package/dist/frontend/lowering/builtins/process.js +107 -14
- package/dist/frontend/lowering/builtins/process.js.map +1 -1
- package/dist/frontend/lowering/builtins/properties.d.ts +0 -7
- package/dist/frontend/lowering/builtins/properties.js +39 -11
- package/dist/frontend/lowering/builtins/properties.js.map +1 -1
- package/dist/frontend/lowering/builtins/readline.d.ts +23 -8
- package/dist/frontend/lowering/builtins/readline.js +266 -90
- package/dist/frontend/lowering/builtins/readline.js.map +1 -1
- package/dist/frontend/lowering/builtins/timers.d.ts +3 -0
- package/dist/frontend/lowering/builtins/timers.js +109 -23
- package/dist/frontend/lowering/builtins/timers.js.map +1 -1
- package/dist/frontend/lowering/builtins/url.d.ts +8 -0
- package/dist/frontend/lowering/builtins/url.js +36 -0
- package/dist/frontend/lowering/builtins/url.js.map +1 -1
- package/dist/frontend/lowering/call-arguments.js +1 -1
- package/dist/frontend/lowering/call-arguments.js.map +1 -1
- package/dist/frontend/lowering/call-signatures.js +26 -2
- package/dist/frontend/lowering/call-signatures.js.map +1 -1
- package/dist/frontend/lowering/class-dynamic-dispatch.d.ts +2 -0
- package/dist/frontend/lowering/class-dynamic-dispatch.js +171 -13
- 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.d.ts +45 -0
- package/dist/frontend/lowering/class-protocol-dispatch.js +516 -0
- package/dist/frontend/lowering/class-protocol-dispatch.js.map +1 -0
- package/dist/frontend/lowering/coercions/structural-plans.js +2 -1
- package/dist/frontend/lowering/coercions/structural-plans.js.map +1 -1
- package/dist/frontend/lowering/coercions/structural.js +3 -3
- package/dist/frontend/lowering/coercions/structural.js.map +1 -1
- package/dist/frontend/lowering/collation-repertoire.js +6 -5
- package/dist/frontend/lowering/collation-repertoire.js.map +1 -1
- package/dist/frontend/lowering/containers/array-callbacks.js +4 -7
- package/dist/frontend/lowering/containers/array-callbacks.js.map +1 -1
- package/dist/frontend/lowering/containers/array-methods.d.ts +0 -7
- package/dist/frontend/lowering/containers/array-methods.js +43 -2
- package/dist/frontend/lowering/containers/array-methods.js.map +1 -1
- package/dist/frontend/lowering/containers/bytes.js +38 -26
- package/dist/frontend/lowering/containers/bytes.js.map +1 -1
- package/dist/frontend/lowering/containers/for-of.d.ts +1 -1
- package/dist/frontend/lowering/containers/for-of.js +5 -1
- package/dist/frontend/lowering/containers/for-of.js.map +1 -1
- package/dist/frontend/lowering/containers/indexed-objects.js +1 -1
- package/dist/frontend/lowering/containers/indexed-objects.js.map +1 -1
- package/dist/frontend/lowering/crypto-tables.d.ts +3 -3
- package/dist/frontend/lowering/crypto-tables.js +77 -12
- package/dist/frontend/lowering/crypto-tables.js.map +1 -1
- package/dist/frontend/lowering/expressions/nullish-assignment.js +10 -0
- package/dist/frontend/lowering/expressions/nullish-assignment.js.map +1 -1
- package/dist/frontend/lowering/expressions/object-literals.js +16 -12
- package/dist/frontend/lowering/expressions/object-literals.js.map +1 -1
- package/dist/frontend/lowering/generic-functions.d.ts +2 -2
- package/dist/frontend/lowering/generic-functions.js +2 -2
- package/dist/frontend/lowering/generic-functions.js.map +1 -1
- package/dist/frontend/lowering/http2-constants.js +1 -1
- package/dist/frontend/lowering/intern-tables.d.ts +13 -0
- package/dist/frontend/lowering/intern-tables.js +536 -0
- package/dist/frontend/lowering/intern-tables.js.map +1 -0
- package/dist/frontend/lowering/lower-array-sort.d.ts +12 -1
- package/dist/frontend/lowering/lower-array-sort.js +561 -191
- package/dist/frontend/lowering/lower-array-sort.js.map +1 -1
- package/dist/frontend/lowering/lower-array-sort.test.js +4 -2
- package/dist/frontend/lowering/lower-array-sort.test.js.map +1 -1
- package/dist/frontend/lowering/lower-assert.js +702 -63
- package/dist/frontend/lowering/lower-assert.js.map +1 -1
- package/dist/frontend/lowering/lower-async-iteration.d.ts +6 -3
- package/dist/frontend/lowering/lower-async-iteration.js +259 -4
- package/dist/frontend/lowering/lower-async-iteration.js.map +1 -1
- package/dist/frontend/lowering/lower-calls.js +118 -12
- package/dist/frontend/lowering/lower-calls.js.map +1 -1
- package/dist/frontend/lowering/lower-classes.d.ts +11 -2
- package/dist/frontend/lowering/lower-classes.js +76 -9
- package/dist/frontend/lowering/lower-classes.js.map +1 -1
- package/dist/frontend/lowering/lower-comptime.d.ts +1 -1
- package/dist/frontend/lowering/lower-comptime.js +4 -4
- package/dist/frontend/lowering/lower-comptime.js.map +1 -1
- package/dist/frontend/lowering/lower-dgram.js +77 -52
- package/dist/frontend/lowering/lower-dgram.js.map +1 -1
- package/dist/frontend/lowering/lower-event-target.d.ts +63 -0
- package/dist/frontend/lowering/lower-event-target.js +362 -0
- package/dist/frontend/lowering/lower-event-target.js.map +1 -0
- package/dist/frontend/lowering/lower-expando.js +2 -2
- package/dist/frontend/lowering/lower-exprs.js +124 -22
- package/dist/frontend/lowering/lower-exprs.js.map +1 -1
- package/dist/frontend/lowering/lower-inspect.d.ts +6 -0
- package/dist/frontend/lowering/lower-inspect.js +240 -49
- package/dist/frontend/lowering/lower-inspect.js.map +1 -1
- package/dist/frontend/lowering/lower-mixins.js +1 -1
- package/dist/frontend/lowering/lower-mock.d.ts +11 -0
- package/dist/frontend/lowering/lower-mock.js +504 -0
- package/dist/frontend/lowering/lower-mock.js.map +1 -0
- package/dist/frontend/lowering/lower-modules.d.ts +1 -1
- package/dist/frontend/lowering/lower-modules.js +14 -3
- package/dist/frontend/lowering/lower-modules.js.map +1 -1
- package/dist/frontend/lowering/lower-namespaces.d.ts +2 -2
- package/dist/frontend/lowering/lower-namespaces.js +2 -2
- package/dist/frontend/lowering/lower-server.d.ts +3 -0
- package/dist/frontend/lowering/lower-server.js +419 -44
- package/dist/frontend/lowering/lower-server.js.map +1 -1
- package/dist/frontend/lowering/lower-stdlib.d.ts +7 -1
- package/dist/frontend/lowering/lower-stdlib.js +10 -3
- package/dist/frontend/lowering/lower-stdlib.js.map +1 -1
- package/dist/frontend/lowering/lower-stmts.d.ts +2 -2
- package/dist/frontend/lowering/lower-stmts.js +69 -14
- package/dist/frontend/lowering/lower-stmts.js.map +1 -1
- package/dist/frontend/lowering/lower-stream.d.ts +10 -6
- package/dist/frontend/lowering/lower-stream.js +1020 -49
- package/dist/frontend/lowering/lower-stream.js.map +1 -1
- package/dist/frontend/lowering/lower-test.js +86 -8
- package/dist/frontend/lowering/lower-test.js.map +1 -1
- package/dist/frontend/lowering/lower-timers.js +1 -1
- package/dist/frontend/lowering/lowerer.d.ts +45 -5
- package/dist/frontend/lowering/lowerer.js +317 -48
- package/dist/frontend/lowering/lowerer.js.map +1 -1
- package/dist/frontend/lowering/native-ffi.js +2 -2
- package/dist/frontend/lowering/native-ffi.js.map +1 -1
- package/dist/frontend/lowering/pairs-snapshot.d.ts +6 -0
- package/dist/frontend/lowering/pairs-snapshot.js +49 -0
- package/dist/frontend/lowering/pairs-snapshot.js.map +1 -1
- package/dist/frontend/lowering/runtime-optional-records.d.ts +115 -0
- package/dist/frontend/lowering/runtime-optional-records.js +715 -0
- package/dist/frontend/lowering/runtime-optional-records.js.map +1 -0
- package/dist/frontend/lowering/runtime-optional-records.test.d.ts +1 -0
- package/dist/frontend/lowering/runtime-optional-records.test.js +175 -0
- package/dist/frontend/lowering/runtime-optional-records.test.js.map +1 -0
- package/dist/frontend/lowering/surfaces.d.ts +11 -3
- package/dist/frontend/lowering/surfaces.js +334 -37
- package/dist/frontend/lowering/surfaces.js.map +1 -1
- package/dist/frontend/lowering/zlib-constants.d.ts +1 -0
- package/dist/frontend/lowering/zlib-constants.js +181 -0
- package/dist/frontend/lowering/zlib-constants.js.map +1 -0
- package/dist/frontend/mock-shapes.d.ts +10 -0
- package/dist/frontend/mock-shapes.js +76 -0
- package/dist/frontend/mock-shapes.js.map +1 -0
- package/dist/frontend/module-syntax.d.ts +1 -1
- package/dist/frontend/module-syntax.js +1 -1
- package/dist/frontend/npm-static-prune.js +1 -1
- package/dist/frontend/npm-static-prune.js.map +1 -1
- package/dist/frontend/npm-static-rewrite-syntax.js +4 -3
- package/dist/frontend/npm-static-rewrite-syntax.js.map +1 -1
- package/dist/frontend/pipeline.js +6 -4
- package/dist/frontend/pipeline.js.map +1 -1
- package/dist/frontend/program.d.ts +3 -3
- package/dist/frontend/program.js +25 -18
- package/dist/frontend/program.js.map +1 -1
- package/dist/frontend/resolve.d.ts +4 -0
- package/dist/frontend/resolve.js +15 -1
- package/dist/frontend/resolve.js.map +1 -1
- package/dist/frontend/ts7/adapter.js +1 -1
- package/dist/frontend/ts7/ast-bytes.d.ts +1 -1
- package/dist/frontend/ts7/ast-bytes.js +1 -1
- package/dist/frontend/ts7/semantic-json.d.ts +1 -1
- package/dist/frontend/ts7/semantic-json.js +1 -1
- package/dist/frontend/ts7/semantic-json.js.map +1 -1
- package/dist/frontend/ts7/world-check.js +1 -1
- package/dist/frontend/tsc-codes.js +3 -2
- package/dist/frontend/tsc-codes.js.map +1 -1
- package/dist/frontend/type-mapper.d.ts +21 -1
- package/dist/frontend/type-mapper.js +245 -27
- package/dist/frontend/type-mapper.js.map +1 -1
- package/dist/index.js +7 -5
- package/dist/index.js.map +1 -1
- package/dist/ir/analysis.d.ts +12 -6
- package/dist/ir/analysis.js +26 -10
- package/dist/ir/analysis.js.map +1 -1
- package/dist/ir/analysis.test.js +15 -3
- package/dist/ir/analysis.test.js.map +1 -1
- package/dist/ir/builtin-effects.js +115 -0
- package/dist/ir/builtin-effects.js.map +1 -1
- package/dist/ir/builtin-signatures.d.ts +1 -1
- package/dist/ir/builtin-signatures.js +438 -46
- package/dist/ir/builtin-signatures.js.map +1 -1
- package/dist/ir/int32-slots.js +1 -0
- package/dist/ir/int32-slots.js.map +1 -1
- package/dist/ir/ir.d.ts +84 -17
- package/dist/ir/ir.js +54 -1
- package/dist/ir/ir.js.map +1 -1
- package/dist/ir/runtime-features.d.ts +1 -0
- package/dist/ir/runtime-features.js +111 -7
- package/dist/ir/runtime-features.js.map +1 -1
- package/dist/ir/serialize.js +1 -1
- package/dist/ir/serialize.js.map +1 -1
- package/dist/ir/traverse.js +1 -0
- package/dist/ir/traverse.js.map +1 -1
- package/dist/ir/validate.js +295 -14
- package/dist/ir/validate.js.map +1 -1
- package/dist/ir/validate.test.js +60 -0
- package/dist/ir/validate.test.js.map +1 -1
- package/dist/library/fence-eval.d.ts +1 -1
- package/dist/library/fence-eval.js +5 -4
- package/dist/library/fence-eval.js.map +1 -1
- package/dist/library/ir-policy.js +11 -4
- package/dist/library/ir-policy.js.map +1 -1
- package/dist/library/library-profile.js +13 -13
- package/dist/library/library-profile.js.map +1 -1
- package/dist/library/prepare.js +1 -1
- package/dist/library/prepare.js.map +1 -1
- package/dist/library/sidecar.js +3 -3
- package/dist/library/sidecar.js.map +1 -1
- package/dist/native/cli.js +1 -0
- package/dist/native/cli.js.map +1 -1
- package/dist/native/compiler.js +1 -3
- package/dist/native/compiler.js.map +1 -1
- package/dist/native/prepare.js +4 -2
- package/dist/native/prepare.js.map +1 -1
- package/dist/native/sanitizer.test.js +1 -0
- package/dist/native/sanitizer.test.js.map +1 -1
- package/package.json +20 -20
- package/surface-manifest.json +1279 -221
|
@@ -1,6 +1,11 @@
|
|
|
1
|
-
import type { IrType } from "../../ir/ir.js";
|
|
1
|
+
import type { IrRecordShape, IrType } from "../../ir/ir.js";
|
|
2
2
|
import type { WalkerHost } from "./walkers.js";
|
|
3
3
|
import type { LlStreamTypedRefAdapter } from "./expr-context.js";
|
|
4
|
+
/** Whether to-dyn of a record shape keeps the record itself: an empty shape
|
|
5
|
+
* and an event-listener record (a `handleEvent` function field) box their
|
|
6
|
+
* identity. Every other shape, tuples included, copies its fields into a
|
|
7
|
+
* fresh checked-dynamic value. */
|
|
8
|
+
export declare function recordDynKeepsIdentity(shape: IrRecordShape): boolean;
|
|
4
9
|
export declare const DYN_KIND: {
|
|
5
10
|
readonly NULL: 0;
|
|
6
11
|
readonly BOOL: 1;
|
|
@@ -55,9 +60,38 @@ export declare class LlDyn {
|
|
|
55
60
|
private dynToStrFn;
|
|
56
61
|
private caughtToDynFn;
|
|
57
62
|
private readonly helperMemo;
|
|
63
|
+
private readonly recursiveShapes;
|
|
64
|
+
private readonly holdsRecursiveShapes;
|
|
58
65
|
/** Emitted function definitions, in interning order. */
|
|
59
66
|
readonly defs: string[];
|
|
60
67
|
constructor(host: DynHost);
|
|
68
|
+
/** The types a dyn matcher or builder for `t` checks structurally: record
|
|
69
|
+
* fields and index values, array elements and union arms. */
|
|
70
|
+
private structuralChildren;
|
|
71
|
+
/** A record or array type that reaches itself through its fields,
|
|
72
|
+
* elements or union arms. Only these can describe a cyclic dyn value, so
|
|
73
|
+
* only their matchers and builders track visited values. */
|
|
74
|
+
private isRecursiveShape;
|
|
75
|
+
/** A type with a recursive shape among the types it reaches. Its matcher
|
|
76
|
+
* and builder keep one visit session open for all of its members, so a
|
|
77
|
+
* dyn value reached through two of them converts once. */
|
|
78
|
+
private holdsRecursiveShape;
|
|
79
|
+
/** `name` around the structural body `${name}_body`, inside one visit
|
|
80
|
+
* session of the runtime. A recursive shape's matcher ("match") answers
|
|
81
|
+
* true for a (value, matcher) pair it is already checking further up the
|
|
82
|
+
* stack. A recursive shape's builder ("build") answers the value it
|
|
83
|
+
* already built for the same dyn value in the session, so cycles and
|
|
84
|
+
* shared values keep their identity. Matchers ("visit") and builders
|
|
85
|
+
* ("memo") of types holding recursive shapes only keep the session open
|
|
86
|
+
* across their members. */
|
|
87
|
+
private emitVisitWrapper;
|
|
88
|
+
/** The runtime call that gives a matcher or builder body a capsule's
|
|
89
|
+
* dyn view: inside a visit session (`wrapped`), a capsule keeps the view
|
|
90
|
+
* it was first given, so an outer visit can keep reading it. */
|
|
91
|
+
private viewFn;
|
|
92
|
+
/** In a recursive shape's builder body: record `value`, just allocated
|
|
93
|
+
* for %d, before its members are built. */
|
|
94
|
+
private recordBuilt;
|
|
61
95
|
/** Branch to a variant only after its literal discriminator and complete
|
|
62
96
|
* structure match. Use the same path for predicates and builders. */
|
|
63
97
|
private unionArmMatch;
|
|
@@ -106,6 +140,11 @@ export declare class LlDyn {
|
|
|
106
140
|
private presenceOf;
|
|
107
141
|
/** Ordinary property lookup, including inherited data and accessors (+1). */
|
|
108
142
|
private objReadLit;
|
|
143
|
+
/** A member read for a matcher or builder of `t`: values that can reach a
|
|
144
|
+
* recursive shape go through the runtime's held read, so its visit
|
|
145
|
+
* tracking does not count the read's reference. Returns the value and
|
|
146
|
+
* the matching release. */
|
|
147
|
+
private memberRead;
|
|
109
148
|
/** Appends a borrowed string, preserving its full byte length. */
|
|
110
149
|
private putScrStr;
|
|
111
150
|
/** Fixed text and JSON tokens hold no lone surrogate, so they append
|
|
@@ -117,6 +156,10 @@ export declare class LlDyn {
|
|
|
117
156
|
/** Emit the standard in-helper pending check: on a pending exception
|
|
118
157
|
* run `cleanup` and return `dummy`. */
|
|
119
158
|
private pendingBail;
|
|
159
|
+
/** A capsule boxed from this class by this program carries the class's
|
|
160
|
+
* key constant itself: return its instance (+1) without comparing names
|
|
161
|
+
* or calling the capsule's retain adapter. Other values continue. */
|
|
162
|
+
private exactClassCapsule;
|
|
120
163
|
/** Native subclass capsules also satisfy a checked base-class slot.
|
|
121
164
|
* Class layouts share their base prefix, so unboxing retains the same
|
|
122
165
|
* pointer and virtual dispatch still uses the object's original vtable. */
|
package/dist/backend/llvm/dyn.js
CHANGED
|
@@ -1,15 +1,26 @@
|
|
|
1
1
|
import { typedRefConstructor } from "./shapes.js";
|
|
2
2
|
import { bindLiveArrayOps } from "./expr-stream-bridges.js";
|
|
3
|
-
import { BYTES_ELEM_NUM, SCR_ARR_FIELD, f64Lit } from "./common.js";
|
|
3
|
+
import { BYTES_ELEM_NUM, SCR_ARR_FIELD, f64Lit, sizeToDouble } from "./common.js";
|
|
4
4
|
import { emitUnionPeek, emitUnionTag } from "./union-repr.js";
|
|
5
|
+
import { INLINE_UNION_FIELD, loadInlineUnion, stackUnionBox, storeInlineUnion, unionBoxBits, } from "./inline-unions.js";
|
|
5
6
|
import { InternalCompilerError } from "../../errors.js";
|
|
6
|
-
import { DYN_HANDLE_KINDS, isDynTypedRefType, isRefCounted, typeKey } from "../../ir/ir.js";
|
|
7
|
+
import { DYN_HANDLE_KINDS, isDirentShape, isDynTypedRefType, isRefCounted, typeKey, } from "../../ir/ir.js";
|
|
7
8
|
import { dynDesc, streamTypedRefEligible } from "../../ir/analysis.js";
|
|
8
9
|
import { mangleRecordNew, mangleRecordStruct } from "../mangle.js";
|
|
9
10
|
import { BlockBuilder } from "./blocks.js";
|
|
10
11
|
import { llvmCommentText } from "./common.js";
|
|
11
12
|
import { arrNewCall, elemAccess, llFieldType, releaseSym, traceAdapter, traceArg, vAdapters, } from "./shapes.js";
|
|
12
13
|
import { LlvmUnsupportedError } from "./unsupported.js";
|
|
14
|
+
/** Whether to-dyn of a record shape keeps the record itself: an empty shape
|
|
15
|
+
* and an event-listener record (a `handleEvent` function field) box their
|
|
16
|
+
* identity. Every other shape, tuples included, copies its fields into a
|
|
17
|
+
* fresh checked-dynamic value. */
|
|
18
|
+
export function recordDynKeepsIdentity(shape) {
|
|
19
|
+
if (shape.tuple)
|
|
20
|
+
return false;
|
|
21
|
+
return ((shape.fields.length === 0 && !shape.indexValue) ||
|
|
22
|
+
shape.fields.some((f) => f.name === "handleEvent" && f.type.kind === "func"));
|
|
23
|
+
}
|
|
13
24
|
/** ScrDynKind values (scr_runtime.h). */
|
|
14
25
|
/** ScrDynHandleTag numeric values (scr_runtime.h's enum order). */
|
|
15
26
|
const DYN_HANDLE_TAG_NUM = {
|
|
@@ -22,6 +33,7 @@ const DYN_HANDLE_TAG_NUM = {
|
|
|
22
33
|
httpClientReq: 6,
|
|
23
34
|
child: 16,
|
|
24
35
|
fileHandle: 17,
|
|
36
|
+
dir: 44,
|
|
25
37
|
};
|
|
26
38
|
export const DYN_KIND = {
|
|
27
39
|
NULL: 0,
|
|
@@ -54,11 +66,117 @@ export class LlDyn {
|
|
|
54
66
|
dynToStrFn = null;
|
|
55
67
|
caughtToDynFn = null;
|
|
56
68
|
helperMemo = new Map();
|
|
69
|
+
recursiveShapes = new Map();
|
|
70
|
+
holdsRecursiveShapes = new Map();
|
|
57
71
|
/** Emitted function definitions, in interning order. */
|
|
58
72
|
defs = [];
|
|
59
73
|
constructor(host) {
|
|
60
74
|
this.host = host;
|
|
61
75
|
}
|
|
76
|
+
/** The types a dyn matcher or builder for `t` checks structurally: record
|
|
77
|
+
* fields and index values, array elements and union arms. */
|
|
78
|
+
structuralChildren(t) {
|
|
79
|
+
switch (t.kind) {
|
|
80
|
+
case "record": {
|
|
81
|
+
const shape = this.host.recordsById.get(t.shapeId);
|
|
82
|
+
if (!shape)
|
|
83
|
+
return [];
|
|
84
|
+
const fields = shape.fields.map((f) => f.type);
|
|
85
|
+
return shape.indexValue ? [...fields, shape.indexValue] : fields;
|
|
86
|
+
}
|
|
87
|
+
case "array":
|
|
88
|
+
return [t.elem];
|
|
89
|
+
case "union":
|
|
90
|
+
return this.host.unionsById.get(t.unionId)?.arms ?? [];
|
|
91
|
+
default:
|
|
92
|
+
return [];
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
|
+
/** A record or array type that reaches itself through its fields,
|
|
96
|
+
* elements or union arms. Only these can describe a cyclic dyn value, so
|
|
97
|
+
* only their matchers and builders track visited values. */
|
|
98
|
+
isRecursiveShape(t) {
|
|
99
|
+
if (t.kind !== "record" && t.kind !== "array")
|
|
100
|
+
return false;
|
|
101
|
+
const key = typeKey(t);
|
|
102
|
+
const known = this.recursiveShapes.get(key);
|
|
103
|
+
if (known !== undefined)
|
|
104
|
+
return known;
|
|
105
|
+
const seen = new Set();
|
|
106
|
+
const pending = [...this.structuralChildren(t)];
|
|
107
|
+
let recursive = false;
|
|
108
|
+
while (pending.length > 0 && !recursive) {
|
|
109
|
+
const next = pending.pop();
|
|
110
|
+
const nextKey = typeKey(next);
|
|
111
|
+
if (nextKey === key)
|
|
112
|
+
recursive = true;
|
|
113
|
+
else if (!seen.has(nextKey)) {
|
|
114
|
+
seen.add(nextKey);
|
|
115
|
+
pending.push(...this.structuralChildren(next));
|
|
116
|
+
}
|
|
117
|
+
}
|
|
118
|
+
this.recursiveShapes.set(key, recursive);
|
|
119
|
+
return recursive;
|
|
120
|
+
}
|
|
121
|
+
/** A type with a recursive shape among the types it reaches. Its matcher
|
|
122
|
+
* and builder keep one visit session open for all of its members, so a
|
|
123
|
+
* dyn value reached through two of them converts once. */
|
|
124
|
+
holdsRecursiveShape(t) {
|
|
125
|
+
const key = typeKey(t);
|
|
126
|
+
const known = this.holdsRecursiveShapes.get(key);
|
|
127
|
+
if (known !== undefined)
|
|
128
|
+
return known;
|
|
129
|
+
const seen = new Set([key]);
|
|
130
|
+
const pending = [...this.structuralChildren(t)];
|
|
131
|
+
let holds = false;
|
|
132
|
+
while (pending.length > 0 && !holds) {
|
|
133
|
+
const next = pending.pop();
|
|
134
|
+
const nextKey = typeKey(next);
|
|
135
|
+
if (seen.has(nextKey))
|
|
136
|
+
continue;
|
|
137
|
+
seen.add(nextKey);
|
|
138
|
+
if (this.isRecursiveShape(next))
|
|
139
|
+
holds = true;
|
|
140
|
+
else
|
|
141
|
+
pending.push(...this.structuralChildren(next));
|
|
142
|
+
}
|
|
143
|
+
this.holdsRecursiveShapes.set(key, holds);
|
|
144
|
+
return holds;
|
|
145
|
+
}
|
|
146
|
+
/** `name` around the structural body `${name}_body`, inside one visit
|
|
147
|
+
* session of the runtime. A recursive shape's matcher ("match") answers
|
|
148
|
+
* true for a (value, matcher) pair it is already checking further up the
|
|
149
|
+
* stack. A recursive shape's builder ("build") answers the value it
|
|
150
|
+
* already built for the same dyn value in the session, so cycles and
|
|
151
|
+
* shared values keep their identity. Matchers ("visit") and builders
|
|
152
|
+
* ("memo") of types holding recursive shapes only keep the session open
|
|
153
|
+
* across their members. */
|
|
154
|
+
emitVisitWrapper(name, t, mode) {
|
|
155
|
+
const host = this.host;
|
|
156
|
+
const what = mode === "match" || mode === "build" ? "visits tracked" : "one visit session";
|
|
157
|
+
if (mode === "match" || mode === "visit") {
|
|
158
|
+
host.declare(`declare zeroext i1 @scr_dyn_match_visit(ptr, ptr, ptr)`);
|
|
159
|
+
this.defs.push(`define internal zeroext i1 @${name}(ptr %d) ${FN_ATTRS} { ; matches ${llvmCommentText(typeKey(t))}, ${what}`, `entry:`, ` %ok = call zeroext i1 @scr_dyn_match_visit(ptr %d, ptr ${mode === "match" ? `@${name}` : "null"}, ptr @${name}_body)`, ` ret i1 %ok`, `}`, ``);
|
|
160
|
+
return;
|
|
161
|
+
}
|
|
162
|
+
const retain = mode === "build" ? vAdapters(host, t).retain : "null";
|
|
163
|
+
host.declare(`declare ptr @scr_dyn_build_visit(ptr, ptr, ptr, ptr, ptr)`);
|
|
164
|
+
this.defs.push(`define internal ptr @${name}(ptr %d, ptr %path) ${FN_ATTRS} { ; check ${llvmCommentText(typeKey(t))}, ${what}`, `entry:`, ` %r = call ptr @scr_dyn_build_visit(ptr %d, ptr %path, ptr ${mode === "build" ? `@${name}` : "null"}, ptr @${name}_body, ptr ${retain})`, ` ret ptr %r`, `}`, ``);
|
|
165
|
+
}
|
|
166
|
+
/** The runtime call that gives a matcher or builder body a capsule's
|
|
167
|
+
* dyn view: inside a visit session (`wrapped`), a capsule keeps the view
|
|
168
|
+
* it was first given, so an outer visit can keep reading it. */
|
|
169
|
+
viewFn(wrapped) {
|
|
170
|
+
const fn = wrapped ? "scr_dyn_visit_view" : "scr_dyn_typed_ref_materialize";
|
|
171
|
+
this.host.declare(`declare ptr @${fn}(ptr)`);
|
|
172
|
+
return fn;
|
|
173
|
+
}
|
|
174
|
+
/** In a recursive shape's builder body: record `value`, just allocated
|
|
175
|
+
* for %d, before its members are built. */
|
|
176
|
+
recordBuilt(B, name, value) {
|
|
177
|
+
this.host.declare(`declare void @scr_dyn_build_add(ptr, ptr, ptr)`);
|
|
178
|
+
B.line(`call void @scr_dyn_build_add(ptr %d, ptr @${name}, ptr ${value})`);
|
|
179
|
+
}
|
|
62
180
|
/** Branch to a variant only after its literal discriminator and complete
|
|
63
181
|
* structure match. Use the same path for predicates and builders. */
|
|
64
182
|
unionArmMatch(B, def, tag, yes, no, preserveRefs = false) {
|
|
@@ -313,12 +431,23 @@ export class LlDyn {
|
|
|
313
431
|
return out;
|
|
314
432
|
}
|
|
315
433
|
/** Ordinary property lookup, including inherited data and accessors (+1). */
|
|
316
|
-
objReadLit(B, d, key) {
|
|
317
|
-
|
|
434
|
+
objReadLit(B, d, key, held = false) {
|
|
435
|
+
const read = held ? "scr_dyn_obj_read_held" : "scr_dyn_obj_read";
|
|
436
|
+
this.host.declare(`declare ptr @${read}(ptr, ptr, ${this.S})`);
|
|
318
437
|
const value = B.tmp();
|
|
319
|
-
B.line(`${value} = call ptr
|
|
438
|
+
B.line(`${value} = call ptr @${read}(ptr ${d}, ptr ${this.host.cstr(key)}, ${this.S} ${Buffer.byteLength(key, "utf8")})`);
|
|
320
439
|
return value;
|
|
321
440
|
}
|
|
441
|
+
/** A member read for a matcher or builder of `t`: values that can reach a
|
|
442
|
+
* recursive shape go through the runtime's held read, so its visit
|
|
443
|
+
* tracking does not count the read's reference. Returns the value and
|
|
444
|
+
* the matching release. */
|
|
445
|
+
memberRead(B, key, t) {
|
|
446
|
+
const held = this.isRecursiveShape(t) || this.holdsRecursiveShape(t);
|
|
447
|
+
const release = held ? "scr_dyn_release_held" : "scr_dyn_release";
|
|
448
|
+
this.host.declare(`declare void @${release}(ptr)`);
|
|
449
|
+
return { value: this.objReadLit(B, "%d", key, held), release };
|
|
450
|
+
}
|
|
322
451
|
/** Appends a borrowed string, preserving its full byte length. */
|
|
323
452
|
putScrStr(B, buf, s) {
|
|
324
453
|
this.host.declare(`declare void @scr_jb_put_str(ptr, ptr)`);
|
|
@@ -371,6 +500,35 @@ export class LlDyn {
|
|
|
371
500
|
B.terminate(`ret ${dummy}`);
|
|
372
501
|
B.startBlock(lk);
|
|
373
502
|
}
|
|
503
|
+
/** A capsule boxed from this class by this program carries the class's
|
|
504
|
+
* key constant itself: return its instance (+1) without comparing names
|
|
505
|
+
* or calling the capsule's retain adapter. Other values continue. */
|
|
506
|
+
exactClassCapsule(B, t) {
|
|
507
|
+
const key = typeKey(t);
|
|
508
|
+
const present = B.tmp();
|
|
509
|
+
const inspect = B.newLabel("dc.exact.inspect");
|
|
510
|
+
const capsule = B.newLabel("dc.exact.capsule");
|
|
511
|
+
const hit = B.newLabel("dc.exact.hit");
|
|
512
|
+
const miss = B.newLabel("dc.exact.miss");
|
|
513
|
+
B.line(`${present} = icmp ne ptr %d, null`);
|
|
514
|
+
B.condBr(present, inspect, miss);
|
|
515
|
+
B.startBlock(inspect);
|
|
516
|
+
const typed = B.tmp();
|
|
517
|
+
B.line(`${typed} = icmp eq i32 ${this.kindOf(B, "%d")}, ${DYN_KIND.TYPED_REF}`);
|
|
518
|
+
B.condBr(typed, capsule, miss);
|
|
519
|
+
B.startBlock(capsule);
|
|
520
|
+
const keySlot = B.tmp(), keyPtr = B.tmp(), same = B.tmp();
|
|
521
|
+
B.line(`${keySlot} = getelementptr inbounds i8, ptr %d, i64 ${this.abiOffset(40, 28)} ; ->v.typed_ref.type_key`);
|
|
522
|
+
B.line(`${keyPtr} = load ptr, ptr ${keySlot}`);
|
|
523
|
+
B.line(`${same} = icmp eq ptr ${keyPtr}, ${this.host.cstr(key)}`);
|
|
524
|
+
B.condBr(same, hit, miss);
|
|
525
|
+
B.startBlock(hit);
|
|
526
|
+
const object = this.payloadOf(B, "%d", "ptr");
|
|
527
|
+
const retained = B.tmp();
|
|
528
|
+
B.line(`${retained} = call ptr ${vAdapters(this.host, t).retain}(ptr ${object})`);
|
|
529
|
+
B.terminate(`ret ptr ${retained}`);
|
|
530
|
+
B.startBlock(miss);
|
|
531
|
+
}
|
|
374
532
|
/* ── dynMatchHelper (walkers.ts, ported) ──────────────────────── */
|
|
375
533
|
/** Native subclass capsules also satisfy a checked base-class slot.
|
|
376
534
|
* Class layouts share their base prefix, so unboxing retains the same
|
|
@@ -404,6 +562,8 @@ export class LlDyn {
|
|
|
404
562
|
return existing;
|
|
405
563
|
const name = `sc_dm_${this.dynMatchers.size}`;
|
|
406
564
|
this.dynMatchers.set(matcherKey, name);
|
|
565
|
+
const recursive = this.isRecursiveShape(t);
|
|
566
|
+
const wrapped = recursive || this.holdsRecursiveShape(t);
|
|
407
567
|
const B = new BlockBuilder();
|
|
408
568
|
if (isRefCounted(t) && t.kind !== "dyn") {
|
|
409
569
|
const matched = this.typedRefMatches(B, t);
|
|
@@ -415,7 +575,7 @@ export class LlDyn {
|
|
|
415
575
|
B.startBlock(lNext);
|
|
416
576
|
}
|
|
417
577
|
if (t.kind !== "dyn") {
|
|
418
|
-
this.
|
|
578
|
+
const view = this.viewFn(wrapped);
|
|
419
579
|
this.host.declare(`declare void @scr_dyn_release_v(ptr)`);
|
|
420
580
|
const kind = this.kindOf(B, "%d");
|
|
421
581
|
const capsule = B.tmp();
|
|
@@ -430,7 +590,7 @@ export class LlDyn {
|
|
|
430
590
|
else {
|
|
431
591
|
const materialized = B.tmp();
|
|
432
592
|
const matched = B.tmp();
|
|
433
|
-
B.line(`${materialized} = call ptr
|
|
593
|
+
B.line(`${materialized} = call ptr @${view}(ptr %d)`);
|
|
434
594
|
B.line(`${matched} = call zeroext i1 @${name}(ptr ${materialized})`);
|
|
435
595
|
B.line(`call void @scr_dyn_release_v(ptr ${materialized})`);
|
|
436
596
|
B.terminate(`ret i1 ${matched}`);
|
|
@@ -609,13 +769,12 @@ export class LlDyn {
|
|
|
609
769
|
for (const f of shape.fields) {
|
|
610
770
|
if (f.type.kind === "dyn")
|
|
611
771
|
continue;
|
|
612
|
-
const m = this.
|
|
772
|
+
const { value: m, release } = this.memberRead(B, f.name, f.type);
|
|
613
773
|
const lNext = B.newLabel("dm.n");
|
|
614
|
-
this.
|
|
615
|
-
this.pendingBail(B, "dm.read", () => B.line(`call void @scr_dyn_release(ptr ${m})`), "i1 false");
|
|
774
|
+
this.pendingBail(B, "dm.read", () => B.line(`call void @${release}(ptr ${m})`), "i1 false");
|
|
616
775
|
const ok = B.tmp();
|
|
617
776
|
B.line(`${ok} = call zeroext i1 @${this.dynMatchHelper(f.type, preserveRefs)}(ptr ${m})`);
|
|
618
|
-
B.line(`call void
|
|
777
|
+
B.line(`call void @${release}(ptr ${m})`);
|
|
619
778
|
B.condBr(ok, lNext, fail);
|
|
620
779
|
B.startBlock(lNext);
|
|
621
780
|
}
|
|
@@ -733,7 +892,9 @@ export class LlDyn {
|
|
|
733
892
|
break;
|
|
734
893
|
}
|
|
735
894
|
}
|
|
736
|
-
this.defs.push(`define internal zeroext i1 @${name}(ptr %d) ${FN_ATTRS} { ; matches ${key}`, B.render(), `}`, ``);
|
|
895
|
+
this.defs.push(`define internal zeroext i1 @${wrapped ? `${name}_body` : name}(ptr %d) ${FN_ATTRS} { ; matches ${key}`, B.render(), `}`, ``);
|
|
896
|
+
if (wrapped)
|
|
897
|
+
this.emitVisitWrapper(name, t, recursive ? "match" : "visit");
|
|
737
898
|
return name;
|
|
738
899
|
}
|
|
739
900
|
/* ── schema-directed JSON.parse ───────────────────────────────── */
|
|
@@ -863,6 +1024,8 @@ export class LlDyn {
|
|
|
863
1024
|
return existing;
|
|
864
1025
|
const name = `sc_dc_${this.dynBuilders.size}`;
|
|
865
1026
|
this.dynBuilders.set(builderKey, name);
|
|
1027
|
+
const recursive = this.isRecursiveShape(t);
|
|
1028
|
+
const memo = !recursive && this.holdsRecursiveShape(t) && this.valTy(t) === "ptr";
|
|
866
1029
|
const host = this.host;
|
|
867
1030
|
const retTy = this.valTy(t);
|
|
868
1031
|
const dummy = retTy === "double" ? `double ${f64Lit(0)}` : retTy === "i1" ? "i1 false" : "ptr null";
|
|
@@ -890,6 +1053,8 @@ export class LlDyn {
|
|
|
890
1053
|
B.terminate(`ret ptr ${error}`);
|
|
891
1054
|
B.startBlock(next);
|
|
892
1055
|
}
|
|
1056
|
+
if (isDynTypedRefType(t))
|
|
1057
|
+
this.exactClassCapsule(B, t);
|
|
893
1058
|
const matched = this.typedRefMatches(B, t);
|
|
894
1059
|
const lRef = B.newLabel("dc.tr");
|
|
895
1060
|
const lNext = B.newLabel("dc.nt");
|
|
@@ -912,7 +1077,7 @@ export class LlDyn {
|
|
|
912
1077
|
B.startBlock(plain);
|
|
913
1078
|
}
|
|
914
1079
|
else if (t.kind !== "union") {
|
|
915
|
-
|
|
1080
|
+
const view = this.viewFn(recursive || memo);
|
|
916
1081
|
host.declare(`declare ptr @scr_dyn_typed_ref_cached_cast(ptr, ptr, ${host.sizeType})`);
|
|
917
1082
|
host.declare(`declare void @scr_dyn_typed_ref_cache_cast(ptr, ptr, ${host.sizeType}, ptr, ptr, ptr, i1)`);
|
|
918
1083
|
host.declare(`declare void @scr_dyn_release_v(ptr)`);
|
|
@@ -928,6 +1093,13 @@ export class LlDyn {
|
|
|
928
1093
|
B.line(`${cached} = call ptr @scr_dyn_typed_ref_cached_cast(ptr %d, ptr ${host.cstr(key)}, ${host.sizeType} ${Buffer.byteLength(key, "utf8")})`);
|
|
929
1094
|
const hasCached = B.tmp();
|
|
930
1095
|
B.line(`${hasCached} = icmp ne ptr ${cached}, null`);
|
|
1096
|
+
if (recursive) {
|
|
1097
|
+
// A cached record keeps its identity: the refresh below rewrites
|
|
1098
|
+
// it in place. Later visits of this capsule in the session answer
|
|
1099
|
+
// it, instead of refreshing it while this visit rebuilds it.
|
|
1100
|
+
host.declare(`declare void @scr_dyn_build_note(ptr, ptr, ptr)`);
|
|
1101
|
+
B.line(`call void @scr_dyn_build_note(ptr %d, ptr @${name}, ptr ${cached})`);
|
|
1102
|
+
}
|
|
931
1103
|
if (t.kind !== "record" && t.kind !== "array") {
|
|
932
1104
|
const lCached = B.newLabel("dc.tr.hit");
|
|
933
1105
|
const lMaterialize = B.newLabel("dc.tr.mat");
|
|
@@ -938,7 +1110,7 @@ export class LlDyn {
|
|
|
938
1110
|
}
|
|
939
1111
|
const materialized = B.tmp();
|
|
940
1112
|
const checked = B.tmp();
|
|
941
|
-
B.line(`${materialized} = call ptr
|
|
1113
|
+
B.line(`${materialized} = call ptr @${view}(ptr %d)`);
|
|
942
1114
|
B.line(`${checked} = call ${retTy} @${name}(ptr ${materialized}, ptr %path)`);
|
|
943
1115
|
B.line(`call void @scr_dyn_release_v(ptr ${materialized})`);
|
|
944
1116
|
const ok = B.tmp();
|
|
@@ -976,7 +1148,7 @@ export class LlDyn {
|
|
|
976
1148
|
? [
|
|
977
1149
|
...shape.fields.map((field, index) => ({
|
|
978
1150
|
index: index + 1,
|
|
979
|
-
type: llFieldType(field.type),
|
|
1151
|
+
type: llFieldType(field.type, host.inlineUnions.record(field.type)),
|
|
980
1152
|
name: field.name,
|
|
981
1153
|
})),
|
|
982
1154
|
...(shape.indexValue
|
|
@@ -1015,6 +1187,12 @@ export class LlDyn {
|
|
|
1015
1187
|
host.declare("declare void @scr_arr_swap_indexed_ext(ptr, ptr)");
|
|
1016
1188
|
B.line(`call void @scr_arr_swap_indexed_ext(ptr ${cached}, ptr ${checked})`);
|
|
1017
1189
|
}
|
|
1190
|
+
if (recursive) {
|
|
1191
|
+
// The memo recorded the record built for the view: later visits
|
|
1192
|
+
// in the session answer the cached record that now holds it.
|
|
1193
|
+
host.declare(`declare void @scr_dyn_build_rekey(ptr, ptr, ptr)`);
|
|
1194
|
+
B.line(`call void @scr_dyn_build_rekey(ptr ${materialized}, ptr @${name}, ptr ${cached})`);
|
|
1195
|
+
}
|
|
1018
1196
|
B.line(`call void ${releaseSym(host, t)}(ptr ${checked})`);
|
|
1019
1197
|
B.terminate(`ret ptr ${cached}`);
|
|
1020
1198
|
B.startBlock(lCache);
|
|
@@ -1246,19 +1424,30 @@ export class LlDyn {
|
|
|
1246
1424
|
B.line(`${ip} = getelementptr inbounds %ScrDynPath, ptr ${pathSlot}, i64 0, i32 2`);
|
|
1247
1425
|
B.line(`store ${host.sizeType} 0, ptr ${ip}`);
|
|
1248
1426
|
};
|
|
1427
|
+
// An inline union field copies the checked box's bits; the caller
|
|
1428
|
+
// releases the box afterwards.
|
|
1249
1429
|
const storeInto = (fieldName, ft, value) => {
|
|
1250
1430
|
const idx = fieldIndex.get(fieldName);
|
|
1251
1431
|
const p = B.tmp();
|
|
1252
1432
|
B.line(`${p} = getelementptr inbounds %${struct}, ptr %r0, i64 0, i32 ${idx} ; .${llvmCommentText(fieldName)}`);
|
|
1253
|
-
|
|
1433
|
+
const fieldTy = llFieldType(ft, host.inlineUnions.record(ft));
|
|
1434
|
+
if (fieldTy === INLINE_UNION_FIELD) {
|
|
1435
|
+
const { tag, bits } = unionBoxBits(B, value, host.unionNoneRef());
|
|
1436
|
+
storeInlineUnion(B, p, tag, bits);
|
|
1437
|
+
}
|
|
1438
|
+
else if (fieldTy === "i8") {
|
|
1254
1439
|
const z = B.tmp();
|
|
1255
1440
|
B.line(`${z} = zext i1 ${value} to i8`);
|
|
1256
1441
|
B.line(`store i8 ${z}, ptr ${p}`);
|
|
1257
1442
|
}
|
|
1258
1443
|
else {
|
|
1259
|
-
B.line(`store ${
|
|
1444
|
+
B.line(`store ${fieldTy} ${value}, ptr ${p}`);
|
|
1260
1445
|
}
|
|
1261
1446
|
};
|
|
1447
|
+
const releaseInline = (ft, value) => {
|
|
1448
|
+
if (host.inlineUnions.record(ft))
|
|
1449
|
+
B.line(`call void ${releaseSym(host, ft)}(ptr ${value})`);
|
|
1450
|
+
};
|
|
1262
1451
|
// Tuple targets: a JSON ARRAY of exactly the arity.
|
|
1263
1452
|
if (shape.tuple) {
|
|
1264
1453
|
const byIndex = [...shape.fields].sort((a, b) => Number(a.name) - Number(b.name));
|
|
@@ -1275,6 +1464,8 @@ export class LlDyn {
|
|
|
1275
1464
|
B.terminate(`ret ptr null`);
|
|
1276
1465
|
B.startBlock(lGo);
|
|
1277
1466
|
B.line(`%r0 = call ptr @${mangleRecordNew(t.shapeId)}()`);
|
|
1467
|
+
if (recursive)
|
|
1468
|
+
this.recordBuilt(B, name, "%r0");
|
|
1278
1469
|
const items = this.itemsOf(B, "%d");
|
|
1279
1470
|
byIndex.forEach((f, i) => {
|
|
1280
1471
|
setPath(null, `${i}`);
|
|
@@ -1282,6 +1473,7 @@ export class LlDyn {
|
|
|
1282
1473
|
const v = B.tmp();
|
|
1283
1474
|
B.line(`${v} = call ${this.valTy(f.type)} @${this.dynCheckHelper(f.type, preserveRefs)}(ptr ${e}, ptr ${pathSlot})`);
|
|
1284
1475
|
storeInto(f.name, f.type, v);
|
|
1476
|
+
releaseInline(f.type, v);
|
|
1285
1477
|
this.pendingBail(B, "dct", releaseR, "ptr null");
|
|
1286
1478
|
});
|
|
1287
1479
|
B.terminate(`ret ptr %r0`);
|
|
@@ -1317,24 +1509,29 @@ export class LlDyn {
|
|
|
1317
1509
|
B.startBlock(lCopy);
|
|
1318
1510
|
}
|
|
1319
1511
|
B.line(`%r0 = call ptr @${mangleRecordNew(t.shapeId)}()`);
|
|
1512
|
+
if (recursive)
|
|
1513
|
+
this.recordBuilt(B, name, "%r0");
|
|
1320
1514
|
for (const f of shape.fields) {
|
|
1321
|
-
const m = this.
|
|
1322
|
-
host.declare(`declare void @scr_dyn_release(ptr)`);
|
|
1515
|
+
const { value: m, release } = this.memberRead(B, f.name, f.type);
|
|
1323
1516
|
this.pendingBail(B, "dcr.read", () => {
|
|
1324
|
-
B.line(`call void
|
|
1517
|
+
B.line(`call void @${release}(ptr ${m})`);
|
|
1325
1518
|
releaseR();
|
|
1326
1519
|
}, "ptr null");
|
|
1327
1520
|
setPath(f.name, "0");
|
|
1328
1521
|
const value = B.tmp();
|
|
1329
1522
|
B.line(`${value} = call ${this.valTy(f.type)} @${this.dynCheckHelper(f.type, preserveRefs)}(ptr ${m}, ptr ${pathSlot})`);
|
|
1330
|
-
B.line(`call void
|
|
1523
|
+
B.line(`call void @${release}(ptr ${m})`);
|
|
1331
1524
|
storeInto(f.name, f.type, value);
|
|
1332
|
-
this.pendingBail(B, "dcr",
|
|
1525
|
+
this.pendingBail(B, "dcr", () => {
|
|
1526
|
+
releaseInline(f.type, value);
|
|
1527
|
+
releaseR();
|
|
1528
|
+
}, "ptr null");
|
|
1333
1529
|
if (f.type.kind === "union") {
|
|
1334
1530
|
const stored = this.presenceOf(B, "%d", f.name, f.type, value);
|
|
1335
1531
|
if (stored !== value)
|
|
1336
1532
|
storeInto(f.name, f.type, stored);
|
|
1337
1533
|
}
|
|
1534
|
+
releaseInline(f.type, value);
|
|
1338
1535
|
}
|
|
1339
1536
|
// Index-signature shapes CAPTURE undeclared keys into the
|
|
1340
1537
|
// overflow map.
|
|
@@ -1409,6 +1606,8 @@ export class LlDyn {
|
|
|
1409
1606
|
const n = this.lenOf(B, "%d");
|
|
1410
1607
|
const a = B.tmp();
|
|
1411
1608
|
B.line(`${a} = ${arrNewCall(host, elem, n)}`);
|
|
1609
|
+
if (recursive)
|
|
1610
|
+
this.recordBuilt(B, name, a);
|
|
1412
1611
|
const items = this.itemsOf(B, "%d");
|
|
1413
1612
|
const pathSlot = "%dcp";
|
|
1414
1613
|
B.entryAllocas.push(`${pathSlot} = alloca %ScrDynPath`);
|
|
@@ -1427,7 +1626,7 @@ export class LlDyn {
|
|
|
1427
1626
|
host.declare(`declare void @scr_arr_set_len(ptr, double)`);
|
|
1428
1627
|
const index = B.tmp();
|
|
1429
1628
|
const length = B.tmp();
|
|
1430
|
-
B.line(`${index} =
|
|
1629
|
+
B.line(`${index} = ${sizeToDouble(this.S)} ${this.S} ${i} to double`);
|
|
1431
1630
|
B.line(`${length} = fadd double ${index}, 1.0`);
|
|
1432
1631
|
B.line(`call void @scr_arr_set_len(ptr ${a}, double ${length})`);
|
|
1433
1632
|
B.br(doneLabel);
|
|
@@ -1514,7 +1713,7 @@ export class LlDyn {
|
|
|
1514
1713
|
// retry the union against the ordinary copy-based structural
|
|
1515
1714
|
// snapshot (the compiler's width-coercion stance, rather than a
|
|
1516
1715
|
// live narrowed alias).
|
|
1517
|
-
|
|
1716
|
+
const view = this.viewFn(recursive || memo);
|
|
1518
1717
|
host.declare(`declare ptr @scr_dyn_typed_ref_cached_cast(ptr, ptr, ${host.sizeType})`);
|
|
1519
1718
|
host.declare(`declare void @scr_dyn_typed_ref_cache_cast(ptr, ptr, ${host.sizeType}, ptr, ptr, ptr, i1)`);
|
|
1520
1719
|
host.declare(`declare void @scr_dyn_release_v(ptr)`);
|
|
@@ -1533,7 +1732,7 @@ export class LlDyn {
|
|
|
1533
1732
|
// pending exception rather than a NULL result.
|
|
1534
1733
|
const materialized = B.tmp();
|
|
1535
1734
|
const checked = B.tmp();
|
|
1536
|
-
B.line(`${materialized} = call ptr
|
|
1735
|
+
B.line(`${materialized} = call ptr @${view}(ptr %d)`);
|
|
1537
1736
|
B.line(`${checked} = call ptr @${name}(ptr ${materialized}, ptr %path)`);
|
|
1538
1737
|
B.line(`call void @scr_dyn_release_v(ptr ${materialized})`);
|
|
1539
1738
|
B.terminate(`ret ptr ${checked}`);
|
|
@@ -1548,7 +1747,7 @@ export class LlDyn {
|
|
|
1548
1747
|
B.line(`${hasCached} = icmp ne ptr ${cached}, null`);
|
|
1549
1748
|
const materialized = B.tmp();
|
|
1550
1749
|
const checked = B.tmp();
|
|
1551
|
-
B.line(`${materialized} = call ptr
|
|
1750
|
+
B.line(`${materialized} = call ptr @${view}(ptr %d)`);
|
|
1552
1751
|
B.line(`${checked} = call ptr @${name}(ptr ${materialized}, ptr %path)`);
|
|
1553
1752
|
B.line(`call void @scr_dyn_release_v(ptr ${materialized})`);
|
|
1554
1753
|
const ok = B.tmp();
|
|
@@ -1691,7 +1890,9 @@ export class LlDyn {
|
|
|
1691
1890
|
throw new LlvmUnsupportedError(`type:${t.kind}`);
|
|
1692
1891
|
}
|
|
1693
1892
|
}
|
|
1694
|
-
this.defs.push(`define internal ${retTy === "i1" ? "zeroext i1" : retTy} @${name}(ptr %d, ptr %path) ${FN_ATTRS} { ; check ${key}`, B.render(), `}`, ``);
|
|
1893
|
+
this.defs.push(`define internal ${retTy === "i1" ? "zeroext i1" : retTy} @${recursive || memo ? `${name}_body` : name}(ptr %d, ptr %path) ${FN_ATTRS} { ; check ${key}`, B.render(), `}`, ``);
|
|
1894
|
+
if (recursive || memo)
|
|
1895
|
+
this.emitVisitWrapper(name, t, recursive ? "build" : "memo");
|
|
1695
1896
|
return name;
|
|
1696
1897
|
}
|
|
1697
1898
|
/* ── toDynHelper (walkers.ts, ported) ─────────────────────────── */
|
|
@@ -1809,6 +2010,10 @@ export class LlDyn {
|
|
|
1809
2010
|
const keyLit = host.cstr(typeKey(t));
|
|
1810
2011
|
const r = B.tmp();
|
|
1811
2012
|
B.line(`${r} = call ptr ${typedRefConstructor(host, t)}(ptr %v, ptr ${rc.retain}, ptr ${rc.release}, ptr ${keyLit}, ${host.sizeType} ${Buffer.byteLength(typeKey(t), "utf8")}, ptr @${adapter.snapshot}, ptr ${adapter.commit})`);
|
|
2013
|
+
// The same live view as a direct box: class members for `in` and
|
|
2014
|
+
// the class name for inspection.
|
|
2015
|
+
for (const line of bindLiveArrayOps(host, adapter, r))
|
|
2016
|
+
B.line(line);
|
|
1812
2017
|
B.terminate(`ret ptr ${r}`);
|
|
1813
2018
|
break;
|
|
1814
2019
|
}
|
|
@@ -1846,9 +2051,14 @@ export class LlDyn {
|
|
|
1846
2051
|
const loadFieldOf = (fname, ft) => {
|
|
1847
2052
|
const p = B.tmp();
|
|
1848
2053
|
B.line(`${p} = getelementptr inbounds %${struct}, ptr %v, i64 0, i32 ${fieldIndex.get(fname)} ; .${llvmCommentText(fname)}`);
|
|
2054
|
+
// An inline union field lends a private stack box (ABSENT kept).
|
|
2055
|
+
if (host.inlineUnions.record(ft)) {
|
|
2056
|
+
const { tag, bits } = loadInlineUnion(B, p);
|
|
2057
|
+
return stackUnionBox(B, host.sizeType, tag, bits);
|
|
2058
|
+
}
|
|
1849
2059
|
const raw = B.tmp();
|
|
1850
|
-
B.line(`${raw} = load ${llFieldType(ft)}, ptr ${p}`);
|
|
1851
|
-
if (llFieldType(ft) !== "i8")
|
|
2060
|
+
B.line(`${raw} = load ${llFieldType(ft, false)}, ptr ${p}`);
|
|
2061
|
+
if (llFieldType(ft, false) !== "i8")
|
|
1852
2062
|
return raw;
|
|
1853
2063
|
const b = B.tmp();
|
|
1854
2064
|
B.line(`${b} = trunc i8 ${raw} to i1`);
|
|
@@ -1885,8 +2095,7 @@ export class LlDyn {
|
|
|
1885
2095
|
break;
|
|
1886
2096
|
}
|
|
1887
2097
|
const d = B.tmp();
|
|
1888
|
-
|
|
1889
|
-
if ((shape.fields.length === 0 && !shape.indexValue) || carriesListenerIdentity) {
|
|
2098
|
+
if (recordDynKeepsIdentity(shape)) {
|
|
1890
2099
|
const rc = vAdapters(host, t);
|
|
1891
2100
|
sourceAccessor = {
|
|
1892
2101
|
name: `${name}_source_access`,
|
|
@@ -1921,6 +2130,12 @@ export class LlDyn {
|
|
|
1921
2130
|
B.startBlock(lSkip);
|
|
1922
2131
|
}
|
|
1923
2132
|
}
|
|
2133
|
+
// A Dirent row takes Node's Dirent prototype (the type probes) and
|
|
2134
|
+
// its Symbol(type) key; %dtype stays readable but non-enumerable.
|
|
2135
|
+
if (isDirentShape(shape)) {
|
|
2136
|
+
host.declare(`declare void @scr_dyn_dirent_finish(ptr)`);
|
|
2137
|
+
B.line(`call void @scr_dyn_dirent_finish(ptr ${d})`);
|
|
2138
|
+
}
|
|
1924
2139
|
if (shape.indexValue) {
|
|
1925
2140
|
const iv = shape.indexValue;
|
|
1926
2141
|
host.declare(`declare ptr @scr_map_keys_js_order(ptr)`);
|
|
@@ -2309,10 +2524,10 @@ export class LlDyn {
|
|
|
2309
2524
|
B.br(done);
|
|
2310
2525
|
B.startBlock(labels.get(DYN_KIND.TYPED_REF));
|
|
2311
2526
|
{
|
|
2312
|
-
host.declare(`declare ptr @
|
|
2527
|
+
host.declare(`declare ptr @scr_dyn_typed_ref_string_view(ptr)`);
|
|
2313
2528
|
host.declare(`declare void @scr_dyn_release_v(ptr)`);
|
|
2314
2529
|
const materialized = B.tmp();
|
|
2315
|
-
B.line(`${materialized} = call ptr @
|
|
2530
|
+
B.line(`${materialized} = call ptr @scr_dyn_typed_ref_string_view(ptr %d)`);
|
|
2316
2531
|
B.line(`call void @sc_ds_buf(ptr %b, ptr ${materialized})`);
|
|
2317
2532
|
B.line(`call void @scr_dyn_release_v(ptr ${materialized})`);
|
|
2318
2533
|
B.br(done);
|
|
@@ -3039,7 +3254,7 @@ export class LlDyn {
|
|
|
3039
3254
|
const n = this.lenOf(B, "%d");
|
|
3040
3255
|
const nd = B.tmp();
|
|
3041
3256
|
const r = B.tmp();
|
|
3042
|
-
B.line(`${nd} =
|
|
3257
|
+
B.line(`${nd} = ${sizeToDouble(host.sizeType)} ${host.sizeType} ${n} to double`);
|
|
3043
3258
|
B.line(`${r} = call ptr @scr_dyn_new_num(double ${nd})`);
|
|
3044
3259
|
B.terminate(`ret ptr ${r}`);
|
|
3045
3260
|
B.startBlock(lStr);
|
|
@@ -3078,7 +3293,7 @@ export class LlDyn {
|
|
|
3078
3293
|
const n2 = B.tmp();
|
|
3079
3294
|
B.line(`${n2} = call double @scr_str_utf16_len(ptr ${s})`);
|
|
3080
3295
|
const idxD = B.tmp();
|
|
3081
|
-
B.line(`${idxD} =
|
|
3296
|
+
B.line(`${idxD} = ${sizeToDouble(host.sizeType)} ${host.sizeType} ${idx} to double`);
|
|
3082
3297
|
const inR2 = B.tmp();
|
|
3083
3298
|
B.line(`${inR2} = fcmp olt double ${idxD}, ${n2}`);
|
|
3084
3299
|
const lHit2 = B.newLabel("kg.ash");
|
|
@@ -3331,7 +3546,7 @@ export class LlDyn {
|
|
|
3331
3546
|
const index = B.tmp();
|
|
3332
3547
|
const bd = B.tmp();
|
|
3333
3548
|
const r = B.tmp();
|
|
3334
|
-
B.line(`${index} =
|
|
3549
|
+
B.line(`${index} = ${sizeToDouble(host.sizeType)} ${host.sizeType} ${i} to double`);
|
|
3335
3550
|
B.line(`${bd} = call double @scr_bytes_get(ptr ${bts}, double ${index})`);
|
|
3336
3551
|
B.line(`${r} = call ptr @scr_dyn_new_num(double ${bd})`);
|
|
3337
3552
|
B.line(`store ptr ${r}, ptr ${itemSlot}`);
|