Keyboard shortcuts

Press or to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

Provisional API: This reference documents current compiler behavior. Compatibility is not yet promised.

src/bootstrap.x

Source-bearing APE to native x2c transition.

Functions

FunctionSummary
bootstrap_build_requestBuilds an ordinary native request for one materialized bootstrap component.
bootstrap_materializeVerifies and materializes the APE source payload at request.prefix.
bootstrap_record_installRecords the resolved host tools and then publishes bootstrap completion.
bootstrap_releaseAttempts to remove a held bootstrap lock without freeing the payload.

Functions

bootstrap_build_request

CliRequest bootstrap_build_request( CliRequest command, Bootstrap payload, Symbol component)

Builds an ordinary native request for one materialized bootstrap component. component must be <runtime> or <compiler>. The former selects a static archive over runtime_srcs; the latter selects an executable over compiler_srcs. The Scope-owned result borrows the payload’s source List and the command’s compiler-argument List; its new Strings and List retain their actual canonical pool lifetimes, which may belong to ancestor pools.

Raises: <alloc-fail> or <size-limit> while constructing the request.

Source: src/bootstrap.x:324

bootstrap_materialize

Bootstrap bootstrap_materialize(CliRequest request)

Verifies and materializes the APE source payload at request.prefix. The prefix must be nonempty and must not be /. An existing tree is reused only when its source identity matches and every manifest entry verifies. On success the Scope-owned result retains the exclusive bootstrap lock; complete additionally requires the matching completion marker, executable compiler, and readable runtime archive. Validation, locking, or filesystem failure prints a bootstrap diagnostic and exits with status 2; a later invocation can recover its dead-PID lock.

Raises: <bad-arg> for embedded manifest bytes that are not String text, or <alloc-fail> or <size-limit> while reading the manifest or constructing the result. If one transfers after lock acquisition, no payload is returned for release and the live process keeps the lock until it exits.

Source: src/bootstrap.x:281

bootstrap_record_install

void bootstrap_record_install(Bootstrap payload, String cc, String ar)

Records the resolved host tools and then publishes bootstrap completion. The completion marker is written only after the toolchain record succeeds. The call does not update payload.complete. A directory, record, or marker failure prints a bootstrap diagnostic and exits with status 2.

Raises: <alloc-fail> or <size-limit> while constructing canonical paths.

Source: src/bootstrap.x:354

bootstrap_release

void bootstrap_release(Bootstrap payload)

Attempts to remove a held bootstrap lock without freeing the payload. The lock path is cleared even if unlink fails. NULL payloads and repeated calls have no effect.

Source: src/bootstrap.x:373

Public types

TypeKindSummary
BootstrapstructRepresents one verified source payload while its installation lock is held.

Bootstrap

typedef struct Bootstrap { String prefix, identity, lock_path, List runtime_srcs, compiler_srcs; int complete; } *Bootstrap

Represents one verified source payload while its installation lock is held. The record is Scope-owned; its Strings and source Lists retain their actual canonical pool lifetimes, which may belong to ancestor pools. Every successful path must call bootstrap_release to remove the filesystem lock.

Source: src/bootstrap.x:21

Design notes

The Cosmopolitan seed publishes the source and drives native build requests. Host tools never receive /zip paths, and the native compiler is linked only with the runtime built for that host.