/tort

Tiny Object Run Time

Primary LanguageC

tort - Tiny Object RunTime

Inspired by Ian Piumarta's idst, maru and other small runtimes.

Core is approx. 5000 lines of C.

Supports:

  • Primitive object types.
    • String.
    • Symbol.
    • Method.
    • Method table.
    • Tagged integer.
    • Vector.
    • Pair.
    • Map.
    • IO with FILE* and finalization.
  • Dynamic message dispatch.
    • ~25,000,000 send/sec on OS X 64-bit using a global method cache.
    • global method cache monitors for invalidations due to:
      • New method definitons using symbol version counters.
      • Changes in lookup() meta-send protocol method.
      • Changes in method table delegation.
  • Meta-send protocol:
    • Decomposed into lookup(message, receiver, ...), apply(message, receiver, ...).
    • Fully recursive lookup() delegation.
    • Message objects allocated on C stack.
    • Supports tail recursion.
    • Supports non-symbol message selectors.
    • Supports method aliasing.
  • Anonymous symbols for lexically scoped methods.
  • Low-bit tag size and method table mapping is configurable at compile-time.
  • Support for locatives (safe pointers).
  • GC Support:
    • NO GC (malloc-only).
    • BDW GC library.
    • SMAL GC library (PROTOTYPE).
Extensions are dynamically loaded:

  • Dynamic library loading with automatic initialization, method installation.
  • Example Extension Library.
    • Lexical blocks in C using GCC nested functions.
    • Fibers (PRELIMINARY).
    • Catch/throw.
    • Object graphing using graphviz/dot.
  • LISP Extension Library.
    • Under 2400 lines.
    • Lisp reader.
    • Lisp writer.
    • Lexical evaluator.
    • Simple macro support.
    • Call-in and call-out to tort primitives.
      • Lambdas can be used as object methods.
      • Lambdas can be used as object blocks.
      • Methods can be called using ('symbol rcvr . args) syntax.
    • Basic Scheme-like semantics boot-strapped from objects and lisp.
    • Basic structures based on vectors.
    • PRELIMINARY x86-64 compiler written in Scheme superset.

Building

make bootstrap make

Examples

lisp/bin/tlisp - simple Lisp interpreter written as object.

= Compiler

lisp/bin/tlisp compiler/t/compiler_test_1.scm