diff options
-rw-r--r-- | src/library.js | 14 | ||||
-rw-r--r-- | tests/runner.py | 9 |
2 files changed, 22 insertions, 1 deletions
diff --git a/src/library.js b/src/library.js index 8b698623..49c1bdc8 100644 --- a/src/library.js +++ b/src/library.js @@ -294,6 +294,20 @@ var Library = { // LLVM specifics + llvm_va_copy: function(ppdest, ppsrc) { + IHEAP[ppdest] = IHEAP[ppsrc]; +#if SAFE_HEAP + SAFE_HEAP_ACCESS(ppdest, null, true); +#endif + /* Alternate implementation that copies the actual DATA; it assumes the va_list is prefixed by its size + var psrc = IHEAP[ppsrc]-1; + var num = IHEAP[psrc]; // right before the data, is the number of (flattened) values + var pdest = _malloc(num+1); + _memcpy(pdest, psrc, num+1); + IHEAP[ppdest] = pdest+1; + */ + }, + __assert_fail: function(condition, file, line) { ABORT = true; throw 'Assertion failed: ' + Pointer_stringify(condition);//JSON.stringify(arguments)//condition; diff --git a/tests/runner.py b/tests/runner.py index 42920946..14b1f2a4 100644 --- a/tests/runner.py +++ b/tests/runner.py @@ -845,6 +845,13 @@ if 'benchmark' not in sys.argv: char d[20]; vsnprintf(d, 20, s, v); puts(d); + + // Try it with copying + va_list tempva; + __va_copy(tempva, v); + vsnprintf(d, 20, s, tempva); + puts(d); + va_end(v); } @@ -888,7 +895,7 @@ if 'benchmark' not in sys.argv: return 0; } ''' - self.do_test(src, '*cheez: 0+24*\nQ85*\nmaxxi:21*\nmaxxD:22.10*\n') + self.do_test(src, '*cheez: 0+24*\n*cheez: 0+24*\nQ85*\nmaxxi:21*\nmaxxD:22.10*\n') def test_stdlibs(self): src = ''' |