diff options
author | Alon Zakai <alonzakai@gmail.com> | 2014-05-08 16:21:14 -0700 |
---|---|---|
committer | Alon Zakai <alonzakai@gmail.com> | 2014-05-08 16:21:14 -0700 |
commit | 2ad7b1037ceb2d5ec5457df8c1365694469dcab2 (patch) | |
tree | 20a1a927d277d2114be374c7a02d043fe02a2e54 /emscripten.py | |
parent | 9c613ffaac19bcc718c0c25e85fde7a3ec11f27c (diff) | |
parent | deb49776cf90ceb1033c741b568423d6a3bb5d46 (diff) |
Merge pull request #2311 from fadams/fix-64bit-long-return-issue
Fix 64bit long return issue
Diffstat (limited to 'emscripten.py')
-rwxr-xr-x | emscripten.py | 34 |
1 files changed, 22 insertions, 12 deletions
diff --git a/emscripten.py b/emscripten.py index 939ddbe8..e2aef648 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 @@ -644,9 +648,11 @@ function setTempRet%d(value) { if not settings.get('SIDE_MODULE'): funcs_js.append(''' -Runtime.stackAlloc = function(size) { return asm['stackAlloc'](size) }; -Runtime.stackSave = function() { return asm['stackSave']() }; -Runtime.stackRestore = function(top) { asm['stackRestore'](top) }; +Runtime.stackAlloc = asm['stackAlloc']; +Runtime.stackSave = asm['stackSave']; +Runtime.stackRestore = asm['stackRestore']; +Runtime.setTempRet0 = asm['setTempRet0']; +Runtime.getTempRet0 = asm['getTempRet0']; ''') # Set function table masks @@ -1058,7 +1064,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', 'setTempRet0', 'getTempRet0'] # function tables function_tables = ['dynCall_' + table for table in last_forwarded_json['Functions']['tables']] function_tables_impls = [] @@ -1208,12 +1214,14 @@ function copyTempDouble(ptr) { HEAP8[tempDoublePtr+6>>0] = HEAP8[ptr+6>>0]; HEAP8[tempDoublePtr+7>>0] = HEAP8[ptr+7>>0]; } -''' + ''.join([''' -function setTempRet%d(value) { +function setTempRet0(value) { value = value|0; - tempRet%d = value; + tempRet0 = value; +} +function getTempRet0() { + return tempRet0|0; } -''' % (i, i) for i in range(10)])] + funcs_js + [''' +'''] + funcs_js + [''' %s return %s; @@ -1225,9 +1233,11 @@ function setTempRet%d(value) { if not settings.get('SIDE_MODULE'): funcs_js.append(''' -Runtime.stackAlloc = function(size) { return asm['stackAlloc'](size) }; -Runtime.stackSave = function() { return asm['stackSave']() }; -Runtime.stackRestore = function(top) { asm['stackRestore'](top) }; +Runtime.stackAlloc = asm['stackAlloc']; +Runtime.stackSave = asm['stackSave']; +Runtime.stackRestore = asm['stackRestore']; +Runtime.setTempRet0 = asm['setTempRet0']; +Runtime.getTempRet0 = asm['getTempRet0']; ''') # Set function table masks |