Skip to content

Instantly share code, notes, and snippets.

@subbuss
Created July 7, 2009 19:03
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save subbuss/142281 to your computer and use it in GitHub Desktop.
Save subbuss/142281 to your computer and use it in GitHub Desktop.
[subbu@earth jruby] java -cp lib/jruby.jar org.jruby.compiler.ir.IR_Builder -e "class Foo; @@b = 5; @a = 1; def self.bar; puts @a; puts @@b; end; end; class Bar < Foo; @a = 2; def self.bar; super; end; bar; end"
Script:
file: "-e"
class:
Class:
className: _DUMMY_
instrs:
0 DEF_CLASS_METH(_DUMMY_, __file__)
1 CONST(Class _DUMMY_, Foo) = Class Foo
2 %v_0 = GET_CONST(Class _DUMMY_, Foo)
3 CONST(Class _DUMMY_, Bar) = Class Bar
classes:
[Class:
className: Foo
instrs:
0 (Class Foo.@@b) = 5:fixnum
1 PUT_FIELD[self, @a, 1:fixnum]
2 DEF_CLASS_METH(Foo, bar)
methods:
[Method:
name: bar
instrs:
0 self = RECV_ARG(0)
1 %v_0 = GET_FIELD(self, @a)
2 %v_1 = CALL(puts, [self, %v_0])
3 %v_2 = GET_CVAR(Class Foo.@@b)
4 %v_3 = CALL(puts, [self, %v_2])
5 RETURN(%v_3)
], Class:
className: Bar
instrs:
0 PUT_FIELD[self, @a, 2:fixnum]
1 DEF_CLASS_METH(Bar, bar)
2 %v_0 = CALL(bar, [self])
methods:
[Method:
name: bar
instrs:
0 self = RECV_ARG(0)
1 %v_0 = CALL(super, null)
2 RETURN(%v_0)
]]
methods:
[Method:
name: __file__]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment