From 8fa92515b5a900ff05c6d9f1f50c7c2ad09af422 Mon Sep 17 00:00:00 2001 From: Torsten Ruger Date: Sat, 14 Nov 2015 13:05:49 +0200 Subject: [PATCH] update arm and small arm fixes constants in arm chunks, needs better solution --- Gemfile.lock | 2 +- lib/register/parfait_adapter.rb | 2 +- lib/register/register_value.rb | 2 +- test/parfait/test_integer.rb | 14 +++++++++----- 4 files changed, 12 insertions(+), 8 deletions(-) diff --git a/Gemfile.lock b/Gemfile.lock index eb8c4d43..465c4539 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -1,6 +1,6 @@ GIT remote: git://github.com/salama/salama-arm.git - revision: bf9ba364343acd4afbe053a18126b87d73f43e94 + revision: 00b175d354046a6228f66a980822eae974ca807a specs: salama-arm (0.3.0) diff --git a/lib/register/parfait_adapter.rb b/lib/register/parfait_adapter.rb index 749d53bf..3bac5acf 100644 --- a/lib/register/parfait_adapter.rb +++ b/lib/register/parfait_adapter.rb @@ -60,7 +60,7 @@ class Symbol # resetting of position used to be error, but since relink and dynamic instruction size it is ok. # in measures (of 32) old = cache_positions[self] - if old != nil and ((old - pos).abs > 32) + if old != nil and ((old - pos).abs > 2000) raise "position set again #{pos}!=#{old} for #{self}" end cache_positions[self] = pos diff --git a/lib/register/register_value.rb b/lib/register/register_value.rb index 66e7b362..48aa44c8 100644 --- a/lib/register/register_value.rb +++ b/lib/register/register_value.rb @@ -24,7 +24,7 @@ module Register end def reg_no - @type.to_s[1 .. -1].to_i + @symbol.to_s[1 .. -1].to_i end def self.look_like_reg is_it diff --git a/test/parfait/test_integer.rb b/test/parfait/test_integer.rb index fa4fe4e1..dd68fed9 100644 --- a/test/parfait/test_integer.rb +++ b/test/parfait/test_integer.rb @@ -98,13 +98,17 @@ five.putstring()" end def test_puti_seven_digit - @string_input = "return 1234567.puti()" + @string_input = "int i = 301 * 4096 + i = i + 1671 + return i.puti()" @stdout = " 1234567" check_return 1234567 end - def test_puti_eigth_digit - @string_input = "return 123445678.puti()" - @stdout = " 123445678" - check_return 123445678 + def test_puti_eight_digit + @string_input = "int i = 3014 * 4096 + i = i + 334 + return i.puti()" + @stdout = " 12345678" + check_return 12345678 end end