Fix last parfait bug
missing return statement (duh)
This commit is contained in:
parent
f6bab0e633
commit
72643ebb08
@ -52,6 +52,7 @@ module Risc
|
||||
raise "Not int #{pos}" unless pos.is_a? Numeric
|
||||
position = Position.at(pos)
|
||||
raise "No position at 0x#{pos.to_s(16)}" unless position
|
||||
log.debug ""
|
||||
log.debug "Setting Position #{clock}-#{position}, "
|
||||
set_instruction( position.object )
|
||||
@clock += 1
|
||||
@ -60,7 +61,7 @@ module Risc
|
||||
|
||||
def set_instruction( instruction )
|
||||
raise "set to same instruction #{instruction}:#{instruction.class} at #{clock}" if @instruction == instruction
|
||||
log.debug "Setting Instruction #{instruction.class}"
|
||||
#log.debug "Setting Instruction #{instruction.class}"
|
||||
old = @instruction
|
||||
@instruction = instruction
|
||||
trigger(:instruction_changed, old , instruction)
|
||||
@ -121,6 +122,7 @@ module Risc
|
||||
end
|
||||
def execute_Branch
|
||||
label = @instruction.label
|
||||
log.debug "Branch to Label: #{@instruction.label}"
|
||||
pos = Position.get(label).at
|
||||
pos += Parfait::BinaryCode.byte_offset if label.is_a?(Parfait::BinaryCode)
|
||||
set_pc( pos )
|
||||
@ -169,6 +171,8 @@ module Risc
|
||||
raise "error #{@instruction} retrieves nil"
|
||||
else
|
||||
value = object.get_internal_word( index )
|
||||
#log.debug "Getting #{index} from #{object} value=#{value}"
|
||||
#log.debug "type=#{object.type} get_type=#{object.get_type} intern=#{object.get_internal_word(0)}"
|
||||
end
|
||||
log.debug "#{@instruction} == #{object}(#{Position.get(object)}) (#{value}|#{index})"
|
||||
set_register( @instruction.register , value )
|
||||
|
@ -11,7 +11,7 @@ module Parfait
|
||||
end
|
||||
# 0 -based index
|
||||
def get_internal_word(index)
|
||||
super(index) if index < self.class.type_length
|
||||
return super(index) if index < self.class.type_length
|
||||
@memory[ index ]
|
||||
end
|
||||
|
||||
|
@ -39,11 +39,6 @@ module Risc
|
||||
produced = produce_body
|
||||
assert_equal Parfait::NilClass , produced.next(5).constant.class
|
||||
end
|
||||
def est_nil_check
|
||||
produced = produce_body
|
||||
assert_equal Label , produced.next(4).label.class
|
||||
assert_equal produced.next(12) , produced.next(4).label
|
||||
end
|
||||
def test_true_label
|
||||
produced = produce_body
|
||||
assert produced.next(8).name.start_with?("true_label")
|
||||
|
@ -37,7 +37,7 @@ module Risc
|
||||
ret = main_ticks(46)
|
||||
assert_equal FunctionReturn , ret.class
|
||||
assert_equal :r3 , ret.register.symbol
|
||||
assert_equal 23404 , @interpreter.get_register(ret.register)
|
||||
assert_equal 40220 , @interpreter.get_register(ret.register)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
@ -12,7 +12,7 @@ module Risc
|
||||
|
||||
def test_simple_collect
|
||||
objects = Collector.collect_space(@linker)
|
||||
assert_equal 564 , objects.length , objects.length.to_s
|
||||
assert_equal 1564 , objects.length , objects.length.to_s
|
||||
end
|
||||
|
||||
def test_collect_all_types
|
||||
@ -59,7 +59,7 @@ module Risc
|
||||
|
||||
def test_simple_collect
|
||||
objects = Collector.collect_space(@linker)
|
||||
assert_equal 564, objects.length , objects.length.to_s
|
||||
assert_equal 1564, objects.length , objects.length.to_s
|
||||
end
|
||||
|
||||
def test_integer_positions
|
||||
|
@ -55,12 +55,12 @@ module Risc
|
||||
end
|
||||
def test_pc1
|
||||
@interpreter.tick
|
||||
assert_equal 23320 , @interpreter.pc
|
||||
assert_equal 40168 , @interpreter.pc
|
||||
end
|
||||
def test_pc2
|
||||
@interpreter.tick
|
||||
@interpreter.tick
|
||||
assert_equal 23324 , @interpreter.pc
|
||||
assert_equal 40172 , @interpreter.pc
|
||||
end
|
||||
def test_tick2
|
||||
@interpreter.tick
|
||||
|
@ -15,7 +15,7 @@ module Risc
|
||||
mains = @linker.assemblers.find_all{|asm| asm.callable.name == :main }
|
||||
assert_equal 1 , mains.length
|
||||
end
|
||||
def est_assembler_num
|
||||
def test_assembler_num
|
||||
assert_equal 22 , @linker.assemblers.length
|
||||
end
|
||||
end
|
||||
|
Loading…
Reference in New Issue
Block a user