refactor builtin object, some machine too

This commit is contained in:
Torsten Ruger
2016-12-15 19:20:54 +02:00
parent 94c423c2b3
commit 5ea6bfed27
4 changed files with 52 additions and 22 deletions

View File

@ -26,14 +26,27 @@ module Register
# now we just instantiate ArmTranslater and pass instructions
def translate_arm
translator = Arm::Translator.new
methods = collect_methods
translate_methods( methods , translator)
label = @init.next
@init = translator.translate( @init)
@init.append label
end
def collect_methods
methods = []
self.space.types.each do |hash , t|
t.instance_methods.each do |f|
methods << f
end
end
methods
end
def translate_methods(methods , translator )
methods.each do |method|
instruction = method.instructions
puts method.name
while instruction.next
nekst = instruction.next
t = translator.translate(nekst) # returning nil means no replace
@ -44,12 +57,8 @@ module Register
instruction = nekst
end
end
label = @init.next
@init = translator.translate( @init)
@init.append label
end
# Objects are data and get assembled after functions
def add_object o
return false if @objects[o.object_id]