<div dir="ltr">I am afraid the frame pointer is really needed.<br></div><div class="gmail_extra"><br><div class="gmail_quote">On Thu, Oct 12, 2017 at 8:51 AM, Andreas Pirklbauer <span dir="ltr"><<a href="mailto:andreas_pirklbauer@yahoo.com" target="_blank">andreas_pirklbauer@yahoo.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div style="word-wrap:break-word"><span style="font-family:monospace;white-space:pre-wrap">> </span><font face="monospace"><span style="white-space:pre-wrap">I forgot to add that this approach of course invalidates
> the stack pointer (SP) itself. So one would need to find
> a different way in fact.

One option would be this: </span></font><div><font face="monospace"><span style="white-space:pre-wrap"><br></span></font></div><div><font face="monospace"><span style="white-space:pre-wrap">For leaf procedures (i.e. </span></font><font face="monospace"><span style="white-space:pre-wrap">procedures </span></font><span style="white-space:pre-wrap;font-family:monospace">which do not themselves</span></div><div><span style="white-space:pre-wrap;font-family:monospace">call other procedures), </span><span style="font-family:monospace;white-space:pre-wrap">the procedure NEW(a, size) can freely</span></div><div><span style="font-family:monospace;white-space:pre-wrap">use the unused stack space that </span><span style="white-space:pre-wrap;font-family:monospace">comes after current stack frame</span></div><div><span style="white-space:pre-wrap;font-family:monospace">- it </span><span style="font-family:monospace;white-space:pre-wrap">is not used anyway, so it does no harm to place data there.</span></div><div><div><span style="font-family:monospace;white-space:pre-wrap"><br></span></div><div><span style="font-family:monospace;white-space:pre-wrap">For non-leaf procedures (i.e. procedures that *do* call other</span></div><div><span style="font-family:monospace;white-space:pre-wrap">procedures), you insert an instruction that adjusts </span><span style="font-family:monospace;white-space:pre-wrap">the SP by</span></div><div><span style="font-family:monospace;white-space:pre-wrap">the total amount of the allocations so far just before the</span></div><div><span style="font-family:monospace;white-space:pre-wrap">other procedure is called, and </span><span style="font-family:monospace;white-space:pre-wrap">readjust it when it returns.</span></div><div><span style="font-family:monospace;white-space:pre-wrap"><br></span></div><div><font face="monospace"><span style="white-space:pre-wrap">But as I said, I haven’t thought more deeply about this..</span></font></div></div><div><font face="monospace"><span style="white-space:pre-wrap"><br></span></font></div><div><font face="monospace"><span style="white-space:pre-wrap"><br></span></font></div><div><font face="monospace"><span style="white-space:pre-wrap"><br></span></font></div><div><font face="monospace"><span style="white-space:pre-wrap"><br></span></font></div></div><br>--<br>
<a href="mailto:Oberon@lists.inf.ethz.ch">Oberon@lists.inf.ethz.ch</a> mailing list for ETH Oberon and related systems<br>
<a href="https://lists.inf.ethz.ch/mailman/listinfo/oberon" rel="noreferrer" target="_blank">https://lists.inf.ethz.ch/<wbr>mailman/listinfo/oberon</a><br>
<br></blockquote></div><br></div>