diff options
author | Alon Zakai <alonzakai@gmail.com> | 2017-04-28 14:34:25 -0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-04-28 14:34:25 -0700 |
commit | a88d9b83a4629f4bf4c3b210b07d11d2396c594d (patch) | |
tree | 0df6fa75b22d4eb5a1590e6ee9fe5e6352ace5e4 /check.py | |
parent | 5d4f9eb82226acc0fdb5e2dea1a04e17c340c371 (diff) | |
download | binaryen-a88d9b83a4629f4bf4c3b210b07d11d2396c594d.tar.gz binaryen-a88d9b83a4629f4bf4c3b210b07d11d2396c594d.tar.bz2 binaryen-a88d9b83a4629f4bf4c3b210b07d11d2396c594d.zip |
ctor evaller (#982)
Add wasm-ctor-eval, which evaluates functions at compile time - typically static constructor functions - and applies their effects into memory, saving work at startup. If we encounter something we can't evaluate at compile time in our interpreter, stop there.
This is similar to ctor_evaller.py in emscripten (which was for asm.js).
Diffstat (limited to 'check.py')
-rwxr-xr-x | check.py | 14 |
1 files changed, 14 insertions, 0 deletions
@@ -237,6 +237,20 @@ for t in os.listdir(os.path.join('test', 'merge')): with open(out + '.stdout') as f: fail_if_not_identical(f.read(), stdout) +print '\n[ checking wasm-ctor-eval... ]\n' + +for t in os.listdir(os.path.join('test', 'ctor-eval')): + if t.endswith(('.wast', '.wasm')): + print '..', t + t = os.path.join('test', 'ctor-eval', t) + ctors = open(t + '.ctors').read().strip() + cmd = [os.path.join('bin', 'wasm-ctor-eval'), t, '-o', 'a.wast', '-S', '--ctors', ctors] + stdout = run_command(cmd) + actual = open('a.wast').read() + out = t + '.out' + with open(out) as f: + fail_if_not_identical(f.read(), actual) + print '\n[ checking wasm-shell spec testcases... ]\n' if len(requested) == 0: |