js: design record for the JavaScript back end (step 1 of #63) #602
Loading…
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Context
Step 1 of #63 (backend: JavaScript). The JavaScript back end is too large for one PR, so it starts with its design record, as #410 did for the native bodies, #413 for the collections and #459 for foreign functions. Everything up to the typed IR is shared, the kernel of natives is closed (
docs/design/NATIVES.md, groups K1 to K8) and the two open technical questions are decided (docs/design/JAVASCRIPT-AND-PHP.mdsections 2a and 2b, landed with #417). What is missing is the mapping from the IR to JavaScript text and the slicing of the work, so that the implementation steps of #63 can each be one PR.What
A new design record
docs/design/JAVASCRIPT-BACKEND.md(with its entry indocs/design/index.mdand a link fromJAVASCRIPT-AND-PHP.mdanddocs/ROADMAP.mdmilestone 9), specifying and justifying, from the existing back ends (compiler/src/backend/c,compiler/src/backend/bytecode) and the IR (compiler/src/ir):compiler/src/backend/javascript/), the flag (torb build --target jsor the existing--targetmechanism, whicheverdocs/tooling/torb-build.mdallows), output shape (ES modules, one file per module or one bundle), howmainandtestare run under Node in CI (.forgejo/actions/nodeexists).byteAtandsliceBytes; JavaScript's are UTF-16: the representation and its cost),Buffer/Arraystorage (typed arrays or plain arrays per element type), panics andmain's exit code.Intrules of section 2a (the runtime functions, which natives arenumber-only), K3 bit-exact libm (state whichMathfunctions V8 answers bit for bit and which need a TorbScript or table-driven implementation, with a test plan), K6 viaDataView.Closeobject (DESTRUCTORS.md section 2a), copy on write forvarpaths on host-collected memory, and howisSameis answered.asyncfunctions versus a state machine, cancellation,runToEnd()in a browser, structured concurrency and theCloseorder.printrunning a first conformance program under Node; then the remaining language, the kernel, tasks, the conformance subset per the capability table of 2b), and which slices touch natives or the seed (the two-commit rule applies to those).Acceptance criteria
docs/design/JAVASCRIPT-BACKEND.mdexists with sections 1 to 6 above, each decision with its reasoning; the record names the first implementation slice precisely enough to be filed as the next issue.Mathdeterminism, promise ordering) are measured or cited, with the Node version.docs/design/index.md,JAVASCRIPT-AND-PHP.md(status line, section 1 pointer) and ROADMAP milestone 9 link the record;skills/is regenerated if the repo's docs check asks for it.docs(design)Conventional Commit. Seed: untouched (no syntax change, no native, no driver flag, no std name).Source
docs/design/JAVASCRIPT-AND-PHP.md(sections 1, 2, 2a, 2b),docs/design/NATIVES.md,docs/ARCHITECTURE.md"Back Ends",docs/design/DESTRUCTORS.mdsection 2a,docs/design/CONCURRENCY.md.[loop:torbscript] claim implement by session:loop-torbscript-20261029-0858 until 2026-10-29T20:40:00Z
[loop:torbscript] release implement: PR #606 opened, CI pending