From 294f4d988f0333df171da509524f4a6133833bd4 Mon Sep 17 00:00:00 2001 From: Torsten Ruger Date: Mon, 26 Mar 2018 19:42:15 +0300 Subject: [PATCH] automatically create binary once cpu instructions are there --- lib/arm/translator.rb | 2 ++ lib/parfait/typed_method.rb | 5 +---- lib/risc/assembler.rb | 1 - 3 files changed, 3 insertions(+), 5 deletions(-) diff --git a/lib/arm/translator.rb b/lib/arm/translator.rb index c2eca269..c9918f4a 100644 --- a/lib/arm/translator.rb +++ b/lib/arm/translator.rb @@ -1,4 +1,6 @@ module Arm + # A translator is cpu specific and translates from risc instructions to a given + # cpu. This one transltes to Arm Instructions. class Translator # translator should translate from register instructio set to it's own (arm eg) diff --git a/lib/parfait/typed_method.rb b/lib/parfait/typed_method.rb index 6baf164d..963d56f9 100644 --- a/lib/parfait/typed_method.rb +++ b/lib/parfait/typed_method.rb @@ -57,12 +57,9 @@ module Parfait @cpu_instructions << cpu if cpu nekst = nekst.next end - @cpu_instructions - end - - def create_binary total = @cpu_instructions.total_byte_length / 4 + 1 @binary = BinaryCode.new( total ) + @cpu_instructions end # determine whether this method has an argument by the name diff --git a/lib/risc/assembler.rb b/lib/risc/assembler.rb index 97571edd..d1ce0969 100644 --- a/lib/risc/assembler.rb +++ b/lib/risc/assembler.rb @@ -50,7 +50,6 @@ module Risc next unless method.is_a? Parfait::TypedMethod log.debug "CODE1 #{method.name}" # create binary for assembly - method.create_binary binary = method.binary Positioned.set_position(binary,at) method.cpu_instructions.set_position( at + 12) # BinaryCode header