register assignment fix (was not taking subsequent calls into account)
This commit is contained in:
parent
200da192b4
commit
6d6c7ddb68
@ -87,7 +87,8 @@ module Vm
|
||||
# a call_site uses pushes and pops these to make them available for code after a call
|
||||
def locals_at l_block
|
||||
used =[]
|
||||
assigned = []
|
||||
# call assigns the return register, but as it is in l_block, it is not asked.
|
||||
assigned = [ RegisterUse.new(Vm::RegisterMachine.instance.return_register) ]
|
||||
l_block.reachable.each do |b|
|
||||
b.uses.each {|u|
|
||||
(used << u) unless assigned.include?(u)
|
||||
|
@ -183,10 +183,18 @@ module Vm
|
||||
end
|
||||
end
|
||||
def uses
|
||||
if opcode == :call
|
||||
@first.args.collect {|arg| arg.used_register }
|
||||
else
|
||||
[]
|
||||
end
|
||||
end
|
||||
def assigns
|
||||
if opcode == :call
|
||||
[RegisterUse.new(RegisterMachine.instance.return_register)]
|
||||
else
|
||||
[]
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
Loading…
Reference in New Issue
Block a user