@@ -1128,47 +1128,6 @@ def get_subresource_location(path, data_uri=None):
1128
1128
else :
1129
1129
return os .path .basename (path )
1130
1130
1131
- @staticmethod
1132
- def make_initializer (sig , settings = None ):
1133
- settings = settings or Settings
1134
- if sig == 'i' :
1135
- return '0'
1136
- elif sig == 'f' :
1137
- return 'Math_fround(0)'
1138
- elif sig == 'j' :
1139
- if settings :
1140
- assert settings ['WASM' ], 'j aka i64 only makes sense in wasm-only mode in binaryen'
1141
- return 'i64(0)'
1142
- else :
1143
- return '+0'
1144
-
1145
- FLOAT_SIGS = ['f' , 'd' ]
1146
-
1147
- @staticmethod
1148
- def make_coercion (value , sig , settings = None , ffi_arg = False , ffi_result = False , convert_from = None ):
1149
- settings = settings or Settings
1150
- if sig == 'i' :
1151
- if convert_from in JS .FLOAT_SIGS :
1152
- value = '(~~' + value + ')'
1153
- return value + '|0'
1154
- if sig in JS .FLOAT_SIGS and convert_from == 'i' :
1155
- value = '(' + value + '|0)'
1156
- if sig == 'f' :
1157
- if ffi_arg :
1158
- return '+Math_fround(' + value + ')'
1159
- elif ffi_result :
1160
- return 'Math_fround(+(' + value + '))'
1161
- else :
1162
- return 'Math_fround(' + value + ')'
1163
- elif sig == 'd' or sig == 'f' :
1164
- return '+' + value
1165
- elif sig == 'j' :
1166
- if settings :
1167
- assert settings ['WASM' ], 'j aka i64 only makes sense in wasm-only mode in binaryen'
1168
- return 'i64(' + value + ')'
1169
- else :
1170
- return value
1171
-
1172
1131
@staticmethod
1173
1132
def legalize_sig (sig ):
1174
1133
# with BigInt support all sigs are legal since we can use i64s.
@@ -1195,16 +1154,6 @@ def is_legal_sig(sig):
1195
1154
return True
1196
1155
return sig == JS .legalize_sig (sig )
1197
1156
1198
- @staticmethod
1199
- def make_jscall (sig ):
1200
- fnargs = ',' .join ('a' + str (i ) for i in range (1 , len (sig )))
1201
- args = (',' if fnargs else '' ) + fnargs
1202
- ret = '''\
1203
- function jsCall_%s(index%s) {
1204
- %sfunctionPointers[index](%s);
1205
- }''' % (sig , args , 'return ' if sig [0 ] != 'v' else '' , fnargs )
1206
- return ret
1207
-
1208
1157
@staticmethod
1209
1158
def make_dynCall (sig , args ):
1210
1159
# wasm2c and asyncify are not yet compatible with direct wasm table calls
@@ -1246,48 +1195,6 @@ def make_invoke(sig, named=True):
1246
1195
1247
1196
return ret
1248
1197
1249
- @staticmethod
1250
- def align (x , by ):
1251
- while x % by != 0 :
1252
- x += 1
1253
- return x
1254
-
1255
- @staticmethod
1256
- def generate_string_initializer (s ):
1257
- if Settings .ASSERTIONS :
1258
- # append checksum of length and content
1259
- crcTable = []
1260
- for i in range (256 ):
1261
- crc = i
1262
- for bit in range (8 ):
1263
- crc = (crc >> 1 ) ^ ((crc & 1 ) * 0xedb88320 )
1264
- crcTable .append (crc )
1265
- crc = 0xffffffff
1266
- n = len (s )
1267
- crc = crcTable [(crc ^ n ) & 0xff ] ^ (crc >> 8 )
1268
- crc = crcTable [(crc ^ (n >> 8 )) & 0xff ] ^ (crc >> 8 )
1269
- for i in s :
1270
- crc = crcTable [(crc ^ i ) & 0xff ] ^ (crc >> 8 )
1271
- for i in range (4 ):
1272
- s .append ((crc >> (8 * i )) & 0xff )
1273
- s = '' .join (map (chr , s ))
1274
- s = s .replace ('\\ ' , '\\ \\ ' ).replace ("'" , "\\ '" )
1275
- s = s .replace ('\n ' , '\\ n' ).replace ('\r ' , '\\ r' )
1276
-
1277
- # Escape the ^Z (= 0x1a = substitute) ASCII character and all characters higher than 7-bit ASCII.
1278
- def escape (x ):
1279
- return '\\ x{:02x}' .format (ord (x .group ()))
1280
-
1281
- return re .sub ('[\x1a \x80 -\xff ]' , escape , s )
1282
-
1283
- @staticmethod
1284
- def is_dyn_call (func ):
1285
- return func .startswith ('dynCall_' )
1286
-
1287
- @staticmethod
1288
- def is_function_table (name ):
1289
- return name .startswith ('FUNCTION_TABLE_' )
1290
-
1291
1198
1292
1199
# Python 2-3 compatibility helper function:
1293
1200
# Converts a string to the native str type.
0 commit comments