aboutsummaryrefslogtreecommitdiff
path: root/emscripten.py
diff options
context:
space:
mode:
authorAlon Zakai <alonzakai@gmail.com>2012-12-13 11:51:13 -0800
committerAlon Zakai <alonzakai@gmail.com>2012-12-13 11:51:13 -0800
commit33745b7c407af78f9ea0d1c71d35ccf64e3ba2ed (patch)
tree72a54153b899df9378a631801a307745e65807b4 /emscripten.py
parent8f55ac76579e8d6cfcef674b8e747aa7b1634c97 (diff)
reorder asm output
Diffstat (limited to 'emscripten.py')
-rwxr-xr-xemscripten.py9
1 files changed, 5 insertions, 4 deletions
diff --git a/emscripten.py b/emscripten.py
index 7d2e8559..e845aef2 100755
--- a/emscripten.py
+++ b/emscripten.py
@@ -327,6 +327,7 @@ var i64Math_modulo = function(a, b, c, d, e) { i64Math.modulo(a, b, c, d, e) };
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))])
function_tables_impls.append('''
function dynCall_%s(index%s%s) {
+ index = index|0;
%s
%sFUNCTION_TABLE_%s[index&{{{ FTM_%s }}}](%s);
}
@@ -363,10 +364,11 @@ var asmPre = (function(env, buffer) {
var HEAPU32 = new env.Uint32Array(buffer);
var HEAPF32 = new env.Float32Array(buffer);
var HEAPF64 = new env.Float64Array(buffer);
-''' % (asm_setup,) + asm_global_funcs + '\n' + asm_global_vars + '''
+''' % (asm_setup,) + '\n' + asm_global_vars + '''
var __THREW__ = 0;
var undef = 0;
-
+''' + ''.join(['''
+ var tempRet%d = 0;''' % i for i in range(10)]) + '\n' + asm_global_funcs + '''
function stackAlloc(size) {
size = size|0;
var ret = 0;
@@ -387,12 +389,11 @@ var asmPre = (function(env, buffer) {
__THREW__ = threw;
}
''' + ''.join(['''
- var tempRet%d = 0;
function setTempRet%d(value) {
value = value|0;
tempRet%d = value;
}
-''' % (i, i, i) for i in range(10)]) + funcs_js.replace('\n', '\n ') + '''
+''' % (i, i) for i in range(10)]) + funcs_js.replace('\n', '\n ') + '''
%s