<div dir="ltr"><font face="monospace">On Wed, Mar 10, 2021 at 9:51 PM Reid Kleckner <<a href="mailto:rnk@google.com">rnk@google.com</a>> wrote:<br>><br>> On Wed, Mar 10, 2021 at 6:35 AM Momchil Velikov <<a href="mailto:momchil.velikov@gmail.com">momchil.velikov@gmail.com</a>> wrote:<br>>><br>>> Just to be clear, the suggestion is to introduce `alignstack` to<br>>> affect argument alignment, while retaining<br>>> the current semantics for `align`?<br>>><br>>> Thus, a pointer argument having both `align(A)` and `alignstack(B)`<br>>> would itself be allocated at B boundary (if it happens to be passed in<br>>> memory),<br>>> while it would contain an A-aligned address?<br>><br>><br>> Yes, that's the proposal as I understand it.<br><br>Something is not quite right here.<br><br>We have up to three relevant alignment <span class="gmail_default" style="font-family:monospace,monospace;font-size:small">properties </span>for a parameter:</font><div><font face="monospace"> * the alignment of the parameter itself (if it happene<span class="gmail_default" style="font-family:monospace,monospace;font-size:small">s</span> to be passed in memory)</font></div><div><font face="monospace"> * if it's a pointer, the actual alignment of the pointed to memory (as an optimisation aid)</font></div><div><font face="monospace"> * if it's a `byval` or <span class="gmail_default" style="font-family:monospace,monospace;font-size:small">a </span>`byref` argument, the minimum alignment of the storage, allocated</font></div><div><font face="monospace"><span class="gmail_default" style="font-family:monospace,monospace;font-size:small">  </span> for the original argument value (ABI affecting).</font></div><div><font face="monospace"><br></font></div><div><div class="gmail_default" style="font-family:monospace,monospace;font-size:small">For non-pointer arguments `alignstack(N)` gives stack slot alignment.</div><div class="gmail_default" style="font-family:monospace,monospace;font-size:small">For pointer arguments, we retain that use of `alignstack(N)` and also have `align(M)` to give</div><div class="gmail_default" style="font-family:monospace,monospace;font-size:small">the actual alignment of the contained pointer.</div><div class="gmail_default" style="font-family:monospace,monospace;font-size:small"><br></div><div class="gmail_default" style="font-family:monospace,monospace;font-size:small">Now when we add `byval` or `byref` to the above, there is no attribute left to give the alignment</div><div class="gmail_default" style="font-family:monospace,monospace;font-size:small">of the allocated memory. We thought of using `alignstack(N)`, but that would leave us without a way</div><div class="gmail_default" style="font-family:monospace,monospace;font-size:small">to specify the pointer alignment itself.</div><div class="gmail_default" style="font-family:monospace,monospace;font-size:small"><br></div><div class="gmail_default" style="font-family:monospace,monospace;font-size:small">~chill</div><div class="gmail_default" style="font-family:monospace,monospace;font-size:small"><br></div></div>-- <br><div dir="ltr" class="gmail_signature" data-smartmail="gmail_signature"><div dir="ltr">Compiler scrub, Arm<br></div></div></div>