Sébastien Aperghis-Tramoni [Thu, 6 Dec 2012 00:04:25 +0000 (17:04 -0700)]
dist/constant/t/utf8.t: Skip tests for early Perls
Karl Williamson [Thu, 6 Dec 2012 00:02:23 +0000 (17:02 -0700)]
AUTHORS: Change email for Sébastien Aperghis-Tramoni
Father Chrysostomos [Wed, 5 Dec 2012 17:35:36 +0000 (09:35 -0800)]
regen pod issue
I don’t see how I could have made the number of potential errors
go down, but that’s what podcheck.t insists on saying, even after
I re-ren autodoc.pl to make sure.
Father Chrysostomos [Wed, 5 Dec 2012 14:09:42 +0000 (06:09 -0800)]
sv.c: Correct newSVpvn_share docs
something I overlooked
Father Chrysostomos [Wed, 5 Dec 2012 14:07:51 +0000 (06:07 -0800)]
sv.h: Warning about cows in SvPV_set apidocs
Father Chrysostomos [Wed, 5 Dec 2012 07:13:56 +0000 (23:13 -0800)]
Stop "\N{...}" from leaking after errors
After a syntax error, S_new_constant in toke.c was not mortalising as
promised.
In this case, it doesn’t need to mortalise the variable. It can sim-
ply free it.
Father Chrysostomos [Wed, 5 Dec 2012 06:09:29 +0000 (22:09 -0800)]
Use SvREFCNT_dec_NN in various cop.h macros
Many of these SVs are never null, and therefore need no null checks.
Father Chrysostomos [Wed, 5 Dec 2012 06:05:09 +0000 (22:05 -0800)]
Stop v111111111111111 from leaking under fatal warnings
Actually, you need more digits than that to get a leak.
This commit arranges for the SV passed to scan_vstring to be freed
in case scan_vstring triggers an integer overflow warning when fatal
warnings are enabled.
Father Chrysostomos [Wed, 5 Dec 2012 05:59:07 +0000 (21:59 -0800)]
toke.c apidocs: Note that scan_vstring might croak
Chris 'BinGOs' Williams [Wed, 5 Dec 2012 16:27:15 +0000 (16:27 +0000)]
Synchronise CPAN Locale-Maketest and core version
Chris 'BinGOs' Williams [Wed, 5 Dec 2012 16:25:26 +0000 (16:25 +0000)]
Update CPANPLUS-Dist-Build to CPAN version 0.68
[DELTA]
0.68 Wed Dec 5 00:17:04 GMT 2012
- Revert change to wrapper command-line
0.66 Tue Dec 4 23:05:53 GMT 2012
- Resolve an issue where Build.PL doesn't generate a
Build script
Daniel Dragan [Sat, 10 Nov 2012 02:58:22 +0000 (21:58 -0500)]
more dTHX optimizations in /win32/*
In some places, where there is a higher risk of a NULL my_perl happening
at an unknown point in the future IMO new scopes were created. In other
places dTHXa(NULL) and aTHXa were used to avoid large whitespace changes.
win32_rename and win32_getenv I determined would have no benefit from
changing them. More context passing was added to static funcs called by
win32_kill and win32_waitpid removing the need to move the dTHXs in the
2 funcs.
Yves Orton [Tue, 4 Dec 2012 14:22:28 +0000 (15:22 +0100)]
Switch default hash to SIPHASH on 64 bit builds and ONE_AT_A_TIME on 32 bit builds
Murmurhash has certain disadvantages that neither ONE_AT_A_TIME nor SIPHASH posses
Father Chrysostomos [Tue, 4 Dec 2012 22:40:26 +0000 (14:40 -0800)]
override.t: Suppress deprecation warning
If we have overridden CORE::GLOBAL::require for the sake of testing it,
we can’t do ‘no warnings’ obviously.
Father Chrysostomos [Tue, 4 Dec 2012 19:22:59 +0000 (11:22 -0800)]
Stop /[a-\d]/ from leaking under fatal warnings
This commit arranges for the regexp and one temporary sv in S_regclass
to be freed in case the ‘False [] range’ warning proves fatal.
Father Chrysostomos [Tue, 4 Dec 2012 19:18:36 +0000 (11:18 -0800)]
Stop /[:foo:]/ from leaking under fatal warnings
This commit arranges for the regexp and one temporary sv in S_regclass
to be freed in case the ‘POSIX syntax [: :] belongs inside character
classes’ warning proves fatal.
Father Chrysostomos [Tue, 4 Dec 2012 19:04:24 +0000 (11:04 -0800)]
[perl #115818] Don’t croak for /[.zog.]/
/[.zog.]/ produces a warning, because the POSIX syntax is not used
correctly. It must be /[[.zog.]]/.
/[[.zog.]]/ croaks, because that POSIX syntax has not been imple-
mented yet.
There is currently a croak for the former, too, even though it is
the latter syntax that is forbidden. There is no reason to forbid
the former.
The reason for warning is that /[.zog.]/ is a regular character
class (equivalent to [.zog]), so it might not do what the programmer
intended. If that is why we warn, it doesn’t make sense to croak.
After all, perl is only guessing that the programmer *might* have made
a mistake.
This makes /[.foo.]/ similar to /[:foo:]/, which warns and then acts
like /[:fo]/.
Sullivan Beck [Tue, 4 Dec 2012 21:32:45 +0000 (21:32 +0000)]
Update Locale-Codes to CPAN version 3.24
Signed-off-by: Chris 'BinGOs' Williams <chris@bingosnet.co.uk>
Steffen Mueller [Sat, 1 Dec 2012 04:03:09 +0000 (23:03 -0500)]
add a note about security concerns in Storable
Storable is not a great way to pass data back and forth across security
boundaries. We have discussed the security implications of the
auto-loading and auto-blessing behaviors in Storable in the past, both
on the perl5-porters mailing list and at various conferences. Somehow,
though, these "well-known" probably have never actually been put into
the documentation. This patch corrects that.
The original version of this patch included a recommendation to use
Sereal in its most stringent configuration, but that text was removed
for the time being by Ricardo Signes, who hopes to add it back once
Sereal has been in public use for just a bit longer.
Brian Carlson [Wed, 28 Nov 2012 13:54:33 +0000 (08:54 -0500)]
Fix misparsing of maketext strings.
Case 61251: This commit fixes a misparse of maketext strings that could
lead to arbitrary code execution. Basically, maketext was compiling
bracket notation into functions, but neglected to escape backslashes
inside the content or die on fully-qualified method names when
generating the code. This change escapes all such backslashes and dies
when a method name with a colon or apostrophe is specified.
Father Chrysostomos [Tue, 4 Dec 2012 18:48:36 +0000 (10:48 -0800)]
embed.fnc: Explain how X is used for public macros
I don’t know whether my message to the list
(<
20121204012335.29409.qmail@lists-nntp.develooper.com>) was noticed.
In any case, here it is for posterity. Hopefully this will save
others from finding this out the hard way as I had to (making mistakes
and having others come and correct them).
Father Chrysostomos [Tue, 4 Dec 2012 18:44:08 +0000 (10:44 -0800)]
Mention in more places that my $_ is deprecated
Father Chrysostomos [Tue, 4 Dec 2012 17:53:55 +0000 (09:53 -0800)]
Deprecate lexical $_
See tickets #114020 and #75598 for why.
The changes to tests in cpan/Text-Tabs have been submitted upstream
at rt.cpan.org #81698.
Father Chrysostomos [Tue, 4 Dec 2012 15:04:48 +0000 (07:04 -0800)]
encoding.t: Skip 2 tests under debugging
Father Chrysostomos [Tue, 4 Dec 2012 14:57:58 +0000 (06:57 -0800)]
Increase $sigtrap::VERSION to 1.07
Father Chrysostomos [Tue, 4 Dec 2012 14:57:02 +0000 (06:57 -0800)]
sigtrap.pm: Avoid lexical $_
my $_ is about to be deprecated.
It has been using it since commit
972fc2eb7a to avoid modifying a
read-only argument. Using @{[...]} instead works, too.
David Mitchell [Tue, 4 Dec 2012 15:30:37 +0000 (15:30 +0000)]
silence some non-clang warnings
ccde85316a0db149f30359ebfdf031ef602b0344 added some
#pragma clang ...
lines to shut up clang.
This caused gcc to give voluminous 'unknown pragma "clang"' output.
Sigh.
Hopefully now fixed, although it all seems very cumbersome.
David Mitchell [Tue, 4 Dec 2012 13:22:41 +0000 (13:22 +0000)]
silence some clang warnings
principally, proto.h was sometimes being included twice - once before
a fn decl, and once after - giving rise to a 'decl after def' warning.
Also, S_croak_memory_wrap was declared static in every source file, but
not used in some. So selectively disable the unused-function warning.
Craig A. Berry [Tue, 4 Dec 2012 13:23:57 +0000 (07:23 -0600)]
Avoid some doubled escapes in tovmsspec.
Since it's impossible to guarantee a filename is never makes
multiple trips through the Unix-to-VMS converter, it's important
not to escape characters that have already been escaped.
David Mitchell [Tue, 4 Dec 2012 11:32:39 +0000 (11:32 +0000)]
add SvREFCNT_dec_NN()
Like SvREFCNT_dec(), but skips the not null check, making code potentially
smaller and faster.
Also as proof of concept, updates the SvREFCNT_dec's in scope.c where
it's obvious the value can't be NULL. There are still 500+ uses in the
perl core that need evaluating!
David Mitchell [Sun, 2 Dec 2012 12:59:37 +0000 (12:59 +0000)]
make SvREFCNT_dec() more efficient
Historically, SvREFCNT_dec was just
#define SvREFCNT_dec(sv) sv_free((SV*)(sv))
then in 5.10.0, for GCC, the macro was partially inlined, avoiding a
function call for the refcnt > 1 case. Recently, the macro was turned into
an inline function, providing the function-call avoidance to other
platforms too. However, the macro/inline-function is quite big, and
appears over 500 times in the core source. Its action is logically
equivalent to:
if (sv) {
if (SvREFCNT(sv) > 1)
SvREFCNT(sv)--;
else if (SvREFCNT == 1) {
// normal case
SvREFCNT(sv)--;
sv_free2(sv);
}
else {
// exceptional case
sv_free(sv);
}
}
Where sv_free2() handles the "normal" quick cases, while sv_free()
handles the odd cases (e,g. a ref count already at 0 during global
destruction).
This means we have to plant code that potentially calls two different
subs, over 500 times.
This commit changes SvREFCNT_dec and sv_free2() to look like:
PERL_STATIC_INLINE void
S_SvREFCNT_dec(pTHX_ SV *sv)
{
if (sv) {
U32 rc = SvREFCNT(sv);
if (rc > 1)
SvREFCNT(sv) = rc - 1;
else
Perl_sv_free2(aTHX_ sv, rc);
}
}
Perl_sv_free2(pTHX_ SV *const sv, const U32 rc)
{
if (rc == 1) {
SvREFCNT(sv) = 0;
... do sv_clear, del_SV etc ...
return
}
/* handle exceptional rc == 0 */
...
}
So for the normal cases (rc > 1, rc == 1) there is the same amount of
testing and function calls, but the second test has been moved inside
the sv_free2() function.
This makes the perl executable about 10-15K smaller, and apparently a bit
faster (modulo the fact that most benchmarks are just measuring noise).
The refcount is passed as a second arg to sv_free2(), as on platforms
that pass the first few args in registers, it saves reading sv->sv_refcnt
again.
David Mitchell [Thu, 29 Nov 2012 11:37:08 +0000 (11:37 +0000)]
Optimise magic handling in save* and leave_scope
There are several places that have code similar to
if (SvMAGICAL(sv)) {
PL_localizing = 2;
SvSETMAGIC(sv)
PL_localizing = 0;
}
The condition is sub-optimal (it should only test for set magic), and the
SvSETMAGIC repeats a similar test.
Other places didn't have the outer condition, so they set PL_localizing
twice even when not needed.
David Mitchell [Sun, 25 Nov 2012 23:08:11 +0000 (23:08 +0000)]
refactor Perl_leave_scope
This is a large and hot function. The main problem with it is that
there is code to pop a few args repeated in just about every branch.
Also, there are a whole bunch of local vars (sv, av, hv, gv etc)
that are never all used simultaneously, but are really just there for
casting convenience. Together, they defeat the compiler's register
allocation algorithms (well, they did for gcc anyway).
We fix this by just declaring three general vars, arg0,1,2 of type ANY, and
move the popping code to above the switch(). We sort the SAVEt_*
indices in order of number of args, so it's quick to determine how many
args we need to pop for a particular type.
Together with the previous commits which added the SS_ADD_* macros, this
reduces the size of scope.o (-O2, gcc x86_64) by about 9% (threaded)
or 17% (unthreaded), and seems to speed up simple loops / function calls
by around 5%.
David Mitchell [Sun, 25 Nov 2012 16:36:43 +0000 (16:36 +0000)]
save_int/i32 inline the long version
Both these functions were structured as
if (int will fit in type)
SS_ADD(...);
else
save_pushi32ptr(...)
Inline the call of the "long" version of the save. With refactoring, the
machine code (x86_64, gcc -O2) is no larger than before, and saves time
on the long version.
David Mitchell [Sun, 25 Nov 2012 15:22:19 +0000 (15:22 +0000)]
Add SS_ADD_* macros and replace most SSPUSH* uses
The current idiom for adding an entry to the savestack is
SSCHECK(3);
SSPUSHINT(...);
SSPUSHPTR(...);
SSPUSHUV(SAVEt_...);
Replace this with a new idiom:
{
dSS_ADD;
SS_ADD_INT(...);
SS_ADD_PTR(...);
SS_ADD_UV(SAVEt_...);
SS_ADD_END(3);
}
This is designed to be more efficient.
First, it defines some local vars, and defers updating PL_savestack_ix
to the end.
Second, it performs the 'is there space on the stack' check *after*
pushing. Doing the check last means that values in registers will have
been pushed and no longer needed, so don't need saving around the call to
grow. Also, tail-call elimination of the grow() can be done. These changes
reduce the code of something like save_pushptrptr() to half its former
size.
Of course, doing the size check *after* pushing means we must always
ensure there are SS_MAXPUSH free slots on the savestack */
Father Chrysostomos [Tue, 4 Dec 2012 01:27:22 +0000 (17:27 -0800)]
Lower version.pm version
Commit
4a7557453 increased the version when modifying a test, but
without updating other tests that check the version number.
Since modifying a test does not affect what gets installed, it was
not actually necessary to change the version number.
Yves Orton [Mon, 3 Dec 2012 23:00:28 +0000 (00:00 +0100)]
Fix per-hash hash order dependency bug in version.pm
If we make each hash have its own keyorder then this test will fail
pretty regularly. Fixing it to get sorted keys from Dumper for the
relevent test prevents this failure.
Joel Berger [Sat, 1 Dec 2012 16:15:36 +0000 (10:15 -0600)]
Cwd::fast_abs_path's untaint should allow for multiline directories
This bug was noticed via https://github.com/dagolden/file-chdir/issues/3 and testing has led to this being the cause.
The problem is worse on some platforms (notably cygwin in this case) when abs_path is implemented by fast_abs_path.
Since File::chdir tests for proper behavior when a directory contains a newline, this bug then breaks File::chdir (one of my favorites and very useful xplatform tool).
Yes this should have tests, but since it will involve creating a directory with a newline, I thought I would do better to leave that to someone with better knowledge than I.
Father Chrysostomos [Mon, 3 Dec 2012 02:53:23 +0000 (18:53 -0800)]
[perl #115962] cwd.t: Add test for fast_abs_path in LF dir
Father Chrysostomos [Mon, 3 Dec 2012 01:46:24 +0000 (17:46 -0800)]
Stop /[\i]/ from leaking under fatal warnings
This commit arranges for the regexp and one temporary sv in S_regclass
to be freed in case the ‘Unrecognized escape \x in character class’
warning proves fatal.
Father Chrysostomos [Mon, 3 Dec 2012 01:40:36 +0000 (17:40 -0800)]
Stop /(?{})+/ from leaking under fatal warnings
This commit arranges for the regexp to be freed in case the ‘blah blah
blah matches null string many times in regex’ warning proves fatal.
Father Chrysostomos [Mon, 3 Dec 2012 01:34:44 +0000 (17:34 -0800)]
Make PL_sawampersand checks conditional on PERL_SAWAMPERSAND
This does not actually make any difference, since PL_sawampersand is
a constant when PERL_SAWAMPERSAND is undefined. It just makes the
code clearer.
Father Chrysostomos [Mon, 3 Dec 2012 01:27:41 +0000 (17:27 -0800)]
Stop /(?{})?/ from leaking under fatal warnings
Fatal errors in regexp compilation do SAVEFREESV before croaking, to
make sure the regexp is freed.
Warnings that happen after the sizing pass need to be protected the
same way, in case they are fatal.
This commit arranges for the regexp to be freed in case the ‘Quanti-
fier unexpected on zero-length expression’ warning proves fatal.
/(?{})?/ also triggers some others leaks. Before re_op_compile calls
S_study_chunk, it allocates three scalars for study_chunk’s use. Some
of those are freed after the call to study_chunk, while others become
part of the regexp.
I surrounded the allocation and freeing with an ENTER/LEAVE pair,
using SAVEFREESV to free them when there is a croak. So those cases
SvREFCNT_dec was used, it is simply omitted. Those cases where it was
omitted now have SvREFCNT_inc.
One more complication was that sometimes there is a goto between the
ENTER and the LEAVE which restarts the surrounding code. It already=
took those scalars into account, freeing them. But to balance ENTER/
LEAVE pairs properly I had to do a LEAVE just before the goto, and
remove the freeing of the SVs after the goto.
The new name of the macro that uses goto was inspired by
Acme::ButFirst.
Father Chrysostomos [Sat, 1 Dec 2012 04:20:19 +0000 (20:20 -0800)]
Remove use of SAVEDESTRUCTOR_X(clear_re...) from regcomp.c
The purpose of this is to free the regexp when croaking.
SAVEDESTRUCTOR_X calls clear_re on scope exit. clear_re does
ReREFCNT_dec.
It used to be necessary to do it this way before regular expres-
sions were SVs.
Since v5.10.0-145-g84679df, regexps have been SVs, and ReREFCNT_dec is
effectively an alias for SvREFCNT_dec.
There will be one less function call on scope exit when regexp compi-
lation croaks if we use SAVEFREESV instead of SAVEDESTRUCTOR_X.
Yves Orton [Mon, 3 Dec 2012 10:49:00 +0000 (11:49 +0100)]
Make it possible to simulate old style one-at-a-time hashing
With a 0 seed and ONE_AT_A_TIME_OLD hashing enabled one can simulate
older perls (with the exception there is no rehashing at play).
This includes a modest tweak to reduce ops per character by comparing
the string pointer to the end of the string, instead of maintaining
a position counter.
Craig A. Berry [Sun, 2 Dec 2012 21:17:55 +0000 (15:17 -0600)]
Better escaping of dots in tovmsspec.
When converting a filename with multiple dots to native VMS syntax,
it's necessary to escape all but the last dot with a caret ('^').
We've been doing this for some time, but have been doing it blindly
such that multiple trips through the converter resulted in a
stuttering caret problem (e.g., foo^^^.bar.pl when foo^.bar.pl was
intended).
So create a convenience macro that does the escaping and make it
only escape unescaped instances and also make it check that the
escape doesn't push us off the end of the buffer we are working
on.
Use the new macro in the three most obvious places that it's
applicable. There may be other places that also should use it.
Craig A. Berry [Sat, 1 Dec 2012 03:47:03 +0000 (21:47 -0600)]
Remove a spurious strlen in VMS's readdir().
After setting the null byte, we turned around and pretended we
didn't know where it was and went hunting for it. Hmm.
Craig A. Berry [Sat, 1 Dec 2012 03:20:47 +0000 (21:20 -0600)]
Fix memory leak in VMS's readdir().
When we got to the end of a directory we were not freeing the
buffer we'd been using. So refactor that section of code to have
only one return. Bug introduced in
657054d4f860463a01c5.
Father Chrysostomos [Sat, 1 Dec 2012 02:01:40 +0000 (18:01 -0800)]
Increase $sort::VERSION to 2.02
Martin Becker [Fri, 30 Nov 2012 17:07:43 +0000 (18:07 +0100)]
fixed typos in sample code in sort.pm documentation
Father Chrysostomos [Fri, 30 Nov 2012 17:50:35 +0000 (09:50 -0800)]
Stop format closure fatal warnings from leaking
Father Chrysostomos [Fri, 30 Nov 2012 17:27:27 +0000 (09:27 -0800)]
svleak.t: Correct test name
I got slightly confused when I added that. I had tested both page
overflow and closure warnings (only the latter leaked), and I got
them mixed up when I wrote the test name.
Father Chrysostomos [Fri, 30 Nov 2012 06:49:09 +0000 (22:49 -0800)]
Stop duplicate lex vars from leaking under fatal warnings
Father Chrysostomos [Thu, 29 Nov 2012 21:07:02 +0000 (13:07 -0800)]
Stop newCONSTSUB from leaking the constant under fatal warnings
James E Keenan [Fri, 30 Nov 2012 02:30:47 +0000 (21:30 -0500)]
Merge branch 'blead' of jkeenan@perl5.git.perl.org:/perl into blead
James E Keenan [Fri, 23 Nov 2012 19:20:56 +0000 (14:20 -0500)]
Add descriptions to tests in t/op/arith.t.
For: RT #115806
James E Keenan [Fri, 30 Nov 2012 02:25:07 +0000 (21:25 -0500)]
t/win32/runenv.t: Correct syntax error reported by bulk88++.
Part of: RT #115788
James E Keenan [Sat, 17 Nov 2012 20:08:39 +0000 (14:08 -0600)]
Add descriptions to tests lacking them.
Accomplished programmatically by modifying sub try().
James E Keenan [Sat, 17 Nov 2012 18:40:44 +0000 (12:40 -0600)]
t/run/switchx.t: Add descriptions to tests lacking them.
The tests which lacked descriptions are in sample files used by the test file.
Better description as suggested by Lukas Mai.
For: RT #115782
James E Keenan [Fri, 23 Nov 2012 18:18:05 +0000 (13:18 -0500)]
t/run/switchF1.t: Add descriptions to tests in t/run/switchF1.t.
For: RT #115896
James E Keenan [Sat, 17 Nov 2012 17:10:28 +0000 (11:10 -0600)]
t/run/script.t: Add descriptions to all tests.
Replace hard-coded tests with functions from test.pl.
Correct error in calling plan.
For: RT #115776
James E Keenan [Sat, 17 Nov 2012 22:08:11 +0000 (16:08 -0600)]
t/op/args.t: Add descriptions for tests lacking them.
In one case, used an inline comment as test description.
For: RT #115792
James E Keenan [Sat, 17 Nov 2012 19:02:19 +0000 (13:02 -0600)]
t/run/switchd.t: Add descriptions to tests lacking them.
For: RT #115784
James E Keenan [Sat, 17 Nov 2012 18:30:52 +0000 (12:30 -0600)]
t/run/switchp.t: Add descriptions to all tests.
For: RT #115780
James E Keenan [Sat, 17 Nov 2012 18:12:06 +0000 (12:12 -0600)]
t/run/switchI.t: Add descriptions to tests lacking them.
This entailed placing the 'grep' in a 'do' block. Trying to add the
description without the 'do' block merely added it to the list being grepped
-- which prevented the description from being printed.
Thanks to Matt Follett and Steve Lembark at St. Louis Perl Hackathon for
diagnosis.
Father Chrysostomos [Thu, 29 Nov 2012 17:08:08 +0000 (09:08 -0800)]
Clear method caches when unwinding local *foo=sub{}
local *foo=sub{} is done in two stages:
• First the local *foo localises the GP (the glob pointer, or list of
slots), setting a flag on the GV.
• Then scalar assignment sees the flag on the GV on the LHS and loca-
lises a single slot.
The slot localisation only stores on the savestack a pointer into the
GP struct and the old value. There is no reference to the GV.
To restore a method properly, we have to have a reference to the GV
when the slot localisation is undone.
So in this commit I have added a new save type, SAVEt_GVSLOT. It is
like SAVEt_GENERIC_SV, except it pushes the GV as well. Currently
it is used only for CVs, but I will need it for HVs and maybe
AVs as well.
It is possible for the unwinding of the slot localisation to affect
only a GV other than the one that is pushed, if glob assignments have
taken place since the local *foo. So we have to check whether the
pointer is inside the GP and use PL_sub_generation++ if it is not.
Father Chrysostomos [Thu, 29 Nov 2012 02:05:28 +0000 (18:05 -0800)]
method_caching.t: Load test.pl at BEGIN time
This stops $::TODO from producing a used-only-once warning.
Father Chrysostomos [Thu, 29 Nov 2012 02:04:01 +0000 (18:04 -0800)]
Clear method caches when unwinding local *foo=*method
It was already working for those cases where *foo contained a sub
before and after localisation. For those cases where *foo had no sub
but localised assignment gave it one, method caches were not being
reset on scope exit.
case SAVEt_GP in scope.c:leave_scope needs to look at both GPs (glob
pointer, or list of glob slots), both from before and after the unlo-
calisation. If either has a sub, method caches need to be cleared.
This does not yet fix local *foo = sub {}, but I added a to-do
test for it. (This is more complicated, as localisation happens in
two seperate steps, the glob slot localisation storing no pointers to
the glob itself on the savestack.)
Father Chrysostomos [Wed, 28 Nov 2012 21:46:07 +0000 (13:46 -0800)]
Fix two local *ISA bugs
These are regressions from 5.8.
local *ISA was not updating isa caches. local *ISA = [] was updating
caches, but scope unwinding was not.
Both save_gp and leave_scope/SAVEt_GP need to check whether the glob
is named ISA and call mro_isa_changed_in if appropriate.
Father Chrysostomos [Wed, 28 Nov 2012 20:39:04 +0000 (12:39 -0800)]
Don’t croak for local *DetachedStash::method
save_gp was trying to call mro_method_changed_in even if the stash had
been detached.
This is a regression from 5.12.
Father Chrysostomos [Wed, 28 Nov 2012 16:36:34 +0000 (08:36 -0800)]
Reset method caches when GPs are shared
The new MRO stuff in 5.10 made PL_sub_generation++ mostly unnecessary,
and almost all uses of it were replaced with mro_method_changed_in.
There is only one problem: That doesn’t actually work properly. After
glob-to-glob assignment (*foo = *bar), both globs share the same GP
(glob pointer, or list of glob slots). But there is no list of GVs
associated with any GP. So there is no way, given a GV whose GP
is shared, to find out what other classes might need their method
caches reset.
sub B::b { "b" }
*A::b = *B::b;
@C::ISA = "A";
print C->b, "\n"; # should print "b"
eval 'sub B::b { "c" }';
print C->b, "\n"; # should print "c"
__END__
$ perl5.8.9 foo
b
c
$ perl5.10.0 foo
b
b
And it continues up to 5.16.x.
If a GP is shared, then those places where mro_method_changed_in is
called after the GP has been modified must do PL_sub_generation++
instead if the GP is shared, which can be detected through its refer-
ence count.
Father Chrysostomos [Mon, 26 Nov 2012 06:15:33 +0000 (22:15 -0800)]
Fix two minor bugs with local glob assignment
These are combined into one patch because it is hard to fix one with-
out fixing the other.
local *glob = $ref was ignoring the clobbered reference and not
accounting for when updating ISA caches, resulting in two bugs:
*Foo::ISA = *Bar::ISA;
@Foo::ISA = "Baz";
sub Baz::ook { "Baz" }
sub L::ook { "See" }
warn Bar->ook; # Baz
local *Foo::ISA = ["L"];
warn Bar->ook; # Baz
@Baz::ISA = @Baz::ISA; # should have no effect
warn Bar->ook; # See
@Baz::ISA = "Foo::bar";
sub Foo::bar::ber { 'baz' }
sub UNIVERSAL::ber { "black sheep" }
warn Baz->ber; # baz
local *Foo:: = \%Bar::;
warn Baz->ber; # baz
@Baz::ISA = @Baz::ISA; # should have no effect
warn Baz->ber; # black sheep
The dref variable in sv.c:S_glob_assign_ref holds the SV that needs to
be freed. So during localisation it is NULL.
When I was fixing up isa and mro bugs in perl 5.14, I misunderstood
its purpose and thought it always contained the reference on the left.
Since we need to have access to what was assigned over after the
assignment, this commit changes dref always to hold the clobbered SV,
and makes the SvREFCNT_dec conditional.
Father Chrysostomos [Mon, 26 Nov 2012 01:16:37 +0000 (17:16 -0800)]
scope.c:save_gp: Remove redundant code
This has been redundant since ERRSV was changed to use GvSVn in com-
mit
f5fa9033b8.
Karl Williamson [Thu, 29 Nov 2012 03:16:06 +0000 (20:16 -0700)]
Make isIDFIRST_uni() return identically as isIDFIRST_utf8()
These two macros should have the same results for the same input code
points. Prior to this patch, the _uni() macro returned the official
Unicode ID_Start property, and the _utf8() macro returned Perl's
slightly restricted definition. Now both return Perl's.
Karl Williamson [Thu, 29 Nov 2012 02:51:43 +0000 (19:51 -0700)]
Remove double underscore in internal function name
This function was added in 5.16, and has no callers in CPAN. It is
undocumented and marked as changeable. Its name has two underscores in
a row by mistake. This removes one of them.
Karl Williamson [Thu, 29 Nov 2012 03:40:12 +0000 (20:40 -0700)]
XS-APItest/t/handy.t: Turn off non_unicode warnings
Tests here use above-Unicode code points, so the warnings these might
otherwise generate should be forced off.
Karl Williamson [Thu, 29 Nov 2012 03:35:45 +0000 (20:35 -0700)]
charnames: Check for enabled warnings before warning
This message should be suppressed if non_unicode warnings are turned
off.
Karl Williamson [Wed, 28 Nov 2012 22:01:29 +0000 (15:01 -0700)]
mktables: Sort some outputs for repeatability
The recent change to random hash ordering caused some of the files
output by mktables to vary from run to run. Everything still worked.
However, one of the ways I debug mktables is to make a change, and then
compare the tables it generates with those from before the change. That
tells me the precise effect of the change. That no longer works if the
tables come out in random order from run to run.
This patch just sorts certain things so that the tables are output in
the same order each time.
Karl Williamson [Wed, 28 Nov 2012 15:46:52 +0000 (08:46 -0700)]
embed.fnc, mathoms.c: Add comments
Karl Williamson [Tue, 27 Nov 2012 22:24:17 +0000 (15:24 -0700)]
perlapi: Don't mention internal function
This function is undocumented, and is for internal core use only. Cause
it to not be mentioned in perlapi
Father Chrysostomos [Tue, 27 Nov 2012 15:08:08 +0000 (07:08 -0800)]
[Merge] New COW mechanism
This branch makes string copying faster by introducing a new copy-on-
write mechanism. A reference count for the string buffer is now
stored inside the string buffer itself. This can be disabled with
-Accflags=-DPERL_NO_COW.
It also disables the PL_sawampersand mechanism, as copy-on-write
can now be used for the pre-match ‘copy’, resulting in no slow-
down from using $& and f(r)iends. This can be reënabled with
-Accflags=-DPERL_SAWAMPERSAND.
Father Chrysostomos [Tue, 27 Nov 2012 06:23:53 +0000 (22:23 -0800)]
Don’t share TARGs between recursive ops
I had to change the definition of IS_PADCONST to account for the
SVf_IsCOW flag. Previously, anything marked READONLY would be consid-
ered a pad constant, to be shared by pads of different recursion lev-
els. Some of those READONLY things were not actually read-only, as
they were copy-on-write scalars, which are never read-only. So I
changed the definition of IS_PADCONST in
e3918bb703c to accept COWs
as well as read-only scalars, since I was removing the READONLY flag
from COWs.
With the new copy-on-write scheme, it is easy for a TARG to turn into
a COW. If that happens and then the same subroutine calls itself
recursively for the first time after that, pad_push will see that this
is a pad ‘constant’ and allow the next recursion level to share it.
If pp_concat calls itself recursively, the recursive call can modify
the scalar the outer call is in the middle of using, causing the
return value to be doubled up (‘tmptmp’) in the test case added here.
Since pad constants are marked PADTMP (I would like to change that
eventually), there is no way to distinguish them from TARGs when the
are COWs, except for the fact that pad constants that are COWs are
always shared hash keys (SvLEN==0).
Father Chrysostomos [Mon, 26 Nov 2012 17:40:34 +0000 (09:40 -0800)]
subst.t: Test something I nearly broke
The saving and restoring of $@ when utf8 tables were looked up was
causing pp_subst’s string pointers to go stale. The existing mechanism
of copying it temporarily to another scalar was already very fragile,
and the new COW mechanism broke it (but I fixed it in the same commit
that introduced the new COW mechanism).
Father Chrysostomos [Sun, 25 Nov 2012 22:50:48 +0000 (14:50 -0800)]
Update docs to concur with $`,$&,$' changes
plus a couple of other pod tweaks.
Father Chrysostomos [Sun, 25 Nov 2012 22:31:25 +0000 (14:31 -0800)]
Increase $English::VERSION to 1.06
Father Chrysostomos [Sun, 25 Nov 2012 22:31:04 +0000 (14:31 -0800)]
English.pm: Update -no_match_vars docs
Father Chrysostomos [Sun, 25 Nov 2012 22:28:25 +0000 (14:28 -0800)]
Test perl #4289
This was fixed by the disabling of PL_sawampersand a few commits ago.
The output used to be like this:
$ perl -e '$_ = "abc"; /b/g; $_ = "hello"; print eval q|$&|, "\n"'
e
$ perl -e '$_ = "abc"; /b/g; $_ = "hello"; print eval q|$`|, "\n"'
h
$ perl -e '$_ = "abc"; /b/g; $_ = "hello"; print eval q|$'\''|, "\n"'
l
Now it’s like this:
$ ./perl -e '$_ = "abc"; /b/g; $_ = "hello"; print eval q|$&|, "\n"'
b
$ ./perl -e '$_ = "abc"; /b/g; $_ = "hello"; print eval q|$`|, "\n"'
a
$ ./perl -e '$_ = "abc"; /b/g; $_ = "hello"; print eval q|$'\''|, "\n"'
c
Father Chrysostomos [Sun, 25 Nov 2012 22:04:05 +0000 (14:04 -0800)]
test_bootstrap.t: Skip PL_sawampersand tests
unless PERL_SAWAMPERSAND is defined.
Father Chrysostomos [Sun, 25 Nov 2012 21:58:40 +0000 (13:58 -0800)]
Fix up Peek.t to account for preceding commits
Father Chrysostomos [Sun, 25 Nov 2012 21:52:27 +0000 (13:52 -0800)]
perl.h: Mention PERL_SAWAMPERSAND in perl -V output
Father Chrysostomos [Sun, 25 Nov 2012 20:57:04 +0000 (12:57 -0800)]
Disable PL_sawampersand
PL_sawampersand actually causes bugs (e.g., perl #4289), because the
behaviour changes. eval '$&' after a match will produce different
results depending on whether $& was seen before the match.
Using copy-on-write for the pre-match copy (preceding patches do that)
alleviates the slowdown caused by mentioning $&. The copy doesn’t
happen unless the string is modified after the match. It’s now a
post- match copy. So we no longer need to do things differently
depending on whether $& has been seen.
PL_sawampersand is now #defined to be equal to what it would be if
every program began with $',$&,$`.
I left the PL_sawampersand code in place, in case this commit proves
immature. Running Configure with -Accflags=PERL_SAWAMPERSAND will
reënable the PL_sawampersand mechanism.
Father Chrysostomos [Wed, 21 Nov 2012 20:45:33 +0000 (12:45 -0800)]
Enable PERL_NEW_COPY_ON_WRITE by default
One can disable this with -Accflags=-DPERL_NO_COW.
I am leaving this in for debugging purposes. If it causes no problems
in 5.18, we might remove the defines and enable it unconditionally in
5.20, but then again we might not.
Father Chrysostomos [Sun, 4 Nov 2012 07:07:31 +0000 (00:07 -0700)]
Allow COW with magical and blessed scalars (among others)
Under PERL_NEW_COPY_ON_WRITE (and I suspect under
PERL_OLD_COPY_ON_WRITE, too, but have not confirmed) it is harmless to
do copy-on-write with a magical or blessed scalar.
Also, under PERL_NEW_COPY_ON_WRITE, it is safe to do copy-on-write
with scalars that have numbers in them as well as strings (though not
under PERL_OLD_COPY_ON_WRITE).
So redefine CAN_COW_MASK under PERL_NEW_COPY_ON_WRITE to be less
restrictive. We still can’t do it when the SvOOK hack is in place,
and I don’t feel comfortable doing it with regexps, even if it could
be proven feasible (regexps are SVf_FAKE, so that covers them).
Anything SvROK cannot be SvPOK, so obviously we can’t COW with that,
but I left SVf_ROK in for good measure.
This change to CAN_COW_MASK affects whether non-cow scalars will be
turned into cows in sv_setsv_flags. It is already possible for exist-
ing cows to become magical, blessed or numeric elsewhere.
Also, we don’t need to check the flags on the lhs in sv_setsv_flags,
except for SVf_BREAK. This is similar to
ecd5fa70f3, but applies to
another branch just below it.
pp_subst needs a little bit of adjustment, as it is not expecting a
vstring to turn into a cow.
Father Chrysostomos [Fri, 19 Oct 2012 16:52:03 +0000 (09:52 -0700)]
Min string length for COW
We have two separate length thresholds for when copy-on-write kicks
in, one for when a buffer would have had to be (re)allocated
(SV_COW_THRESHOLD) and another for when there is already a large
enough buffer available (SV_COWBUF_THRESHOLD).
Benchmarking against mktables and against Test.Simple’s test suite
(see JS::Test::Simple on CPAN) run with WWW::Scripter and JE shows
that 0/1250 is the best combination, at least on 32-bit darwin.
Apparently, copying into an existing buffer is much faster than the
bookkeeping overhead of sv_force_normal_flags (which I see no way to
speed up).
I have defined these conditionally with #ifndef, so that platform-spe-
cific hints can override them with values appropriate to the platform.
Also, refactor things in sv_setsv_flags slightly to avoid using SvLEN
and SvCUR repeatedly.
Father Chrysostomos [Mon, 8 Oct 2012 07:20:21 +0000 (00:20 -0700)]
New COW mechanism
This was discussed in ticket #114820.
This new copy-on-write mechanism stores a reference count for the
PV inside the PV itself, at the very end. (I was using SvEND+1
at first, but parts of the regexp engine expect to be able to do
SvCUR_set(sv,0), which causes the wrong byte of the string to be used
as the reference count.) Only 256 SVs can share the same PV this way.
Also, only strings with allocated space after the trailing null can
be used for copy-on-write.
Much of the code is shared with PERL_OLD_COPY_ON_WRITE. The restric-
tion against doing copy-on-write with magical variables has hence been
inherited, though it is not necessary. A future commit will take
care of that.
I had to modify _core_swash_init to handle $@ differently. The exist-
ing mechanism of copying $@ to a new scalar and back again was very
fragile. With copy-on-write, $@ =~ s/// can cause pp_subst’s string
pointers to become stale. So now we remove the scalar from *@ and
allow the utf8-table-loading code to autovivify a new one. Then we
restore the untouched $@ afterwards if all goes well.
Matthew Horsfall (alh) [Sun, 25 Nov 2012 16:13:05 +0000 (11:13 -0500)]
Fix comment referencing pp_iterinit (should be pp_enteriter)
Karl Williamson [Mon, 26 Nov 2012 23:18:47 +0000 (16:18 -0700)]
regexec.c: White space only; no code changes
Karl Williamson [Mon, 26 Nov 2012 23:06:53 +0000 (16:06 -0700)]
Remove 3 unused interpreter variables
These variables have been unused in the Perl core since
commit
4c88d5e0740d796bf5064336d280bba72897f385.
The variables are undocumented. The only real use of any of these I
found in CPAN is at
https://metacpan.org/source/ABERGMAN/Devel-GC-Helper-0.25/Helper.xs#L1
The uses there appear to be in a list of known Perl variables. Since
the module was published, more than a few new variables have been added,
making this code obsolete anyway.
Craig A. Berry [Mon, 26 Nov 2012 13:07:21 +0000 (07:07 -0600)]
Consider /... a directory component with EFS on VMS.
For some reason the omnibus patch (
360732b5267d5dfe) that brought
Extended Filename Syntax support to the VMS port considered three
dots part of the filename portion rather than part of the
directory portion when converting a Unix-format path to VMS format.
There's no reason this should be different with EFS, so make it
the same as without EFS, which gets two TODO tests passing.
Father Chrysostomos [Mon, 26 Nov 2012 01:13:21 +0000 (17:13 -0800)]
Add Bob Ernst to AUTHORS