[OpenBIOS] [PATCH 1/3] bootstrap.fs: add pseudo r-stack implementation for interpret mode
Segher Boessenkool
segher at kernel.crashing.org
Mon Jul 18 00:27:25 CEST 2016
On Sun, Jul 17, 2016 at 09:51:23PM +0100, Mark Cave-Ayland wrote:
> >> Regarding the documentation, I wasn't too worried about this since it's
> >> fairly obvious that calling another word is going to involve another
> >> r-stack push from the caller (and indeed it was the first thing that
> >> stood out when I tried your code in the debugger).
> >
> > It surprises me every. single. time.
>
> Really?!?
Yes. I also use systems that do not use the traditional implementation
approach (return address not on the return stack, DO loop counters not
on the return stack, etc. -- Apple OF has both of these, or the latter
at least, I can never remember such things).
And I did write TOES> so I really should be able to handle juggling
two stacks. Sigh.
> >> If you would like to suggest something suitable in a maximum of a couple
> >> of lines you think would help then I don't mind adding it in a v2,
> >> however compared to other undocumented gotchas in the Forth code I've
> >> come across whilst working on OpenBIOS this was very easy to figure out
> >> so I can't get too excited about it.
> >
> > \ WARNING: Deep magic ahead!
>
> Ha! If this were the general guideline then that comment would be
> replicated a lot throughout the entire OpenBIOS codebase so I'll give
> this a miss for now ;)
:-)
Ideally, most code should not have any trickiness to it.
Segher
More information about the OpenBIOS
mailing list