On Tue, 18 Jan 2022 at 06:52, Tony Cook <tony@develop-help.com> wrote: > On Mon, Jan 17, 2022 at 06:28:19PM +0000, Paul "LeoNerd" Evans wrote: > > since in order to make pp_arg* work at all we still have to > > copy the args to the AV found in PAD_SVl(0). > > (Sorry I can't type a lot right now.) > > Can't entersub leave the arguments (and mark) on the stack for a > signature sub and pp_argelem access the arguments on the stack > instead? > > The final argelem would need to pop the mark and clean up the stack. > > This would save the cost of setting up the AV. > That sounds like a big change in behaviour? It seems like this would lead to the following situation: - everything in the signature is now an alias instead of a copy - signature args are no longer refcounted (stack-not-refcounted has long been a source of various problems!) The first one would lead to very surprising behaviour with cases like `sub ltrim ($x) { $x =~ s{^\s+}{}; $x }`, and the second likewise for lexical captures such as `(sub ($x) { sub { $x } })->($thing_that_drops_out_of_scope_shortly_after)`.Thread Previous | Thread Next