The Artima Developer Community
Sponsored Link

Ruby Buzz Forum
Sirb: The Rubinius Loupe

0 replies on 1 page.

Welcome Guest
  Sign In

Go back to the topic listing  Back to Topic List Click to reply to this topic  Reply to this Topic Click to search messages in this forum  Search Forum Click for a threaded view of the topic  Threaded View   
Previous Topic   Next Topic
Flat View: This topic has 0 replies on 1 page
Brian Ford

Posts: 153
Nickname: brixen
Registered: Dec, 2005

Brian Ford is Rails developer with PLANET ARGON.
Sirb: The Rubinius Loupe Posted: Apr 20, 2007 9:39 PM
Reply to this message Reply

This post originated from an RSS feed registered with Ruby Buzz by Brian Ford.
Original Post: Sirb: The Rubinius Loupe
Feed Title: def euler(x); cos(x) + i*sin(x); end
Feed URL: http://feeds.feedburner.com/defeulerxcosxisinxend
Feed Description: euler(PI) # => -1
Latest Ruby Buzz Posts
Latest Ruby Buzz Posts by Brian Ford
Latest Posts From def euler(x); cos(x) + i*sin(x); end

Advertisement

If my previous post about sirb got you drooling a bit, read on. I���ve added some simple command line arguments to sirb that enable you to request that s-expressions, assembly, or bytecodes (or all of them) are printed each time through the RCEPL loop. You can get a hint at all the goodness by passing the -h switch.


$ ./shotgun/rubinius apps/irb/sirb.rb -h -p -x -s -b
  Usage: sirb [options]
    sirb is a RCEPL (read, compile, execute, print, loop) program for rubinius

    Options: 
            -p   Print the parsed s-expression
            -x   Print the normalized s-expression.
            -s   Print assembly instructions.
            -b   Print bytecode encoding.

sirb(eval):0> puts "Hello, Rubinius. You rock my world!" 

S-exp:
[:newline, 1, "(eval)", [:fcall, :puts, [:array, [:str, "Hello, Rubinius. You rock my world!", 0]]]]

Normalized S-exp:
[:newline, 1, "(eval)", [:call, [:self], :puts, [:array, [:str, "Hello, Rubinius. You rock my world!", 0]]]]

Asm:
#line 1
push_literal 0
string_dup
push self
send puts 1
ret

Bytecodes:
"\v\000\000\000\000:\f)\000\000\000\001\000\000\000\001'\000\000\000" 
Hello, Rubinius. You rock my world!
=> nil
sirb(eval):1>

As I mentioned, sirb is rudimentary at the moment. But it shows you how much can be done with Rubinius right now. Swell! And, a big thanks to mae for fixing up how the output of the execution prints (no more ["foo"]).

Read: Sirb: The Rubinius Loupe

Topic: Some Real World Performance notes on Ruby 1.8 and 1.9 Previous Topic   Next Topic Topic: Rake db:bootstrap and foreign keys

Sponsored Links



Google
  Web Artima.com   

Copyright © 1996-2019 Artima, Inc. All Rights Reserved. - Privacy Policy - Terms of Use