Skip to content

Upgrade kernel to ShenOSKernel 42.2 (shen-scheme 0.50 parity) - #29

Merged
pyrex41 merged 2 commits into
mainfrom
kernel-42.2
Oct 11, 2026
Merged

pyrex41 merged 2 commits into
mainfrom
kernel-42.2

Conversation

@pyrex41

@pyrex41 pyrex41 commented Oct 11, 2026

Copy link
Copy Markdown
Owner

Summary

Replaces the Tarver S42 kernel (s42-pristine-20260825) wholesale with the community ShenOSKernel 42.2, the kernel upstream shen-scheme 0.50 ships (option (a) from #28). Source: Shen-Language/shen-sources tag shen-42.2, commit 73507e069fe147aefb728d632c4ce40bc6a7b314; tarball ShenOSKernel-42.2.tar.gz, SHA-256 1d02273003654d34ec020ae67cb214ecec410dee3350419ff807d82b652678d8. (version) is now "42.2".

Changes

  • Vendored kernel (byte-identical to the release tarball):
    • kernel/klambda/*.kl (23 files): adds dict.kl, init.kl, stlib.kl, extension-namespaces.kl, extension-type-annotations.kl; drops backend.kl.
    • kernel/tests/ (the 42.2 suite, 143 tests), kernel/stlib/ and kernel/README.md.
  • Boot (interp/boot.rs): follows shen-scheme 0.50's file order and init order:
    1. Load the .kl files, which now contain only defuns.
    2. Call shen.initialise.
    3. Install primitive metadata, then the AOT code, then the native overrides.
    4. Run shen.x.programmable-pattern-matching.initialise, then shen.x.namespaces.initialise, then stlib.initialise.
  • Standard library and extensions:
    • The standard library boots from the precompiled stlib.kl; boot::load_stlib is removed.
    • Booted extensions: features, launcher, programmable-pattern-matching and namespaces (shen-scheme 0.50's set), plus expand-dynamic from the old boot list.
    • type-annotations is vendored and AOT-generated but not booted.
  • Native overrides (primitives.rs):
    • The native put/get/unput assume Tarver's pointer-list layout. They are now installed only when the kernel defines shen.change-pointer-value, so 42.2 uses its own dict.kl versions. This also fixes the embedded CAS kernel in shenffi, whose dict layout the old overrides did not handle.
    • value/or, <-address/or and <-vector/or stay installed unconditionally because klcompile emits calls to them. A regression test is added.
  • klcompile: the four large stlib.initialise-* defuns are in KERNEL_SLOW_DEFUNS (left tree-walked).
  • Regenerated AOT: crates/shen-rust/src/aot/kernel/ was rebuilt with scripts/codegen-kernel-aot.sh, and mod.rs was updated.
  • shenffi: the embedded boot uses the same file set and runs the same post-boot initialisers.
  • Tests: (version) is now expected to be "42.2"; the <-address/or regression test is added; comments updated.
  • Docs:
    • kernel/klambda/PROVENANCE.md records the lineage choice and the 42.0–42.2 port-upgrade audit, keeping S42 as history.
    • kernel/stlib/PROVENANCE.md, README and STATUS are updated.
    • A new CHANGELOG.md is added.

Verification

  • diff -r of the vendored files against the extracted tarball: clean. Staged blobs were checked with sha256.
  • cargo build --release -j 2: OK.
  • scripts/kernel-tests.sh: passed: 143, failed: 0.
  • cargo test -j 2 --workspace --no-fail-fast: 238 passed, 0 failed, 1 ignored.
  • cargo fmt --all -- --check: OK. cargo clippy --workspace --all-targets -- -D warnings: clean.
  • scripts/kernel-aot-audit.sh: OK.
  • Spot checks against shen-scheme 0.50 (eval -e):
    • Same results: (version), arithmetic, append/reverse/map, @s, closures, trap-error, the (head []) message inside trap-error, filter/arity, macroexpand [input+ number], read-from-string, make-string, tuples.
    • script and (load F) on files with no trailing newline: identical output.
    • Reading at EOF without a newline (read-file, read): identical output.
    • Expected host differences: *language*, hash values, closure printing, the top-level error prefix, str of a cons.
  • Bifrost go run . --impls shen-rust,shen-scheme with shen-scheme 0.50: 63 pass, 3 FAIL. None of the three is a shen-rust bug:

Remaining work / known failures

  • Not re-run:
  • boot_from_kl_source (shaken slices) still runs only shen.initialise. Shaken builds must call boot::run_post_aot_initialisers themselves if they need stlib types or macros.
  • shen.x.features.initialise is not called, as before: the port implements shen.x.features.current natively. shen-scheme reports [shen/scheme]; shen-rust reports [shen.x/sha256-host].
  • Bare shen-rust with no arguments still uses the old host-side REPL, which parses KL syntax and bypasses the kernel reader, so 42.1 source-form handlers do not run there. shen-rust repl, eval and script use the kernel's own read loop.

Closes #28

🤖 Generated with Claude Code

https://claude.ai/code/session_01X718xocsFckMvso6EAKoXR


Generated by Claude Code

Replace the Tarver S42 lineage (s42-pristine-20260825) with the community
ShenOSKernel 42.2 that upstream shen-scheme 0.50 ships
(Shen-Language/shen-sources tag shen-42.2, commit 73507e0;
ShenOSKernel-42.2.tar.gz SHA-256 1d022730...2678d8).

kernel/klambda/*.kl, kernel/tests/, kernel/stlib/ (from lib/stlib/) and
kernel/README.md are byte-identical copies of the release tarball. New:
dict.kl, init.kl, stlib.kl, extension-namespaces.kl,
extension-type-annotations.kl. Removed: backend.kl (Tarver's cl.* backend).

The port adaptation and regenerated AOT modules follow in the next commit.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01X718xocsFckMvso6EAKoXR
Adapt the loader to the community 42.2 kernel (#28):

- boot: load the defun-only .kl set in shen-scheme 0.50's order, call
  shen.initialise, install AOT + native overrides, then run
  shen.x.programmable-pattern-matching.initialise,
  shen.x.namespaces.initialise and stlib.initialise (shen-scheme 0.50's
  init order). The standard library now boots from the precompiled
  stlib.kl; boot::load_stlib is removed. *version* is "42.2".
- primitives: the native put/get/unput implement Tarver's pointer-list
  property store, so only install them over a kernel that defines
  shen.change-pointer-value; 42.2 keeps its dict.kl-based put/get.
- klcompile: restore the four stlib.initialise-* defuns to the kernel
  known-slow skip set (large literal tables, run once at boot).
- Regenerate crates/shen-rust/src/aot/kernel/ with
  scripts/codegen-kernel-aot.sh (Gate 6 audit OK); drop backend.rs, add
  dict/init/stlib/extension_namespaces/extension_type_annotations.
- shenffi: embed the same file set and run the same post-boot
  initialisers in shen_boot_embedded.
- Tests: (version) = "42.2"; regression test for the <-address/or AOT
  helper (Bifrost tuple-not-vector).
- Docs: PROVENANCE (lineage choice, port-upgrade audit, S42 kept as
  history), stlib PROVENANCE, CHANGELOG, README, STATUS.

Kernel tests: 143 passed, 0 failed (release).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01X718xocsFckMvso6EAKoXR
@pyrex41
pyrex41 merged commit 5e6de0b into main Oct 11, 2026
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Upgrade kernel to ShenOSKernel 42.2 (Shen 0.50 parity)

2 participants