aboutsummaryrefslogtreecommitdiff
path: root/emscripten.py
diff options
context:
space:
mode:
authorAlon Zakai <alonzakai@gmail.com>2013-05-15 11:34:18 -0700
committerAlon Zakai <alonzakai@gmail.com>2013-05-15 11:34:18 -0700
commit8ed84f09e75083b19fa6b2ad2a3651b01af41fb7 (patch)
tree137067d532ecb0f84af204758f8017d4a64040b3 /emscripten.py
parentede562fea850fb0e3e9c9e84cc25603e7587c02b (diff)
refactor code to generate empty function tables
Diffstat (limited to 'emscripten.py')
-rwxr-xr-xemscripten.py15
1 files changed, 2 insertions, 13 deletions
diff --git a/emscripten.py b/emscripten.py
index b99c0c09..df51d840 100755
--- a/emscripten.py
+++ b/emscripten.py
@@ -288,6 +288,8 @@ def emscript(infile, settings, outfile, libraries=[], compiler_engine=None,
exported_implemented_functions.add(key)
for key, value in curr_forwarded_json['Functions']['unimplementedFunctions'].iteritems():
forwarded_json['Functions']['unimplementedFunctions'][key] = value
+ for key, value in curr_forwarded_json['Functions']['neededTables'].iteritems():
+ forwarded_json['Functions']['neededTables'][key] = value
if settings.get('ASM_JS'):
parts = pre.split('// ASM_LIBRARY FUNCTIONS\n')
@@ -322,11 +324,6 @@ def emscript(infile, settings, outfile, libraries=[], compiler_engine=None,
forwarded_json['Functions']['indexedFunctions'][indexed] = curr # make sure not to modify this python object later - we use it in indexize
if alias: i = max(table_counters.values())
forwarded_json['Functions']['nextIndex'] = i # post phase can continue to add, in getIndex
- function_table_size = forwarded_json['Functions']['nextIndex']
- i = 1
- while i < function_table_size:
- i *= 2
- function_table_size = i
def split_32(x):
x = int(x)
@@ -383,14 +380,6 @@ def emscript(infile, settings, outfile, libraries=[], compiler_engine=None,
pre_tables = last_forwarded_json['Functions']['tables']['pre']
del last_forwarded_json['Functions']['tables']['pre']
- # Find function table calls without function tables generated for them
- for funcs_js_item in funcs_js:
- for use in set(re.findall(r'{{{ FTM_[\w\d_$]+ }}}', funcs_js_item)):
- sig = use[8:len(use)-4]
- if sig not in last_forwarded_json['Functions']['tables']:
- if DEBUG: print >> sys.stderr, 'add empty function table', sig
- last_forwarded_json['Functions']['tables'][sig] = 'var FUNCTION_TABLE_' + sig + ' = [' + ','.join(['0']*function_table_size) + '];\n'
-
def make_table(sig, raw):
i = Counter.i
Counter.i += 1