fix the initial jump

This commit is contained in:
Torsten Ruger
2015-06-10 10:43:50 +02:00
parent 1c8ed44e84
commit 6f111a5ae0
5 changed files with 20 additions and 13 deletions

View File

@ -113,10 +113,6 @@ module Virtual
obj.add_instance_method Builtin::Integer.send(f , nil)
end
# and the @init block in turn _jumps_ to __init__
# the point of which is that by the time main executes, all is :normal:
@init = Block.new(:_init_ , nil )
@init.add_code(Register::RegisterMain.new(underscore_init))
end
end
end

View File

@ -44,6 +44,8 @@ module Virtual
attr_reader :passes , :space , :class_mappings , :init , :objects
def run_passes
@init = Block.new("init",nil)
@init.add_code Register::RegisterMain.new( self.space.get_main )
Minimizer.new.run
Collector.new.run
@passes.each do |pass_class|
@ -51,12 +53,12 @@ module Virtual
@space.classes.values.each do |c|
c.instance_methods.each do |f|
nb = f.info.blocks
raise "nil blocks " unless nb
blocks += nb
end
end
#puts "running #{pass_class}"
blocks.each do |block|
raise "nil block " unless block
pass = eval pass_class
raise "no such pass-class as #{pass_class}" unless pass
pass.new.run(block)