new register allocation generates good looking push/pop
This commit is contained in:
@@ -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
|
||||
|
@@ -11,7 +11,8 @@ module Ast
|
||||
puts "compiling if condition #{cond}"
|
||||
cond_val = cond.compile(context , into)
|
||||
into.b true_block , condition_code: cond_val.operator
|
||||
|
||||
into.branch = true_block
|
||||
|
||||
if_false.each do |part|
|
||||
puts "compiling in if false #{part}"
|
||||
last = part.compile(context , false_block )
|
||||
|
@@ -7,6 +7,8 @@ module Ast
|
||||
puts "compiling while condition #{condition}"
|
||||
cond_val = condition.compile(context , while_block)
|
||||
while_block.b ret , condition_code: cond_val.not_operator
|
||||
while_block.branch = ret
|
||||
|
||||
last = nil
|
||||
body.each do |part|
|
||||
puts "compiling in while #{part}"
|
||||
|
Reference in New Issue
Block a user