unscoping block names and adding labels to objects (which are off)
This commit is contained in:
parent
0271045ff4
commit
5bb03f2d8b
lib
@ -30,7 +30,9 @@ module Elf
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
assembler.objects.values.each do |slot|
|
||||||
|
add_symbol "#{slot.object.class.name}::#{slot.position.to_s(16)}" , slot.position
|
||||||
|
end
|
||||||
end
|
end
|
||||||
attr_reader :text
|
attr_reader :text
|
||||||
def set_text(text)
|
def set_text(text)
|
||||||
|
@ -22,6 +22,7 @@ module Register
|
|||||||
@space = space
|
@space = space
|
||||||
@objects = {}
|
@objects = {}
|
||||||
end
|
end
|
||||||
|
attr_reader :objects
|
||||||
|
|
||||||
def link
|
def link
|
||||||
link_object(@space)
|
link_object(@space)
|
||||||
|
@ -43,7 +43,7 @@ module Virtual
|
|||||||
@receiver = receiver
|
@receiver = receiver
|
||||||
@return_type = return_type
|
@return_type = return_type
|
||||||
# first block we have to create with .new , as new_block assumes a current
|
# first block we have to create with .new , as new_block assumes a current
|
||||||
enter = Block.new( name , self ).add_code(MethodEnter.new())
|
enter = Block.new( "enter" , self ).add_code(MethodEnter.new())
|
||||||
@blocks = [enter]
|
@blocks = [enter]
|
||||||
@current = enter
|
@current = enter
|
||||||
new_block("return").add_code(MethodReturn.new)
|
new_block("return").add_code(MethodReturn.new)
|
||||||
@ -100,8 +100,7 @@ module Virtual
|
|||||||
# In code generation , the new_block is written after this one, ie zero runtime cost
|
# In code generation , the new_block is written after this one, ie zero runtime cost
|
||||||
# This does _not_ change the insertion point, that has do be done with insert_at(block)
|
# This does _not_ change the insertion point, that has do be done with insert_at(block)
|
||||||
def new_block new_name
|
def new_block new_name
|
||||||
block_name = "#{@current.name}_#{new_name}"
|
new_b = Block.new( new_name , self )
|
||||||
new_b = Block.new( block_name , self )
|
|
||||||
index = @blocks.index( @current )
|
index = @blocks.index( @current )
|
||||||
@blocks.insert( index + 1 , new_b ) # + one because we want the ne after the insert_at
|
@blocks.insert( index + 1 , new_b ) # + one because we want the ne after the insert_at
|
||||||
return new_b
|
return new_b
|
||||||
|
Loading…
x
Reference in New Issue
Block a user