@@ -477,7 +477,7 @@ def fix_item(item):
477
477
if '_rand' in exported_implemented_functions or '_srand' in exported_implemented_functions :
478
478
basic_vars += ['___rand_seed' ]
479
479
480
- asm_runtime_funcs = ['stackAlloc' , 'stackSave' , 'stackRestore' , 'setThrew' ] + ['setTempRet%d' % i for i in range (10 )]
480
+ asm_runtime_funcs = ['stackAlloc' , 'stackSave' , 'stackRestore' , 'setThrew' ] + ['setTempRet%d' % i for i in range (10 )] + [ 'getTempRet%d' % i for i in range ( 10 )]
481
481
# function tables
482
482
function_tables = ['dynCall_' + table for table in last_forwarded_json ['Functions' ]['tables' ]]
483
483
function_tables_impls = []
@@ -632,6 +632,10 @@ def math_fix(g):
632
632
value = value|0;
633
633
tempRet%d = value;
634
634
}
635
+ ''' % (i , i ) for i in range (10 )]) + '' .join (['''
636
+ function getTempRet%d() {
637
+ return tempRet%d|0;
638
+ }
635
639
''' % (i , i ) for i in range (10 )])] + [PostSets .js + '\n ' ] + funcs_js + ['''
636
640
%s
637
641
@@ -644,9 +648,11 @@ def math_fix(g):
644
648
645
649
if not settings .get ('SIDE_MODULE' ):
646
650
funcs_js .append ('''
647
- Runtime.stackAlloc = function(size) { return asm['stackAlloc'](size) };
648
- Runtime.stackSave = function() { return asm['stackSave']() };
649
- Runtime.stackRestore = function(top) { asm['stackRestore'](top) };
651
+ Runtime.stackAlloc = asm['stackAlloc'];
652
+ Runtime.stackSave = asm['stackSave'];
653
+ Runtime.stackRestore = asm['stackRestore'];
654
+ Runtime.setTempRet0 = asm['setTempRet0'];
655
+ Runtime.getTempRet0 = asm['getTempRet0'];
650
656
''' )
651
657
652
658
# Set function table masks
@@ -1058,7 +1064,7 @@ def keyfunc(other):
1058
1064
if '_rand' in exported_implemented_functions or '_srand' in exported_implemented_functions :
1059
1065
basic_vars += ['___rand_seed' ]
1060
1066
1061
- asm_runtime_funcs = ['stackAlloc' , 'stackSave' , 'stackRestore' , 'setThrew' ] + [ 'setTempRet%d' % i for i in range ( 10 ) ]
1067
+ asm_runtime_funcs = ['stackAlloc' , 'stackSave' , 'stackRestore' , 'setThrew' , 'setTempRet0' , 'getTempRet0' ]
1062
1068
# function tables
1063
1069
function_tables = ['dynCall_' + table for table in last_forwarded_json ['Functions' ]['tables' ]]
1064
1070
function_tables_impls = []
@@ -1208,12 +1214,14 @@ def math_fix(g):
1208
1214
HEAP8[tempDoublePtr+6>>0] = HEAP8[ptr+6>>0];
1209
1215
HEAP8[tempDoublePtr+7>>0] = HEAP8[ptr+7>>0];
1210
1216
}
1211
- ''' + '' .join (['''
1212
- function setTempRet%d(value) {
1217
+ function setTempRet0(value) {
1213
1218
value = value|0;
1214
- tempRet%d = value;
1219
+ tempRet0 = value;
1220
+ }
1221
+ function getTempRet0() {
1222
+ return tempRet0|0;
1215
1223
}
1216
- ''' % ( i , i ) for i in range ( 10 )]) ] + funcs_js + ['''
1224
+ ''' ] + funcs_js + ['''
1217
1225
%s
1218
1226
1219
1227
return %s;
@@ -1225,9 +1233,11 @@ def math_fix(g):
1225
1233
1226
1234
if not settings .get ('SIDE_MODULE' ):
1227
1235
funcs_js .append ('''
1228
- Runtime.stackAlloc = function(size) { return asm['stackAlloc'](size) };
1229
- Runtime.stackSave = function() { return asm['stackSave']() };
1230
- Runtime.stackRestore = function(top) { asm['stackRestore'](top) };
1236
+ Runtime.stackAlloc = asm['stackAlloc'];
1237
+ Runtime.stackSave = asm['stackSave'];
1238
+ Runtime.stackRestore = asm['stackRestore'];
1239
+ Runtime.setTempRet0 = asm['setTempRet0'];
1240
+ Runtime.getTempRet0 = asm['getTempRet0'];
1231
1241
''' )
1232
1242
1233
1243
# Set function table masks
0 commit comments