Starting to rework slot instructions that create risc

have to go through all and all macros and all thems tests. What did the wise man say: one step at a time
This commit is contained in:
2020-03-01 16:41:58 +02:00
parent 4643be0ae6
commit 4888b3b6db
14 changed files with 73 additions and 44 deletions

View File

@ -38,9 +38,9 @@ module SlotMachine
end
require_relative "basic_values"
require_relative "instruction/label"
require_relative "instruction/check"
require_relative "instruction/basic_values"
require_relative "instruction/simple_call"
require_relative "instruction/dynamic_call"
require_relative "instruction/block_yield"

View File

@ -40,11 +40,9 @@ module SlotMachine
#TODO transfer the Number of arguments to :arguments_given (to be checked on entry)
arg_target = [:message , :next_message ]
@arguments.each_with_index do |arg , index| # +1 because of type
compiler.reset_regs
load = SlotMachine::SlotLoad.new(self.source, arg_target + ["arg#{index+1}".to_sym] , arg)
load.to_risc(compiler)
end
compiler.reset_regs
transfer
end
end

View File

@ -48,7 +48,6 @@ module SlotMachine
def to_risc(compiler)
const_reg = @right.to_register(compiler , original_source)
@left.reduce_and_load(const_reg , compiler , original_source )
compiler.reset_regs
end
end

View File

@ -42,8 +42,9 @@ module SlotMachine
# most likely be united
def reduce_and_load(const_reg , compiler , original_source )
raise "only cache" unless known_object.is_a?( Parfait::CacheEntry)
left = compiler.use_reg( :CacheEntry )
compiler.add_code Risc.load_constant(original_source, known_object , left)
load = Risc.load_constant(original_source, known_object )
left = load.register
compiler.add_code load
compiler.add_code Risc.reg_to_slot(original_source, const_reg , left, slots.name)
end
end