-
Notifications
You must be signed in to change notification settings - Fork 693
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
current_memory doesn't seem useful #904
Comments
I assumed we were not going to allow |
I disagree, and think we'll allow growing SABs. It'll likely require threads checking in to avoid issues you mention, but disallowing it because it's hard seems to be the wrong tradeoffs for developers. |
I think the only good reason to remove |
To draw another parallel to C++: Don't be that method! |
@binji Just to answer your question in a bit more detail: I think we only want to allow sharing a @jfbastien That's a good question. Practically speaking, the only code that will use @kripken Do you know if Binaryen ever emits it? |
@lukewagner thanks, that makes sense. Removing |
That's outside of wasm 😉 |
@lukewagner: looks like asm2wasm doesn't (as you said, the malloc bookkeeping is done elsewhere) but the wasm backend might, s2wasm has code to translate it and it is in the s2wasm tests. Perhaps that's out of date though, @sunfishcode or @dschuff should know. |
The s2wasm support is there because we added a way to emit current_memory through LLVM, however I'm not aware of anyone making use of it yet. |
Ok, so then this probably wouldn't be much of a breaking change, and one we could do in-place (noting the change on webassembly.org/roadmap). One thing I just noticed is that technically, according to current semantics, |
I don't see the value of removing |
(Well, not semantically equivalent to |
@titzer as I detailed above, when we add threads it will not have the same synchronization guarantees unless we make it more than a mere relaxed load. The point @lukewagner makes is interesting though. It detaches the
That's not the case, right? Further, the above sharing may be a valid usecase for WDYT? |
@jfbastien The You're also right that when multiple |
Well, concurrent I can think of a single use case that requires a reasonably fast |
@pipcet Agreed that malloc impls will need their own synchronized internal bookkeeping. That's a good use case for which |
Agreed that's what we want. I want to ensure that's what the spec says.
Right, that's why I'm asking: is
I don't think that's what was should be done: there should be a single, dynamically-linked, |
@jfbastien Can you explain in what sense I also fail to see why To reiterate: I think the ABI should provide a canonical memory location which contains the current memory limit. If and when our view of memory becomes more complicated than a linear memory starting at 0 and being fully readable and writable, we can extend that, and maybe add a @lukewagner I'm not sure I'm reading that right. If we have a synchronized variable containing the current memory limit, why bother with |
@pipcet you need some module which tracks total heap size, and which blocks are allocated / free'd. Why even expose something in the ABI? I'd rather have But all this is orthogonal to the issue: we seem to agree |
@pipcet Well if one wants to test whether a given pointer is in-bounds, one may not know/care what malloc (or other memory mgmt scheme) is being used. For that use |
Considering this has been shipped in FF and Chrome, I think it's too late to change. |
I'm worried that when we add threads it'll be actively misleading because of TOCTOU (same mistake as the POSIX filesystem APIs). We'll have to make it a sequentially-consistent operation as well, to prevent IRIW problems, which means it's a tool to implement Dekker's (same as some library functions in C++).
It's probably better to drop it.
The text was updated successfully, but these errors were encountered: