aboutsummaryrefslogtreecommitdiff
path: root/src/runtime.js
diff options
context:
space:
mode:
authorAlon Zakai <alonzakai@gmail.com>2012-11-24 23:06:44 +0100
committerAlon Zakai <alonzakai@gmail.com>2012-12-07 14:23:18 -0800
commit26e9eba5aa1db69ad6fa36f6b6f27aed7532623c (patch)
treebfd1414c2dfdefca1f7afb4cea96b12fd3d217f7 /src/runtime.js
parentff39897223947c89af7066f3a9421db28e796605 (diff)
generate separate type-specific function tables
Diffstat (limited to 'src/runtime.js')
-rw-r--r--src/runtime.js20
1 files changed, 14 insertions, 6 deletions
diff --git a/src/runtime.js b/src/runtime.js
index dd14e779..8c1fbd65 100644
--- a/src/runtime.js
+++ b/src/runtime.js
@@ -311,10 +311,16 @@ var Runtime = {
return ret;
},
- addFunction: function(func) {
- var ret = FUNCTION_TABLE.length;
- FUNCTION_TABLE.push(func);
- FUNCTION_TABLE.push(0);
+ getFunctionTable: function(sig) { // return value, param types e.g. "vid" void (int, double)
+ return Module['FUNCTION_TABLE_' + sig];
+ },
+
+ addFunction: function(func, sig) {
+ assert(sig);
+ var table = Runtime.getFunctionTable(sig);
+ var ret = table.length;
+ table.push(func);
+ table.push(0);
return ret;
},
@@ -328,10 +334,12 @@ var Runtime = {
funcWrappers: {},
- getFuncWrapper: function(func) {
+ getFuncWrapper: function(func, sig) {
+ assert(sig);
+ var table = Runtime.getFunctionTable(sig);
if (!Runtime.funcWrappers[func]) {
Runtime.funcWrappers[func] = function() {
- FUNCTION_TABLE[func].apply(null, arguments);
+ table[func].apply(null, arguments);
};
}
return Runtime.funcWrappers[func];