diff options
author | Father Chrysostomos <sprout@cpan.org> | 2013-08-09 18:00:22 -0700 |
---|---|---|
committer | Father Chrysostomos <sprout@cpan.org> | 2013-08-09 19:44:13 -0700 |
commit | d36ee5be0c1466cc557c9d9f328896dc96483962 (patch) | |
tree | 17d6c2b4b02e40a1ccc90982caed1f4b47e385b2 /toke.c | |
parent | 1dc74fdba201402174cfbd293adc42f5a0bafc22 (diff) | |
download | perl-d36ee5be0c1466cc557c9d9f328896dc96483962.tar.gz |
toke.c:S_incline: avoid vivifying GV under threads
Since c82ecf346 has been reverted by the previous commit, under
threads we are back to storing the name of the current file in the
cop, rather than a pointer to the GV. This means the GV may not even
have been created, so CopFILEGV will autovivify it. We can avoid
autovivifying it in those cases where we are not going to be copying
the lines anyway, which S_incline only does for string eval (when it
sees a #line directive). Even if the GV already exists, this makes
the check faster, as we no longer have to look it up by name when
parsing a file.
Diffstat (limited to 'toke.c')
-rw-r--r-- | toke.c | 6 |
1 files changed, 4 insertions, 2 deletions
@@ -1753,13 +1753,14 @@ S_incline(pTHX_ const char *s) if (t - s > 0) { const STRLEN len = t - s; - GV * const cfgv = CopFILEGV(PL_curcop); - if (cfgv && !PL_rsfp && !PL_parser->filtered) { + if (!PL_rsfp && !PL_parser->filtered) { /* must copy *{"::_<(eval N)[oldfilename:L]"} * to *{"::_<newfilename"} */ /* However, the long form of evals is only turned on by the debugger - usually they're "(eval %lu)" */ + GV * const cfgv = CopFILEGV(PL_curcop); + if (cfgv) { char smallbuf[128]; STRLEN tmplen2 = len; char *tmpbuf2; @@ -1803,6 +1804,7 @@ S_incline(pTHX_ const char *s) } if (tmpbuf2 != smallbuf) Safefree(tmpbuf2); + } } CopFILE_free(PL_curcop); CopFILE_setn(PL_curcop, s, len); |