aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlon Zakai <alonzakai@gmail.com>2012-12-06 14:29:10 -0800
committerAlon Zakai <alonzakai@gmail.com>2012-12-07 14:23:24 -0800
commit9fcc17f1565c9470d6c9eebe451d0c820784ca96 (patch)
tree4f5c3bb908fa1a0e20c5671158b1bb25d218bde9
parent82a95c63d46429dccb31b0718bc69e008cee5744 (diff)
asm glue for tempRet*
-rwxr-xr-xemscripten.py10
-rw-r--r--src/parseTools.js3
2 files changed, 10 insertions, 3 deletions
diff --git a/emscripten.py b/emscripten.py
index 450bc49b..8bf750ac 100755
--- a/emscripten.py
+++ b/emscripten.py
@@ -302,7 +302,7 @@ var i64Math_multiply = function(a, b, c, d) { i64Math.multiply(a, b, c, d) };
var i64Math_divide = function(a, b, c, d, e) { i64Math.divide(a, b, c, d, e) };
var i64Math_modulo = function(a, b, c, d, e) { i64Math.modulo(a, b, c, d, e) };
'''
- asm_runtime_funcs = ['stackAlloc', 'stackSave', 'stackRestore']
+ asm_runtime_funcs = ['stackAlloc', 'stackSave', 'stackRestore'] + ['setTempRet%d' % i for i in range(10)]
# function tables
function_tables = ['dynCall_' + table for table in last_forwarded_json['Functions']['tables']]
function_tables_impls = []
@@ -360,7 +360,13 @@ var asmPre = (function(env, buffer) {
top = top|0;
STACKTOP = top;
}
-''' + funcs_js.replace('\n', '\n ') + '''
+''' + ''.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 ') + '''
%s
diff --git a/src/parseTools.js b/src/parseTools.js
index dc3f2ef0..91242861 100644
--- a/src/parseTools.js
+++ b/src/parseTools.js
@@ -1579,7 +1579,8 @@ function makeStructuralReturn(values) {
if (USE_TYPED_ARRAYS == 2) {
var i = 0;
return 'return (' + values.slice(1).map(function(value) {
- return 'tempRet' + (i++) + ' = ' + value;
+ return ASM_JS ? 'asm.setTempRet' + (i++) + '(' + value + ')'
+ : 'tempRet' + (i++) + ' = ' + value;
}).concat([values[0]]).join(',') + ')';
} else {
var i = 0;