summaryrefslogtreecommitdiff
path: root/op.c
diff options
context:
space:
mode:
authorDaniel Dragan <bulk88@hotmail.com>2015-07-30 02:00:07 -0400
committerTony Cook <tony@develop-help.com>2015-08-12 14:49:55 +1000
commit9b669ea1e2997fbb78558e1fc0a7ecae3aa23af0 (patch)
treed48eb3f5011d45122e6976a92177c6a118651405 /op.c
parent9728ed0a4dcaca9d7fddf6ce9c5736ed3aacd487 (diff)
downloadperl-9b669ea1e2997fbb78558e1fc0a7ecae3aa23af0.tar.gz
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.
Diffstat (limited to 'op.c')
-rw-r--r--op.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/op.c b/op.c
index 2c459403f4..ae1eb300d8 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);