aboutsummaryrefslogtreecommitdiff
path: root/src/modules.js
diff options
context:
space:
mode:
Diffstat (limited to 'src/modules.js')
-rw-r--r--src/modules.js19
1 files changed, 17 insertions, 2 deletions
diff --git a/src/modules.js b/src/modules.js
index a6aa2644..9f419234 100644
--- a/src/modules.js
+++ b/src/modules.js
@@ -252,12 +252,26 @@ var Functions = {
for (var i = 0; i < argTypes.length; i++) {
var type = argTypes[i];
if (!type) break; // varargs
- sig += isIntImplemented(type) ? (getBits(type) == 64 ? 'ii' : 'i') : 'f'; // legalized i64s will be i32s
+ if (type in Runtime.FLOAT_TYPES) {
+ sig += 'f';
+ } else {
+ var chunks = getNumIntChunks(type);
+ for (var j = 0; j < chunks; j++) sig += 'i';
+ }
}
if (hasVarArgs) sig += 'i';
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)) {
@@ -449,7 +463,8 @@ var PassManager = {
Types: Types,
Variables: Variables,
Functions: Functions,
- EXPORTED_FUNCTIONS: EXPORTED_FUNCTIONS // needed for asm.js global constructors (ctors)
+ EXPORTED_FUNCTIONS: EXPORTED_FUNCTIONS, // needed for asm.js global constructors (ctors)
+ Runtime: { GLOBAL_BASE: Runtime.GLOBAL_BASE }
}));
} else if (phase == 'funcs') {
print('\n//FORWARDED_DATA:' + JSON.stringify({