This commit is contained in:
Torsten Ruger 2018-07-30 10:26:47 +03:00
parent 2dc03f8d1b
commit 165036ea39
6 changed files with 8 additions and 16 deletions

View File

@ -18,6 +18,5 @@ module Parfait
def inspect def inspect
"#{@self_type.object_class.name}(#{arguments_type.inspect})" "#{@self_type.object_class.name}(#{arguments_type.inspect})"
end end
end end
end end

View File

@ -110,7 +110,10 @@ module Risc
# Instruction interpretation starts here # Instruction interpretation starts here
def execute_DynamicJump def execute_DynamicJump
method = get_register(@instruction.register) method = get_register(@instruction.register)
pos = Position.get(method.binary).at + Parfait::BinaryCode.byte_offset pos = Position.get(method.binary)
log.debug "Jump to binary at: #{pos} #{method.name}:#{method.binary.class}"
raise "Invalid position for #{method.name}" unless pos.valid?
pos = pos + Parfait::BinaryCode.byte_offset
set_pc( pos ) set_pc( pos )
false false
end end

View File

@ -45,7 +45,7 @@ module Risc
ret = main_ticks(60) ret = main_ticks(60)
assert_equal FunctionReturn , ret.class assert_equal FunctionReturn , ret.class
assert_equal :r1 , ret.register.symbol assert_equal :r1 , ret.register.symbol
assert_equal 23392 , @interpreter.get_register(ret.register) assert_equal 24160 , @interpreter.get_register(ret.register)
end end
def test_sys def test_sys
sys = main_ticks(65) sys = main_ticks(65)

View File

@ -54,7 +54,7 @@ module Risc
end end
def test_pc1 def test_pc1
@interpreter.tick @interpreter.tick
assert_equal 22968 , @interpreter.pc assert_equal 23736 , @interpreter.pc
end end
def test_tick2 def test_tick2
@interpreter.tick @interpreter.tick
@ -68,7 +68,7 @@ module Risc
def test_pc2 def test_pc2
@interpreter.tick @interpreter.tick
@interpreter.tick @interpreter.tick
assert_equal 22972 , @interpreter.pc assert_equal 23740 , @interpreter.pc
end end
def test_tick_14_jump def test_tick_14_jump
14.times {@interpreter.tick} 14.times {@interpreter.tick}

View File

@ -25,7 +25,7 @@ module Risc
assert_equal 0 , Position.get(@linker.cpu_init).at assert_equal 0 , Position.get(@linker.cpu_init).at
end end
def test_cpu_at def test_cpu_at
assert_equal "0x686c" , Position.get(@linker.cpu_init.first).to_s assert_equal "0x6b6c" , Position.get(@linker.cpu_init.first).to_s
end end
def test_cpu_label def test_cpu_label
assert_equal Position , Position.get(@linker.cpu_init.first).class assert_equal Position , Position.get(@linker.cpu_init.first).class

View File

@ -49,16 +49,6 @@ module Risc
assert_equal Vool::MethodStatement , clazz.body.first.class assert_equal Vool::MethodStatement , clazz.body.first.class
end end
def test_method_statement_has_class
vool = in_test_vool("def meth; @ivar = 5;end")
assert vool.body.first.clazz
end
def test_parfait_class_creation
vool = in_test_vool("def meth; @ivar = 5;end")
assert_equal Parfait::Class , vool.body.first.clazz.class
end
def test_callable_method_instance_type def test_callable_method_instance_type
in_test_vool("def meth; @ivar = 5; @ibar = 4;end") in_test_vool("def meth; @ivar = 5; @ibar = 4;end")
test = Parfait.object_space.get_class_by_name(:Test) test = Parfait.object_space.get_class_by_name(:Test)