add fixnum as constant (was buggy)
This commit is contained in:
parent
2f39f707f0
commit
75c43d1b03
@ -1,7 +1,6 @@
|
|||||||
|
|
||||||
module Register
|
module Register
|
||||||
# This implements setting of the various slot variables the vm defines.
|
# This implements setting of the various slot variables the vm defines.
|
||||||
# Basic mem moves, but have to shuffle the type nibbles (TODO!)
|
|
||||||
|
|
||||||
class SetImplementation
|
class SetImplementation
|
||||||
def run block
|
def run block
|
||||||
@ -10,11 +9,13 @@ module Register
|
|||||||
# need a temporay place because of indexed load/store
|
# need a temporay place because of indexed load/store
|
||||||
tmp = Register.tmp_reg
|
tmp = Register.tmp_reg
|
||||||
# for constants we have to "move" the constants value
|
# for constants we have to "move" the constants value
|
||||||
if( code.from.is_a?(Parfait::Value) or code.from.is_a?(Symbol))
|
if( code.from.is_a?(Parfait::Value) or code.from.is_a?(Symbol) or code.from.is_a?(Fixnum) )
|
||||||
move1 = LoadConstant.new(code, code.from , tmp )
|
move1 = LoadConstant.new(code, code.from , tmp )
|
||||||
else # while otherwise we "load"
|
else # while otherwise we "load"
|
||||||
|
#puts "from #{code.from}"
|
||||||
move1 = Register.get_slot(code, code.from.object_name , get_index(code.from) , tmp )
|
move1 = Register.get_slot(code, code.from.object_name , get_index(code.from) , tmp )
|
||||||
end
|
end
|
||||||
|
#puts "to #{code.to}"
|
||||||
move2 = Register.set_slot( code , tmp , code.to.object_name , get_index(code.to) )
|
move2 = Register.set_slot( code , tmp , code.to.object_name , get_index(code.to) )
|
||||||
block.replace(code , [move1,move2] )
|
block.replace(code , [move1,move2] )
|
||||||
end
|
end
|
||||||
@ -29,7 +30,7 @@ module Register
|
|||||||
when Virtual::Return
|
when Virtual::Return
|
||||||
return Register.resolve_index( :message , :return_value)
|
return Register.resolve_index( :message , :return_value)
|
||||||
when Virtual::NewArgSlot
|
when Virtual::NewArgSlot
|
||||||
puts "from: #{from.index}"
|
#puts "from: #{from.index}"
|
||||||
return Register.resolve_index( :message , :name) + from.index
|
return Register.resolve_index( :message , :name) + from.index
|
||||||
else
|
else
|
||||||
raise "not implemented for #{from.class}"
|
raise "not implemented for #{from.class}"
|
||||||
|
Loading…
x
Reference in New Issue
Block a user