diff options
author | Quentin Carbonneaux <quentin.carbonneaux@yale.edu> | 2016-03-27 18:35:21 -0400 |
---|---|---|
committer | Quentin Carbonneaux <quentin.carbonneaux@yale.edu> | 2016-03-27 18:35:21 -0400 |
commit | 3406a5fb2f64dc94a5fff4cb61b4c9a48a551b49 (patch) | |
tree | 82c0d122d6a0756d249b66440a636e3e2057b65a /tools/pmov.c | |
parent | 2f2d99e63f7b200958ae846edaa656ce914993bf (diff) | |
download | roux-3406a5fb2f64dc94a5fff4cb61b4c9a48a551b49.tar.gz |
free memory in pmov test
Diffstat (limited to 'tools/pmov.c')
-rw-r--r-- | tools/pmov.c | 18 |
1 files changed, 14 insertions, 4 deletions
diff --git a/tools/pmov.c b/tools/pmov.c index 68add5a..9136374 100644 --- a/tools/pmov.c +++ b/tools/pmov.c @@ -15,6 +15,8 @@ static void assert_test(char *, int), fail(void), iexec(int *); #include "../src/rega.c" +static void bsinit_(BSet *, uint); + static RMap mbeg; static Ins ins[NIReg], *ip; static Blk dummyb = { .ins = ins }; @@ -38,8 +40,8 @@ main() sprintf(tmp[t].name, "tmp%d", t-Tmp0+1); } - bsinit(mbeg.b, Tmp0+NIReg); - bsinit(mend.b, Tmp0+NIReg); + bsinit_(mbeg.b, Tmp0+NIReg); + bsinit_(mend.b, Tmp0+NIReg); cnt = 0; for (tm = 0; tm < 1ull << (2*NIReg); tm++) { mbeg.n = 0; @@ -160,7 +162,7 @@ main() break; } } - Nxt: ; + Nxt: freeall(); } printf("%llu tests successful!\n", cnt); exit(0); @@ -211,7 +213,7 @@ replay() RMap mend; re = 1; - bsinit(mend.b, Tmp0+NIReg); + bsinit_(mend.b, Tmp0+NIReg); rcopy(&mend, &mbeg); dopm(&dummyb, ip-1, &mend); } @@ -248,5 +250,13 @@ assert_test(char *s, int x) fail(); } +static void +bsinit_(BSet *bs, uint n) +{ + n = (n + NBit-1) / NBit; + bs->nt = n; + bs->t = emalloc(n * sizeof bs->t[0]); +} + /* symbols required by the linker */ char debug['Z'+1]; |