diff options
author | Alon Zakai <alonzakai@gmail.com> | 2013-03-18 13:42:32 -0700 |
---|---|---|
committer | Alon Zakai <alonzakai@gmail.com> | 2013-03-18 13:42:32 -0700 |
commit | 5685df86fd3a64f5b0e4acfbebab39559b96455d (patch) | |
tree | 721e8c480a7a6c29830eea9e5000236996a864e8 /src | |
parent | cc35ae70ece1f93a23bd666bda395fbb697bbda8 (diff) |
add option to turn all unresolved references into dead functions (i.e., no compile-time warnings or errors, instead runtime aborts
Diffstat (limited to 'src')
-rw-r--r-- | src/jsifier.js | 2 | ||||
-rw-r--r-- | src/settings.js | 8 |
2 files changed, 8 insertions, 2 deletions
diff --git a/src/jsifier.js b/src/jsifier.js index 5c718c09..7db2ee70 100644 --- a/src/jsifier.js +++ b/src/jsifier.js @@ -512,7 +512,7 @@ function JSify(data, functionsOnly, givenFunctions) { } else if (LibraryManager.library.hasOwnProperty(shortident)) { item.JS = addFromLibrary(shortident); } else if (!LibraryManager.library.hasOwnProperty(shortident + '__inline')) { - if (!(item.ident in DEAD_FUNCTIONS)) { + if (!(item.ident in DEAD_FUNCTIONS) && !UNRESOLVED_AS_DEAD) { item.JS = 'var ' + item.ident + '; // stub for ' + item.ident; if (ASM_JS) { throw 'Unresolved symbol: ' + item.ident + ', this must be corrected for asm.js validation to succeed. Consider adding it to DEAD_FUNCTIONS.'; diff --git a/src/settings.js b/src/settings.js index b342ae6d..c7ed7cd2 100644 --- a/src/settings.js +++ b/src/settings.js @@ -344,8 +344,14 @@ var PGO = 0; // Enables profile-guided optimization in the form of runtime check // can pass to DEAD_FUNCTIONS (you can also emit the list manually by // calling PGOMonitor.dump()); var DEAD_FUNCTIONS = []; // A list of functions that no code will be emitted for, and - // a runtime abort will happen if they are called + // a runtime abort will happen if they are called. If + // such a function is an unresolved reference, that is not + // considered an error. // TODO: options to lazily load such functions +var UNRESOLVED_AS_DEAD = 0; // Handle all unresolved functions as if they were in the + // list of dead functions. This is a quick way to turn + // all unresolved references into runtime aborts (and not + // get compile-time warnings or errors on them). var EXPLICIT_ZEXT = 0; // If 1, generate an explicit conversion of zext i1 to i32, using ?: |