fix frame indexes

This commit is contained in:
Torsten Ruger
2015-06-28 10:50:47 +03:00
parent ef42abe611
commit a00a49ecdb
4 changed files with 16 additions and 5 deletions

View File

@ -18,6 +18,9 @@ module Arm
@immediate = 0
@rn = :r0 # register zero = zero bit pattern
@extra = nil
if @rn.is_a?(Numeric) and !@rn.fits_u8? and !calculate_u8_with_rr(@rn)
@extra = 1
end
end
attr_accessor :to , :from

View File

@ -105,8 +105,8 @@ module Register
method.info.blocks.each do |block|
block.codes.each do |code|
begin
code.assemble( stream )
rescue => e
code.assemble( stream )
rescue => e
puts "Method error #{method.name}\n#{Sof.write(method.info.blocks).to_s[0...2000]}"
puts Sof.write(code)
raise e
@ -118,7 +118,7 @@ module Register
stream.rewind
#puts "Assembled #{method.name} with length #{stream.length}"
raise "length error #{method.code.length} != #{method.info.byte_length}" if method.code.length != method.info.byte_length
raise "length error #{stream.length} != #{method.info.byte_length}" if method.info.byte_length - stream.length > 32
raise "length error #{stream.length} != #{method.info.byte_length}" if method.info.byte_length - stream.length > 6
stream.each_byte do |b|
method.code.set_char(index , b )
index = index + 1

View File

@ -136,7 +136,7 @@ module Virtual
end
def byte_length
@blocks.inject(0) { |c , block| c += block.byte_length } + 8
@blocks.inject(0) { |c , block| c += block.byte_length } + 4
end
# position of the function is the position of the entry block, is where we call