On Feb 16, 2025, at 8:03 PM, Van Snyder via cctalk
<cctalk(a)classiccmp.org> wrote:
On Sun, 2025-02-16 at 18:52 -0500, Paul Koning via cctalk wrote:
For example, the EL-X8 has an addressing mode
for resolving
references through the "display" of static scopes in what looks like
a single operation.
When Tom Pennello was a grad student studying under Frank de Remer at
ACSC, he collected a big pile of codes in languages that had nested
lexical and dynamic scopes (such as recursive internal functions). He
found that chasing up-links was much faster than displays. In some
cases, creating and destroying the display took six times longer than
executing the function. I mentioned this to Malcolm Cohen and me
mumbled something about a "trampoline." I have no idea what that is.
I'm puzzled by that, since the display is a static data structure and updating it
takes only a few instructions for each call and fewer for a return.
"Trampolines" are how GCC handles nested functions, or at least that is the
traditional mechanism. I never really understood them other than to realize they involve
executable code on the stack -- which means they only work in some machines and some
operating systems. I think there is now a replacement mechanism that avoids this issue
but I don't remember the details. Why GCC didn't adopt displays isn't clear
to me.
paul