| Commit message (Collapse) | Author | Age | Files | Lines |
|
|
|
|
|
| |
This patch uses the recently-added MAYBE_DEREF_GV macro which puts the
glob deref logic in one spot. It also adds _nomg and _flags varia-
tions of it. _flags understands the SV_GMAGIC flag.
|
|
|
|
|
|
|
|
|
|
|
|
| |
Commit 557fbd17eb added the MAYBE_DEREF_GV macro, which 2ea1cce
applied to chdir, chmod and chown.
That macro calls get-magic on its arguments checks to see if it might
be a gv or ref and, if it’s a ref, calls get-magic on the referent,
to see whether it will turn into a gv. That means we’ll end up with
chdir($array_obj) calling get-magic on the array. While probably
harmless, calling get-magic is superfluous and probably incorrect. I
don’t know that there is a reasonable way to test this.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
There are so many parts of the core (mostly pp functions or functions
they call) that need a glob or a globref, including many that call
get-magic at the wrong time (or not at all in some cases, that it
makes sense to add a macro to do it.
It can be used like this:
if (gv = MAYBE_DEREF_GV(sv)) /* calls get-magic */
{
}
else { /* avoid magic here */
}
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
This restores the old definition of dPOPTOPiirl_nomg from
before 96b6b87 and the old definition of dPOPXiirl_ul_nomg from
before e62ca0f (except for a bug fix: POPi cannot be used since
it’s magical). It also reverts most of c31c291.
This does mean that uninitialized warnings for various operators are
back in reverse order. So I am reinstating a bug with this commit. But
that bug was never a 5.14 blocker and so should never have been fixed
during code freeze (and there is the slight possibility that the fix
would break sensitive test suites). It was only fixed ‘for free’ as a
side effect of fixing [perl #87708], but that bug turned out to have a
better fix (commit 75ea7a1) that allows these changes to be reverted.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
The short story: In 5.13.1 or .2 these ops started calling get-magic
just once if the same gmagical scalar was used for both operands. Then
the same value would be used on both sides. In 5.12 FETCH would be
called twice with both return values used, but they would be swapped
in most cases (so $t/$t would return 1.5 if $t returned 2 and then
3). Now FETCH is called twice and the two operands are used in the
right order.
Up till now there have been patches to fix specific ops, but I real-
ised that the same ten or so lines of code would have to be added to
the rest of the 20+ pp_ functions, all of which use tryAMAGICbin_MG
(which calls Perl_try_amagic_bin in gv.c), so it made sense to add the
code to Perl_try_amagic_bin instead. This fixes all the ops in one
fell swoop.
The code in question checks whether the left and right operands are
the same gmagical scalar. If so, it copies the scalar into a new mor-
tal one, and then calls get-magic on the original operand to get its
new value (for the rhs). The new scalar is placed just below the top
of the stack, so it becomes the left operand.
This does slow down the bitwise integer ops slightly, but only in this
rare edge case. And the simplification of the code seems worth it.
Forthcoming are commits that revert some of the changes already made,
as this commit renders them unnecessary.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
This is just part of #87708.
This fixes the % and * operators under ‘use integer’ when the same
tied scalar is used for both operands and returns two different val-
ues. Before this commit, get-magic would be called only once and
the same value used. In 5.12.x * just worked but the operands were
swapped for %.
It turns out that every operator using the dPOPTOPiirl_nomg macro
needs exactly the same treatment, so this commit eliminates the
dPOPTOPiirl_halfmg macro added a few commits ago and modifies
dPOPTOPiirl_nomg to do was it was doing. This should be perfectly
safe, as dPOPTOPiirl_nomg has not been in a stable release (and is
only for internal use anyway).
|
|
|
|
|
|
|
|
|
| |
This is just part of #87708.
This fixes + and - under ‘use integer’ when the same tied scalar is
used for both operands and returns two different values. Before this
commit, get-magic would be called only once and the same value used.
In 5.12.x + just worked but the operands were swapped for -.
|
|
|
|
|
|
|
|
|
| |
This is just part of #87708.
This fixes <=> under ‘use integer’ when the same tied scalar is used
for both operands and returns two different values. Before this com-
mit, get-magic would be called only once and the same value used. In
5.12.x, the operands would be reversed.
|
|
|
|
|
|
|
| |
This fixes atan2 when the same tied scalar is used for both operands
and returns two different values. Before this commit, get-magic would
be called only once and the same value used. In 5.12.x, the operands
would be reversed.
|
|
|
|
|
| |
Add a flag TIED_METHOD_SAY to Perl_tied_method(), to allow tied PRINT to
effect C<local $\ = "\n";> within the ENTER/LEAVE pair of Perl_tied_method().
|
|
|
|
| |
It can be used for (at least) the call to "SPLICE" from pp_splice.
|
| |
|
|
|
|
|
| |
Expecting the targ in sp[-1] rather than sp[0] is accomplished
cleanly using dATARGET.
|
|
|
|
|
|
|
|
| |
Due to the way that '<> as glob' was parsed differently from
'<> as filehandle' from 5.6 onwards, something like <$foo[0]>
didn't handle overloading, even where $foo[0] was an overloaded object.
This was contrary to the docs for overload, and meant that <> couldn't
be used as a general overloaded iterator operator.
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
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).
|
|
|
|
| |
tryAMAGICunDEREF() isn't used anywhere in the core. Add tests for it.
|
|
|
|
| |
Nothing outside the core was using this macro.
|
|
|
|
|
|
|
|
|
| |
This removes around 300 bytes of object code from each place it was previously
inlined. It also provides a better interface - quite a lot of the core
currently bodges things by creating a local variable C<SV **sp = &sv> to use
the macro.
Change the XS::APItest wrapper to amagic_deref_call().
|
|
|
|
|
|
|
| |
Only Perl_amagic_call() was using RvDEEPCP() when it was added in 5.000, and I
believe that it's never had any other users (in the core, on CPAN, or anywhere
else visible to Google codesearch). Hence it seems an ideal candidates to be
inlined and eliminated.
|
|
|
|
|
|
|
|
| |
Yes, it was a while loop implemented using goto, although this only became
clear by untangling the macros. I believe it need never have been implemented
as goto, given that the other user of tryAMAGICunW_var "broke" out of the
"if"'s block using a return, hence that "if" could have been a "while" all
along.
|
|
|
|
|
| |
Aside from the 2 callers where it can be replaced with AMG_CALLun().
AMG_CALLun_var was only used in core.
|
|
|
|
|
|
|
| |
This also inlines and eliminates FORCE_SETs and setAGAIN.
The three eliminated macros were not referenced from anywhere else. (The core,
CPAN, code visible to Google codesearch.)
|
|
|
|
|
| |
tryAMAGICunW was only used within pp.h itself, and not referenced from anywhere
else. (The core, CPAN, code visible to Google codesearch.)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Since commit 6f1401dc2acd2a2b, many AMAGIC macros in pp.h are no longer used
in core, nor in modules or CPAN, nor in code visible to Google codesearch.
Specifically:
tryAMAGICbinW_var
tryAMAGICbinW
tryAMAGICbin_var
tryAMAGICbin
tryAMAGICbinSET
tryAMAGICbinSET_var
tryAMAGICbinW_var
AMG_CALLbinL
tryAMAGICun_var
tryAMAGICun
tryAMAGICunSET_var
tryAMAGICunSET
tryAMAGICftest
|
|
|
|
|
|
|
|
|
| |
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.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
In most places, ops checked their args for overload *before* doing
mg_get(). This meant that, among other issues, tied vars that
returned overloaded objects wouldn't trigger calling the
overloaded method. (Actually, for tied and arrays and hashes, it
still often would since mg_get gets called beforehand in rvalue
context).
This patch does the following:
Makes sure get magic is called first.
Moves most of the overload code formerly included by macros at the
start of each pp function into the separate helper functions
Perl_try_amagic_bin, Perl_try_amagic_un, S_try_amagic_ftest,
with 3 new wrapper macros:
tryAMAGICbin_MG, tryAMAGICun_MG, tryAMAGICftest_MG.
This made the code 3800 bytes smaller.
Makes sure that FETCH is not called multiple times. Much of this
bit was helped by some earlier work from Father Chrysostomos.
Added new functions and macros sv_inc_nomg(), sv_dec_nomg(),
dPOPnv_nomg, dPOPXiirl_ul_nomg, dPOPTOPnnrl_nomg, dPOPTOPiirl_ul_nomg
dPOPTOPiirl_nomg, SvIV_please_nomg, SvNV_nomg (again, some of
these were based on Father Chrysostomos's work).
Fixed the list version of the repeat operator (x): it now only
calls overloaded methods for the scalar version:
(1,2,$overloaded) x 10
no longer erroneously calls
x_method($overloaded,10))
The only thing I haven't checked/fixed yet is overloading the
iterator operator, <>.
|
| |
|
|
|
|
|
|
| |
Filetest ops don't always expect an op on the stack, so we should use
TOPs only if we're sure that we're not stat'ing the _ filehandle.
This is indicated by OPf_KIDS (as checked in ck_ftst).
|
| |
|
| |
|
| |
|
| |
|
| |
|
|
|
|
| |
pp_hslice
|
|
|
| |
p4raw-id: //depot/perl@34585
|
|
|
|
|
|
| |
From: Rick Delaney (via RT) <perlbug-followup@perl.org>
Message-ID: <rt-3.6.HEAD-22068-1213469460-652.55786-75-0@perl.org>
p4raw-id: //depot/perl@34055
|
|
|
|
|
| |
results in slightly smaller object code. (No extra work is done.)
p4raw-id: //depot/perl@32834
|
|
|
|
|
|
|
|
|
| |
The macros all create new mortals using sv_newmortal(), and those
cannot be magical. This is in contrary to the X?PUSH macros, which
operate on TARG, which can be magical.
With that in mind, mentioning whether or not mX?PUSH can handle
'set' magic doesn't make sense any longer.
p4raw-id: //depot/perl@32824
|
|
|
|
|
|
| |
and mortalizing them. Use these macros where possible. And also
mX?PUSH[inpu] where possible.
p4raw-id: //depot/perl@32821
|
|
|
| |
p4raw-id: //depot/perl@32237
|
|
|
|
|
| |
Message-ID: <prol131i8b27re246alnhmem4mj13fcl2b@4ax.com>
p4raw-id: //depot/perl@30879
|
|
|
| |
p4raw-id: //depot/perl@29907
|
|
|
|
|
| |
space saving to merge them. Hopefully this will reduce L2 cache misses.
p4raw-id: //depot/perl@29836
|
|
|
|
|
|
| |
files that generate .h files, so they'll be ready
next time.
p4raw-id: //depot/perl@29695
|
|
|
|
|
| |
The overloading tests are not free.
p4raw-id: //depot/perl@27126
|
|
|
|
|
| |
which don't do the pre-processor string manipulation internally.
p4raw-id: //depot/perl@27122
|
|
|
|
|
| |
(Since change 17990 added version object overloading)
p4raw-id: //depot/perl@26516
|
|
|
|
|
|
|
| |
Message-ID: <20051227203939.GC1781@petdance.com>
Includes a small fix to the changes in tryAMAGICbinW_var() in pp.h.
p4raw-id: //depot/perl@26505
|