<div dir="ltr"><div dir="ltr"><div dir="ltr"><div>Thanks for all the detailed replies.</div><div><br></div><div>> You can't rely on x and y being laid out in any particular order even during multiple calls to stack_direction within a single compilation</div><div><br></div><div>But according to the assembly being generated, there is a fixed layout on the stack. I agree, the code is pretty ambiguous. But it should be well defined within the compiler. If it changes from compilation unit to compilation unit, so be it, at least given some specific instance of the function, it should be a constant.</div><div><br></div><div>> If there turned out to be a compelling enough use-case, an intrinsic could be added to get the result more efficiently.</div><div><br></div><div dir="ltr">We need this operation in Ruby, and generally in coroutines to know how to layout the stack. Some architectures decided it would be a great idea for the stack to grow upwards.</div><div dir="ltr"><br></div><div>- Where to put guard page.</div><div>- What should be the initial stack pointer.</div><div>- How to alloca for custom stack allocations.</div><div><br></div><div>Thanks</div><div>Samuel</div></div></div></div>