eliscript 0.1.3 → 0.1.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/COPYING.RUNTIME +93 -0
- package/README.md +15 -3
- package/bin/eliscript-test +29 -0
- package/bootstrap/backends/README.md +5 -4
- package/bootstrap/backends/binary.eli +89 -22
- package/bootstrap/backends/capabilities.eli +9 -4
- package/bootstrap/backends/managed-layout.eli +93 -81
- package/bootstrap/backends/managed.eli +651 -125
- package/bootstrap/backends/native.eli +1791 -324
- package/bootstrap/backends/numeric.eli +71 -7
- package/bootstrap/backends/sha256.eli +165 -68
- package/bootstrap/backends/wasm.eli +461 -52
- package/bootstrap/compiler/analyzer.eli +692 -2
- package/bootstrap/compiler/compiler.eli +16 -3
- package/bootstrap/compiler/emitter.eli +80 -35
- package/bootstrap/compiler/project.eli +175 -1
- package/bootstrap/compiler/transient-analysis.eli +2 -2
- package/bootstrap/host/build.eli +1 -0
- package/bootstrap/host/build.mjs +1 -1
- package/bootstrap/host/build.mjs.map +1 -1
- package/bootstrap/host/bun.mjs +7 -9
- package/bootstrap/host/bun.mjs.map +1 -1
- package/bootstrap/host/check-cli-ground.eli +47 -5
- package/bootstrap/host/check-cli-ground.mjs +60 -19
- package/bootstrap/host/check-cli-ground.mjs.map +1 -1
- package/bootstrap/host/check-cli.mjs +41 -1
- package/bootstrap/host/check-cli.mjs.map +1 -1
- package/bootstrap/host/compiler-session.eli +136 -22
- package/bootstrap/host/eliscript-cli.mjs +1 -1
- package/bootstrap/host/eliscript-cli.mjs.map +1 -1
- package/bootstrap/host/evaluation-cli.eli +33 -1
- package/bootstrap/host/evaluation-cli.mjs +65 -28
- package/bootstrap/host/evaluation-cli.mjs.map +1 -1
- package/bootstrap/host/evaluation.eli +651 -42
- package/bootstrap/host/evaluation.mjs +884 -72
- package/bootstrap/host/evaluation.mjs.map +1 -1
- package/bootstrap/host/project-cli-ground.eli +6 -1
- package/bootstrap/host/project-cli-ground.mjs +33 -32
- package/bootstrap/host/project-cli-ground.mjs.map +1 -1
- package/bootstrap/host/project-cli.mjs +1 -1
- package/bootstrap/host/project-cli.mjs.map +1 -1
- package/bootstrap/host/project-ground.eli +266 -45
- package/bootstrap/host/project-ground.mjs +429 -159
- package/bootstrap/host/project-ground.mjs.map +1 -1
- package/bootstrap/host/project.mjs +30 -40
- package/bootstrap/host/project.mjs.map +1 -1
- package/bootstrap/host/test-cli.eli +379 -0
- package/bootstrap/host/test-cli.mjs +494 -0
- package/bootstrap/host/test-cli.mjs.map +1 -0
- package/browser/README.md +7 -0
- package/browser/host.mjs +21 -29
- package/browser/host.mjs.map +1 -1
- package/browser/worker.mjs +7 -9
- package/browser/worker.mjs.map +1 -1
- package/compiler/eliscript-analyzer.el +694 -0
- package/compiler/eliscript-cli.el +66 -22
- package/compiler/eliscript-emitter.el +67 -43
- package/compiler/eliscript-ir-emitter.el +71 -36
- package/compiler/eliscript-project.el +360 -80
- package/compiler/eliscript-transient-analysis.el +5 -5
- package/compiler/eliscript.el +6 -0
- package/dist/backends/binary.mjs +148 -26
- package/dist/backends/binary.mjs.map +1 -1
- package/dist/backends/capabilities.mjs +11 -4
- package/dist/backends/capabilities.mjs.map +1 -1
- package/dist/backends/elf.mjs +4 -4
- package/dist/backends/elf.mjs.map +1 -1
- package/dist/backends/managed-layout.mjs +53 -56
- package/dist/backends/managed-layout.mjs.map +1 -1
- package/dist/backends/managed.mjs +1116 -375
- package/dist/backends/managed.mjs.map +1 -1
- package/dist/backends/memory.mjs +24 -26
- package/dist/backends/memory.mjs.map +1 -1
- package/dist/backends/native.mjs +2529 -434
- package/dist/backends/native.mjs.map +1 -1
- package/dist/backends/numeric.mjs +140 -33
- package/dist/backends/numeric.mjs.map +1 -1
- package/dist/backends/optimize.mjs +2 -2
- package/dist/backends/optimize.mjs.map +1 -1
- package/dist/backends/regexp.mjs +33 -35
- package/dist/backends/regexp.mjs.map +1 -1
- package/dist/backends/sha256.mjs +159 -59
- package/dist/backends/sha256.mjs.map +1 -1
- package/dist/backends/wasm.mjs +609 -73
- package/dist/backends/wasm.mjs.map +1 -1
- package/dist/bootstrap/analyzer.mjs +1018 -2
- package/dist/bootstrap/analyzer.mjs.map +1 -1
- package/dist/bootstrap/compiler.mjs +30 -23
- package/dist/bootstrap/compiler.mjs.map +1 -1
- package/dist/bootstrap/emitter.mjs +206 -161
- package/dist/bootstrap/emitter.mjs.macro-origins.json +16 -16
- package/dist/bootstrap/emitter.mjs.map +1 -1
- package/dist/bootstrap/expander.mjs +27 -31
- package/dist/bootstrap/expander.mjs.map +1 -1
- package/dist/bootstrap/ir.mjs +22 -24
- package/dist/bootstrap/ir.mjs.map +1 -1
- package/dist/bootstrap/project.mjs +246 -1
- package/dist/bootstrap/project.mjs.map +1 -1
- package/dist/bootstrap/reader.mjs +2 -2
- package/dist/bootstrap/reader.mjs.map +1 -1
- package/dist/bootstrap/source-map.mjs +34 -48
- package/dist/bootstrap/source-map.mjs.map +1 -1
- package/dist/bootstrap/transient-analysis.mjs +2 -2
- package/dist/bootstrap/transient-analysis.mjs.map +1 -1
- package/dist/browser/compiler.js +106 -106
- package/dist/browser/host.mjs +21 -29
- package/dist/browser/loader.js +1 -1
- package/dist/browser/worker.mjs +95 -95
- package/dist/compiler-artifact.json +1 -1
- package/dist/host/compiler-session.mjs +405 -228
- package/dist/host/compiler-session.mjs.map +1 -1
- package/dist/host/compiler-tools.mjs +44 -46
- package/dist/host/compiler-tools.mjs.map +1 -1
- package/dist/literal-sources/runtime/core/array-map.eli +45 -0
- package/dist/literal-sources/runtime/core/collection-internals.eli +22 -2
- package/dist/literal-sources/runtime/core/collection.eli +282 -23
- package/dist/literal-sources/runtime/core/data-text.eli +196 -13
- package/dist/literal-sources/runtime/core/data.eli +1 -1
- package/dist/literal-sources/runtime/core/identifier.eli +1 -1
- package/dist/literal-sources/runtime/core/lazy-sequence.eli +822 -44
- package/dist/literal-sources/runtime/core/list.eli +1 -1
- package/dist/literal-sources/runtime/core/map.eli +1 -1
- package/dist/literal-sources/runtime/core/metadata-internals.eli +2 -2
- package/dist/literal-sources/runtime/core/metadata.eli +2 -2
- package/dist/literal-sources/{stdlib/core/object.eli → runtime/core/object-impl.eli} +6 -6
- package/dist/literal-sources/runtime/core/object.eli +1 -1
- package/dist/literal-sources/runtime/core/order.eli +3 -3
- package/dist/literal-sources/runtime/core/persistent-kind.eli +1 -1
- package/dist/literal-sources/{stdlib/core/protocol.eli → runtime/core/protocol-impl.eli} +2 -2
- package/dist/literal-sources/runtime/core/protocol.eli +5 -3
- package/dist/literal-sources/runtime/core/queue.eli +1 -1
- package/dist/literal-sources/runtime/core/record.eli +3 -3
- package/dist/literal-sources/runtime/core/regex.eli +2 -2
- package/dist/literal-sources/runtime/core/sequence.eli +1 -1
- package/dist/literal-sources/runtime/core/set-algebra.eli +1 -1
- package/dist/literal-sources/runtime/core/set.eli +1 -1
- package/dist/literal-sources/runtime/core/sorted.eli +4 -4
- package/dist/literal-sources/{stdlib/core/text.eli → runtime/core/text-impl.eli} +2 -2
- package/dist/literal-sources/runtime/core/text.eli +1 -1
- package/dist/literal-sources/runtime/core/transducer.eli +24 -2
- package/dist/literal-sources/runtime/core/transient.eli +7 -5
- package/dist/literal-sources/runtime/core/type.eli +1 -1
- package/dist/literal-sources/runtime/core/value-internals.eli +3 -3
- package/dist/literal-sources/runtime/core/value.eli +2 -2
- package/dist/literal-sources/runtime/core/vector.eli +5 -2
- package/dist/literal-sources/{stdlib → runtime/managed}/managed-literal-protocols.eli +100 -34
- package/dist/literal-sources/{stdlib → runtime/managed}/managed-literals.eli +406 -81
- package/{stdlib → dist/literal-sources/runtime/managed}/managed-queue-state.eli +1 -1
- package/{stdlib → dist/literal-sources/runtime/managed}/managed-sorted-state.eli +1 -1
- package/dist/literal-sources/runtime/managed/managed-transient-state.eli +1206 -0
- package/{stdlib → dist/literal-sources/runtime/managed}/managed-value-state.eli +30 -6
- package/dist/literal-sources/{stdlib → runtime/managed}/managed-vector-view-state.eli +1 -1
- package/dist/literal-sources/runtime/wire/http-rpc.eli +1 -1
- package/dist/literal-sources/runtime/wire/markdown.eli +1 -1
- package/dist/literal-sources/runtime/wire/schema.eli +1 -1
- package/dist/literal-sources/stdlib/bit.eli +89 -1
- package/dist/literal-sources/stdlib/data.eli +522 -0
- package/dist/literal-sources/stdlib/interop/object.eli +39 -0
- package/dist/literal-sources/stdlib/persistent-list.eli +60 -21
- package/dist/literal-sources/stdlib/persistent-map.eli +335 -324
- package/dist/literal-sources/stdlib/persistent-set.eli +8 -6
- package/dist/literal-sources/stdlib/persistent-vector.eli +18 -18
- package/dist/literal-sources/stdlib/protocol.eli +63 -0
- package/{stdlib/core → dist/literal-sources/stdlib}/set.eli +8 -8
- package/dist/literal-sources/stdlib/string.eli +362 -0
- package/dist/runtime/lisp/async-runtime.mjs +55 -59
- package/dist/runtime/lisp/async-runtime.mjs.map +1 -1
- package/dist/runtime/lisp/builtins.mjs +232 -280
- package/dist/runtime/lisp/builtins.mjs.map +1 -1
- package/dist/runtime/lisp/cli.mjs +159 -167
- package/dist/runtime/lisp/cli.mjs.map +1 -1
- package/dist/runtime/lisp/compiler.mjs +359 -419
- package/dist/runtime/lisp/compiler.mjs.map +1 -1
- package/dist/runtime/lisp/core.mjs +24 -24
- package/dist/runtime/lisp/core.mjs.map +1 -1
- package/dist/runtime/lisp/evaluator.mjs +315 -385
- package/dist/runtime/lisp/evaluator.mjs.map +1 -1
- package/dist/runtime/lisp/extensions.mjs +85 -103
- package/dist/runtime/lisp/extensions.mjs.map +1 -1
- package/dist/runtime/lisp/host-io.mjs +106 -122
- package/dist/runtime/lisp/host-io.mjs.map +1 -1
- package/dist/runtime/lisp/io-worker.mjs +117 -135
- package/dist/runtime/lisp/io-worker.mjs.map +1 -1
- package/dist/runtime/lisp/keymap.mjs +5 -5
- package/dist/runtime/lisp/keymap.mjs.map +1 -1
- package/dist/runtime/lisp/macros-forms.mjs +49 -51
- package/dist/runtime/lisp/macros-forms.mjs.map +1 -1
- package/dist/runtime/lisp/reader-format.mjs +31 -31
- package/dist/runtime/lisp/reader-format.mjs.map +1 -1
- package/dist/runtime/lisp/regexp-buffer.mjs +9 -9
- package/dist/runtime/lisp/regexp-buffer.mjs.map +1 -1
- package/dist/runtime/math.mjs +32 -38
- package/dist/runtime/math.mjs.map +1 -1
- package/dist/runtime/number-radix.mjs +5 -7
- package/dist/runtime/number-radix.mjs.map +1 -1
- package/dist/runtime/primitives.mjs +81 -46
- package/dist/runtime/primitives.mjs.macro-origins.json +294 -44
- package/dist/runtime/primitives.mjs.map +1 -1
- package/dist/runtime/unicode-case.mjs +6 -6
- package/dist/runtime/unicode-case.mjs.map +1 -1
- package/dist/runtime.eli +3068 -1882
- package/dist/stage3-release.json +1 -1
- package/dist/stdlib/async.mjs +1838 -0
- package/dist/stdlib/bit.mjs +116 -0
- package/dist/stdlib/collection.mjs +193 -0
- package/dist/stdlib/core.mjs +28 -0
- package/dist/stdlib/data-text.mjs +54 -0
- package/dist/stdlib/data.mjs +601 -0
- package/dist/stdlib/devtools.mjs +565 -0
- package/dist/stdlib/diff.mjs +180 -0
- package/dist/stdlib/fn.mjs +164 -0
- package/dist/stdlib/hierarchy.mjs +189 -0
- package/dist/stdlib/identifier.mjs +33 -0
- package/dist/stdlib/interop/js.mjs +706 -0
- package/dist/stdlib/interop/object.mjs +40 -0
- package/dist/stdlib/json.mjs +843 -0
- package/dist/stdlib/lazy-sequence.mjs +117 -0
- package/dist/stdlib/math.mjs +386 -0
- package/dist/stdlib/meta.mjs +21 -0
- package/dist/stdlib/multimethod.mjs +345 -0
- package/dist/stdlib/numeric.mjs +327 -0
- package/dist/stdlib/order.mjs +194 -0
- package/dist/stdlib/persistent-list.mjs +171 -0
- package/dist/stdlib/persistent-map.mjs +781 -0
- package/dist/stdlib/persistent-queue.mjs +44 -0
- package/dist/stdlib/persistent-set.mjs +225 -0
- package/dist/stdlib/persistent-vector.mjs +316 -0
- package/dist/stdlib/portable/data-text.mjs +1094 -0
- package/dist/stdlib/portable/data.mjs +62 -0
- package/dist/stdlib/portable/identifier.mjs +179 -0
- package/dist/stdlib/portable/metadata.mjs +63 -0
- package/dist/stdlib/portable/object.mjs +140 -0
- package/dist/stdlib/portable/sequence.mjs +142 -0
- package/dist/stdlib/portable/text.mjs +111 -0
- package/dist/stdlib/pprint.mjs +807 -0
- package/dist/stdlib/protocol.mjs +61 -0
- package/dist/stdlib/record.mjs +25 -0
- package/dist/stdlib/regex.mjs +115 -0
- package/dist/stdlib/result.mjs +198 -0
- package/dist/stdlib/schema.mjs +2828 -0
- package/dist/stdlib/seq.mjs +913 -0
- package/dist/stdlib/set.mjs +317 -0
- package/dist/stdlib/sorted.mjs +56 -0
- package/dist/stdlib/state.mjs +451 -0
- package/dist/stdlib/string.mjs +494 -0
- package/dist/stdlib/tap.mjs +187 -0
- package/dist/stdlib/test.mjs +669 -0
- package/dist/stdlib/time.mjs +522 -0
- package/dist/stdlib/transducer.mjs +85 -0
- package/dist/stdlib/transient.mjs +32 -0
- package/dist/stdlib/type.mjs +28 -0
- package/dist/stdlib/uuid.mjs +377 -0
- package/dist/stdlib/value.mjs +334 -0
- package/dist/stdlib/walk.mjs +243 -0
- package/dist/stdlib/wire/gepo.mjs +28 -0
- package/dist/stdlib/wire/mdp.mjs +13 -0
- package/dist/stdlib/wire/mds.mjs +10 -0
- package/dist/stdlib/zipper.mjs +1025 -0
- package/editor/README.md +15 -0
- package/editor/eliscript-data.el +221 -8
- package/editor/eliscript-mode.el +207 -48
- package/editor/eliscript-runtime.el +6 -3
- package/package.json +49 -15
- package/platform/README.md +6 -0
- package/platform/browser.mjs +10 -12
- package/platform/browser.mjs.map +1 -1
- package/runtime/README.md +12 -5
- package/runtime/core/array-map.eli +538 -0
- package/runtime/core/array-map.mjs +651 -0
- package/runtime/core/array-map.mjs.map +1 -0
- package/runtime/core/collection-internals.eli +85 -33
- package/runtime/core/collection-internals.mjs +245 -193
- package/runtime/core/collection-internals.mjs.map +1 -1
- package/runtime/core/collection.eli +105 -3
- package/runtime/core/collection.mjs +190 -53
- package/runtime/core/collection.mjs.map +1 -1
- package/runtime/core/data-text.eli +224 -16
- package/runtime/core/data-text.mjs +345 -83
- package/runtime/core/data-text.mjs.map +1 -1
- package/runtime/core/data.eli +50 -33
- package/runtime/core/data.mjs +72 -36
- package/runtime/core/data.mjs.map +1 -1
- package/runtime/core/identifier.mjs +15 -19
- package/runtime/core/identifier.mjs.map +1 -1
- package/runtime/core/lazy-sequence.eli +885 -15
- package/runtime/core/lazy-sequence.mjs +1265 -38
- package/runtime/core/lazy-sequence.mjs.map +1 -1
- package/runtime/core/map-internals.eli +209 -1
- package/runtime/core/map-internals.mjs +359 -71
- package/runtime/core/map-internals.mjs.map +1 -1
- package/runtime/core/map.eli +75 -7
- package/runtime/core/map.mjs +122 -47
- package/runtime/core/map.mjs.map +1 -1
- package/{stdlib/core/object.eli → runtime/core/object-impl.eli} +6 -6
- package/runtime/core/object-impl.mjs +5 -5
- package/runtime/core/object-impl.mjs.map +1 -1
- package/runtime/core/order.eli +15 -3
- package/runtime/core/order.mjs +23 -8
- package/runtime/core/order.mjs.map +1 -1
- package/runtime/core/persistent-kind.mjs +9 -13
- package/runtime/core/persistent-kind.mjs.map +1 -1
- package/runtime/core/protocol-error.mjs +9 -11
- package/runtime/core/protocol-error.mjs.map +1 -1
- package/{stdlib/core/protocol.eli → runtime/core/protocol-impl.eli} +2 -2
- package/runtime/core/protocol-impl.mjs +10 -10
- package/runtime/core/protocol-impl.mjs.map +1 -1
- package/runtime/core/queue.mjs +14 -16
- package/runtime/core/queue.mjs.map +1 -1
- package/runtime/core/record.eli +2 -2
- package/runtime/core/record.mjs +13 -17
- package/runtime/core/record.mjs.map +1 -1
- package/runtime/core/regex.mjs +18 -22
- package/runtime/core/regex.mjs.map +1 -1
- package/runtime/core/sequence.eli +33 -31
- package/runtime/core/sequence.mjs +60 -93
- package/runtime/core/sequence.mjs.map +1 -1
- package/runtime/core/set.eli +53 -27
- package/runtime/core/set.mjs +113 -82
- package/runtime/core/set.mjs.map +1 -1
- package/runtime/core/sorted.mjs +91 -108
- package/runtime/core/sorted.mjs.map +1 -1
- package/{stdlib/core/text.eli → runtime/core/text-impl.eli} +2 -2
- package/runtime/core/text-impl.mjs +1 -1
- package/runtime/core/text-impl.mjs.map +1 -1
- package/runtime/core/transducer.eli +24 -0
- package/runtime/core/transducer.mjs +27 -1
- package/runtime/core/transducer.mjs.map +1 -1
- package/runtime/core/transient-internals.eli +12 -4
- package/runtime/core/transient-internals.mjs +19 -6
- package/runtime/core/transient-internals.mjs.map +1 -1
- package/runtime/core/transient.eli +31 -0
- package/runtime/core/transient.mjs +33 -2
- package/runtime/core/transient.mjs.map +1 -1
- package/runtime/core/value-internals.mjs +29 -35
- package/runtime/core/value-internals.mjs.map +1 -1
- package/runtime/core/vector.eli +73 -20
- package/runtime/core/vector.mjs +159 -156
- package/runtime/core/vector.mjs.map +1 -1
- package/runtime/literals.eli +16 -9
- package/runtime/literals.mjs +25 -9
- package/runtime/literals.mjs.map +1 -1
- package/{stdlib → runtime/managed}/managed-literal-protocols.eli +100 -34
- package/{stdlib → runtime/managed}/managed-literals.eli +406 -81
- package/{dist/literal-sources/stdlib → runtime/managed}/managed-queue-state.eli +1 -1
- package/runtime/managed/managed-runtime-array-map.eli +45 -0
- package/{stdlib → runtime/managed}/managed-runtime-collection-internals.eli +22 -2
- package/{stdlib → runtime/managed}/managed-runtime-collection.eli +282 -23
- package/{stdlib → runtime/managed}/managed-runtime-data-text.eli +196 -13
- package/{stdlib → runtime/managed}/managed-runtime-data.eli +1 -1
- package/{stdlib → runtime/managed}/managed-runtime-identifier.eli +1 -1
- package/runtime/managed/managed-runtime-lazy-sequence.eli +935 -0
- package/{stdlib → runtime/managed}/managed-runtime-list.eli +1 -1
- package/{stdlib → runtime/managed}/managed-runtime-map.eli +1 -1
- package/{stdlib → runtime/managed}/managed-runtime-metadata-internals.eli +2 -2
- package/{stdlib → runtime/managed}/managed-runtime-metadata.eli +2 -2
- package/{stdlib → runtime/managed}/managed-runtime-object.eli +1 -1
- package/{stdlib → runtime/managed}/managed-runtime-order.eli +3 -3
- package/{stdlib → runtime/managed}/managed-runtime-persistent-kind.eli +1 -1
- package/{stdlib → runtime/managed}/managed-runtime-protocol.eli +5 -3
- package/{stdlib → runtime/managed}/managed-runtime-queue.eli +1 -1
- package/{stdlib → runtime/managed}/managed-runtime-record.eli +3 -3
- package/{stdlib → runtime/managed}/managed-runtime-regex.eli +2 -2
- package/{stdlib → runtime/managed}/managed-runtime-sequence.eli +1 -1
- package/{stdlib → runtime/managed}/managed-runtime-set-algebra.eli +1 -1
- package/{stdlib → runtime/managed}/managed-runtime-set.eli +1 -1
- package/{stdlib → runtime/managed}/managed-runtime-sorted.eli +4 -4
- package/{stdlib → runtime/managed}/managed-runtime-text.eli +1 -1
- package/{stdlib → runtime/managed}/managed-runtime-transducer.eli +24 -2
- package/{stdlib → runtime/managed}/managed-runtime-transient.eli +7 -5
- package/{stdlib → runtime/managed}/managed-runtime-type.eli +1 -1
- package/{stdlib → runtime/managed}/managed-runtime-value-internals.eli +3 -3
- package/{stdlib → runtime/managed}/managed-runtime-value.eli +2 -2
- package/{stdlib → runtime/managed}/managed-runtime-vector.eli +5 -2
- package/{dist/literal-sources/stdlib → runtime/managed}/managed-sorted-state.eli +1 -1
- package/runtime/managed/managed-transient-state.eli +1206 -0
- package/{dist/literal-sources/stdlib → runtime/managed}/managed-value-state.eli +30 -6
- package/{stdlib → runtime/managed}/managed-vector-view-state.eli +1 -1
- package/{stdlib → runtime/managed}/managed-wire-http-rpc.eli +1 -1
- package/{stdlib → runtime/managed}/managed-wire-markdown.eli +1 -1
- package/{stdlib → runtime/managed}/managed-wire-schema.eli +1 -1
- package/runtime/math.mjs +32 -38
- package/runtime/math.mjs.map +1 -1
- package/runtime/number-radix.mjs +5 -7
- package/runtime/number-radix.mjs.map +1 -1
- package/runtime/primitives.eli +19 -6
- package/runtime/primitives.mjs +81 -46
- package/runtime/primitives.mjs.map +1 -1
- package/runtime/source-mapping.mjs +17 -23
- package/runtime/source-mapping.mjs.map +1 -1
- package/runtime/testing/map.eli +70 -41
- package/runtime/testing/map.mjs +57 -34
- package/runtime/testing/map.mjs.map +1 -1
- package/runtime/unicode-case.mjs +6 -6
- package/runtime/unicode-case.mjs.map +1 -1
- package/runtime/wire/http-rpc.mjs +12 -18
- package/runtime/wire/http-rpc.mjs.map +1 -1
- package/runtime/wire/markdown.mjs +42 -42
- package/runtime/wire/markdown.mjs.map +1 -1
- package/runtime/wire/schema.mjs +13 -13
- package/runtime/wire/schema.mjs.map +1 -1
- package/runtime/worker-value-codec.mjs +5 -7
- package/runtime/worker-value-codec.mjs.map +1 -1
- package/runtime/worker-value-stream.mjs +128 -135
- package/runtime/worker-value-stream.mjs.map +1 -1
- package/runtime/worker.mjs +75 -89
- package/runtime/worker.mjs.map +1 -1
- package/stdlib/README.md +25 -18
- package/stdlib/async.eli +1245 -0
- package/stdlib/bit.eli +89 -1
- package/stdlib/bit.mjs +89 -2
- package/stdlib/bit.mjs.map +1 -1
- package/stdlib/{core/collection.eli → collection.eli} +39 -4
- package/stdlib/core.eli +956 -0
- package/stdlib/data-text.eli +62 -1091
- package/stdlib/data.eli +517 -37
- package/stdlib/devtools.eli +399 -0
- package/stdlib/diff.eli +134 -0
- package/stdlib/{function.eli → fn.eli} +1 -1
- package/stdlib/identifier.eli +21 -136
- package/stdlib/interop/object.eli +39 -0
- package/stdlib/{core/lazy-sequence.eli → lazy-sequence.eli} +28 -2
- package/stdlib/math.eli +267 -0
- package/stdlib/{core/metadata.eli → meta.eli} +2 -2
- package/stdlib/{core/order.eli → order.eli} +6 -6
- package/stdlib/persistent-list.eli +60 -21
- package/stdlib/persistent-map.eli +335 -324
- package/stdlib/persistent-set.eli +8 -6
- package/stdlib/persistent-vector.eli +18 -18
- package/stdlib/portable/data-text.eli +1092 -0
- package/stdlib/portable/data.eli +42 -0
- package/stdlib/portable/identifier.eli +147 -0
- package/stdlib/{metadata.eli → portable/metadata.eli} +5 -5
- package/stdlib/{object.eli → portable/object.eli} +1 -1
- package/stdlib/{sequence.eli → portable/sequence.eli} +1 -1
- package/stdlib/{text.eli → portable/text.eli} +1 -1
- package/stdlib/pprint.eli +588 -0
- package/stdlib/protocol.eli +63 -0
- package/stdlib/{core/record.eli → record.eli} +2 -2
- package/stdlib/regex.eli +70 -0
- package/stdlib/result.eli +53 -44
- package/stdlib/schema.eli +1886 -0
- package/stdlib/{core/seq.eli → seq.eli} +97 -90
- package/{dist/literal-sources/stdlib/core → stdlib}/set.eli +8 -8
- package/stdlib/{core/sorted.eli → sorted.eli} +2 -2
- package/stdlib/{state/atom.eli → state.eli} +137 -7
- package/stdlib/string.eli +362 -0
- package/stdlib/tap.eli +135 -0
- package/stdlib/test.eli +566 -0
- package/stdlib/time.eli +419 -0
- package/stdlib/{core/transducer.eli → transducer.eli} +4 -2
- package/stdlib/{core/transient.eli → transient.eli} +11 -5
- package/stdlib/{core/type.eli → type.eli} +2 -2
- package/stdlib/uuid.eli +288 -0
- package/stdlib/{core/walk.eli → walk.eli} +6 -6
- package/stdlib/{gepo.eli → wire/gepo.eli} +2 -2
- package/stdlib/{mdp.eli → wire/mdp.eli} +2 -2
- package/stdlib/{mds.eli → wire/mds.eli} +2 -2
- package/stdlib/{core/zipper.eli → zipper.eli} +179 -138
- package/tests/helpers/wasm-managed-math-node.mjs +495 -582
- package/tools/acceptance/check-ground.mjs +106 -132
- package/tools/acceptance/check.mjs +16 -16
- package/tools/acceptance/retained-performance-snapshot.mjs +265 -149
- package/tools/acceptance/retained-soak.mjs +5 -7
- package/tools/acceptance/retained-transient.mjs +5 -7
- package/tools/backends/build.mjs +373 -95
- package/tools/backends/compiler-bootstrap.mjs +271 -317
- package/tools/backends/compiler-browser.mjs +7 -9
- package/tools/backends/compiler-build.mjs +77 -97
- package/tools/backends/compiler-cli-ground.mjs +47 -47
- package/tools/backends/compiler-data-transport.mjs +27 -31
- package/tools/backends/compiler-host-iteration.mjs +13 -21
- package/tools/backends/compiler-host-record.mjs +28 -34
- package/tools/backends/compiler-metadata.mjs +145 -53
- package/tools/backends/compiler-package-ground.mjs +39 -47
- package/tools/backends/compiler-package-loader.mjs +164 -206
- package/tools/backends/compiler-session.mjs +432 -324
- package/tools/backends/compiler-worker.mjs +79 -89
- package/tools/backends/dist/bootstrap-js-stages.mjs +17 -19
- package/tools/backends/dist/bootstrap-js-stages.mjs.map +1 -1
- package/tools/backends/dist/managed-ir-inventory.mjs +1 -1
- package/tools/backends/dist/managed-ir-inventory.mjs.map +1 -1
- package/tools/backends/dist/release-cli.mjs +151 -22
- package/tools/backends/dist/release-cli.mjs.map +1 -1
- package/tools/backends/dist/run-artifact.mjs +54 -76
- package/tools/backends/dist/run-artifact.mjs.map +1 -1
- package/tools/backends/managed-foreign-binding.mjs +370 -114
- package/tools/backends/managed-host-ground.mjs +14 -17
- package/tools/backends/managed-host-lifecycle.mjs +42 -53
- package/tools/backends/managed-host-object-realm.mjs +121 -111
- package/tools/backends/managed-host-proxy.mjs +5 -7
- package/tools/backends/managed-host-runtime.mjs +6295 -4350
- package/tools/backends/managed-host.mjs +234 -188
- package/tools/backends/managed-layout.mjs +53 -56
- package/tools/backends/managed-module-graph-ground.mjs +488 -568
- package/tools/backends/managed-module-graph.mjs +62 -76
- package/tools/backends/managed-runtime-host-ground.mjs +352 -400
- package/tools/backends/managed-runtime.mjs +227 -266
- package/tools/backends/managed-source-view-ground.mjs +165 -161
- package/tools/backends/managed-source-view.mjs +415 -154
- package/tools/backends/native-managed-runtime.mjs +96 -138
- package/tools/backends/native-memory.mjs +1122 -742
- package/tools/backends/native-node-ffi.mjs +2439 -0
- package/tools/backends/native-node-memory.mjs +793 -383
- package/tools/backends/native-node-runner.mjs +1458 -579
- package/tools/backends/native-node-watchdog.mjs +12 -14
- package/tools/backends/native-node-worker.mjs +46 -50
- package/tools/backends/stage3-targets.mjs +2 -2
- package/tools/bootstrap-runtime.el +4 -4
- package/tools/collections/transient-builder-benchmark.mjs +17 -17
- package/tools/project/check-cli.eli +27 -3
- package/tools/project/project-cli.eli +1 -1
- package/tools/testing/maintained-suite-source.mjs +5 -7
- package/tools/testing/maintained-suite-source.mjs.map +1 -1
- package/dist/literal-sources/stdlib/core/data.eli +0 -306
- package/dist/literal-sources/stdlib/managed-transient-state.eli +0 -353
- package/stdlib/core/data-text.eli +0 -16
- package/stdlib/core/data.eli +0 -306
- package/stdlib/core/identifier.eli +0 -32
- package/stdlib/core/regex.eli +0 -17
- package/stdlib/deferred.eli +0 -70
- package/stdlib/managed-runtime-lazy-sequence.eli +0 -157
- package/stdlib/managed-transient-state.eli +0 -353
- /package/{stdlib → runtime/managed}/managed-protocol-error.eli +0 -0
- /package/{stdlib → runtime/managed}/managed-runtime-literals.eli +0 -0
- /package/{stdlib → runtime/managed}/managed-runtime-truth.eli +0 -0
- /package/{stdlib → runtime/managed}/managed-testing-value.eli +0 -0
|
@@ -1,12 +1,13 @@
|
|
|
1
1
|
(module eliscript.backend.wasm
|
|
2
2
|
(import "./optimize.mjs" optimize-program)
|
|
3
|
-
(import "./numeric.mjs" lower-numeric-program optimize-numeric-program numeric-pure tree-size backend-fail find-function
|
|
3
|
+
(import "./numeric.mjs" lower-numeric-program optimize-numeric-program numeric-pure tree-size backend-fail find-function
|
|
4
|
+
runtime-body-cache-get mark-trusted-runtime-program trusted-runtime-program-p)
|
|
4
5
|
|
|
5
6
|
(import "./memory.mjs" lower-memory-program)
|
|
6
7
|
(import "./capabilities.mjs" prepare-host-capabilities host-capability-index)
|
|
7
8
|
(import "./managed.mjs" lower-managed-program lower-managed-project)
|
|
8
9
|
(import "./binary.mjs" binary-output binary-byte binary-push binary-child binary-length binary-resume
|
|
9
|
-
binary-append binary-append-owned binary-finish)
|
|
10
|
+
binary-append binary-append-owned binary-to-u8 binary-append-u8 binary-finish)
|
|
10
11
|
|
|
11
12
|
;; Byte encoding and instruction selection are Eliscript algorithms. The
|
|
12
13
|
;; returned ordinary byte array needs no assembler, linker, or optimizer.
|
|
@@ -149,12 +150,13 @@
|
|
|
149
150
|
(defun emit-trapping-bytes (output expression bytes &optional terminal)
|
|
150
151
|
(let ((state (get output :wasmDebug nil)) (range nil))
|
|
151
152
|
(when state
|
|
152
|
-
(let ((sites (get state :trapSites))
|
|
153
|
-
|
|
153
|
+
(let* ((sites (get state :trapSites))
|
|
154
|
+
(site-id (+ (get state :trapSiteBase 0) (1+ (js-length sites)))))
|
|
155
|
+
(binary-push output 65) (positive-signed-leb output site-id)
|
|
154
156
|
(binary-push output 36 0)
|
|
155
157
|
(setq range (js-object :kind "trap-site" :function (get state :function) :functionIndex (get state :functionIndex)
|
|
156
158
|
:depth (get state :depth) :start (js-length output) :end 0 :span (get expression :span nil)
|
|
157
|
-
:site
|
|
159
|
+
:site site-id))
|
|
158
160
|
(js-call sites :push range) (js-call (get state :ranges) :push range)))
|
|
159
161
|
(append-bytes output bytes)
|
|
160
162
|
(when range
|
|
@@ -565,6 +567,7 @@
|
|
|
565
567
|
(backend-fail nil "typed WASM emitter requires a program object"))
|
|
566
568
|
(let* ((functions (get program :functions)) (copies (js-array))
|
|
567
569
|
(memory (= (get program :abi) "memory-u32"))
|
|
570
|
+
(workspace nil)
|
|
568
571
|
(copy (Object/assign (js-object) program)) (index 0))
|
|
569
572
|
(unless (Array/isArray functions)
|
|
570
573
|
(backend-fail program "typed WASM emitter requires declared functions"))
|
|
@@ -573,9 +576,18 @@
|
|
|
573
576
|
(unless (and (not (nil? function)) (= (value-type function) "object")
|
|
574
577
|
(not (Array/isArray function)) (Array/isArray (get function :locals)))
|
|
575
578
|
(backend-fail program "typed WASM function requires a locals array"))
|
|
576
|
-
(let ((
|
|
579
|
+
(let* ((fn-body (get function :body))
|
|
580
|
+
(cached (when memory (runtime-body-cache-get fn-body)))
|
|
581
|
+
(function-copy (Object/assign (js-object) function)))
|
|
577
582
|
(put function-copy :locals (js-call (get function :locals) :slice))
|
|
578
|
-
(
|
|
583
|
+
(if (and cached (get cached :frozen))
|
|
584
|
+
(progn
|
|
585
|
+
(unless (get cached :wasmValidated)
|
|
586
|
+
(unless workspace (setq workspace (make-wasm-validation-workspace)))
|
|
587
|
+
(validate-fresh-wasm-expression fn-body function memory workspace)
|
|
588
|
+
(put cached :wasmValidated t))
|
|
589
|
+
(put function-copy :body fn-body))
|
|
590
|
+
(put function-copy :body (copy-wasm-expression fn-body function memory)))
|
|
579
591
|
(js-call copies :push function-copy)))
|
|
580
592
|
(setq index (1+ index)))
|
|
581
593
|
(put copy :functions copies) copy))
|
|
@@ -696,6 +708,10 @@
|
|
|
696
708
|
(unless (js-call indices :has text)
|
|
697
709
|
(setq index (js-length texts))
|
|
698
710
|
(js-call texts :push text) (js-call indices :set text index))
|
|
711
|
+
(let ((refs (get output :wasmDataRefs nil)))
|
|
712
|
+
(when refs
|
|
713
|
+
(js-call refs :push text)
|
|
714
|
+
(js-call (get output :wasmDataRefIndices) :push index)))
|
|
699
715
|
;; Passive segments remain immutable and reusable after earlier copies
|
|
700
716
|
;; are mutated. No character callbacks, imports or initializer IR exist.
|
|
701
717
|
(emit-expression output (js-nth 0 children))
|
|
@@ -1036,8 +1052,212 @@
|
|
|
1036
1052
|
(while (< index (js-length children))
|
|
1037
1053
|
(prepare-indirect-calls (js-nth index children) signature-map allowed-domain-sigs enabled) (setq index (1+ index)))) expression)
|
|
1038
1054
|
|
|
1055
|
+
(defun replay-wasm-debug-body (debug function host-count index count body-start body-end ranges local-entries-start instructions-start size-start)
|
|
1056
|
+
(let* ((source (get function :source nil))
|
|
1057
|
+
(dst-ranges (get debug :ranges))
|
|
1058
|
+
(dst-sites (get debug :trapSites))
|
|
1059
|
+
(ri 0)
|
|
1060
|
+
(rlen (js-length ranges)))
|
|
1061
|
+
(while (< ri rlen)
|
|
1062
|
+
(let* ((r (js-nth ri ranges))
|
|
1063
|
+
(cloned (Object/assign (js-object) r
|
|
1064
|
+
(js-object :start (+ body-start (get r :start))
|
|
1065
|
+
:end (+ body-start (get r :end))))))
|
|
1066
|
+
(js-call dst-ranges :push cloned)
|
|
1067
|
+
(when (= (get cloned :kind) "trap-site")
|
|
1068
|
+
(js-call dst-sites :push cloned)))
|
|
1069
|
+
(setq ri (1+ ri)))
|
|
1070
|
+
(js-call (get debug :functions) :push
|
|
1071
|
+
(js-object :name (get function :name) :index (+ host-count index)
|
|
1072
|
+
:span (get function :span (if source (get source :span nil) nil))
|
|
1073
|
+
:sizeField (js-object :start size-start :end body-start)
|
|
1074
|
+
:body (js-object :start body-start :end body-end)
|
|
1075
|
+
:locals (js-object :start body-start :entriesStart (+ body-start local-entries-start)
|
|
1076
|
+
:end (+ body-start instructions-start) :count count)
|
|
1077
|
+
:instructions (js-object :start (+ body-start instructions-start) :end body-end)))))
|
|
1078
|
+
|
|
1079
|
+
(defconst wasm-hot-inline-names (new globalThis.Set (js-array
|
|
1080
|
+
"last-error" "fail" "begin-operation" "heap-check" "heap-block" "heap-ro-block"
|
|
1081
|
+
"heap-value-valid" "heap-reference-check" "val64-dynamic-p" "val64-inline-number-p"
|
|
1082
|
+
"val64-ro-p" "val64-readable-block-p" "heap-slot-index" "heap-generation" "heap-handle"
|
|
1083
|
+
"value-number-bits" "heap-number-word" "heap-number-from-word"
|
|
1084
|
+
"rt-root-scope-get-abs" "rt-root-scope-set-abs")))
|
|
1085
|
+
|
|
1086
|
+
(defun wasm-inline-candidate (function self-index)
|
|
1087
|
+
(when (js-call wasm-hot-inline-names :has (get function :name nil))
|
|
1088
|
+
(let* ((body (get function :body))
|
|
1089
|
+
(locals (get function :locals))
|
|
1090
|
+
(pending (js-array body))
|
|
1091
|
+
(count 0)
|
|
1092
|
+
(valid (<= (js-length locals) 16)))
|
|
1093
|
+
(while (and valid (> (js-length pending) 0))
|
|
1094
|
+
(let* ((node (js-call pending :pop))
|
|
1095
|
+
(kind (get node :kind))
|
|
1096
|
+
(children (get node :children))
|
|
1097
|
+
(i 0))
|
|
1098
|
+
(setq count (1+ count))
|
|
1099
|
+
(when (and (= kind "call") (= (get node :value) self-index))
|
|
1100
|
+
(setq valid nil))
|
|
1101
|
+
(if (or (> count 180)
|
|
1102
|
+
(not valid)
|
|
1103
|
+
(= kind "call-indirect") (= kind "host-call")
|
|
1104
|
+
(= kind "while") (= kind "remainder-while")
|
|
1105
|
+
(= kind "guarded-while") (= kind "guarded-counter-while")
|
|
1106
|
+
(= kind "data-text") (= kind "memory-data-copy"))
|
|
1107
|
+
(setq valid nil)
|
|
1108
|
+
(when (Array/isArray children)
|
|
1109
|
+
(while (< i (js-length children))
|
|
1110
|
+
(js-call pending :push (js-nth i children))
|
|
1111
|
+
(setq i (1+ i)))))))
|
|
1112
|
+
(when valid (js-object :function function :body body :locals (js-call locals :slice)
|
|
1113
|
+
:arity (get function :arity) :size count)))))
|
|
1114
|
+
|
|
1115
|
+
(defun wasm-has-inline-site (node candidates self-index)
|
|
1116
|
+
(let ((pending (js-array node)) (found nil))
|
|
1117
|
+
(while (and (not found) (> (js-length pending) 0))
|
|
1118
|
+
(let* ((item (js-call pending :pop))
|
|
1119
|
+
(kind (get item :kind))
|
|
1120
|
+
(children (get item :children))
|
|
1121
|
+
(i 0))
|
|
1122
|
+
(if (and (= kind "call")
|
|
1123
|
+
(/= (get item :value) self-index)
|
|
1124
|
+
(not (nil? (js-nth (get item :value) candidates))))
|
|
1125
|
+
(setq found t)
|
|
1126
|
+
(when (Array/isArray children)
|
|
1127
|
+
(while (< i (js-length children))
|
|
1128
|
+
(js-call pending :push (js-nth i children))
|
|
1129
|
+
(setq i (1+ i)))))))
|
|
1130
|
+
found))
|
|
1131
|
+
|
|
1132
|
+
(defun wasm-shift-clone (node base)
|
|
1133
|
+
(let* ((kind (get node :kind))
|
|
1134
|
+
(children (get node :children))
|
|
1135
|
+
(has-children (Array/isArray children))
|
|
1136
|
+
(clen (if has-children (js-length children) 0))
|
|
1137
|
+
(is-local (or (= kind "local") (= kind "set") (= kind "initialize"))))
|
|
1138
|
+
(if (and (= clen 0) (not is-local))
|
|
1139
|
+
node
|
|
1140
|
+
(let ((new-children nil) (changed false) (i 0))
|
|
1141
|
+
(while (< i clen)
|
|
1142
|
+
(let* ((orig (js-nth i children))
|
|
1143
|
+
(cloned (wasm-shift-clone orig base)))
|
|
1144
|
+
(when (not (eq cloned orig))
|
|
1145
|
+
(unless new-children (setq new-children (js-call children :slice)))
|
|
1146
|
+
(put new-children i cloned)
|
|
1147
|
+
(setq changed t)))
|
|
1148
|
+
(setq i (1+ i)))
|
|
1149
|
+
(if (and (not changed) (not is-local))
|
|
1150
|
+
node
|
|
1151
|
+
(let ((copy (Object/assign (js-object) node)))
|
|
1152
|
+
(put copy :children (or new-children (if has-children children (js-array))))
|
|
1153
|
+
(when is-local
|
|
1154
|
+
(put copy :value (+ (get node :value) base)))
|
|
1155
|
+
copy))))))
|
|
1156
|
+
|
|
1157
|
+
(defun wasm-rewrite-inline (node candidates self-index locals budget)
|
|
1158
|
+
(let* ((kind (get node :kind))
|
|
1159
|
+
(children (get node :children))
|
|
1160
|
+
(has-children (Array/isArray children))
|
|
1161
|
+
(clen (if has-children (js-length children) 0))
|
|
1162
|
+
(new-children nil)
|
|
1163
|
+
(changed false)
|
|
1164
|
+
(i 0))
|
|
1165
|
+
(while (< i clen)
|
|
1166
|
+
(let* ((orig (js-nth i children))
|
|
1167
|
+
(rewritten (wasm-rewrite-inline orig candidates self-index locals budget)))
|
|
1168
|
+
(when (not (eq rewritten orig))
|
|
1169
|
+
(unless new-children (setq new-children (js-call children :slice)))
|
|
1170
|
+
(put new-children i rewritten)
|
|
1171
|
+
(setq changed t)))
|
|
1172
|
+
(setq i (1+ i)))
|
|
1173
|
+
(let* ((target-index (if (= kind "call") (get node :value) -1))
|
|
1174
|
+
(cand (when (and (= kind "call") (/= target-index self-index)
|
|
1175
|
+
(>= target-index 0) (< target-index (js-length candidates)))
|
|
1176
|
+
(js-nth target-index candidates)))
|
|
1177
|
+
(callee-locals (when cand (get cand :locals)))
|
|
1178
|
+
(callee-body (when cand (get cand :body))))
|
|
1179
|
+
(if (and cand callee-body
|
|
1180
|
+
(<= (+ (js-length locals) (js-length callee-locals)) (get budget :maxLocals))
|
|
1181
|
+
(<= (+ (get budget :added) (get cand :size)) (get budget :maxAdded)))
|
|
1182
|
+
(let ((base (js-length locals))
|
|
1183
|
+
(callee-arity (get cand :arity))
|
|
1184
|
+
(args (or new-children children))
|
|
1185
|
+
(seq-children (js-array))
|
|
1186
|
+
(k 0))
|
|
1187
|
+
(while (< k (js-length callee-locals))
|
|
1188
|
+
(let ((ltype (get (js-nth k callee-locals) :type)))
|
|
1189
|
+
(js-call locals :push (js-object :name (str "inline-" (+ base k)) :type ltype :index (+ base k)))
|
|
1190
|
+
(if (< k callee-arity)
|
|
1191
|
+
(js-call seq-children :push
|
|
1192
|
+
(js-object :kind "set" :type ltype :value (+ base k)
|
|
1193
|
+
:children (js-array (js-nth k args))))
|
|
1194
|
+
(let ((zero-node (js-object :kind "literal" :type ltype
|
|
1195
|
+
:value (if (= ltype "f64") 0.0
|
|
1196
|
+
(if (or (= ltype "v64") (= ltype "bits64"))
|
|
1197
|
+
(js-object :low 0 :high 0)
|
|
1198
|
+
0))
|
|
1199
|
+
:children (js-array))))
|
|
1200
|
+
(js-call seq-children :push
|
|
1201
|
+
(js-object :kind "set" :type ltype :value (+ base k)
|
|
1202
|
+
:children (js-array zero-node))))))
|
|
1203
|
+
(setq k (1+ k)))
|
|
1204
|
+
(js-call seq-children :push (wasm-shift-clone callee-body base))
|
|
1205
|
+
(put budget :added (+ (get budget :added) (get cand :size)))
|
|
1206
|
+
(js-object :kind "sequence" :type (get node :type) :children seq-children))
|
|
1207
|
+
(if changed
|
|
1208
|
+
(let ((copy (Object/assign (js-object) node)))
|
|
1209
|
+
(put copy :children new-children)
|
|
1210
|
+
copy)
|
|
1211
|
+
node)))))
|
|
1212
|
+
|
|
1213
|
+
(defun wasm-build-inline-candidates (functions)
|
|
1214
|
+
(let* ((count (js-length functions))
|
|
1215
|
+
(candidates (new globalThis.Array count))
|
|
1216
|
+
(any-cand nil)
|
|
1217
|
+
(k 0))
|
|
1218
|
+
(while (< k count)
|
|
1219
|
+
(let ((cand (wasm-inline-candidate (js-nth k functions) k)))
|
|
1220
|
+
(put candidates k cand)
|
|
1221
|
+
(when cand (setq any-cand t)))
|
|
1222
|
+
(setq k (1+ k)))
|
|
1223
|
+
(when any-cand candidates)))
|
|
1224
|
+
|
|
1225
|
+
(defun wasm-runtime-prefix-ok (functions inline-candidates)
|
|
1226
|
+
(let* ((count (js-length functions))
|
|
1227
|
+
(first-cached (when (> count 0)
|
|
1228
|
+
(runtime-body-cache-get (get (js-nth 0 functions) :body nil))))
|
|
1229
|
+
(rt-id (if first-cached (get first-cached :runtimeId 0) 0))
|
|
1230
|
+
(rt-count (if first-cached (get first-cached :runtimeFnCount 0) 0))
|
|
1231
|
+
(ok (and (> rt-id 0) (> rt-count 0) (<= rt-count count)))
|
|
1232
|
+
(ri 0))
|
|
1233
|
+
(while (and ok (< ri rt-count))
|
|
1234
|
+
(let* ((rfn (js-nth ri functions))
|
|
1235
|
+
(rc (runtime-body-cache-get (get rfn :body nil)))
|
|
1236
|
+
(cand (js-nth ri inline-candidates)))
|
|
1237
|
+
(unless (if rc
|
|
1238
|
+
(and (= (get rc :runtimeId) rt-id)
|
|
1239
|
+
(= (get rc :runtimeFnCount) rt-count)
|
|
1240
|
+
(= (get rc :fnIndex) ri)
|
|
1241
|
+
(= (get rc :arity) (get rfn :arity)))
|
|
1242
|
+
(nil? cand))
|
|
1243
|
+
(setq ok false)))
|
|
1244
|
+
(setq ri (1+ ri)))
|
|
1245
|
+
(if ok rt-count 0)))
|
|
1246
|
+
|
|
1247
|
+
(defun wasm-append-memory-scratch (locals)
|
|
1248
|
+
(let ((base (js-length locals)))
|
|
1249
|
+
(js-call locals :push
|
|
1250
|
+
(js-object :name "memory-address" :index base :type "u32")
|
|
1251
|
+
(js-object :name "memory-word" :index (1+ base) :type "u32")
|
|
1252
|
+
(js-object :name "memory-float" :index (+ base 2) :type "f64")
|
|
1253
|
+
(js-object :name "memory-wide" :index (+ base 3) :type "v64"))
|
|
1254
|
+
(js-object :word (js-object :addressLocal base :valueLocal (1+ base))
|
|
1255
|
+
:floating (js-object :addressLocal base :valueLocal (+ base 2))
|
|
1256
|
+
:wide (js-object :addressLocal base :valueLocal (+ base 3)))))
|
|
1257
|
+
|
|
1039
1258
|
(defun emit-typed-scalar-wasm (program options &optional debug consume-owned-bodies)
|
|
1040
1259
|
(let* ((memory (= (get program :abi) "memory-u32"))
|
|
1260
|
+
(trusted (and memory (trusted-runtime-program-p program)))
|
|
1041
1261
|
(scalar-byte (if memory 127 124))
|
|
1042
1262
|
(ro-data (or (get program :roData nil) (get options :roData nil)))
|
|
1043
1263
|
(active-ro-segments (if memory (build-active-ro-segments ro-data) (js-array)))
|
|
@@ -1058,6 +1278,15 @@
|
|
|
1058
1278
|
(types nil) (declarations nil) (imports nil)
|
|
1059
1279
|
(exports nil) (bodies nil)
|
|
1060
1280
|
(memory-scratch (js-array))
|
|
1281
|
+
(inline-candidates (when (and memory (not debug)) (wasm-build-inline-candidates functions)))
|
|
1282
|
+
(rt-prefix-count (if inline-candidates (wasm-runtime-prefix-ok functions inline-candidates) 0))
|
|
1283
|
+
(rt-inline-candidates
|
|
1284
|
+
(when (and inline-candidates (> rt-prefix-count 0))
|
|
1285
|
+
(let ((arr (new globalThis.Array rt-prefix-count)) (k 0))
|
|
1286
|
+
(while (< k rt-prefix-count)
|
|
1287
|
+
(put arr k (js-nth k inline-candidates))
|
|
1288
|
+
(setq k (1+ k)))
|
|
1289
|
+
arr)))
|
|
1061
1290
|
(data-texts (js-array)) (data-indices (new globalThis.Map))
|
|
1062
1291
|
(output nil) (index 0))
|
|
1063
1292
|
(when memory
|
|
@@ -1073,7 +1302,21 @@
|
|
|
1073
1302
|
(backend-fail program "memory32 reserves the memory export name"))
|
|
1074
1303
|
(let ((position 0))
|
|
1075
1304
|
(while (< position (js-length functions))
|
|
1076
|
-
(
|
|
1305
|
+
(let* ((fn (js-nth position functions))
|
|
1306
|
+
(cached (runtime-body-cache-get (get fn :body))))
|
|
1307
|
+
(if (and cached (or trusted (get cached :frozen)))
|
|
1308
|
+
(if (get cached :hasMemoryAccess)
|
|
1309
|
+
(let* ((locals (get fn :locals)) (base (js-length locals)))
|
|
1310
|
+
(js-call locals :push (js-object :name "memory-address" :index base :type "u32")
|
|
1311
|
+
(js-object :name "memory-word" :index (1+ base) :type "u32")
|
|
1312
|
+
(js-object :name "memory-float" :index (+ base 2) :type "f64")
|
|
1313
|
+
(js-object :name "memory-wide" :index (+ base 3) :type "v64"))
|
|
1314
|
+
(js-call memory-scratch :push
|
|
1315
|
+
(js-object :word (js-object :addressLocal base :valueLocal (1+ base))
|
|
1316
|
+
:floating (js-object :addressLocal base :valueLocal (+ base 2))
|
|
1317
|
+
:wide (js-object :addressLocal base :valueLocal (+ base 3)))))
|
|
1318
|
+
(js-call memory-scratch :push undefined))
|
|
1319
|
+
(js-call memory-scratch :push (prepare-memory-scratch fn))))
|
|
1077
1320
|
(setq position (1+ position)))))
|
|
1078
1321
|
(when debug
|
|
1079
1322
|
(when (or (js-call (get program :exports) :includes "__eliscript_trap_site")
|
|
@@ -1120,7 +1363,7 @@
|
|
|
1120
1363
|
(setq position (1+ position))))
|
|
1121
1364
|
(setq output (binary-output options))
|
|
1122
1365
|
(setq types (binary-child output) declarations (binary-child output) imports (binary-child output)
|
|
1123
|
-
exports (binary-child output) bodies (binary-
|
|
1366
|
+
exports (binary-child output) bodies (binary-output (js-object :binaryEncoding "u16le-chunks")))
|
|
1124
1367
|
(append-bytes output (js-array 0 97 115 109 1 0 0 0))
|
|
1125
1368
|
(when (> host-count 0)
|
|
1126
1369
|
(unsigned-leb imports host-count)
|
|
@@ -1140,7 +1383,10 @@
|
|
|
1140
1383
|
(setq position (1+ position)))))
|
|
1141
1384
|
(setq index 0)
|
|
1142
1385
|
(while (< index (js-length functions))
|
|
1143
|
-
(
|
|
1386
|
+
(let* ((body (get (js-nth index functions) :body))
|
|
1387
|
+
(cached (when memory (runtime-body-cache-get body))))
|
|
1388
|
+
(unless (and cached (or trusted (get cached :frozen)) (not (get cached :hasIndirect)))
|
|
1389
|
+
(prepare-indirect-calls body signature-map allowed-domain-sigs (and memory table))))
|
|
1144
1390
|
(setq index (1+ index)))
|
|
1145
1391
|
(unsigned-leb types (js-length signatures))
|
|
1146
1392
|
(setq index 0)
|
|
@@ -1181,46 +1427,188 @@
|
|
|
1181
1427
|
(setq index 0)
|
|
1182
1428
|
(while (< index (js-length functions))
|
|
1183
1429
|
(let* ((function (js-nth index functions))
|
|
1184
|
-
(body (
|
|
1185
|
-
(
|
|
1186
|
-
(
|
|
1187
|
-
(
|
|
1188
|
-
|
|
1189
|
-
|
|
1190
|
-
(
|
|
1191
|
-
|
|
1192
|
-
|
|
1193
|
-
|
|
1194
|
-
|
|
1195
|
-
|
|
1196
|
-
|
|
1197
|
-
|
|
1198
|
-
|
|
1199
|
-
|
|
1200
|
-
|
|
1201
|
-
|
|
1202
|
-
|
|
1203
|
-
|
|
1204
|
-
|
|
1205
|
-
|
|
1206
|
-
|
|
1207
|
-
|
|
1208
|
-
|
|
1209
|
-
|
|
1210
|
-
|
|
1211
|
-
|
|
1212
|
-
|
|
1213
|
-
|
|
1214
|
-
|
|
1215
|
-
|
|
1216
|
-
|
|
1217
|
-
|
|
1218
|
-
|
|
1219
|
-
|
|
1220
|
-
|
|
1221
|
-
|
|
1222
|
-
|
|
1223
|
-
|
|
1430
|
+
(fn-body (get function :body))
|
|
1431
|
+
(locals (get function :locals))
|
|
1432
|
+
(cache-entry (when memory (runtime-body-cache-get fn-body)))
|
|
1433
|
+
(can-cache-body (and cache-entry (or trusted (get cache-entry :frozen))
|
|
1434
|
+
(not (get cache-entry :hasIndirect))
|
|
1435
|
+
(not (get cache-entry :hasHostCall)))))
|
|
1436
|
+
(if can-cache-body
|
|
1437
|
+
(let* ((arity (get function :arity))
|
|
1438
|
+
(nlocals (js-length locals))
|
|
1439
|
+
(loc-sig 2166136261) (li arity))
|
|
1440
|
+
(while (< li nlocals)
|
|
1441
|
+
(setq loc-sig (unsigned-bit-shift-right
|
|
1442
|
+
(imul32 (bit-xor loc-sig (result-byte (get (js-nth li locals) :type))) 16777619) 0))
|
|
1443
|
+
(setq li (1+ li)))
|
|
1444
|
+
(let* ((inline-rt (and (not debug) rt-inline-candidates (< index rt-prefix-count)))
|
|
1445
|
+
(trap-site-base (if debug (js-length (get debug :trapSites)) 0))
|
|
1446
|
+
(cache-key (if debug
|
|
1447
|
+
(str host-count ":" index ":" arity ":" nlocals ":" loc-sig ":" trap-site-base ":" (get function :name))
|
|
1448
|
+
(str host-count ":" arity ":" nlocals ":" loc-sig (if inline-rt ":I" ""))))
|
|
1449
|
+
(wasm-bodies (if debug
|
|
1450
|
+
(let ((m (get cache-entry :wasmDebugBodies nil)))
|
|
1451
|
+
(unless m
|
|
1452
|
+
(setq m (new globalThis.Map))
|
|
1453
|
+
(put cache-entry :wasmDebugBodies m))
|
|
1454
|
+
m)
|
|
1455
|
+
(get cache-entry :wasmBodies)))
|
|
1456
|
+
(has-data-text (get cache-entry :hasDataText))
|
|
1457
|
+
(cached-entry (js-call wasm-bodies :get cache-key))
|
|
1458
|
+
(hit-entry nil)
|
|
1459
|
+
(hit-bytes nil))
|
|
1460
|
+
(when cached-entry
|
|
1461
|
+
(if (not has-data-text)
|
|
1462
|
+
(progn
|
|
1463
|
+
(setq hit-entry cached-entry)
|
|
1464
|
+
(setq hit-bytes (if debug (get cached-entry :bytes) cached-entry)))
|
|
1465
|
+
(let* ((refs (get cached-entry :refs))
|
|
1466
|
+
(ref-indices (get cached-entry :refIndices))
|
|
1467
|
+
(rcount (js-length refs))
|
|
1468
|
+
(next-idx (js-length data-texts))
|
|
1469
|
+
(pending (new globalThis.Map))
|
|
1470
|
+
(ok t) (ri 0))
|
|
1471
|
+
(while (and ok (< ri rcount))
|
|
1472
|
+
(let* ((txt (js-nth ri refs))
|
|
1473
|
+
(existing (js-call data-indices :get txt))
|
|
1474
|
+
(actual (if (not (undefined? existing)) existing
|
|
1475
|
+
(let ((pend (js-call pending :get txt)))
|
|
1476
|
+
(if (not (undefined? pend)) pend
|
|
1477
|
+
(let ((assigned next-idx))
|
|
1478
|
+
(setq next-idx (1+ next-idx))
|
|
1479
|
+
(js-call pending :set txt assigned)
|
|
1480
|
+
assigned))))))
|
|
1481
|
+
(unless (= actual (js-nth ri ref-indices))
|
|
1482
|
+
(setq ok false)))
|
|
1483
|
+
(setq ri (1+ ri)))
|
|
1484
|
+
(when ok
|
|
1485
|
+
(js-call pending :forEach (lambda (idx txt)
|
|
1486
|
+
(js-call data-indices :set txt idx)
|
|
1487
|
+
(js-call data-texts :push txt)))
|
|
1488
|
+
(setq hit-entry cached-entry)
|
|
1489
|
+
(setq hit-bytes (get cached-entry :bytes))))))
|
|
1490
|
+
(if hit-bytes
|
|
1491
|
+
(let ((size-start (js-length bodies)))
|
|
1492
|
+
(unsigned-leb bodies (js-length hit-bytes))
|
|
1493
|
+
(when debug
|
|
1494
|
+
(let* ((body-start (js-length bodies))
|
|
1495
|
+
(body-end (+ body-start (js-length hit-bytes))))
|
|
1496
|
+
(replay-wasm-debug-body debug function host-count index (- nlocals arity)
|
|
1497
|
+
body-start body-end
|
|
1498
|
+
(get hit-entry :ranges)
|
|
1499
|
+
(get hit-entry :localEntriesStart)
|
|
1500
|
+
(get hit-entry :instructionsStart)
|
|
1501
|
+
size-start)))
|
|
1502
|
+
(binary-append-u8 bodies hit-bytes))
|
|
1503
|
+
(let ((emit-body fn-body)
|
|
1504
|
+
(emit-locals locals)
|
|
1505
|
+
(emit-scratch (when memory (js-nth index memory-scratch))))
|
|
1506
|
+
(when (and inline-rt (wasm-has-inline-site fn-body rt-inline-candidates index))
|
|
1507
|
+
(let* ((tmp-locals (js-call locals :slice))
|
|
1508
|
+
(budget (js-object :added 0 :maxAdded 140 :maxLocals 80))
|
|
1509
|
+
(new-body (wasm-rewrite-inline fn-body rt-inline-candidates index tmp-locals budget)))
|
|
1510
|
+
(when (> (get budget :added) 0)
|
|
1511
|
+
(setq emit-locals tmp-locals emit-body new-body)
|
|
1512
|
+
(when (and memory (nil? emit-scratch) (has-memory-access-p emit-body))
|
|
1513
|
+
(setq emit-scratch (wasm-append-memory-scratch emit-locals))))))
|
|
1514
|
+
(let* ((emit-nlocals (js-length emit-locals))
|
|
1515
|
+
(body (binary-child bodies))
|
|
1516
|
+
(count (- emit-nlocals arity))
|
|
1517
|
+
(position arity)
|
|
1518
|
+
(local-ranges (when debug (js-array)))
|
|
1519
|
+
(local-sites (when debug (js-array)))
|
|
1520
|
+
(local-entries-start 0) (instructions-start 0)
|
|
1521
|
+
(refs (when (and has-data-text (not cached-entry)) (js-array)))
|
|
1522
|
+
(ref-indices (when (and has-data-text (not cached-entry)) (js-array))))
|
|
1523
|
+
(put body :wasmFunctionBase host-count) (put body :wasmHostCapabilities capabilities)
|
|
1524
|
+
(put body :wasmMemory memory) (put body :wasmDataTexts data-texts)
|
|
1525
|
+
(when emit-scratch (put body :wasmMemoryScratch emit-scratch))
|
|
1526
|
+
(put body :wasmDataIndices data-indices)
|
|
1527
|
+
(when debug
|
|
1528
|
+
(put body :wasmDebug (js-object :ranges local-ranges :depth 0
|
|
1529
|
+
:trapSites local-sites :trapSiteBase trap-site-base
|
|
1530
|
+
:function (get function :name) :functionIndex (+ host-count index))))
|
|
1531
|
+
(when refs
|
|
1532
|
+
(put body :wasmDataRefs refs)
|
|
1533
|
+
(put body :wasmDataRefIndices ref-indices))
|
|
1534
|
+
(unsigned-leb body count)
|
|
1535
|
+
(setq local-entries-start (js-length body))
|
|
1536
|
+
(while (< position emit-nlocals)
|
|
1537
|
+
(binary-push body 1 (result-byte (get (js-nth position emit-locals) :type)))
|
|
1538
|
+
(setq position (1+ position)))
|
|
1539
|
+
(setq instructions-start (js-length body))
|
|
1540
|
+
(emit-expression body emit-body)
|
|
1541
|
+
(binary-push body 11)
|
|
1542
|
+
(let ((u8 (unless (and cached-entry (not debug)) (binary-to-u8 body)))
|
|
1543
|
+
(size-start (js-length bodies)))
|
|
1544
|
+
(unless cached-entry
|
|
1545
|
+
(if debug
|
|
1546
|
+
(js-call wasm-bodies :set cache-key
|
|
1547
|
+
(js-object :bytes u8 :ranges local-ranges
|
|
1548
|
+
:localEntriesStart local-entries-start :instructionsStart instructions-start
|
|
1549
|
+
:refs refs :refIndices ref-indices))
|
|
1550
|
+
(if has-data-text
|
|
1551
|
+
(js-call wasm-bodies :set cache-key
|
|
1552
|
+
(js-object :bytes u8 :refs refs :refIndices ref-indices))
|
|
1553
|
+
(js-call wasm-bodies :set cache-key u8))))
|
|
1554
|
+
(unsigned-leb bodies (js-length body))
|
|
1555
|
+
(when debug
|
|
1556
|
+
(let* ((body-start (js-length bodies))
|
|
1557
|
+
(body-end (+ body-start (js-length body))))
|
|
1558
|
+
(replay-wasm-debug-body debug function host-count index count
|
|
1559
|
+
body-start body-end local-ranges local-entries-start instructions-start size-start)))
|
|
1560
|
+
(binary-append-owned bodies body)))))))
|
|
1561
|
+
(let ((emit-body fn-body)
|
|
1562
|
+
(emit-locals locals)
|
|
1563
|
+
(emit-scratch (when memory (js-nth index memory-scratch))))
|
|
1564
|
+
(when (and memory (not debug) inline-candidates (wasm-has-inline-site fn-body inline-candidates index))
|
|
1565
|
+
(let* ((tmp-locals (js-call locals :slice))
|
|
1566
|
+
(budget (js-object :added 0 :maxAdded 140 :maxLocals 80))
|
|
1567
|
+
(new-body (wasm-rewrite-inline fn-body inline-candidates index tmp-locals budget)))
|
|
1568
|
+
(when (> (get budget :added) 0)
|
|
1569
|
+
(setq emit-locals tmp-locals emit-body new-body)
|
|
1570
|
+
(when (and (nil? emit-scratch) (has-memory-access-p emit-body))
|
|
1571
|
+
(setq emit-scratch (wasm-append-memory-scratch emit-locals))))))
|
|
1572
|
+
(let* ((body (binary-child bodies))
|
|
1573
|
+
(count (- (js-length emit-locals) (get function :arity)))
|
|
1574
|
+
(position (get function :arity))
|
|
1575
|
+
(range-start (if debug (js-length (get debug :ranges)) 0))
|
|
1576
|
+
(local-entries-start 0) (instructions-start 0))
|
|
1577
|
+
(put body :wasmFunctionBase host-count) (put body :wasmHostCapabilities capabilities)
|
|
1578
|
+
(put body :wasmMemory memory) (put body :wasmDataTexts data-texts)
|
|
1579
|
+
(when emit-scratch (put body :wasmMemoryScratch emit-scratch))
|
|
1580
|
+
(put body :wasmDataIndices data-indices)
|
|
1581
|
+
(when debug
|
|
1582
|
+
(put body :wasmDebug (js-object :ranges (get debug :ranges) :depth 0
|
|
1583
|
+
:trapSites (get debug :trapSites)
|
|
1584
|
+
:function (get function :name) :functionIndex (+ host-count index))))
|
|
1585
|
+
(unsigned-leb body count)
|
|
1586
|
+
(setq local-entries-start (js-length body))
|
|
1587
|
+
(while (< position (js-length emit-locals))
|
|
1588
|
+
(binary-push body 1 (result-byte (get (js-nth position emit-locals) :type)))
|
|
1589
|
+
(setq position (1+ position)))
|
|
1590
|
+
(setq instructions-start (js-length body))
|
|
1591
|
+
(emit-expression body emit-body)
|
|
1592
|
+
(binary-push body 11)
|
|
1593
|
+
(let ((size-start (js-length bodies)))
|
|
1594
|
+
(unsigned-leb bodies (js-length body))
|
|
1595
|
+
(when debug
|
|
1596
|
+
(let* ((body-start (js-length bodies)) (body-end (+ body-start (js-length body)))
|
|
1597
|
+
(source (get function :source nil)) (ranges (get debug :ranges)) (i range-start))
|
|
1598
|
+
(while (< i (js-length ranges))
|
|
1599
|
+
(let ((range (js-nth i ranges)))
|
|
1600
|
+
(put range :start (+ body-start (get range :start)))
|
|
1601
|
+
(put range :end (+ body-start (get range :end))))
|
|
1602
|
+
(setq i (1+ i)))
|
|
1603
|
+
(js-call (get debug :functions) :push
|
|
1604
|
+
(js-object :name (get function :name) :index (+ host-count index)
|
|
1605
|
+
:span (get function :span (if source (get source :span nil) nil))
|
|
1606
|
+
:sizeField (js-object :start size-start :end body-start)
|
|
1607
|
+
:body (js-object :start body-start :end body-end)
|
|
1608
|
+
:locals (js-object :start body-start :entriesStart (+ body-start local-entries-start)
|
|
1609
|
+
:end (+ body-start instructions-start) :count count)
|
|
1610
|
+
:instructions (js-object :start (+ body-start instructions-start) :end body-end)))))
|
|
1611
|
+
(binary-append-owned bodies body)))))
|
|
1224
1612
|
(when consume-owned-bodies (put function :body nil)))
|
|
1225
1613
|
(setq index (1+ index)))
|
|
1226
1614
|
(section output 1 types)
|
|
@@ -1345,11 +1733,32 @@
|
|
|
1345
1733
|
(validate-fresh-wasm-expression (get function :body) function memory workspace))
|
|
1346
1734
|
(setq index (1+ index)))) program)
|
|
1347
1735
|
|
|
1736
|
+
(defun validate-trusted-typed-wasm-program (program)
|
|
1737
|
+
(unless (and (not (nil? program)) (= (value-type program) "object")
|
|
1738
|
+
(not (Array/isArray program)))
|
|
1739
|
+
(backend-fail nil "typed WASM emitter requires a program object"))
|
|
1740
|
+
(let ((functions (get program :functions)) (memory (= (get program :abi) "memory-u32"))
|
|
1741
|
+
(trusted (and (= (get program :abi) "memory-u32") (trusted-runtime-program-p program)))
|
|
1742
|
+
(workspace (make-wasm-validation-workspace)) (index 0))
|
|
1743
|
+
(unless (Array/isArray functions)
|
|
1744
|
+
(backend-fail program "typed WASM emitter requires declared functions"))
|
|
1745
|
+
(while (< index (js-length functions))
|
|
1746
|
+
(let ((function (js-nth index functions)))
|
|
1747
|
+
(unless (and (not (nil? function)) (= (value-type function) "object")
|
|
1748
|
+
(not (Array/isArray function)) (Array/isArray (get function :locals)))
|
|
1749
|
+
(backend-fail program "typed WASM function requires a locals array"))
|
|
1750
|
+
(let* ((body (get function :body))
|
|
1751
|
+
(cached (when memory (runtime-body-cache-get body))))
|
|
1752
|
+
(unless (and cached (or trusted (get cached :frozen)) (get cached :wasmValidated))
|
|
1753
|
+
(validate-fresh-wasm-expression body function memory workspace)
|
|
1754
|
+
(when cached (put cached :wasmValidated t)))))
|
|
1755
|
+
(setq index (1+ index)))) program)
|
|
1756
|
+
|
|
1348
1757
|
(defun emit-fresh-managed-wasm-product (lowered configure)
|
|
1349
1758
|
(unless (= (value-type configure) "function")
|
|
1350
1759
|
(backend-fail nil "managed WASM product requires an output configuration callback"))
|
|
1351
1760
|
(let* ((configuration (funcall configure))
|
|
1352
|
-
(typed (validate-
|
|
1761
|
+
(typed (validate-trusted-typed-wasm-program (mark-trusted-runtime-program (get lowered :typed))))
|
|
1353
1762
|
(memory (or (get configuration :memory nil) (js-object)))
|
|
1354
1763
|
(debug (when (= (get configuration :debug false) t)
|
|
1355
1764
|
(js-object :format "eliscript-wasm-source-map"
|
|
@@ -1401,7 +1810,7 @@
|
|
|
1401
1810
|
;; Reuse the exact same validator/emitter and release each encoded body.
|
|
1402
1811
|
(defun emit-owned-memory-wasm (program &optional options)
|
|
1403
1812
|
(unless (= (get program :abi) "memory-u32") (backend-fail program "owned memory emitter requires memory-u32"))
|
|
1404
|
-
(binary-finish (emit-typed-scalar-wasm (validate-
|
|
1813
|
+
(binary-finish (emit-typed-scalar-wasm (validate-trusted-typed-wasm-program program) (or options (js-object)) nil t)))
|
|
1405
1814
|
|
|
1406
1815
|
(defun emit-typed-memory-wasm (program &optional options)
|
|
1407
1816
|
(unless (= (get program :abi) "memory-u32") (backend-fail program "typed memory emitter requires memory-u32"))
|