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
package/dist/backends/wasm.mjs
CHANGED
|
@@ -1,19 +1,20 @@
|
|
|
1
1
|
// Generated by Eliscript. Do not edit.
|
|
2
2
|
import { tdz as __eliscript_tdz_error, immutable as __eliscript_const_error } from "eliscript/runtime/errors.mjs";
|
|
3
3
|
var __eliscript_tdz_ready_0;
|
|
4
|
+
var __eliscript_tdz_ready_1;
|
|
4
5
|
import "eliscript/runtime/unicode-case.mjs";
|
|
5
6
|
import "eliscript/runtime/math.mjs";
|
|
6
|
-
import { __eliscript_at, __eliscript_at_direct, __eliscript_to_number, __eliscript_numeric_decrement, __eliscript_numeric_relation, __eliscript_numeric_sub, __eliscript_numeric_mul, __eliscript_numeric_div, __eliscript_numeric_rem, __eliscript_numeric_and, __eliscript_numeric_or, __eliscript_numeric_xor, __eliscript_numeric_shl, __eliscript_numeric_shr, __eliscript_numeric_ushr, __eliscript_numeric_neg, __eliscript_numeric_int32, __eliscript_numeric_uint32, __eliscript_numeric_not } from "eliscript/runtime/prelude.mjs";
|
|
7
|
+
import { __eliscript_at, __eliscript_at_direct, __eliscript_to_number, __eliscript_numeric_decrement, __eliscript_numeric_relation, __eliscript_numeric_sub, __eliscript_numeric_mul, __eliscript_numeric_div, __eliscript_numeric_rem, __eliscript_numeric_and, __eliscript_numeric_or, __eliscript_numeric_xor, __eliscript_numeric_shl, __eliscript_numeric_shr, __eliscript_numeric_ushr, __eliscript_numeric_neg, __eliscript_numeric_int32, __eliscript_numeric_uint32, __eliscript_numeric_not, __eliscript_numeric_imul } from "eliscript/runtime/prelude.mjs";
|
|
7
8
|
import { stringToBigint as __eliscript_string_to_bigint, float64Words as __eliscript_number_float64_words, buildArray as __eliscript_array_build, arrayCopyAssoc as __eliscript_array_copy_assoc, unsupportedArity as __eliscript_arity_error } from "eliscript/runtime/primitives.mjs";
|
|
8
9
|
import { valueType as __eliscript_value_type } from "eliscript/runtime/primitives.mjs";
|
|
9
10
|
const __eliscript_truthy = (value) => value !== false && value != null;
|
|
10
11
|
|
|
11
12
|
import {optimize_program} from "./optimize.mjs";
|
|
12
|
-
import {lower_numeric_program, optimize_numeric_program, numeric_pure, tree_size, backend_fail, find_function} from "./numeric.mjs";
|
|
13
|
+
import {lower_numeric_program, optimize_numeric_program, numeric_pure, tree_size, backend_fail, find_function, runtime_body_cache_get, mark_trusted_runtime_program, trusted_runtime_program_p} from "./numeric.mjs";
|
|
13
14
|
import {lower_memory_program} from "./memory.mjs";
|
|
14
15
|
import {prepare_host_capabilities, host_capability_index} from "./capabilities.mjs";
|
|
15
16
|
import {lower_managed_program, lower_managed_project} from "./managed.mjs";
|
|
16
|
-
import {binary_output, binary_byte, binary_push, binary_child, binary_length, binary_resume, binary_append, binary_append_owned, binary_finish} from "./binary.mjs";
|
|
17
|
+
import {binary_output, binary_byte, binary_push, binary_child, binary_length, binary_resume, binary_append, binary_append_owned, binary_to_u8, binary_append_u8, binary_finish} from "./binary.mjs";
|
|
17
18
|
function append_bytes(output, bytes) {
|
|
18
19
|
return binary_append(output, bytes);
|
|
19
20
|
}
|
|
@@ -206,10 +207,11 @@ function emit_trapping_bytes(output, expression, bytes, terminal = null) {
|
|
|
206
207
|
if (__eliscript_truthy(state)) {
|
|
207
208
|
{
|
|
208
209
|
let sites = (state)["trapSites"];
|
|
210
|
+
let site_id = (((state)["trapSiteBase"] ?? 0) + (((sites) ?? []).length + 1));
|
|
209
211
|
binary_push(output, 65);
|
|
210
|
-
positive_signed_leb(output,
|
|
212
|
+
positive_signed_leb(output, site_id);
|
|
211
213
|
binary_push(output, 36, 0);
|
|
212
|
-
((range = ({"kind": "trap-site", "function": (state)["function"], "functionIndex": (state)["functionIndex"], "depth": (state)["depth"], "start": ((output) ?? []).length, "end": 0, "span": ((expression)["span"] ?? null), "site":
|
|
214
|
+
((range = ({"kind": "trap-site", "function": (state)["function"], "functionIndex": (state)["functionIndex"], "depth": (state)["depth"], "start": ((output) ?? []).length, "end": 0, "span": ((expression)["span"] ?? null), "site": site_id})));
|
|
213
215
|
(sites)["push"](range);
|
|
214
216
|
((state)["ranges"])["push"](range);
|
|
215
217
|
}
|
|
@@ -904,6 +906,7 @@ function copy_typed_wasm_program(program) {
|
|
|
904
906
|
let functions = (program)["functions"];
|
|
905
907
|
let copies = [];
|
|
906
908
|
let memory = ((program)["abi"] === "memory-u32");
|
|
909
|
+
let workspace = null;
|
|
907
910
|
let copy = Object.assign(({}), program);
|
|
908
911
|
let index = 0;
|
|
909
912
|
if ((!__eliscript_truthy(Array.isArray(functions)))) {
|
|
@@ -916,9 +919,22 @@ function copy_typed_wasm_program(program) {
|
|
|
916
919
|
backend_fail(program, "typed WASM function requires a locals array");
|
|
917
920
|
}
|
|
918
921
|
{
|
|
922
|
+
let fn_body = (function$)["body"];
|
|
923
|
+
let cached = (__eliscript_truthy(memory) ? runtime_body_cache_get(fn_body) : null);
|
|
919
924
|
let function_copy = Object.assign(({}), function$);
|
|
920
925
|
((function_copy)["locals"] = ((function$)["locals"])["slice"]());
|
|
921
|
-
((
|
|
926
|
+
if ((__eliscript_truthy(cached) && __eliscript_truthy((cached)["frozen"]))) {
|
|
927
|
+
if ((!__eliscript_truthy((cached)["wasmValidated"]))) {
|
|
928
|
+
if ((!__eliscript_truthy(workspace))) {
|
|
929
|
+
((workspace = make_wasm_validation_workspace()));
|
|
930
|
+
}
|
|
931
|
+
validate_fresh_wasm_expression(fn_body, function$, memory, workspace);
|
|
932
|
+
((cached)["wasmValidated"] = true);
|
|
933
|
+
}
|
|
934
|
+
((function_copy)["body"] = fn_body);
|
|
935
|
+
} else {
|
|
936
|
+
((function_copy)["body"] = copy_wasm_expression(fn_body, function$, memory));
|
|
937
|
+
}
|
|
922
938
|
(copies)["push"](function_copy);
|
|
923
939
|
}
|
|
924
940
|
}
|
|
@@ -1163,6 +1179,13 @@ function emit_memory_data_copy(output, expression) {
|
|
|
1163
1179
|
(texts)["push"](text);
|
|
1164
1180
|
(indices)["set"](text, index);
|
|
1165
1181
|
}
|
|
1182
|
+
{
|
|
1183
|
+
let refs = ((output)["wasmDataRefs"] ?? null);
|
|
1184
|
+
if (__eliscript_truthy(refs)) {
|
|
1185
|
+
(refs)["push"](text);
|
|
1186
|
+
((output)["wasmDataRefIndices"])["push"](index);
|
|
1187
|
+
}
|
|
1188
|
+
}
|
|
1166
1189
|
emit_expression(output, ((((children) ?? [])[0]) ?? null));
|
|
1167
1190
|
binary_push(output, 65, 0, 65);
|
|
1168
1191
|
signed_word_leb(output, __eliscript_numeric_mul(2, ((text) ?? []).length));
|
|
@@ -1691,11 +1714,268 @@ function prepare_indirect_calls(expression, signature_map, allowed_domain_sigs,
|
|
|
1691
1714
|
}
|
|
1692
1715
|
return expression;
|
|
1693
1716
|
}
|
|
1717
|
+
function replay_wasm_debug_body(debug, function$, host_count, index, count, body_start, body_end, ranges, local_entries_start, instructions_start, size_start) {
|
|
1718
|
+
{
|
|
1719
|
+
let source = ((function$)["source"] ?? null);
|
|
1720
|
+
let dst_ranges = (debug)["ranges"];
|
|
1721
|
+
let dst_sites = (debug)["trapSites"];
|
|
1722
|
+
let ri = 0;
|
|
1723
|
+
let rlen = ((ranges) ?? []).length;
|
|
1724
|
+
while (__eliscript_numeric_relation("<", ri, rlen)) {
|
|
1725
|
+
{
|
|
1726
|
+
let r = ((((ranges) ?? [])[ri]) ?? null);
|
|
1727
|
+
let cloned = Object.assign(({}), r, ({"start": (body_start + (r)["start"]), "end": (body_start + (r)["end"])}));
|
|
1728
|
+
(dst_ranges)["push"](cloned);
|
|
1729
|
+
if (((cloned)["kind"] === "trap-site")) {
|
|
1730
|
+
(dst_sites)["push"](cloned);
|
|
1731
|
+
}
|
|
1732
|
+
}
|
|
1733
|
+
((ri = (ri + 1)));
|
|
1734
|
+
}
|
|
1735
|
+
return ((debug)["functions"])["push"](({"name": (function$)["name"], "index": (host_count + index), "span": ((function$)["span"] ?? (__eliscript_truthy(source) ? ((source)["span"] ?? null) : null)), "sizeField": ({"start": size_start, "end": body_start}), "body": ({"start": body_start, "end": body_end}), "locals": ({"start": body_start, "entriesStart": (body_start + local_entries_start), "end": (body_start + instructions_start), "count": count}), "instructions": ({"start": (body_start + instructions_start), "end": body_end})}));
|
|
1736
|
+
}
|
|
1737
|
+
}
|
|
1738
|
+
const wasm_hot_inline_names = new (globalThis.Set)(["last-error", "fail", "begin-operation", "heap-check", "heap-block", "heap-ro-block", "heap-value-valid", "heap-reference-check", "val64-dynamic-p", "val64-inline-number-p", "val64-ro-p", "val64-readable-block-p", "heap-slot-index", "heap-generation", "heap-handle", "value-number-bits", "heap-number-word", "heap-number-from-word", "rt-root-scope-get-abs", "rt-root-scope-set-abs"]);
|
|
1739
|
+
__eliscript_tdz_ready_1 = true;
|
|
1740
|
+
function wasm_inline_candidate(function$, self_index) {
|
|
1741
|
+
if (__eliscript_truthy(((__eliscript_tdz_ready_1 === true ? wasm_hot_inline_names : __eliscript_tdz_error("wasm_hot_inline_names")))["has"](((function$)["name"] ?? null)))) {
|
|
1742
|
+
{
|
|
1743
|
+
let body = (function$)["body"];
|
|
1744
|
+
let locals = (function$)["locals"];
|
|
1745
|
+
let pending = [body];
|
|
1746
|
+
let count = 0;
|
|
1747
|
+
let valid = __eliscript_numeric_relation("<=", ((locals) ?? []).length, 16);
|
|
1748
|
+
while ((__eliscript_truthy(valid) && __eliscript_numeric_relation(">", ((pending) ?? []).length, 0))) {
|
|
1749
|
+
{
|
|
1750
|
+
let node = (pending)["pop"]();
|
|
1751
|
+
let kind = (node)["kind"];
|
|
1752
|
+
let children = (node)["children"];
|
|
1753
|
+
let i = 0;
|
|
1754
|
+
((count = (count + 1)));
|
|
1755
|
+
if (((kind === "call") && ((node)["value"] === self_index))) {
|
|
1756
|
+
((valid = null));
|
|
1757
|
+
}
|
|
1758
|
+
if ((__eliscript_numeric_relation(">", count, 180) || !(__eliscript_truthy(valid)) || (kind === "call-indirect") || (kind === "host-call") || (kind === "while") || (kind === "remainder-while") || (kind === "guarded-while") || (kind === "guarded-counter-while") || (kind === "data-text") || (kind === "memory-data-copy"))) {
|
|
1759
|
+
((valid = null));
|
|
1760
|
+
} else {
|
|
1761
|
+
if (__eliscript_truthy(Array.isArray(children))) {
|
|
1762
|
+
while (__eliscript_numeric_relation("<", i, ((children) ?? []).length)) {
|
|
1763
|
+
(pending)["push"](((((children) ?? [])[i]) ?? null));
|
|
1764
|
+
((i = (i + 1)));
|
|
1765
|
+
}
|
|
1766
|
+
}
|
|
1767
|
+
}
|
|
1768
|
+
}
|
|
1769
|
+
}
|
|
1770
|
+
if (__eliscript_truthy(valid)) {
|
|
1771
|
+
return ({"function": function$, "body": body, "locals": (locals)["slice"](), "arity": (function$)["arity"], "size": count});
|
|
1772
|
+
} else {
|
|
1773
|
+
return null;
|
|
1774
|
+
}
|
|
1775
|
+
}
|
|
1776
|
+
} else {
|
|
1777
|
+
return null;
|
|
1778
|
+
}
|
|
1779
|
+
}
|
|
1780
|
+
function wasm_has_inline_site(node, candidates, self_index) {
|
|
1781
|
+
{
|
|
1782
|
+
let pending = [node];
|
|
1783
|
+
let found = null;
|
|
1784
|
+
while ((!(__eliscript_truthy(found)) && __eliscript_numeric_relation(">", ((pending) ?? []).length, 0))) {
|
|
1785
|
+
{
|
|
1786
|
+
let item = (pending)["pop"]();
|
|
1787
|
+
let kind = (item)["kind"];
|
|
1788
|
+
let children = (item)["children"];
|
|
1789
|
+
let i = 0;
|
|
1790
|
+
if (((kind === "call") && ((item)["value"] !== self_index) && !((((((candidates) ?? [])[(item)["value"]]) ?? null) === null)))) {
|
|
1791
|
+
((found = true));
|
|
1792
|
+
} else {
|
|
1793
|
+
if (__eliscript_truthy(Array.isArray(children))) {
|
|
1794
|
+
while (__eliscript_numeric_relation("<", i, ((children) ?? []).length)) {
|
|
1795
|
+
(pending)["push"](((((children) ?? [])[i]) ?? null));
|
|
1796
|
+
((i = (i + 1)));
|
|
1797
|
+
}
|
|
1798
|
+
}
|
|
1799
|
+
}
|
|
1800
|
+
}
|
|
1801
|
+
}
|
|
1802
|
+
return found;
|
|
1803
|
+
}
|
|
1804
|
+
}
|
|
1805
|
+
function wasm_shift_clone(node, base) {
|
|
1806
|
+
{
|
|
1807
|
+
let kind = (node)["kind"];
|
|
1808
|
+
let children = (node)["children"];
|
|
1809
|
+
let has_children = Array.isArray(children);
|
|
1810
|
+
let clen = (__eliscript_truthy(has_children) ? ((children) ?? []).length : 0);
|
|
1811
|
+
let is_local = ((kind === "local") || (kind === "set") || (kind === "initialize"));
|
|
1812
|
+
if (((clen === 0) && !(__eliscript_truthy(is_local)))) {
|
|
1813
|
+
return node;
|
|
1814
|
+
} else {
|
|
1815
|
+
{
|
|
1816
|
+
let new_children = null;
|
|
1817
|
+
let changed = false;
|
|
1818
|
+
let i = 0;
|
|
1819
|
+
while (__eliscript_numeric_relation("<", i, clen)) {
|
|
1820
|
+
{
|
|
1821
|
+
let orig = ((((children) ?? [])[i]) ?? null);
|
|
1822
|
+
let cloned = wasm_shift_clone(orig, base);
|
|
1823
|
+
if (!((cloned === orig))) {
|
|
1824
|
+
if ((!__eliscript_truthy(new_children))) {
|
|
1825
|
+
((new_children = (children)["slice"]()));
|
|
1826
|
+
}
|
|
1827
|
+
((new_children)[i] = cloned);
|
|
1828
|
+
((changed = true));
|
|
1829
|
+
}
|
|
1830
|
+
}
|
|
1831
|
+
((i = (i + 1)));
|
|
1832
|
+
}
|
|
1833
|
+
if ((!(__eliscript_truthy(changed)) && !(__eliscript_truthy(is_local)))) {
|
|
1834
|
+
return node;
|
|
1835
|
+
} else {
|
|
1836
|
+
{
|
|
1837
|
+
let copy = Object.assign(({}), node);
|
|
1838
|
+
((copy)["children"] = ((__eliscript_value_3) => (__eliscript_truthy(__eliscript_value_3) ? __eliscript_value_3 : (__eliscript_truthy(has_children) ? children : [])))(new_children));
|
|
1839
|
+
if (__eliscript_truthy(is_local)) {
|
|
1840
|
+
((copy)["value"] = ((node)["value"] + base));
|
|
1841
|
+
}
|
|
1842
|
+
return copy;
|
|
1843
|
+
}
|
|
1844
|
+
}
|
|
1845
|
+
}
|
|
1846
|
+
}
|
|
1847
|
+
}
|
|
1848
|
+
}
|
|
1849
|
+
function wasm_rewrite_inline(node, candidates, self_index, locals, budget) {
|
|
1850
|
+
{
|
|
1851
|
+
let kind = (node)["kind"];
|
|
1852
|
+
let children = (node)["children"];
|
|
1853
|
+
let has_children = Array.isArray(children);
|
|
1854
|
+
let clen = (__eliscript_truthy(has_children) ? ((children) ?? []).length : 0);
|
|
1855
|
+
let new_children = null;
|
|
1856
|
+
let changed = false;
|
|
1857
|
+
let i = 0;
|
|
1858
|
+
while (__eliscript_numeric_relation("<", i, clen)) {
|
|
1859
|
+
{
|
|
1860
|
+
let orig = ((((children) ?? [])[i]) ?? null);
|
|
1861
|
+
let rewritten = wasm_rewrite_inline(orig, candidates, self_index, locals, budget);
|
|
1862
|
+
if (!((rewritten === orig))) {
|
|
1863
|
+
if ((!__eliscript_truthy(new_children))) {
|
|
1864
|
+
((new_children = (children)["slice"]()));
|
|
1865
|
+
}
|
|
1866
|
+
((new_children)[i] = rewritten);
|
|
1867
|
+
((changed = true));
|
|
1868
|
+
}
|
|
1869
|
+
}
|
|
1870
|
+
((i = (i + 1)));
|
|
1871
|
+
}
|
|
1872
|
+
{
|
|
1873
|
+
let target_index = ((kind === "call") ? (node)["value"] : -1);
|
|
1874
|
+
let cand = (((kind === "call") && (target_index !== self_index) && __eliscript_numeric_relation(">=", target_index, 0) && __eliscript_numeric_relation("<", target_index, ((candidates) ?? []).length)) ? ((((candidates) ?? [])[target_index]) ?? null) : null);
|
|
1875
|
+
let callee_locals = (__eliscript_truthy(cand) ? (cand)["locals"] : null);
|
|
1876
|
+
let callee_body = (__eliscript_truthy(cand) ? (cand)["body"] : null);
|
|
1877
|
+
if ((__eliscript_truthy(cand) && __eliscript_truthy(callee_body) && __eliscript_numeric_relation("<=", (((locals) ?? []).length + ((callee_locals) ?? []).length), (budget)["maxLocals"]) && __eliscript_numeric_relation("<=", ((budget)["added"] + (cand)["size"]), (budget)["maxAdded"]))) {
|
|
1878
|
+
{
|
|
1879
|
+
let base = ((locals) ?? []).length;
|
|
1880
|
+
let callee_arity = (cand)["arity"];
|
|
1881
|
+
let args = ((__eliscript_value_4) => (__eliscript_truthy(__eliscript_value_4) ? __eliscript_value_4 : children))(new_children);
|
|
1882
|
+
let seq_children = [];
|
|
1883
|
+
let k = 0;
|
|
1884
|
+
while (__eliscript_numeric_relation("<", k, ((callee_locals) ?? []).length)) {
|
|
1885
|
+
{
|
|
1886
|
+
let ltype = (((((callee_locals) ?? [])[k]) ?? null))["type"];
|
|
1887
|
+
(locals)["push"](({"name": (String("inline-") + String((base + k))), "type": ltype, "index": (base + k)}));
|
|
1888
|
+
if (__eliscript_numeric_relation("<", k, callee_arity)) {
|
|
1889
|
+
(seq_children)["push"](({"kind": "set", "type": ltype, "value": (base + k), "children": [((((args) ?? [])[k]) ?? null)]}));
|
|
1890
|
+
} else {
|
|
1891
|
+
{
|
|
1892
|
+
let zero_node = ({"kind": "literal", "type": ltype, "value": ((ltype === "f64") ? 0 : (((ltype === "v64") || (ltype === "bits64")) ? ({"low": 0, "high": 0}) : 0)), "children": []});
|
|
1893
|
+
(seq_children)["push"](({"kind": "set", "type": ltype, "value": (base + k), "children": [zero_node]}));
|
|
1894
|
+
}
|
|
1895
|
+
}
|
|
1896
|
+
}
|
|
1897
|
+
((k = (k + 1)));
|
|
1898
|
+
}
|
|
1899
|
+
(seq_children)["push"](wasm_shift_clone(callee_body, base));
|
|
1900
|
+
((budget)["added"] = ((budget)["added"] + (cand)["size"]));
|
|
1901
|
+
return ({"kind": "sequence", "type": (node)["type"], "children": seq_children});
|
|
1902
|
+
}
|
|
1903
|
+
} else {
|
|
1904
|
+
if (__eliscript_truthy(changed)) {
|
|
1905
|
+
{
|
|
1906
|
+
let copy = Object.assign(({}), node);
|
|
1907
|
+
((copy)["children"] = new_children);
|
|
1908
|
+
return copy;
|
|
1909
|
+
}
|
|
1910
|
+
} else {
|
|
1911
|
+
return node;
|
|
1912
|
+
}
|
|
1913
|
+
}
|
|
1914
|
+
}
|
|
1915
|
+
}
|
|
1916
|
+
}
|
|
1917
|
+
function wasm_build_inline_candidates(functions) {
|
|
1918
|
+
{
|
|
1919
|
+
let count = ((functions) ?? []).length;
|
|
1920
|
+
let candidates = new (globalThis.Array)(count);
|
|
1921
|
+
let any_cand = null;
|
|
1922
|
+
let k = 0;
|
|
1923
|
+
while (__eliscript_numeric_relation("<", k, count)) {
|
|
1924
|
+
{
|
|
1925
|
+
let cand = wasm_inline_candidate(((((functions) ?? [])[k]) ?? null), k);
|
|
1926
|
+
((candidates)[k] = cand);
|
|
1927
|
+
if (__eliscript_truthy(cand)) {
|
|
1928
|
+
((any_cand = true));
|
|
1929
|
+
}
|
|
1930
|
+
}
|
|
1931
|
+
((k = (k + 1)));
|
|
1932
|
+
}
|
|
1933
|
+
if (__eliscript_truthy(any_cand)) {
|
|
1934
|
+
return candidates;
|
|
1935
|
+
} else {
|
|
1936
|
+
return null;
|
|
1937
|
+
}
|
|
1938
|
+
}
|
|
1939
|
+
}
|
|
1940
|
+
function wasm_runtime_prefix_ok(functions, inline_candidates) {
|
|
1941
|
+
{
|
|
1942
|
+
let count = ((functions) ?? []).length;
|
|
1943
|
+
let first_cached = (__eliscript_numeric_relation(">", count, 0) ? runtime_body_cache_get(((((((functions) ?? [])[0]) ?? null))["body"] ?? null)) : null);
|
|
1944
|
+
let rt_id = (__eliscript_truthy(first_cached) ? ((first_cached)["runtimeId"] ?? 0) : 0);
|
|
1945
|
+
let rt_count = (__eliscript_truthy(first_cached) ? ((first_cached)["runtimeFnCount"] ?? 0) : 0);
|
|
1946
|
+
let ok = (__eliscript_numeric_relation(">", rt_id, 0) && __eliscript_numeric_relation(">", rt_count, 0) && __eliscript_numeric_relation("<=", rt_count, count));
|
|
1947
|
+
let ri = 0;
|
|
1948
|
+
while ((__eliscript_truthy(ok) && __eliscript_numeric_relation("<", ri, rt_count))) {
|
|
1949
|
+
{
|
|
1950
|
+
let rfn = ((((functions) ?? [])[ri]) ?? null);
|
|
1951
|
+
let rc = runtime_body_cache_get(((rfn)["body"] ?? null));
|
|
1952
|
+
let cand = ((((inline_candidates) ?? [])[ri]) ?? null);
|
|
1953
|
+
if ((!__eliscript_truthy((__eliscript_truthy(rc) ? (((rc)["runtimeId"] === rt_id) && ((rc)["runtimeFnCount"] === rt_count) && ((rc)["fnIndex"] === ri) && ((rc)["arity"] === (rfn)["arity"])) : (cand === null))))) {
|
|
1954
|
+
((ok = false));
|
|
1955
|
+
}
|
|
1956
|
+
}
|
|
1957
|
+
((ri = (ri + 1)));
|
|
1958
|
+
}
|
|
1959
|
+
if (__eliscript_truthy(ok)) {
|
|
1960
|
+
return rt_count;
|
|
1961
|
+
} else {
|
|
1962
|
+
return 0;
|
|
1963
|
+
}
|
|
1964
|
+
}
|
|
1965
|
+
}
|
|
1966
|
+
function wasm_append_memory_scratch(locals) {
|
|
1967
|
+
{
|
|
1968
|
+
let base = ((locals) ?? []).length;
|
|
1969
|
+
(locals)["push"](({"name": "memory-address", "index": base, "type": "u32"}), ({"name": "memory-word", "index": (base + 1), "type": "u32"}), ({"name": "memory-float", "index": (base + 2), "type": "f64"}), ({"name": "memory-wide", "index": (base + 3), "type": "v64"}));
|
|
1970
|
+
return ({"word": ({"addressLocal": base, "valueLocal": (base + 1)}), "floating": ({"addressLocal": base, "valueLocal": (base + 2)}), "wide": ({"addressLocal": base, "valueLocal": (base + 3)})});
|
|
1971
|
+
}
|
|
1972
|
+
}
|
|
1694
1973
|
function emit_typed_scalar_wasm(program, options, debug = null, consume_owned_bodies = null) {
|
|
1695
1974
|
{
|
|
1696
1975
|
let memory = ((program)["abi"] === "memory-u32");
|
|
1976
|
+
let trusted = ((__eliscript_value_5) => (__eliscript_truthy(__eliscript_value_5) ? trusted_runtime_program_p(program) : __eliscript_value_5))(memory);
|
|
1697
1977
|
let scalar_byte = (__eliscript_truthy(memory) ? 127 : 124);
|
|
1698
|
-
let ro_data = ((
|
|
1978
|
+
let ro_data = ((__eliscript_value_6) => (__eliscript_truthy(__eliscript_value_6) ? __eliscript_value_6 : ((options)["roData"] ?? null)))(((program)["roData"] ?? null));
|
|
1699
1979
|
let active_ro_segments = (__eliscript_truthy(memory) ? build_active_ro_segments(ro_data) : []);
|
|
1700
1980
|
let required_pages = ((__eliscript_truthy(ro_data) && __eliscript_truthy(((ro_data)["header"] ?? null))) ? (globalThis.Math)["max"](1, (globalThis.Math)["ceil"](__eliscript_numeric_div((((ro_data)["header"])["imageDataEnd"] ?? 256), 65536))) : 1);
|
|
1701
1981
|
let raw_initial = ((options)["initialPages"] ?? 1);
|
|
@@ -1716,6 +1996,15 @@ function emit_typed_scalar_wasm(program, options, debug = null, consume_owned_bo
|
|
|
1716
1996
|
let exports = null;
|
|
1717
1997
|
let bodies = null;
|
|
1718
1998
|
let memory_scratch = [];
|
|
1999
|
+
let inline_candidates = ((__eliscript_truthy(memory) && !(__eliscript_truthy(debug))) ? wasm_build_inline_candidates(functions) : null);
|
|
2000
|
+
let rt_prefix_count = (__eliscript_truthy(inline_candidates) ? wasm_runtime_prefix_ok(functions, inline_candidates) : 0);
|
|
2001
|
+
let rt_inline_candidates = ((__eliscript_truthy(inline_candidates) && __eliscript_numeric_relation(">", rt_prefix_count, 0)) ? ((arr, k) => {
|
|
2002
|
+
while (__eliscript_numeric_relation("<", k, rt_prefix_count)) {
|
|
2003
|
+
((arr)[k] = ((((inline_candidates) ?? [])[k]) ?? null));
|
|
2004
|
+
((k = (k + 1)));
|
|
2005
|
+
}
|
|
2006
|
+
return arr;
|
|
2007
|
+
})(new (globalThis.Array)(rt_prefix_count), 0) : null);
|
|
1719
2008
|
let data_texts = [];
|
|
1720
2009
|
let data_indices = new (globalThis.Map)();
|
|
1721
2010
|
let output = null;
|
|
@@ -1733,7 +2022,24 @@ function emit_typed_scalar_wasm(program, options, debug = null, consume_owned_bo
|
|
|
1733
2022
|
{
|
|
1734
2023
|
let position = 0;
|
|
1735
2024
|
while (__eliscript_numeric_relation("<", position, ((functions) ?? []).length)) {
|
|
1736
|
-
|
|
2025
|
+
{
|
|
2026
|
+
let fn = ((((functions) ?? [])[position]) ?? null);
|
|
2027
|
+
let cached = runtime_body_cache_get((fn)["body"]);
|
|
2028
|
+
if ((__eliscript_truthy(cached) && (__eliscript_truthy(trusted) || __eliscript_truthy((cached)["frozen"])))) {
|
|
2029
|
+
if (__eliscript_truthy((cached)["hasMemoryAccess"])) {
|
|
2030
|
+
{
|
|
2031
|
+
let locals = (fn)["locals"];
|
|
2032
|
+
let base = ((locals) ?? []).length;
|
|
2033
|
+
(locals)["push"](({"name": "memory-address", "index": base, "type": "u32"}), ({"name": "memory-word", "index": (base + 1), "type": "u32"}), ({"name": "memory-float", "index": (base + 2), "type": "f64"}), ({"name": "memory-wide", "index": (base + 3), "type": "v64"}));
|
|
2034
|
+
(memory_scratch)["push"](({"word": ({"addressLocal": base, "valueLocal": (base + 1)}), "floating": ({"addressLocal": base, "valueLocal": (base + 2)}), "wide": ({"addressLocal": base, "valueLocal": (base + 3)})}));
|
|
2035
|
+
}
|
|
2036
|
+
} else {
|
|
2037
|
+
(memory_scratch)["push"](undefined);
|
|
2038
|
+
}
|
|
2039
|
+
} else {
|
|
2040
|
+
(memory_scratch)["push"](prepare_memory_scratch(fn));
|
|
2041
|
+
}
|
|
2042
|
+
}
|
|
1737
2043
|
((position = (position + 1)));
|
|
1738
2044
|
}
|
|
1739
2045
|
}
|
|
@@ -1785,8 +2091,8 @@ function emit_typed_scalar_wasm(program, options, debug = null, consume_owned_bo
|
|
|
1785
2091
|
while (__eliscript_numeric_relation("<", position, ((declared_sigs) ?? []).length)) {
|
|
1786
2092
|
{
|
|
1787
2093
|
let entry = ((((declared_sigs) ?? [])[position]) ?? null);
|
|
1788
|
-
let param_types = ((
|
|
1789
|
-
let ret_type = ((
|
|
2094
|
+
let param_types = ((__eliscript_value_7) => (__eliscript_truthy(__eliscript_value_7) ? ((__eliscript_value_8) => (__eliscript_truthy(__eliscript_value_8) ? ((entry)["parameterTypes"] ?? null) : __eliscript_value_8))((__eliscript_value_type(entry) === "object")) : __eliscript_value_7))(entry);
|
|
2095
|
+
let ret_type = ((__eliscript_value_9) => (__eliscript_truthy(__eliscript_value_9) ? ((__eliscript_value_10) => (__eliscript_truthy(__eliscript_value_10) ? ((entry)["resultType"] ?? null) : __eliscript_value_10))((__eliscript_value_type(entry) === "object")) : __eliscript_value_9))(entry);
|
|
1790
2096
|
let params = [];
|
|
1791
2097
|
let i = 0;
|
|
1792
2098
|
if ((!(__eliscript_truthy(entry) && (__eliscript_value_type(entry) === "object") && __eliscript_truthy(Array.isArray(param_types)) && __eliscript_numeric_relation("<=", ((param_types) ?? []).length, 65535) && __eliscript_truthy(ret_type)))) {
|
|
@@ -1803,7 +2109,7 @@ function emit_typed_scalar_wasm(program, options, debug = null, consume_owned_bo
|
|
|
1803
2109
|
}
|
|
1804
2110
|
}
|
|
1805
2111
|
((output = binary_output(options)));
|
|
1806
|
-
((types = binary_child(output)), (declarations = binary_child(output)), (imports = binary_child(output)), (exports = binary_child(output)), (bodies =
|
|
2112
|
+
((types = binary_child(output)), (declarations = binary_child(output)), (imports = binary_child(output)), (exports = binary_child(output)), (bodies = binary_output(({"binaryEncoding": "u16le-chunks"}))));
|
|
1807
2113
|
append_bytes(output, [0, 97, 115, 109, 1, 0, 0, 0]);
|
|
1808
2114
|
if (__eliscript_numeric_relation(">", host_count, 0)) {
|
|
1809
2115
|
unsigned_leb(imports, host_count);
|
|
@@ -1812,7 +2118,7 @@ function emit_typed_scalar_wasm(program, options, debug = null, consume_owned_bo
|
|
|
1812
2118
|
while (__eliscript_numeric_relation("<", position, host_count)) {
|
|
1813
2119
|
{
|
|
1814
2120
|
let capability = ((((capabilities) ?? [])[position]) ?? null);
|
|
1815
|
-
let cap_params = ((
|
|
2121
|
+
let cap_params = ((__eliscript_value_11) => (__eliscript_truthy(__eliscript_value_11) ? __eliscript_value_11 : ["u32", "v64"]))(((capability)["parameterTypes"] ?? null));
|
|
1816
2122
|
let cap_result = ((capability)["resultType"] ?? "v64");
|
|
1817
2123
|
let param_bytes = [];
|
|
1818
2124
|
let i = 0;
|
|
@@ -1834,7 +2140,13 @@ function emit_typed_scalar_wasm(program, options, debug = null, consume_owned_bo
|
|
|
1834
2140
|
}
|
|
1835
2141
|
((index = 0));
|
|
1836
2142
|
while (__eliscript_numeric_relation("<", index, ((functions) ?? []).length)) {
|
|
1837
|
-
|
|
2143
|
+
{
|
|
2144
|
+
let body = (((((functions) ?? [])[index]) ?? null))["body"];
|
|
2145
|
+
let cached = (__eliscript_truthy(memory) ? runtime_body_cache_get(body) : null);
|
|
2146
|
+
if ((!(__eliscript_truthy(cached) && (__eliscript_truthy(trusted) || __eliscript_truthy((cached)["frozen"])) && !(__eliscript_truthy((cached)["hasIndirect"]))))) {
|
|
2147
|
+
prepare_indirect_calls(body, signature_map, allowed_domain_sigs, ((__eliscript_value_12) => (__eliscript_truthy(__eliscript_value_12) ? table : __eliscript_value_12))(memory));
|
|
2148
|
+
}
|
|
2149
|
+
}
|
|
1838
2150
|
((index = (index + 1)));
|
|
1839
2151
|
}
|
|
1840
2152
|
unsigned_leb(types, ((signatures) ?? []).length);
|
|
@@ -1898,55 +2210,246 @@ function emit_typed_scalar_wasm(program, options, debug = null, consume_owned_bo
|
|
|
1898
2210
|
while (__eliscript_numeric_relation("<", index, ((functions) ?? []).length)) {
|
|
1899
2211
|
{
|
|
1900
2212
|
let function$ = ((((functions) ?? [])[index]) ?? null);
|
|
1901
|
-
let
|
|
2213
|
+
let fn_body = (function$)["body"];
|
|
1902
2214
|
let locals = (function$)["locals"];
|
|
1903
|
-
let
|
|
1904
|
-
let
|
|
1905
|
-
|
|
1906
|
-
|
|
1907
|
-
|
|
1908
|
-
|
|
1909
|
-
|
|
1910
|
-
|
|
1911
|
-
|
|
1912
|
-
|
|
1913
|
-
|
|
1914
|
-
|
|
1915
|
-
((body)["wasmDataIndices"] = data_indices);
|
|
1916
|
-
if (__eliscript_truthy(debug)) {
|
|
1917
|
-
((body)["wasmDebug"] = ({"ranges": (debug)["ranges"], "depth": 0, "trapSites": (debug)["trapSites"], "function": (function$)["name"], "functionIndex": (host_count + index)}));
|
|
1918
|
-
}
|
|
1919
|
-
unsigned_leb(body, count);
|
|
1920
|
-
((local_entries_start = ((body) ?? []).length));
|
|
1921
|
-
while (__eliscript_numeric_relation("<", position, ((locals) ?? []).length)) {
|
|
1922
|
-
binary_push(body, 1, result_byte((((((locals) ?? [])[position]) ?? null))["type"]));
|
|
1923
|
-
((position = (position + 1)));
|
|
1924
|
-
}
|
|
1925
|
-
((instructions_start = ((body) ?? []).length));
|
|
1926
|
-
emit_expression(body, (function$)["body"]);
|
|
1927
|
-
binary_push(body, 11);
|
|
1928
|
-
{
|
|
1929
|
-
let size_start = ((bodies) ?? []).length;
|
|
1930
|
-
unsigned_leb(bodies, ((body) ?? []).length);
|
|
1931
|
-
if (__eliscript_truthy(debug)) {
|
|
2215
|
+
let cache_entry = (__eliscript_truthy(memory) ? runtime_body_cache_get(fn_body) : null);
|
|
2216
|
+
let can_cache_body = ((__eliscript_value_13) => (__eliscript_truthy(__eliscript_value_13) ? ((__eliscript_value_14) => (__eliscript_truthy(__eliscript_value_14) ? ((!__eliscript_truthy((cache_entry)["hasIndirect"])) && (!__eliscript_truthy((cache_entry)["hasHostCall"]))) : __eliscript_value_14))(((__eliscript_value_15) => (__eliscript_truthy(__eliscript_value_15) ? __eliscript_value_15 : (cache_entry)["frozen"]))(trusted)) : __eliscript_value_13))(cache_entry);
|
|
2217
|
+
if (__eliscript_truthy(can_cache_body)) {
|
|
2218
|
+
{
|
|
2219
|
+
let arity = (function$)["arity"];
|
|
2220
|
+
let nlocals = ((locals) ?? []).length;
|
|
2221
|
+
let loc_sig = 2166136261;
|
|
2222
|
+
let li = arity;
|
|
2223
|
+
while (__eliscript_numeric_relation("<", li, nlocals)) {
|
|
2224
|
+
((loc_sig = __eliscript_numeric_ushr(__eliscript_numeric_imul(__eliscript_numeric_xor(loc_sig, result_byte((((((locals) ?? [])[li]) ?? null))["type"])), 16777619), 0)));
|
|
2225
|
+
((li = (li + 1)));
|
|
2226
|
+
}
|
|
1932
2227
|
{
|
|
1933
|
-
let
|
|
1934
|
-
let
|
|
1935
|
-
let
|
|
1936
|
-
let
|
|
1937
|
-
|
|
1938
|
-
|
|
2228
|
+
let inline_rt = ((__eliscript_value_16) => (__eliscript_truthy(__eliscript_value_16) ? ((__eliscript_value_17) => (__eliscript_truthy(__eliscript_value_17) ? __eliscript_numeric_relation("<", index, rt_prefix_count) : __eliscript_value_17))(rt_inline_candidates) : __eliscript_value_16))((!__eliscript_truthy(debug)));
|
|
2229
|
+
let trap_site_base = (__eliscript_truthy(debug) ? (((debug)["trapSites"]) ?? []).length : 0);
|
|
2230
|
+
let cache_key = (__eliscript_truthy(debug) ? (String(host_count) + String(":") + String(index) + String(":") + String(arity) + String(":") + String(nlocals) + String(":") + String(loc_sig) + String(":") + String(trap_site_base) + String(":") + String((function$)["name"])) : (String(host_count) + String(":") + String(arity) + String(":") + String(nlocals) + String(":") + String(loc_sig) + String((__eliscript_truthy(inline_rt) ? ":I" : ""))));
|
|
2231
|
+
let wasm_bodies = (__eliscript_truthy(debug) ? ((m) => {
|
|
2232
|
+
if ((!__eliscript_truthy(m))) {
|
|
2233
|
+
((m = new (globalThis.Map)()));
|
|
2234
|
+
((cache_entry)["wasmDebugBodies"] = m);
|
|
2235
|
+
}
|
|
2236
|
+
return m;
|
|
2237
|
+
})(((cache_entry)["wasmDebugBodies"] ?? null)) : (cache_entry)["wasmBodies"]);
|
|
2238
|
+
let has_data_text = (cache_entry)["hasDataText"];
|
|
2239
|
+
let cached_entry = (wasm_bodies)["get"](cache_key);
|
|
2240
|
+
let hit_entry = null;
|
|
2241
|
+
let hit_bytes = null;
|
|
2242
|
+
if (__eliscript_truthy(cached_entry)) {
|
|
2243
|
+
if (!(__eliscript_truthy(has_data_text))) {
|
|
2244
|
+
((hit_entry = cached_entry));
|
|
2245
|
+
((hit_bytes = (__eliscript_truthy(debug) ? (cached_entry)["bytes"] : cached_entry)));
|
|
2246
|
+
} else {
|
|
2247
|
+
{
|
|
2248
|
+
let refs = (cached_entry)["refs"];
|
|
2249
|
+
let ref_indices = (cached_entry)["refIndices"];
|
|
2250
|
+
let rcount = ((refs) ?? []).length;
|
|
2251
|
+
let next_idx = ((data_texts) ?? []).length;
|
|
2252
|
+
let pending = new (globalThis.Map)();
|
|
2253
|
+
let ok = true;
|
|
2254
|
+
let ri = 0;
|
|
2255
|
+
while ((__eliscript_truthy(ok) && __eliscript_numeric_relation("<", ri, rcount))) {
|
|
2256
|
+
{
|
|
2257
|
+
let txt = ((((refs) ?? [])[ri]) ?? null);
|
|
2258
|
+
let existing = (data_indices)["get"](txt);
|
|
2259
|
+
let actual = (!((existing === undefined)) ? existing : ((pend) => {
|
|
2260
|
+
if (!((pend === undefined))) {
|
|
2261
|
+
return pend;
|
|
2262
|
+
} else {
|
|
2263
|
+
{
|
|
2264
|
+
let assigned = next_idx;
|
|
2265
|
+
((next_idx = (next_idx + 1)));
|
|
2266
|
+
(pending)["set"](txt, assigned);
|
|
2267
|
+
return assigned;
|
|
2268
|
+
}
|
|
2269
|
+
}
|
|
2270
|
+
})((pending)["get"](txt)));
|
|
2271
|
+
if ((!(actual === ((((ref_indices) ?? [])[ri]) ?? null)))) {
|
|
2272
|
+
((ok = false));
|
|
2273
|
+
}
|
|
2274
|
+
}
|
|
2275
|
+
((ri = (ri + 1)));
|
|
2276
|
+
}
|
|
2277
|
+
if (__eliscript_truthy(ok)) {
|
|
2278
|
+
(pending)["forEach"](((idx, txt) => {
|
|
2279
|
+
(data_indices)["set"](txt, idx);
|
|
2280
|
+
return (data_texts)["push"](txt);
|
|
2281
|
+
}));
|
|
2282
|
+
((hit_entry = cached_entry));
|
|
2283
|
+
((hit_bytes = (cached_entry)["bytes"]));
|
|
2284
|
+
}
|
|
2285
|
+
}
|
|
2286
|
+
}
|
|
2287
|
+
}
|
|
2288
|
+
if (__eliscript_truthy(hit_bytes)) {
|
|
1939
2289
|
{
|
|
1940
|
-
let
|
|
1941
|
-
((
|
|
1942
|
-
|
|
2290
|
+
let size_start = ((bodies) ?? []).length;
|
|
2291
|
+
unsigned_leb(bodies, ((hit_bytes) ?? []).length);
|
|
2292
|
+
if (__eliscript_truthy(debug)) {
|
|
2293
|
+
{
|
|
2294
|
+
let body_start = ((bodies) ?? []).length;
|
|
2295
|
+
let body_end = (body_start + ((hit_bytes) ?? []).length);
|
|
2296
|
+
replay_wasm_debug_body(debug, function$, host_count, index, __eliscript_numeric_sub(nlocals, arity), body_start, body_end, (hit_entry)["ranges"], (hit_entry)["localEntriesStart"], (hit_entry)["instructionsStart"], size_start);
|
|
2297
|
+
}
|
|
2298
|
+
}
|
|
2299
|
+
binary_append_u8(bodies, hit_bytes);
|
|
2300
|
+
}
|
|
2301
|
+
} else {
|
|
2302
|
+
{
|
|
2303
|
+
let emit_body = fn_body;
|
|
2304
|
+
let emit_locals = locals;
|
|
2305
|
+
let emit_scratch = (__eliscript_truthy(memory) ? ((((memory_scratch) ?? [])[index]) ?? null) : null);
|
|
2306
|
+
if ((__eliscript_truthy(inline_rt) && __eliscript_truthy(wasm_has_inline_site(fn_body, rt_inline_candidates, index)))) {
|
|
2307
|
+
{
|
|
2308
|
+
let tmp_locals = (locals)["slice"]();
|
|
2309
|
+
let budget = ({"added": 0, "maxAdded": 140, "maxLocals": 80});
|
|
2310
|
+
let new_body = wasm_rewrite_inline(fn_body, rt_inline_candidates, index, tmp_locals, budget);
|
|
2311
|
+
if (__eliscript_numeric_relation(">", (budget)["added"], 0)) {
|
|
2312
|
+
((emit_locals = tmp_locals), (emit_body = new_body));
|
|
2313
|
+
if ((__eliscript_truthy(memory) && (emit_scratch === null) && __eliscript_truthy(has_memory_access_p(emit_body)))) {
|
|
2314
|
+
((emit_scratch = wasm_append_memory_scratch(emit_locals)));
|
|
2315
|
+
}
|
|
2316
|
+
}
|
|
2317
|
+
}
|
|
2318
|
+
}
|
|
2319
|
+
{
|
|
2320
|
+
let emit_nlocals = ((emit_locals) ?? []).length;
|
|
2321
|
+
let body = binary_child(bodies);
|
|
2322
|
+
let count = __eliscript_numeric_sub(emit_nlocals, arity);
|
|
2323
|
+
let position = arity;
|
|
2324
|
+
let local_ranges = (__eliscript_truthy(debug) ? [] : null);
|
|
2325
|
+
let local_sites = (__eliscript_truthy(debug) ? [] : null);
|
|
2326
|
+
let local_entries_start = 0;
|
|
2327
|
+
let instructions_start = 0;
|
|
2328
|
+
let refs = ((__eliscript_truthy(has_data_text) && !(__eliscript_truthy(cached_entry))) ? [] : null);
|
|
2329
|
+
let ref_indices = ((__eliscript_truthy(has_data_text) && !(__eliscript_truthy(cached_entry))) ? [] : null);
|
|
2330
|
+
((body)["wasmFunctionBase"] = host_count);
|
|
2331
|
+
((body)["wasmHostCapabilities"] = capabilities);
|
|
2332
|
+
((body)["wasmMemory"] = memory);
|
|
2333
|
+
((body)["wasmDataTexts"] = data_texts);
|
|
2334
|
+
if (__eliscript_truthy(emit_scratch)) {
|
|
2335
|
+
((body)["wasmMemoryScratch"] = emit_scratch);
|
|
2336
|
+
}
|
|
2337
|
+
((body)["wasmDataIndices"] = data_indices);
|
|
2338
|
+
if (__eliscript_truthy(debug)) {
|
|
2339
|
+
((body)["wasmDebug"] = ({"ranges": local_ranges, "depth": 0, "trapSites": local_sites, "trapSiteBase": trap_site_base, "function": (function$)["name"], "functionIndex": (host_count + index)}));
|
|
2340
|
+
}
|
|
2341
|
+
if (__eliscript_truthy(refs)) {
|
|
2342
|
+
((body)["wasmDataRefs"] = refs);
|
|
2343
|
+
((body)["wasmDataRefIndices"] = ref_indices);
|
|
2344
|
+
}
|
|
2345
|
+
unsigned_leb(body, count);
|
|
2346
|
+
((local_entries_start = ((body) ?? []).length));
|
|
2347
|
+
while (__eliscript_numeric_relation("<", position, emit_nlocals)) {
|
|
2348
|
+
binary_push(body, 1, result_byte((((((emit_locals) ?? [])[position]) ?? null))["type"]));
|
|
2349
|
+
((position = (position + 1)));
|
|
2350
|
+
}
|
|
2351
|
+
((instructions_start = ((body) ?? []).length));
|
|
2352
|
+
emit_expression(body, emit_body);
|
|
2353
|
+
binary_push(body, 11);
|
|
2354
|
+
{
|
|
2355
|
+
let u8 = ((!(__eliscript_truthy(cached_entry) && !(__eliscript_truthy(debug)))) ? binary_to_u8(body) : null);
|
|
2356
|
+
let size_start = ((bodies) ?? []).length;
|
|
2357
|
+
if ((!__eliscript_truthy(cached_entry))) {
|
|
2358
|
+
if (__eliscript_truthy(debug)) {
|
|
2359
|
+
(wasm_bodies)["set"](cache_key, ({"bytes": u8, "ranges": local_ranges, "localEntriesStart": local_entries_start, "instructionsStart": instructions_start, "refs": refs, "refIndices": ref_indices}));
|
|
2360
|
+
} else {
|
|
2361
|
+
if (__eliscript_truthy(has_data_text)) {
|
|
2362
|
+
(wasm_bodies)["set"](cache_key, ({"bytes": u8, "refs": refs, "refIndices": ref_indices}));
|
|
2363
|
+
} else {
|
|
2364
|
+
(wasm_bodies)["set"](cache_key, u8);
|
|
2365
|
+
}
|
|
2366
|
+
}
|
|
2367
|
+
}
|
|
2368
|
+
unsigned_leb(bodies, ((body) ?? []).length);
|
|
2369
|
+
if (__eliscript_truthy(debug)) {
|
|
2370
|
+
{
|
|
2371
|
+
let body_start = ((bodies) ?? []).length;
|
|
2372
|
+
let body_end = (body_start + ((body) ?? []).length);
|
|
2373
|
+
replay_wasm_debug_body(debug, function$, host_count, index, count, body_start, body_end, local_ranges, local_entries_start, instructions_start, size_start);
|
|
2374
|
+
}
|
|
2375
|
+
}
|
|
2376
|
+
binary_append_owned(bodies, body);
|
|
2377
|
+
}
|
|
2378
|
+
}
|
|
1943
2379
|
}
|
|
1944
|
-
((i = (i + 1)));
|
|
1945
2380
|
}
|
|
1946
|
-
((debug)["functions"])["push"](({"name": (function$)["name"], "index": (host_count + index), "span": ((function$)["span"] ?? (__eliscript_truthy(source) ? ((source)["span"] ?? null) : null)), "sizeField": ({"start": size_start, "end": body_start}), "body": ({"start": body_start, "end": body_end}), "locals": ({"start": body_start, "entriesStart": (body_start + local_entries_start), "end": (body_start + instructions_start), "count": count}), "instructions": ({"start": (body_start + instructions_start), "end": body_end})}));
|
|
1947
2381
|
}
|
|
1948
2382
|
}
|
|
1949
|
-
|
|
2383
|
+
} else {
|
|
2384
|
+
{
|
|
2385
|
+
let emit_body = fn_body;
|
|
2386
|
+
let emit_locals = locals;
|
|
2387
|
+
let emit_scratch = (__eliscript_truthy(memory) ? ((((memory_scratch) ?? [])[index]) ?? null) : null);
|
|
2388
|
+
if ((__eliscript_truthy(memory) && !(__eliscript_truthy(debug)) && __eliscript_truthy(inline_candidates) && __eliscript_truthy(wasm_has_inline_site(fn_body, inline_candidates, index)))) {
|
|
2389
|
+
{
|
|
2390
|
+
let tmp_locals = (locals)["slice"]();
|
|
2391
|
+
let budget = ({"added": 0, "maxAdded": 140, "maxLocals": 80});
|
|
2392
|
+
let new_body = wasm_rewrite_inline(fn_body, inline_candidates, index, tmp_locals, budget);
|
|
2393
|
+
if (__eliscript_numeric_relation(">", (budget)["added"], 0)) {
|
|
2394
|
+
((emit_locals = tmp_locals), (emit_body = new_body));
|
|
2395
|
+
if (((emit_scratch === null) && __eliscript_truthy(has_memory_access_p(emit_body)))) {
|
|
2396
|
+
((emit_scratch = wasm_append_memory_scratch(emit_locals)));
|
|
2397
|
+
}
|
|
2398
|
+
}
|
|
2399
|
+
}
|
|
2400
|
+
}
|
|
2401
|
+
{
|
|
2402
|
+
let body = binary_child(bodies);
|
|
2403
|
+
let count = __eliscript_numeric_sub(((emit_locals) ?? []).length, (function$)["arity"]);
|
|
2404
|
+
let position = (function$)["arity"];
|
|
2405
|
+
let range_start = (__eliscript_truthy(debug) ? (((debug)["ranges"]) ?? []).length : 0);
|
|
2406
|
+
let local_entries_start = 0;
|
|
2407
|
+
let instructions_start = 0;
|
|
2408
|
+
((body)["wasmFunctionBase"] = host_count);
|
|
2409
|
+
((body)["wasmHostCapabilities"] = capabilities);
|
|
2410
|
+
((body)["wasmMemory"] = memory);
|
|
2411
|
+
((body)["wasmDataTexts"] = data_texts);
|
|
2412
|
+
if (__eliscript_truthy(emit_scratch)) {
|
|
2413
|
+
((body)["wasmMemoryScratch"] = emit_scratch);
|
|
2414
|
+
}
|
|
2415
|
+
((body)["wasmDataIndices"] = data_indices);
|
|
2416
|
+
if (__eliscript_truthy(debug)) {
|
|
2417
|
+
((body)["wasmDebug"] = ({"ranges": (debug)["ranges"], "depth": 0, "trapSites": (debug)["trapSites"], "function": (function$)["name"], "functionIndex": (host_count + index)}));
|
|
2418
|
+
}
|
|
2419
|
+
unsigned_leb(body, count);
|
|
2420
|
+
((local_entries_start = ((body) ?? []).length));
|
|
2421
|
+
while (__eliscript_numeric_relation("<", position, ((emit_locals) ?? []).length)) {
|
|
2422
|
+
binary_push(body, 1, result_byte((((((emit_locals) ?? [])[position]) ?? null))["type"]));
|
|
2423
|
+
((position = (position + 1)));
|
|
2424
|
+
}
|
|
2425
|
+
((instructions_start = ((body) ?? []).length));
|
|
2426
|
+
emit_expression(body, emit_body);
|
|
2427
|
+
binary_push(body, 11);
|
|
2428
|
+
{
|
|
2429
|
+
let size_start = ((bodies) ?? []).length;
|
|
2430
|
+
unsigned_leb(bodies, ((body) ?? []).length);
|
|
2431
|
+
if (__eliscript_truthy(debug)) {
|
|
2432
|
+
{
|
|
2433
|
+
let body_start = ((bodies) ?? []).length;
|
|
2434
|
+
let body_end = (body_start + ((body) ?? []).length);
|
|
2435
|
+
let source = ((function$)["source"] ?? null);
|
|
2436
|
+
let ranges = (debug)["ranges"];
|
|
2437
|
+
let i = range_start;
|
|
2438
|
+
while (__eliscript_numeric_relation("<", i, ((ranges) ?? []).length)) {
|
|
2439
|
+
{
|
|
2440
|
+
let range = ((((ranges) ?? [])[i]) ?? null);
|
|
2441
|
+
((range)["start"] = (body_start + (range)["start"]));
|
|
2442
|
+
((range)["end"] = (body_start + (range)["end"]));
|
|
2443
|
+
}
|
|
2444
|
+
((i = (i + 1)));
|
|
2445
|
+
}
|
|
2446
|
+
((debug)["functions"])["push"](({"name": (function$)["name"], "index": (host_count + index), "span": ((function$)["span"] ?? (__eliscript_truthy(source) ? ((source)["span"] ?? null) : null)), "sizeField": ({"start": size_start, "end": body_start}), "body": ({"start": body_start, "end": body_end}), "locals": ({"start": body_start, "entriesStart": (body_start + local_entries_start), "end": (body_start + instructions_start), "count": count}), "instructions": ({"start": (body_start + instructions_start), "end": body_end})}));
|
|
2447
|
+
}
|
|
2448
|
+
}
|
|
2449
|
+
binary_append_owned(bodies, body);
|
|
2450
|
+
}
|
|
2451
|
+
}
|
|
2452
|
+
}
|
|
1950
2453
|
}
|
|
1951
2454
|
if (__eliscript_truthy(consume_owned_bodies)) {
|
|
1952
2455
|
((function$)["body"] = null);
|
|
@@ -2073,7 +2576,7 @@ function make_wasm_validation_workspace() {
|
|
|
2073
2576
|
function validate_fresh_wasm_expression(expression, parent, memory, workspace = null) {
|
|
2074
2577
|
require_wasm_expression_node(expression, parent, memory);
|
|
2075
2578
|
{
|
|
2076
|
-
let work = ((
|
|
2579
|
+
let work = ((__eliscript_value_18) => (__eliscript_truthy(__eliscript_value_18) ? __eliscript_value_18 : make_wasm_validation_workspace()))(workspace);
|
|
2077
2580
|
let nodes = (work)["nodes"];
|
|
2078
2581
|
let positions = (work)["positions"];
|
|
2079
2582
|
let seen = (work)["seen"];
|
|
@@ -2166,14 +2669,49 @@ function validate_fresh_typed_wasm_program(program) {
|
|
|
2166
2669
|
}
|
|
2167
2670
|
return program;
|
|
2168
2671
|
}
|
|
2672
|
+
function validate_trusted_typed_wasm_program(program) {
|
|
2673
|
+
if ((!(!((program === null)) && (__eliscript_value_type(program) === "object") && !(__eliscript_truthy(Array.isArray(program)))))) {
|
|
2674
|
+
backend_fail(null, "typed WASM emitter requires a program object");
|
|
2675
|
+
}
|
|
2676
|
+
{
|
|
2677
|
+
let functions = (program)["functions"];
|
|
2678
|
+
let memory = ((program)["abi"] === "memory-u32");
|
|
2679
|
+
let trusted = ((__eliscript_value_19) => (__eliscript_truthy(__eliscript_value_19) ? trusted_runtime_program_p(program) : __eliscript_value_19))(((program)["abi"] === "memory-u32"));
|
|
2680
|
+
let workspace = make_wasm_validation_workspace();
|
|
2681
|
+
let index = 0;
|
|
2682
|
+
if ((!__eliscript_truthy(Array.isArray(functions)))) {
|
|
2683
|
+
backend_fail(program, "typed WASM emitter requires declared functions");
|
|
2684
|
+
}
|
|
2685
|
+
while (__eliscript_numeric_relation("<", index, ((functions) ?? []).length)) {
|
|
2686
|
+
{
|
|
2687
|
+
let function$ = ((((functions) ?? [])[index]) ?? null);
|
|
2688
|
+
if ((!(!((function$ === null)) && (__eliscript_value_type(function$) === "object") && !(__eliscript_truthy(Array.isArray(function$))) && __eliscript_truthy(Array.isArray((function$)["locals"]))))) {
|
|
2689
|
+
backend_fail(program, "typed WASM function requires a locals array");
|
|
2690
|
+
}
|
|
2691
|
+
{
|
|
2692
|
+
let body = (function$)["body"];
|
|
2693
|
+
let cached = (__eliscript_truthy(memory) ? runtime_body_cache_get(body) : null);
|
|
2694
|
+
if ((!(__eliscript_truthy(cached) && (__eliscript_truthy(trusted) || __eliscript_truthy((cached)["frozen"])) && __eliscript_truthy((cached)["wasmValidated"])))) {
|
|
2695
|
+
validate_fresh_wasm_expression(body, function$, memory, workspace);
|
|
2696
|
+
if (__eliscript_truthy(cached)) {
|
|
2697
|
+
((cached)["wasmValidated"] = true);
|
|
2698
|
+
}
|
|
2699
|
+
}
|
|
2700
|
+
}
|
|
2701
|
+
}
|
|
2702
|
+
((index = (index + 1)));
|
|
2703
|
+
}
|
|
2704
|
+
}
|
|
2705
|
+
return program;
|
|
2706
|
+
}
|
|
2169
2707
|
function emit_fresh_managed_wasm_product(lowered, configure) {
|
|
2170
2708
|
if ((!(__eliscript_value_type(configure) === "function"))) {
|
|
2171
2709
|
backend_fail(null, "managed WASM product requires an output configuration callback");
|
|
2172
2710
|
}
|
|
2173
2711
|
{
|
|
2174
2712
|
let configuration = configure();
|
|
2175
|
-
let typed =
|
|
2176
|
-
let memory = ((
|
|
2713
|
+
let typed = validate_trusted_typed_wasm_program(mark_trusted_runtime_program((lowered)["typed"]));
|
|
2714
|
+
let memory = ((__eliscript_value_20) => (__eliscript_truthy(__eliscript_value_20) ? __eliscript_value_20 : ({})))(((configuration)["memory"] ?? null));
|
|
2177
2715
|
let debug = ((((configuration)["debug"] ?? false) === true) ? ({"format": "eliscript-wasm-source-map", "target": "wasm32", "abi": "memory-u32", "offsetUnit": "byte", "offsetBase": "module", "functions": [], "ranges": []}) : null);
|
|
2178
2716
|
let descriptor = (lowered)["descriptor"];
|
|
2179
2717
|
let output = append_metadata_section(emit_typed_scalar_wasm(typed, memory, debug, true), "eliscript-managed-control", JSON.stringify(descriptor));
|
|
@@ -2187,18 +2725,16 @@ function emit_fresh_managed_wasm_product(lowered, configure) {
|
|
|
2187
2725
|
}
|
|
2188
2726
|
}
|
|
2189
2727
|
function managed_wasm_product_fail(node, message, phase = null) {
|
|
2190
|
-
|
|
2191
|
-
|
|
2192
|
-
|
|
2193
|
-
|
|
2194
|
-
|
|
2195
|
-
|
|
2196
|
-
}
|
|
2197
|
-
})();
|
|
2728
|
+
try {
|
|
2729
|
+
return backend_fail(node, message);
|
|
2730
|
+
} catch (error) {
|
|
2731
|
+
(((error)["eliscriptDiagnostic"])["phase"] = ((__eliscript_value_21) => (__eliscript_truthy(__eliscript_value_21) ? __eliscript_value_21 : "managed-backend"))(phase));
|
|
2732
|
+
return ((__eliscript_value_22) => { throw __eliscript_value_22; })(error);
|
|
2733
|
+
}
|
|
2198
2734
|
}
|
|
2199
2735
|
function emit_managed_ir_wasm_product(program, runtime_program, lower_options, configure) {
|
|
2200
2736
|
{
|
|
2201
|
-
let options = ((
|
|
2737
|
+
let options = ((__eliscript_value_23) => (__eliscript_truthy(__eliscript_value_23) ? __eliscript_value_23 : ({})))(lower_options);
|
|
2202
2738
|
let requested = ((options)["abi"] ?? null);
|
|
2203
2739
|
let lowered = lower_managed_program(program, runtime_program, (requested === "managed-module"), null, null, null, null, null, null, ((options)["literalModules"] ?? null));
|
|
2204
2740
|
if ((!((requested === null)) && !(((requested === "managed-control") || (requested === "managed-module"))))) {
|
|
@@ -2212,7 +2748,7 @@ function emit_managed_ir_wasm_product(program, runtime_program, lower_options, c
|
|
|
2212
2748
|
}
|
|
2213
2749
|
function emit_managed_project_wasm_product(modules, entry, runtime_program, lower_options, configure) {
|
|
2214
2750
|
{
|
|
2215
|
-
let requested = ((((
|
|
2751
|
+
let requested = ((((__eliscript_value_24) => (__eliscript_truthy(__eliscript_value_24) ? __eliscript_value_24 : ({})))(lower_options))["abi"] ?? null);
|
|
2216
2752
|
let lowered = lower_managed_project(modules, entry, runtime_program, lower_options);
|
|
2217
2753
|
if ((!((requested === null)) && !((requested === "managed-module")))) {
|
|
2218
2754
|
managed_wasm_product_fail(null, "managed projects require managed-module", "managed-link");
|
|
@@ -2224,22 +2760,22 @@ function emit_typed_numeric_wasm(program, options = null) {
|
|
|
2224
2760
|
if ((!((program)["abi"] === "numeric-f64"))) {
|
|
2225
2761
|
backend_fail(program, "WASM emitter requires numeric-f64 typed input");
|
|
2226
2762
|
}
|
|
2227
|
-
return binary_finish(emit_typed_scalar_wasm(copy_typed_wasm_program(program), ((
|
|
2763
|
+
return binary_finish(emit_typed_scalar_wasm(copy_typed_wasm_program(program), ((__eliscript_value_25) => (__eliscript_truthy(__eliscript_value_25) ? __eliscript_value_25 : ({})))(options)));
|
|
2228
2764
|
}
|
|
2229
2765
|
function emit_memory_wasm(program, options = null) {
|
|
2230
|
-
return binary_finish(emit_typed_scalar_wasm(lower_memory_program(program), ((
|
|
2766
|
+
return binary_finish(emit_typed_scalar_wasm(lower_memory_program(program), ((__eliscript_value_26) => (__eliscript_truthy(__eliscript_value_26) ? __eliscript_value_26 : ({})))(options)));
|
|
2231
2767
|
}
|
|
2232
2768
|
function emit_owned_memory_wasm(program, options = null) {
|
|
2233
2769
|
if ((!((program)["abi"] === "memory-u32"))) {
|
|
2234
2770
|
backend_fail(program, "owned memory emitter requires memory-u32");
|
|
2235
2771
|
}
|
|
2236
|
-
return binary_finish(emit_typed_scalar_wasm(
|
|
2772
|
+
return binary_finish(emit_typed_scalar_wasm(validate_trusted_typed_wasm_program(program), ((__eliscript_value_27) => (__eliscript_truthy(__eliscript_value_27) ? __eliscript_value_27 : ({})))(options), null, true));
|
|
2237
2773
|
}
|
|
2238
2774
|
function emit_typed_memory_wasm(program, options = null) {
|
|
2239
2775
|
if ((!((program)["abi"] === "memory-u32"))) {
|
|
2240
2776
|
backend_fail(program, "typed memory emitter requires memory-u32");
|
|
2241
2777
|
}
|
|
2242
|
-
return binary_finish(emit_typed_scalar_wasm(copy_typed_wasm_program(program), ((
|
|
2778
|
+
return binary_finish(emit_typed_scalar_wasm(copy_typed_wasm_program(program), ((__eliscript_value_28) => (__eliscript_truthy(__eliscript_value_28) ? __eliscript_value_28 : ({})))(options)));
|
|
2243
2779
|
}
|
|
2244
2780
|
function emit_typed_memory_wasm_artifact(program, options = null) {
|
|
2245
2781
|
if ((!((program)["abi"] === "memory-u32"))) {
|
|
@@ -2247,7 +2783,7 @@ function emit_typed_memory_wasm_artifact(program, options = null) {
|
|
|
2247
2783
|
}
|
|
2248
2784
|
{
|
|
2249
2785
|
let debug = ({"format": "eliscript-wasm-source-map", "target": "wasm32", "abi": "memory-u32", "offsetUnit": "byte", "offsetBase": "module", "functions": [], "ranges": []});
|
|
2250
|
-
let bytes = emit_typed_scalar_wasm(copy_typed_wasm_program(program), ((
|
|
2786
|
+
let bytes = emit_typed_scalar_wasm(copy_typed_wasm_program(program), ((__eliscript_value_29) => (__eliscript_truthy(__eliscript_value_29) ? __eliscript_value_29 : ({})))(options), debug);
|
|
2251
2787
|
((debug)["moduleByteLength"] = ((bytes) ?? []).length);
|
|
2252
2788
|
return ({"bytes": binary_finish(bytes), "debug": debug});
|
|
2253
2789
|
}
|