save and restore the right registers
This commit is contained in:
@ -67,6 +67,16 @@ module Vm
|
||||
l
|
||||
end
|
||||
|
||||
def save_locals context , into
|
||||
save = args.collect{|a| a.register } + @locals.collect{|l| l.register}
|
||||
into.push save
|
||||
end
|
||||
|
||||
def restore_locals context , into
|
||||
restore = args.collect{|a| a.register } + @locals.collect{|l| l.register}
|
||||
into.pop restore
|
||||
end
|
||||
|
||||
def new_block name
|
||||
block = Block.new(name , self)
|
||||
@blocks << block
|
||||
|
@ -59,6 +59,7 @@ module Vm
|
||||
end
|
||||
def initialize reg
|
||||
@register = reg
|
||||
raise inspect if reg == nil
|
||||
end
|
||||
def length
|
||||
4
|
||||
|
Reference in New Issue
Block a user