remove the last use of an add_xx function, closing #9

This commit is contained in:
Torsten Ruger 2018-08-15 19:37:03 +03:00
parent 43fa7ccbcc
commit 01752aab05
2 changed files with 5 additions and 18 deletions

View File

@ -137,20 +137,6 @@ module Risc
to[Parfait::Integer.integer_index] << from
end
end
# for computationally building code (ie writing assembler) these short cuts
# help to instantiate risc instructions and add them immediately
[ :slot_to_reg , :load_constant, :load_data,
:transfer ].each do |method|
define_method("add_#{method}".to_sym) do |*args|
if not @source_used
args[0] = @source
@source_used = true
end
add_code Risc.send( method , *args )
end
end
end

View File

@ -87,10 +87,11 @@ module Risc
# Assumes int return value and extracts the fixnum for process exit code
def exit_sequence(builder)
save_message( builder )
message = Risc.message_reg
builder.add_slot_to_reg "get return" , message , :return_value , message
builder.add_slot_to_reg( "reduce return" , message , Parfait::Integer.integer_index , message)
builder.add_code Syscall.new("emit_syscall(exit)", :exit )
builder.build do
message << message[:return_value]
message.reduce_int
add_code Syscall.new("emit_syscall(exit)", :exit )
end
end
# the exit function