Repository navigation
Conversation
…as trying to grow to 2GB would fail. Also fix a misleading variable name in heap.h
This was referenced Feb 28, 2020
dschuff
approved these changes
Mar 3, 2020
kripken
added a commit
that referenced
this pull request
Mar 26, 2020
…10601) To support that mode add a JS optimizer pass that fixes up pointers in JS libraries. Doing this as a pass is nice because our JS libraries can still be written with signed pointers, which is smaller and may be faster on some VMs (signed values fit in 31-bit smis). This will fix up user code as well, automatically. The pass looks for HEAP8 etc. symbols on which we do HEAP8[something] and ensures the pointer is unsigned. It also fixes up .set() and other calls that receive pointers. One compromise the pass makes is that it looks not just for the canonical HEAP8 etc. names but also HEAP and heap. Those are used in our JS library code a bunch, so fixing those up too prevents a lot more work in that code, and can help user code too. There is some risk to doing so, if a user has code with that name but actually doesn't want the unsigning; however, the risk is small (we just force their indexes on an array to be non-negative; likely they don't want that anyhow!), and I think the reverse risk (a user has code that should be changed, but forgets) is much more likely, so this seems safest. A later PR will add our JS library fixes, which will show that even with this extension there is still code that must be handled manually, so I think it's best to do as much automatically as we can. This also changes MAXIMUM_MEMORY to be 2GB. That is effectively no change from the previous -1 (no limit) since 2GB was the absolute limit anyhow. This has two benefits: first, people must opt-in explicitly to getting 2GB+ heap support with the code size downside, and also we expect only some browsers will support 2GB+ heaps for now, so requiring explicit opt-in from devs is safer to avoid web compat issues (i.e., only users that really need such heaps will set them, and then they may only work in some browsers, but at least that won't happen for users that could actually run in all browsers). Note that emmalloc is not designed to work with 2GB+ heaps, so show a useful error in that case. This is a minor breaking change for users in that building with emmalloc + memory growth will hit the error, forcing the user to set a maximum to the growth. This is part of a set of 3+ PRs for #6566, together with #10600
kripken
added a commit
that referenced
this pull request
Mar 26, 2020
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This just removes the restriction. The check was not actually
necessary before as we check this when growing memory anyhow.
Turns out this save some code size.
Also rename a parameter that had a misleading name which
I noticed while doing this.
This is part of a set of 3+ PRs for #6566