In perl.git, the branch blead has been updated

<https://perl5.git.perl.org/perl.git/commitdiff/7d65f652cb34981f4cb53a56496f5712f740d496?hp=445198b9b50e1018da1c98005a88bdf15c964f23>

- Log -----------------------------------------------------------------
commit 7d65f652cb34981f4cb53a56496f5712f740d496
Author: Father Chrysostomos <spr...@cpan.org>
Date:   Fri Nov 10 13:57:33 2017 -0800

    perldelta for reënabling of CV optimization

commit d96402565ccd7459d3a8bc4074f177d00bbefeeb
Author: Father Chrysostomos <spr...@cpan.org>
Date:   Sun Oct 29 11:21:45 2017 -0700

    Revert "Temporarily revert CV-in-stash optimisation"
    
    This reverts commit 6eed25e2537643b77650cb3e4514ec9dc2e97d74.

-----------------------------------------------------------------------

Summary of changes:
 op.c              |  2 +-
 pod/perldelta.pod | 24 ++++++++++++++++++++++++
 t/op/sub.t        |  1 -
 3 files changed, 25 insertions(+), 2 deletions(-)

diff --git a/op.c b/op.c
index c61bfd08de..368f9b146e 100644
--- a/op.c
+++ b/op.c
@@ -9617,7 +9617,7 @@ Perl_newATTRSUB_x(pTHX_ I32 floor, OP *o, OP *proto, OP 
*attrs,
           sub is stored in.  */
        const I32 flags =
           ec ? GV_NOADD_NOINIT
-             :   PL_curstash != CopSTASH(PL_curcop)
+             :   (IN_PERL_RUNTIME && PL_curstash != CopSTASH(PL_curcop))
               || memchr(name, ':', namlen) || memchr(name, '\'', namlen)
                    ? gv_fetch_flags
                    : GV_ADDMULTI | GV_NOINIT | GV_NOTQUAL;
diff --git a/pod/perldelta.pod b/pod/perldelta.pod
index fbd5e9cacd..51953078c3 100644
--- a/pod/perldelta.pod
+++ b/pod/perldelta.pod
@@ -79,6 +79,24 @@ The parsing has now been made consistent, permitting 
yada-yada only as
 a statement.  Affected code can use C<do{...}> to put a yada-yada into
 an arbitrary expression context.
 
+=head2 Subroutines no longer need typeglobs
+
+Perl 5.22.0 introduced an optimization allowing subroutines to be stored in
+packages as simple sub refs, not requiring a full typeglob (thus
+potentially saving large amounts of memeory).  However, the optimization
+was flawed: it only applied to the main package.
+
+This optimization has now been extended to all packages.  This may break
+compatibility with introspection code that looks inside stashes and expects
+everything in them to be a typeglob.
+
+When this optimization happens, the typeglob still notionally exists, so
+accessing it will cause the stash entry to be upgraded to a typeglob.  The
+optimization does not apply to XSUBs or exported subroutines, and calling a
+method will undo it, since method calls cache things in typeglobs.
+
+[perl #129916] [perl #132252]
+
 =head1 Deprecations
 
 XXX Any deprecated features, syntax, modules etc. should be listed here.
@@ -155,6 +173,12 @@ In addition, C<sprintf> expressions which have a constant 
format
 containing only C<%s> and C<%%> format elements, and which have a fixed
 number of arguments, are now also optimised into a C<multiconcat> op.
 
+=item *
+
+Subroutines in packages no longer need to be stored in typeglobs, saving
+large amounts of memory.  See L</Subroutines no longer need typeglobs>
+under L</Incompatible Changes>, above.
+
 =back
 
 =head1 Modules and Pragmata
diff --git a/t/op/sub.t b/t/op/sub.t
index 5c501b181e..f73abb455f 100644
--- a/t/op/sub.t
+++ b/t/op/sub.t
@@ -423,7 +423,6 @@ is ref($main::{rt_129916}), 'CODE', 'simple sub stored as 
CV in stash (main::)';
     sub foo { 42 }
 }
 {
-    local $TODO = "CV symbol table optimization only works in main:: [perl 
#129916]";
     is ref($RT129916::{foo}), 'CODE', 'simple sub stored as CV in stash 
(non-main::)';
 }
 

-- 
Perl5 Master Repository

Reply via email to