Skip to content

Releases: Heniokhos-Systems/KernRift

v2.8.26

Choose a tag to compare

@github-actions github-actions released this 11 Jun 20:34

Full Changelog: v2.8.25...v2.8.26

v2.8.25

Choose a tag to compare

@github-actions github-actions released this 07 May 01:06

Full Changelog: v2.8.24...v2.8.25

v2.8.24

Choose a tag to compare

@github-actions github-actions released this 04 May 07:56

Full Changelog: v2.8.22...v2.8.24

v2.8.22

Choose a tag to compare

@github-actions github-actions released this 01 May 00:04

Full Changelog: v2.8.21...v2.8.22

v2.8.21

Choose a tag to compare

@Pantelis23 Pantelis23 released this 29 Apr 03:09

Three IR codegen wins compounding to a 5.2% bootstrap shrink (1.24 MB → 1.18 MB) and 30% sort runtime drop (153 → 108 ms — krc now beats gcc -O2 on bubble-sort by 2.5×).

What changed

  1. 6th register colour (rbp). Graph-colouring regalloc gained one more callee-saved register, dropping spill rate compiler-wide. rbp had been left out historically; the lz4 / fat-archive paths surfaced an off-by-one in stack-arg overflow loads — replaced `ir_frame_size + 48` (hardcoded "5 pushes + ret addr") with `ir_frame_size + ir_callee_save_bytes + 8`.

  2. Per-function used-callee-save prologue. Functions push only the colours regalloc actually assigned. fib's prologue dropped from 5 pushes to 3; leaf-ish helpers often drop to 0-1. Variable alignment math (push_count parity decides frame_size +8) keeps SP 16-aligned at every CALL.

  3. Cross-register spill-reload peephole. `store rax,V; load rcx,V` (different reg) now emits `mov rcx, rax` instead of a stack roundtrip. Catches matmul-style intermediate-vreg flows through different scratch regs.

Runtime delta (Ryzen 9 7900X)

bench v2.8.20 v2.8.21 gcc -O2 krc Δ
fib 442 ms 427 ms 78 ms -3%
sort 153 ms 108 ms 270 ms -30%, 2.5× ahead of gcc -O2
sieve 3 ms 3 ms 2 ms tied
matmul 34 ms 33 ms 4 ms -3%

Verified: bootstrap fixed point at 1,176,168 bytes; 439/439 tests pass.

Next on the optimization roadmap

  • matmul still 8× behind gcc -O2 — needs loop strength reduction to remove per-iter address recomputation (~10 of ~16 inner-loop insns are `(i*N+j)*8` calculations the compiler should hoist as a running pointer).
  • fib still 5× behind — gcc -O2 inlines fib 4-5 levels deep before materialising leaves as real `call`. Recursive inlining at the IR level.

Full Changelog: v2.8.20...v2.8.21

Full Changelog: v2.8.20...v2.8.21

v2.8.20

Choose a tag to compare

@Pantelis23 Pantelis23 released this 27 Apr 22:46

Fix: return N from main was silently ignored.

The auto-inserted exit syscall at the end of main was clobbering the return register (rax on x86_64, x0 on aarch64) with a hardcoded 0 right before the syscall, so:

```kernrift
fn main() -> int32 { return 42 }
```

exited with status 0 instead of 42 — on every backend (legacy and IR, both arches). The user-visible symptom was that while 1 == 1 { if cond { return 42 } } ignored the return, but it was the same root cause; the loop had nothing to do with it. Existing examples like hello.kr were fine because they call exit(0) explicitly and never reach the auto-glue.

Fix:

  • Auto-exit syscall now forwards the current rax/x0 as the exit code.
  • IR_RET_VOID zeros rax/x0 before branching to the epilogue, so fn main() { ... } (void) still exits with 0.
  • Legacy backends do the same zero at the start of main's body.
  • Function-local return (in non-main functions) is unaffected: callers don't read the return register on void returns.

Verified:

  • fn main() -> int32 { return 42 } → exit 42 ✓
  • while 1 == 1 { ...; return 7 } → exit 7 ✓
  • while 1 == 1 { println(i); if i == 3 { return 42 } } → prints 1 2 3, exit 42 ✓
  • fn main() { ... } (void) → exit 0 ✓

Bootstrap fixed point at 1,244,072 bytes; 439/439 tests pass.

Full Changelog: v2.8.19...v2.8.20

Full Changelog: v2.8.19...v2.8.20

v2.8.19

Choose a tag to compare

@Pantelis23 Pantelis23 released this 27 Apr 21:36

Three stacked bugs that prevented .krbo fat binaries from running in Termux on Android 14+, plus four signed-arithmetic / mixed-float codegen-correctness fixes.

Termux runner

  • runner.kr argv-shift detection now matches argv[0] == argv[1] (Termux's exec wrapper duplicates the binary path), so kr --version no longer parses --version as a .krbo path and SIGBUS on garbage.
  • New kr-runner Make target that concatenates runner.kr + bcj.kr. Building the runner alone left filter_aarch64_bcj / filter_x86_64_bcj unresolved and silently corrupted every extracted slice (entry-point bytes clobbered → SIGBUS at startup).
  • packaging/kr.sh shell wrapper that catches the runner's exit-120 and re-execs ./kr-exec from the user's shell context. Raw execve from the runner's app SELinux domain hits EACCES because Termux wraps execve via libc LD_PRELOAD and our svc 0 syscall bypasses it; the user's shell context has the wrapper engaged so the re-exec succeeds.

Compiler correctness

  • Mixed f32/f64 in BinOp + Assign — widen the narrower side to f64 in float arithmetic. a + 1.0 for f32 a no longer silently reads zero (low 32 bits of f64 1.0).
  • Signed-aware compareint64 var < 0 now actually fires. Added a parallel ir_vreg_signed_buf byte array; int8/16/32/64 declarations tag it, BinOp/Assign propagate, ordering compares pick IR_SCMP_* over unsigned IR_CMP_*. uint* stays unsigned.
  • Signed /, %, >> — new IR_SDIV (132), IR_SMOD (133), IR_SAR (134) emit cqo + idiv / asr on x86 and aarch64. Mirrored in the legacy backend with AST-derived signedness (legacy_node_is_signed).

Verified on Z Fold 5 / Android 16 / Termux: kr program.krbo runs and exits 0. Bootstrap fixed point at 1,240,432 bytes; 439/439 tests pass.

Full Changelog: v2.8.18...v2.8.19

Full Changelog: v2.8.18...v2.8.19

v2.8.18

Choose a tag to compare

@github-actions github-actions released this 23 Apr 18:48

Full Changelog: v2.8.17...v2.8.18

v2.8.17

Choose a tag to compare

@github-actions github-actions released this 21 Apr 03:32

Full Changelog: v2.8.15...v2.8.17

v2.8.15

Choose a tag to compare

@github-actions github-actions released this 19 Apr 16:28

Full Changelog: v2.8.14...v2.8.15