summaryrefslogtreecommitdiff
path: root/emscripten.py
diff options
context:
space:
mode:
authorFraser Adams <fraser.adams@blueyonder.co.uk>2014-04-24 08:41:41 +0100
committerFraser Adams <fraser.adams@blueyonder.co.uk>2014-04-24 08:41:41 +0100
commite59333c486a97132698a1232ffdb1f5ae048d2b6 (patch)
treed068317527d5bfe435348172f6f2a76cfc0dfb18 /emscripten.py
parent55ba58508e65f70aed38ec57b78b46a83ecf9433 (diff)
Committing the actual change now
Diffstat (limited to 'emscripten.py')
-rwxr-xr-xemscripten.py16
1 files changed, 13 insertions, 3 deletions
diff --git a/emscripten.py b/emscripten.py
index c8122cb9..13492ba8 100755
--- a/emscripten.py
+++ b/emscripten.py
@@ -477,7 +477,7 @@ def emscript(infile, settings, outfile, libraries=[], compiler_engine=None,
if '_rand' in exported_implemented_functions or '_srand' in exported_implemented_functions:
basic_vars += ['___rand_seed']
- asm_runtime_funcs = ['stackAlloc', 'stackSave', 'stackRestore', 'setThrew'] + ['setTempRet%d' % i for i in range(10)]
+ asm_runtime_funcs = ['stackAlloc', 'stackSave', 'stackRestore', 'setThrew'] + ['setTempRet%d' % i for i in range(10)] + ['getTempRet%d' % i for i in range(10)]
# function tables
function_tables = ['dynCall_' + table for table in last_forwarded_json['Functions']['tables']]
function_tables_impls = []
@@ -632,6 +632,10 @@ function setTempRet%d(value) {
value = value|0;
tempRet%d = value;
}
+''' % (i, i) for i in range(10)]) + ''.join(['''
+function getTempRet%d() {
+ return tempRet%d|0;
+}
''' % (i, i) for i in range(10)])] + [PostSets.js + '\n'] + funcs_js + ['''
%s
@@ -647,6 +651,7 @@ function setTempRet%d(value) {
Runtime.stackAlloc = function(size) { return asm['stackAlloc'](size) };
Runtime.stackSave = function() { return asm['stackSave']() };
Runtime.stackRestore = function(top) { asm['stackRestore'](top) };
+Runtime.getTempRet0 = asm['getTempRet0'];
''')
# Set function table masks
@@ -1056,7 +1061,7 @@ def emscript_fast(infile, settings, outfile, libraries=[], compiler_engine=None,
if '_rand' in exported_implemented_functions or '_srand' in exported_implemented_functions:
basic_vars += ['___rand_seed']
- asm_runtime_funcs = ['stackAlloc', 'stackSave', 'stackRestore', 'setThrew'] + ['setTempRet%d' % i for i in range(10)]
+ asm_runtime_funcs = ['stackAlloc', 'stackSave', 'stackRestore', 'setThrew'] + ['setTempRet%d' % i for i in range(10)] + ['getTempRet%d' % i for i in range(10)]
# function tables
function_tables = ['dynCall_' + table for table in last_forwarded_json['Functions']['tables']]
function_tables_impls = []
@@ -1202,7 +1207,7 @@ function copyTempDouble(ptr) {
HEAP8[tempDoublePtr+3|0] = HEAP8[ptr+3|0];
HEAP8[tempDoublePtr+4|0] = HEAP8[ptr+4|0];
HEAP8[tempDoublePtr+5|0] = HEAP8[ptr+5|0];
- HEAP8[tempDoublePtr+6|0] = HEAP8[ptr+6|0];
+ HEAP8[tempDoublePtr+6|0] = HEAP8[ptr+6|0];f
HEAP8[tempDoublePtr+7|0] = HEAP8[ptr+7|0];
}
''' + ''.join(['''
@@ -1210,6 +1215,10 @@ function setTempRet%d(value) {
value = value|0;
tempRet%d = value;
}
+''' % (i, i) for i in range(10)]) + ''.join(['''
+function getTempRet%d() {
+ return tempRet%d|0;
+}
''' % (i, i) for i in range(10)])] + funcs_js + ['''
%s
@@ -1225,6 +1234,7 @@ function setTempRet%d(value) {
Runtime.stackAlloc = function(size) { return asm['stackAlloc'](size) };
Runtime.stackSave = function() { return asm['stackSave']() };
Runtime.stackRestore = function(top) { asm['stackRestore'](top) };
+Runtime.getTempRet0 = asm['getTempRet0'];
''')
# Set function table masks