diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/jsifier.js | 7 | ||||
-rw-r--r-- | src/modules.js | 9 |
2 files changed, 15 insertions, 1 deletions
diff --git a/src/jsifier.js b/src/jsifier.js index 38581ce4..e86a345d 100644 --- a/src/jsifier.js +++ b/src/jsifier.js @@ -1498,7 +1498,12 @@ function JSify(data, functionsOnly, givenFunctions) { var returnType = 'void'; if ((byPointer || ASM_JS) && hasReturn) { - returnType = getReturnType(type); + if (callIdent in Functions.implementedFunctions) { + // LLVM sometimes bitcasts for no reason. We must call using the exact same type as the actual function is generated as + returnType = Functions.getSignatureReturnType(Functions.implementedFunctions[callIdent]); + } else { + returnType = getReturnType(type); + } } if (byPointer) { diff --git a/src/modules.js b/src/modules.js index 53d97817..8cfc38de 100644 --- a/src/modules.js +++ b/src/modules.js @@ -258,6 +258,15 @@ var Functions = { return sig; }, + getSignatureReturnType: function(sig) { + switch(sig[0]) { + case 'v': return 'void'; + case 'i': return 'i32'; + case 'f': return 'double'; + default: throw 'what is this sig? ' + sig; + } + }, + // Mark a function as needing indexing. Python will coordinate them all getIndex: function(ident, doNotCreate, sig) { if (doNotCreate && !(ident in this.indexedFunctions)) { |