moving string to parfait

using parfait::word
also rename builtins string to word
This commit is contained in:
Torsten Ruger 2015-05-13 16:17:10 +03:00
parent baca6eb4c6
commit 9d711e7766
16 changed files with 50 additions and 60 deletions

View File

@ -36,7 +36,7 @@ module Elf
assembler.objects.values.each do |slot|
label = "#{slot.class.name}::#{slot.position.to_s(16)}"
label += "=#{slot}" if slot.is_a?(Symbol) or slot.is_a?(String)
label += "=#{slot.string}" if slot.is_a?(Virtual::StringConstant)
label += "=#{slot.string}" if slot.is_a?(Parfait::Word)
add_symbol label , slot.position
end
end

View File

@ -8,5 +8,28 @@ module Parfait
# Words are constant, maybe like js strings, ruby symbols
# Words are short, but may have spaces
class Word < Object
def initialize str
@string = str
end
attr_reader :string
def result= value
raise "called"
class_for(MoveInstruction).new(value , self , :opcode => :mov)
end
def clazz
Space.space.get_or_create_class(:Word)
end
def layout
Virtual::Object.layout
end
def mem_length
padded(1 + string.length)
end
def position
return @position if @position
return @string.position if @string.position
super
end
end
end

View File

@ -144,7 +144,7 @@ module Register
end
def assemble_String( str )
str = str.string if str.is_a? Virtual::StringConstant
str = str.string if str.is_a? Parfait::Word
str = str.to_s if str.is_a? Symbol
word = (str.length + 7) / 32 # all object are multiple of 8 words (7 for header)
raise "String too long (implement split string!) #{word}" if word > 15

View File

@ -28,7 +28,7 @@ module Builtin
def putint context
putint_function = Virtual::CompiledMethod.new(:putint , [] , Virtual::Integer ,Virtual::Integer )
return putint_function
buffer = Virtual::StringConstant.new(" ") # create a buffer
buffer = Parfait::Word.new(" ") # create a buffer
context.object_space.add_object buffer # and save it (function local variable: a no no)
int = putint_function.receiver
moved_int = putint_function.new_local

View File

@ -76,6 +76,6 @@ module Builtin
end
end
require_relative "integer"
require_relative "string"
require_relative "word"
require_relative "array"
require_relative "kernel"

View File

@ -1,5 +1,5 @@
module Builtin
class String
class Word
module ClassMethods
def get context , index = Virtual::Integer
get_function = Virtual::CompiledMethod.new(:get , [ Virtual::Integer] , Virtual::Integer , Virtual::Integer )
@ -9,11 +9,11 @@ module Builtin
set_function = Virtual::CompiledMethod.new(:set , [Virtual::Integer, Virtual::Integer] , Virtual::Integer ,Virtual::Integer )
return set_function
end
def puts context
def puts context
puts_function = Virtual::CompiledMethod.new(:puts , [] )
return puts_function
end
end
extend ClassMethods
extend ClassMethods
end
end

View File

@ -71,7 +71,7 @@ module Virtual
# attr_reader :string
def self.compile_string expression , method
value = StringConstant.new(expression.string)
value = Parfait::Word.new(expression.string)
to = Return.new(Reference , value)
Machine.instance.space.add_object value
method.add_code Set.new( to , value )

View File

@ -8,7 +8,7 @@ module Virtual
me = Compiler.compile( expession.receiver , method )
method.add_code NewMessage.new
method.add_code Set.new(NewSelf.new(me.type), me)
method.add_code Set.new(NewName.new(), StringConstant.new(expession.name))
method.add_code Set.new(NewName.new(), Parfait::Word.new(expession.name))
compiled_args = []
expession.args.each_with_index do |arg , i|
#compile in the running method, ie before passing control

View File

@ -1,5 +1,5 @@
module Virtual
class Constant < ::Virtual::Object
end
class TrueConstant < Constant
@ -10,7 +10,7 @@ module Virtual
end
# another abstract "marker" class (so we can check for it)
# derived classes are Boot/Meta Class and StringConstant
# derived classes are Boot/Meta Class and StringConstant
class ObjectConstant < Constant
def type
Virtual::Reference
@ -32,36 +32,5 @@ module Virtual
integer >= 0 and integer <= 255
end
end
# The name really says it all.
# The only interesting thing is storage.
# Currently string are stored "inline" , ie in the code segment.
# Mainly because that works an i aint no elf expert.
class StringConstant < ObjectConstant
def initialize str
@string = str
end
attr_reader :string
def result= value
raise "called"
class_for(MoveInstruction).new(value , self , :opcode => :mov)
end
def clazz
Space.space.get_or_create_class(:String)
end
def layout
Virtual::Object.layout
end
def mem_length
padded(1 + string.length)
end
def position
return @position if @position
return @string.position if @string.position
super
end
end
end
end

View File

@ -113,9 +113,9 @@ module Virtual
[:putint,:fibo].each do |f|
obj.add_instance_method Builtin::Integer.send(f , nil)
end
obj = @space.get_or_create_class :String
obj = @space.get_or_create_class :Word
[:get , :set , :puts].each do |f|
obj.add_instance_method Builtin::String.send(f , nil)
obj.add_instance_method Builtin::Word.send(f , nil)
end
obj = space.get_or_create_class :Array
[:get , :set , :push].each do |f|

View File

@ -63,7 +63,7 @@ module Virtual
def layout_for(object)
case object
when Array , Symbol , String , Virtual::CompiledMethod , Virtual::Block , Virtual::StringConstant
when Array , Symbol , String , Virtual::CompiledMethod , Virtual::Block , Parfait::Word
@@ARRAY
when Hash
@@HASH.merge :keys => object.keys , :values => object.values

View File

@ -6,7 +6,7 @@ class TestList < MiniTest::Test
def test_list_clas
@string_input = <<HERE
class Object
end
end
class List
def Node.new()
return 4
@ -56,9 +56,8 @@ HERE
@should = [0x0,0xb0,0xa0,0xe3,0x2a,0x10,0xa0,0xe3,0x13,0x0,0x0,0xeb,0x1,0x70,0xa0,0xe3,0x0,0x0,0x0,0xef,0x0,0x70,0xa0,0xe1,0x0,0x40,0x2d,0xe9,0xa,0x30,0x42,0xe2,0x22,0x21,0x42,0xe0,0x22,0x22,0x82,0xe0,0x22,0x24,0x82,0xe0,0x22,0x28,0x82,0xe0,0xa2,0x21,0xa0,0xe1,0x2,0x41,0x82,0xe0,0x84,0x30,0x53,0xe0,0x1,0x20,0x82,0x52,0xa,0x30,0x83,0x42,0x30,0x30,0x83,0xe2,0x0,0x30,0xc1,0xe5,0x1,0x10,0x41,0xe2,0x0,0x0,0x52,0xe3,0xef,0xff,0xff,0x1b,0x0,0x80,0xbd,0xe8,0x0,0x40,0x2d,0xe9,0x1,0x20,0xa0,0xe1,0x20,0x10,0x8f,0xe2,0x9,0x10,0x81,0xe2,0xe9,0xff,0xff,0xeb,0x14,0x10,0x8f,0xe2,0xc,0x20,0xa0,0xe3,0x1,0x0,0xa0,0xe3,0x4,0x70,0xa0,0xe3,0x0,0x0,0x0,0xef,0x0,0x70,0xa0,0xe1,0x0,0x80,0xbd,0xe8,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20]
@output = " 42 "
parse
@target = [:String , :plus]
@target = [:Word , :plus]
write "class"
end
end

View File

@ -29,7 +29,7 @@ class Object
end
def index_of( name )
l = @layout
return l.index_of(name)
return l.index_of(name)
end
def layout()
return @layout
@ -48,7 +48,7 @@ class String
return @length
end
def plus(str)
my_length = @length
my_length = @length
str_len = str.length()
new_string = String.new_string(my_length + str_len)
i = 0
@ -70,11 +70,11 @@ HERE
@should = [0x0,0xb0,0xa0,0xe3,0x2a,0x10,0xa0,0xe3,0x13,0x0,0x0,0xeb,0x1,0x70,0xa0,0xe3,0x0,0x0,0x0,0xef,0x0,0x70,0xa0,0xe1,0x0,0x40,0x2d,0xe9,0xa,0x30,0x42,0xe2,0x22,0x21,0x42,0xe0,0x22,0x22,0x82,0xe0,0x22,0x24,0x82,0xe0,0x22,0x28,0x82,0xe0,0xa2,0x21,0xa0,0xe1,0x2,0x41,0x82,0xe0,0x84,0x30,0x53,0xe0,0x1,0x20,0x82,0x52,0xa,0x30,0x83,0x42,0x30,0x30,0x83,0xe2,0x0,0x30,0xc1,0xe5,0x1,0x10,0x41,0xe2,0x0,0x0,0x52,0xe3,0xef,0xff,0xff,0x1b,0x0,0x80,0xbd,0xe8,0x0,0x40,0x2d,0xe9,0x1,0x20,0xa0,0xe1,0x20,0x10,0x8f,0xe2,0x9,0x10,0x81,0xe2,0xe9,0xff,0xff,0xeb,0x14,0x10,0x8f,0xe2,0xc,0x20,0xa0,0xe3,0x1,0x0,0xa0,0xe3,0x4,0x70,0xa0,0xe3,0x0,0x0,0x0,0xef,0x0,0x70,0xa0,0xe1,0x0,0x80,0xbd,0xe8,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20]
@output = " 42 "
parse
@target = [:String , :plus]
@target = [:Word , :plus]
write "class"
end
def parse
def parse
parser = Parser::Salama.new
syntax = parser.parse_with_debug(@string_input)
parts = Parser::Transform.new.apply(syntax)
@ -91,4 +91,3 @@ HERE
end
end

View File

@ -51,7 +51,7 @@ class TestBasic < MiniTest::Test
def test_string
@string_input = "\"hello\""
@output = "-Virtual::Return(:index => 5, :type => Virtual::Reference)*^* :value Virtual::StringConstant(:string => 'hello')"
@output = "-Virtual::Return(:index => 5, :type => Virtual::Reference)*^* :value Parfait::Word(:string => 'hello')"
check
end

View File

@ -11,7 +11,7 @@ class Object
end
end
HERE
@output = "-&5 Virtual::BootClass(:length => -1, :name => :Object, :super_class_name => :Object)*^* :instance_methods -Virtual::CompiledMethod(:name => :index_of, :class_name => :Object, :arg_names => &1 Virtual::Reference, :return_type => Virtual::Integer)*^* :locals []*^* :tmps []*^* :receiver [*1]*^* :blocks -Virtual::Block(:length => -1, :name => :enter)*^* :codes -Virtual::MethodEnter(:length => -1)*^* -Virtual::Block(:length => -1, :name => :return)*^* :codes -Virtual::MethodReturn(:length => -1)*^* -Virtual::CompiledMethod(:name => :_get_instance_variable, :class_name => :Object, :receiver => &1 Virtual::Reference, :return_type => &2 Virtual::Mystery)*^* :arg_names [*1]*^* :locals []*^* :tmps []*^* :blocks -Virtual::Block(:length => -1, :name => :enter)*^* :codes -Virtual::MethodEnter(:length => -1)*^* -Virtual::Block(:length => -1, :name => :return)*^* :codes -Virtual::MethodReturn(:length => -1)*^* -Virtual::CompiledMethod(:name => :_set_instance_variable, :class_name => :Object, :receiver => &1 Virtual::Reference, :return_type => &2 Virtual::Mystery)*^* :arg_names [*1, *1]*^* :locals []*^* :tmps []*^* :blocks -Virtual::Block(:length => -1, :name => :enter)*^* :codes -Virtual::MethodEnter(:length => -1)*^* -Virtual::Block(:length => -1, :name => :return)*^* :codes -Virtual::MethodReturn(:length => -1)*^* -&4 Virtual::CompiledMethod(:name => :get_class, :class_name => :Object)*^* :arg_names []*^* :locals []*^* :tmps []*^* :receiver Virtual::Self(:index => 3, :type => *2)*^* :return_type Virtual::Return(:index => 5, :type => *2)*^* :blocks -Virtual::Block(:length => -1, :name => :enter)*^* :codes -Virtual::MethodEnter(:length => -1)*^* -Virtual::InstanceGet(:name => :layout)*^* -Virtual::NewMessage(:length => -1)*^* -Virtual::Set()*^* :to Virtual::NewSelf(:index => 3, :type => *2)*^* :from &3 Virtual::Return(:index => 5, :type => *2)*^* -Virtual::Set()*^* :to Virtual::NewName(:index => 4, :type => *2)*^* :from Virtual::StringConstant(:string => :get_class)*^* -Virtual::MessageSend(:name => :get_class)*^* :me &3 Virtual::Return(:index => 5, :type => *2)*^* :args []*^* -Virtual::Block(:length => -1, :name => :return)*^* :codes -Virtual::MethodReturn(:length => -1)*^* -&4 Virtual::CompiledMethod(:name => :get_class, :class_name => :Object)*^* :arg_names []*^* :locals []*^* :tmps []*^* :receiver Virtual::Self(:index => 3, :type => *2)*^* :return_type Virtual::Return(:index => 5, :type => *2)*^* :blocks -Virtual::Block(:length => -1, :name => :enter)*^* :codes -Virtual::MethodEnter(:length => -1)*^* -Virtual::InstanceGet(:name => :layout)*^* -Virtual::NewMessage(:length => -1)*^* -Virtual::Set()*^* :to Virtual::NewSelf(:index => 3, :type => *2)*^* :from &3 Virtual::Return(:index => 5, :type => *2)*^* -Virtual::Set()*^* :to Virtual::NewName(:index => 4, :type => *2)*^* :from Virtual::StringConstant(:string => :get_class)*^* -Virtual::MessageSend(:name => :get_class)*^* :me &3 Virtual::Return(:index => 5, :type => *2)*^* :args []*^* -Virtual::Block(:length => -1, :name => :return)*^* :codes -Virtual::MethodReturn(:length => -1)*^* :meta_class Virtual::MetaClass(:length => -1, :me_self => *5)*^* :functions []"
@output = "-&5 Virtual::BootClass(:length => -1, :name => :Object, :super_class_name => :Object)*^* :instance_methods -Virtual::CompiledMethod(:name => :index_of, :class_name => :Object, :arg_names => &1 Virtual::Reference, :return_type => Virtual::Integer)*^* :locals []*^* :tmps []*^* :receiver [*1]*^* :blocks -Virtual::Block(:length => -1, :name => :enter)*^* :codes -Virtual::MethodEnter(:length => -1)*^* -Virtual::Block(:length => -1, :name => :return)*^* :codes -Virtual::MethodReturn(:length => -1)*^* -Virtual::CompiledMethod(:name => :_get_instance_variable, :class_name => :Object, :receiver => &1 Virtual::Reference, :return_type => &2 Virtual::Mystery)*^* :arg_names [*1]*^* :locals []*^* :tmps []*^* :blocks -Virtual::Block(:length => -1, :name => :enter)*^* :codes -Virtual::MethodEnter(:length => -1)*^* -Virtual::Block(:length => -1, :name => :return)*^* :codes -Virtual::MethodReturn(:length => -1)*^* -Virtual::CompiledMethod(:name => :_set_instance_variable, :class_name => :Object, :receiver => &1 Virtual::Reference, :return_type => &2 Virtual::Mystery)*^* :arg_names [*1, *1]*^* :locals []*^* :tmps []*^* :blocks -Virtual::Block(:length => -1, :name => :enter)*^* :codes -Virtual::MethodEnter(:length => -1)*^* -Virtual::Block(:length => -1, :name => :return)*^* :codes -Virtual::MethodReturn(:length => -1)*^* -&4 Virtual::CompiledMethod(:name => :get_class, :class_name => :Object)*^* :arg_names []*^* :locals []*^* :tmps []*^* :receiver Virtual::Self(:index => 3, :type => *2)*^* :return_type Virtual::Return(:index => 5, :type => *2)*^* :blocks -Virtual::Block(:length => -1, :name => :enter)*^* :codes -Virtual::MethodEnter(:length => -1)*^* -Virtual::InstanceGet(:name => :layout)*^* -Virtual::NewMessage(:length => -1)*^* -Virtual::Set()*^* :to Virtual::NewSelf(:index => 3, :type => *2)*^* :from &3 Virtual::Return(:index => 5, :type => *2)*^* -Virtual::Set()*^* :to Virtual::NewName(:index => 4, :type => *2)*^* :from Parfait::Word(:string => :get_class)*^* -Virtual::MessageSend(:name => :get_class)*^* :me &3 Virtual::Return(:index => 5, :type => *2)*^* :args []*^* -Virtual::Block(:length => -1, :name => :return)*^* :codes -Virtual::MethodReturn(:length => -1)*^* -&4 Virtual::CompiledMethod(:name => :get_class, :class_name => :Object)*^* :arg_names []*^* :locals []*^* :tmps []*^* :receiver Virtual::Self(:index => 3, :type => *2)*^* :return_type Virtual::Return(:index => 5, :type => *2)*^* :blocks -Virtual::Block(:length => -1, :name => :enter)*^* :codes -Virtual::MethodEnter(:length => -1)*^* -Virtual::InstanceGet(:name => :layout)*^* -Virtual::NewMessage(:length => -1)*^* -Virtual::Set()*^* :to Virtual::NewSelf(:index => 3, :type => *2)*^* :from &3 Virtual::Return(:index => 5, :type => *2)*^* -Virtual::Set()*^* :to Virtual::NewName(:index => 4, :type => *2)*^* :from Parfait::Word(:string => :get_class)*^* -Virtual::MessageSend(:name => :get_class)*^* :me &3 Virtual::Return(:index => 5, :type => *2)*^* :args []*^* -Virtual::Block(:length => -1, :name => :return)*^* :codes -Virtual::MethodReturn(:length => -1)*^* :meta_class Virtual::MetaClass(:length => -1, :me_self => *5)*^* :functions []"
check
end

View File

@ -20,7 +20,7 @@ def foo()
end
foo()
HERE
@output = "-Virtual::CompiledMethod(:name => :foo, :class_name => :Object)*^* :arg_names []*^* :locals []*^* :tmps []*^* :receiver Virtual::Self(:index => 3, :type => *1)*^* :return_type Virtual::Return(:index => 5, :type => *1)*^* :blocks -Virtual::Block(:length => -1, :name => :enter)*^* :codes -Virtual::MethodEnter(:length => -1)*^* -Virtual::NewMessage(:length => -1)*^* -Virtual::Set()*^* :to Virtual::NewSelf(:index => 3, :type => *1)*^* :from &5 Virtual::Self(:index => 3, :type => *1)*^* -Virtual::Set()*^* :to Virtual::NewName(:index => 4, :type => *1)*^* :from Virtual::StringConstant(:string => :puts)*^* -Virtual::Set()*^* :to &4 Virtual::Return(:index => 5, :type => &3 Virtual::Reference, :value => *2)*^* :from &2 Virtual::StringConstant(:string => 'Hello')*^* -Virtual::Set()*^* :to &6 Virtual::NewMessageSlot(:index => 0, :type => &3 Virtual::Reference, :value => *4)*^* :from &4 Virtual::Return(:index => 5, :type => &3 Virtual::Reference, :value => *2)*^* -Virtual::MessageSend(:name => :puts)*^* :me &5 Virtual::Self(:index => 3, :type => *1)*^* :args [*6]*^* -Virtual::Block(:length => -1, :name => :return)*^* :codes -Virtual::MethodReturn(:length => -1)*^*-Virtual::Return(:index => 5, :type => &1 Virtual::Mystery)"
@output = "-Virtual::CompiledMethod(:name => :foo, :class_name => :Object)*^* :arg_names []*^* :locals []*^* :tmps []*^* :receiver Virtual::Self(:index => 3, :type => *1)*^* :return_type Virtual::Return(:index => 5, :type => *1)*^* :blocks -Virtual::Block(:length => -1, :name => :enter)*^* :codes -Virtual::MethodEnter(:length => -1)*^* -Virtual::NewMessage(:length => -1)*^* -Virtual::Set()*^* :to Virtual::NewSelf(:index => 3, :type => *1)*^* :from &5 Virtual::Self(:index => 3, :type => *1)*^* -Virtual::Set()*^* :to Virtual::NewName(:index => 4, :type => *1)*^* :from Parfait::Word(:string => :puts)*^* -Virtual::Set()*^* :to &4 Virtual::Return(:index => 5, :type => &3 Virtual::Reference, :value => *2)*^* :from &2 Parfait::Word(:string => 'Hello')*^* -Virtual::Set()*^* :to &6 Virtual::NewMessageSlot(:index => 0, :type => &3 Virtual::Reference, :value => *4)*^* :from &4 Virtual::Return(:index => 5, :type => &3 Virtual::Reference, :value => *2)*^* -Virtual::MessageSend(:name => :puts)*^* :me &5 Virtual::Self(:index => 3, :type => *1)*^* :args [*6]*^* -Virtual::Block(:length => -1, :name => :return)*^* :codes -Virtual::MethodReturn(:length => -1)*^*-Virtual::Return(:index => 5, :type => &1 Virtual::Mystery)"
check
end
@ -30,7 +30,7 @@ def String.length(x)
@length
end
HERE
@output = "---RETURN_MARKER- &7 !ruby/object:Virtual::CompiledMethodRETURN_MARKER name: :lengthRETURN_MARKER args:RETURN_MARKER - :xRETURN_MARKER locals: []RETURN_MARKER tmps: []RETURN_MARKER receiver: &6 !ruby/object:Boot::BootClassRETURN_MARKER instance_methods:RETURN_MARKER - &2 !ruby/object:Virtual::CompiledMethodRETURN_MARKER name: :getRETURN_MARKER args:RETURN_MARKER - &1 !ruby/class 'Virtual::Integer'RETURN_MARKER locals: []RETURN_MARKER tmps: []RETURN_MARKER receiver: *1RETURN_MARKER return_type: *1RETURN_MARKER blocks:RETURN_MARKER - &3 !ruby/object:Virtual::BlockRETURN_MARKER method: *2RETURN_MARKER name: :getRETURN_MARKER branch: RETURN_MARKER codes:RETURN_MARKER - !ruby/object:Virtual::MethodEnter {}RETURN_MARKER - !ruby/object:Virtual::BlockRETURN_MARKER method: *2RETURN_MARKER name: :get_returnRETURN_MARKER branch: RETURN_MARKER codes:RETURN_MARKER - !ruby/object:Virtual::MethodReturn {}RETURN_MARKER current: *3RETURN_MARKER - &4 !ruby/object:Virtual::CompiledMethodRETURN_MARKER name: :setRETURN_MARKER args:RETURN_MARKER - *1RETURN_MARKER - *1RETURN_MARKER locals: []RETURN_MARKER tmps: []RETURN_MARKER receiver: *1RETURN_MARKER return_type: *1RETURN_MARKER blocks:RETURN_MARKER - &5 !ruby/object:Virtual::BlockRETURN_MARKER method: *4RETURN_MARKER name: :setRETURN_MARKER branch: RETURN_MARKER codes:RETURN_MARKER - !ruby/object:Virtual::MethodEnter {}RETURN_MARKER - !ruby/object:Virtual::BlockRETURN_MARKER method: *4RETURN_MARKER name: :set_returnRETURN_MARKER branch: RETURN_MARKER codes:RETURN_MARKER - !ruby/object:Virtual::MethodReturn {}RETURN_MARKER current: *5RETURN_MARKER name: :StringRETURN_MARKER super_class_name: :ObjectRETURN_MARKER meta_class: !ruby/object:Boot::MetaClassRETURN_MARKER functions: []RETURN_MARKER me_self: *6RETURN_MARKER return_type: !ruby/object:Virtual::ReturnRETURN_MARKER index: 0RETURN_MARKER type: !ruby/class 'Virtual::Mystery'RETURN_MARKER blocks:RETURN_MARKER - &8 !ruby/object:Virtual::BlockRETURN_MARKER method: *7RETURN_MARKER name: :lengthRETURN_MARKER branch: RETURN_MARKER codes:RETURN_MARKER - !ruby/object:Virtual::MethodEnter {}RETURN_MARKER - !ruby/object:Virtual::InstanceGetRETURN_MARKER name: :lengthRETURN_MARKER - !ruby/object:Virtual::BlockRETURN_MARKER method: *7RETURN_MARKER name: :length_returnRETURN_MARKER branch: RETURN_MARKER codes:RETURN_MARKER - !ruby/object:Virtual::MethodReturn {}RETURN_MARKER current: *8RETURN_MARKER"
@output = "---RETURN_MARKER- &7 !ruby/object:Virtual::CompiledMethodRETURN_MARKER name: :lengthRETURN_MARKER args:RETURN_MARKER - :xRETURN_MARKER locals: []RETURN_MARKER tmps: []RETURN_MARKER receiver: &6 !ruby/object:Boot::BootClassRETURN_MARKER instance_methods:RETURN_MARKER - &2 !ruby/object:Virtual::CompiledMethodRETURN_MARKER name: :getRETURN_MARKER args:RETURN_MARKER - &1 !ruby/class 'Virtual::Integer'RETURN_MARKER locals: []RETURN_MARKER tmps: []RETURN_MARKER receiver: *1RETURN_MARKER return_type: *1RETURN_MARKER blocks:RETURN_MARKER - &3 !ruby/object:Virtual::BlockRETURN_MARKER method: *2RETURN_MARKER name: :getRETURN_MARKER branch: RETURN_MARKER codes:RETURN_MARKER - !ruby/object:Virtual::MethodEnter {}RETURN_MARKER - !ruby/object:Virtual::BlockRETURN_MARKER method: *2RETURN_MARKER name: :get_returnRETURN_MARKER branch: RETURN_MARKER codes:RETURN_MARKER - !ruby/object:Virtual::MethodReturn {}RETURN_MARKER current: *3RETURN_MARKER - &4 !ruby/object:Virtual::CompiledMethodRETURN_MARKER name: :setRETURN_MARKER args:RETURN_MARKER - *1RETURN_MARKER - *1RETURN_MARKER locals: []RETURN_MARKER tmps: []RETURN_MARKER receiver: *1RETURN_MARKER return_type: *1RETURN_MARKER blocks:RETURN_MARKER - &5 !ruby/object:Virtual::BlockRETURN_MARKER method: *4RETURN_MARKER name: :setRETURN_MARKER branch: RETURN_MARKER codes:RETURN_MARKER - !ruby/object:Virtual::MethodEnter {}RETURN_MARKER - !ruby/object:Virtual::BlockRETURN_MARKER method: *4RETURN_MARKER name: :set_returnRETURN_MARKER branch: RETURN_MARKER codes:RETURN_MARKER - !ruby/object:Virtual::MethodReturn {}RETURN_MARKER current: *5RETURN_MARKER name: :WordRETURN_MARKER super_class_name: :ObjectRETURN_MARKER meta_class: !ruby/object:Boot::MetaClassRETURN_MARKER functions: []RETURN_MARKER me_self: *6RETURN_MARKER return_type: !ruby/object:Virtual::ReturnRETURN_MARKER index: 0RETURN_MARKER type: !ruby/class 'Virtual::Mystery'RETURN_MARKER blocks:RETURN_MARKER - &8 !ruby/object:Virtual::BlockRETURN_MARKER method: *7RETURN_MARKER name: :lengthRETURN_MARKER branch: RETURN_MARKER codes:RETURN_MARKER - !ruby/object:Virtual::MethodEnter {}RETURN_MARKER - !ruby/object:Virtual::InstanceGetRETURN_MARKER name: :lengthRETURN_MARKER - !ruby/object:Virtual::BlockRETURN_MARKER method: *7RETURN_MARKER name: :length_returnRETURN_MARKER branch: RETURN_MARKER codes:RETURN_MARKER - !ruby/object:Virtual::MethodReturn {}RETURN_MARKER current: *8RETURN_MARKER"
check
end
@ -41,7 +41,7 @@ def foo(x)
2 + 5
end
HERE
@output = "-Virtual::CompiledMethod(:name => :foo, :class_name => :Object)*^* :arg_names [:x]*^* :locals [:abba]*^* :tmps []*^* :receiver Virtual::Self(:index => 3, :type => &1 Virtual::Mystery)*^* :return_type Virtual::Return(:index => 5, :type => &1 Virtual::Mystery)*^* :blocks -Virtual::Block(:length => -1, :name => :enter)*^* :codes -Virtual::MethodEnter(:length => -1)*^* -Virtual::Set()*^* :to &4 Virtual::Return(:index => 5, :type => &3 Virtual::Integer, :value => *2)*^* :from &2 Virtual::IntegerConstant(:integer => 5)*^* -Virtual::Set()*^* :to Virtual::Return(:index => 5, :type => *1)*^* :from Virtual::FrameSlot(:index => 1, :type => &3 Virtual::Integer, :value => *4)*^* -Virtual::Set()*^* :to &6 Virtual::Return(:index => 5, :type => &3 Virtual::Integer, :value => *5)*^* :from &5 Virtual::IntegerConstant(:integer => 2)*^* -Virtual::NewMessage(:length => -1)*^* -Virtual::Set()*^* :to Virtual::NewSelf(:index => 3, :type => &3 Virtual::Integer)*^* :from &6 Virtual::Return(:index => 5, :type => &3 Virtual::Integer, :value => *5)*^* -Virtual::Set()*^* :to Virtual::NewName(:index => 4, :type => *1)*^* :from Virtual::StringConstant(:string => :+)*^* -Virtual::Set()*^* :to &8 Virtual::Return(:index => 5, :type => &3 Virtual::Integer, :value => *7)*^* :from &7 Virtual::IntegerConstant(:integer => 5)*^* -Virtual::Set()*^* :to &9 Virtual::NewMessageSlot(:index => 0, :type => &3 Virtual::Integer, :value => *8)*^* :from &8 Virtual::Return(:index => 5, :type => &3 Virtual::Integer, :value => *7)*^* -Virtual::MessageSend(:name => :+)*^* :me &6 Virtual::Return(:index => 5, :type => &3 Virtual::Integer, :value => *5)*^* :args [*9]*^* -Virtual::Block(:length => -1, :name => :return)*^* :codes -Virtual::MethodReturn(:length => -1)"
@output = "-Virtual::CompiledMethod(:name => :foo, :class_name => :Object)*^* :arg_names [:x]*^* :locals [:abba]*^* :tmps []*^* :receiver Virtual::Self(:index => 3, :type => &1 Virtual::Mystery)*^* :return_type Virtual::Return(:index => 5, :type => &1 Virtual::Mystery)*^* :blocks -Virtual::Block(:length => -1, :name => :enter)*^* :codes -Virtual::MethodEnter(:length => -1)*^* -Virtual::Set()*^* :to &4 Virtual::Return(:index => 5, :type => &3 Virtual::Integer, :value => *2)*^* :from &2 Virtual::IntegerConstant(:integer => 5)*^* -Virtual::Set()*^* :to Virtual::Return(:index => 5, :type => *1)*^* :from Virtual::FrameSlot(:index => 1, :type => &3 Virtual::Integer, :value => *4)*^* -Virtual::Set()*^* :to &6 Virtual::Return(:index => 5, :type => &3 Virtual::Integer, :value => *5)*^* :from &5 Virtual::IntegerConstant(:integer => 2)*^* -Virtual::NewMessage(:length => -1)*^* -Virtual::Set()*^* :to Virtual::NewSelf(:index => 3, :type => &3 Virtual::Integer)*^* :from &6 Virtual::Return(:index => 5, :type => &3 Virtual::Integer, :value => *5)*^* -Virtual::Set(:from => Parfait::Word(:string => :+))*^* :to Virtual::NewName(:index => 4, :type => *1)*^* -Virtual::Set()*^* :to &8 Virtual::Return(:index => 5, :type => &3 Virtual::Integer, :value => *7)*^* :from &7 Virtual::IntegerConstant(:integer => 5)*^* -Virtual::Set()*^* :to &9 Virtual::NewMessageSlot(:index => 0, :type => &3 Virtual::Integer, :value => *8)*^* :from &8 Virtual::Return(:index => 5, :type => &3 Virtual::Integer, :value => *7)*^* -Virtual::MessageSend(:name => :+)*^* :me &6 Virtual::Return(:index => 5, :type => &3 Virtual::Integer, :value => *5)*^* :args [*9]*^* -Virtual::Block(:length => -1, :name => :return)*^* :codes -Virtual::MethodReturn(:length => -1)"
check
end
@ -51,7 +51,7 @@ def foo()
2 + 5
end
HERE
@output = "-Virtual::CompiledMethod(:name => :foo, :class_name => :Object)*^* :arg_names []*^* :locals []*^* :tmps []*^* :receiver Virtual::Self(:index => 3, :type => &1 Virtual::Mystery)*^* :return_type Virtual::Return(:index => 5, :type => &1 Virtual::Mystery)*^* :blocks -Virtual::Block(:length => -1, :name => :enter)*^* :codes -Virtual::MethodEnter(:length => -1)*^* -Virtual::Set()*^* :to &4 Virtual::Return(:index => 5, :type => &3 Virtual::Integer, :value => *2)*^* :from &2 Virtual::IntegerConstant(:integer => 2)*^* -Virtual::NewMessage(:length => -1)*^* -Virtual::Set()*^* :to Virtual::NewSelf(:index => 3, :type => &3 Virtual::Integer)*^* :from &4 Virtual::Return(:index => 5, :type => &3 Virtual::Integer, :value => *2)*^* -Virtual::Set()*^* :to Virtual::NewName(:index => 4, :type => *1)*^* :from Virtual::StringConstant(:string => :+)*^* -Virtual::Set()*^* :to &6 Virtual::Return(:index => 5, :type => &3 Virtual::Integer, :value => *5)*^* :from &5 Virtual::IntegerConstant(:integer => 5)*^* -Virtual::Set()*^* :to &7 Virtual::NewMessageSlot(:index => 0, :type => &3 Virtual::Integer, :value => *6)*^* :from &6 Virtual::Return(:index => 5, :type => &3 Virtual::Integer, :value => *5)*^* -Virtual::MessageSend(:name => :+)*^* :me &4 Virtual::Return(:index => 5, :type => &3 Virtual::Integer, :value => *2)*^* :args [*7]*^* -Virtual::Block(:length => -1, :name => :return)*^* :codes -Virtual::MethodReturn(:length => -1)"
@output = "-Virtual::CompiledMethod(:name => :foo, :class_name => :Object)*^* :arg_names []*^* :locals []*^* :tmps []*^* :receiver Virtual::Self(:index => 3, :type => &1 Virtual::Mystery)*^* :return_type Virtual::Return(:index => 5, :type => &1 Virtual::Mystery)*^* :blocks -Virtual::Block(:length => -1, :name => :enter)*^* :codes -Virtual::MethodEnter(:length => -1)*^* -Virtual::Set()*^* :to &4 Virtual::Return(:index => 5, :type => &3 Virtual::Integer, :value => *2)*^* :from &2 Virtual::IntegerConstant(:integer => 2)*^* -Virtual::NewMessage(:length => -1)*^* -Virtual::Set()*^* :to Virtual::NewSelf(:index => 3, :type => &3 Virtual::Integer)*^* :from &4 Virtual::Return(:index => 5, :type => &3 Virtual::Integer, :value => *2)*^* -Virtual::Set(:from => Parfait::Word(:string => :+))*^* :to Virtual::NewName(:index => 4, :type => *1)*^* -Virtual::Set()*^* :to &6 Virtual::Return(:index => 5, :type => &3 Virtual::Integer, :value => *5)*^* :from &5 Virtual::IntegerConstant(:integer => 5)*^* -Virtual::Set()*^* :to &7 Virtual::NewMessageSlot(:index => 0, :type => &3 Virtual::Integer, :value => *6)*^* :from &6 Virtual::Return(:index => 5, :type => &3 Virtual::Integer, :value => *5)*^* -Virtual::MessageSend(:name => :+)*^* :me &4 Virtual::Return(:index => 5, :type => &3 Virtual::Integer, :value => *2)*^* :args [*7]*^* -Virtual::Block(:length => -1, :name => :return)*^* :codes -Virtual::MethodReturn(:length => -1)"
check
end