Commit Graph
23 Commits
Author SHA1 Message Date
Chris Tate c41f1a8be9 Expand LLVM native output targets (#280)
* Expand LLVM native output targets

- Add owned helper and runtime-pack contracts for macOS x64, Linux glibc/musl, Windows x64, and WASI.
- Generalize LLVM target selection, package validation, linker plans, and release/CI matrices.
- Document linker boundaries and add focused native-output and runtime-pack coverage.

* Pin Windows LLVM helper CI to VS 2022

The official LLVM archive needs the Visual Studio 2022 CMake generator, which is not guaranteed by windows-latest.

* Align bootstrap cache with LLVM runtime-pack builds

Use the same target-specific helper and linker identity before and after compiler loading so routed executable cache hits remain lightweight.

* Install Windows LLVM CI tools with Chocolatey

windows-2022 includes Visual Studio but not winget; use its available Chocolatey bootstrap for CMake and Ninja.

* Prevent Zig version probes from leaving runtime-pack objects

Run runtime-pack compiler version probes in a private temporary directory and remove the accidental tracked WASI a.o file.

* Use 7-Zip for Windows LLVM setup

Extract the official LLVM development archive with two-stage 7-Zip instead of Windows tar.exe, which timed out while materializing the toolchain tree.

* Define ssize_t for the MSVC runtime pack

Clang's MSVC target does not expose POSIX ssize_t through sys/types.h; define the pointer-sized runtime type without affecting MinGW.

* Build the Windows runtime pack with Zig

Use the MinGW-compatible Windows sysroot required by the runtime while retaining COFF helper output and installing Zig in the Windows native CI lane.

* Give macOS LLVM differential shard time to finish

Shard 1 passed its setup and focused contracts but was cancelled during its cold LLVM differential slice at the 20-minute job limit.
2026-09-01 13:41:34 -05:00
Chris Tate 1cec922d95 Separate native linking from C compilation (#278)
* Separate native linking from C compilation

 - Split the helper-object runtime-pack path into explicit link planning and platform linking.
 - Reserve SCRIPTC_LINKER for object-only executable links while retaining a deprecated SCRIPTC_CC compatibility path.
 - Add no-legacy-C coverage and document the linker/SDK boundary.

* Preserve runtime pack link errors

* Fix linker cache invalidation and warnings

* Fix C executable cache routing

- Keep explicit C builds on compiler-backed cache identities.
- Cover linker-only environment changes across exact C repeats.
2026-08-31 20:29:59 -05:00
Chris Tate 64b2a285d5 feat(runtime): ship precompiled macOS artifacts (#248)
* feat(runtime): ship precompiled macOS artifacts

- Add a versioned macOS arm64 runtime pack with deterministic feature selection and artifact verification.
- Link LLVM helper objects against release-built runtime and vendor inputs without compiling user-machine C.
- Wire package publishing, cache validation, documentation, and full-gate coverage for the new path.

* fix(runtime): harden precompiled artifact handling

* fix(runtime): make precompiled artifacts reproducible

* fix(runtime): reject opaque linkers from executable cache

* fix(runtime): normalize precompiled archive metadata

* fix(runtime): harden precompiled artifact caching

* fix(runtime): close executable cache link race

* fix(runtime): stage verified pack artifacts

* fix(runtime): bracket helper cache inputs

* fix(runtime): preserve executable link identity

* fix(runtime): trace selected linker dependencies
2026-08-28 09:29:21 -05:00
Chris Tate 73efea6ab3 feat(cli): expose native object link info (#247)
* feat(cli): expose native object link info

- add versioned, cache-independent native link metadata for program objects

- document the experimental runtime ABI and provide C-driver and Apple linker examples

- verify ABI mismatch, FFI parity, packed installs, and external linking in CI

* fix(example): validate native runtime pack identity
2026-08-27 13:47:09 -05:00
Chris Tate 401338f437 feat(compiler): add native LLVM object emission (#242)
* feat(compiler): add native LLVM object emission

- ship the pinned macOS arm64 LLVM helper and platform package
- add assembly/object CLI outputs, caching, diagnostics, and runtime ABI checks
- validate helper artifacts through CI, packaging, docs, and differential coverage

* fix(compiler): harden native LLVM emission

* fix(compiler): harden LLVM helper packaging

* fix(compiler): stabilize LLVM helper package size

* fix(compiler): harden native helper validation

* fix(compiler): harden LLVM helper verification

* fix(compiler): harden native object emission
2026-08-27 10:30:40 -05:00
Chris Tate 77fad3c4cc feat(cli): add source-level output kinds (#241)
* feat(cli): add source-level output kinds

- add typed IR, C, and LLVM primary artifacts without native toolchain discovery
- centralize output paths, compatibility validation, and stale artifact cleanup
- document and test the new CLI contract

* fix(cli): harden source output contracts

* fix(cli): harden source output compatibility
2026-08-26 15:26:24 -05:00
Chris Tate 469efdd7f0 refactor: clarify compiler module boundaries (#232)
* refactor: clarify compiler module boundaries

- Rename backend, frontend, IR, and cache modules for explicit ownership.
- Split native cache/vendor and frontend shared concerns into focused modules.
- Expand compiler context names and refresh imports, tests, and documentation.

* fix: preserve renamed compiler interfaces
2026-08-23 20:16:13 -05:00
Chris Tate af333016d4 perf: preseed native build caches (#192)
* perf: preseed native build caches

- Warm runtime, TLS, and dynamic-engine artifacts during npm installation
- Add an explicit toolchain-aware cache warm command for images and CI
- Move vendor artifacts into the user cache and build QuickJS directly

* fix: harden native cache warming

* fix: promote staged vendor cache entries

* fix: isolate shared native cache entries

* fix: validate shared vendor cache artifacts
2026-08-21 19:52:25 -05:00
Chris Tate 5138c1683a perf: add executable dev object caching (#191)
- Add an explicit executable dev posture using native -O0 builds
- Split large LLVM programs into parallel, independently cached objects
- Preserve release cache compatibility and safe single-TU fallbacks
2026-08-21 13:03:31 -05:00
Chris Tate 2805c3ddb4 perf: lazy-load the compiler from the CLI (#189)
* perf: lazy-load the compiler from the CLI

- Serve help and version from a lightweight bootstrap and route exact executable cache hits before loading the compiler graph.
- Validate routed hits against compiler, frontend, toolchain, and native dependency proofs with portable cache publication.

* fix: repair lazy executable cache routes
2026-08-21 10:29:34 -05:00
Chris Tate ff98ee2330 Speed up scriptc builds (#166)
* Speed up scriptc builds

- Cache native compilation inputs and enable Node 24 bytecode caching
- Memoize frontend type lowering and reduce checker overfetch
- Add dev-mode library optimization and phase timing

* Fix persistent cache invalidation

* Fix native cache dependency validation

* Fix native cache header shadow invalidation
2026-08-17 20:15:56 -05:00
Chris TateandAlbert 31f268be2b feat: support wasm32-wasi as a production target (#133)
* feat: support wasm32-wasi as a production target

- Add production LLVM WASI codegen with a 32-bit ABI, coroutines, and dynamic modules
- Integrate WASI builds and execution into the CLI with capability diagnostics
- Add differential coverage and document the fourth production target

Co-authored-by: Albert <57402359+bulatovv@users.noreply.github.com>

* fix: address wasm target review findings

* fix WASI guest paths and fetch alias detection

* fix WASI async bridge and fetch detection

---------

Co-authored-by: Albert <57402359+bulatovv@users.noreply.github.com>
2026-08-11 14:12:59 -05:00
Chris Tate 0d5bc0dd0d feat(coverage): resolve external host type surfaces (#80)
* feat(coverage): resolve external host type surfaces

- Add repeatable --external-types mappings for checker-only module resolution.
- Keep host runtime values as explicit blockers with tests and documentation.

* fix: validate external type mappings

* fix: fence external host runtime edges

* fix(compiler): skip empty external type lookup

* fix(compiler): honor external type boundaries
2026-08-02 19:41:35 -05:00
Chris Tate 6d521671df Fix Windows cross-target CLI setup 2026-07-26 17:25:37 -05:00
Chris TateandKhaled Ghallab d7b5891b4f Fix scriptc run on Windows
- Normalize Windows paths passed through the TS7 virtual filesystem.
- Emit and launch .exe outputs by default on Windows.
- Add targeted regressions and a Windows GitHub Actions smoke test.

Co-authored-by: Khaled Ghallab <171967089+Khaled-Ghallab@users.noreply.github.com>
2026-07-26 15:50:38 -05:00
Chris Tate bed63d3223 feat: add outbound native FFI
- Add a strict versioned manifest and direct C ABI lowering for both backends.
- Link declared native inputs through the CLI and compiler APIs with precise diagnostics.
- Cover the ABI under plain and sanitized integration tests and document its contracts.
2026-07-25 09:56:48 -05:00
Chris Tate 701e2795a1 CLI: -v, and argument errors that read as errors
- `scriptc -v` / `--version` prints the installed version, read from the package manifest so a release build and a source checkout answer the same way. It previously fell through to the compile path and crashed trying to read `-v` as an entry file.
- An unknown flag or a missing flag value now prints one line naming what was wrong, followed by usage. parseArgs' ERR_PARSE_ARGS_* used to escape to the top level and paint a Node stack trace over the terminal.
- Reworded `--backend` help: llvm is the default and the output that ships, c is the readable reference backend for inspecting what the compiler produced.
2026-07-24 23:23:58 -05:00
Chris Tate f9cbff164f Library mode takes the static-or-refuse npm posture: eligible packages compile, SC4013 refuses the rest
- compileLibrary runs the --npm-static eligibility bar automatically over every bare specifier the graph exposes (opted-in packages' own import and top-level require edges included, iterated to a fixpoint) — an eligible package compiles statically into the library graph, and every fallback the shared frontend records refuses as SC4013 naming the package, the specific failed bar, and the vendor-or-drop remedy (with the profile's SC4013 teaching riding the hint), never SC1010/SC2013's executable-lane teachings.
- requireInitStmt now emits the guarded %init call for a bare require naming another opted-in package: the dep's module body never ran before (NULL-closure crash at first use), a latent npm-static gap on both lanes that the library fixpoint hits immediately; the executable lane never exercised an inter-package require.
- Contract facts exclude statically-compiled npm files (their .d.ts is dropped by construction, so no npm declaration can name a wire-contract type) while their bytes keep joining source_hash/build_id through moduleOrder; the sidecar stays byte-deterministic and a package-file edit flips both identity hashes.
- Builtins keep their story under the npm posture: async_free builtin imports compile alongside npm code, event-loop surfaces still refuse SC4005, no new fence.
- New fixtures npm-static, npm-refuse, and contract-npm vendor fake packages per the tests/fixtures/npm precedent; the K12 suites assert the compile and refusal sides on both emissions and the contract suite covers the identity-hash implications.
2026-07-23 20:06:31 -05:00
Chris Tate 5c1eaaad14 Emit the format-1 contract sidecar beside every sidecar-declaring library build
- lib-contract.ts reads the entry's exported types, function signatures, and the ratified exported-const conventions (modelUnbound/msgUnbound/appearanceMsg/chromeMsg/envMsgs) from the AST in statement order, never the checker
- sidecar.ts projects them into the schema's closed vocabulary: declaration-ordered type table with synthesized <Container>_<member> records, five-family msg descriptors (number-first pins number_bytes, bytes-first takes the record family), helper table with the arena bit, channels, and the canonical abi.exports order
- build_id follows the schema's worked definition (compiler version, profile bytes, sorted canonical module graph) and lands on IrLibSection.identity so both backends emit the getters from the one value the sidecar records; the getters are pure constant returns with no entry prologue — poisoned-guard exempt, callable pre-init and post-trap
- not-yet facts emit the stated absent forms: integer_slots [] with every numeric slot f64, deterministic computed by a conservative ambient-surface scan (moduleLibNondeterministicSurface), async_free structural behind SC4005
- sidecar-validate.ts implements the V1-V14 self-check run before writing; unprojectable designations refuse as SC4009 naming the declaration; the CLI prints the sidecar path beside the archive
2026-07-23 14:44:44 -05:00
Chris Tate b5e3d019fc Rename the capability: library mode, never "core", surface and internals
- CLI: the core verb becomes `scriptc build --lib --profile <p.json>` (no positional; profile names the entry); artifact renames to <name>.lib.a with .lib.ll/.lib.c/.lib.ir.json siblings
- SC4xxx diagnostic text and hints say library, never core; trap-message strings likewise (LIBRARY RC AUDIT, library reset registry, library inbound bytes)
- internals: compileLibrary/compileLibArchive, IrModule.lib + IrLibSection/IrLibExport, moduleLibAsyncSurface, libRoots, loadLibraryProfile/LibraryProfile under src/library/, frontend/lib-exports.ts, emitLibEntries/emitLibDefs
- runtime: scr_core.c -> scr_library.c with scr_library_* symbols and the SCR_LIB macro (scr_lib_* was taken by the stdlib unit); scr_lib_session_cleanup
- tests: tests/library-mode/ fixtures (entries lib.ts), library-*.test.ts harness files
2026-07-23 09:24:44 -05:00
Chris Tate 6d7214fbc9 compileCore: the library-emission mode over both backends
- IrModule.core lands the resolved export map + mode-provided symbol names on the IR; both emitters generate the external ccc wrappers, the re-runnable init entry (globals released and zeroed, error-vt stamps, %main, escaped-exception check), sink registration, and the optional reset/collect entries from the same facts
- marshalling wrappers delegate to scr_core.c helpers (str/bytes in-copy, arena-out), so the two emissions are identical by construction; both arena postures emit from resultResetSymbol
- compileCoreArchive builds <name>.core.a: program TU + the narrowed core runtime set (no scr_async/scr_child) + IR-gated pure-data units, all -DSCR_CORE; vendored zlib objects keep the libc/libm-only undefined-reference contract on hosts
- profile-mapped exports seed lowering reachability (coreRoots) so uncalled exports stop dead-stripping on the core path
- emitted family-4 traps (OOM, invalid union tag, bad key) route through scr_trap in both backends
- CLI verb: scriptc core --profile <file> [-o out]
2026-07-23 01:29:13 -05:00
Chris Tate 7fca9785ea Coverage renders the diagnostics it stops on
- A type-error stop prints the same code frames a build prints
- The import-site stop renders its diagnostics below the blocker table
- Coverage is the first command reached for; the verdict line alone swallowed the fix
2026-07-22 19:23:23 -05:00
Chris Tate 23d5918a53 init 2026-07-22 18:08:04 -05:00