Skip to content

v0.9.8-03: Default @arc, Unified Diagnostics & Parallel Incremental Build

Choose a tag to compare

@dp-aixball dp-aixball released this 29 May 08:24

Toka v0.9.8-03 Release Notes

Toka v0.9.8-03 is a milestone release that delivers critical advancements in static safety guarantees, standard library architecture, parallel build tooling, and multi-threaded runtime safety. This release hardens the compilation boundary, aligns standard library containers with physical hardware models, introduces a parallel incremental build engine, and establishes default atomic reference counting with optimal memory orderings.

🚀 Key Achievements Since v0.9.8-02

1. Multi-Threaded Runtime Safety: Default Atomic Reference Counting

  • Default @arc Semantics: Promoted all reference counting operations for the shared pointer ~ to be atomic by default. This eliminates critical memory safety race conditions under multi-threaded environments.
  • Optimal Happens-Before Memory Orderings:
    • Inc (Retain): Utilizes Monotonic (Relaxed) ordering to minimize runtime overhead. It avoids expensive Data Memory Barrier (DMB) instructions on AArch64 (Apple Silicon) platforms while remaining extremely lightweight on x86_64.
    • Dec (Release): Utilizes AcquireRelease ordering. This establishes a hardware-enforced barrier that synchronizes all historical writes before triggering the @encap/drop destructor, preventing Use-After-Free (UAF) and race conditions during deallocation.
  • Future-Proof Memory Policies: Silently reserved backend code generation slots for @policy suffixes (such as @local and @weak) in the Type and CodeGen systems, avoiding breaking changes for Toka 2.0.

2. Standard Library Redesign: CPU Contiguous Memory & Power-of-Two RingCore

  • Physical Hardware Alignment: Deleted the classic doubly LinkedList from the standard library (std). This aligns Toka with modern contiguous CPU physical memory hierarchies to maximize cache locality.
  • Zero-Division Power-of-Two RingCore: Refactored standard library queue and buffer containers with a power-of-two RingCore, substituting expensive modulo division with fast bitwise operations.
  • True O(1) FIFO Channels: Upgraded standard library channel queues to leverage RingCore, providing zero-cost, high-throughput asynchronous communication.

3. Safety Hardening: Generational Slab & TCB Escaping Analysis

  • Generational Slab Allocator: Implemented the standard generational Slab allocator and SlabID with strict encapsulation.
  • Zero-Copy Option Borrows: Refactored Slab::get and Slab::get_mut to return safe, zero-copy Option borrows and strictly enforced pointer morphology sigils.
  • TCB Boundary Reinterpret Cast Guard: Hardened collectDeps and returnedDeps algorithms in the semantic analyzer to proactively detect and block unsafe pointer reinterpret-cast escapes across the Trusted Computing Base (TCB).

4. Developer Tooling: Forge Parallel Incremental Build Engine

  • Parallel Build Orchestrator: Developed forge, Toka's native parallel incremental build engine. It compiles dirty targets concurrently utilizing standard channels and waker mechanics.
  • Instant Cache Resolution: Embedded a persistent cache store (.forge_cache) that tracks compile-time metadata, file sizes, and modification timestamps to achieve O(1) clean target resolution.
  • Self-Contained FFI Interop: Leveraged native libc_system and thread-local memory allocation systems to manage task lifecycle dynamically.

5. Code Quality & Unified Diagnostics

  • 100% Strongly-Typed Error Engine: Unified and migrated all hand-written compiler error diagnostics into a single source of truth (spec/diagnostic.map.json). It automatically generates type-safe templates, expanding the diagnostics library to 395 entries.
  • Prohibiting Pointer Sigils on Method self: Upgraded HasPointer checks to IsRawPointer and defined ERR_SELF_POINTER_SIGIL to block unsafe morphology symbols on method self parameters at the parser level.
  • Zero-Trigraph Compiler Build: Eliminated -Wtrigraphs preprocessor warnings during C++ compiler bootstrap by escaping legacy query strings inside the error definitions.

🧪 Verification & Regression Testing

This release has passed comprehensive regression test suites:

  • Positive Test Suite (test_pass.sh): 263 out of 263 tests passed (100.00% success rate), including multi-threaded stress tests (atomic_stress.tk and sync_mutex.tk).
  • Negative Test Suite (test_fail.sh): 113 out of 113 diagnostic failure tests passed (100.00% success rate).
  • LSP & Tooling Warnings: Cleaned up all package manager and language server warnings.

📦 Commit & Tag Information

  • Tag: v0.9.8-03
  • Baseline Hash: b190895