add position_chaning to event interface
by reacting to the change _before it happens, we can move any BinaryCode out of the way So when Instruction are inserted and code gets inserted, we don't need to set up the correct listener explicitly (which is tricky across mathods and changing chains), but instead just move anything that is in the way along
This commit is contained in:
@@ -117,16 +117,14 @@ module Risc
|
||||
#
|
||||
# start at code_start.
|
||||
def position_code(code_start)
|
||||
prev_code = nil
|
||||
Parfait.object_space.types.values.each do |type|
|
||||
next unless type.methods
|
||||
type.methods.each_method do |method|
|
||||
Position.log.debug "Position starts for method #{method.name}"
|
||||
last_code = CodeListener.init(method.binary)
|
||||
last_code.set(code_start)
|
||||
first_position = InstructionListener.init(method.cpu_instructions, method.binary)
|
||||
first_position.set( code_start + Parfait::BinaryCode.byte_offset)
|
||||
last_code.position_listener( prev_code.object) if prev_code
|
||||
prev_code = last_code
|
||||
code_start = last_code.next_slot
|
||||
end
|
||||
end
|
||||
|
Reference in New Issue
Block a user