This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
Perl_doref(): make non-recursive
authorDavid Mitchell <davem@iabyn.com>
Fri, 31 May 2019 10:58:11 +0000 (11:58 +0100)
committerDavid Mitchell <davem@iabyn.com>
Mon, 24 Jun 2019 10:40:07 +0000 (11:40 +0100)
commite9b0092a1019a24f6bb26933c7b796c2b733d11f
tree7b4966121338e793bf13275d5370ce7ec8f9e9e0
parentfe4e86b8d83215d20fe96e969c5fb5cb133fe090
Perl_doref(): make non-recursive

This stops the following code from SEGVing for example:

    my $e = "\$r";
    $e = "+do{$e}" for 1..70_000;
    $e = "push \@{$e}, 1";
    eval $e;

Similarly with a long

    $a[0][0][0][0].....

This commit causes a slight change in behaviour, in that scalar(o)
is now only called once at the end of the top-level doref() call,
rather than at the end of processing each child. This should make no
functional difference, apart from speeding up compiling infinitesimally.
op.c