SlideShare a Scribd company logo
1 of 51
A Tool of the Future
   aka the road to enlightenment




                 1
Ask/give questions/comments.


   Both nice and nasty.
Mantra of rubinius
If it can be done in ruby, then it shouldn’t be in C.




                          3
An idealist is a person who helps
other people to be prosperous.

                   Henry Ford
the edges of the sword are life and death
     no one knows which is which

                               Ikkyū Sōjun
If you’re not failing every now
and again, it’s a sign you’re not
    anything very innovative.
                   Woody Allen
KHAAAAANN!


      James T. Kirk
• What is (and is not) rubinius?
• Who is rubinius?
• Features and Goals
• Timeline
• Technical Details
• Demo / Questions
                        9
http://rubini.us
What.


• A brand new ruby engine
• Bytecode Virtual Machine based
• Generational Garbage Collection


                      11
Why.


• Fun
• A desire for a better interpreter


                       12
Why pt. 2


• Every talk at this conference has mentioned
  some limitation of ruby.

• All limitations are limitations of the current
  interpreter, not the language.




                         13
What it’s not.


• Vaporware
• A thesis project
• Finished.


                     14
Who.
•                                    Aki Reijonen (loop)
    Evan Phoenix (evan)

•                                    Mat Elder (mae)
    Brian Ford (brixen)

•                                    John Hornbeck (hornbeck)
    Wilson Bilkovich (Defiler)

•                                    Carsten Bormann (cabo)
    Pat Eyler (pate)

•                                    Devin Walters (defn)
    Alan Hurdle (hurdlea)

•                                    Frederick Ros (sleeper)
    Thomas Lockney (tlockney)

•                                    Alexander Kellet (lypanov)
    Eero Saynatkai (rue)

•   Mikko Lehtonen (scoopr)

                                15
Features and Goals
• Remember the Mantra!
• VM in C only
  • Includes primitive operations
• Extensive tests and specs
• Core library in ruby
  •   Array#dup, Method#new, Object#instance_eval


                        16
• 1.8.5 compatible
• 98% first class
• Easy to understand, easy to extend, easy to
  optimize

• MRI (Matz Ruby Interpreter) C API compatible

                       17
Timeline.
• 1.0 by October, 2007 - RubyConf
  • Near 100% compatible with 1.8.5
  • Able to run rails 1.2
• 2.0
  • JIT
  • Optimizers
                     18
Technical Details
• 5 core sections
  • CPU
  • Primitives
  • Compiler
  • Object Memory / Garbage Collection
  • Core library
                     19
CPU


• Fully bytecode based
• All bytecodes are written test first
• Leverage GCC to make help make fast


                     20
Threads

• Currently supports green threads
• Contains low level sychronization / sharing
  mechanism called Channel

  • A PI Calculus-like channel
• Native Thread support in a MxN scheme
  • (eventually)
                       21
Primitives


• The most basic method
• Written C (for now)
• Provide most basic functionality


                       22
Compiler

• Completely written in ruby
• COMPLETELY WRITTEN IN RUBY
• Self bootstrapped from initial rubinius
  prototype

• Pipeline based architecture

                        23
# rbx sirb -p -s -b
sirb(eval):000> puts “hello evan”
puts "hello evan"
[:newline, 1,
   "(eval)",
   [:fcall, :puts,
      [:array, [:str, "hello evan"]]]]
#line 1
push_literal 0
string_dup
push self
send puts 1
ret
"v00000000:fC0000
0000)000000010000
         0001'0000
• Every stage is directly accessible
• Think: new parsers that output rubinius
  assembly

  • LISP
  • Smalltalk
  • Erlang

                      29
• Compiler is a normal class, which open doors...
  • Compile ERB templates directly into
    CompiledMethods

  • Ability to remove Kernel#eval if an
    application of rubinius warrants it




                       30
“The Reaper”
     (Object Memory / Garbage Collection)



• Generational Collector
• Young Objects: Baker two-space compacting
  collector

• Mature Objects: Mark/Sweep collector

                      31
Infanticide

• Young objects live fast and die young (usually)
• Once an object survives for a while, it’s
  promoted to the mature object space.

• Compaction keeps the memory footprint small.

                        32
The Old Guard

• Mature objects are collected 10 to 30 times
  less often than young objects.

• All object access in VM is done through the
  “write barrier”, which maintains the set of
  mature objects that reference young objects.

• Objects themselves are not marked, making
  rubinius very “fork friendly”.


                        33
Core library



• Everything you’ve come to love, now in written
  in ruby.




                       34
def [](arg, len = nil)
   if len
     len = len.to_i
     return nil if len  0
   end

   if arg.is_a? String
     unless len.nil?
       raise ArgumentError.new(String#[] cannot accept a second argument with a String.)
     end
     return (self.include?(arg) ? arg.dup : nil)
   elsif arg.respond_to? :match
     m = arg.match(self)
     return m[len.to_i] if m  len
     return m[0] if m
     return nil
   elsif arg.respond_to?(:first) and arg.respond_to?(:last)
     from = arg.first
     to = arg.last
     to -= 1 if arg.respond_to?(:exclude_end?)  arg.exclude_end?
     size = self.size
     from = from + size if from  0
     to += size if to  0
     len = to - from + 1
     self[from, len]

   elsif arg and arg.respond_to?(:to_i)
     arg = arg.to_i

                                                            String#[]
     size = self.size
     arg = arg + size if arg  0
     if 0 = arg  arg  size
        if len
          len = size - arg if arg + len = size
          substring(arg, len)
        else
          @data[arg]
        end
     else # invalid start index
       len ?  : nil
     end
   else
     raise ArgumentError.new(String#[] cannot accept #{arg.class} objects)
   end
def parent
  a=3
  ask_child(a)
  puts OMG #{a} PONIES!
end

def ask_child(initial_pony_count)
  ctx = MethodContext.current.sender
  # Will be ctx.locals[:a] = 9 soon.
  ctx.locals[2] = 9
end

parent()
OMG 9 PONIES!
Nothing is sacred.
    (evil built in)
Backtraces

vatu :: rbx-branches/event ./shotgun/rubinius ctx.rb
An exception has occured:
    No method 'ask_child' on an instance of Object. (NoMethodError)

Backtrace:
           NoMethodError#initialize   at   core/exception.rb:47
                  NoMethodError.new   at   bootstrap/class.rb:8
    main.ask_child (method_missing)   at   bootstrap/method_missing.rb:8
                        main.parent   at   ctx.rb:3
                    main.__script__   at   ctx.rb:12
                          main.load   at   core/compile.rb:56
                    main.__script__   at   core/__loader.rb:95



                                39
MethodTables

class Blah
end

class Foo
  def hello
    puts “hello evan”
  end
end

Blah.methods[:hello_also] = Foo.methods[:hello]
Blah.new.hello_also # hello evan

                          40
It’s your party.


            class Mu  nil
            end

            p Mu.instance_methods # []
            p Mu.superclass # nil




you still mad?           41
Zen and the Art of Object Creation

                42
VM level Sampler



s = Sampler.new(100) # 100 hz
s.start
100000.times { 1 + 1 }
s.stop
s.results.size # 332




                          43
CompiledMethods



m = Array.methods[:index]
p m # #CompiledMethod:0x32a34 ...
p m.name # :index




                          44
But what does that all mean?!
We all know and love
introspection, so take that to the
           next level...
• Better debbugers
  • Read MethodContext objects directly
• Richer information
  • Read method cache’s to find out common
    classes for arguments and locals



                       47
A Better Tool.
!=
How you can help

• Write tests / specs
• Write core library functionality
• Write VM code
• Port valgrind to OS X
  • Bounty available!

                       50
Evan Phoenix
http://rubini.us

       51

More Related Content

What's hot

Building native Android applications with Mirah and Pindah
Building native Android applications with Mirah and PindahBuilding native Android applications with Mirah and Pindah
Building native Android applications with Mirah and PindahNick Plante
 
pyconjp2015_talk_Translation of Python Program__
pyconjp2015_talk_Translation of Python Program__pyconjp2015_talk_Translation of Python Program__
pyconjp2015_talk_Translation of Python Program__Renyuan Lyu
 
Unix Shell Scripting Basics
Unix Shell Scripting BasicsUnix Shell Scripting Basics
Unix Shell Scripting BasicsDr.Ravi
 
Devel::NYTProf v5 at YAPC::NA 201406
Devel::NYTProf v5 at YAPC::NA 201406Devel::NYTProf v5 at YAPC::NA 201406
Devel::NYTProf v5 at YAPC::NA 201406Tim Bunce
 

What's hot (6)

Building native Android applications with Mirah and Pindah
Building native Android applications with Mirah and PindahBuilding native Android applications with Mirah and Pindah
Building native Android applications with Mirah and Pindah
 
pyconjp2015_talk_Translation of Python Program__
pyconjp2015_talk_Translation of Python Program__pyconjp2015_talk_Translation of Python Program__
pyconjp2015_talk_Translation of Python Program__
 
Php engine
Php enginePhp engine
Php engine
 
Unix Shell Scripting Basics
Unix Shell Scripting BasicsUnix Shell Scripting Basics
Unix Shell Scripting Basics
 
Devel::NYTProf v5 at YAPC::NA 201406
Devel::NYTProf v5 at YAPC::NA 201406Devel::NYTProf v5 at YAPC::NA 201406
Devel::NYTProf v5 at YAPC::NA 201406
 
Opal compiler
Opal compilerOpal compiler
Opal compiler
 

Viewers also liked

Rubinius - Improving the Rails ecosystem
Rubinius - Improving the Rails ecosystemRubinius - Improving the Rails ecosystem
Rubinius - Improving the Rails ecosystemevanphx
 
2010 04-24-cerealize
2010 04-24-cerealize2010 04-24-cerealize
2010 04-24-cerealizeLin Jen-Shin
 
Server Development Workflow For PicCollage
Server Development Workflow For PicCollageServer Development Workflow For PicCollage
Server Development Workflow For PicCollageLin Jen-Shin
 
2008-12-21 Rubinius
2008-12-21 Rubinius2008-12-21 Rubinius
2008-12-21 RubiniusLin Jen-Shin
 
The Architecture of PicCollage Server
The Architecture of PicCollage ServerThe Architecture of PicCollage Server
The Architecture of PicCollage ServerLin Jen-Shin
 
2012 05-08-lambda-draft
2012 05-08-lambda-draft2012 05-08-lambda-draft
2012 05-08-lambda-draftLin Jen-Shin
 
Rubinius @ RubyAndRails2010
Rubinius @ RubyAndRails2010Rubinius @ RubyAndRails2010
Rubinius @ RubyAndRails2010Dirkjan Bussink
 
Rubinius For You - GoRuCo
Rubinius For You - GoRuCoRubinius For You - GoRuCo
Rubinius For You - GoRuCoevanphx
 
Concurrent Ruby Application Servers
Concurrent Ruby Application ServersConcurrent Ruby Application Servers
Concurrent Ruby Application ServersLin Jen-Shin
 

Viewers also liked (10)

Emrubyconf
EmrubyconfEmrubyconf
Emrubyconf
 
Rubinius - Improving the Rails ecosystem
Rubinius - Improving the Rails ecosystemRubinius - Improving the Rails ecosystem
Rubinius - Improving the Rails ecosystem
 
2010 04-24-cerealize
2010 04-24-cerealize2010 04-24-cerealize
2010 04-24-cerealize
 
Server Development Workflow For PicCollage
Server Development Workflow For PicCollageServer Development Workflow For PicCollage
Server Development Workflow For PicCollage
 
2008-12-21 Rubinius
2008-12-21 Rubinius2008-12-21 Rubinius
2008-12-21 Rubinius
 
The Architecture of PicCollage Server
The Architecture of PicCollage ServerThe Architecture of PicCollage Server
The Architecture of PicCollage Server
 
2012 05-08-lambda-draft
2012 05-08-lambda-draft2012 05-08-lambda-draft
2012 05-08-lambda-draft
 
Rubinius @ RubyAndRails2010
Rubinius @ RubyAndRails2010Rubinius @ RubyAndRails2010
Rubinius @ RubyAndRails2010
 
Rubinius For You - GoRuCo
Rubinius For You - GoRuCoRubinius For You - GoRuCo
Rubinius For You - GoRuCo
 
Concurrent Ruby Application Servers
Concurrent Ruby Application ServersConcurrent Ruby Application Servers
Concurrent Ruby Application Servers
 

Similar to Rubinius - A Tool of the Future

A Re-Introduction to JavaScript
A Re-Introduction to JavaScriptA Re-Introduction to JavaScript
A Re-Introduction to JavaScriptSimon Willison
 
Applying RSpec Best Practises
Applying RSpec Best PractisesApplying RSpec Best Practises
Applying RSpec Best PractisesNeil Henegan
 
Test First Teaching
Test First TeachingTest First Teaching
Test First TeachingSarah Allen
 
Ruby Topic Maps Tutorial (2007-10-10)
Ruby Topic Maps Tutorial (2007-10-10)Ruby Topic Maps Tutorial (2007-10-10)
Ruby Topic Maps Tutorial (2007-10-10)Benjamin Bock
 
A New Age of JVM Garbage Collectors (Clojure Conj 2019)
A New Age of JVM Garbage Collectors (Clojure Conj 2019)A New Age of JVM Garbage Collectors (Clojure Conj 2019)
A New Age of JVM Garbage Collectors (Clojure Conj 2019)Alexander Yakushev
 
Hiveminder - Everything but the Secret Sauce
Hiveminder - Everything but the Secret SauceHiveminder - Everything but the Secret Sauce
Hiveminder - Everything but the Secret SauceJesse Vincent
 
Charles nutter star techconf 2011 - jvm languages
Charles nutter   star techconf 2011 - jvm languagesCharles nutter   star techconf 2011 - jvm languages
Charles nutter star techconf 2011 - jvm languagesStarTech Conference
 
javascript teach
javascript teachjavascript teach
javascript teachguest3732fa
 
JSBootcamp_White
JSBootcamp_WhiteJSBootcamp_White
JSBootcamp_Whiteguest3732fa
 
Ruby for .NET developers
Ruby for .NET developersRuby for .NET developers
Ruby for .NET developersMax Titov
 
error_highlight: User-friendly Error Diagnostics
error_highlight: User-friendly Error Diagnosticserror_highlight: User-friendly Error Diagnostics
error_highlight: User-friendly Error Diagnosticsmametter
 
Archeology for Entertainment, or Checking Microsoft Word 1.1a with PVS-Studio
Archeology for Entertainment, or Checking Microsoft Word 1.1a with PVS-StudioArcheology for Entertainment, or Checking Microsoft Word 1.1a with PVS-Studio
Archeology for Entertainment, or Checking Microsoft Word 1.1a with PVS-StudioAndrey Karpov
 
Experiments in Sharing Java VM Technology with CRuby
Experiments in Sharing Java VM Technology with CRubyExperiments in Sharing Java VM Technology with CRuby
Experiments in Sharing Java VM Technology with CRubyMatthew Gaudet
 
Your Own Metric System
Your Own Metric SystemYour Own Metric System
Your Own Metric SystemErin Dees
 
Master the Concepts Behind the Java 10 Challenges and Eliminate Stressful Bugs
Master the Concepts Behind the Java 10 Challenges and Eliminate Stressful BugsMaster the Concepts Behind the Java 10 Challenges and Eliminate Stressful Bugs
Master the Concepts Behind the Java 10 Challenges and Eliminate Stressful BugsRafael Chinelato Del Nero
 
Perl at SkyCon'12
Perl at SkyCon'12Perl at SkyCon'12
Perl at SkyCon'12Tim Bunce
 

Similar to Rubinius - A Tool of the Future (20)

IJTC%202009%20JRuby
IJTC%202009%20JRubyIJTC%202009%20JRuby
IJTC%202009%20JRuby
 
Scala Sjug 09
Scala Sjug 09Scala Sjug 09
Scala Sjug 09
 
A Re-Introduction to JavaScript
A Re-Introduction to JavaScriptA Re-Introduction to JavaScript
A Re-Introduction to JavaScript
 
Ruby Under The Hood
Ruby Under The HoodRuby Under The Hood
Ruby Under The Hood
 
Applying RSpec Best Practises
Applying RSpec Best PractisesApplying RSpec Best Practises
Applying RSpec Best Practises
 
Test First Teaching
Test First TeachingTest First Teaching
Test First Teaching
 
Ruby Topic Maps Tutorial (2007-10-10)
Ruby Topic Maps Tutorial (2007-10-10)Ruby Topic Maps Tutorial (2007-10-10)
Ruby Topic Maps Tutorial (2007-10-10)
 
A New Age of JVM Garbage Collectors (Clojure Conj 2019)
A New Age of JVM Garbage Collectors (Clojure Conj 2019)A New Age of JVM Garbage Collectors (Clojure Conj 2019)
A New Age of JVM Garbage Collectors (Clojure Conj 2019)
 
Hiveminder - Everything but the Secret Sauce
Hiveminder - Everything but the Secret SauceHiveminder - Everything but the Secret Sauce
Hiveminder - Everything but the Secret Sauce
 
Charles nutter star techconf 2011 - jvm languages
Charles nutter   star techconf 2011 - jvm languagesCharles nutter   star techconf 2011 - jvm languages
Charles nutter star techconf 2011 - jvm languages
 
javascript teach
javascript teachjavascript teach
javascript teach
 
JSBootcamp_White
JSBootcamp_WhiteJSBootcamp_White
JSBootcamp_White
 
Ruby for .NET developers
Ruby for .NET developersRuby for .NET developers
Ruby for .NET developers
 
error_highlight: User-friendly Error Diagnostics
error_highlight: User-friendly Error Diagnosticserror_highlight: User-friendly Error Diagnostics
error_highlight: User-friendly Error Diagnostics
 
Archeology for Entertainment, or Checking Microsoft Word 1.1a with PVS-Studio
Archeology for Entertainment, or Checking Microsoft Word 1.1a with PVS-StudioArcheology for Entertainment, or Checking Microsoft Word 1.1a with PVS-Studio
Archeology for Entertainment, or Checking Microsoft Word 1.1a with PVS-Studio
 
Experiments in Sharing Java VM Technology with CRuby
Experiments in Sharing Java VM Technology with CRubyExperiments in Sharing Java VM Technology with CRuby
Experiments in Sharing Java VM Technology with CRuby
 
Inferno Scalable Deep Learning on Spark
Inferno Scalable Deep Learning on SparkInferno Scalable Deep Learning on Spark
Inferno Scalable Deep Learning on Spark
 
Your Own Metric System
Your Own Metric SystemYour Own Metric System
Your Own Metric System
 
Master the Concepts Behind the Java 10 Challenges and Eliminate Stressful Bugs
Master the Concepts Behind the Java 10 Challenges and Eliminate Stressful BugsMaster the Concepts Behind the Java 10 Challenges and Eliminate Stressful Bugs
Master the Concepts Behind the Java 10 Challenges and Eliminate Stressful Bugs
 
Perl at SkyCon'12
Perl at SkyCon'12Perl at SkyCon'12
Perl at SkyCon'12
 

More from evanphx

Developing a Language
Developing a LanguageDeveloping a Language
Developing a Languageevanphx
 
Rubinius - What Have You Done For Me Lately?
Rubinius - What Have You Done For Me Lately?Rubinius - What Have You Done For Me Lately?
Rubinius - What Have You Done For Me Lately?evanphx
 
Rubinius - What Have You Done For Me Lately
Rubinius - What Have You Done For Me LatelyRubinius - What Have You Done For Me Lately
Rubinius - What Have You Done For Me Latelyevanphx
 
Staking Your Claim In Open Source
Staking Your Claim In Open SourceStaking Your Claim In Open Source
Staking Your Claim In Open Sourceevanphx
 
Rubinius 1.0 and more!
Rubinius 1.0 and more!Rubinius 1.0 and more!
Rubinius 1.0 and more!evanphx
 
RubyConf 2009
RubyConf 2009RubyConf 2009
RubyConf 2009evanphx
 
Accelerating Ruby with LLVM
Accelerating Ruby with LLVMAccelerating Ruby with LLVM
Accelerating Ruby with LLVMevanphx
 
Ruby World
Ruby WorldRuby World
Ruby Worldevanphx
 
Rubinius Community - MWRC
Rubinius Community - MWRCRubinius Community - MWRC
Rubinius Community - MWRCevanphx
 
rubyconf 2007 - Rubinius 1.0
rubyconf 2007 - Rubinius 1.0rubyconf 2007 - Rubinius 1.0
rubyconf 2007 - Rubinius 1.0evanphx
 

More from evanphx (10)

Developing a Language
Developing a LanguageDeveloping a Language
Developing a Language
 
Rubinius - What Have You Done For Me Lately?
Rubinius - What Have You Done For Me Lately?Rubinius - What Have You Done For Me Lately?
Rubinius - What Have You Done For Me Lately?
 
Rubinius - What Have You Done For Me Lately
Rubinius - What Have You Done For Me LatelyRubinius - What Have You Done For Me Lately
Rubinius - What Have You Done For Me Lately
 
Staking Your Claim In Open Source
Staking Your Claim In Open SourceStaking Your Claim In Open Source
Staking Your Claim In Open Source
 
Rubinius 1.0 and more!
Rubinius 1.0 and more!Rubinius 1.0 and more!
Rubinius 1.0 and more!
 
RubyConf 2009
RubyConf 2009RubyConf 2009
RubyConf 2009
 
Accelerating Ruby with LLVM
Accelerating Ruby with LLVMAccelerating Ruby with LLVM
Accelerating Ruby with LLVM
 
Ruby World
Ruby WorldRuby World
Ruby World
 
Rubinius Community - MWRC
Rubinius Community - MWRCRubinius Community - MWRC
Rubinius Community - MWRC
 
rubyconf 2007 - Rubinius 1.0
rubyconf 2007 - Rubinius 1.0rubyconf 2007 - Rubinius 1.0
rubyconf 2007 - Rubinius 1.0
 

Recently uploaded

The Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptxThe Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptxMalak Abu Hammad
 
FULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | Delhi
FULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | DelhiFULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | Delhi
FULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | Delhisoniya singh
 
Salesforce Community Group Quito, Salesforce 101
Salesforce Community Group Quito, Salesforce 101Salesforce Community Group Quito, Salesforce 101
Salesforce Community Group Quito, Salesforce 101Paola De la Torre
 
08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking MenDelhi Call girls
 
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptxHampshireHUG
 
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking MenDelhi Call girls
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerThousandEyes
 
Presentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreterPresentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreternaman860154
 
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 3652toLead Limited
 
Factors to Consider When Choosing Accounts Payable Services Providers.pptx
Factors to Consider When Choosing Accounts Payable Services Providers.pptxFactors to Consider When Choosing Accounts Payable Services Providers.pptx
Factors to Consider When Choosing Accounts Payable Services Providers.pptxKatpro Technologies
 
[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdfhans926745
 
SQL Database Design For Developers at php[tek] 2024
SQL Database Design For Developers at php[tek] 2024SQL Database Design For Developers at php[tek] 2024
SQL Database Design For Developers at php[tek] 2024Scott Keck-Warren
 
#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024BookNet Canada
 
Enhancing Worker Digital Experience: A Hands-on Workshop for Partners
Enhancing Worker Digital Experience: A Hands-on Workshop for PartnersEnhancing Worker Digital Experience: A Hands-on Workshop for Partners
Enhancing Worker Digital Experience: A Hands-on Workshop for PartnersThousandEyes
 
Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...
Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...
Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...HostedbyConfluent
 
Injustice - Developers Among Us (SciFiDevCon 2024)
Injustice - Developers Among Us (SciFiDevCon 2024)Injustice - Developers Among Us (SciFiDevCon 2024)
Injustice - Developers Among Us (SciFiDevCon 2024)Allon Mureinik
 
Human Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR SystemsHuman Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR SystemsMark Billinghurst
 
Understanding the Laravel MVC Architecture
Understanding the Laravel MVC ArchitectureUnderstanding the Laravel MVC Architecture
Understanding the Laravel MVC ArchitecturePixlogix Infotech
 
Swan(sea) Song – personal research during my six years at Swansea ... and bey...
Swan(sea) Song – personal research during my six years at Swansea ... and bey...Swan(sea) Song – personal research during my six years at Swansea ... and bey...
Swan(sea) Song – personal research during my six years at Swansea ... and bey...Alan Dix
 
Beyond Boundaries: Leveraging No-Code Solutions for Industry Innovation
Beyond Boundaries: Leveraging No-Code Solutions for Industry InnovationBeyond Boundaries: Leveraging No-Code Solutions for Industry Innovation
Beyond Boundaries: Leveraging No-Code Solutions for Industry InnovationSafe Software
 

Recently uploaded (20)

The Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptxThe Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptx
 
FULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | Delhi
FULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | DelhiFULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | Delhi
FULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | Delhi
 
Salesforce Community Group Quito, Salesforce 101
Salesforce Community Group Quito, Salesforce 101Salesforce Community Group Quito, Salesforce 101
Salesforce Community Group Quito, Salesforce 101
 
08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men
 
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
 
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected Worker
 
Presentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreterPresentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreter
 
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365
 
Factors to Consider When Choosing Accounts Payable Services Providers.pptx
Factors to Consider When Choosing Accounts Payable Services Providers.pptxFactors to Consider When Choosing Accounts Payable Services Providers.pptx
Factors to Consider When Choosing Accounts Payable Services Providers.pptx
 
[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf
 
SQL Database Design For Developers at php[tek] 2024
SQL Database Design For Developers at php[tek] 2024SQL Database Design For Developers at php[tek] 2024
SQL Database Design For Developers at php[tek] 2024
 
#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
 
Enhancing Worker Digital Experience: A Hands-on Workshop for Partners
Enhancing Worker Digital Experience: A Hands-on Workshop for PartnersEnhancing Worker Digital Experience: A Hands-on Workshop for Partners
Enhancing Worker Digital Experience: A Hands-on Workshop for Partners
 
Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...
Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...
Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...
 
Injustice - Developers Among Us (SciFiDevCon 2024)
Injustice - Developers Among Us (SciFiDevCon 2024)Injustice - Developers Among Us (SciFiDevCon 2024)
Injustice - Developers Among Us (SciFiDevCon 2024)
 
Human Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR SystemsHuman Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR Systems
 
Understanding the Laravel MVC Architecture
Understanding the Laravel MVC ArchitectureUnderstanding the Laravel MVC Architecture
Understanding the Laravel MVC Architecture
 
Swan(sea) Song – personal research during my six years at Swansea ... and bey...
Swan(sea) Song – personal research during my six years at Swansea ... and bey...Swan(sea) Song – personal research during my six years at Swansea ... and bey...
Swan(sea) Song – personal research during my six years at Swansea ... and bey...
 
Beyond Boundaries: Leveraging No-Code Solutions for Industry Innovation
Beyond Boundaries: Leveraging No-Code Solutions for Industry InnovationBeyond Boundaries: Leveraging No-Code Solutions for Industry Innovation
Beyond Boundaries: Leveraging No-Code Solutions for Industry Innovation
 

Rubinius - A Tool of the Future

  • 1. A Tool of the Future aka the road to enlightenment 1
  • 2. Ask/give questions/comments. Both nice and nasty.
  • 3. Mantra of rubinius If it can be done in ruby, then it shouldn’t be in C. 3
  • 4. An idealist is a person who helps other people to be prosperous. Henry Ford
  • 5. the edges of the sword are life and death no one knows which is which Ikkyū Sōjun
  • 6. If you’re not failing every now and again, it’s a sign you’re not anything very innovative. Woody Allen
  • 7. KHAAAAANN! James T. Kirk
  • 8.
  • 9. • What is (and is not) rubinius? • Who is rubinius? • Features and Goals • Timeline • Technical Details • Demo / Questions 9
  • 11. What. • A brand new ruby engine • Bytecode Virtual Machine based • Generational Garbage Collection 11
  • 12. Why. • Fun • A desire for a better interpreter 12
  • 13. Why pt. 2 • Every talk at this conference has mentioned some limitation of ruby. • All limitations are limitations of the current interpreter, not the language. 13
  • 14. What it’s not. • Vaporware • A thesis project • Finished. 14
  • 15. Who. • Aki Reijonen (loop) Evan Phoenix (evan) • Mat Elder (mae) Brian Ford (brixen) • John Hornbeck (hornbeck) Wilson Bilkovich (Defiler) • Carsten Bormann (cabo) Pat Eyler (pate) • Devin Walters (defn) Alan Hurdle (hurdlea) • Frederick Ros (sleeper) Thomas Lockney (tlockney) • Alexander Kellet (lypanov) Eero Saynatkai (rue) • Mikko Lehtonen (scoopr) 15
  • 16. Features and Goals • Remember the Mantra! • VM in C only • Includes primitive operations • Extensive tests and specs • Core library in ruby • Array#dup, Method#new, Object#instance_eval 16
  • 17. • 1.8.5 compatible • 98% first class • Easy to understand, easy to extend, easy to optimize • MRI (Matz Ruby Interpreter) C API compatible 17
  • 18. Timeline. • 1.0 by October, 2007 - RubyConf • Near 100% compatible with 1.8.5 • Able to run rails 1.2 • 2.0 • JIT • Optimizers 18
  • 19. Technical Details • 5 core sections • CPU • Primitives • Compiler • Object Memory / Garbage Collection • Core library 19
  • 20. CPU • Fully bytecode based • All bytecodes are written test first • Leverage GCC to make help make fast 20
  • 21. Threads • Currently supports green threads • Contains low level sychronization / sharing mechanism called Channel • A PI Calculus-like channel • Native Thread support in a MxN scheme • (eventually) 21
  • 22. Primitives • The most basic method • Written C (for now) • Provide most basic functionality 22
  • 23. Compiler • Completely written in ruby • COMPLETELY WRITTEN IN RUBY • Self bootstrapped from initial rubinius prototype • Pipeline based architecture 23
  • 24. # rbx sirb -p -s -b sirb(eval):000> puts “hello evan”
  • 26. [:newline, 1, "(eval)", [:fcall, :puts, [:array, [:str, "hello evan"]]]]
  • 29. • Every stage is directly accessible • Think: new parsers that output rubinius assembly • LISP • Smalltalk • Erlang 29
  • 30. • Compiler is a normal class, which open doors... • Compile ERB templates directly into CompiledMethods • Ability to remove Kernel#eval if an application of rubinius warrants it 30
  • 31. “The Reaper” (Object Memory / Garbage Collection) • Generational Collector • Young Objects: Baker two-space compacting collector • Mature Objects: Mark/Sweep collector 31
  • 32. Infanticide • Young objects live fast and die young (usually) • Once an object survives for a while, it’s promoted to the mature object space. • Compaction keeps the memory footprint small. 32
  • 33. The Old Guard • Mature objects are collected 10 to 30 times less often than young objects. • All object access in VM is done through the “write barrier”, which maintains the set of mature objects that reference young objects. • Objects themselves are not marked, making rubinius very “fork friendly”. 33
  • 34. Core library • Everything you’ve come to love, now in written in ruby. 34
  • 35. def [](arg, len = nil) if len len = len.to_i return nil if len 0 end if arg.is_a? String unless len.nil? raise ArgumentError.new(String#[] cannot accept a second argument with a String.) end return (self.include?(arg) ? arg.dup : nil) elsif arg.respond_to? :match m = arg.match(self) return m[len.to_i] if m len return m[0] if m return nil elsif arg.respond_to?(:first) and arg.respond_to?(:last) from = arg.first to = arg.last to -= 1 if arg.respond_to?(:exclude_end?) arg.exclude_end? size = self.size from = from + size if from 0 to += size if to 0 len = to - from + 1 self[from, len] elsif arg and arg.respond_to?(:to_i) arg = arg.to_i String#[] size = self.size arg = arg + size if arg 0 if 0 = arg arg size if len len = size - arg if arg + len = size substring(arg, len) else @data[arg] end else # invalid start index len ? : nil end else raise ArgumentError.new(String#[] cannot accept #{arg.class} objects) end
  • 36. def parent a=3 ask_child(a) puts OMG #{a} PONIES! end def ask_child(initial_pony_count) ctx = MethodContext.current.sender # Will be ctx.locals[:a] = 9 soon. ctx.locals[2] = 9 end parent()
  • 38. Nothing is sacred. (evil built in)
  • 39. Backtraces vatu :: rbx-branches/event ./shotgun/rubinius ctx.rb An exception has occured: No method 'ask_child' on an instance of Object. (NoMethodError) Backtrace: NoMethodError#initialize at core/exception.rb:47 NoMethodError.new at bootstrap/class.rb:8 main.ask_child (method_missing) at bootstrap/method_missing.rb:8 main.parent at ctx.rb:3 main.__script__ at ctx.rb:12 main.load at core/compile.rb:56 main.__script__ at core/__loader.rb:95 39
  • 40. MethodTables class Blah end class Foo def hello puts “hello evan” end end Blah.methods[:hello_also] = Foo.methods[:hello] Blah.new.hello_also # hello evan 40
  • 41. It’s your party. class Mu nil end p Mu.instance_methods # [] p Mu.superclass # nil you still mad? 41
  • 42. Zen and the Art of Object Creation 42
  • 43. VM level Sampler s = Sampler.new(100) # 100 hz s.start 100000.times { 1 + 1 } s.stop s.results.size # 332 43
  • 44. CompiledMethods m = Array.methods[:index] p m # #CompiledMethod:0x32a34 ... p m.name # :index 44
  • 45. But what does that all mean?!
  • 46. We all know and love introspection, so take that to the next level...
  • 47. • Better debbugers • Read MethodContext objects directly • Richer information • Read method cache’s to find out common classes for arguments and locals 47
  • 49. !=
  • 50. How you can help • Write tests / specs • Write core library functionality • Write VM code • Port valgrind to OS X • Bounty available! 50