This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
[perl #89544] Non-eval closures don’t need CvOUTSIDE
authorFather Chrysostomos <sprout@cpan.org>
Wed, 20 Jun 2012 21:23:02 +0000 (14:23 -0700)
committerFather Chrysostomos <sprout@cpan.org>
Wed, 20 Jun 2012 22:54:05 +0000 (15:54 -0700)
commita0d2bbd5c47035a4f7369e4fddd46b502764d86e
tree175a61f41be9b43ee8d21ada2d05a4748cbf717a
parent60d91a71fad08b06816b91400592863df5f10d47
[perl #89544] Non-eval closures don’t need CvOUTSIDE

A closure doesn’t need an outside pointer at run time, unless it has a
string eval in it.  CvOUTSIDE is only used at compilation time to look
up variables by name.

Since CvOUTSIDE is reference-counted, a closure can unnecessarily hang
on to variables it is not using (see the test in the diff).  So stop
setting it when cloning a closure, unless it is needed for eval.
cv.h
pad.c
t/op/closure.t