@scriptc/compiler 0.0.35 → 0.1.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/ambient/scriptc-node-fallback.d.ts +14 -11
- package/ambient/scriptc-overrides.d.ts +0 -7
- package/ambient/scriptc.d.ts +1 -1
- package/dist/backend/build-cache.d.ts +44 -0
- package/dist/backend/build-cache.js +241 -0
- package/dist/backend/build-cache.js.map +1 -0
- package/dist/backend/{emission/emit-async.d.ts → c/async.d.ts} +21 -30
- package/dist/backend/{emission/emit-async.js → c/async.js} +270 -286
- package/dist/backend/c/async.js.map +1 -0
- package/dist/backend/{emission/emitter.d.ts → c/c-emitter.d.ts} +6 -23
- package/dist/backend/{emission/emitter.js → c/c-emitter.js} +53 -107
- package/dist/backend/c/c-emitter.js.map +1 -0
- package/dist/backend/c/exprs.d.ts +8 -0
- package/dist/backend/c/exprs.js +7937 -0
- package/dist/backend/c/exprs.js.map +1 -0
- package/dist/backend/{emission/emit-island.d.ts → c/island.d.ts} +5 -5
- package/dist/backend/{emission/emit-island.js → c/island.js} +24 -22
- package/dist/backend/c/island.js.map +1 -0
- package/dist/backend/{emission → c}/may-throw.d.ts +1 -1
- package/dist/backend/{emission → c}/may-throw.js +4 -1
- package/dist/backend/c/may-throw.js.map +1 -0
- package/dist/backend/{emission/emit-shapes.d.ts → c/shapes.d.ts} +19 -19
- package/dist/backend/{emission/emit-shapes.js → c/shapes.js} +78 -87
- package/dist/backend/c/shapes.js.map +1 -0
- package/dist/backend/{emission/emit-stmts.d.ts → c/stmts.d.ts} +12 -12
- package/dist/backend/{emission/emit-stmts.js → c/stmts.js} +395 -343
- package/dist/backend/c/stmts.js.map +1 -0
- package/dist/backend/{emission/emit-types.d.ts → c/types.d.ts} +1 -1
- package/dist/backend/{emission/emit-types.js → c/types.js} +42 -286
- package/dist/backend/c/types.js.map +1 -0
- package/dist/backend/c/types.test.js +25 -0
- package/dist/backend/c/types.test.js.map +1 -0
- package/dist/backend/{emission/emit-walkers.d.ts → c/walkers.d.ts} +19 -41
- package/dist/backend/{emission/emit-walkers.js → c/walkers.js} +242 -304
- package/dist/backend/c/walkers.js.map +1 -0
- package/dist/backend/external-c.d.ts +33 -0
- package/dist/backend/external-c.js +51 -0
- package/dist/backend/external-c.js.map +1 -0
- package/dist/backend/ffi-callbacks.d.ts +1 -1
- package/dist/backend/ffi-callbacks.js +4 -3
- package/dist/backend/ffi-callbacks.js.map +1 -1
- package/dist/backend/{library-identity.d.ts → library-identity-markers.d.ts} +0 -4
- package/dist/backend/{library-identity.js → library-identity-markers.js} +10 -9
- package/dist/backend/library-identity-markers.js.map +1 -0
- package/dist/backend/link-plan.d.ts +37 -0
- package/dist/backend/link-plan.js +26 -0
- package/dist/backend/link-plan.js.map +1 -0
- package/dist/backend/linker.d.ts +22 -0
- package/dist/backend/linker.js +236 -0
- package/dist/backend/linker.js.map +1 -0
- package/dist/backend/llvm/blocks.d.ts +4 -0
- package/dist/backend/llvm/blocks.js +29 -0
- package/dist/backend/llvm/blocks.js.map +1 -1
- package/dist/backend/llvm/classes.d.ts +2 -19
- package/dist/backend/llvm/classes.js +20 -52
- package/dist/backend/llvm/classes.js.map +1 -1
- package/dist/backend/llvm/common.d.ts +4 -0
- package/dist/backend/llvm/common.js +27 -0
- package/dist/backend/llvm/common.js.map +1 -0
- package/dist/backend/llvm/dyn.d.ts +3 -8
- package/dist/backend/llvm/dyn.js +159 -224
- package/dist/backend/llvm/dyn.js.map +1 -1
- package/dist/backend/llvm/emitter.d.ts +4 -1
- package/dist/backend/llvm/emitter.js +548 -9988
- package/dist/backend/llvm/emitter.js.map +1 -1
- package/dist/backend/llvm/expr-async.d.ts +4 -0
- package/dist/backend/llvm/expr-async.js +726 -0
- package/dist/backend/llvm/expr-async.js.map +1 -0
- package/dist/backend/llvm/expr-bytes.d.ts +13 -0
- package/dist/backend/llvm/expr-bytes.js +456 -0
- package/dist/backend/llvm/expr-bytes.js.map +1 -0
- package/dist/backend/llvm/expr-callbacks.d.ts +22 -0
- package/dist/backend/llvm/expr-callbacks.js +520 -0
- package/dist/backend/llvm/expr-callbacks.js.map +1 -0
- package/dist/backend/llvm/expr-calls.d.ts +2 -0
- package/dist/backend/llvm/expr-calls.js +618 -0
- package/dist/backend/llvm/expr-calls.js.map +1 -0
- package/dist/backend/llvm/expr-containers.d.ts +25 -0
- package/dist/backend/llvm/expr-containers.js +637 -0
- package/dist/backend/llvm/expr-containers.js.map +1 -0
- package/dist/backend/llvm/expr-context.d.ts +255 -0
- package/dist/backend/llvm/expr-context.js +2 -0
- package/dist/backend/llvm/expr-context.js.map +1 -0
- package/dist/backend/llvm/expr-control.d.ts +2 -0
- package/dist/backend/llvm/expr-control.js +473 -0
- package/dist/backend/llvm/expr-control.js.map +1 -0
- package/dist/backend/llvm/expr-dispatch.d.ts +4 -0
- package/dist/backend/llvm/expr-dispatch.js +153 -0
- package/dist/backend/llvm/expr-dispatch.js.map +1 -0
- package/dist/backend/llvm/expr-dynamic.d.ts +2 -0
- package/dist/backend/llvm/expr-dynamic.js +810 -0
- package/dist/backend/llvm/expr-dynamic.js.map +1 -0
- package/dist/backend/llvm/expr-island.d.ts +15 -0
- package/dist/backend/llvm/expr-island.js +690 -0
- package/dist/backend/llvm/expr-island.js.map +1 -0
- package/dist/backend/llvm/expr-primitives.d.ts +6 -0
- package/dist/backend/llvm/expr-primitives.js +642 -0
- package/dist/backend/llvm/expr-primitives.js.map +1 -0
- package/dist/backend/llvm/expr-records.d.ts +9 -0
- package/dist/backend/llvm/expr-records.js +299 -0
- package/dist/backend/llvm/expr-records.js.map +1 -0
- package/dist/backend/llvm/expr-stream-bridges.d.ts +13 -0
- package/dist/backend/llvm/expr-stream-bridges.js +420 -0
- package/dist/backend/llvm/expr-stream-bridges.js.map +1 -0
- package/dist/backend/llvm/expr-stream-callbacks.d.ts +12 -0
- package/dist/backend/llvm/expr-stream-callbacks.js +360 -0
- package/dist/backend/llvm/expr-stream-callbacks.js.map +1 -0
- package/dist/backend/llvm/lib-dispatch.d.ts +5 -0
- package/dist/backend/llvm/lib-dispatch.js +267 -0
- package/dist/backend/llvm/lib-dispatch.js.map +1 -0
- package/dist/backend/llvm/lib-filesystem.d.ts +6 -0
- package/dist/backend/llvm/lib-filesystem.js +594 -0
- package/dist/backend/llvm/lib-filesystem.js.map +1 -0
- package/dist/backend/llvm/lib-network.d.ts +2 -0
- package/dist/backend/llvm/lib-network.js +429 -0
- package/dist/backend/llvm/lib-network.js.map +1 -0
- package/dist/backend/llvm/lib-process.d.ts +5 -0
- package/dist/backend/llvm/lib-process.js +585 -0
- package/dist/backend/llvm/lib-process.js.map +1 -0
- package/dist/backend/llvm/lib-shared.d.ts +6 -0
- package/dist/backend/llvm/lib-shared.js +687 -0
- package/dist/backend/llvm/lib-shared.js.map +1 -0
- package/dist/backend/llvm/lib-stream.d.ts +2 -0
- package/dist/backend/llvm/lib-stream.js +470 -0
- package/dist/backend/llvm/lib-stream.js.map +1 -0
- package/dist/backend/llvm/shapes.d.ts +12 -2
- package/dist/backend/llvm/shapes.js +66 -307
- package/dist/backend/llvm/shapes.js.map +1 -1
- package/dist/backend/llvm/shapes.test.js +52 -0
- package/dist/backend/llvm/shapes.test.js.map +1 -0
- package/dist/backend/llvm/unsupported.d.ts +1 -1
- package/dist/backend/llvm/walkers.d.ts +2 -3
- package/dist/backend/llvm/walkers.js +195 -222
- package/dist/backend/llvm/walkers.js.map +1 -1
- package/dist/backend/native-codegen.d.ts +45 -0
- package/dist/backend/native-codegen.js +275 -0
- package/dist/backend/native-codegen.js.map +1 -0
- package/dist/backend/native-codegen.test.js +226 -0
- package/dist/backend/native-codegen.test.js.map +1 -0
- package/dist/backend/native-link-info.d.ts +96 -0
- package/dist/backend/native-link-info.js +243 -0
- package/dist/backend/native-link-info.js.map +1 -0
- package/dist/backend/native-link-info.test.d.ts +1 -0
- package/dist/backend/native-link-info.test.js +134 -0
- package/dist/backend/native-link-info.test.js.map +1 -0
- package/dist/backend/{cc.d.ts → native-toolchain.d.ts} +54 -34
- package/dist/backend/{cc.js → native-toolchain.js} +231 -810
- package/dist/backend/native-toolchain.js.map +1 -0
- package/dist/backend/native-toolchain.test.d.ts +1 -0
- package/dist/backend/{cc-cache.test.js → native-toolchain.test.js} +219 -7
- package/dist/backend/native-toolchain.test.js.map +1 -0
- package/dist/backend/object-localize.js +1 -1
- package/dist/backend/runtime-abi.d.ts +10 -0
- package/dist/backend/runtime-abi.js +11 -0
- package/dist/backend/runtime-abi.js.map +1 -0
- package/dist/backend/runtime-pack-targets.test.d.ts +1 -0
- package/dist/backend/runtime-pack-targets.test.js +54 -0
- package/dist/backend/runtime-pack-targets.test.js.map +1 -0
- package/dist/backend/runtime-pack.d.ts +112 -0
- package/dist/backend/runtime-pack.js +305 -0
- package/dist/backend/runtime-pack.js.map +1 -0
- package/dist/backend/runtime-pack.test.d.ts +1 -0
- package/dist/backend/runtime-pack.test.js +473 -0
- package/dist/backend/runtime-pack.test.js.map +1 -0
- package/dist/backend/targets.d.ts +76 -0
- package/dist/backend/targets.js +262 -0
- package/dist/backend/targets.js.map +1 -0
- package/dist/backend/targets.test.d.ts +1 -0
- package/dist/backend/targets.test.js +41 -0
- package/dist/backend/targets.test.js.map +1 -0
- package/dist/backend/vendor-archives.d.ts +41 -0
- package/dist/backend/vendor-archives.js +462 -0
- package/dist/backend/vendor-archives.js.map +1 -0
- package/dist/compat/fetch-profile.d.ts +0 -1
- package/dist/compat/fetch-profile.js +0 -1
- package/dist/compat/fetch-profile.js.map +1 -1
- package/dist/coverage/report.js +3 -3
- package/dist/coverage/report.js.map +1 -1
- package/dist/coverage/surface-manifest.js +35 -33
- package/dist/coverage/surface-manifest.js.map +1 -1
- package/dist/diagnostics/diagnostic.d.ts +11 -12
- package/dist/diagnostics/diagnostic.js +19 -17
- package/dist/diagnostics/diagnostic.js.map +1 -1
- package/dist/diagnostics/render.d.ts +1 -1
- package/dist/diagnostics/render.js +1 -1
- package/dist/diagnostics/render.js.map +1 -1
- package/dist/errors.d.ts +5 -0
- package/dist/errors.js +9 -0
- package/dist/errors.js.map +1 -0
- package/dist/executable/{early-cache.d.ts → executable-cache.d.ts} +2 -2
- package/dist/executable/{early-cache.js → executable-cache.js} +36 -98
- package/dist/executable/executable-cache.js.map +1 -0
- package/dist/executable/executable-cache.test.d.ts +1 -0
- package/dist/executable/{early-cache.test.js → executable-cache.test.js} +3 -3
- package/dist/executable/executable-cache.test.js.map +1 -0
- package/dist/ffi/{profile.js → ffi-manifest.js} +1 -1
- package/dist/ffi/ffi-manifest.js.map +1 -0
- package/dist/frontend/builtin-modules.d.ts +21 -0
- package/dist/frontend/builtin-modules.js +82 -0
- package/dist/frontend/builtin-modules.js.map +1 -0
- package/dist/frontend/cjs-lexer.d.ts +7 -0
- package/dist/frontend/cjs-lexer.js +15 -17
- package/dist/frontend/cjs-lexer.js.map +1 -1
- package/dist/frontend/dts-paths.d.ts +26 -0
- package/dist/frontend/dts-paths.js +41 -0
- package/dist/frontend/dts-paths.js.map +1 -0
- package/dist/frontend/input-tracker.d.ts +0 -2
- package/dist/frontend/input-tracker.js +1 -4
- package/dist/frontend/input-tracker.js.map +1 -1
- package/dist/frontend/lib-contract.d.ts +1 -5
- package/dist/frontend/lib-contract.js +1 -1
- package/dist/frontend/lib-contract.js.map +1 -1
- package/dist/frontend/lib-exports.d.ts +1 -1
- package/dist/frontend/lowering/array-values.d.ts +8 -0
- package/dist/frontend/lowering/array-values.js +60 -0
- package/dist/frontend/lowering/array-values.js.map +1 -0
- package/dist/frontend/lowering/call-position.d.ts +4 -0
- package/dist/frontend/lowering/call-position.js +7 -0
- package/dist/frontend/lowering/call-position.js.map +1 -0
- package/dist/frontend/lowering/callback-arg.d.ts +20 -0
- package/dist/frontend/lowering/callback-arg.js +44 -0
- package/dist/frontend/lowering/callback-arg.js.map +1 -0
- package/dist/frontend/lowering/lib-boundary.d.ts +1 -1
- package/dist/frontend/lowering/lib-boundary.js +34 -34
- package/dist/frontend/lowering/lib-boundary.js.map +1 -1
- package/dist/frontend/lowering/lower-array-sort.d.ts +22 -0
- package/dist/frontend/lowering/lower-array-sort.js +619 -0
- package/dist/frontend/lowering/lower-array-sort.js.map +1 -0
- package/dist/frontend/lowering/lower-assert.d.ts +3 -3
- package/dist/frontend/lowering/lower-assert.js +214 -241
- package/dist/frontend/lowering/lower-assert.js.map +1 -1
- package/dist/frontend/lowering/lower-builtins.d.ts +74 -146
- package/dist/frontend/lowering/lower-builtins.js +1285 -1233
- package/dist/frontend/lowering/lower-builtins.js.map +1 -1
- package/dist/frontend/lowering/lower-calls.d.ts +59 -192
- package/dist/frontend/lowering/lower-calls.js +1644 -1506
- package/dist/frontend/lowering/lower-calls.js.map +1 -1
- package/dist/frontend/lowering/lower-classes.d.ts +62 -125
- package/dist/frontend/lowering/lower-classes.js +832 -866
- package/dist/frontend/lowering/lower-classes.js.map +1 -1
- package/dist/frontend/lowering/lower-comptime.d.ts +5 -12
- package/dist/frontend/lowering/lower-comptime.js +32 -31
- package/dist/frontend/lowering/lower-comptime.js.map +1 -1
- package/dist/frontend/lowering/lower-containers.d.ts +35 -135
- package/dist/frontend/lowering/lower-containers.js +1984 -2227
- package/dist/frontend/lowering/lower-containers.js.map +1 -1
- package/dist/frontend/lowering/lower-dgram.d.ts +3 -7
- package/dist/frontend/lowering/lower-dgram.js +97 -111
- package/dist/frontend/lowering/lower-dgram.js.map +1 -1
- package/dist/frontend/lowering/lower-enums.d.ts +4 -4
- package/dist/frontend/lowering/lower-enums.js +30 -30
- package/dist/frontend/lowering/lower-enums.js.map +1 -1
- package/dist/frontend/lowering/{lower-emitter.d.ts → lower-event-emitter.d.ts} +7 -18
- package/dist/frontend/lowering/{lower-emitter.js → lower-event-emitter.js} +172 -174
- package/dist/frontend/lowering/lower-event-emitter.js.map +1 -0
- package/dist/frontend/lowering/lower-expando.d.ts +5 -5
- package/dist/frontend/lowering/lower-expando.js +40 -40
- package/dist/frontend/lowering/lower-expando.js.map +1 -1
- package/dist/frontend/lowering/lower-exprs.d.ts +60 -264
- package/dist/frontend/lowering/lower-exprs.js +2361 -1765
- package/dist/frontend/lowering/lower-exprs.js.map +1 -1
- package/dist/frontend/lowering/lower-generators.d.ts +6 -6
- package/dist/frontend/lowering/lower-generators.js +73 -72
- package/dist/frontend/lowering/lower-generators.js.map +1 -1
- package/dist/frontend/lowering/lower-inspect.d.ts +5 -17
- package/dist/frontend/lowering/lower-inspect.js +273 -261
- package/dist/frontend/lowering/lower-inspect.js.map +1 -1
- package/dist/frontend/lowering/lower-island.d.ts +39 -49
- package/dist/frontend/lowering/lower-island.js +447 -513
- package/dist/frontend/lowering/lower-island.js.map +1 -1
- package/dist/frontend/lowering/lower-mixins.d.ts +7 -10
- package/dist/frontend/lowering/lower-mixins.js +85 -85
- package/dist/frontend/lowering/lower-mixins.js.map +1 -1
- package/dist/frontend/lowering/lower-modules.d.ts +12 -18
- package/dist/frontend/lowering/lower-modules.js +284 -283
- package/dist/frontend/lowering/lower-modules.js.map +1 -1
- package/dist/frontend/lowering/lower-namespaces.d.ts +23 -49
- package/dist/frontend/lowering/lower-namespaces.js +123 -115
- package/dist/frontend/lowering/lower-namespaces.js.map +1 -1
- package/dist/frontend/lowering/lower-server.d.ts +18 -25
- package/dist/frontend/lowering/lower-server.js +909 -899
- package/dist/frontend/lowering/lower-server.js.map +1 -1
- package/dist/frontend/lowering/lower-stmts.d.ts +30 -149
- package/dist/frontend/lowering/lower-stmts.js +1463 -1285
- package/dist/frontend/lowering/lower-stmts.js.map +1 -1
- package/dist/frontend/lowering/lower-stream.d.ts +12 -12
- package/dist/frontend/lowering/lower-stream.js +300 -301
- package/dist/frontend/lowering/lower-stream.js.map +1 -1
- package/dist/frontend/lowering/lower-test.d.ts +5 -5
- package/dist/frontend/lowering/lower-test.js +82 -82
- package/dist/frontend/lowering/lower-test.js.map +1 -1
- package/dist/frontend/lowering/lowerer.d.ts +134 -22
- package/dist/frontend/lowering/lowerer.js +1277 -126
- package/dist/frontend/lowering/lowerer.js.map +1 -1
- package/dist/frontend/lowering/pairs-snapshot.d.ts +11 -0
- package/dist/frontend/lowering/pairs-snapshot.js +85 -0
- package/dist/frontend/lowering/pairs-snapshot.js.map +1 -0
- package/dist/frontend/lowering/static-this.d.ts +6 -0
- package/dist/frontend/lowering/static-this.js +24 -0
- package/dist/frontend/lowering/static-this.js.map +1 -0
- package/dist/frontend/lowering/surfaces.d.ts +24 -35
- package/dist/frontend/lowering/surfaces.js +78 -66
- package/dist/frontend/lowering/surfaces.js.map +1 -1
- package/dist/frontend/npm-static-rewrite.js +6 -28
- package/dist/frontend/npm-static-rewrite.js.map +1 -1
- package/dist/frontend/npm-static.d.ts +0 -10
- package/dist/frontend/npm-static.js +4 -7
- package/dist/frontend/npm-static.js.map +1 -1
- package/dist/frontend/npm.d.ts +0 -24
- package/dist/frontend/npm.js +11 -85
- package/dist/frontend/npm.js.map +1 -1
- package/dist/frontend/program.d.ts +3 -1
- package/dist/frontend/program.js +9 -4
- package/dist/frontend/program.js.map +1 -1
- package/dist/frontend/provenance-registry.d.ts +0 -2
- package/dist/frontend/provenance-registry.js +0 -10
- package/dist/frontend/provenance-registry.js.map +1 -1
- package/dist/frontend/provenance.js +4 -7
- package/dist/frontend/provenance.js.map +1 -1
- package/dist/frontend/resolve.d.ts +7 -2
- package/dist/frontend/resolve.js +12 -17
- package/dist/frontend/resolve.js.map +1 -1
- package/dist/frontend/resolve.test.d.ts +1 -0
- package/dist/frontend/resolve.test.js +29 -0
- package/dist/frontend/resolve.test.js.map +1 -0
- package/dist/frontend/ts7/adapter.d.ts +2 -2
- package/dist/frontend/ts7/adapter.js +1 -1
- package/dist/frontend/ts7/adapter.js.map +1 -1
- package/dist/frontend/ts7/checker.js +2 -36
- package/dist/frontend/ts7/checker.js.map +1 -1
- package/dist/frontend/ts7/enums.js +2 -1
- package/dist/frontend/ts7/enums.js.map +1 -1
- package/dist/frontend/ts7/{program.js → program-adapter.js} +7 -6
- package/dist/frontend/ts7/program-adapter.js.map +1 -0
- package/dist/frontend/ts7/world-check.d.ts +1 -3
- package/dist/frontend/ts7/world-check.js +3 -1
- package/dist/frontend/ts7/world-check.js.map +1 -1
- package/dist/frontend/tsc-codes.d.ts +8 -0
- package/dist/frontend/tsc-codes.js +109 -0
- package/dist/frontend/tsc-codes.js.map +1 -0
- package/dist/frontend/{types.d.ts → type-mapper.d.ts} +2 -25
- package/dist/frontend/{types.js → type-mapper.js} +12 -11
- package/dist/frontend/type-mapper.js.map +1 -0
- package/dist/frontend/workspace-registry.d.ts +26 -0
- package/dist/frontend/workspace-registry.js +71 -0
- package/dist/frontend/workspace-registry.js.map +1 -0
- package/dist/index.d.ts +113 -31
- package/dist/index.js +536 -128
- package/dist/index.js.map +1 -1
- package/dist/ir/analysis.d.ts +37 -0
- package/dist/ir/analysis.js +118 -0
- package/dist/ir/analysis.js.map +1 -0
- package/dist/ir/analysis.test.d.ts +1 -0
- package/dist/ir/analysis.test.js +21 -0
- package/dist/ir/analysis.test.js.map +1 -0
- package/dist/ir/build.d.ts +9 -0
- package/dist/ir/build.js +33 -0
- package/dist/ir/build.js.map +1 -0
- package/dist/ir/integer-loops.d.ts +1 -1
- package/dist/ir/{nodes.d.ts → ir.d.ts} +119 -37
- package/dist/ir/{nodes.js → ir.js} +170 -166
- package/dist/ir/ir.js.map +1 -0
- package/dist/ir/ir.test.d.ts +1 -0
- package/dist/ir/ir.test.js +17 -0
- package/dist/ir/ir.test.js.map +1 -0
- package/dist/ir/serialize.d.ts +2 -2
- package/dist/ir/serialize.js +3 -2
- package/dist/ir/serialize.js.map +1 -1
- package/dist/ir/validate.d.ts +1 -1
- package/dist/ir/validate.js +93 -41
- package/dist/ir/validate.js.map +1 -1
- package/dist/library/cache-primitives.d.ts +24 -0
- package/dist/library/cache-primitives.js +83 -0
- package/dist/library/cache-primitives.js.map +1 -0
- package/dist/library/cache-reset.test.d.ts +1 -0
- package/dist/library/cache-reset.test.js +47 -0
- package/dist/library/cache-reset.test.js.map +1 -0
- package/dist/library/{implementation-identity.js → compiler-self-identity.js} +1 -1
- package/dist/library/compiler-self-identity.js.map +1 -0
- package/dist/library/fence-eval.d.ts +3 -1
- package/dist/library/fence-eval.js +8 -2
- package/dist/library/fence-eval.js.map +1 -1
- package/dist/library/int-infer.d.ts +1 -36
- package/dist/library/int-infer.js +29 -18
- package/dist/library/int-infer.js.map +1 -1
- package/dist/library/int-infer.test.js +4 -4
- package/dist/library/{early-cache.d.ts → library-cache.d.ts} +1 -1
- package/dist/library/{early-cache.js → library-cache.js} +34 -89
- package/dist/library/library-cache.js.map +1 -0
- package/dist/library/library-cache.test.d.ts +1 -0
- package/dist/library/{early-cache.test.js → library-cache.test.js} +7 -7
- package/dist/library/library-cache.test.js.map +1 -0
- package/dist/library/{profile.d.ts → library-profile.d.ts} +4 -7
- package/dist/library/{profile.js → library-profile.js} +18 -11
- package/dist/library/library-profile.js.map +1 -0
- package/dist/library/semantic-source.js +2 -1
- package/dist/library/semantic-source.js.map +1 -1
- package/dist/library/sidecar.d.ts +5 -2
- package/dist/library/sidecar.js +11 -5
- package/dist/library/sidecar.js.map +1 -1
- package/dist/startup-cache.d.ts +11 -3
- package/dist/startup-cache.js +17 -2
- package/dist/startup-cache.js.map +1 -1
- package/package.json +19 -2
- package/surface-manifest.json +5 -5
- package/dist/backend/cc-cache.test.js.map +0 -1
- package/dist/backend/cc.js.map +0 -1
- package/dist/backend/emission/emit-async.js.map +0 -1
- package/dist/backend/emission/emit-exprs.d.ts +0 -13
- package/dist/backend/emission/emit-exprs.js +0 -7407
- package/dist/backend/emission/emit-exprs.js.map +0 -1
- package/dist/backend/emission/emit-island.js.map +0 -1
- package/dist/backend/emission/emit-shapes.js.map +0 -1
- package/dist/backend/emission/emit-stmts.js.map +0 -1
- package/dist/backend/emission/emit-types.js.map +0 -1
- package/dist/backend/emission/emit-walkers.js.map +0 -1
- package/dist/backend/emission/emitter.js.map +0 -1
- package/dist/backend/emission/may-throw.js.map +0 -1
- package/dist/backend/library-identity.js.map +0 -1
- package/dist/executable/early-cache.js.map +0 -1
- package/dist/executable/early-cache.test.js.map +0 -1
- package/dist/ffi/profile.js.map +0 -1
- package/dist/frontend/lowering/lower-emitter.js.map +0 -1
- package/dist/frontend/shared.d.ts +0 -82
- package/dist/frontend/shared.js +0 -308
- package/dist/frontend/shared.js.map +0 -1
- package/dist/frontend/ts7/program.js.map +0 -1
- package/dist/frontend/types.js.map +0 -1
- package/dist/ir/nodes.js.map +0 -1
- package/dist/library/early-cache.js.map +0 -1
- package/dist/library/early-cache.test.js.map +0 -1
- package/dist/library/implementation-identity.js.map +0 -1
- package/dist/library/profile.js.map +0 -1
- /package/dist/backend/{cc-cache.test.d.ts → c/types.test.d.ts} +0 -0
- /package/dist/{executable/early-cache.test.d.ts → backend/llvm/shapes.test.d.ts} +0 -0
- /package/dist/{library/early-cache.test.d.ts → backend/native-codegen.test.d.ts} +0 -0
- /package/dist/ffi/{profile.d.ts → ffi-manifest.d.ts} +0 -0
- /package/dist/frontend/ts7/{program.d.ts → program-adapter.d.ts} +0 -0
- /package/dist/library/{implementation-identity.d.ts → compiler-self-identity.d.ts} +0 -0
package/dist/backend/llvm/dyn.js
CHANGED
|
@@ -1,17 +1,19 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { InternalCompilerError } from "../../errors.js";
|
|
2
|
+
import { DYN_HANDLE_KINDS, isRefCounted, typeKey } from "../../ir/ir.js";
|
|
3
|
+
import { dynDesc, undefinedArmTag } from "../../ir/analysis.js";
|
|
2
4
|
import { mangleRecordNew, mangleRecordStruct } from "../mangle.js";
|
|
3
5
|
import { BlockBuilder } from "./blocks.js";
|
|
4
6
|
import { arrNewCall, elemAccess, llFieldType, releaseSym, traceAdapter, traceArg, vAdapters } from "./shapes.js";
|
|
5
7
|
import { LlvmUnsupportedError } from "./unsupported.js";
|
|
6
8
|
/** ScrDynKind values (scr_runtime.h). */
|
|
7
9
|
/** ScrDynHandleTag numeric values (scr_runtime.h's enum order). */
|
|
8
|
-
|
|
10
|
+
const DYN_HANDLE_TAG_NUM = {
|
|
9
11
|
httpReq: 0,
|
|
10
12
|
httpRes: 1,
|
|
11
13
|
netSocket: 2,
|
|
12
14
|
netServer: 3,
|
|
13
15
|
};
|
|
14
|
-
export const
|
|
16
|
+
export const DYN_KIND = {
|
|
15
17
|
NULL: 0,
|
|
16
18
|
BOOL: 1,
|
|
17
19
|
NUM: 2,
|
|
@@ -237,47 +239,7 @@ export class LlDyn {
|
|
|
237
239
|
B.terminate(`ret ${dummy}`);
|
|
238
240
|
B.startBlock(lk);
|
|
239
241
|
}
|
|
240
|
-
/* ──
|
|
241
|
-
/** Short human description of a dynCheck target for error messages. */
|
|
242
|
-
dynDesc(t) {
|
|
243
|
-
switch (t.kind) {
|
|
244
|
-
case "f64":
|
|
245
|
-
return "number";
|
|
246
|
-
case "string":
|
|
247
|
-
return "string";
|
|
248
|
-
case "bool":
|
|
249
|
-
return "boolean";
|
|
250
|
-
case "record":
|
|
251
|
-
return this.host.recordsById.get(t.shapeId)?.tuple ? "array" : "object";
|
|
252
|
-
case "array":
|
|
253
|
-
return "array";
|
|
254
|
-
case "nullT":
|
|
255
|
-
return "null";
|
|
256
|
-
case "undefinedT":
|
|
257
|
-
return "undefined";
|
|
258
|
-
case "dyn":
|
|
259
|
-
return "unknown";
|
|
260
|
-
case "bytes":
|
|
261
|
-
return "Uint8Array";
|
|
262
|
-
case "object":
|
|
263
|
-
return t.className.replace(/^%/, "");
|
|
264
|
-
case "union": {
|
|
265
|
-
const def = this.host.unionsById.get(t.unionId);
|
|
266
|
-
if (!def)
|
|
267
|
-
throw new Error(`llvm emitter bug: dynDesc of unknown union ${t.unionId}`);
|
|
268
|
-
return def.arms.map((a) => this.dynDesc(a)).join(" | ");
|
|
269
|
-
}
|
|
270
|
-
case "func":
|
|
271
|
-
return "function";
|
|
272
|
-
default: {
|
|
273
|
-
const h = DYN_HANDLE_KINDS.get(t.kind);
|
|
274
|
-
if (h)
|
|
275
|
-
return h.cls;
|
|
276
|
-
throw new Error(`llvm emitter bug: dynDesc of non-JSON type ${t.kind}`);
|
|
277
|
-
}
|
|
278
|
-
}
|
|
279
|
-
}
|
|
280
|
-
/* ── dynMatchHelper (emit-walkers.ts, ported) ──────────────────────── */
|
|
242
|
+
/* ── dynMatchHelper (walkers.ts, ported) ──────────────────────── */
|
|
281
243
|
/** `sc_dm_<n>(ptr d) -> i1` — does this dyn fit T? Never throws. */
|
|
282
244
|
dynMatchHelper(t) {
|
|
283
245
|
const key = typeKey(t);
|
|
@@ -303,7 +265,7 @@ export class LlDyn {
|
|
|
303
265
|
this.host.declare(`declare void @scr_dyn_release_v(ptr)`);
|
|
304
266
|
const kind = this.kindOf(B, "%d");
|
|
305
267
|
const capsule = B.tmp();
|
|
306
|
-
B.line(`${capsule} = icmp eq i32 ${kind}, ${
|
|
268
|
+
B.line(`${capsule} = icmp eq i32 ${kind}, ${DYN_KIND.TYPED_REF}`);
|
|
307
269
|
const lCapsule = B.newLabel("dm.tr.mat");
|
|
308
270
|
const lPlain = B.newLabel("dm.tr.plain");
|
|
309
271
|
B.condBr(capsule, lCapsule, lPlain);
|
|
@@ -324,19 +286,19 @@ export class LlDyn {
|
|
|
324
286
|
};
|
|
325
287
|
switch (t.kind) {
|
|
326
288
|
case "f64":
|
|
327
|
-
kindIs(
|
|
289
|
+
kindIs(DYN_KIND.NUM);
|
|
328
290
|
break;
|
|
329
291
|
case "string":
|
|
330
|
-
kindIs(
|
|
292
|
+
kindIs(DYN_KIND.STR);
|
|
331
293
|
break;
|
|
332
294
|
case "bool":
|
|
333
|
-
kindIs(
|
|
295
|
+
kindIs(DYN_KIND.BOOL);
|
|
334
296
|
break;
|
|
335
297
|
case "nullT":
|
|
336
|
-
kindIs(
|
|
298
|
+
kindIs(DYN_KIND.NULL);
|
|
337
299
|
break;
|
|
338
300
|
case "undefinedT":
|
|
339
|
-
kindIs(
|
|
301
|
+
kindIs(DYN_KIND.UNDEF);
|
|
340
302
|
break;
|
|
341
303
|
case "dyn":
|
|
342
304
|
// An `unknown` target: every dyn value fits, undefined included.
|
|
@@ -344,20 +306,20 @@ export class LlDyn {
|
|
|
344
306
|
break;
|
|
345
307
|
case "bytes":
|
|
346
308
|
if (t.elem !== "u8")
|
|
347
|
-
throw new
|
|
348
|
-
kindIs(
|
|
309
|
+
throw new InternalCompilerError(`llvm emitter bug: dynMatch of bytes<${t.elem}>`);
|
|
310
|
+
kindIs(DYN_KIND.BYTES);
|
|
349
311
|
break;
|
|
350
312
|
case "record": {
|
|
351
313
|
const shape = this.host.recordsById.get(t.shapeId);
|
|
352
314
|
if (!shape)
|
|
353
|
-
throw new
|
|
315
|
+
throw new InternalCompilerError(`llvm emitter bug: dynCheck of unknown shape ${t.shapeId}`);
|
|
354
316
|
const fail = B.newLabel("dm.f");
|
|
355
317
|
const kd = this.kindOf(B, "%d");
|
|
356
318
|
// A tuple matches a JSON ARRAY of EXACTLY its arity, positionally.
|
|
357
319
|
if (shape.tuple) {
|
|
358
320
|
const byIndex = [...shape.fields].sort((a, b) => Number(a.name) - Number(b.name));
|
|
359
321
|
const isArr = B.tmp();
|
|
360
|
-
B.line(`${isArr} = icmp eq i32 ${kd}, ${
|
|
322
|
+
B.line(`${isArr} = icmp eq i32 ${kd}, ${DYN_KIND.ARR}`);
|
|
361
323
|
const l1 = B.newLabel("dm.a");
|
|
362
324
|
B.condBr(isArr, l1, fail);
|
|
363
325
|
B.startBlock(l1);
|
|
@@ -382,7 +344,7 @@ export class LlDyn {
|
|
|
382
344
|
break;
|
|
383
345
|
}
|
|
384
346
|
const isObj = B.tmp();
|
|
385
|
-
B.line(`${isObj} = icmp eq i32 ${kd}, ${
|
|
347
|
+
B.line(`${isObj} = icmp eq i32 ${kd}, ${DYN_KIND.OBJ}`);
|
|
386
348
|
const l0 = B.newLabel("dm.o");
|
|
387
349
|
B.condBr(isObj, l0, fail);
|
|
388
350
|
B.startBlock(l0);
|
|
@@ -395,7 +357,7 @@ export class LlDyn {
|
|
|
395
357
|
B.line(`${has} = icmp ne ptr ${m}, null`);
|
|
396
358
|
const lTest = B.newLabel("dm.t");
|
|
397
359
|
const lNext = B.newLabel("dm.n");
|
|
398
|
-
if (
|
|
360
|
+
if (undefinedArmTag(f.type, this.host.unionsById) >= 0) {
|
|
399
361
|
// Optional-flavored field: a MISSING key is the undefined arm
|
|
400
362
|
// (a match); a PRESENT key must fit the union as usual.
|
|
401
363
|
B.condBr(has, lTest, lNext);
|
|
@@ -456,7 +418,7 @@ export class LlDyn {
|
|
|
456
418
|
const fail = B.newLabel("dm.f");
|
|
457
419
|
const kd = this.kindOf(B, "%d");
|
|
458
420
|
const isArr = B.tmp();
|
|
459
|
-
B.line(`${isArr} = icmp eq i32 ${kd}, ${
|
|
421
|
+
B.line(`${isArr} = icmp eq i32 ${kd}, ${DYN_KIND.ARR}`);
|
|
460
422
|
const l0 = B.newLabel("dm.a");
|
|
461
423
|
B.condBr(isArr, l0, fail);
|
|
462
424
|
B.startBlock(l0);
|
|
@@ -478,7 +440,7 @@ export class LlDyn {
|
|
|
478
440
|
case "union": {
|
|
479
441
|
const def = this.host.unionsById.get(t.unionId);
|
|
480
442
|
if (!def)
|
|
481
|
-
throw new
|
|
443
|
+
throw new InternalCompilerError(`llvm emitter bug: dynCheck of unknown union ${t.unionId}`);
|
|
482
444
|
// Arms in canonical order; any full match answers true.
|
|
483
445
|
const yes = B.newLabel("dm.y");
|
|
484
446
|
for (const arm of def.arms) {
|
|
@@ -499,7 +461,7 @@ export class LlDyn {
|
|
|
499
461
|
this.defs.push(`define internal zeroext i1 @${name}(ptr %d) ${FN_ATTRS} { ; matches ${key}`, B.render(), `}`, ``);
|
|
500
462
|
return name;
|
|
501
463
|
}
|
|
502
|
-
/* ── dynCheckHelper (
|
|
464
|
+
/* ── dynCheckHelper (walkers.ts, ported) ──────────────────────── */
|
|
503
465
|
/** `sc_dc_<n>(ptr d, ptr path) -> T` — validate the checked-dynamic tree against T and
|
|
504
466
|
* BUILD the typed value (+1), or throw the catchable path-annotated
|
|
505
467
|
* TypeError and return a dummy with the pending flag set. */
|
|
@@ -514,7 +476,7 @@ export class LlDyn {
|
|
|
514
476
|
const retTy = this.valTy(t);
|
|
515
477
|
const dummy = retTy === "double" ? `double ${f64Lit(0)}` : retTy === "i1" ? "i1 false" : "ptr null";
|
|
516
478
|
host.declare(`declare void @scr_dyn_check_fail(ptr, ptr, ptr)`);
|
|
517
|
-
const want = host.cstr(
|
|
479
|
+
const want = host.cstr(dynDesc(t, this.host.recordsById, this.host.unionsById));
|
|
518
480
|
const B = new BlockBuilder();
|
|
519
481
|
if (isRefCounted(t) && t.kind !== "dyn") {
|
|
520
482
|
host.declare(`declare zeroext i1 @scr_dyn_typed_ref_is(ptr, ptr, ${host.sizeType})`);
|
|
@@ -537,7 +499,7 @@ export class LlDyn {
|
|
|
537
499
|
const rc = vAdapters(host, t);
|
|
538
500
|
const kind = this.kindOf(B, "%d");
|
|
539
501
|
const capsule = B.tmp();
|
|
540
|
-
B.line(`${capsule} = icmp eq i32 ${kind}, ${
|
|
502
|
+
B.line(`${capsule} = icmp eq i32 ${kind}, ${DYN_KIND.TYPED_REF}`);
|
|
541
503
|
const lCapsule = B.newLabel("dc.tr.cap");
|
|
542
504
|
const lPlain = B.newLabel("dc.tr.plain");
|
|
543
505
|
B.condBr(capsule, lCapsule, lPlain);
|
|
@@ -566,7 +528,7 @@ export class LlDyn {
|
|
|
566
528
|
? host.recordsById.get(t.shapeId)
|
|
567
529
|
: undefined;
|
|
568
530
|
if (t.kind === "record" && !shape) {
|
|
569
|
-
throw new
|
|
531
|
+
throw new InternalCompilerError(`llvm emitter bug: cached typed-ref cast of unknown shape ${t.shapeId}`);
|
|
570
532
|
}
|
|
571
533
|
const lOk = B.newLabel("dc.tr.ok");
|
|
572
534
|
const lBad = B.newLabel("dc.tr.bad");
|
|
@@ -604,6 +566,13 @@ export class LlDyn {
|
|
|
604
566
|
{ index: 1, type: host.sizeType, name: "length" },
|
|
605
567
|
{ index: 2, type: host.sizeType, name: "capacity" },
|
|
606
568
|
{ index: 7, type: "ptr", name: "data" },
|
|
569
|
+
{ index: 8, type: "ptr", name: "presence" },
|
|
570
|
+
{ index: 9, type: "ptr", name: "sparse slots" },
|
|
571
|
+
{ index: 10, type: host.sizeType, name: "sparse length" },
|
|
572
|
+
{ index: 11, type: host.sizeType, name: "sparse capacity" },
|
|
573
|
+
{ index: 12, type: "ptr", name: "numeric properties" },
|
|
574
|
+
{ index: 13, type: host.sizeType, name: "property length" },
|
|
575
|
+
{ index: 14, type: host.sizeType, name: "property capacity" },
|
|
607
576
|
];
|
|
608
577
|
members.forEach((member) => {
|
|
609
578
|
const cachedPtr = B.tmp();
|
|
@@ -654,19 +623,19 @@ export class LlDyn {
|
|
|
654
623
|
};
|
|
655
624
|
switch (t.kind) {
|
|
656
625
|
case "f64": {
|
|
657
|
-
requireKind(
|
|
626
|
+
requireKind(DYN_KIND.NUM, "dc");
|
|
658
627
|
const v = this.payloadOf(B, "%d", "double");
|
|
659
628
|
B.terminate(`ret double ${v}`);
|
|
660
629
|
break;
|
|
661
630
|
}
|
|
662
631
|
case "bool": {
|
|
663
|
-
requireKind(
|
|
632
|
+
requireKind(DYN_KIND.BOOL, "dc");
|
|
664
633
|
const v = this.boolOf(B, "%d");
|
|
665
634
|
B.terminate(`ret i1 ${v}`);
|
|
666
635
|
break;
|
|
667
636
|
}
|
|
668
637
|
case "string": {
|
|
669
|
-
requireKind(
|
|
638
|
+
requireKind(DYN_KIND.STR, "dc");
|
|
670
639
|
host.declare(`declare ptr @scr_str_retain_v(ptr)`);
|
|
671
640
|
const s = this.payloadOf(B, "%d", "ptr");
|
|
672
641
|
const r = B.tmp();
|
|
@@ -685,8 +654,8 @@ export class LlDyn {
|
|
|
685
654
|
case "bytes": {
|
|
686
655
|
// `u as Uint8Array`: kind check, then a fresh COPY out.
|
|
687
656
|
if (t.elem !== "u8")
|
|
688
|
-
throw new
|
|
689
|
-
requireKind(
|
|
657
|
+
throw new InternalCompilerError(`llvm emitter bug: dynCheck of bytes<${t.elem}>`);
|
|
658
|
+
requireKind(DYN_KIND.BYTES, "dc");
|
|
690
659
|
host.declare(`declare ptr @scr_dyn_bytes_copy_out(ptr)`);
|
|
691
660
|
const r = B.tmp();
|
|
692
661
|
B.line(`${r} = call ptr @scr_dyn_bytes_copy_out(ptr %d)`);
|
|
@@ -703,11 +672,11 @@ export class LlDyn {
|
|
|
703
672
|
// %error objects rebuild once and cache the pair. The C walker's
|
|
704
673
|
// arm exactly.
|
|
705
674
|
if (t.className !== "%Error") {
|
|
706
|
-
throw new
|
|
675
|
+
throw new InternalCompilerError(`llvm emitter bug: dynCheck of class ${t.className} (only %Error extracts from the checked-dynamic tree)`);
|
|
707
676
|
}
|
|
708
677
|
const kd = this.kindOf(B, "%d");
|
|
709
678
|
const isObj = B.tmp();
|
|
710
|
-
B.line(`${isObj} = icmp eq i32 ${kd}, ${
|
|
679
|
+
B.line(`${isObj} = icmp eq i32 ${kd}, ${DYN_KIND.OBJ}`);
|
|
711
680
|
const lObj = B.newLabel("dce.o");
|
|
712
681
|
const lFail = B.newLabel("dce.f");
|
|
713
682
|
B.condBr(isObj, lObj, lFail);
|
|
@@ -730,7 +699,7 @@ export class LlDyn {
|
|
|
730
699
|
case "record": {
|
|
731
700
|
const shape = host.recordsById.get(t.shapeId);
|
|
732
701
|
if (!shape)
|
|
733
|
-
throw new
|
|
702
|
+
throw new InternalCompilerError(`llvm emitter bug: dynCheck of unknown shape ${t.shapeId}`);
|
|
734
703
|
const struct = mangleRecordStruct(t.shapeId);
|
|
735
704
|
const fieldIndex = new Map(shape.fields.map((f, i) => [f.name, i + 1]));
|
|
736
705
|
const releaseR = () => {
|
|
@@ -779,7 +748,7 @@ export class LlDyn {
|
|
|
779
748
|
if (shape.tuple) {
|
|
780
749
|
const byIndex = [...shape.fields].sort((a, b) => Number(a.name) - Number(b.name));
|
|
781
750
|
const arityWant = host.cstr(`array of length ${byIndex.length}`);
|
|
782
|
-
requireKind(
|
|
751
|
+
requireKind(DYN_KIND.ARR, "dct");
|
|
783
752
|
const len = this.lenOf(B, "%d");
|
|
784
753
|
const lenOk = B.tmp();
|
|
785
754
|
B.line(`${lenOk} = icmp eq ${host.sizeType} ${len}, ${byIndex.length}`);
|
|
@@ -803,11 +772,11 @@ export class LlDyn {
|
|
|
803
772
|
B.terminate(`ret ptr %r0`);
|
|
804
773
|
break;
|
|
805
774
|
}
|
|
806
|
-
requireKind(
|
|
775
|
+
requireKind(DYN_KIND.OBJ, "dcr");
|
|
807
776
|
B.line(`%r0 = call ptr @${mangleRecordNew(t.shapeId)}()`);
|
|
808
777
|
for (const f of shape.fields) {
|
|
809
|
-
const fieldWant = host.cstr(
|
|
810
|
-
const utag = f.type.kind === "union" ?
|
|
778
|
+
const fieldWant = host.cstr(dynDesc(f.type, this.host.recordsById, this.host.unionsById));
|
|
779
|
+
const utag = f.type.kind === "union" ? undefinedArmTag(f.type, host.unionsById) : -1;
|
|
811
780
|
const m = this.objGetLit(B, "%d", f.name);
|
|
812
781
|
if (f.type.kind === "dyn") {
|
|
813
782
|
// An `unknown` field: a present key passes through, a missing
|
|
@@ -931,7 +900,7 @@ export class LlDyn {
|
|
|
931
900
|
case "array": {
|
|
932
901
|
const elem = t.elem;
|
|
933
902
|
const c = this.dynCheckHelper(elem);
|
|
934
|
-
requireKind(
|
|
903
|
+
requireKind(DYN_KIND.ARR, "dca");
|
|
935
904
|
const n = this.lenOf(B, "%d");
|
|
936
905
|
const a = B.tmp();
|
|
937
906
|
B.line(`${a} = ${arrNewCall(host, elem, n)}`);
|
|
@@ -967,7 +936,7 @@ export class LlDyn {
|
|
|
967
936
|
case "union": {
|
|
968
937
|
const def = host.unionsById.get(t.unionId);
|
|
969
938
|
if (!def)
|
|
970
|
-
throw new
|
|
939
|
+
throw new InternalCompilerError(`llvm emitter bug: dynCheck of unknown union ${t.unionId}`);
|
|
971
940
|
// Arms in CANONICAL order, first FULL match wins. The matched
|
|
972
941
|
// arm's builder can no longer fail.
|
|
973
942
|
def.arms.forEach((arm, i) => {
|
|
@@ -1022,7 +991,7 @@ export class LlDyn {
|
|
|
1022
991
|
const rc = vAdapters(host, t);
|
|
1023
992
|
const kind = this.kindOf(B, "%d");
|
|
1024
993
|
const capsule = B.tmp();
|
|
1025
|
-
B.line(`${capsule} = icmp eq i32 ${kind}, ${
|
|
994
|
+
B.line(`${capsule} = icmp eq i32 ${kind}, ${DYN_KIND.TYPED_REF}`);
|
|
1026
995
|
const lCapsule = B.newLabel("dcu.cap");
|
|
1027
996
|
const lFail = B.newLabel("dcu.fail");
|
|
1028
997
|
B.condBr(capsule, lCapsule, lFail);
|
|
@@ -1090,7 +1059,7 @@ export class LlDyn {
|
|
|
1090
1059
|
// caps[0] obj-box owns the dyn value (untraced).
|
|
1091
1060
|
const adapter = this.dynFuncAdapterHelper(t);
|
|
1092
1061
|
const sigLit = host.cstr(key);
|
|
1093
|
-
requireKind(
|
|
1062
|
+
requireKind(DYN_KIND.FUNC, "dcf");
|
|
1094
1063
|
host.declare(`declare i32 @strcmp(ptr, ptr)`);
|
|
1095
1064
|
const sigp = B.tmp();
|
|
1096
1065
|
const sig = B.tmp();
|
|
@@ -1148,7 +1117,7 @@ export class LlDyn {
|
|
|
1148
1117
|
this.defs.push(`define internal ${retTy === "i1" ? "zeroext i1" : retTy} @${name}(ptr %d, ptr %path) ${FN_ATTRS} { ; check ${key}`, B.render(), `}`, ``);
|
|
1149
1118
|
return name;
|
|
1150
1119
|
}
|
|
1151
|
-
/* ── toDynHelper (
|
|
1120
|
+
/* ── toDynHelper (walkers.ts, ported) ─────────────────────────── */
|
|
1152
1121
|
/** `sc_td_<n>(<T> v) -> ptr` — build a fresh dyn value from a
|
|
1153
1122
|
* static one (+1), DEEP-COPYING composites. Borrows the operand.
|
|
1154
1123
|
* Never throws. */
|
|
@@ -1187,7 +1156,7 @@ export class LlDyn {
|
|
|
1187
1156
|
case "object": {
|
|
1188
1157
|
// %Error only (canConvertToDyn's gate): the checked-dynamic tree's error encoding.
|
|
1189
1158
|
if (t.className !== "%Error") {
|
|
1190
|
-
throw new
|
|
1159
|
+
throw new InternalCompilerError(`llvm emitter bug: to-dyn of class ${t.className}`);
|
|
1191
1160
|
}
|
|
1192
1161
|
host.declare(`declare ptr @scr_dyn_from_error(ptr)`);
|
|
1193
1162
|
const r = B.tmp();
|
|
@@ -1208,7 +1177,7 @@ export class LlDyn {
|
|
|
1208
1177
|
}
|
|
1209
1178
|
case "bytes": {
|
|
1210
1179
|
if (t.elem !== "u8")
|
|
1211
|
-
throw new
|
|
1180
|
+
throw new InternalCompilerError(`llvm emitter bug: to-dyn of bytes<${t.elem}>`);
|
|
1212
1181
|
host.declare(`declare ptr @scr_dyn_new_bytes_copy(ptr)`);
|
|
1213
1182
|
const r = B.tmp();
|
|
1214
1183
|
B.line(`${r} = call ptr @scr_dyn_new_bytes_copy(ptr %v)`);
|
|
@@ -1218,7 +1187,7 @@ export class LlDyn {
|
|
|
1218
1187
|
case "record": {
|
|
1219
1188
|
const shape = host.recordsById.get(t.shapeId);
|
|
1220
1189
|
if (!shape)
|
|
1221
|
-
throw new
|
|
1190
|
+
throw new InternalCompilerError(`llvm emitter bug: to-dyn of unknown shape ${t.shapeId}`);
|
|
1222
1191
|
const struct = mangleRecordStruct(t.shapeId);
|
|
1223
1192
|
const fieldIndex = new Map(shape.fields.map((f, i) => [f.name, i + 1]));
|
|
1224
1193
|
const loadFieldOf = (fname, ft) => {
|
|
@@ -1306,71 +1275,54 @@ export class LlDyn {
|
|
|
1306
1275
|
const len = B.tmp();
|
|
1307
1276
|
B.line(`${ks} = call ptr @scr_map_keys_js_order(ptr ${ovf})`);
|
|
1308
1277
|
B.line(`${len} = call double @scr_arr_len(ptr ${ks})`);
|
|
1309
|
-
|
|
1310
|
-
|
|
1311
|
-
|
|
1312
|
-
|
|
1313
|
-
|
|
1314
|
-
|
|
1315
|
-
|
|
1316
|
-
|
|
1317
|
-
|
|
1318
|
-
|
|
1319
|
-
|
|
1320
|
-
|
|
1321
|
-
|
|
1322
|
-
|
|
1323
|
-
|
|
1324
|
-
|
|
1325
|
-
|
|
1326
|
-
|
|
1327
|
-
|
|
1328
|
-
|
|
1329
|
-
|
|
1330
|
-
|
|
1331
|
-
|
|
1332
|
-
|
|
1333
|
-
|
|
1334
|
-
|
|
1335
|
-
|
|
1336
|
-
|
|
1337
|
-
|
|
1338
|
-
val = B.tmp();
|
|
1339
|
-
B.line(`${val} = trunc i8 ${raw} to i1`);
|
|
1278
|
+
B.countedLoop(len, (i) => {
|
|
1279
|
+
const k = B.tmp();
|
|
1280
|
+
B.line(`${k} = call ptr @scr_arr_get_ref(ptr ${ks}, double ${i}) ; key (+1)`);
|
|
1281
|
+
const { len: klen, data: kdata } = this.strParts(B, k);
|
|
1282
|
+
if (iv.kind === "f64" || iv.kind === "bool") {
|
|
1283
|
+
const outTy = iv.kind === "f64" ? "double" : "i8";
|
|
1284
|
+
const outSlot = B.slot();
|
|
1285
|
+
B.entryAllocas.push(`${outSlot} = alloca ${outTy}`);
|
|
1286
|
+
B.line(`store ${outTy} ${iv.kind === "f64" ? f64Lit(0) : "0"}, ptr ${outSlot}`);
|
|
1287
|
+
host.declare(`declare zeroext i1 @scr_map_get_str_${iv.kind === "f64" ? "f64" : "bool"}(ptr, ptr, ptr)`);
|
|
1288
|
+
const found = B.tmp();
|
|
1289
|
+
B.line(`${found} = call zeroext i1 @scr_map_get_str_${iv.kind === "f64" ? "f64" : "bool"}(ptr ${ovf}, ptr ${k}, ptr ${outSlot})`);
|
|
1290
|
+
const raw = B.tmp();
|
|
1291
|
+
B.line(`${raw} = load ${outTy}, ptr ${outSlot}`);
|
|
1292
|
+
let val = raw;
|
|
1293
|
+
if (iv.kind === "bool") {
|
|
1294
|
+
val = B.tmp();
|
|
1295
|
+
B.line(`${val} = trunc i8 ${raw} to i1`);
|
|
1296
|
+
}
|
|
1297
|
+
const boxed = B.tmp();
|
|
1298
|
+
if (iv.kind === "f64") {
|
|
1299
|
+
host.declare(`declare ptr @scr_dyn_new_num(double)`);
|
|
1300
|
+
B.line(`${boxed} = call ptr @scr_dyn_new_num(double ${val})`);
|
|
1301
|
+
}
|
|
1302
|
+
else {
|
|
1303
|
+
host.declare(`declare ptr @scr_dyn_new_bool(i1 zeroext)`);
|
|
1304
|
+
B.line(`${boxed} = call ptr @scr_dyn_new_bool(i1 ${val})`);
|
|
1305
|
+
}
|
|
1306
|
+
B.line(`call void @scr_dyn_obj_set(ptr ${d}, ptr ${kdata}, ${host.sizeType} ${klen}, ptr ${boxed})`);
|
|
1340
1307
|
}
|
|
1341
|
-
|
|
1342
|
-
|
|
1343
|
-
host.declare(`declare ptr @
|
|
1344
|
-
|
|
1308
|
+
else if (iv.kind === "dyn") {
|
|
1309
|
+
// get_str_ref returns +1 — exactly the ownership obj_set takes.
|
|
1310
|
+
host.declare(`declare ptr @scr_map_get_str_ref(ptr, ptr)`);
|
|
1311
|
+
const hit = B.tmp();
|
|
1312
|
+
B.line(`${hit} = call ptr @scr_map_get_str_ref(ptr ${ovf}, ptr ${k})`);
|
|
1313
|
+
B.line(`call void @scr_dyn_obj_set(ptr ${d}, ptr ${kdata}, ${host.sizeType} ${klen}, ptr ${hit})`);
|
|
1345
1314
|
}
|
|
1346
1315
|
else {
|
|
1347
|
-
host.declare(`declare ptr @
|
|
1348
|
-
|
|
1316
|
+
host.declare(`declare ptr @scr_map_get_str_ref(ptr, ptr)`);
|
|
1317
|
+
const hit = B.tmp();
|
|
1318
|
+
B.line(`${hit} = call ptr @scr_map_get_str_ref(ptr ${ovf}, ptr ${k})`);
|
|
1319
|
+
const conv = B.tmp();
|
|
1320
|
+
B.line(`${conv} = call ptr @${this.toDynHelper(iv)}(ptr ${hit})`);
|
|
1321
|
+
B.line(`call void @scr_dyn_obj_set(ptr ${d}, ptr ${kdata}, ${host.sizeType} ${klen}, ptr ${conv})`);
|
|
1322
|
+
B.line(`call void ${releaseSym(host, iv)}(ptr ${hit})`);
|
|
1349
1323
|
}
|
|
1350
|
-
B.line(`call void @
|
|
1351
|
-
}
|
|
1352
|
-
else if (iv.kind === "dyn") {
|
|
1353
|
-
// get_str_ref returns +1 — exactly the ownership obj_set takes.
|
|
1354
|
-
host.declare(`declare ptr @scr_map_get_str_ref(ptr, ptr)`);
|
|
1355
|
-
const hit = B.tmp();
|
|
1356
|
-
B.line(`${hit} = call ptr @scr_map_get_str_ref(ptr ${ovf}, ptr ${k})`);
|
|
1357
|
-
B.line(`call void @scr_dyn_obj_set(ptr ${d}, ptr ${kdata}, ${host.sizeType} ${klen}, ptr ${hit})`);
|
|
1358
|
-
}
|
|
1359
|
-
else {
|
|
1360
|
-
host.declare(`declare ptr @scr_map_get_str_ref(ptr, ptr)`);
|
|
1361
|
-
const hit = B.tmp();
|
|
1362
|
-
B.line(`${hit} = call ptr @scr_map_get_str_ref(ptr ${ovf}, ptr ${k})`);
|
|
1363
|
-
const conv = B.tmp();
|
|
1364
|
-
B.line(`${conv} = call ptr @${this.toDynHelper(iv)}(ptr ${hit})`);
|
|
1365
|
-
B.line(`call void @scr_dyn_obj_set(ptr ${d}, ptr ${kdata}, ${host.sizeType} ${klen}, ptr ${conv})`);
|
|
1366
|
-
B.line(`call void ${releaseSym(host, iv)}(ptr ${hit})`);
|
|
1367
|
-
}
|
|
1368
|
-
B.line(`call void @scr_str_release(ptr ${k})`);
|
|
1369
|
-
const i2 = B.tmp();
|
|
1370
|
-
B.line(`${i2} = fadd double ${i}, ${f64Lit(1)}`);
|
|
1371
|
-
B.line(`store double ${i2}, ptr ${iSlot}`);
|
|
1372
|
-
B.br(lc);
|
|
1373
|
-
B.startBlock(le);
|
|
1324
|
+
B.line(`call void @scr_str_release(ptr ${k})`);
|
|
1325
|
+
});
|
|
1374
1326
|
B.line(`call void @scr_arr_release(ptr ${ks})`);
|
|
1375
1327
|
}
|
|
1376
1328
|
if (cyclicRec)
|
|
@@ -1394,51 +1346,34 @@ export class LlDyn {
|
|
|
1394
1346
|
B.line(`${d} = call ptr @scr_dyn_new_arr()`);
|
|
1395
1347
|
const len = B.tmp();
|
|
1396
1348
|
B.line(`${len} = call double @scr_arr_len(ptr %v)`);
|
|
1397
|
-
|
|
1398
|
-
|
|
1399
|
-
|
|
1400
|
-
|
|
1401
|
-
|
|
1402
|
-
|
|
1403
|
-
|
|
1404
|
-
|
|
1405
|
-
|
|
1406
|
-
|
|
1407
|
-
|
|
1408
|
-
|
|
1409
|
-
|
|
1410
|
-
|
|
1411
|
-
|
|
1412
|
-
|
|
1413
|
-
|
|
1414
|
-
host.declare(`declare ${elem.kind === "bool" ? "zeroext i1" : accTy} @scr_arr_get_${acc}(ptr, double)`);
|
|
1415
|
-
const e = B.tmp();
|
|
1416
|
-
B.line(`${e} = call ${accTy} @scr_arr_get_${acc}(ptr %v, double ${i})`);
|
|
1417
|
-
const boxed = B.tmp();
|
|
1418
|
-
if (elem.kind === "f64") {
|
|
1419
|
-
host.declare(`declare ptr @scr_dyn_new_num(double)`);
|
|
1420
|
-
B.line(`${boxed} = call ptr @scr_dyn_new_num(double ${e})`);
|
|
1349
|
+
B.countedLoop(len, (i) => {
|
|
1350
|
+
if (elem.kind === "f64" || elem.kind === "bool") {
|
|
1351
|
+
const acc = elem.kind;
|
|
1352
|
+
const accTy = elem.kind === "f64" ? "double" : "i1";
|
|
1353
|
+
host.declare(`declare ${elem.kind === "bool" ? "zeroext i1" : accTy} @scr_arr_get_${acc}(ptr, double)`);
|
|
1354
|
+
const e = B.tmp();
|
|
1355
|
+
B.line(`${e} = call ${accTy} @scr_arr_get_${acc}(ptr %v, double ${i})`);
|
|
1356
|
+
const boxed = B.tmp();
|
|
1357
|
+
if (elem.kind === "f64") {
|
|
1358
|
+
host.declare(`declare ptr @scr_dyn_new_num(double)`);
|
|
1359
|
+
B.line(`${boxed} = call ptr @scr_dyn_new_num(double ${e})`);
|
|
1360
|
+
}
|
|
1361
|
+
else {
|
|
1362
|
+
host.declare(`declare ptr @scr_dyn_new_bool(i1 zeroext)`);
|
|
1363
|
+
B.line(`${boxed} = call ptr @scr_dyn_new_bool(i1 ${e})`);
|
|
1364
|
+
}
|
|
1365
|
+
B.line(`call void @scr_dyn_arr_push(ptr ${d}, ptr ${boxed})`);
|
|
1421
1366
|
}
|
|
1422
1367
|
else {
|
|
1423
|
-
host.declare(`declare ptr @
|
|
1424
|
-
|
|
1368
|
+
host.declare(`declare ptr @scr_arr_get_ref(ptr, double)`);
|
|
1369
|
+
const e = B.tmp();
|
|
1370
|
+
B.line(`${e} = call ptr @scr_arr_get_ref(ptr %v, double ${i}) ; +1`);
|
|
1371
|
+
const conv = B.tmp();
|
|
1372
|
+
B.line(`${conv} = call ptr @${this.toDynHelper(elem)}(ptr ${e})`);
|
|
1373
|
+
B.line(`call void @scr_dyn_arr_push(ptr ${d}, ptr ${conv})`);
|
|
1374
|
+
B.line(`call void ${releaseSym(host, elem)}(ptr ${e})`);
|
|
1425
1375
|
}
|
|
1426
|
-
|
|
1427
|
-
}
|
|
1428
|
-
else {
|
|
1429
|
-
host.declare(`declare ptr @scr_arr_get_ref(ptr, double)`);
|
|
1430
|
-
const e = B.tmp();
|
|
1431
|
-
B.line(`${e} = call ptr @scr_arr_get_ref(ptr %v, double ${i}) ; +1`);
|
|
1432
|
-
const conv = B.tmp();
|
|
1433
|
-
B.line(`${conv} = call ptr @${this.toDynHelper(elem)}(ptr ${e})`);
|
|
1434
|
-
B.line(`call void @scr_dyn_arr_push(ptr ${d}, ptr ${conv})`);
|
|
1435
|
-
B.line(`call void ${releaseSym(host, elem)}(ptr ${e})`);
|
|
1436
|
-
}
|
|
1437
|
-
const i2 = B.tmp();
|
|
1438
|
-
B.line(`${i2} = fadd double ${i}, ${f64Lit(1)}`);
|
|
1439
|
-
B.line(`store double ${i2}, ptr ${iSlot}`);
|
|
1440
|
-
B.br(lc);
|
|
1441
|
-
B.startBlock(le);
|
|
1376
|
+
});
|
|
1442
1377
|
if (cyclicArr)
|
|
1443
1378
|
B.line(`call void @scr_dyn_from_leave()`);
|
|
1444
1379
|
B.terminate(`ret ptr ${d}`);
|
|
@@ -1447,7 +1382,7 @@ export class LlDyn {
|
|
|
1447
1382
|
case "union": {
|
|
1448
1383
|
const def = host.unionsById.get(t.unionId);
|
|
1449
1384
|
if (!def)
|
|
1450
|
-
throw new
|
|
1385
|
+
throw new InternalCompilerError(`llvm emitter bug: to-dyn of unknown union ${t.unionId}`);
|
|
1451
1386
|
const tagp = B.tmp();
|
|
1452
1387
|
const tag = B.tmp();
|
|
1453
1388
|
B.line(`${tagp} = getelementptr inbounds %ScrUnion, ptr %v, i64 0, i32 1`);
|
|
@@ -1555,7 +1490,7 @@ export class LlDyn {
|
|
|
1555
1490
|
return name;
|
|
1556
1491
|
}
|
|
1557
1492
|
/** The checked-dynamic tree-promise settle adapter for one fulfillment payload type —
|
|
1558
|
-
* promiseDynAdapterHelper (
|
|
1493
|
+
* promiseDynAdapterHelper (walkers.ts), ported:
|
|
1559
1494
|
* `void sc_pda_<n>(ptr %dst, ptr %src)` reads src's fulfilled payload
|
|
1560
1495
|
* by its compile-time kind, converts it to a dyn value, and fulfills
|
|
1561
1496
|
* dst with it (scr_dyn_new_promise_adapting's callback; rejections
|
|
@@ -1661,11 +1596,11 @@ export class LlDyn {
|
|
|
1661
1596
|
const kd = this.kindOf(B, "%d");
|
|
1662
1597
|
const done = B.newLabel("ds.d");
|
|
1663
1598
|
const labels = new Map();
|
|
1664
|
-
for (const k of [
|
|
1599
|
+
for (const k of [DYN_KIND.NULL, DYN_KIND.BOOL, DYN_KIND.NUM, DYN_KIND.STR, DYN_KIND.ARR, DYN_KIND.OBJ, DYN_KIND.UNDEF, DYN_KIND.BYTES, DYN_KIND.FUNC, DYN_KIND.HANDLE, DYN_KIND.PROMISE, DYN_KIND.JSVAL, DYN_KIND.TYPED_REF]) {
|
|
1665
1600
|
labels.set(k, B.newLabel(`ds.k${k}`));
|
|
1666
1601
|
}
|
|
1667
1602
|
B.terminate(`switch i32 ${kd}, label %${done} [ ${[...labels].map(([k, l]) => `i32 ${k}, label %${l}`).join(" ")} ]`);
|
|
1668
|
-
B.startBlock(labels.get(
|
|
1603
|
+
B.startBlock(labels.get(DYN_KIND.JSVAL));
|
|
1669
1604
|
{
|
|
1670
1605
|
// Island-held: the engine's own ToString (a bridged failure
|
|
1671
1606
|
// leaves the exception pending and appends nothing).
|
|
@@ -1673,7 +1608,7 @@ export class LlDyn {
|
|
|
1673
1608
|
B.line(`call void @scr_dyn_isl_tostr_buf(ptr %b, ptr %d)`);
|
|
1674
1609
|
B.br(done);
|
|
1675
1610
|
}
|
|
1676
|
-
B.startBlock(labels.get(
|
|
1611
|
+
B.startBlock(labels.get(DYN_KIND.TYPED_REF));
|
|
1677
1612
|
{
|
|
1678
1613
|
host.declare(`declare ptr @scr_dyn_typed_ref_materialize(ptr)`);
|
|
1679
1614
|
host.declare(`declare void @scr_dyn_release_v(ptr)`);
|
|
@@ -1683,13 +1618,13 @@ export class LlDyn {
|
|
|
1683
1618
|
B.line(`call void @scr_dyn_release_v(ptr ${materialized})`);
|
|
1684
1619
|
B.br(done);
|
|
1685
1620
|
}
|
|
1686
|
-
B.startBlock(labels.get(
|
|
1621
|
+
B.startBlock(labels.get(DYN_KIND.UNDEF));
|
|
1687
1622
|
this.puts(B, "%b", "undefined");
|
|
1688
1623
|
B.br(done);
|
|
1689
|
-
B.startBlock(labels.get(
|
|
1624
|
+
B.startBlock(labels.get(DYN_KIND.NULL));
|
|
1690
1625
|
this.puts(B, "%b", "null");
|
|
1691
1626
|
B.br(done);
|
|
1692
|
-
B.startBlock(labels.get(
|
|
1627
|
+
B.startBlock(labels.get(DYN_KIND.BOOL));
|
|
1693
1628
|
{
|
|
1694
1629
|
const bv = this.boolOf(B, "%d");
|
|
1695
1630
|
const s = B.tmp();
|
|
@@ -1697,7 +1632,7 @@ export class LlDyn {
|
|
|
1697
1632
|
B.line(`call void @scr_jb_puts(ptr %b, ptr ${s})`);
|
|
1698
1633
|
B.br(done);
|
|
1699
1634
|
}
|
|
1700
|
-
B.startBlock(labels.get(
|
|
1635
|
+
B.startBlock(labels.get(DYN_KIND.NUM));
|
|
1701
1636
|
{
|
|
1702
1637
|
// String(n): NaN/Infinity spelled out, not the JSON null.
|
|
1703
1638
|
const x = this.payloadOf(B, "%d", "double");
|
|
@@ -1707,13 +1642,13 @@ export class LlDyn {
|
|
|
1707
1642
|
B.line(`call void @scr_str_release(ptr ${s})`);
|
|
1708
1643
|
B.br(done);
|
|
1709
1644
|
}
|
|
1710
|
-
B.startBlock(labels.get(
|
|
1645
|
+
B.startBlock(labels.get(DYN_KIND.STR));
|
|
1711
1646
|
{
|
|
1712
1647
|
const s = this.payloadOf(B, "%d", "ptr");
|
|
1713
1648
|
this.putScrStr(B, "%b", s);
|
|
1714
1649
|
B.br(done);
|
|
1715
1650
|
}
|
|
1716
|
-
B.startBlock(labels.get(
|
|
1651
|
+
B.startBlock(labels.get(DYN_KIND.ARR));
|
|
1717
1652
|
{
|
|
1718
1653
|
// Array.prototype.toString: join(",") — null/undefined ELEMENTS
|
|
1719
1654
|
// print empty (unlike top level), nested arrays flatten.
|
|
@@ -1734,8 +1669,8 @@ export class LlDyn {
|
|
|
1734
1669
|
const isU = B.tmp();
|
|
1735
1670
|
const isN = B.tmp();
|
|
1736
1671
|
const unit = B.tmp();
|
|
1737
|
-
B.line(`${isU} = icmp eq i32 ${ek}, ${
|
|
1738
|
-
B.line(`${isN} = icmp eq i32 ${ek}, ${
|
|
1672
|
+
B.line(`${isU} = icmp eq i32 ${ek}, ${DYN_KIND.UNDEF}`);
|
|
1673
|
+
B.line(`${isN} = icmp eq i32 ${ek}, ${DYN_KIND.NULL}`);
|
|
1739
1674
|
B.line(`${unit} = or i1 ${isU}, ${isN}`);
|
|
1740
1675
|
const lSkip = B.newLabel("ds.sk");
|
|
1741
1676
|
const lRec = B.newLabel("ds.rc");
|
|
@@ -1747,7 +1682,7 @@ export class LlDyn {
|
|
|
1747
1682
|
});
|
|
1748
1683
|
B.br(done);
|
|
1749
1684
|
}
|
|
1750
|
-
B.startBlock(labels.get(
|
|
1685
|
+
B.startBlock(labels.get(DYN_KIND.OBJ));
|
|
1751
1686
|
{
|
|
1752
1687
|
// The checked-dynamic tree's error encoding renders Error.prototype.toString;
|
|
1753
1688
|
// plain objects are "[object Object]".
|
|
@@ -1776,7 +1711,7 @@ export class LlDyn {
|
|
|
1776
1711
|
B.startBlock(lt);
|
|
1777
1712
|
const k = this.kindOf(B, m);
|
|
1778
1713
|
const isStr = B.tmp();
|
|
1779
|
-
B.line(`${isStr} = icmp eq i32 ${k}, ${
|
|
1714
|
+
B.line(`${isStr} = icmp eq i32 ${k}, ${DYN_KIND.STR}`);
|
|
1780
1715
|
const ls = B.newLabel(`${hint}.s`);
|
|
1781
1716
|
B.condBr(isStr, ls, lj);
|
|
1782
1717
|
B.startBlock(ls);
|
|
@@ -1839,7 +1774,7 @@ export class LlDyn {
|
|
|
1839
1774
|
putIf(ems, "ds.pm");
|
|
1840
1775
|
B.br(done);
|
|
1841
1776
|
}
|
|
1842
|
-
B.startBlock(labels.get(
|
|
1777
|
+
B.startBlock(labels.get(DYN_KIND.BYTES));
|
|
1843
1778
|
{
|
|
1844
1779
|
// Buffer-flavored values coerce utf8; plain Uint8Array joins
|
|
1845
1780
|
// its elements.
|
|
@@ -1894,7 +1829,7 @@ export class LlDyn {
|
|
|
1894
1829
|
});
|
|
1895
1830
|
B.br(done);
|
|
1896
1831
|
}
|
|
1897
|
-
B.startBlock(labels.get(
|
|
1832
|
+
B.startBlock(labels.get(DYN_KIND.FUNC));
|
|
1898
1833
|
{
|
|
1899
1834
|
// Function.prototype.toString: the native-code form.
|
|
1900
1835
|
this.puts(B, "%b", "function ");
|
|
@@ -1914,10 +1849,10 @@ export class LlDyn {
|
|
|
1914
1849
|
this.puts(B, "%b", "() { [native code] }");
|
|
1915
1850
|
B.br(done);
|
|
1916
1851
|
}
|
|
1917
|
-
B.startBlock(labels.get(
|
|
1852
|
+
B.startBlock(labels.get(DYN_KIND.HANDLE));
|
|
1918
1853
|
this.puts(B, "%b", "[object Object]");
|
|
1919
1854
|
B.br(done);
|
|
1920
|
-
B.startBlock(labels.get(
|
|
1855
|
+
B.startBlock(labels.get(DYN_KIND.PROMISE));
|
|
1921
1856
|
// Object.prototype.toString with the Promise @@toStringTag.
|
|
1922
1857
|
this.puts(B, "%b", "[object Promise]");
|
|
1923
1858
|
B.br(done);
|
|
@@ -1930,7 +1865,7 @@ export class LlDyn {
|
|
|
1930
1865
|
const B = new BlockBuilder();
|
|
1931
1866
|
const kd = this.kindOf(B, "%d");
|
|
1932
1867
|
const isStr = B.tmp();
|
|
1933
|
-
B.line(`${isStr} = icmp eq i32 ${kd}, ${
|
|
1868
|
+
B.line(`${isStr} = icmp eq i32 ${kd}, ${DYN_KIND.STR}`);
|
|
1934
1869
|
const lFast = B.newLabel("ds.f");
|
|
1935
1870
|
const lSlow = B.newLabel("ds.s");
|
|
1936
1871
|
B.condBr(isStr, lFast, lSlow);
|
|
@@ -1952,7 +1887,7 @@ export class LlDyn {
|
|
|
1952
1887
|
}
|
|
1953
1888
|
return name;
|
|
1954
1889
|
}
|
|
1955
|
-
/* ── caughtToDyn (
|
|
1890
|
+
/* ── caughtToDyn (walkers.ts, ported) ─────────────────────────── */
|
|
1956
1891
|
/** A catch binding flowing into an `unknown` slot: the typed→unknown
|
|
1957
1892
|
* deep-copy stance over the exception snapshot's runtime kind. */
|
|
1958
1893
|
caughtToDynHelper() {
|
|
@@ -2085,8 +2020,8 @@ export class LlDyn {
|
|
|
2085
2020
|
const isU = B.tmp();
|
|
2086
2021
|
const isN = B.tmp();
|
|
2087
2022
|
const unit = B.tmp();
|
|
2088
|
-
B.line(`${isU} = icmp eq i32 ${kd}, ${
|
|
2089
|
-
B.line(`${isN} = icmp eq i32 ${kd}, ${
|
|
2023
|
+
B.line(`${isU} = icmp eq i32 ${kd}, ${DYN_KIND.UNDEF}`);
|
|
2024
|
+
B.line(`${isN} = icmp eq i32 ${kd}, ${DYN_KIND.NULL}`);
|
|
2090
2025
|
B.line(`${unit} = or i1 ${isU}, ${isN}`);
|
|
2091
2026
|
const lUnit = B.newLabel("kg.u");
|
|
2092
2027
|
const lNext = B.newLabel("kg.n");
|
|
@@ -2127,7 +2062,7 @@ export class LlDyn {
|
|
|
2127
2062
|
// ordinary property reads while the capsule itself keeps identity.
|
|
2128
2063
|
{
|
|
2129
2064
|
const isTyped = B.tmp();
|
|
2130
|
-
B.line(`${isTyped} = icmp eq i32 ${kd}, ${
|
|
2065
|
+
B.line(`${isTyped} = icmp eq i32 ${kd}, ${DYN_KIND.TYPED_REF}`);
|
|
2131
2066
|
const lTyped = B.newLabel("kg.tr");
|
|
2132
2067
|
const lNext = B.newLabel("kg.n");
|
|
2133
2068
|
B.condBr(isTyped, lTyped, lNext);
|
|
@@ -2147,7 +2082,7 @@ export class LlDyn {
|
|
|
2147
2082
|
// scalar-normalized — the routed keyed read that retired the fence.
|
|
2148
2083
|
{
|
|
2149
2084
|
const isJv = B.tmp();
|
|
2150
|
-
B.line(`${isJv} = icmp eq i32 ${kd}, ${
|
|
2085
|
+
B.line(`${isJv} = icmp eq i32 ${kd}, ${DYN_KIND.JSVAL}`);
|
|
2151
2086
|
const lJv = B.newLabel("kg.jv");
|
|
2152
2087
|
const lNext = B.newLabel("kg.n");
|
|
2153
2088
|
B.condBr(isJv, lJv, lNext);
|
|
@@ -2161,7 +2096,7 @@ export class LlDyn {
|
|
|
2161
2096
|
// OBJ: the own member (+1) or the undefined singleton.
|
|
2162
2097
|
{
|
|
2163
2098
|
const isObj = B.tmp();
|
|
2164
|
-
B.line(`${isObj} = icmp eq i32 ${kd}, ${
|
|
2099
|
+
B.line(`${isObj} = icmp eq i32 ${kd}, ${DYN_KIND.OBJ}`);
|
|
2165
2100
|
const lObj = B.newLabel("kg.ob");
|
|
2166
2101
|
const lNext = B.newLabel("kg.n");
|
|
2167
2102
|
B.condBr(isObj, lObj, lNext);
|
|
@@ -2181,7 +2116,7 @@ export class LlDyn {
|
|
|
2181
2116
|
// HANDLE: the tag's modeled properties through the installed ops.
|
|
2182
2117
|
{
|
|
2183
2118
|
const isH = B.tmp();
|
|
2184
|
-
B.line(`${isH} = icmp eq i32 ${kd}, ${
|
|
2119
|
+
B.line(`${isH} = icmp eq i32 ${kd}, ${DYN_KIND.HANDLE}`);
|
|
2185
2120
|
const lH = B.newLabel("kg.h");
|
|
2186
2121
|
const lNext = B.newLabel("kg.n");
|
|
2187
2122
|
B.condBr(isH, lH, lNext);
|
|
@@ -2290,7 +2225,7 @@ export class LlDyn {
|
|
|
2290
2225
|
// BYTES: .length and canonical-index byte reads answer like Node.
|
|
2291
2226
|
{
|
|
2292
2227
|
const isB = B.tmp();
|
|
2293
|
-
B.line(`${isB} = icmp eq i32 ${kd}, ${
|
|
2228
|
+
B.line(`${isB} = icmp eq i32 ${kd}, ${DYN_KIND.BYTES}`);
|
|
2294
2229
|
const lB = B.newLabel("kg.by");
|
|
2295
2230
|
const lNext = B.newLabel("kg.n");
|
|
2296
2231
|
B.condBr(isB, lB, lNext);
|
|
@@ -2339,7 +2274,7 @@ export class LlDyn {
|
|
|
2339
2274
|
// FUNC: own props (defineProperties writes), then name/length.
|
|
2340
2275
|
{
|
|
2341
2276
|
const isF = B.tmp();
|
|
2342
|
-
B.line(`${isF} = icmp eq i32 ${kd}, ${
|
|
2277
|
+
B.line(`${isF} = icmp eq i32 ${kd}, ${DYN_KIND.FUNC}`);
|
|
2343
2278
|
const lF = B.newLabel("kg.fn");
|
|
2344
2279
|
const lNext = B.newLabel("kg.n");
|
|
2345
2280
|
B.condBr(isF, lF, lNext);
|
|
@@ -2363,8 +2298,8 @@ export class LlDyn {
|
|
|
2363
2298
|
const isA = B.tmp();
|
|
2364
2299
|
const isS = B.tmp();
|
|
2365
2300
|
const either = B.tmp();
|
|
2366
|
-
B.line(`${isA} = icmp eq i32 ${kd}, ${
|
|
2367
|
-
B.line(`${isS} = icmp eq i32 ${kd}, ${
|
|
2301
|
+
B.line(`${isA} = icmp eq i32 ${kd}, ${DYN_KIND.ARR}`);
|
|
2302
|
+
B.line(`${isS} = icmp eq i32 ${kd}, ${DYN_KIND.STR}`);
|
|
2368
2303
|
B.line(`${either} = or i1 ${isA}, ${isS}`);
|
|
2369
2304
|
const lAS = B.newLabel("kg.as");
|
|
2370
2305
|
const lNext = B.newLabel("kg.n");
|
|
@@ -2462,8 +2397,8 @@ export class LlDyn {
|
|
|
2462
2397
|
const isU = B.tmp();
|
|
2463
2398
|
const isN = B.tmp();
|
|
2464
2399
|
const unit = B.tmp();
|
|
2465
|
-
B.line(`${isU} = icmp eq i32 ${kd}, ${
|
|
2466
|
-
B.line(`${isN} = icmp eq i32 ${kd}, ${
|
|
2400
|
+
B.line(`${isU} = icmp eq i32 ${kd}, ${DYN_KIND.UNDEF}`);
|
|
2401
|
+
B.line(`${isN} = icmp eq i32 ${kd}, ${DYN_KIND.NULL}`);
|
|
2467
2402
|
B.line(`${unit} = or i1 ${isU}, ${isN}`);
|
|
2468
2403
|
const lThrow = B.newLabel("ddc.t");
|
|
2469
2404
|
const lOk = B.newLabel("ddc.o");
|
|
@@ -2526,7 +2461,7 @@ export class LlDyn {
|
|
|
2526
2461
|
// Typed stream capsules iterate their cached, refreshed dyn view.
|
|
2527
2462
|
{
|
|
2528
2463
|
const isTyped = B.tmp();
|
|
2529
|
-
B.line(`${isTyped} = icmp eq i32 ${kd}, ${
|
|
2464
|
+
B.line(`${isTyped} = icmp eq i32 ${kd}, ${DYN_KIND.TYPED_REF}`);
|
|
2530
2465
|
const lTyped = B.newLabel("din.tr");
|
|
2531
2466
|
const lNext = B.newLabel("din.nt");
|
|
2532
2467
|
B.condBr(isTyped, lTyped, lNext);
|
|
@@ -2546,7 +2481,7 @@ export class LlDyn {
|
|
|
2546
2481
|
// dyn-routing-ops).
|
|
2547
2482
|
{
|
|
2548
2483
|
const isJv = B.tmp();
|
|
2549
|
-
B.line(`${isJv} = icmp eq i32 ${kd}, ${
|
|
2484
|
+
B.line(`${isJv} = icmp eq i32 ${kd}, ${DYN_KIND.JSVAL}`);
|
|
2550
2485
|
const lJv = B.newLabel("din.jv");
|
|
2551
2486
|
const lNotJv = B.newLabel("din.njv");
|
|
2552
2487
|
B.condBr(isJv, lJv, lNotJv);
|
|
@@ -2562,9 +2497,9 @@ export class LlDyn {
|
|
|
2562
2497
|
const okB = B.tmp();
|
|
2563
2498
|
const ok01 = B.tmp();
|
|
2564
2499
|
const ok = B.tmp();
|
|
2565
|
-
B.line(`${okA} = icmp eq i32 ${kd}, ${
|
|
2566
|
-
B.line(`${okS} = icmp eq i32 ${kd}, ${
|
|
2567
|
-
B.line(`${okB} = icmp eq i32 ${kd}, ${
|
|
2500
|
+
B.line(`${okA} = icmp eq i32 ${kd}, ${DYN_KIND.ARR}`);
|
|
2501
|
+
B.line(`${okS} = icmp eq i32 ${kd}, ${DYN_KIND.STR}`);
|
|
2502
|
+
B.line(`${okB} = icmp eq i32 ${kd}, ${DYN_KIND.BYTES}`);
|
|
2568
2503
|
B.line(`${ok01} = or i1 ${okA}, ${okS}`);
|
|
2569
2504
|
B.line(`${ok} = or i1 ${ok01}, ${okB}`);
|
|
2570
2505
|
const lGo = B.newLabel("din.g");
|
|
@@ -2582,7 +2517,7 @@ export class LlDyn {
|
|
|
2582
2517
|
const lF = B.newLabel("din.f");
|
|
2583
2518
|
const lDef = B.newLabel("din.d");
|
|
2584
2519
|
const lTail = B.newLabel("din.e");
|
|
2585
|
-
B.terminate(`switch i32 ${kd}, label %${lDef} [ i32 ${
|
|
2520
|
+
B.terminate(`switch i32 ${kd}, label %${lDef} [ i32 ${DYN_KIND.UNDEF}, label %${lU} i32 ${DYN_KIND.NULL}, label %${lN} i32 ${DYN_KIND.BOOL}, label %${lB2} i32 ${DYN_KIND.NUM}, label %${lNum} i32 ${DYN_KIND.FUNC}, label %${lF} ]`);
|
|
2586
2521
|
B.startBlock(lU);
|
|
2587
2522
|
this.puts(B, buf, "undefined");
|
|
2588
2523
|
B.br(lTail);
|