diff options
author | Daniel Dragan <bulk88@hotmail.com> | 2015-07-30 02:00:07 -0400 |
---|---|---|
committer | Tony Cook <tony@develop-help.com> | 2015-08-12 14:49:55 +1000 |
commit | 9b669ea1e2997fbb78558e1fc0a7ecae3aa23af0 (patch) | |
tree | d48eb3f5011d45122e6976a92177c6a118651405 /gv.c | |
parent | 9728ed0a4dcaca9d7fddf6ce9c5736ed3aacd487 (diff) | |
download | perl-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 'gv.c')
-rw-r--r-- | gv.c | 4 |
1 files changed, 3 insertions, 1 deletions
@@ -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 |