-
Notifications
You must be signed in to change notification settings - Fork 3.4k
Fix for undefined ASSERTIONS
variable in html output of emcc
#5749
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix for undefined ASSERTIONS
variable in html output of emcc
#5749
Conversation
* Some new externs added to please Closure Compiler, small tweaks to resolve some issues with newer version * Rewrite multiple `f.write()` calls into single call with more readable JavaScript code inside * Google Closure Compiler updated to latest v20171023.0.0 * Fix for multiple duplicated `var ptr` declarations. Fixes to externs (added File API externs). * Suppress a lot of warnings that naturally occur in asm.js code * Closure Compiler should run without errors now (warnings are present, but don't cause everything to fail) * Fix JS optimizer to properly work with added suppression comment (resulted in corrupted JS build). More externs fixes. * WebIDL fixes for modern Closure Compiler * Removed externs already included in latest Closure Compiler * Fix for multiple declarations of `ASSERTION` variable. Fix for `EmterpreterAsync` usage appearing in builds without `EmterpreterAsync` definition. Suppress `FUNCTION_TABLE` undefined variable. Fix for `getterReturnType` and `setterArgumentType` used while undefined (probably copy-paste typo, replaced with `rawFieldType`). * Suppress errors about undefined variables
Cool, that solution looks good to me, and seems to work as described for me locally. As far as the comment, I think you may have misinterpreted it, but this diff from when it was added should clear up the meaning: tl;dr: One function with a simple |
But now having |
That comment was about It seems like it could be a lot more clear, though. Maybe change it to something like |
Do we need |
Well, it is an exceptional situation anyway, so I went ahead and simplified it even further to single function. Shouldn't make any real-world difference even without Closure Compiler post-processing. Does it make sense? |
I'd originally written it pretty much the same way as you're suggesting, but @kripken specifically requested duplicating it: #5296 (comment) That is an interesting point about Closure. I believe Closure output requires access to Edit: Since that link doesn't seem to work, here's the relevant comment:
|
I don't think it ever requires If that was a performance concern, I've just prepared benchmark that compares performance of the example with My Chromium Nightly and Firefox Nightly do not see any measurable difference. So either it is not the case at all or it was fixed in V8 and other JavaScript engines already. |
Awesome. I was just speaking about As far as the |
Yeah, this seems good. The benchmark doesn't actually reach the ASSERTIONS check (the variable isn't defined, so it would throw, unless I'm missing something), but that's fine as it's the expected case anyhow. So perhaps we were overly cautious before. |
Looks good in local testing too. Just waiting on CI. |
It seems to be specific to HTML builds, since
src/arrayUtils.js
doesn't defineASSERTIONS
anymore (https://github.com/kripken/emscripten/pull/5720/files#diff-86414f2ed951321c81d9a4aa55bb139cL13).Also removed comment (left from the PR linked above): it indicated that previously the code didn't work at all, but should start working with this PR.
@buu700, did I interpret it correctly?
This is a response to 93479ec#commitcomment-25492064