aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlon Zakai <alonzakai@gmail.com>2013-09-29 18:40:47 -0700
committerAlon Zakai <alonzakai@gmail.com>2013-10-02 17:31:37 -0700
commitde3972ed9812e04c777e0c1cefbe2b4284f85610 (patch)
tree3776b5ffad082e1477a26c9b502b89aaf8144f93
parent6e8ba9140b706ed30977e083f6d25c05af08076e (diff)
when function is actually void, do not capture it's output even if llvm mistakenly bitcasts that way
-rw-r--r--src/jsifier.js11
1 files changed, 8 insertions, 3 deletions
diff --git a/src/jsifier.js b/src/jsifier.js
index acbcf582..41a3d070 100644
--- a/src/jsifier.js
+++ b/src/jsifier.js
@@ -1207,7 +1207,7 @@ function JSify(data, functionsOnly, givenFunctions) {
// in an assignment
var disabled = DISABLE_EXCEPTION_CATCHING == 2 && !(item.funcData.ident in EXCEPTION_CATCHING_WHITELIST);
var phiSets = calcPhiSets(item);
- var call_ = makeFunctionCall(item.ident, item.params, item.funcData, item.type, ASM_JS && !disabled, !!item.assignTo || !item.standalone, true);
+ var call_ = makeFunctionCall(item, item.params, item.funcData, item.type, ASM_JS && !disabled, !!item.assignTo || !item.standalone, true);
var ret;
@@ -1375,7 +1375,9 @@ function JSify(data, functionsOnly, givenFunctions) {
return ret;
}
- function makeFunctionCall(ident, params, funcData, type, forceByPointer, hasReturn, invoke) {
+ function makeFunctionCall(item, params, funcData, type, forceByPointer, hasReturn, invoke) {
+ var ident = item.ident;
+
// We cannot compile assembly. See comment in intertyper.js:'Call'
assert(ident != 'asm', 'Inline assembly cannot be compiled to JavaScript!');
@@ -1525,6 +1527,9 @@ function JSify(data, functionsOnly, givenFunctions) {
if (trueType !== returnType && !isIdenticallyImplemented(trueType, returnType)) {
if (VERBOSE) warnOnce('Fixing function call based on return type from signature, on ' + [callIdent, returnType, trueType]);
returnType = trueType;
+ if (trueType === 'void') {
+ item.assignTo = null;
+ }
}
}
}
@@ -1584,7 +1589,7 @@ function JSify(data, functionsOnly, givenFunctions) {
function getelementptrHandler(item) { return finalizeLLVMFunctionCall(item) }
function callHandler(item) {
if (item.standalone && LibraryManager.isStubFunction(item.ident)) return ';';
- var ret = makeFunctionCall(item.ident, item.params, item.funcData, item.type, false, !!item.assignTo || !item.standalone) + (item.standalone ? ';' : '');
+ var ret = makeFunctionCall(item, item.params, item.funcData, item.type, false, !!item.assignTo || !item.standalone) + (item.standalone ? ';' : '');
return makeVarArgsCleanup(ret);
}