RubyX

Compile ruby to binary

in 100% Ruby

No external dependencies

Faster ( X times )

Easy to understand

Easy to modify own tool

Torsten

codeberg.org/rubydesign

30+ years coding

Now coding as hobby

from Finland

Finland

Raisa (my wife)

Raisa

Run a b&b villataika.fi

Villa Taika

RubyX

Compile ruby to binary in ruby

why

how

future

Short Story

About the 60’s

uncle Bob

going to Mars

the Energy solution

Mission to the Moon

‘61 goal declared by Kennedy

‘69 achieved by Appollo 9

4bit , 2k RAM , 1Mhz

Mars 2020, maybe

Molten-Salt Reactor

Early 60’s nuclear research (Thorium)

sucessful run '64-'69 , 7MW

Walk away safe , small , little waste

Rediscovered by Kirk Sorensen 2008

Programming

Uncle Bob “Future of programming”

C ,Unix,Smalltalk ,Lisp ,invented 60’s

Engineers doubling every 5 years

Go 2009 , Rust 2010 , Julia 2012

Theory of 60’s

Programming, spaceflight, energy

Major advancement in 60’s

New advancements only recently

Why now

Simula invented OO concepts in 67

Smalltalk (first pure OO) PARC 70’s

Popular 80’s , "Blue Book" published

Ruby, Python, JS, reincarnated 90’s

YARV, mri’s stack machine, 00's

The Speed problem

10x possibly 30x sometimes 100x

laptop becomes a pi

1k hardware costs 10k

Effects of Speed

2 language problem (nice OR fast)

Limited domains accessible

Smaller community

less tools

Problem cause

Speed is symptom

Interpretation is cause
(walking with a map)

Compilation is the solution

Meta problem

Implementation language

You can’t fix

Ruby is the solution

Why me?

I

love ruby

Also:

I have time

and basic skills

and motivation

Motivation

Further the art

prove the oo case

for the community

with you

Demo of cli


ruby-x.rubydesign.fi


codeberg.org/ruby-x

Currenty working (overview)

basic oo (classes/ objects)

memory layout

calling convention

binary creation

variables +

assignment

  • local /arg
  • ivar
  • implicit return

static calling

argument passing

constants

local / ivar

calls

dynamic sending

as static, plus

method resolution

caching

Lambdas

implicit capture and compilation

block passing as argument

yield with arguments

return (lambda style)

control structures

if / else / until

while

complex conditions

no break / continue (easy)

Not working

eval

procs / binding

exceptions

class variables / globals

multi - assignment

stdlib

. . . . . .

That was what


next


How

With rails analogy

Rails app

many views


RubyX

many methods


method = view

controller renders view


compiler compiles methods


controller = compiler part

rack handles http


assembler and elf handles binary creation


lower levels don't matter to most

request processed by layers


Compiler processes in layers


same same, but different :-)

Compiler layers

Ruby source (parser gem)

Virtual oo language (vool)

Minimal oo Machine (mom)

Risc abstraction

Target (arm)

Elf / binary

Vool, virtual oo language

virtual == no syntax

oo == object model like ruby

ruby without the fluff ( splats / unless ..)

Statements + Expression

nothing implicit

Language vs Machine

next level is (abtract) machine

statement tree vs instruction list

variables vs memory

control structures vs jumps

abstract vs basic

Mom, minimal object machine

16 instructions

Works only on memory

higher level than next

ease transition to next level

1 vool → 2-8 mom

MOM instructions

simple call , argument transfer , return sequence

dynamic call , method resolve

checks with implicit jumps

ruby truth check , identity check

yield . . .

Risc abstraction

arm without the fluff

arm like registers

20 instructions

extensible (for builtin + more)

last virtual layer

interpreter + visual debugger

Risc instructions

mem/reg + reg/reg

arithmetic operators

tests on operation result

jump , call , return

syscall

Code generation



object generation

Object Model

Everything is Object

Fixed sizes

opaque data, ruby has no access

mom instructions to process data

Object has Type

Types are immutable

Types store callable methods

maps names to indexes

does not define types recursively

type reference may change

Type implements Class

Class has instance Type

new object has instance type

instance type may change

many types implement one class

class stores method definition

Types are static

Ruby is dynamic

?

objects type reference may change

class instance type may change

Basic Objects: Parfait

minimal runtime for compiling

Basic oo: Class , Type , Method , Code

Utils: String, Integer , Array , Hash

also, additional builtin methods

Calling convention

linked list (not stack)

object oriented

easy to understand

exceptions easier

binding easier

Message Object

next / caller message

frame (locals) + args

return address + value

method

receiver (self)

Project

5 years

3k commits , 1600 tests

multi arch ready, arm working

basic executables (mini rt)

stable architecture

Plans for RubyX

What can you do

Impact on community

My next Plans

Benchmarks

Bootstrapping

Parfait

Benchmarks

Micro with mixed results

Integer ops slightly slower

Calling 2x faster

Puts faster than c

Conclusion from Benchmarks

Bigger benchmarks, more functionality

Profiling

Macros

Inlining

Better Parfait

Integrate existing tests

Complement existing classes

More classes

Optimize

Bootstrap

Compile ruby-x with rubyxc

Improving compiler

Figure out metacode

Integrate ruby spec

Things you can do

Spread the word

Learn

Participate

Participate

Many topics, small and large

Functionality or research

no pressure

Topics

assemblers (architectures)

Register allocation

digital trees (judy)

lock free synchronisation (Dr Cliff)

stdlib , pi project , gc , . . . . .

Impact on community

assuming bootstrapped + working

new applications

desktops, native mobile, server, ai

Broaden base, more tools, positive spiral

Evolution

small core , gems + bundler

democracy of gems

better gc, better hash

good thrive etc

best results when not controlled

RubyX

Read up ruby-x.rubydesign.fi
Start coding codeberg.org/ruby-x/
Make contact google group ruby-x