fix more of the changed names
add a few self.
This commit is contained in:
parent
66e0d4ae26
commit
3d113b4d83
@ -55,7 +55,7 @@ module Mom
|
||||
|
||||
if_zero ok_label
|
||||
|
||||
callable_method << callable_method[:next]
|
||||
callable_method << callable_method[:next_callable]
|
||||
branch while_start_label
|
||||
|
||||
add_code exit_label
|
||||
|
@ -77,7 +77,7 @@ module Parfait
|
||||
# hand out a return address for use as constant the address is added
|
||||
def get_address
|
||||
addr = next_address
|
||||
next_address = next_address.next_integer
|
||||
self.next_address = next_address.next_integer
|
||||
addr
|
||||
end
|
||||
|
||||
|
@ -127,16 +127,16 @@ module Parfait
|
||||
def remove_method( method_name )
|
||||
raise "No such method #{method_name} in #{self.name}" unless methods
|
||||
if( methods.name == method_name)
|
||||
self.methods = methods.next
|
||||
self.methods = methods.next_callable
|
||||
return true
|
||||
end
|
||||
method = methods
|
||||
while(method && method.next)
|
||||
if( method.next.name == method_name)
|
||||
method.set_next( method.next.next )
|
||||
while(method && method.next_callable)
|
||||
if( method.next_callable.name == method_name)
|
||||
method.set_next( method.next_callable.next_callable )
|
||||
return true
|
||||
else
|
||||
method = method.next
|
||||
method = method.next_callable
|
||||
end
|
||||
end
|
||||
raise "No such method #{method_name} in #{self.name}"
|
||||
|
@ -135,12 +135,12 @@ module Parfait
|
||||
{BinaryCode: {next_code: :BinaryCode} ,
|
||||
Block: {binary: :BinaryCode, next_callable: :Block,
|
||||
arguments_type: :Type , self_type: :Type, frame_type: :Type,
|
||||
name: :Word } ,
|
||||
name: :Word , blocks: :Block } ,
|
||||
|
||||
CacheEntry: {cached_type: :Type , cached_method: :CallableMethod } ,
|
||||
Callable: {binary: :BinaryCode,next_callable: :Callable ,
|
||||
arguments_type: :Type , self_type: :Type, frame_type: :Type,
|
||||
name: :Word } ,
|
||||
name: :Word , blocks: :Block } ,
|
||||
CallableMethod: {binary: :BinaryCode, next_callable: :CallableMethod ,
|
||||
arguments_type: :Type , self_type: :Type, frame_type: :Type ,
|
||||
name: :Word , blocks: :Block} ,
|
||||
|
@ -16,17 +16,17 @@ module Risc
|
||||
|
||||
def position_inserted(position)
|
||||
Position.log.debug "extending one at #{position}"
|
||||
pos = CodeListener.init( position.object.next , @platform)
|
||||
pos = CodeListener.init( position.object.next_code , @platform)
|
||||
raise "HI #{position}" unless position.valid?
|
||||
return unless position.valid?
|
||||
Position.log.debug "insert #{position.object.next.object_id.to_s(16)}"
|
||||
Position.log.debug "insert #{position.object.next_code.object_id.to_s(16)}"
|
||||
pos.set( position + position.object.padded_length)
|
||||
set_jump_for(position)
|
||||
end
|
||||
|
||||
def position_changed(position)
|
||||
Position.log.debug "Code changed #{position}"
|
||||
nekst = position.object.next
|
||||
nekst = position.object.next_code
|
||||
if( nekst )
|
||||
nekst_pos = Position.get(nekst)
|
||||
Position.log.debug "Code changed, setting next #{position}"
|
||||
@ -47,8 +47,8 @@ module Risc
|
||||
def set_jump_for(position)
|
||||
at = position.at
|
||||
code = position.object
|
||||
return unless code.next #dont jump beyond and
|
||||
jump = Branch.new("BinaryCode #{at.to_s(16)}" , code.next)
|
||||
return unless code.next_code #dont jump beyond and
|
||||
jump = Branch.new("BinaryCode #{at.to_s(16)}" , code.next_code)
|
||||
translator = @platform.translator
|
||||
cpu_jump = translator.translate(jump)
|
||||
pos = at + code.padded_length - cpu_jump.byte_length
|
||||
@ -66,7 +66,7 @@ module Risc
|
||||
position = Position.get_or_create(code)
|
||||
first = position unless first
|
||||
position.position_listener(CodeListener.new(platform))
|
||||
code = code.next
|
||||
code = code.next_code
|
||||
end
|
||||
first
|
||||
end
|
||||
|
@ -14,18 +14,18 @@ module Risc
|
||||
def test_listener_after_extend
|
||||
CodeListener.init(@binary,:interpreter).set(10)
|
||||
@binary.extend_one
|
||||
pos = Position.get(@binary.next)
|
||||
pos = Position.get(@binary.next_code)
|
||||
assert_equal CodeListener , pos.event_table[:position_changed].first.class
|
||||
end
|
||||
def test_valid_pos_for_extended
|
||||
@binary.extend_one
|
||||
CodeListener.init(@binary,:interpreter).set(10)
|
||||
assert Position.get(@binary.next).valid?
|
||||
assert Position.get(@binary.next_code).valid?
|
||||
end
|
||||
def test_extend_sets_next_pos
|
||||
CodeListener.init(@binary,:interpreter).set(10)
|
||||
@binary.extend_one
|
||||
assert Position.get(@binary.next).valid?
|
||||
assert Position.get(@binary.next_code).valid?
|
||||
end
|
||||
def test_extends_creates_jump
|
||||
CodeListener.init(@binary,:interpreter).set(10)
|
||||
|
@ -13,12 +13,12 @@ module Risc
|
||||
def test_bin_propagates_existing
|
||||
@binary.extend_to(16)
|
||||
CodeListener.init( @binary , :interpreter).set(0)
|
||||
assert_equal @binary.padded_length , Position.get(@binary.next).at
|
||||
assert_equal @binary.padded_length , Position.get(@binary.next_code).at
|
||||
end
|
||||
def test_bin_propagates_after
|
||||
CodeListener.init( @binary , :interpreter).set(0)
|
||||
@binary.extend_to(16)
|
||||
assert_equal @binary.padded_length , Position.get(@binary.next).at
|
||||
assert_equal @binary.padded_length , Position.get(@binary.next_code).at
|
||||
end
|
||||
end
|
||||
end
|
||||
|
Loading…
Reference in New Issue
Block a user