diff options
author | Alon Zakai <alonzakai@gmail.com> | 2011-11-10 13:36:13 -0800 |
---|---|---|
committer | Alon Zakai <alonzakai@gmail.com> | 2011-11-10 13:36:13 -0800 |
commit | 008d2433826b0ac7d4bdd5556bd4c6b4f1351c73 (patch) | |
tree | 078b3d833e98d3dd21bce1fbc6bd87b64516f356 | |
parent | bbefb9fb22982d5ed712f8eb9664fef8d278c4b1 (diff) |
more i64 fixes and tests
-rw-r--r-- | src/intertyper.js | 2 | ||||
-rw-r--r-- | src/jsifier.js | 2 | ||||
-rw-r--r-- | tests/runner.py | 20 |
3 files changed, 21 insertions, 3 deletions
diff --git a/src/intertyper.js b/src/intertyper.js index 0f41f20f..b8100913 100644 --- a/src/intertyper.js +++ b/src/intertyper.js @@ -762,6 +762,8 @@ function intertyper(data, parseFunctions, baseLineNum) { // Some specific corrections, since 'i64' is special if (item.op in LLVM.SHIFTS) { item.param2.type = 'i32'; + } else if (item.op == 'select') { + item.param1.type = 'i1'; } } } diff --git a/src/jsifier.js b/src/jsifier.js index b362009d..a12bf883 100644 --- a/src/jsifier.js +++ b/src/jsifier.js @@ -848,7 +848,7 @@ function JSify(data, functionsOnly, givenFunctions, givenGlobalVariables) { var val = finalizeParam(param); if (!func || !func.hasVarArgs || i < func.numParams-1 || useJSArgs) { if (param.type == 'i64' && I64_MODE == 1) { - val = makeI64Copy(val); // Must copy [low, high] i64s, so they don't end up modified in the caller + val = makeCopyI64(val); // Must copy [low, high] i64s, so they don't end up modified in the caller } args.push(val); argsTypes.push(param.type); diff --git a/tests/runner.py b/tests/runner.py index ca38d000..acee1983 100644 --- a/tests/runner.py +++ b/tests/runner.py @@ -403,6 +403,14 @@ if 'benchmark' not in str(sys.argv): return test > 5 ? 0x0000def123450123ULL : 0ULL; } + void modifier1(int64_t t) { + t |= 12; + printf("m1: %Ld\n", t); + } + void modifier2(int64_t &t) { + t |= 12; + } + int main() { int64_t x1 = 0x1234def123450789ULL; @@ -411,11 +419,19 @@ if 'benchmark' not in str(sys.argv): printf("*%Ld\n%d,%d,%d,%d,%d\n%d,%d,%d,%d,%d*\n", x1, x1==x2, x1<x2, x1<=x2, x1>x2, x1>=x2, // note: some rounding in the printing! x1==x3, x1<x3, x1<=x3, x1>x3, x1>=x3); printf("*%Ld*\n", returner1()); - //printf("*%Ld*\n", returner2(30)); + printf("*%Ld*\n", returner2(30)); + + // Make sure in params are not modified + int64_t t = 123; + modifier1(t); + printf("*%Ld*\n", t); + modifier2(t); + printf("*%Ld*\n", t); return 0; } ''' - self.do_run(src, '*1311918518731868200\n0,0,0,1,1\n1,0,1,0,1*\n*245127260211081*\n') + self.do_run(src, '*1311918518731868200\n0,0,0,1,1\n1,0,1,0,1*\n*245127260211081*\n*245127260209443*\n' + + 'm1: 127\n*123*\n*127*\n') def test_unsigned(self): |