aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlon Zakai <alonzakai@gmail.com>2013-02-26 19:35:11 -0500
committerAlon Zakai <alonzakai@gmail.com>2013-02-26 19:35:11 -0500
commitbafdc889fcfcab5715e8dae5d26c3d5ff3160498 (patch)
tree71dc212bf53d133901541dc508786b3b2052c9e3
parent4113375f1f0f6d3a807c1edd843e96596ee6e2c5 (diff)
show signature in dyncall errors, and simplify approach
-rw-r--r--src/jsifier.js3
-rw-r--r--src/modules.js8
-rwxr-xr-xtests/runner.py2
3 files changed, 3 insertions, 10 deletions
diff --git a/src/jsifier.js b/src/jsifier.js
index ff43c8c6..0e82a547 100644
--- a/src/jsifier.js
+++ b/src/jsifier.js
@@ -1402,7 +1402,8 @@ function JSify(data, functionsOnly, givenFunctions) {
assert(returnType.search(/\("'\[,/) == -1); // XXX need isFunctionType(type, out)
callIdent = '(' + callIdent + ')&{{{ FTM_' + sig + ' }}}'; // the function table mask is set in emscripten.py
} else if (SAFE_DYNCALLS) {
- callIdent = '(tempInt=' + callIdent + ',tempInt < 0 || tempInt >= FUNCTION_TABLE.length-1 ? abort("dyncall error") : tempInt)';
+ assert(!ASM_JS, 'cannot emit safe dyncalls in asm');
+ callIdent = '(tempInt=' + callIdent + ',tempInt < 0 || tempInt >= FUNCTION_TABLE.length-1 || !FUNCTION_TABLE[tempInt] ? abort("dyncall error: ' + sig + '") : tempInt)';
}
callIdent = Functions.getTable(sig) + '[' + callIdent + ']';
}
diff --git a/src/modules.js b/src/modules.js
index 7f8a959b..501ff22e 100644
--- a/src/modules.js
+++ b/src/modules.js
@@ -330,14 +330,6 @@ var Functions = {
}
}
}
- if (SAFE_DYNCALLS) {
- assert(!ASM_JS, 'cannot emit safe dyncalls in asm');
- for (var j = 0; j < table.length; j++) {
- if (table[j] == 0) {
- table[j] = "function() { abort('dyncall error') }";
- }
- }
- }
if (table.length > 20) {
// add some newlines in the table, for readability
var j = 10;
diff --git a/tests/runner.py b/tests/runner.py
index d4ec2501..9cf40543 100755
--- a/tests/runner.py
+++ b/tests/runner.py
@@ -2835,7 +2835,7 @@ Exiting setjmp function, level: 0, prev_jmp: -1
return 0;
}
'''.replace('COND', '==' if cond else '!=').replace('BODY', r'{ printf("all good\n"); }' if body else '')
- self.do_run(src, 'dyncall error' if not work else 'all good')
+ self.do_run(src, 'dyncall error: vi' if not work else 'all good')
def test_dynamic_cast(self):
if self.emcc_args is None: return self.skip('need libcxxabi')