using label int in interpreter
This commit is contained in:
parent
0dc89c772a
commit
01a2911483
@ -141,7 +141,7 @@ module Risc
|
|||||||
def execute_LoadConstant
|
def execute_LoadConstant
|
||||||
to = @instruction.register
|
to = @instruction.register
|
||||||
value = @instruction.constant
|
value = @instruction.constant
|
||||||
value = value.value if value.is_a?(Mom::Constant)
|
value = value.integer if value.is_a?(Label)
|
||||||
set_register( to , value )
|
set_register( to , value )
|
||||||
true
|
true
|
||||||
end
|
end
|
||||||
@ -226,7 +226,7 @@ module Risc
|
|||||||
def execute_FunctionReturn
|
def execute_FunctionReturn
|
||||||
link = get_register( @instruction.register )
|
link = get_register( @instruction.register )
|
||||||
log.debug "Return to #{link}"
|
log.debug "Return to #{link}"
|
||||||
set_pc Position.get(link).at
|
set_pc link.value
|
||||||
false
|
false
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -32,7 +32,7 @@ module Risc
|
|||||||
ret = main_ticks(12)
|
ret = main_ticks(12)
|
||||||
assert_equal FunctionReturn , ret.class
|
assert_equal FunctionReturn , ret.class
|
||||||
link = @interpreter.get_register( ret.register )
|
link = @interpreter.get_register( ret.register )
|
||||||
assert_equal Label , link.class
|
assert_equal Parfait::Integer , link.class
|
||||||
end
|
end
|
||||||
def test_transfer
|
def test_transfer
|
||||||
transfer = main_ticks(13)
|
transfer = main_ticks(13)
|
||||||
|
@ -42,7 +42,7 @@ module Risc
|
|||||||
ret = main_ticks(74)
|
ret = main_ticks(74)
|
||||||
assert_equal FunctionReturn , ret.class
|
assert_equal FunctionReturn , ret.class
|
||||||
link = @interpreter.get_register( ret.register )
|
link = @interpreter.get_register( ret.register )
|
||||||
assert_equal Label , link.class
|
assert_equal Parfait::Integer , link.class
|
||||||
end
|
end
|
||||||
def test_sys
|
def test_sys
|
||||||
sys = main_ticks(89)
|
sys = main_ticks(89)
|
||||||
|
@ -62,7 +62,7 @@ module Risc
|
|||||||
ret = main_ticks(137)
|
ret = main_ticks(137)
|
||||||
assert_equal FunctionReturn , ret.class
|
assert_equal FunctionReturn , ret.class
|
||||||
link = @interpreter.get_register( ret.register )
|
link = @interpreter.get_register( ret.register )
|
||||||
assert_equal Label , link.class
|
assert_equal Parfait::Integer , link.class
|
||||||
end
|
end
|
||||||
def test_sys
|
def test_sys
|
||||||
sys = main_ticks(139)
|
sys = main_ticks(139)
|
||||||
|
@ -31,7 +31,7 @@ module Risc
|
|||||||
ret = main_ticks(8)
|
ret = main_ticks(8)
|
||||||
assert_equal FunctionReturn , ret.class
|
assert_equal FunctionReturn , ret.class
|
||||||
link = @interpreter.get_register( ret.register )
|
link = @interpreter.get_register( ret.register )
|
||||||
assert_equal Label , link.class
|
assert_equal Parfait::Integer , link.class
|
||||||
end
|
end
|
||||||
def test_transfer
|
def test_transfer
|
||||||
transfer = main_ticks(9)
|
transfer = main_ticks(9)
|
||||||
|
Loading…
Reference in New Issue
Block a user