fix frame indexes
This commit is contained in:
parent
ef42abe611
commit
a00a49ecdb
@ -18,6 +18,9 @@ module Arm
|
|||||||
@immediate = 0
|
@immediate = 0
|
||||||
@rn = :r0 # register zero = zero bit pattern
|
@rn = :r0 # register zero = zero bit pattern
|
||||||
@extra = nil
|
@extra = nil
|
||||||
|
if @rn.is_a?(Numeric) and !@rn.fits_u8? and !calculate_u8_with_rr(@rn)
|
||||||
|
@extra = 1
|
||||||
|
end
|
||||||
end
|
end
|
||||||
attr_accessor :to , :from
|
attr_accessor :to , :from
|
||||||
|
|
||||||
|
@ -105,8 +105,8 @@ module Register
|
|||||||
method.info.blocks.each do |block|
|
method.info.blocks.each do |block|
|
||||||
block.codes.each do |code|
|
block.codes.each do |code|
|
||||||
begin
|
begin
|
||||||
code.assemble( stream )
|
code.assemble( stream )
|
||||||
rescue => e
|
rescue => e
|
||||||
puts "Method error #{method.name}\n#{Sof.write(method.info.blocks).to_s[0...2000]}"
|
puts "Method error #{method.name}\n#{Sof.write(method.info.blocks).to_s[0...2000]}"
|
||||||
puts Sof.write(code)
|
puts Sof.write(code)
|
||||||
raise e
|
raise e
|
||||||
@ -118,7 +118,7 @@ module Register
|
|||||||
stream.rewind
|
stream.rewind
|
||||||
#puts "Assembled #{method.name} with length #{stream.length}"
|
#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 #{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|
|
stream.each_byte do |b|
|
||||||
method.code.set_char(index , b )
|
method.code.set_char(index , b )
|
||||||
index = index + 1
|
index = index + 1
|
||||||
|
@ -136,7 +136,7 @@ module Virtual
|
|||||||
end
|
end
|
||||||
|
|
||||||
def byte_length
|
def byte_length
|
||||||
@blocks.inject(0) { |c , block| c += block.byte_length } + 8
|
@blocks.inject(0) { |c , block| c += block.byte_length } + 4
|
||||||
end
|
end
|
||||||
|
|
||||||
# position of the function is the position of the entry block, is where we call
|
# position of the function is the position of the entry block, is where we call
|
||||||
|
@ -14,24 +14,32 @@ class TestPadding < MiniTest::Test
|
|||||||
assert_equal 32 , @pad.padded(p) , "Expecting 32 for #{p}"
|
assert_equal 32 , @pad.padded(p) , "Expecting 32 for #{p}"
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
def test_large
|
def test_medium
|
||||||
[26,40,53,56].each do |p|
|
[26,40,53,56].each do |p|
|
||||||
assert_equal 64 , @pad.padded(p) , "Expecting 64 for #{p}"
|
assert_equal 64 , @pad.padded(p) , "Expecting 64 for #{p}"
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
def test_large
|
||||||
|
[58,88].each do |p|
|
||||||
|
assert_equal 96 , @pad.padded(p) , "Expecting 96 for #{p}"
|
||||||
|
end
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
class TestPositioning < MiniTest::Test
|
class TestPositioning < MiniTest::Test
|
||||||
def test_list1
|
def test_list1
|
||||||
list = Virtual.new_list([1])
|
list = Virtual.new_list([1])
|
||||||
|
list.set_layout( Parfait::Layout.new Object)
|
||||||
assert_equal 32 , list.word_length
|
assert_equal 32 , list.word_length
|
||||||
end
|
end
|
||||||
def test_list5
|
def test_list5
|
||||||
list = Virtual.new_list([1,2,3,4,5])
|
list = Virtual.new_list([1,2,3,4,5])
|
||||||
|
list.set_layout( Parfait::Layout.new Object)
|
||||||
assert_equal 32 , list.word_length
|
assert_equal 32 , list.word_length
|
||||||
end
|
end
|
||||||
def test_layout
|
def test_layout
|
||||||
layout = Parfait::Layout.new Object
|
layout = Parfait::Layout.new Object
|
||||||
|
layout.set_layout( Parfait::Layout.new Object)
|
||||||
layout.push 5
|
layout.push 5
|
||||||
assert_equal 32 , layout.word_length
|
assert_equal 32 , layout.word_length
|
||||||
end
|
end
|
||||||
|
Loading…
Reference in New Issue
Block a user