In perl.git, the branch blead has been updated

<http://perl5.git.perl.org/perl.git/commitdiff/9b669ea1e2997fbb78558e1fc0a7ecae3aa23af0?hp=9728ed0a4dcaca9d7fddf6ce9c5736ed3aacd487>

- Log -----------------------------------------------------------------
commit 9b669ea1e2997fbb78558e1fc0a7ecae3aa23af0
Author: Daniel Dragan <bul...@hotmail.com>
Date:   Thu Jul 30 02:00:07 2015 -0400

    dont create *{"_<$filename"} globs for perl lang debugging of XSUBs
    
    1st problem, *{"_<$filename"} globs aren't created for PP code unless
    PERLDB_LINE || PERLDB_SAVESRC are on (see Perl_yylex ). Creating XSUBs
    unconditionally created the *{"_<$filename"} globs for XSUB, even if PP
    subs were not getting the debugging globs created. This is probably an
    oversight, from commit b195d4879f which tried to deprecate using
    the *{"_<$filename"} GVs for storing the originating filename of the CV
    which was partially reverted 2 months later in commit 57843af05b with
    CvFILE becoming a char * instead of GV *. To speed up XSUB registration
    time, and decrease memory when not in Perl lang debugging mode dont create
    the debugging globs for XSUBs unless in Perl lang debugging mode.
    
    see also
    http://www.nntp.perl.org/group/perl.perl5.porters/2000/06/msg13832.html
    
    2nd problem, since the perl debugger can't step into C code, nor set
    breakpoints in it, there is no reason to create *{"_<$filename"} globs
    for .c files. Since someone maybe one day might try to implement that
    feature, comment out the code instead of deleting it. This will slightly
    reduce the size of perl binary, and speed up XSUB registration time, and
    decrease memory usage when using the Perl debugger.
    
    see also (no responses)
    http://www.nntp.perl.org/group/perl.perl5.porters/2015/06/msg229014.html
    
    perl has a number of core perma-XSUBs
    (UNIVERSAL/PerlIO/DynaLoader/Internals/mro/misc const subs/etc). Each of
    these previously got a "_<foo.c" glob. I counted 7 .c debugging globs on
    my perl. This commit, before on WinXP, running threaded perl with
    -e"system 'pause'" as a sample script, "Private Bytes" (all process
    unique memory, IE not shared, not mmaped) was 488 KB, after this commit
    it was 484 KB, which means that enough malloc memory was saved plus a
    little bit of chance, to cross one 4 KB page of memory. IDK the exact
    amount of saved memory is over or under 4KB.
-----------------------------------------------------------------------

Summary of changes:
 gv.c              | 4 +++-
 op.c              | 4 +++-
 pod/perldelta.pod | 8 +++++++-
 util.c            | 4 +++-
 4 files changed, 16 insertions(+), 4 deletions(-)

diff --git a/gv.c b/gv.c
index 651a7aa..5ffc7fe 100644
--- a/gv.c
+++ b/gv.c
@@ -572,7 +572,9 @@ S_maybe_add_coresub(pTHX_ HV * const stash, GV *gv,
     }
     CvGV_set(cv, gv); /* This stops new ATTRSUB from setting CvFILE
                          from PL_curcop. */
-    (void)gv_fetchfile(file);
+    /* XSUBs can't be perl lang/perl5db.pl debugged
+    if (PERLDB_LINE_OR_SAVESRC)
+        (void)gv_fetchfile(file); */
     CvFILE(cv) = (char *)file;
     /* XXX This is inefficient, as doing things this order causes
            a prototype check in newATTRSUB.  But we have to do
diff --git a/op.c b/op.c
index 2c45940..ae1eb30 100644
--- a/op.c
+++ b/op.c
@@ -9116,7 +9116,9 @@ Perl_newXS_len_flags(pTHX_ const char *name, STRLEN len,
 
         CvGV_set(cv, gv);
         if(filename) {
-            (void)gv_fetchfile(filename);
+            /* XSUBs can't be perl lang/perl5db.pl debugged
+            if (PERLDB_LINE_OR_SAVESRC)
+                (void)gv_fetchfile(filename); */
             assert(!CvDYNFILE(cv)); /* cv_undef should have turned it off */
             if (flags & XS_DYNAMIC_FILENAME) {
                 CvDYNFILE_on(cv);
diff --git a/pod/perldelta.pod b/pod/perldelta.pod
index 6ace170..8ae82cf 100644
--- a/pod/perldelta.pod
+++ b/pod/perldelta.pod
@@ -89,7 +89,13 @@ There may well be none in a stable release.
 
 =item *
 
-XXX
+Creating Perl debugger data structures (see L<perldebguts/"Debugger 
Internals">)
+for XSUBs and const subs has been removed.  This removed one glob/scalar combo
+for each unique C<.c> file that XSUBs and const subs came from.  On startup
+(C<perl -e"0">) about half a dozen glob/scalar debugger combos were created.
+Loading XS modules created more glob/scalar combos.  These things were created
+regardless if the perl debugger was being used or not, unlike for pure perl
+subs, and ignores that the perl debugger can not debug C code.
 
 =back
 
diff --git a/util.c b/util.c
index 0a2c11e..e357379 100644
--- a/util.c
+++ b/util.c
@@ -5452,7 +5452,9 @@ Perl_xs_handshake(const U32 key, void * v_my_perl, const 
char * file, ...)
        SAVEPPTR(PL_xsubfilename);/* which was require'd from a XSUB BEGIN */
        PL_xsubfilename = file;   /* so the old name must be restored for
                                     additional XSUBs to register themselves */
-       (void)gv_fetchfile(file);
+       /* XSUBs can't be perl lang/perl5db.pl debugged
+       if (PERLDB_LINE_OR_SAVESRC)
+           (void)gv_fetchfile(file); */
     }
 
     if(key & HSf_POPMARK) {

--
Perl5 Master Repository

Reply via email to