add inital jump to __init__

This commit is contained in:
Torsten Ruger 2014-09-11 10:30:23 +03:00
parent f44965ef21
commit cb727c658e

View File

@ -34,7 +34,7 @@ module Register
def link def link
collect_object(@space) collect_object(@space)
at = 0 at = 4
@objects.each do |id , slot| @objects.each do |id , slot|
next unless slot.objekt.is_a? Virtual::CompiledMethod next unless slot.objekt.is_a? Virtual::CompiledMethod
slot.position = at slot.position = at
@ -51,6 +51,12 @@ module Register
def assemble def assemble
link link
@stream = StringIO.new @stream = StringIO.new
mid , main_slot = @objects.find{|k,slot| slot.objekt.is_a?(Virtual::CompiledMethod) and (slot.objekt.name == :__init__ )}
main = main_slot.objekt
puts "function found #{main.name}"
initial_jump = RegisterMachine.instance.b( main )
initial_jump.position = 0
initial_jump.assemble( @stream , self )
@objects.each do |id , slot| @objects.each do |id , slot|
next unless slot.objekt.is_a? Virtual::CompiledMethod next unless slot.objekt.is_a? Virtual::CompiledMethod
assemble_object( slot ) assemble_object( slot )