Commit 5e761980
5e761980cedbMerged
Yukihiro "Matz" Matsumoto <[email protected]> · 8 months ago · 5 files · +4 added · ~1 modified
Description
Implement Spinel AOT compiler: Prism parser + C codegen
First working AOT compiler that parses Ruby source with libprism, performs simple type inference, and generates C code linked against mruby. Successfully compiles bm_so_mandelbrot.rb to an executable that produces bit-identical output to CRuby.
Performance on mandelbrot (size=600): CRuby: 1.14s mruby interpreter: 3.18s Spinel AOT: 0.06s (19x faster than CRuby, 53x faster than mruby)
The compiler handles: while loops, local variables, Integer/Float/Boolean type inference, arithmetic/comparison/bitwise operators (as direct C ops), string interpolation, puts/print, Integer#chr, break.
Co-Authored-By: Claude Opus 4.6 (1M context) [email protected]
Details
- Commit
- 5e761980cedb
- Parent
- f134697e738f
.gitignoremodifiedView file
*.a*.so*.dylib*.pbm# Build outputs/spinel/mandelbrot/mandelbrot_aot.c/mandelbrot_dbg# Dependencies (fetched by `make deps`)/lib/prism/MakefileaddedView file
Loading diff…
src/codegen.caddedView file
Loading diff…
src/codegen.haddedView file
Loading diff…
src/main.caddedView file
Loading diff…