fix dunamic jump in interpreter and misc

This commit is contained in:
Torsten Ruger 2018-07-03 19:15:36 +03:00
parent cab6bc389f
commit e099014d63
6 changed files with 10 additions and 7 deletions

View File

@ -57,7 +57,7 @@ module Arm
end
def to_s
"#{opcode} [#{@first.join(',') }] #{super}"
"#{opcode} [#{@first.join(', ') }] #{super}"
end
end

View File

@ -30,7 +30,7 @@ module Mom
def to_s
names = [known_name] + @slots
"[#{names.join(',')}]"
"[#{names.join(', ')}]"
end
def known_name

View File

@ -16,6 +16,7 @@ module Risc
str = label.name
when Parfait::BinaryCode
str = "Code"
str += ":#{Position.get(label)}" if Position.set?(label)
else
str = "(no label)"
end

View File

@ -32,7 +32,8 @@ module Risc
@linker = linker
end
def start_program
def start_program(linker = nil)
@linker = linker || @linker
initialize(@linker)
init = @linker.cpu_init
set_state(:running)
@ -115,14 +116,15 @@ module Risc
# Instruction interpretation starts here
def execute_DynamicJump
method = get_register(@instruction.register)
set_pc( Position.get(method.cpu_instructions).at )
pos = Position.get(method.binary).at + Parfait::BinaryCode.byte_offset
set_pc( pos )
false
end
def execute_Branch
label = @instruction.label
pos = Position.get(label).at
pos += Parfait::BinaryCode.byte_offset if label.is_a?(Parfait::BinaryCode)
set_pc pos
set_pc( pos )
false
end

View File

@ -52,7 +52,7 @@ module Vool
end
def to_s
"#{receiver}.#{name}(#{arguments.join(',')})"
"#{receiver}.#{name}(#{arguments.join(', ')})"
end
def each(&block)
block.call(self)

View File

@ -33,7 +33,7 @@ module Vool
end
def to_s
"#{receiver}.#{name}(#{arguments.join(',')})"
"#{receiver}.#{name}(#{arguments.join(', ')})"
end
def each(&block)
block.call(self)