Move booting to RubyXCompiler init

Also pass the source into the compile method.
This way compiler can be reused for subsequent compile.
Does remove some double boots, but no major time save
This commit is contained in:
Torsten Ruger
2018-09-02 13:57:19 +03:00
parent d73e1526cd
commit 8a81d41d5e
14 changed files with 39 additions and 57 deletions

View File

@ -8,8 +8,6 @@ module Elf
DEBUG = false
def setup
Parfait.boot!
Risc.boot!
end
def in_space(input)
@ -19,7 +17,7 @@ module Elf
in_space("def main(arg);#{input};end")
end
def check(input, file)
linker = RubyX::RubyXCompiler.new(input).ruby_to_binary( :arm )
linker = RubyX::RubyXCompiler.new.ruby_to_binary( input , :arm )
writer = Elf::ObjectWriter.new(linker)
writer.save "test/#{file}.o"
end

View File

@ -6,7 +6,7 @@ module Elf
def setup
super
@linker = RubyX::RubyXCompiler.new(as_main("return 1")).ruby_to_risc(:arm)
@linker = RubyX::RubyXCompiler.new.ruby_to_risc(as_main("return 1"),:arm)
@linker.position_all
@linker.create_binary
end