• v5.5.0 cd0ac7834d

    v5.5.0 — OOP in Native Codegen: Classes, Methods, Ivars
    Some checks are pending
    CI / build-and-test (push) Waiting to run
    Stable

    root released this 2026-03-16 19:20:06 -03:00 | 114 commits to main since this release

    What's New

    Native OOP Support

    Koder can now compile classes with instance variables and methods to standalone x86_64 ELF binaries:

    class Counter
      def initialize(n)
        @n = n
      end
      def value
        return @n
      end
    end
    c = Counter.new(99)
    puts c.value  # => 99
    

    1173-byte standalone ELF binary

    Implementation Details

    • CLASS_DEF assigns sequential class IDs
    • Objects: 80-byte heap blocks with class_id + 8 ivar slots
    • STORE_IVAR/LOAD_IVAR: ivar access at [self + 16 + idx*8]
    • Method dispatch: class_id comparison chain
    • Self passed implicitly at [rbp+16]

    Native Codegen Summary

    Feature Status
    Integers + arithmetic
    Strings (alloc, concat, to_s)
    Variables
    If/else, while
    Functions (def/call/return)
    Arrays (literal, index, push)
    Hashes (alloc, set, get)
    Classes (new, ivars, methods) NEW
    Comparisons, logical ops

    Backlog

    • #052: ZIP/RAR/7z archive support
    • #053: XML parser
    • #054: YAML parser
    Downloads