Steamline objectPosition init
check for resetting on the same position with different class, which should not happen Ie it’s ok for an object to push another object up, but not for an instruction to land on code
This commit is contained in:
@ -13,7 +13,7 @@ module Risc
|
||||
attr_reader :code , :method
|
||||
|
||||
def initialize(code, pos , method)
|
||||
super(pos,code)
|
||||
super(code,pos)
|
||||
@code = code
|
||||
@method = method
|
||||
raise "Method nil" unless method
|
||||
@ -26,21 +26,22 @@ module Risc
|
||||
next_meth = next_method
|
||||
return unless next_meth
|
||||
Position.set( next_meth.binary , next_pos , next_meth)
|
||||
Position.set( next_meth.cpu_instructions, next_pos + 12 , next_meth.binary)
|
||||
next_cpu_pos = next_pos + Parfait::BinaryCode.offset
|
||||
Position.set( next_meth.cpu_instructions, next_cpu_pos , next_meth.binary)
|
||||
end
|
||||
end
|
||||
def reset_to(pos)
|
||||
super(pos)
|
||||
#puts "Reset (#{changed}) #{instruction}"
|
||||
Position.log.debug "Reset (#{pos.to_s(16)}) #{code}"
|
||||
init(pos)
|
||||
end
|
||||
def next_method
|
||||
next_m = @method.next_method
|
||||
return next_m if next_m
|
||||
#puts "Type now #{@method.for_type.name}"
|
||||
Position.log.debug "Type now #{@method.for_type.name}"
|
||||
type = next_type(@method.for_type)
|
||||
if type
|
||||
#puts "Position for #{type.name}"
|
||||
Position.log.debug "Position for #{type.name}"
|
||||
return type.methods
|
||||
else
|
||||
return nil
|
||||
|
@ -18,26 +18,26 @@ module Risc
|
||||
attr_reader :instruction , :binary
|
||||
def initialize(instruction, pos , binary)
|
||||
raise "not set " unless binary
|
||||
super(pos, instruction)
|
||||
super(instruction,pos)
|
||||
@instruction = instruction
|
||||
@binary = binary
|
||||
end
|
||||
def init(at)
|
||||
diff = at - Position.get(@binary).at
|
||||
if( diff % 60 == 12*4)
|
||||
if( diff % 60 == 13*4)
|
||||
@binary.extend_one unless @binary.next
|
||||
@binary = @binary.next
|
||||
raise "end of line " unless @binary
|
||||
at = Position.get(@binary).at + 3*4
|
||||
at = Position.get(@binary).at + Parfait::BinaryCode.offset
|
||||
end
|
||||
return unless instruction.next
|
||||
at += instruction.byte_length
|
||||
Position.set(instruction.next, at , binary)
|
||||
return unless @instruction.next
|
||||
at += @instruction.byte_length
|
||||
Position.set(@instruction.next, at , @binary)
|
||||
end
|
||||
|
||||
def reset_to(pos)
|
||||
super(pos)
|
||||
#puts "Reset (#{changed}) #{instruction}"
|
||||
Position.log.debug "Reset (#{pos}) #{instruction}"
|
||||
init(pos)
|
||||
end
|
||||
end
|
||||
|
@ -3,7 +3,7 @@ module Risc
|
||||
class ObjectPosition
|
||||
attr_reader :at , :object
|
||||
|
||||
def initialize( at , object)
|
||||
def initialize( object, at)
|
||||
@at = at
|
||||
@object = object
|
||||
raise "not int #{self}-#{at}" unless @at.is_a?(Integer)
|
||||
|
Reference in New Issue
Block a user