aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlon Zakai <alonzakai@gmail.com>2013-05-15 11:55:50 -0700
committerAlon Zakai <alonzakai@gmail.com>2013-05-15 11:55:50 -0700
commitca91732506299933d14d36093a8aa69cc0670ea5 (patch)
treeb64852acc1a1cfbd5eaac6d34b7e2207c6ae4401
parent8ed84f09e75083b19fa6b2ad2a3651b01af41fb7 (diff)
handle the case of no function tables with aliasing function pointers
-rwxr-xr-xemscripten.py2
-rwxr-xr-xtests/runner.py4
2 files changed, 5 insertions, 1 deletions
diff --git a/emscripten.py b/emscripten.py
index df51d840..236a2e4e 100755
--- a/emscripten.py
+++ b/emscripten.py
@@ -322,7 +322,7 @@ def emscript(infile, settings, outfile, libraries=[], compiler_engine=None,
i += 2
#print >> sys.stderr, 'function indexing', indexed, curr, sig
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())
+ if alias: i = max(table_counters.values()) if len(table_counters) > 0 else 2 + 2*settings['RESERVED_FUNCTION_POINTERS']
forwarded_json['Functions']['nextIndex'] = i # post phase can continue to add, in getIndex
def split_32(x):
diff --git a/tests/runner.py b/tests/runner.py
index b2b1ff43..734dc51b 100755
--- a/tests/runner.py
+++ b/tests/runner.py
@@ -8513,6 +8513,10 @@ def process(filename):
self.do_run(src, '''Finished up all reserved function pointers. Use a higher value for RESERVED_FUNCTION_POINTERS.''')
generated = open('src.cpp.o.js').read()
assert 'jsCall' not in generated
+ Settings.RESERVED_FUNCTION_POINTERS = 1
+
+ Settings.ALIASING_FUNCTION_POINTERS = 1
+ self.do_run(src, '''Hello 7 from JS!''')
def test_scriptaclass(self):
if self.emcc_args is None: return self.skip('requires emcc')