Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 25 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,31 @@ All notable changes to EigenScript are documented here.

### Changed

- **Host-only builtins moved to one whole-TU-gated file,
`src/builtins_host.c` (#741).** `EIGENSCRIPT_FREESTANDING` was carved
into `builtins.c` inline — 52 `#ifdef` blocks gating ~1,500 lines, with
host-only builtins interleaved among portable ones, so the only feedback
that a new builtin had leaked a host dependency was the freestanding
symbol gate failing on a stray libc import. Everything needing a real OS
underneath — filesystem (`read_text`/`write_bytes`/`ls`/… and the module
resolver's host arm), subprocess (`exec_capture`, the `proc_*` family),
terminal raw mode, POSIX regex (`match`/`match_all`/`regex_replace`),
streams, `random_hex`, `build_corpus`, `read_file_util` — now lives in
`builtins_host.c` behind a single `#if` (the `ext_store.c` pattern:
under the profile the TU compiles to a no-op `register_host_builtins`
plus the resolver stub). `builtins.c` keeps 5 conditional sites, all
genuine dual-behavior carve-outs (glibc allocator introspection, the
`getpid` seed term, `try_parse`'s stderr fd-plumbing), and its
registration table calls the host registrar unconditionally inside the
`[0, g_builtin_binding_count)` builtin band. Zero behavior change under
the host profile; the freestanding surface is byte-identical (both
`freestanding_check.sh` stages pass unchanged, allowlist untouched). A
builtin that quietly grows a host dependency now fails the symbol gate
by NAME (`builtin_foo` undefined in the profile) instead of by stray
import, and the fix is structural — define it in the host TU. The
matching extraction for `lint.c`'s 6 blocks (the E003 binding base,
`--api`, `check_undefined_names`) is tracked separately.

- **Build variants now coexist: per-variant objdirs with dependency
tracking (#740).** Every runtime variant (`build`/`full`/`http`/`zlib`/
`net`/`gfx`/`asan`/`asan-http`/`tsan`/`valgrind`/`poison`) was a single
Expand Down
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ LDFLAGS := -pie -Wl,-z,relro,-z,now -lm -lpthread
endif

SRC_DIR := src
SOURCES := $(SRC_DIR)/eigenscript.c $(SRC_DIR)/lexer.c $(SRC_DIR)/parser.c $(SRC_DIR)/builtins.c $(SRC_DIR)/builtins_tensor.c $(SRC_DIR)/hash.c $(SRC_DIR)/arena.c $(SRC_DIR)/state.c $(SRC_DIR)/strbuf.c $(SRC_DIR)/ext_store.c $(SRC_DIR)/fmt.c $(SRC_DIR)/lint.c $(SRC_DIR)/chunk.c $(SRC_DIR)/compiler.c $(SRC_DIR)/vm.c $(SRC_DIR)/jit.c $(SRC_DIR)/trace.c $(SRC_DIR)/eigs_embed.c $(SRC_DIR)/repl.c $(SRC_DIR)/step.c $(SRC_DIR)/tape_read.c $(SRC_DIR)/bundle.c $(SRC_DIR)/main.c
SOURCES := $(SRC_DIR)/eigenscript.c $(SRC_DIR)/lexer.c $(SRC_DIR)/parser.c $(SRC_DIR)/builtins.c $(SRC_DIR)/builtins_host.c $(SRC_DIR)/builtins_tensor.c $(SRC_DIR)/hash.c $(SRC_DIR)/arena.c $(SRC_DIR)/state.c $(SRC_DIR)/strbuf.c $(SRC_DIR)/ext_store.c $(SRC_DIR)/fmt.c $(SRC_DIR)/lint.c $(SRC_DIR)/chunk.c $(SRC_DIR)/compiler.c $(SRC_DIR)/vm.c $(SRC_DIR)/jit.c $(SRC_DIR)/trace.c $(SRC_DIR)/eigs_embed.c $(SRC_DIR)/repl.c $(SRC_DIR)/step.c $(SRC_DIR)/tape_read.c $(SRC_DIR)/bundle.c $(SRC_DIR)/main.c
BINARY := $(SRC_DIR)/eigenscript

# CLI-only translation units: linked into the binary, never into the
Expand Down
7 changes: 6 additions & 1 deletion docs/FREESTANDING.md
Original file line number Diff line number Diff line change
Expand Up @@ -199,7 +199,12 @@ DROP rows above name: the filesystem builtins (incl. `load_file`/`import`,
which raise a profile-specific error), subprocess, terminal raw mode, libc
regex (route: EigenRegex's `regex_compat`), the page store, the trace-tape
file sinks, and the JIT (`EIGS_JIT_ENABLED` gates every arch check;
interpreter-only until the `map_exec` root exists). The entry point is
interpreter-only until the `map_exec` root exists). The host-only builtins
live in one whole-TU-gated file, `src/builtins_host.c` (#741, the
`ext_store.c` pattern — under the profile it compiles to a no-op registrar
plus the resolver stub), so the drop is a single gate rather than ~50
scattered `#ifdef` pairs, and a builtin that grows a host dependency
belongs there by construction. The entry point is
`eigs_embed.h` with **source strings** — `main.c` (the POSIX CLI) is not part
of the profile.

Expand Down
Loading
Loading