diff --git a/lib/register/builtin/kernel.rb b/lib/register/builtin/kernel.rb index 7648ba0c..cda39cdf 100644 --- a/lib/register/builtin/kernel.rb +++ b/lib/register/builtin/kernel.rb @@ -10,7 +10,7 @@ module Builtin function.info.return_type = Virtual::Integer main = Virtual.machine.space.get_main me = Virtual::Self.new(Virtual::Reference) - code = Virtual::Set.new(Virtual::Self.new(me.type), me) + code = Virtual::Set.new(me , Virtual::Self.new(me.type)) function.info.add_code(code) function.info.add_code Virtual::MethodCall.new(main) return function diff --git a/lib/virtual/compiler/basic_expressions.rb b/lib/virtual/compiler/basic_expressions.rb index 220be0ba..add6d6a9 100644 --- a/lib/virtual/compiler/basic_expressions.rb +++ b/lib/virtual/compiler/basic_expressions.rb @@ -15,25 +15,25 @@ module Virtual def self.compile_integer expression , method int = expression.value to = Return.new(Integer , int) - method.info.add_code Set.new( to , int) + method.info.add_code Set.new( int , to ) to end def self.compile_true expression , method to = Return.new(Reference , true ) - method.info.add_code Set.new( to , true ) + method.info.add_code Set.new( true , to ) to end def self.compile_false expression , method to = Return.new(Reference , false) - method.info.add_code Set.new( to , false ) + method.info.add_code Set.new( false , to ) to end def self.compile_nil expression , method to = Return.new(Reference , nil) - method.info.add_code Set.new( to , nil ) + method.info.add_code Set.new( nil , to ) to end @@ -62,7 +62,7 @@ module Virtual clazz = Space.space.get_class_by_name name raise "uups #{clazz}.#{name}" unless clazz to = Return.new(Reference , clazz ) - method.info.add_code Set.new( to , clazz ) + method.info.add_code Set.new( clazz , to ) to end @@ -72,7 +72,7 @@ module Virtual value = expression.string.to_sym to = Return.new(Reference , value) method.info.constants << value - method.info.add_code Set.new( to , value ) + method.info.add_code Set.new( value , to ) to end @@ -85,10 +85,10 @@ module Virtual raise "oh noo, nil from where #{expression.right.inspect}" unless r index = method.has_arg(expression.left.name.to_sym) if index - method.info.add_code Set.new(Return.new , MessageSlot.new(index , r,type , r )) + method.info.add_code Set.new(MessageSlot.new(index , r,type , r ) , Return.new) else index = method.ensure_local(expression.left.name.to_sym) - method.info.add_code Set.new(Return.new , FrameSlot.new(index , r.type , r )) + method.info.add_code Set.new(FrameSlot.new(index , r.type , r ) , Return.new) end r end diff --git a/lib/virtual/compiler/callsite_expression.rb b/lib/virtual/compiler/callsite_expression.rb index c8720f5d..09b8d3d2 100644 --- a/lib/virtual/compiler/callsite_expression.rb +++ b/lib/virtual/compiler/callsite_expression.rb @@ -7,8 +7,8 @@ module Virtual def self.compile_callsite expession , method me = Compiler.compile( expession.receiver , method ) method.info.add_code NewMessage.new - method.info.add_code Set.new(NextSelf.new(me.type), me) - method.info.add_code Set.new(NextMessageName.new(), expession.name.to_sym) + method.info.add_code Set.new( me , NextSelf.new(me.type)) + method.info.add_code Set.new( expession.name.to_sym , NextMessageName.new()) compiled_args = [] expession.args.each_with_index do |arg , i| #compile in the running method, ie before passing control @@ -16,7 +16,7 @@ module Virtual # move the compiled value to it's slot in the new message to = NextMessageSlot.new(i ,val.type , val) # (doing this immediately, not after the loop, so if it's a return it won't get overwritten) - method.info.add_code Set.new(to , val ) + method.info.add_code Set.new( val , to ) compiled_args << to end method.info.add_code MessageSend.new(expession.name , me , compiled_args) #and pass control diff --git a/lib/virtual/instructions/set.rb b/lib/virtual/instructions/set.rb index 955610ce..b43e5230 100644 --- a/lib/virtual/instructions/set.rb +++ b/lib/virtual/instructions/set.rb @@ -5,9 +5,9 @@ module Virtual # these are represented as slots (see there) # from may be a Constant (Object,Integer,String,Class) class Set < Instruction - def initialize to , from - @to = to + def initialize from , to @from = from + @to = to end attr_reader :from , :to end diff --git a/lib/virtual/slots/slot.rb b/lib/virtual/slots/slot.rb index 3f20514c..28599da0 100644 --- a/lib/virtual/slots/slot.rb +++ b/lib/virtual/slots/slot.rb @@ -37,4 +37,4 @@ end require_relative "message_slot" require_relative "self_slot" require_relative "frame_slot" -require_relative "new_message_slot" +require_relative "next_message_slot"