What's happening is that the function is being inlined completely rather than producing a local call or explicit closure, thus not introducing a new stack frame (and thus a complete closure environment) but a different physenv is still involved, leading the IR2 conversion of the REF node to believe that an ANCESTOR-FRAME-REF is required, and for some reason it picks up the /calling/ frame to read from.
Thank you!
What's happening is that the function is being inlined completely rather than producing a local call or explicit closure, thus not introducing a new stack frame (and thus a complete closure environment) but a different physenv is still involved, leading the IR2 conversion of the REF node to believe that an ANCESTOR-FRAME-REF is required, and for some reason it picks up the /calling/ frame to read from.