From 313152805a8d9b2faf217996ba067ac8296ad668 Mon Sep 17 00:00:00 2001 From: inglorion Date: Sat, 10 Nov 2012 22:20:00 -0800 Subject: [PATCH] Made auto-bytes and auto-words work with variable arguments on ARM --- lib/voodoo/generators/arm_gas_generator.rb | 2 +- test/auto-bytes.voo | 8 +++++--- test/auto-words.voo | 9 +++++---- 3 files changed, 11 insertions(+), 8 deletions(-) diff --git a/lib/voodoo/generators/arm_gas_generator.rb b/lib/voodoo/generators/arm_gas_generator.rb index 2ff7537..a8d5598 100644 --- a/lib/voodoo/generators/arm_gas_generator.rb +++ b/lib/voodoo/generators/arm_gas_generator.rb @@ -166,7 +166,7 @@ module Voodoo emit "add #{register}, #{register}, \##{@STACK_ALIGNMENT - 1}\n" emit "mvn #{temporary}, \##{@STACK_ALIGNMENT - 1}\n" emit "and #{register}, #{register}, #{temporary}\n" - emit "sub sp, #{temp1}\n" + emit "sub sp, #{register}\n" end def auto_words value, register diff --git a/test/auto-bytes.voo b/test/auto-bytes.voo index 7a80f43..5ad57cc 100644 --- a/test/auto-bytes.voo +++ b/test/auto-bytes.voo @@ -15,17 +15,19 @@ import printf align test: function - let bytes auto-bytes 17 + let nbytes 17 + let max sub nbytes 1 + let bytes auto-bytes nbytes let i 0 let j 97 test_loop: - iflt i 16 + iflt i max set-byte bytes i j set i add i 1 set j add j 1 goto test_loop end if - set-byte bytes 16 0 + set-byte bytes max 0 call printf print_endline_fmt bytes call test_pass bytes diff --git a/test/auto-words.voo b/test/auto-words.voo index ee7f570..a518c68 100644 --- a/test/auto-words.voo +++ b/test/auto-words.voo @@ -46,18 +46,19 @@ test_loop: call test_pass words block - let a 42 - let more-words auto-words 19 + let nwords 19 + let a 42 + let more-words auto-words nwords let b 0 let c 72 test_loop1: - iflt b 19 + iflt b nwords set-word more-words b c set b add b 1 set c add c 1 goto test_loop1 end if - call print_words more-words 19 + call print_words more-words nwords call printf print_int_fmt a call printf print_int_fmt b call printf print_int_fmt c -- 2.11.4.GIT