create methods with binaries and extend them later

Binary is new jump target for function call
This commit is contained in:
Torsten Ruger
2018-03-28 12:49:17 +03:00
parent 105e8f7092
commit 85ddf53429
4 changed files with 16 additions and 4 deletions

View File

@ -11,11 +11,14 @@ module Parfait
def initialize(total_size)
super()
extend_to(total_size)
#puts "Init with #{total_size} for #{object_id}"
(1..(data_length+1)).each{ |index| set_word(index , 0) }
end
def extend_to(total_size)
if total_size > self.data_length
@next = BinaryCode.new(total_size - data_length)
end
#puts "Init with #{total_size} for #{object_id}"
(1..(data_length+1)).each{ |index| set_word(index , 0) }
end
def to_s
"BinaryCode #{}"

View File

@ -43,6 +43,7 @@ module Parfait
raise "Wrong frame type, expect Type not #{frame.class}" unless frame.is_a? Type
@arguments = arguments
@frame = frame
@binary = BinaryCode.new(0)
source = "_init_method"
name = "#{@for_type.name}.#{@name}"
@risc_instructions = Risc.label(source, name)
@ -58,7 +59,7 @@ module Parfait
nekst = nekst.next
end
total = @cpu_instructions.total_byte_length / 4 + 1
@binary = BinaryCode.new( total )
@binary.extend_to( total )
@cpu_instructions
end