rename Mystery

just unknown, mystery should be more difficult to find out.
After all we keep run time info, so just need unknown at compile time
This commit is contained in:
Torsten Ruger 2015-06-11 07:04:14 +02:00
parent d8fa266b5d
commit ee6f9d733b
9 changed files with 24 additions and 23 deletions

View File

@ -43,7 +43,7 @@ module Virtual
method.info = CompiledMethodInfo.new method.info = CompiledMethodInfo.new
method method
end end
def initialize return_type = Virtual::Mystery def initialize return_type = Virtual::Unknown
# first block we have to create with .new , as new_block assumes a current # first block we have to create with .new , as new_block assumes a current
enter = Block.new( "enter" , self ).add_code(MethodEnter.new()) enter = Block.new( "enter" , self ).add_code(MethodEnter.new())
@return_type = return_type @return_type = return_type

View File

@ -11,7 +11,7 @@ module Virtual
# Everything in ruby is an expression, ie returns a value. So the effect of every compile # Everything in ruby is an expression, ie returns a value. So the effect of every compile
# is that a value is put into the ReturnSlot of the current Message. # is that a value is put into the ReturnSlot of the current Message.
# The compile method (so every compile method) returns the value that it deposits which # The compile method (so every compile method) returns the value that it deposits which
# may be unknown Mystery value. # may be unknown Unknown value.
# #
# The Compiler.compile uses a visitor patter to dispatch according to the class name of # The Compiler.compile uses a visitor patter to dispatch according to the class name of
# the expression. So a NameExpression is delegated to compile_name etc. # the expression. So a NameExpression is delegated to compile_name etc.

View File

@ -68,6 +68,7 @@ module Virtual
# attr_reader :string # attr_reader :string
def self.compile_string expression , method def self.compile_string expression , method
# Clearly a TODO here to implement strings rather than reusing symbols
value = expression.string.to_sym value = expression.string.to_sym
to = Return.new(Reference , value) to = Return.new(Reference , value)
method.info.constants << value method.info.constants << value
@ -94,7 +95,7 @@ module Virtual
def self.compile_variable expression, method def self.compile_variable expression, method
method.info.add_code InstanceGet.new(expression.name) method.info.add_code InstanceGet.new(expression.name)
Return.new( Mystery ) Return.new( Unknown )
end end
end end
end end

View File

@ -1,26 +1,26 @@
module Virtual module Virtual
# The message that is being processed has a layout as per the constant above # The message that is being processed has a layout as per the constant above
class MessageSlot < Slot class MessageSlot < Slot
def initialize index , type = Mystery , value = nil def initialize index , type = Unknown , value = nil
super(index ,type , value ) super(index ,type , value )
end end
end end
class Return < MessageSlot class Return < MessageSlot
def initialize type = Mystery, value = nil def initialize type = Unknown, value = nil
super( MESSAGE_RETURN_VALUE , type , value ) super( MESSAGE_RETURN_VALUE , type , value )
end end
end end
class Self < MessageSlot class Self < MessageSlot
def initialize type = Mystery, value = nil def initialize type = Unknown, value = nil
super( MESSAGE_SELF , type , value ) super( MESSAGE_SELF , type , value )
end end
end end
# Name of the current message # Name of the current message
class Name < MessageSlot class Name < MessageSlot
def initialize type = Mystery, value = nil def initialize type = Unknown, value = nil
super( MESSAGE_NAME , type , value ) super( MESSAGE_NAME , type , value )
end end
end end

View File

@ -1,24 +1,24 @@
module Virtual module Virtual
class NewMessageSlot < Slot class NewMessageSlot < Slot
def initialize index , type = Mystery, value = nil def initialize index , type = Unknown, value = nil
super(index , type , value ) super(index , type , value )
end end
end end
class NewReturn < NewMessageSlot class NewReturn < NewMessageSlot
def initialize type = Mystery, value = nil def initialize type = Unknown, value = nil
super( MESSAGE_RETURN_VALUE, type , value ) super( MESSAGE_RETURN_VALUE, type , value )
end end
end end
class NewSelf < NewMessageSlot class NewSelf < NewMessageSlot
def initialize type = Mystery, value = nil def initialize type = Unknown, value = nil
super( MESSAGE_SELF , type , value ) super( MESSAGE_SELF , type , value )
end end
end end
class NewName < NewMessageSlot class NewName < NewMessageSlot
def initialize type = Mystery, value = nil def initialize type = Unknown, value = nil
super( MESSAGE_NAME, type , value ) super( MESSAGE_NAME, type , value )
end end
end end

View File

@ -42,13 +42,13 @@ module Virtual
end end
class FrameSlot < Slot class FrameSlot < Slot
def initialize index , type = Mystery, value = nil def initialize index , type = Unknown, value = nil
super super
end end
end end
class SelfSlot < Slot class SelfSlot < Slot
def initialize index , type = Mystery, value = nil def initialize index , type = Unknown, value = nil
super super
end end
end end

View File

@ -1,7 +1,7 @@
module Virtual module Virtual
# Integer and (Object) References are the main derived classes, but float will come and ... # Integer and (Object) References are the main derived classes, but float will come and ...
# The Mystery Type has unknown type and has only casting methods. So it must be cast to be useful. # The Unknown Type has unknown type and has only casting methods. So it must be cast to be useful.
class Type class Type
def == other def == other
return false unless other.class == self.class return false unless other.class == self.class
@ -20,7 +20,7 @@ module Virtual
attr_reader :of_class attr_reader :of_class
end end
class Mystery < Type class Unknown < Type
end end
end end

View File

@ -27,7 +27,7 @@ class TestBasic < MiniTest::Test
def test_name def test_name
@string_input = 'foo ' @string_input = 'foo '
@output = "-Virtual::Return(:index => 5, :type => Virtual::Mystery)" @output = "-Virtual::Return(:index => 5, :type => Virtual::Unknown)"
check check
end end
@ -39,7 +39,7 @@ class TestBasic < MiniTest::Test
def test_instance_variable def test_instance_variable
@string_input = '@foo_bar ' @string_input = '@foo_bar '
@output = "-Virtual::Return(:index => 5, :type => Virtual::Mystery)" @output = "-Virtual::Return(:index => 5, :type => Virtual::Unknown)"
check check
end end

View File

@ -9,7 +9,7 @@ def foo(x)
5 5
end end
HERE HERE
@output = "-&7 Parfait::Method(:name => 'foo', :code => '')*^* :memory -0*^* -&1 ['name', 'code', 'arg_names', 'locals', 'tmps']*^* :arg_names [:x]*^* :locals []*^* :tmps []*^* :info Virtual::CompiledMethodInfo()*^* :return_type &15 Virtual::Return(:index => 5, :type => &9 Virtual::Integer)*^* :value &16 Virtual::IntegerConstant(:integer => 5)*^* :blocks -Virtual::Block(:length => -1, :name => :enter)*^* :codes -Virtual::MethodEnter()*^* -Virtual::Set(:to => *15, :from => *16)*^* -Virtual::Block(:length => -1, :name => :return)*^* :codes [Virtual::MethodReturn()]*^* :receiver Virtual::Self(:index => 3, :type => &6 Virtual::Mystery)" @output = "-&7 Parfait::Method(:name => 'foo', :code => '')*^* :memory -0*^* -&1 ['name', 'code', 'arg_names', 'locals', 'tmps']*^* :arg_names [:x]*^* :locals []*^* :tmps []*^* :info Virtual::CompiledMethodInfo()*^* :return_type &15 Virtual::Return(:index => 5, :type => &9 Virtual::Integer)*^* :value &16 Virtual::IntegerConstant(:integer => 5)*^* :blocks -Virtual::Block(:length => -1, :name => :enter)*^* :codes -Virtual::MethodEnter()*^* -Virtual::Set(:to => *15, :from => *16)*^* -Virtual::Block(:length => -1, :name => :return)*^* :codes [Virtual::MethodReturn()]*^* :receiver Virtual::Self(:index => 3, :type => &6 Virtual::Unknown)"
check check
end end
@ -20,7 +20,7 @@ def foo()
end end
foo() foo()
HERE HERE
@output = "-&7 Parfait::Method(:name => 'foo', :code => '')*^* :memory -0*^* -&1 ['name', 'code', 'arg_names', 'locals', 'tmps']*^* :arg_names []*^* :locals []*^* :tmps []*^* :info Virtual::CompiledMethodInfo()*^* :return_type Virtual::Return(:index => 5, :type => *6)*^* :blocks -Virtual::Block(:length => -1, :name => :enter)*^* :codes -Virtual::MethodEnter()*^* -Virtual::NewMessage()*^* -Virtual::Set()*^* :to Virtual::NewSelf(:index => 3)*^* :type &15 Virtual::Reference(:of_class => *2)*^* :from &17 Virtual::Self(:index => 3)*^* :type &15 Virtual::Reference(:of_class => *2)*^* -Virtual::Set(:from => 'puts')*^* :to Virtual::NewName(:index => 4, :type => *6)*^* -Virtual::Set(:from => 'Hello')*^* :to &16 Virtual::Return(:index => 5, :type => &5 Virtual::Reference, :value => 'Hello')*^* -Virtual::Set()*^* :to &18 Virtual::NewMessageSlot(:index => 0, :type => &5 Virtual::Reference, :value => *16)*^* :from &16 Virtual::Return(:index => 5, :type => &5 Virtual::Reference, :value => 'Hello')*^* -Virtual::MessageSend(:name => :puts)*^* :me &17 Virtual::Self(:index => 3)*^* :type &15 Virtual::Reference(:of_class => *2)*^* :args [*18]*^* -Virtual::Block(:length => -1, :name => :return)*^* :codes [Virtual::MethodReturn()]*^* :receiver Virtual::Self(:index => 3, :type => *6)*^*-Virtual::Return(:index => 5, :type => &6 Virtual::Mystery)" @output = "-&7 Parfait::Method(:name => 'foo', :code => '')*^* :memory -0*^* -&1 ['name', 'code', 'arg_names', 'locals', 'tmps']*^* :arg_names []*^* :locals []*^* :tmps []*^* :info Virtual::CompiledMethodInfo()*^* :return_type Virtual::Return(:index => 5, :type => *6)*^* :blocks -Virtual::Block(:length => -1, :name => :enter)*^* :codes -Virtual::MethodEnter()*^* -Virtual::NewMessage()*^* -Virtual::Set()*^* :to Virtual::NewSelf(:index => 3)*^* :type &15 Virtual::Reference(:of_class => *2)*^* :from &17 Virtual::Self(:index => 3)*^* :type &15 Virtual::Reference(:of_class => *2)*^* -Virtual::Set(:from => 'puts')*^* :to Virtual::NewName(:index => 4, :type => *6)*^* -Virtual::Set(:from => 'Hello')*^* :to &16 Virtual::Return(:index => 5, :type => &5 Virtual::Reference, :value => 'Hello')*^* -Virtual::Set()*^* :to &18 Virtual::NewMessageSlot(:index => 0, :type => &5 Virtual::Reference, :value => *16)*^* :from &16 Virtual::Return(:index => 5, :type => &5 Virtual::Reference, :value => 'Hello')*^* -Virtual::MessageSend(:name => :puts)*^* :me &17 Virtual::Self(:index => 3)*^* :type &15 Virtual::Reference(:of_class => *2)*^* :args [*18]*^* -Virtual::Block(:length => -1, :name => :return)*^* :codes [Virtual::MethodReturn()]*^* :receiver Virtual::Self(:index => 3, :type => *6)*^*-Virtual::Return(:index => 5, :type => &6 Virtual::Unknown)"
check check
end end
@ -41,7 +41,7 @@ def foo(x)
2 + 5 2 + 5
end end
HERE HERE
@output = "-&7 Parfait::Method(:name => 'foo', :code => '')*^* :memory -0*^* -&1 ['name', 'code', 'arg_names', 'locals', 'tmps']*^* :arg_names [:x]*^* :locals ['abba']*^* :tmps []*^* :info Virtual::CompiledMethodInfo()*^* :return_type Virtual::Return(:index => 5, :type => &6 Virtual::Mystery)*^* :blocks -Virtual::Block(:length => -1, :name => :enter)*^* :codes -Virtual::MethodEnter()*^* -Virtual::Set()*^* :to &16 Virtual::Return(:index => 5, :type => &9 Virtual::Integer, :value => *15)*^* :from &15 Virtual::IntegerConstant(:integer => 5)*^* -Virtual::Set()*^* :to Virtual::Return(:index => 5, :type => *6)*^* :from Virtual::FrameSlot(:index => 1, :type => &9 Virtual::Integer, :value => *16)*^* -Virtual::Set()*^* :to &18 Virtual::Return(:index => 5, :type => &9 Virtual::Integer, :value => *17)*^* :from &17 Virtual::IntegerConstant(:integer => 2)*^* -Virtual::NewMessage()*^* -Virtual::Set()*^* :to Virtual::NewSelf(:index => 3, :type => &9 Virtual::Integer)*^* :from &18 Virtual::Return(:index => 5, :type => &9 Virtual::Integer, :value => *17)*^* -Virtual::Set(:from => '+')*^* :to Virtual::NewName(:index => 4, :type => *6)*^* -Virtual::Set()*^* :to &20 Virtual::Return(:index => 5, :type => &9 Virtual::Integer, :value => *19)*^* :from &19 Virtual::IntegerConstant(:integer => 5)*^* -Virtual::Set()*^* :to &21 Virtual::NewMessageSlot(:index => 0, :type => &9 Virtual::Integer, :value => *20)*^* :from &20 Virtual::Return(:index => 5, :type => &9 Virtual::Integer, :value => *19)*^* -Virtual::MessageSend(:name => :+)*^* :me &18 Virtual::Return(:index => 5, :type => &9 Virtual::Integer, :value => *17)*^* :args [*21]*^* -Virtual::Block(:length => -1, :name => :return)*^* :codes [Virtual::MethodReturn()]*^* :receiver Virtual::Self(:index => 3, :type => &6 Virtual::Mystery)" @output = "-&7 Parfait::Method(:name => 'foo', :code => '')*^* :memory -0*^* -&1 ['name', 'code', 'arg_names', 'locals', 'tmps']*^* :arg_names [:x]*^* :locals ['abba']*^* :tmps []*^* :info Virtual::CompiledMethodInfo()*^* :return_type Virtual::Return(:index => 5, :type => &6 Virtual::Unknown)*^* :blocks -Virtual::Block(:length => -1, :name => :enter)*^* :codes -Virtual::MethodEnter()*^* -Virtual::Set()*^* :to &16 Virtual::Return(:index => 5, :type => &9 Virtual::Integer, :value => *15)*^* :from &15 Virtual::IntegerConstant(:integer => 5)*^* -Virtual::Set()*^* :to Virtual::Return(:index => 5, :type => *6)*^* :from Virtual::FrameSlot(:index => 1, :type => &9 Virtual::Integer, :value => *16)*^* -Virtual::Set()*^* :to &18 Virtual::Return(:index => 5, :type => &9 Virtual::Integer, :value => *17)*^* :from &17 Virtual::IntegerConstant(:integer => 2)*^* -Virtual::NewMessage()*^* -Virtual::Set()*^* :to Virtual::NewSelf(:index => 3, :type => &9 Virtual::Integer)*^* :from &18 Virtual::Return(:index => 5, :type => &9 Virtual::Integer, :value => *17)*^* -Virtual::Set(:from => '+')*^* :to Virtual::NewName(:index => 4, :type => *6)*^* -Virtual::Set()*^* :to &20 Virtual::Return(:index => 5, :type => &9 Virtual::Integer, :value => *19)*^* :from &19 Virtual::IntegerConstant(:integer => 5)*^* -Virtual::Set()*^* :to &21 Virtual::NewMessageSlot(:index => 0, :type => &9 Virtual::Integer, :value => *20)*^* :from &20 Virtual::Return(:index => 5, :type => &9 Virtual::Integer, :value => *19)*^* -Virtual::MessageSend(:name => :+)*^* :me &18 Virtual::Return(:index => 5, :type => &9 Virtual::Integer, :value => *17)*^* :args [*21]*^* -Virtual::Block(:length => -1, :name => :return)*^* :codes [Virtual::MethodReturn()]*^* :receiver Virtual::Self(:index => 3, :type => &6 Virtual::Unknown)"
check check
end end
@ -51,7 +51,7 @@ def foo()
2 + 5 2 + 5
end end
HERE HERE
@output = "-&7 Parfait::Method(:name => 'foo', :code => '')*^* :memory -0*^* -&1 ['name', 'code', 'arg_names', 'locals', 'tmps']*^* :arg_names []*^* :locals []*^* :tmps []*^* :info Virtual::CompiledMethodInfo()*^* :return_type Virtual::Return(:index => 5, :type => &6 Virtual::Mystery)*^* :blocks -Virtual::Block(:length => -1, :name => :enter)*^* :codes -Virtual::MethodEnter()*^* -Virtual::Set()*^* :to &16 Virtual::Return(:index => 5, :type => &9 Virtual::Integer, :value => *15)*^* :from &15 Virtual::IntegerConstant(:integer => 2)*^* -Virtual::NewMessage()*^* -Virtual::Set()*^* :to Virtual::NewSelf(:index => 3, :type => &9 Virtual::Integer)*^* :from &16 Virtual::Return(:index => 5, :type => &9 Virtual::Integer, :value => *15)*^* -Virtual::Set(:from => '+')*^* :to Virtual::NewName(:index => 4, :type => *6)*^* -Virtual::Set()*^* :to &18 Virtual::Return(:index => 5, :type => &9 Virtual::Integer, :value => *17)*^* :from &17 Virtual::IntegerConstant(:integer => 5)*^* -Virtual::Set()*^* :to &19 Virtual::NewMessageSlot(:index => 0, :type => &9 Virtual::Integer, :value => *18)*^* :from &18 Virtual::Return(:index => 5, :type => &9 Virtual::Integer, :value => *17)*^* -Virtual::MessageSend(:name => :+)*^* :me &16 Virtual::Return(:index => 5, :type => &9 Virtual::Integer, :value => *15)*^* :args [*19]*^* -Virtual::Block(:length => -1, :name => :return)*^* :codes [Virtual::MethodReturn()]*^* :receiver Virtual::Self(:index => 3, :type => &6 Virtual::Mystery)" @output = "-&7 Parfait::Method(:name => 'foo', :code => '')*^* :memory -0*^* -&1 ['name', 'code', 'arg_names', 'locals', 'tmps']*^* :arg_names []*^* :locals []*^* :tmps []*^* :info Virtual::CompiledMethodInfo()*^* :return_type Virtual::Return(:index => 5, :type => &6 Virtual::Unknown)*^* :blocks -Virtual::Block(:length => -1, :name => :enter)*^* :codes -Virtual::MethodEnter()*^* -Virtual::Set()*^* :to &16 Virtual::Return(:index => 5, :type => &9 Virtual::Integer, :value => *15)*^* :from &15 Virtual::IntegerConstant(:integer => 2)*^* -Virtual::NewMessage()*^* -Virtual::Set()*^* :to Virtual::NewSelf(:index => 3, :type => &9 Virtual::Integer)*^* :from &16 Virtual::Return(:index => 5, :type => &9 Virtual::Integer, :value => *15)*^* -Virtual::Set(:from => '+')*^* :to Virtual::NewName(:index => 4, :type => *6)*^* -Virtual::Set()*^* :to &18 Virtual::Return(:index => 5, :type => &9 Virtual::Integer, :value => *17)*^* :from &17 Virtual::IntegerConstant(:integer => 5)*^* -Virtual::Set()*^* :to &19 Virtual::NewMessageSlot(:index => 0, :type => &9 Virtual::Integer, :value => *18)*^* :from &18 Virtual::Return(:index => 5, :type => &9 Virtual::Integer, :value => *17)*^* -Virtual::MessageSend(:name => :+)*^* :me &16 Virtual::Return(:index => 5, :type => &9 Virtual::Integer, :value => *15)*^* :args [*19]*^* -Virtual::Block(:length => -1, :name => :return)*^* :codes [Virtual::MethodReturn()]*^* :receiver Virtual::Self(:index => 3, :type => &6 Virtual::Unknown)"
check check
end end
@ -65,7 +65,7 @@ def ofthen(n)
end end
end end
HERE HERE
@output = "-&7 Parfait::Method(:name => 'ofthen', :code => '')*^* :memory -0*^* -&1 ['name', 'code', 'arg_names', 'locals', 'tmps']*^* :arg_names [:n]*^* :locals ['isit', 'maybenot']*^* :tmps []*^* :info Virtual::CompiledMethodInfo()*^* :return_type &18 Virtual::Return(:index => 5, :type => &9 Virtual::Integer)*^* :value &19 Virtual::IntegerConstant(:integer => 667)*^* :blocks -Virtual::Block(:length => -1, :name => :enter)*^* :codes -Virtual::MethodEnter()*^* -Virtual::Set()*^* :to Virtual::Return(:index => 5, :type => *9, :value => *15)*^* :from &15 Virtual::IntegerConstant(:integer => 0)*^* -Virtual::IsTrueBranch(:to => *20)*^* -Virtual::Block(:length => -1, :name => :if_false)*^* :codes -Virtual::Set(:to => *18, :from => *19)*^* -Virtual::Set()*^* :to Virtual::Return(:index => 5, :type => *6)*^* :from Virtual::FrameSlot(:index => 2, :type => *9, :value => *18)*^* -Virtual::UnconditionalBranch(:to => *21)*^* -&20 Virtual::Block(:length => -1, :name => :if_true)*^* :codes -Virtual::Set()*^* :to &17 Virtual::Return(:index => 5, :type => *9)*^* :value &16 Virtual::IntegerConstant(:integer => 42)*^* :from &16 Virtual::IntegerConstant(:integer => 42)*^* -Virtual::Set()*^* :to Virtual::Return(:index => 5, :type => *6)*^* :from Virtual::FrameSlot(:index => 1, :type => *9)*^* :value &17 Virtual::Return(:index => 5, :type => *9)*^* :value &16 Virtual::IntegerConstant(:integer => 42)*^* -&21 Virtual::Block(:length => -1, :name => :if_merge)*^* :codes []*^* -Virtual::Block(:length => -1, :name => :return)*^* :codes [Virtual::MethodReturn()]*^* :receiver Virtual::Self(:index => 3, :type => &6 Virtual::Mystery)" @output = "-&7 Parfait::Method(:name => 'ofthen', :code => '')*^* :memory -0*^* -&1 ['name', 'code', 'arg_names', 'locals', 'tmps']*^* :arg_names [:n]*^* :locals ['isit', 'maybenot']*^* :tmps []*^* :info Virtual::CompiledMethodInfo()*^* :return_type &18 Virtual::Return(:index => 5, :type => &9 Virtual::Integer)*^* :value &19 Virtual::IntegerConstant(:integer => 667)*^* :blocks -Virtual::Block(:length => -1, :name => :enter)*^* :codes -Virtual::MethodEnter()*^* -Virtual::Set()*^* :to Virtual::Return(:index => 5, :type => *9, :value => *15)*^* :from &15 Virtual::IntegerConstant(:integer => 0)*^* -Virtual::IsTrueBranch(:to => *20)*^* -Virtual::Block(:length => -1, :name => :if_false)*^* :codes -Virtual::Set(:to => *18, :from => *19)*^* -Virtual::Set()*^* :to Virtual::Return(:index => 5, :type => *6)*^* :from Virtual::FrameSlot(:index => 2, :type => *9, :value => *18)*^* -Virtual::UnconditionalBranch(:to => *21)*^* -&20 Virtual::Block(:length => -1, :name => :if_true)*^* :codes -Virtual::Set()*^* :to &17 Virtual::Return(:index => 5, :type => *9)*^* :value &16 Virtual::IntegerConstant(:integer => 42)*^* :from &16 Virtual::IntegerConstant(:integer => 42)*^* -Virtual::Set()*^* :to Virtual::Return(:index => 5, :type => *6)*^* :from Virtual::FrameSlot(:index => 1, :type => *9)*^* :value &17 Virtual::Return(:index => 5, :type => *9)*^* :value &16 Virtual::IntegerConstant(:integer => 42)*^* -&21 Virtual::Block(:length => -1, :name => :if_merge)*^* :codes []*^* -Virtual::Block(:length => -1, :name => :return)*^* :codes [Virtual::MethodReturn()]*^* :receiver Virtual::Self(:index => 3, :type => &6 Virtual::Unknown)"
check check
end end
@ -79,7 +79,7 @@ def fibonaccit(n)
end end
end end
HERE HERE
@output = "-Virtual::CompiledMethod(:name => :ofthen, :class_name => 'Object')*^* :arg_names [:n]*^* :locals [:isit, :maybenot]*^* :tmps []*^* :receiver Virtual::Self(:index => 3, :type => &4 Virtual::Mystery)*^* :return_type &6 Virtual::Return(:index => 5, :type => &1 Virtual::Integer)*^* :value &7 Virtual::IntegerConstant(:integer => 667)*^* :blocks -Virtual::Block(:length => -1, :name => :enter)*^* :codes -Virtual::MethodEnter(:length => -1)*^* -Virtual::Set()*^* :to Virtual::Return(:index => 5, :type => *1, :value => *2)*^* :from &2 Virtual::IntegerConstant(:integer => 0)*^* -Virtual::IsTrueBranch(:to => *8)*^* -Virtual::Block(:length => -1, :name => :if_false)*^* :codes -Virtual::Set(:to => *6, :from => *7)*^* -Virtual::Set()*^* :to Virtual::Return(:index => 5, :type => *4)*^* :from Virtual::FrameSlot(:index => 2, :type => *1, :value => *6)*^* -Virtual::UnconditionalBranch(:to => *9)*^* -&8 Virtual::Block(:length => -1, :name => :if_true)*^* :codes -Virtual::Set()*^* :to &5 Virtual::Return(:index => 5, :type => *1)*^* :value &3 Virtual::IntegerConstant(:integer => 42)*^* :from &3 Virtual::IntegerConstant(:integer => 42)*^* -Virtual::Set()*^* :to Virtual::Return(:index => 5, :type => *4)*^* :from Virtual::FrameSlot(:index => 1, :type => *1)*^* :value &5 Virtual::Return(:index => 5, :type => *1)*^* :value &3 Virtual::IntegerConstant(:integer => 42)*^* -&9 Virtual::Block(:length => -1, :name => :if_merge)*^* :codes []*^* -Virtual::Block(:length => -1, :name => :return)*^* :codes -Virtual::MethodReturn(:length => -1)" @output = "-Virtual::CompiledMethod(:name => :ofthen, :class_name => 'Object')*^* :arg_names [:n]*^* :locals [:isit, :maybenot]*^* :tmps []*^* :receiver Virtual::Self(:index => 3, :type => &4 Virtual::Unknown)*^* :return_type &6 Virtual::Return(:index => 5, :type => &1 Virtual::Integer)*^* :value &7 Virtual::IntegerConstant(:integer => 667)*^* :blocks -Virtual::Block(:length => -1, :name => :enter)*^* :codes -Virtual::MethodEnter(:length => -1)*^* -Virtual::Set()*^* :to Virtual::Return(:index => 5, :type => *1, :value => *2)*^* :from &2 Virtual::IntegerConstant(:integer => 0)*^* -Virtual::IsTrueBranch(:to => *8)*^* -Virtual::Block(:length => -1, :name => :if_false)*^* :codes -Virtual::Set(:to => *6, :from => *7)*^* -Virtual::Set()*^* :to Virtual::Return(:index => 5, :type => *4)*^* :from Virtual::FrameSlot(:index => 2, :type => *1, :value => *6)*^* -Virtual::UnconditionalBranch(:to => *9)*^* -&8 Virtual::Block(:length => -1, :name => :if_true)*^* :codes -Virtual::Set()*^* :to &5 Virtual::Return(:index => 5, :type => *1)*^* :value &3 Virtual::IntegerConstant(:integer => 42)*^* :from &3 Virtual::IntegerConstant(:integer => 42)*^* -Virtual::Set()*^* :to Virtual::Return(:index => 5, :type => *4)*^* :from Virtual::FrameSlot(:index => 1, :type => *1)*^* :value &5 Virtual::Return(:index => 5, :type => *1)*^* :value &3 Virtual::IntegerConstant(:integer => 42)*^* -&9 Virtual::Block(:length => -1, :name => :if_merge)*^* :codes []*^* -Virtual::Block(:length => -1, :name => :return)*^* :codes -Virtual::MethodReturn(:length => -1)"
check check
end end