Repository navigation
Conversation
|
I've updated the overview to not reference things from the design repo. I've also tried to add some basic spec changes, though perhaps those would be better to just do directly in the rst files. Still haven't gotten around to the JavaScript-stuff. |
|
The alignment immediate on these operators is effectively ignored, right? If so, I think it should be removed (or specification of unnatural alignment should be made invalid). |
Elsewhere we discussed trapping if not at least naturally-aligned. Given that, I tend to agree that we could just drop alignment entirely. |
|
Makes sense, but I believe we were going to use the alignment u32 as the place to add a flag/index for accessing memories other than 0, right? So perhaps we should just keep the alignment but require it to be natural. |
| limits ::= 0x00 n:u32 => {min n, max e, notshared} | ||
| 0x01 n:u32 m:u32 => {min n, max m, notshared} | ||
| 0x11 n:u32 m:u32 => {min n, max m, shared} | ||
| ``` |
There was a problem hiding this comment.
Is the shared-unbounded case deliberately omitted? (i.e. 0x10 n:u32 => {min n, max e, shared})
And what is the text syntax?
There was a problem hiding this comment.
Yes, it is deliberately omitted. I can't remember what issue we discussed it, but it simplifies things if we can just assume the VM will reserve address space for the maximum size. Though I suppose if grow_memory is just best effort anyway, maybe it doesn't really make a difference.
Haven't really thought of a text syntax yet. I guess it could just be:
(memory <min> <max> shared)
There was a problem hiding this comment.
We're worried about having to suspend all threads if we need to physically move the memory. If max is specified we know we'll never need to move the memory because the virtual memory was pre-allocated, and only page protections or bounds need to be changed which doesn't require thread suspension.
It's easy to add later, so I'm not too worried. It would be good to document, and point at the experience from NaCl. IIRC the issues around suspension were documented in its codebase.
There was a problem hiding this comment.
I can't seem to find the place in the NaCl source that talks about the difficulty in thread suspension. But I'll add a comment about it generically, and we can add further references later.
| memory. The operators have sequentially consistent ordering. | ||
|
|
||
| Both wake and wait operators trap if the effective address of either operator | ||
| is misaligned or out-of-bounds. |
There was a problem hiding this comment.
"Misaligned" for wake means 4 byte aligned, right? This should be spelled out, or perhaps wake shouldn't care about alignment.
There was a problem hiding this comment.
Good point, I've explicitly mentioned wake requires 4-byte alignment.
|
|
||
| `grow_memory` of a shared linear memory is allowed, but may fail if the new | ||
| size is greater than the specified maximum size, or if reserving the additional | ||
| memory fails. All agents in the executing agent's cluster will have access to |
There was a problem hiding this comment.
This wording makes it a little unclear that grow_memory always fails if the new size is greater than the specified maximum size, which is what I assume is intended here. Possible wording suggestion:
grow_memory of a shared linear memory is allowed. Like non-shared memory, it fails if the new size is greater than the memory's maximum size, and it may also fail if reserving the additional memory fails.
There was a problem hiding this comment.
Thanks, I've used this wording.
|
OK, first pass of the JS API changes. PTAL |
|
|
||
| If `m` is shared, any attempts to [detach][] `buffer` shall throw a | ||
| [TypeError][]. Otherwise, any attempts to [detach][] `buffer` _other_ than the | ||
| detachment performed by `m.grow` shall throw a [TypeError][]. |
There was a problem hiding this comment.
To confirm: shared memory grow detatches the SAB?
There was a problem hiding this comment.
No, I guess this should be clearer. The "Otherwise" is meant to refer to when m is not shared; a SAB is never detached.
|
|
||
| However, the `memoryDescriptor` now will check for a `shared` property: | ||
|
|
||
| If [`HasProperty`][](`"shared"`), then let `shared` be |
There was a problem hiding this comment.
The usual ES conventions is to not use HasProperty in such situations (e.g. because it is an observable extra call with proxies), but handle undefined as a result of Get appropriately. Fortunately, undefined, already converts to false, so you can just drop the check without substitute.
|
Wait, when has the opcode prefix changed to F0? As long as the only motivation for that remains being silly, it still is not worth the price of unnecessary opcode space fragmentation IMO. |
|
r.e. opcode prefix: I don't really care either way, but both you and @jfbastien have argued for different codes. It doesn't seem like there's a strong technical argument either way, and we don't have a policy for opcode layout. Perhaps we should? This sort of thing is going to keep coming up. |
|
Aside from the opcode prefix, are there any other issues that I should address before landing this overview? |
jfbastien
left a comment
There was a problem hiding this comment.
As a first draft this lgtm.
|
OK, landing w/ lgtm. |
For now this is just copied from WebAssembly/design#1019, since I haven't had a chance to work on the proposal much. I'll address some of the feedback there soon.