diff options
author | Alon Zakai <alonzakai@gmail.com> | 2013-02-26 15:16:35 -0500 |
---|---|---|
committer | Alon Zakai <alonzakai@gmail.com> | 2013-02-26 15:16:35 -0500 |
commit | 108f6550f37ed10bef300c93f6158029471f7921 (patch) | |
tree | ca9eebdeb19517f94fe32aa31c9fc5d7e5b37868 | |
parent | 556bb55f1b79f5b1420d5cf6d124631aea247a43 (diff) |
do not emit EMSCRIPTEN_GENERATED_FUNCTIONS to the final output, it is just needed internally
-rw-r--r-- | src/jsifier.js | 8 | ||||
-rw-r--r-- | src/settings.js | 2 | ||||
-rwxr-xr-x | tests/runner.py | 2 | ||||
-rw-r--r-- | tools/js_optimizer.py | 2 | ||||
-rw-r--r-- | tools/shared.py | 1 |
5 files changed, 12 insertions, 3 deletions
diff --git a/src/jsifier.js b/src/jsifier.js index 4af522b4..fe8aebe4 100644 --- a/src/jsifier.js +++ b/src/jsifier.js @@ -1567,9 +1567,11 @@ function JSify(data, functionsOnly, givenFunctions) { var shellParts = read(shellFile).split('{{BODY}}'); print(shellParts[1]); // Print out some useful metadata (for additional optimizations later, like the eliminator) - print('// EMSCRIPTEN_GENERATED_FUNCTIONS: ' + JSON.stringify(keys(Functions.implementedFunctions).filter(function(func) { - return IGNORED_FUNCTIONS.indexOf(func.ident) < 0; - })) + '\n'); + if (EMIT_GENERATED_FUNCTIONS) { + print('// EMSCRIPTEN_GENERATED_FUNCTIONS: ' + JSON.stringify(keys(Functions.implementedFunctions).filter(function(func) { + return IGNORED_FUNCTIONS.indexOf(func.ident) < 0; + })) + '\n'); + } PassManager.serialize(); diff --git a/src/settings.js b/src/settings.js index 7caa5b92..21b6abcf 100644 --- a/src/settings.js +++ b/src/settings.js @@ -327,6 +327,8 @@ var EXPLICIT_ZEXT = 0; // If 1, generate an explicit conversion of zext i1 to i3 var NECESSARY_BLOCKADDRS = []; // List of (function, block) for all block addresses that are taken. +var EMIT_GENERATED_FUNCTIONS = 0; // whether to emit the list of generated functions, needed for external JS optimization passes + // Compiler debugging options var DEBUG_TAGS_SHOWING = []; // Some useful items: diff --git a/tests/runner.py b/tests/runner.py index 0368720d..aae4c460 100755 --- a/tests/runner.py +++ b/tests/runner.py @@ -507,6 +507,8 @@ if 'benchmark' not in str(sys.argv) and 'sanity' not in str(sys.argv) and 'brows ''' self.do_run(src, 'hello, world!') + assert 'EMSCRIPTEN_GENERATED_FUNCTIONS' not in open(self.in_dir('src.cpp.o.js')).read(), 'must not emit this unneeded internal thing' + def test_intvars(self): if self.emcc_args == None: return self.skip('needs ta2') diff --git a/tools/js_optimizer.py b/tools/js_optimizer.py index 69a5bb2b..52cae6e5 100644 --- a/tools/js_optimizer.py +++ b/tools/js_optimizer.py @@ -76,6 +76,8 @@ def run_on_js(filename, passes, js_engine, jcache): assert gen_end > gen_start pre = js[:gen_start] post = js[gen_end:] + if 'last' in passes: + post = post.replace(suffix, '') # no need to write out the metadata - nothing after us needs it js = js[gen_start:gen_end] else: pre = '' diff --git a/tools/shared.py b/tools/shared.py index 1f1016cd..d587a071 100644 --- a/tools/shared.py +++ b/tools/shared.py @@ -563,6 +563,7 @@ class Settings: if opt_level >= 1: Settings.ASSERTIONS = 0 Settings.DISABLE_EXCEPTION_CATCHING = 1 + Settings.EMIT_GENERATED_FUNCTIONS = 1 if opt_level >= 2: Settings.RELOOP = 1 if opt_level >= 3: |