diff options
-rw-r--r-- | src/jsifier.js | 3 | ||||
-rw-r--r-- | src/modules.js | 2 | ||||
-rw-r--r-- | src/preamble.js | 2 |
3 files changed, 4 insertions, 3 deletions
diff --git a/src/jsifier.js b/src/jsifier.js index ab5c8720..c5a6ec9d 100644 --- a/src/jsifier.js +++ b/src/jsifier.js @@ -938,13 +938,12 @@ function JSify(data, functionsOnly, givenFunctions, givenGlobalVariables) { print('Runtime.structMetadata = ' + JSON.stringify(Types.structMetadata)); } generated.forEach(function(item) { print(indentify(item.JS || '', 2)); }); - print(Functions.generateIndexing()); - var postFile = BUILD_AS_SHARED_LIB ? 'postamble_sharedlib.js' : 'postamble.js'; var postParts = processMacros(preprocess(read(postFile), CONSTANTS)).split('{{GLOBAL_VARS}}'); print(postParts[0]); itemsDict.GlobalVariable.forEach(function(item) { print(indentify(item.JS, 4)); }); itemsDict.GlobalVariablePostSet.forEach(function(item) { print(indentify(item.JS, 4)); }); + print(Functions.generateIndexing()); // done last, as it may rely on aliases set in postsets print(postParts[1]); print(shellParts[1]); return null; diff --git a/src/modules.js b/src/modules.js index 8205e9ff..c9ac560e 100644 --- a/src/modules.js +++ b/src/modules.js @@ -244,7 +244,7 @@ var Functions = { // Shared libraries reuse the parent's function table. return 'FUNCTION_TABLE = FUNCTION_TABLE.concat([' + indices + ']);'; } else { - return 'var FUNCTION_TABLE = [' + indices + '];'; + return 'FUNCTION_TABLE = [' + indices + '];'; } } }; diff --git a/src/preamble.js b/src/preamble.js index 9dd7ffaa..2bc47aac 100644 --- a/src/preamble.js +++ b/src/preamble.js @@ -412,6 +412,8 @@ Module['Array_stringify'] = Array_stringify; // Memory management +var FUNCTION_TABLE; + var PAGE_SIZE = 4096; function alignMemoryPage(x) { return Math.ceil(x/PAGE_SIZE)*PAGE_SIZE; |