resetting registers to prevent overflow

This commit is contained in:
Torsten Ruger 2015-10-22 14:50:58 +03:00
parent 2842c903e1
commit 83670079c3

View File

@ -12,6 +12,7 @@ module Phisol
true_block = @method.source.new_block "if_true" # second, linked in after current, before merge true_block = @method.source.new_block "if_true" # second, linked in after current, before merge
false_block = @method.source.new_block "if_false" # directly next in order, ie if we don't jump we land here false_block = @method.source.new_block "if_false" # directly next in order, ie if we don't jump we land here
reset_regs
is = process(condition) is = process(condition)
branch_class = Object.const_get "Register::Is#{branch_type.capitalize}" branch_class = Object.const_get "Register::Is#{branch_type.capitalize}"
@method.source.add_code branch_class.new( condition , true_block ) @method.source.add_code branch_class.new( condition , true_block )
@ -19,10 +20,12 @@ module Phisol
# compile the true block (as we think of it first, even it is second in sequential order) # compile the true block (as we think of it first, even it is second in sequential order)
@method.source.current true_block @method.source.current true_block
reset_regs
last = process_all(if_true).last last = process_all(if_true).last
# compile the false block # compile the false block
@method.source.current false_block @method.source.current false_block
reset_regs
last = process_all(if_false).last if if_false last = process_all(if_false).last if if_false
@method.source.add_code Register::Branch.new(statement, merge_block ) @method.source.add_code Register::Branch.new(statement, merge_block )