Skip to content

Mini 0.5.0

Choose a tag to compare

@github-actions github-actions released this 30 Oct 10:35
0a233cd

Mini 0.5.0: the whole toolchain is native. mini, minic and the compiler need no JVM, and the compiler compiles itself through C and LLVM.

Install:

curl -fsSL https://raw.githubusercontent.com/HenrySchwerdt/mini/main/install.sh | sh
mini new hello && cd hello && mini run

Try it in the browser: https://henryschwerdt.github.io/mini/ (every example in the docs has a Run button).

Highlights

Native project tool mini.

  • mini new, build, run, test, check, add, tree, explain, doctor.
  • mini.toml with path and git dependencies.
  • Compiled by Mini itself: about 1 ms to start and ships in the release archive. No JDK, no Gradle.

minic with good diagnostics.

  • Errors read like rustc: file:line:col, the source line with an underline, and a summary line. Memory-model errors link to their documentation page.
  • --error-format=json, --color, --error-limit.
  • New commands: minic run file.kt -- args, minic check file.kt, --help for every command, and "did you mean" for typos.
  • Clear exit codes: 0 ok, 1 compile error, 2 usage, 3 internal compiler error.
  • A missing C compiler is explained. Generated C is never shown as a raw C error.
  • -O2 is the default. minic build -g emits #line directives, so gdb and crash reports show your .kt lines.

LLVM backend.

  • MIR to LLVM IR, as text or in memory through the LLVM C API bound in Mini (minic-native --backend=llvm|llvm-api).
  • minic-native --run runs programs with the ORC JIT.
  • Now as fast as the C backend, or faster on numeric code: TBAA, the initial-exec TLS model, and no exception test on the fast path of array accesses.

C interop. external + @CName, CPointer/*Var, memScoped, @CStruct, staticCFunction, @file:CInclude/@file:CLink, and @Owned(free=) for C-allocated memory.

Performance.

  • A thread-local size-class allocator for small objects and faster arenas: 30–48% faster on allocation-heavy code.
  • Inline array accessors, array reads without reference counting where that is safe, and fast integer formatting.
  • Against C at -O2: nbody 0.94–1.03x, mandelbrot ~1.0x, fannkuch 0.9–1.2x, binarytrees ~1.2x, spectralnorm ~1.2x.
  • Cross-language results (C, Rust, Go, JVM, Kotlin/Native): https://henryschwerdt.github.io/mini/benchmarks

Language.

  • The overloadable matrix operator a @ b (operator fun matmul, @=). It is built for tensor libraries, and nothing implements it by default.
  • Operators with context parameters now work.
  • More Kotlin parsed exactly like K2.

In the browser.

  • minic compiled to WebAssembly, together with clang and wasm-ld.
  • A playground, notebooks, and Run/Check buttons on every documentation example.
  • A notebook-style tutorial: https://henryschwerdt.github.io/mini/learn/

What is in the release

  • mini-0.5.0-<target>.tar.gz for linux-x64, linux-arm64 and macos-arm64:
    • bin/mini: the project tool
    • bin/minic: the driver, with run, build, check, emit-c
    • bin/minic-native: the self-hosted compiler
    • lib/libminirt.a and include/: the runtime
    • stdlib/: the standard library sources
  • mini-0.5.0-bootstrap-c.tar.gz: the generated C of the compiler plus the runtime sources. A C compiler alone builds a working compiler from it.
  • SHA256SUMS.

Known gaps

  • A C compiler (clang or gcc) is still needed at build time.
  • No Windows. No coroutines or async IO. No reflection or JSON yet; JSON will be a separate library, mini-serialization.
  • Programs that use allocator objects (mini.memory) do not build on every path yet. The memory checker covers them everywhere.
  • mini check on projects that are not in Strict mode only checks the first file.
  • The repository's own test suite still runs on Gradle/JVM. Moving it to mini test is in progress.

All changes since v0.4.0

  • Release notes for v0.5.0; the release workflow uses docs/releases/.md (1115b59)
  • bootstrap.sh: read the native memory-check diagnostics from stderr (38967ed)
  • wasm playground: parse position-less 'error: ...' lines of minic (ICE, usage), ignore the summary line (5cdb7a5)
  • mini-tool: drop minic-native's own summary lines, keep position-less errors in --message-format=json (deefc54)
  • minic CLI: run/check, help, did-you-mean, -O2 default, C compiler discovery, ICE reporting (263c011)
  • minic-native: rustc-style diagnostics, JSON output, exit codes, #line directives (9bd89a7)
  • parser: accept the variance keyword in as a value-parameter modifier, like K2 (d553302)
  • docs: environment variables of the native mini (MINI_ROOT layout, MINIC_NATIVE, MINI_STAGE0) (13a1a33)
  • website: bring the roadmap page up to date (b846503)
  • website: document cells and preload in the playground README (bfa999d)
  • website: landing page and mobile fixes, install sidebar, tutorial wording (404418b)
  • LLVM backend: initial-exec TLS for the pending slot, TBAA tags, no pending test after inline array accesses (a5151a8)
  • website: interactive tutorial, runnable cells everywhere, install and CLI docs, new landing page (ecbed91)
  • docs: the native mini tool, no Gradle for users (448e1ea)
  • Ship the native mini: wrapper, release archives, install.sh, CI smoke test (535bf59)
  • website: MiniCell component, markdown plugin for runnable fences, toolchain preload (WIP) (6cac662)
  • mini-tool: native Platform and a native build driven by minic-native (ba9ac10)
  • Add the overloadable matrix operator @ (a @ b is a.matmul(b), a @= b) (b2a5d83)
  • docs: quick wins section with before/after measurements (73d150e)
  • Fast int to string without snprintf; StringBuilder.append(Int/Long) without a temporary (ad5abd6)
  • plan: serialization and the web framework are separate libraries, not stdlib (fe3ea2b)
  • RcOpt: borrow array element reads that define a validated borrower (92e62c9)
  • Inline array accessors in the runtime header and in the LLVM lowering (ffc1d8b)
  • website: cross-language baseline and profile summary on the benchmarks page (437f188)
  • docs: cross-language baseline and where the time goes (benchmarks.md) (1cd9bf8)
  • bench: add full baseline run (old runtime, 4-core VM) (9cd4482)
  • docs: tighten allocator numbers wording (0b05641)
  • docs: allocator section in benchmarks.md, implementation notes in memory-model.md and runtime README (56d3cfc)
  • runtime: O(1) batch hand-off in the small-object allocator, inline arena fast path, arena chunk cache (9a1f9bb)
  • bench: cross-language benchmark suite (programs, runner, CI workflow) (e65efa9)
  • runtime: thread-local size-class allocator for Rc/Heap, faster arena bump path (0291bc0)
  • wasm: fast minic.wasm build with the host clang, browser e2e test, pages.yml wiring (707b311)
  • wasm: module worker for the playground (MiniToolchain contract), site layout, protocol test (a5bef7b)
  • wasm: minic.wasm (the compiler as a WASI module), toolchain bundle script and CI workflow, docs (1db7604)
  • wasm: libminirt and all test programs for wasm32-wasip1 with the prebuilt YoWASP clang (b8cca6b)
  • CI: install LLVM 18 dev for the llvm shard and run LlvmApiEndToEndTest there; selfcompare baseline 82 -> 43 (72a54fb)
  • ORC JIT (minic-native --run), mk_pending_slot accessor, bootstrap.sh --backend=llvm-api, LlvmApiEndToEndTest, docs (bfac13e)
  • LLVM C API bound in Mini (compiler/llvm-c) and the in-memory LLVM backend: minic-native --backend=llvm-api (1859221)
  • LLVM backend: lowering written once against an IrBuilder interface, text builder keeps the .ll output (8daa5b7)
  • website: regenerate the counter MIR listing (own frontend output) (4508f59)
  • C backend: extern asm labels carry the platform user label prefix (macOS linking) (a0866da)
  • own frontend: T::class for type parameters; reified class-literal testdata (fd10ead)
  • Pages: run the playground unit tests and typecheck (deb92fc)
  • website: playground and notebook front end (CodeMirror editor, runner, share links, .minb, Open in playground) (df62845)
  • website: toolchain interface, WASI shim, runner worker, notebook model, with node tests (4e79c62)
  • LowerPurityTest: ignore string literals (package names like "java." are data, not API use) (1881c85)
  • own frontend: Byte/Short comparisons and equality widen to Int like K2 (01c497e)
  • website: cinterop sample output matches the trailing space (24047e1)
  • interop: keep selfcompare baseline (no negative literals in interop layout code) (73da3b4)
  • C interop: docs (guide page, README, plan status, memory model), test exclusions (6b3eb71)
  • C interop: memory checker for memScoped/nativeHeap/@owned(free) on both frontends, rebase onto the checker port (09d39d2)
  • C interop: MIR pointers/Byte/Short/Float, externs, loads/stores, callbacks, kotlinx.cinterop stdlib, both frontends, K2 memory-checker support, tests (WIP) (4791dd6)
  • selfcompare: baseline 41 -> 82 (K2-fidelity differences in the new LLVM emitter code), and run it in CI (090c6ba)
  • selfcompare.py: K2 side is --frontend=k2 now that the own frontend is the default (1472a70)
  • own frontend: backtick-quoted names only for identifiers (sema parse), not string text (c9db733)
  • own frontend: backtick identifiers without quotes, no smart cast to Nothing, frontend errors printed like K2's; docs (474e124)
  • minic: own frontend is the default (--frontend=k2 selects K2); bootstrap smoke test of native --check (9236e01)
  • memory checker: native --check mode and build gate in minic-native, MiniMemoryCheckTest (corpus parity with K2, all user files) (d05153a)
  • memory checker on the own frontend: MemoryFacts port (lower), offsets in Ast2Ir, qualified annotation names, minic check --frontend=mini, all user files checked (bd31041)
  • CI: actually schedule the llvm shard (the shard list is built with fromJSON) (6fb0912)
  • CI: LLVM end-to-end tests in their own shard (557e462)
  • LLVM backend (phase 1 of 10g) on top of D2: MIR to textual LLVM IR with the Strict paths, --backend=llvm, bootstrap --backend=llvm, tests, bench, docs (c8fcdf3)