-
v5.5.0 — OOP in Native Codegen: Classes, Methods, Ivars
StableSome checks are pendingCI / build-and-test (push) Waiting to runreleased this
2026-03-16 19:20:06 -03:00 | 114 commits to main since this releaseWhat'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
Downloads
-
Source code (ZIP)
0 downloads
-
Source code (TAR.GZ)
0 downloads