Skip to content

Tiny v0.2.5 - JIT Region Outlining and Packed Arrays

Choose a tag to compare

@confh confh released this 15 Jun 18:10

Tiny v0.2.5 - JIT Region Outlining and Packed Arrays

This release introduces significant performance optimizations to the JIT engine, a new data validation library, and substantial enhancements to the language server.

JIT Engine Enhancements

  • Region Outlining: Implemented a loop-profiling pass that automatically outlines hot loops from top-level code and function bodies into specialized JIT regions (__jit_region_*). This enables JIT acceleration for performance-critical logic regardless of whether it is encapsulated in a function.
  • Packed Object Arrays: Introduced host-memory mirroring for arrays containing objects of uniform shape. The JIT engine now generates direct linear memory access patterns via field-column pointer tables, bypassing expensive host-side VM property lookups during array iterations.
  • Default Parameter Injection: The JIT compiler now supports calls to functions with default parameters by statically injecting literal default values into the WASM stack, maintaining full arity without interpreter fallbacks.
  • Result Memoization: Side-effect-free functions are now identified during compilation and eligible for JIT-level memoization. Results are cached based on input identity, eliminating redundant computation for deterministic paths.

Compiler and Optimizer

  • Advanced Superinstructions: The bytecode optimizer now emits new superinstructions, including OP_ARRAY_INDEX_LOCAL_STORE and OP_JUMP_PROPERTY_LOCAL_FALSE/TRUE, consolidating multiple operations into single dispatch cycles.
  • Enhanced Type Propagation: Improved the internal type flow analysis to track property hints for local objects and element types for arrays across complex control flow, enabling tighter JIT code generation.
  • Specialized Property Access: Constant string indices in IndexExpr are now automatically lowered to OP_GET_PROPERTY_SAFE and OP_SET_PROPERTY opcodes for faster resolution.

Standard Library

  • Schema Validation library: Added the validate library, providing a chainable, type-safe API for defining and enforcing data schemas. It includes support for nested objects, arrays, unions, and custom refinement predicates with detailed error reporting.
  • URL library: Added the url library for URL encoding & decoding.
  • Standard Library Extensions:
    • array: Added find(callback) method.
    • object: Added forEach(callback), pick(keys), and omit(keys) utilities.
    • http: Refined request body handling for direct JIT-to-Native object serialization.

Language Server (LSP)

  • Organize Imports: New code action to automatically sort and deduplicate import statements while removing unused aliases.
  • Semantic Error Recovery: The analyzer can now provide semantic diagnostics in files with active syntax errors by performing partial statement recovery during the scan pass.
  • Refactoring Integrity: Enhanced reference tracking and rename logic to correctly filter out object literal keys and string occurrences, ensuring refactors only affect intended identifiers.
  • Type Narrowing: Improved narrowing logic for complex conditional guards and guard-return patterns.

Internal Changes

  • Bytecode Version: Internal bytecode version bumped to 25.
  • VM Configuration: NewVM now requires a VMInfo configuration struct instead of positional arguments.