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