You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I can't find anything in the spec interpreter that defines the default alignment of loads/stores. If an align= attribute is omitted, then the memop's align member is None, and the evaluator just ignores the alignment. Can it be made more explicit what the default alignment is?
The evaluator alwaysignores alignment. The intention is that None means "no hint" and therefore natural alignment. But I guess I can see confusion with None meaning "completely unaligned" (i.e., align=1), so it'd be just as well to remove the option and make align an int that parser.mly fills in when missing.
Plus we should perhaps define this in the design no? I looked quickly and did not see much information about the lack of information on alignment and what it implied.
If we keep alignment an option, then yes, it'd make sense for AstSemantics.md to say the hint is optional and, when not present, natural alignment should be assumed. If the alignment is changed to a non-optional int, then it's a syntactic sugar detail of the sexpr language that the align immediate is optional.
Seems bizarre to me to say that we have to do align for a load but the immediate is optional.
(i32.load align (i32.const 0)) seems just overkill. I really think that the default should be that it is optional and if not there, it is defined in the AstSemantics.md as then meaning the load is of natural alignment.
Seems bizarre to me to say that we have to do align for a load but the
immediate is optional.
(i32.load align (i32.const 0)) seems just overkill. I really think that
the default should be that it is optional and if not there, it is defined
in the AstSemantics.md as then meaning the load is of natural alignment.
—
Reply to this email directly or view it on GitHub #158 (comment).
The s-expr language offers a variety of syntactic sugar wherein you can omit things and the obvious default AST node is generated. Having a missing align attribute imply natural alignment seems to be no different. Thus, (i32.load (i32.const 0)) would imply align=4. From AstSemantics.md POV (as it is currently written), there is always an alignment immediate, so no need to say what the default is. However, as I said above, we could change AstSemantics.md to say "alignment is optional, when missing natural alignment is assumed". I think it's all just a matter of subjective preference until we get to the binary encoding.
Activity
lukewagner commentedon Nov 2, 2015
The evaluator always ignores alignment. The intention is that
Nonemeans "no hint" and therefore natural alignment. But I guess I can see confusion withNonemeaning "completely unaligned" (i.e.,align=1), so it'd be just as well to remove theoptionand makealignanintthatparser.mlyfills in when missing.jcbeyler commentedon Nov 3, 2015
Plus we should perhaps define this in the design no? I looked quickly and did not see much information about the lack of information on alignment and what it implied.
lukewagner commentedon Nov 3, 2015
If we keep alignment an
option, then yes, it'd make sense for AstSemantics.md to say the hint is optional and, when not present, natural alignment should be assumed. If the alignment is changed to a non-optionalint, then it's a syntactic sugar detail of the sexpr language that thealignimmediate is optional.jcbeyler commentedon Nov 3, 2015
Seems bizarre to me to say that we have to do align for a load but the immediate is optional.
(i32.load align (i32.const 0)) seems just overkill. I really think that the default should be that it is optional and if not there, it is defined in the AstSemantics.md as then meaning the load is of natural alignment.
titzer commentedon Nov 3, 2015
I think Luke was suggesting that the hint missing means that the access is
assumed to be aligned.
So:
(i32.load (i32.const 0))
and
(i32.load unaligned (i32.const 1))
?
On Tue, Nov 3, 2015 at 6:52 AM, jcbeyler [email protected] wrote:
lukewagner commentedon Nov 4, 2015
The s-expr language offers a variety of syntactic sugar wherein you can omit things and the obvious default AST node is generated. Having a missing
alignattribute imply natural alignment seems to be no different. Thus,(i32.load (i32.const 0))would implyalign=4. From AstSemantics.md POV (as it is currently written), there is always an alignment immediate, so no need to say what the default is. However, as I said above, we could change AstSemantics.md to say "alignment is optional, when missing natural alignment is assumed". I think it's all just a matter of subjective preference until we get to the binary encoding.rossberg commentedon Feb 25, 2016
This has been resolved.
Add a note for WebAssembly.Memory.prototype.grow return value (WebAss…
Fix typo (WebAssembly#158)
Move /spectec/spec directory to /specification (WebAssembly#158)
Add a note for WebAssembly.Memory.prototype.grow return value (WebAss…