new register allocation generates good looking push/pop

This commit is contained in:
Torsten Ruger
2014-06-09 19:24:09 +03:00
parent b66c4157d5
commit d7a60f2803
7 changed files with 85 additions and 41 deletions

View File

@ -22,12 +22,12 @@ module Ast
raise "No receiver error #{inspect}:#{value_receiver}:#{name}" if (value_receiver.nil?)
call = Vm::CallSite.new( name , value_receiver , params , function)
current_function = context.function
current_function.save_locals(context , into) if current_function
into.push([]) unless current_function.nil?
call.load_args into
call.do_call into
after = into.new_block("#{into.name}_call#{@@counter+=1}")
into.insert_at after
current_function.restore_locals(context , after) if current_function
after.pop([]) unless current_function.nil?
puts "compile call #{function.return_type}"
function.return_type
end