| Commit message (Collapse) | Author | Age | Files | Lines |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
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, <>.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
The message ‘Variable "%s" is not imported’ cannot be suppressed, even
with -X (local $SIG{__WARN__}=sub{} is what I have to use):
perl -Xle '$foo;use strict; eval q/$foo/ or die "---$@---"'
Variable "$foo" is not imported at (eval 1) line 2.
---Global symbol "$foo" requires explicit package name at (eval 1) line 2.
--- at -e line 1.
This is because we have what appears to the user to be a multi-line
error message. It is in fact a warning ‘Variable...’ followed by an
error ‘Global symbol...’.
The attached patch assigns a warning category to the warning.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Nasty code like the following results in PL_defoutgv not pointing
to a valid GV:
my $x = *STDERR; select($x); $x = 1;
This causes all sorts of SEGVs when PL_defoutgv is subsequently accessed,
because most code assumes that it has a valid gv_gp pointer. It also
turns out that PL_defoutgv is under-tested; for example, temporarily
hacking pp_close to make an arg-less close() croak didn't cause any
minitest failures.
Add a new test file that does some basic testing of a bad PL_defoutgv,
and fix all the obvious badness in accessing it.
This also fixes #20727, which although ostensibly a tie bug, was due to
PL_defoutgv pointing to a tiedelem scalar, and fun like that described
above happening.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
f7461760003db2ce68155c97ea6c1658e96fcd27 improved the PL_check hook for
bareword subs, but broke the above module. This is Zefram's followup:
The issue is that speculative function lookups were leaving detritus
consisting of empty GVs in the stash. These didn't affect normal
functioning, but code that looks inside the stash could see them, and
code that makes unreliable assumptions about the format of the stash
can be broken. This is the same general mode of failure that we saw
with namespace::clean.
LinkedList-Single's failing test was using direct stash access poorly,
in a way that made for a poor test, quite apart from making too many
assumptions about stash structure. In the latest version of the package,
0.99.6, the test has been changed to a much better form, which actually
tests what it meant to and incidentally doesn't read the stash at all.
Although they don't affect normal functioning, the empty GVs shouldn't
be there. It's much like the upgraded constant subs, which we concluded
ought to be downgraded when the upgraded form is no longer required,
in order to save memory. The solution here is similar: delete the
empty GV when it is detected that a real GV is no longer required.
The present patch does this at the same time as checking for constant-sub
downgradability.
|
|
|
|
|
|
| |
It can be hard especially for those unfamiliar with the source to find
where variables like $` and $[ are set up, now they're just a ack -Q
away.
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Attached is a patch that changes how the tokeniser looks up subroutines,
when they're referenced by a bareword, for prototype and const-sub
purposes. Formerly, it has looked up bareword subs directly in the
package, which is contrary to the way the generated op tree looks up
the sub, via an rv2cv op. The patch makes the tokeniser generate the
rv2cv op earlier, and dig around in that.
The motivation for this is to allow modules to hook the rv2cv op
creation, to affect the name->subroutine lookup process. Currently,
such hooking affects op execution as intended, but everything goes wrong
with a bareword ref where the tokeniser looks at some unrelated CV,
or a blank space, in the package. With the patch in place, an rv2cv
hook correctly affects the tokeniser and therefore the prototype-based
aspects of parsing.
The patch also changes ck_subr (which applies the argument context and
checking parts of prototype behaviour) to handle subs referenced by an
RV const op inside the rv2cv, where formerly it would only handle a gv
op inside the rv2cv. This is to support the most likely kind of
modified rv2cv op.
The attached patch is the resulting revised version of the bareword
sub patch. It incorporates the original patch (allowing rv2cv op
hookers to control prototype processing), the GV-downgrading addition,
and a mention in perldelta.
|
|
|
|
|
|
|
|
|
|
|
| |
If this is defined, it will be called instead of stringification
whenever an object is used as a regexp or interpolated into a regexp.
This will fall back to stringification even without C<fallback => 1>,
for compatibility.
An overloaded 'qr' must return either a REGEXP or a ref to a REGEXP
(such as created by qr//). Any further overloading on the return value
will be ignored.
|
| |
|
|
|
|
|
|
|
| |
None were documented as also being in 'syntax'. Effectively, this completes the
reorganisation of commits 12bcd1a617c74d6e and 9014280dc8264580. See
http://www.xray.mpe.mpg.de/mailing-lists/perl5-porters/2009-10/msg00601.html and
http://www.xray.mpe.mpg.de/mailing-lists/perl5-porters/2002-03/msg00850.html
|
|
|
|
|
| |
Replace ckWARN_d{,2,3,4}() && Perl_warner() with it, which trades reduced code
size for 1 more function call if warnings are not enabled.
|
|
|
|
|
|
|
| |
Replace ckWARN{,2,3,4}() && Perl_warner() with it, which trades reduced code
size (about 0.2%), for 1 more function call if warnings are not enabled.
However, if we're now in the L1 or L2 cache when we weren't previously, that's
still going to be a speed win.
|
|
|
|
|
|
|
|
|
|
| |
As it may be needed later when the lookup failed.
This fixes [perl #69066].
However, from now, "package ::" and "package foo::" respectively introduce
the "::" and "foo::" packages. Deciding if this is the correct thing to do
ought to be addressed separately.
|
| |
|
|
|
|
| |
and tweaking Perl_sv_upgrade().
|
|
|
|
| |
The "short" names become macro wrappers, and the Perl_* versions become mathoms.
|
|
|
|
| |
This fixes bug #68182
|
|
|
|
|
| |
This way we'll restore most of the performance on object desctruction
lost by the previous commit
|
|
|
|
|
|
|
|
| |
This boolean parameter indicates if the function has been called
to update the overload magic table while looking up the DESTROY
method. In this case, it's probably best to avoid croaking if
those tables could not be updated (for example due to a method
that could not be loaded.)
|
|
|
|
| |
matching entry in perldiag (and fix it so that more of the existing ones do).
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Curiously, this appears to always have been implemented slightly inefficiently.
It dates from perl 4.000, which added the functionality to make assigning to $0
set the process name. The equivalent fix for 4.000 is:
--- a/perl.c
+++ b/perl.c
@@ -738,7 +738,7 @@ FIX YOUR KERNEL, PUT A C WRAPPER AROUND THIS SCRIPT, OR USE -u AND UNDUMP!\n");
(void)hadd(sigstab);
}
- magicalize("!#?^~=-%.+&*()<>,\\/[|`':\004\t\020\024\027\006");
+ magicalize("!#?^~=-%.+&*()<>,\\/[|`':0\004\t\020\024\027\006");
userinit(); /* in case linked C routines want magical variables */
amperstab = stabent("&",allstabs);
@@ -828,7 +828,6 @@ FIX YOUR KERNEL, PUT A C WRAPPER AROUND THIS SCRIPT, OR USE -u AND UNDUMP!\n");
#endif
if (tmpstab = stabent("0",allstabs)) {
str_set(stab_val(tmpstab),origfilename);
- magicname("0", Nullch, 0);
}
if (tmpstab = stabent("\030",allstabs))
str_set(stab_val(tmpstab),origargv[0]);
|
| |
|
|
|
|
|
| |
Explicitly zero the memory for PL_psig_ptr, PL_psig_name and PL_psig_pend if we
didn't need to allocate it this time round.
|
| |
|
| |
|
|
|
|
| |
allowed to access the corresponding string buffer byte
|
|
|
|
| |
In amagic_call(), the 'method' arg comes the overload enum in overload.h, but is expected to match the bit set from %overloading::numbers::names. It values wrongly start at 1, differing by 1 from the enum indexes. This didn't appear in the tests because 'method' was reduced modulo 7 instead of 8.
|
| |
|
|
|
|
| |
Plus a comment by Nicholas
|
| |
|
|
|
| |
p4raw-id: //depot/perl@34931
|
|
|
| |
p4raw-id: //depot/perl@34926
|
|
|
|
|
|
|
| |
Message-ID: <20081120131719.GA32120@timac.local>
[tweaked for blead because of change 27941]
p4raw-id: //depot/perl@34896
|
|
|
|
|
| |
Message-ID: <20081114084436.GJ5779@tytlal.topaz.cx>
p4raw-id: //depot/perl@34831
|
|
|
| |
p4raw-id: //depot/perl@34710
|
|
|
|
|
|
| |
Message-ID: <20081103160130.GA45762@timac.local>
Date: Mon, 3 Nov 2008 16:01:31 +0000
p4raw-id: //depot/perl@34705
|
|
|
|
|
|
| |
Message-ID: <25940.1225611819@chthon>
Date: Sun, 02 Nov 2008 01:43:39 -0600
p4raw-id: //depot/perl@34698
|
|
|
|
|
|
| |
Can't easily do gv.h, as GvGP() (at least) needs to split into two
macros - one const for reading, one non-const for writing.
p4raw-id: //depot/perl@34679
|
|
|
|
|
| |
erroneous const in dump.c.
p4raw-id: //depot/perl@34675
|
|
|
| |
p4raw-id: //depot/perl@34654
|
|
|
| |
p4raw-id: //depot/perl@34653
|
|
|
| |
p4raw-id: //depot/perl@34647
|
|
|
| |
p4raw-id: //depot/perl@34629
|
|
|
| |
p4raw-id: //depot/perl@34585
|
|
|
|
|
| |
coincidentally were both from changes I made)
p4raw-id: //depot/perl@33814
|
|
|
|
|
| |
Perl_gv_fetchmethod_flags()
p4raw-id: //depot/perl@33707
|
|
|
|
|
|
| |
a non-NULL stash. So change the parameter to NN.
* Fixed the one really obscure hitherto untested case.
p4raw-id: //depot/perl@33706
|
|
|
| |
p4raw-id: //depot/perl@33704
|
|
|
| |
p4raw-id: //depot/perl@33703
|
|
|
|
|
|
|
|
|
|
|
| |
gv_fetchmethod. It therefore needs to duplicate a lot of
the internals of that function.
"Duplicate". <snigger>. You said a naughty word. Now sanitised.
[All tests pass, but I'm not 100% confident that this code is
equivalent in all reachable corner cases, and it may be possible
to simplify the error reporting logic now in gv_fetchmethod_flags]
p4raw-id: //depot/perl@33702
|