diff options
author | Alon Zakai <alonzakai@gmail.com> | 2013-01-16 16:25:27 -0800 |
---|---|---|
committer | Alon Zakai <alonzakai@gmail.com> | 2013-01-16 16:27:15 -0800 |
commit | d0b3bb756d24c8ddea9f7de0225730eea46fa928 (patch) | |
tree | 7b8c60666dcdbd82c11e9456c0337e2104f4f5d8 | |
parent | d0128078f3f8d53d4c91a645b647df7695396ab8 (diff) |
fix dynCall generation
-rwxr-xr-x | emscripten.py | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/emscripten.py b/emscripten.py index 4cde12c7..f3683a96 100755 --- a/emscripten.py +++ b/emscripten.py @@ -331,11 +331,14 @@ var i64Math_modulo = function(a, b, c, d, e) { i64Math.modulo(a, b, c, d, e) }; ''' asm_runtime_funcs = ['stackAlloc', 'stackSave', 'stackRestore', 'setThrew'] + ['setTempRet%d' % i for i in range(10)] # function tables + def asm_coerce(value, sig): + return ('+' if sig == 'd' else '') + value + ('|0' if sig == 'i' else '') + function_tables = ['dynCall_' + table for table in last_forwarded_json['Functions']['tables']] function_tables_impls = [] for sig in last_forwarded_json['Functions']['tables'].iterkeys(): args = ','.join(['a' + str(i) for i in range(1, len(sig))]) - arg_coercions = ' '.join(['a' + str(i) + '=' + ('+' if sig[i] == 'd' else '') + 'a' + str(i) + ('|0' if sig[i] == 'i' else '') + ';' for i in range(1, len(sig))]) + arg_coercions = ' '.join(['a' + str(i) + '=' + asm_coerce('a' + str(i), sig[i]) + ';' for i in range(1, len(sig))]) function_tables_impls.append(''' function dynCall_%s(index%s%s) { index = index|0; |