More rename cleanp
This commit is contained in:
@ -13,7 +13,7 @@ module Vool
|
||||
end
|
||||
|
||||
# Since the return is normalized to only allow simple values it is simple.
|
||||
# To return form a method in mom instructions we only need to do two things:
|
||||
# To return form a method in slot_machine instructions we only need to do two things:
|
||||
# - store the given return value, this is a SlotMove
|
||||
# - activate return sequence (reinstantiate old message and jump to return address)
|
||||
def to_slot( compiler )
|
||||
|
@ -67,13 +67,13 @@ module Vool
|
||||
|
||||
def message_setup(compiler,called_method)
|
||||
setup = SlotMachine::MessageSetup.new( called_method )
|
||||
mom_receive = @receiver.to_slot_definition(compiler)
|
||||
slot_receive = @receiver.to_slot_definition(compiler)
|
||||
arg_target = [:message , :next_message ]
|
||||
args = []
|
||||
@arguments.each_with_index do |arg , index| # +1 because of type
|
||||
args << SlotMachine::SlotLoad.new(self, arg_target + ["arg#{index+1}".to_sym] , arg.to_slot_definition(compiler))
|
||||
end
|
||||
setup << SlotMachine::ArgumentTransfer.new(self, mom_receive , args )
|
||||
setup << SlotMachine::ArgumentTransfer.new(self, slot_receive , args )
|
||||
end
|
||||
|
||||
def simple_call(compiler, called_method)
|
||||
|
@ -16,7 +16,7 @@
|
||||
# The protocol is thus two stage:
|
||||
# - first to_parfait with implicit side-effects of creating parfait objects that
|
||||
# are added to the Parfait object_space
|
||||
# - second to_slot , which will return a mom version of the statement. This may be code
|
||||
# - second to_slot , which will return a slot version of the statement. This may be code
|
||||
# or a compiler (for methods), or compiler collection (for classes)
|
||||
#
|
||||
module Vool
|
||||
@ -38,8 +38,8 @@ module Vool
|
||||
raise "Called when it shouldn't #{self.class}"
|
||||
end
|
||||
|
||||
# create mom version of the statement, this is often code, that is added to the
|
||||
# compiler, but for methods it is a compiler and for classes a collection of those.
|
||||
# create slot_machine version of the statement, this is often code, that is added
|
||||
# to the compiler, but for methods it is a compiler and for classes a collection of those.
|
||||
#
|
||||
# The argument given most often is a compiler
|
||||
# The default implementation (this) is to raise an error
|
||||
|
@ -71,8 +71,8 @@ module Vool
|
||||
stats = @statements.dup
|
||||
first = stats.shift.to_slot(compiler)
|
||||
while( nekst = stats.shift )
|
||||
next_mom = nekst.to_slot(compiler)
|
||||
first.append next_mom
|
||||
next_slot = nekst.to_slot(compiler)
|
||||
first.append next_slot
|
||||
end
|
||||
first
|
||||
end
|
||||
|
@ -37,7 +37,7 @@ module Vool
|
||||
compile_method = SlotMachine::SlotDefinition.new( compiler.get_method , [])
|
||||
runtime_method = SlotMachine::SlotDefinition.new( :message , [ :method] )
|
||||
check = SlotMachine::NotSameCheck.new(compile_method , runtime_method, ok_label)
|
||||
# TODO? Maybe create mom instructions for this
|
||||
# TODO? Maybe create slot instructions for this
|
||||
#builder = compiler.builder("yield")
|
||||
#Risc::Macro.exit_sequence(builder)
|
||||
#check << builder.built
|
||||
@ -49,13 +49,13 @@ module Vool
|
||||
def yield_arg_block(compiler)
|
||||
arg_index = compiler.get_method.arguments_type.get_length - 1
|
||||
setup = SlotMachine::MessageSetup.new( arg_index )
|
||||
mom_receive = @receiver.to_slot_definition(compiler)
|
||||
slot_receive = @receiver.to_slot_definition(compiler)
|
||||
arg_target = [:message , :next_message ]
|
||||
args = []
|
||||
@arguments.each_with_index do |arg , index| # +1 because of type
|
||||
args << SlotMachine::SlotLoad.new(self, arg_target + ["arg#{index+1}".to_sym] , arg.to_slot_definition(compiler))
|
||||
end
|
||||
setup << SlotMachine::ArgumentTransfer.new( self , mom_receive , args )
|
||||
setup << SlotMachine::ArgumentTransfer.new( self , slot_receive , args )
|
||||
setup << SlotMachine::BlockYield.new( self , arg_index )
|
||||
end
|
||||
|
||||
|
Reference in New Issue
Block a user