unscoping block names and adding labels to objects (which are off)

This commit is contained in:
Torsten Ruger 2014-08-30 20:55:22 +03:00
parent 0271045ff4
commit 5bb03f2d8b
3 changed files with 6 additions and 4 deletions

View File

@ -30,7 +30,9 @@ module Elf
end
end
end
assembler.objects.values.each do |slot|
add_symbol "#{slot.object.class.name}::#{slot.position.to_s(16)}" , slot.position
end
end
attr_reader :text
def set_text(text)

View File

@ -22,6 +22,7 @@ module Register
@space = space
@objects = {}
end
attr_reader :objects
def link
link_object(@space)

View File

@ -43,7 +43,7 @@ module Virtual
@receiver = receiver
@return_type = return_type
# 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]
@current = enter
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
# This does _not_ change the insertion point, that has do be done with insert_at(block)
def new_block new_name
block_name = "#{@current.name}_#{new_name}"
new_b = Block.new( block_name , self )
new_b = Block.new( new_name , self )
index = @blocks.index( @current )
@blocks.insert( index + 1 , new_b ) # + one because we want the ne after the insert_at
return new_b