fix constant propagation through the layers

so they can end up in the binary
This commit is contained in:
Torsten Ruger
2018-07-03 10:12:22 +03:00
parent 63dfee0978
commit bb1d1495db
5 changed files with 29 additions and 9 deletions

View File

@ -1,10 +1,10 @@
module Risc
class Assembler
attr_reader :method , :instructions , :constants
def initialize( method , instructions, constants)
attr_reader :method , :instructions
def initialize( method , instructions)
@method = method
@instructions = instructions
@constants = constants
total = instructions.total_byte_length / 4 + 1
method.binary.extend_to( total )
end

View File

@ -13,7 +13,7 @@ module Risc
include Util::Logging
log_level :info
def initialize(platform , assemblers)
def initialize(platform , assemblers , constants)
if(platform.is_a?(Symbol))
platform = platform.to_s.capitalize
platform = Risc::Platform.for(platform)
@ -21,7 +21,7 @@ module Risc
raise "Platform must be platform, not #{platform.class}" unless platform.is_a?(Platform)
@platform = platform
@assemblers = assemblers
@constants = []
@constants = constants
@cpu_init = cpu_init_init
end