| Commit message (Collapse) | Author | Age | Files | Lines |
|
|
|
|
|
|
|
|
| |
# New Ticket Created by (Peter J. Acklam)
# Please include the string: [perl #81904]
# in the subject line of all future correspondence about this issue.
# <URL: http://rt.perl.org/rt3/Ticket/Display.html?id=81904 >
Signed-off-by: Abigail <abigail@abigail.be>
|
| |
|
|
|
|
|
|
|
|
|
|
|
| |
Using OP_NAME() isn't going to be helpful here. Firstly, it doesn't cope
with out of range op numbers - it only "special" cases op_custom. Secondly,
as the three ops we "panic" on are padmy, mapstart and custom, if we get
here for a custom op then that means that the custom op didn't have an
implementation. Given that OP_NAME() looks up the custom op by its pp_addr,
likely it will return NULL, unless someone (unhelpfully) registers
&PL_unimplemented_op as the address of their custom op. NULL doesn't
generate a useful error message. "custom" does. */
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Some amagic-related macros take the full method enumeration name,
(e.g. "add_amg"); while others "helpfully" allow you to pass a shortened
version, ("add"), and do a CAT2(meth,_amg) behind the scenes.
Standardise on passing the full name; this makes it less confusing and
allows you to grep for the enumeration name in the source.
It updates two macros to accept full enumeration names: tryAMAGICunTARGET
(which isn't used outside the core apparently), and AMG_CALLun, which is
replaced by a new AMG_CALLunary (since AMG_CALLun is used outside the
core).
|
|
|
|
| |
It was never part of the public API, and only ever used by pp_{s,}cho{,m}p.
|
| |
|
|
|
|
|
|
| |
They share code for dealing with PVAVs, PVHVs, read only values and handling
PL_encoding. They are not part of the public API, and Google codesearch shows
no users outside the core.
|
|
|
|
| |
Pass in an SV to hold the count, rather than returning the count.
|
|
|
|
|
| |
Previously list chomp worked from last to first, whilst list chop worked from
first to last.
|
| |
|
|
|
|
|
|
|
|
| |
(if we can avoid it).
Fix for RT #77456. Basically it extends the usage of the AMGf_numeric flag
to the remaining overloadable numeric ops that behave differently with IV
and NV.
|
| |
|
|
|
|
|
| |
I believe on many processors two increments are faster than two
additions
|
| |
|
|
|
|
|
|
|
|
|
|
| |
This was supposed to have been fixed by 2acc3314e31a9, but the code it
added was in the wrong spot. (This is the code that makes *{} return a
new glob if its argument is FAKE.)
Consequently, local *$foo was localising $foo, not *$foo.
This changes the order of the statements and adds a test.
|
|
|
|
| |
Nothing is using this any more, as of the previous commit.
|
|
|
|
| |
The else is never reached if the assignment in the protasis succeeds.
|
| |
|
|
|
|
| |
Nothing outside the core was using this macro.
|
| |
|
|
|
|
|
| |
Aside from the 2 callers where it can be replaced with AMG_CALLun().
AMG_CALLun_var was only used in core.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
All built-in functions that operate directly on array or hash
containers now also accept hard references to arrays or hashes:
|----------------------------+---------------------------|
| Traditional syntax | Terse syntax |
|----------------------------+---------------------------|
| push @$arrayref, @stuff | push $arrayref, @stuff |
| unshift @$arrayref, @stuff | unshift $arrayref, @stuff |
| pop @$arrayref | pop $arrayref |
| shift @$arrayref | shift $arrayref |
| splice @$arrayref, 0, 2 | splice $arrayref, 0, 2 |
| keys %$hashref | keys $hashref |
| keys @$arrayref | keys $arrayref |
| values %$hashref | values $hashref |
| values @$arrayref | values $arrayref |
| ($k,$v) = each %$hashref | ($k,$v) = each $hashref |
| ($k,$v) = each @$arrayref | ($k,$v) = each $arrayref |
|----------------------------+---------------------------|
This allows these built-in functions to act on long dereferencing
chains or on the return value of subroutines without needing to wrap
them in C<@{}> or C<%{}>:
push @{$obj->tags}, $new_tag; # old way
push $obj->tags, $new_tag; # new way
for ( keys %{$hoh->{genres}{artists}} ) {...} # old way
for ( keys $hoh->{genres}{artists} ) {...} # new way
For C<push>, C<unshift> and C<splice>, the reference will auto-vivify
if it is not defined, just as if it were wrapped with C<@{}>.
Calling C<keys> or C<values> directly on a reference gives a
substantial performance improvement over explicit dereferencing.
For C<keys>, C<values>, C<each>, when overloaded dereferencing is
present, the overloaded dereference is used instead of dereferencing
the underlying reftype. Warnings are issued about assumptions made in
the following three ambiguous cases:
(a) If both %{} and @{} overloading exists, %{} is used
(b) If %{} overloading exists on a blessed arrayref, %{} is used
(c) If @{} overloading exists on a blessed hashref, @{} is used
|
|
|
|
|
|
|
|
| |
This also happens to apply to *{ $::{glob} }, but not to *{\*glob} or
*{$thing = *glob}.
In other words, it’s only when the operand is a real glob, and not a
reference or a SVt_FAKE glob.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
This has the side-effect of fixing these one-liners:
$ perl5.13.5 -le' my $glob = \*foo::ISA; delete $::{"foo::"}; *$glob = *a'
Bus error
$ perl5.13.5 -le' my $glob = \*foo::ISA; delete $::{"foo::"}; *$glob = []'
Bus error
$ perl5.13.6 -le'sub baz; my $glob = \*foo::bar; delete $::{"foo::"}; *$glob = *baz;'
Bus error
$ perl5.13.6 -le'sub foo::bar; my $glob = \*foo::bar; delete $::{"foo::"}; *$glob = *baz;'
Bus error
In the first two cases the crash was inadvertently fixed (isn’t it
nice when that happens?) in 5.13.6 (by 6f86b615fa7), but there was
still a fatal error:
Can't call mro_isa_changed_in() on anonymous symbol table at -e line 1.
Because sv_clear calls ->DESTROY, if an object’s stash has been
detached from the symbol table, mro_get_linear_isa can be called on a
hash with no HvENAME. So HvNAME is used as a fallback for those cases.
|
|
|
|
|
| |
With change a5b92898, negation started modifying numeric arguments,
causing problems for modules like Data::Float.
|
| |
|
|
|
|
|
|
|
|
|
|
| |
Stop *{} from returning globs with the SVf_FAKE flag on.
It removes three tests from t/op/gv.t (that I added) that test buggy
edge cases that can no longer occur.
It also modifies tests in t/io/defout.t to keep them passing. I am not
sure that test script serves any purpose any more.
|
| |
|
|
|
|
|
| |
The & | ^ operators now avoid turning on numericness of read-only
arguments.
|
|
|
|
|
| |
The attached patch adds the conversion if the value of the SV
looks_like_number.
|
|
|
|
|
|
| |
This fixes ! by changing sv_2bool to sv_2bool_flags (with a macro
wrapper) and adding SvTRUE_nomg. It also corrects the docs that state
incorrectly that SvTRUE does not handle magic.
|
|
|
|
|
|
| |
This patch changes sv_eq, sv_cmp, sv_cmp_locale and sv_collxfrm
to _flags forms, with macros under the old names for sv_eq and
sv_collxfrm, but functions for sv_cmp* since pp_sort.c needs them.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
It's was intended as a temporary namespace only, and we really don't want to
ship it in any release until we've figured out what it should really look like.
This reverts commit 05c0d6bbe3ec5cc9af99d105b8648ad02ed7cc95,
"add sv_reftype_len() and make sv_reftype() be a wrapper for it"
commit 792477b9c2e4c75cb03d07bd6d25dc7e1fdf448e,
"create the "mauve" temporary namespace for things like reftype"
commit 8df6b97c1de8326d50ac9c8cae4bf716393b45bb,
"mauve.t needs access to %Config, make sure it's available"
commit cfe9162d0d593cd12a979c73df82c7509b324343,
"use more efficient sv_reftype_len() interface"
and commit 47b13905e23c2a72acdde8bb4669e25e5eaefec4
"add more tests to lib/mauve.t so it tests also that mauve::reftype can return "LVALUE""
There's a `mauve' branch still containing all the code for the temporary mauve
namespace. That should be used to work on it until it's mostly ready to be
released, and only then merged to blead. Alternatively, it should be deleted if
another way to provide mauve's features in the core is found.
|
|
|
|
|
|
|
|
|
| |
[perl #9466]
pp_postinc and pp_postdec used a pad TARG to return a copy of the
original value. When that value was a reference, it meant a copy
of the reference would hang out in the pad forever and so the referent
would leak. Fix this by using a mortal instead.
|
| |
|
|
|
|
|
|
|
|
| |
Assignment of length() to a lexical is optimized by passing the
assigned-to variable as TARG, avoiding a pp_padsv and pp_sassign.
9f621b which changed length(undef) to return undef didn't take this into
account, and used SETs (which doesn't set TARG), so the code above left
$x == 3.
|
|
|
|
| |
TEMP instead of using TARG. Made appropriate TODO tests live.
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
This commit changes srand to to return the seed instead of always
returning 1. The motivation behind this is to allow applications to not
have to come up with their own pseudo-random generator if they want
repeatable results.
The previous return behavior has never been documented. Note that it is
possible, but very unlikely, for the seed to end up being 0, which means
that if someone were relying on the undocumented previous behavior of
srand returning true, that in very rare instances it would return 0,
failing, and the next time they ran it, it would succeed, possibly
leading to puzzlement and very rare unexplained failures.
|
|
|
|
|
|
| |
Now that CvGV can sometimes be reference counted, stop people from directly
assigning to it (by using CvGV as an lvalue), and instead force them to use
CvGV_set()
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Each CV usually has a pointer, CvGV(cv), back to the GV that corresponds
to the CV's name (or to *foo::__ANON__ for anon CVs). This pointer wasn't
reference counted, to avoid loops. This could leave it dangling if the GV
is deleted.
We fix this by:
For named subs, adding backref magic to the GV, so that when the GV is
freed, it can trigger processing the CV's CvGV field. This processing
consists of: if it looks like the freeing of the GV is about to trigger
freeing of the CV too, set it to NULL; otherwise make it point to
*foo::__ANON__ (and set CvAONON(cv)).
For anon subs, make CvGV a strong reference, i.e. increment the refcnt of
*foo::__ANON__. This doesn't cause a loop, since in this case the
__ANON__ glob doesn't point to the CV. This also avoids dangling pointers
if someone does an explicit 'delete $foo::{__ANON__}'.
Note that there was already some partial protection for CvGV with
commit f1c32fec87699aee2eeb638f44135f21217d2127. This worked by
anonymising any corresponding CV when freeing a stash or stash entry.
This had two drawbacks. First it didn't fix CVs that were anonmous or that
weren't currently pointed to by the GV (e.g. after local *foo), and
second, it caused *all* CVs to get anonymised during cleanup, even the
ones that would have been deleted shortly afterwards anyway. This commit
effectively removes that former commit, while reusing a bit of the
actual anonymising code.
|
|
|
|
| |
Signed-off-by: David Golden <dagolden@cpan.org>
|
|
|
|
|
| |
This reduces object code size, reducing CPU cache pressure on the non-exception
paths.
|
|
|
|
|
|
|
|
|
| |
Much simplification ensues - witness the diffstat.
Changes Perl_die_unwind() to use Perl_croak() rather than DIE().
Reverses an unwise part of bb4c52e023e0fcad.
Reverts 9e95c6350a60744d and 805bf316c58ab2d7.
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Unicode contains two context-sensitive case-changing rules. This patch
enables one of them, dealing with the Greek YPOGEGRAMMENI. The code had
been #ifdef'd out, so the changes here are more than what the diff
shows. The reason it was #ifdef'd out was because more research was
needed to verify that it was correct, which I have now done, and think
it is.
The issue is we may just be uppercasing a portion of the context, so
don't have complete knowledge of what should be done. This patch causes
us to move the ypogegrammeni to as far right as it should go, or to the
end of the context we know about, whichever comes first. That's the
best we can do. If it really should be moved further to the right,
there's no way we can do it, because the user has not called uc()
with the full information needed. So, in all cases, this is better than
just leaving it where it was in the input. Also, the applicable context
is limited to a logical character, that matched by /\X/, so if the user
is calling uc() on a subset of a logical character, it really is their
mistake.
|
|
|
|
|
| |
This better represents its current role as specifically delaying magic on
@ISA as opposed to a general array magic delay mechanism.
|
|
|
|
|
|
| |
This is achieved by introducing a new find_rundefsv() function in pad.c
This fixes [perl #75436].
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
The previous commit made various ops such as rv2av unconditionally do
an SvGETMAGIC(). Under some circumstances this could cause a double
mg_get() (and hence double FETCH etc). In particular, when the
proceeding op was something like aelem with OPpDEREF, the aelem would
call vivify_ref(), which would call magic. So in peep(), mark
OP_RV2[SAH]V ops with the new OPpDEREFed flag if the preceding op was
OPpDEREF. Then use this flag to avoid a second dose of magic.
Note that RV2GV probably needs this flag too, but there weren't any
spare private flag bits left for that op (I think).
|
|
|
|
|
| |
This is just like bug 68192, except in this case it’s a different set
of operators that have had this problem for much longer.
|