This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
Aaron Crane [Fri, 17 Oct 2014 15:59:22 +0000 (16:59 +0100)]
Make fileno() builtin work on directory handles
This requires OS support in the form of either the dirfd() function, or a
dd_fd member in the DIR struct. POSIX.1-2008 specifies the former. If
neither is available, fileno() on a directory handle will return undef and
set errno.
David Mitchell [Fri, 24 Oct 2014 15:26:38 +0000 (16:26 +0100)]
Add OP_MULTIDEREF
This op is an optimisation for any series of one or more array or hash
lookups and dereferences, where the key/index is a simple constant or
package/lexical variable. If the first-level lookup is of a simple
array/hash variable or scalar ref, then that is included in the op too.
So all of the following are replaced with a single op:
$h{foo}
$a[$i]
$a[5][$k][$i]
$r->{$k}
local $a[0][$i]
exists $a[$i]{$k}
delete $h{foo}
while these aren't:
$a[0] already handled by OP_AELEMFAST
$a[$x+1] not a simple index
and these are partially replaced:
(expr)->[0]{$k} the bit following (expr) is replaced
$h{foo}[$x+1][0] the first and third lookups are each done with
a multideref op, while the $x+1 expression and
middle lookup are done by existing add, aelem etc
ops.
Up until now, aggregate dereferencing has been very heavyweight in ops; for
example, $r->[0]{$x} is compiled as:
gv[*r] s
rv2sv sKM/DREFAV,1
rv2av[t2] sKR/1
const[IV 0] s
aelem sKM/DREFHV,2
rv2hv sKR/1
gvsv[*x] s
helem vK/2
When executing this, in addition to the actual calls to av_fetch() and
hv_fetch(), there is a lot of overhead of pushing SVs on and off the
stack, and calling lots of little pp() functions from the runops loop
(each with its potential indirect branch miss).
The multideref op avoids that by running all the code in a loop in a
switch statement. It makes use of the new UNOP_AUX type to hold an array
of
typedef union {
PADOFFSET pad_offset;
SV *sv;
IV iv;
UV uv;
} UNOP_AUX_item;
In something like $a[7][$i]{foo}, the GVs or pad offsets for @a and $i are
stored as items in the array, along with a pointer to a const SV holding
'foo', and the UV 7 is stored directly. Along with this, some UVs are used
to store a sequence of actions (several actions are squeezed into a single
UV).
Then the main body of pp_multideref is a big while loop round a switch,
which reads actions and values from the AUX array. The two big branches in
the switch are ones that are affectively unrolled (/DREFAV, rv2av, aelem)
and (/DREFHV, rv2hv, helem) triplets. The other branches are various entry
points that handle retrieving the different types of initial value; for
example 'my %h; $h{foo}' needs to get %h from the pad, while '(expr)->{foo}'
needs to pop expr off the stack.
Note that there is a slight complication with /DEREF; in the example above
of $r->[0]{$x}, the aelem op is actually
aelem sKM/DREFHV,2
which means that the aelem, after having retrieved a (possibly undef)
value from the array, is responsible for autovivifying it into a hash,
ready for the next op. Similarly, the rv2sv that retrieves $r from the
typeglob is responsible for autovivifying it into an AV. This action
of doing the next op's work for it complicates matters somewhat. Within
pp_multideref, the autovivification action is instead included as the
first step of the current action.
In terms of benchmarking with Porting/bench.pl, a simple lexical
$a[$i][$j] shows a reduction of approx 40% in numbers of instructions
executed, while $r->[0][0][0] uses 54% fewer. The speed-up for hash
accesses is relatively more modest, since the actual hash lookup (i.e.
hv_fetch()) is more expensive than an array lookup. A lexical $h{foo}
uses 10% fewer, while $r->{foo}{bar}{baz} uses 34% fewer instructions.
Overall,
bench.pl --tests='/expr::(array|hash)/' ...
gives:
PRE POST
------ ------
Ir 100.00 145.00
Dr 100.00 165.30
Dw 100.00 175.74
COND 100.00 132.02
IND 100.00 171.11
COND_m 100.00 127.65
IND_m 100.00 203.90
with cache misses unchanged at 100%.
In general, the more lookups done, the bigger the proportionate saving.
David Mitchell [Mon, 27 Oct 2014 17:33:32 +0000 (17:33 +0000)]
add UNOP_AUX OP class
This is the same as a UNOP, but with the addition of an op_aux field,
which points to an array of UNOP_AUX_item unions.
It is intended as a general escape mechanism for adding per-op-type extra
fields (or arrays of items) to UNOPs.
Its class character (for regen/opcodes etc) is '+'.
Currently there are no ops of this type; but shortly, OP_MULTIDEREF will
be added, which is the original motivation for this new op type.
David Mitchell [Sun, 2 Nov 2014 16:01:00 +0000 (16:01 +0000)]
ext/B/Makefile.PL: spot hex defines
The regex in ext/B/Makefile.PL was failing to find C constants of the
form
#define FOO 0xNNN
where NNN contained one or more [a-fA-F] chars
With this change it imports a few more constants:
CXTYPEMASK
GVf_IMPORTED
RV2CVOPCV_FLAG_MASK
OPpARG4_MASK
OPpPADRANGE_COUNTMASK
David Mitchell [Thu, 30 Oct 2014 10:28:06 +0000 (10:28 +0000)]
Perl_op_sibling_splice(): update OPf_KIDS
Previously this function didn't update OPf_KIDS when altering the
children. This was only safe as long as the count of kids didn't transition
between 0 and !0.
David Mitchell [Fri, 24 Oct 2014 15:23:38 +0000 (16:23 +0100)]
add S_deb_padvar() to dump.c
factor out the code that prints a pad var name in -Dt output
David Mitchell [Thu, 7 Aug 2014 15:34:23 +0000 (16:34 +0100)]
add S_op_clear_gv() to op.c
Abstract out the code that clear an GV attached to an op,
since we will shortly need to do this in more than one place
David Mitchell [Sun, 27 Jul 2014 19:59:48 +0000 (20:59 +0100)]
create S_check_hash_fields() function
factor out the code in S_finalize_op() that performs checks on hash keys
into a separate function, since we'll shortly need to call this code from
more than one place.
Father Chrysostomos [Sun, 7 Dec 2014 05:48:27 +0000 (21:48 -0800)]
Increase $arybase::VERSION to 0.09
syber [Sun, 7 Dec 2014 00:26:04 +0000 (03:26 +0300)]
gv_fetchmeth_sv now supports SV shared hashes
gv_fetchmeth_internal added, which receives method name
both as SV and const char. Now it calls hv_common instead
of hv_fetch.
gv_fetchmeth_pvn and gv_fetchmeth_sv are now just wrappers
for gv_fetchmeth_internal
Result: x2 speedup for gv_fetchmeth_sv new SV is a shared hash
BEFORE
PVN - 28.5 Mcalls/s
SV SHARED HASH - 26 Mcalls/s
AFTER
PVN - 29.4 Mcalls/s
SV SHARED HASH - 51 Mcalls/s
James Raspass [Sat, 6 Dec 2014 22:51:57 +0000 (22:51 +0000)]
Tweak sv_pos_b2u_flags check in pp_index
There's no need to run sv_pos_b2u_flags if the retval is one as
one byte can only be one character, therefore change the test to
"> 1". This makes index on unicode strings that match at 1 slightly
faster.
Father Chrysostomos [Sun, 7 Dec 2014 01:21:13 +0000 (17:21 -0800)]
Revert ‘Used pad name lists for pad ids’
This reverts commit
8771da69db30134352181c38401c7e50753a7ee8.
Pad lists need to carry IDs around with them, so that when something
tries to close over a pad, it is possible to confirm that the right
pad is being closed over (either the original outer pad, or a clone of
it). (See the commit message of
db4cf31d1, in which commit I added an
ID to the padlist struct.)
In
8771da69 I found that I could use the memory address of the pad’s
name list (name lists are shared) and avoid the extra field.
Some time after
8771da69 I realised that a pad list could be freed,
and the same address reused for another pad list, so using a memory
address may not be so wise. I thought it highly unlikely, though, and
put it on the back burner.
I have just run into that. t/comp/form_scope.t is now failing
for me with test 13, added by
db4cf31d1. It bisects to
3d6de2cd1
(PERL_PADNAME_MINIMAL), but that’s a red herring. Trivial changes
to the script make the problem go away. And it only happens on non-
debugging builds, and only on my machine. Stepping through with gdb
shows that the format-cloning is following the format prototype’s out-
side pointer and confirming that it is has the correct pad (yes, the
memory addresses are the same), which I know it doesn’t, because I can
see what the test is doing.
While generation numbers can still fall afoul of the same problem, it
is much less likely.
Anyway, the worst thing about
8771da69 is the typo in the first word
of the commit message.
Father Chrysostomos [Sat, 6 Dec 2014 14:23:28 +0000 (06:23 -0800)]
form_scope.t: Diagnostics for test 13
Daniel Dragan [Sat, 6 Dec 2014 05:32:44 +0000 (00:32 -0500)]
Win32 Intel C is always C99 now
Father Chrysostomos [Sat, 6 Dec 2014 19:36:42 +0000 (11:36 -0800)]
deparse-skips.txt: Note why comp/parser.t fails
Father Chrysostomos [Sat, 6 Dec 2014 19:36:09 +0000 (11:36 -0800)]
deparse-skips.txt: comp/proto.t now passes
Father Chrysostomos [Sat, 6 Dec 2014 19:33:15 +0000 (11:33 -0800)]
Deparse & calls with scalar() where necessary
This is wrong:
$ ./perl -Ilib -mO=Deparse,-P -e 'sub foo($$){}; foo(bar(), baz())'
sub foo ($$) {
}
&foo(bar(), baz());
-e syntax OK
The resulting code calls bar and baz in list context.
Father Chrysostomos [Sat, 6 Dec 2014 14:44:39 +0000 (06:44 -0800)]
Deparse.pm:pp_entersub: Refactor repetition away
I’m about to modify this code, and having two copies of the join(...)
is not so helpful.
Jarkko Hietaniemi [Sun, 7 Dec 2014 00:03:45 +0000 (19:03 -0500)]
Initialize ab_op_info before use.
Balancing act between gcc/clang versions: some versions would
be happy with = { 0 }, some versions complain that with = { 0 }
some fields might be uninitialized. (The latter might be known
stupidness with some gcc versions.) But all versions I tested
seem to agree that Zero() (memset in disguise) will initialize.
Jarkko Hietaniemi [Sat, 6 Dec 2014 21:00:23 +0000 (16:00 -0500)]
Add a comment explaining what to do if this test fails.
Jarkko Hietaniemi [Sat, 6 Dec 2014 20:58:01 +0000 (15:58 -0500)]
threads.pm version bump for
0c87ebb8.
Jarkko Hietaniemi [Sat, 6 Dec 2014 20:27:41 +0000 (15:27 -0500)]
Followup
3f39ca90: those functions need no prototypes for ext/re.
Jarkko Hietaniemi [Sat, 6 Dec 2014 15:14:30 +0000 (10:14 -0500)]
g++ groks __attribute__((unused)) at least since 4.3.6.
Cannot find the exact moment from gcc release notes, but tests fine in 4.3.6.
(not fine = "warning: unused ...")
Jarkko Hietaniemi [Sat, 6 Dec 2014 14:21:34 +0000 (09:21 -0500)]
If no lchown, not using the args.
Jarkko Hietaniemi [Sat, 6 Dec 2014 14:04:49 +0000 (09:04 -0500)]
Variables possibly clobbered by longjmp/vfork.
(my_perl in the line 480 has the same problem, but messier to fix.)
Jarkko Hietaniemi [Sat, 6 Dec 2014 13:42:11 +0000 (08:42 -0500)]
These functions are not used with ext/re.
Father Chrysostomos [Sat, 6 Dec 2014 14:15:40 +0000 (06:15 -0800)]
B::Deparse: Escape non-ASCII printable chars
Before this, we were escaping all non-ASCII chars if the string con-
tained any non-printable chars. So ".\x{100}" would come out exactly
like that, but "\x{100}" would be deparsed as "Ā", causing problems if
the script has no ‘use utf8’ in scope.
(It was also misbehaving on EBCDIC, causing the existing \x
test to fail.)
Father Chrysostomos [Sat, 6 Dec 2014 14:01:03 +0000 (06:01 -0800)]
Deparse.pm: Don’t call maybe_parens for sv_undef
(LIST)[INDEX] is neat, but it doesn’t short-circuit, so it should not
be used if LIST contains method calls.
Father Chrysostomos [Sat, 6 Dec 2014 06:44:56 +0000 (22:44 -0800)]
Remove comp/opsubs.t from deparse-skips.txt
It passes. Since when I don’t know.
Father Chrysostomos [Sat, 6 Dec 2014 06:43:40 +0000 (22:43 -0800)]
Remove comp/hints.t from deparse-skips.txt
It passes, probably due to BEGIN block fixes.
Father Chrysostomos [Sat, 6 Dec 2014 06:41:49 +0000 (22:41 -0800)]
deparse-skips.txt: Note some skip reasons
Father Chrysostomos [Sat, 6 Dec 2014 06:40:15 +0000 (22:40 -0800)]
Remove comp/form_scope.t from deparse-skips.txt
It passes!
Father Chrysostomos [Sat, 6 Dec 2014 05:41:30 +0000 (21:41 -0800)]
Deparse formats in the right spot
Formats need the same logic applied in
34b54951568, to avoid this:
Input:
{
my $x;
format STDOUT =
@
$x
.
}
__END__
$ pbpaste|./perl -Ilib -MO=Deparse
{
my $x;
}
format STDOUT =
@
$x
.
__DATA__
- syntax OK
That $x in the format is now global, not lexical.
Also, we need to make sure the sequence numbers are correct. The
statement after the format stopped having a higher sequence number
than CvOUTSIDE_SEQ(format) in
8635e3c238f, because the ‘pending’
sequence number set aside for the nextstate op created just after com-
pile-time block exit (which nextstate op comes before the block) was
not actually being used by newFORM (unlike newATTRSUB), so the follow-
ing statement was using that number.
Father Chrysostomos [Sat, 6 Dec 2014 05:45:10 +0000 (21:45 -0800)]
Avoid extraneous ‘();’ when deparsing just subs
34b54951 caused a program that is empty apart from sub definitions to
be deparsed with ‘();’ for the main sub. Previously it was omitted.
This commit removes it, not only for the sake of backward-compatibil-
ity, but also because ‘();’ is not a particularly sane way of dumping
an empty program.
Father Chrysostomos [Sat, 6 Dec 2014 06:06:58 +0000 (22:06 -0800)]
op.c: use GV_NOTQUAL in newATTRSUB_x
If we are scanning for the package separator ourselves, then we can
notify gv_fetchsv that we found none, so it doesn’t have to scan
again.
Daniel Dragan [Wed, 3 Dec 2014 09:59:46 +0000 (04:59 -0500)]
1 exit path for returning ptr in Perl_safesysmalloc and Perl_safesysrealloc
commit
6edcbed640 goto-ed around an initialization and was partially
reverted in commit
c62df97fd6 . This patch restores the intention of
commit
6edcbed640 by having only 1 exit path that will be returning
a pointer (and not croaking).
Father Chrysostomos [Sat, 6 Dec 2014 04:40:22 +0000 (20:40 -0800)]
Increase $NDBM_File::VERSION to 1.14
Father Chrysostomos [Sat, 6 Dec 2014 04:39:52 +0000 (20:39 -0800)]
Increase $mro::VERSION to 1.17
Father Chrysostomos [Sat, 6 Dec 2014 04:39:29 +0000 (20:39 -0800)]
Increase $Data::Dumper::VERSION to 2.155
Daniel Dragan [Sat, 6 Dec 2014 01:23:06 +0000 (20:23 -0500)]
dont test for bootstrap file twice in XSLoader
This saves ~8ms on my mech HD Win64 system per load() call.
See [perl #123373] for details.
Daniel Dragan [Fri, 5 Dec 2014 22:34:32 +0000 (17:34 -0500)]
cleanup logic in S_sv_uncow
I couldnt understand this code at first glance. Many empty conditional
blocks because of page protection ROing which isn't implemented on Win32,
caused erratic stepping in my debugger with CC optimizations *off*.
-read COWREFCNT only once
-save COWREFCNT to an auto for debugger visual inspection
-don't check len twice
-don't write sv_buf_to_rw() twice
No change in behavior is expected.
Father Chrysostomos [Sat, 6 Dec 2014 01:55:17 +0000 (17:55 -0800)]
Revert "toke.c: Remove redundant PL_expect check"
This reverts commit
8b4c5ad11955dc809ba3b7d6672b3a13ea54e770.
It caused bug #123372.
Father Chrysostomos [Sat, 6 Dec 2014 01:55:08 +0000 (17:55 -0800)]
Test bug #123372
Jarkko Hietaniemi [Sat, 6 Dec 2014 02:59:28 +0000 (21:59 -0500)]
Initialize possibly uninitialized.
Jarkko Hietaniemi [Sat, 6 Dec 2014 01:16:54 +0000 (20:16 -0500)]
Unused expression + variable.
Jarkko Hietaniemi [Sat, 6 Dec 2014 01:14:20 +0000 (20:14 -0500)]
Some versions of gcc -Wextra are too paranoid about { 0 }.
Jarkko Hietaniemi [Sat, 6 Dec 2014 01:04:08 +0000 (20:04 -0500)]
POSIX math potentially unused vars.
Jarkko Hietaniemi [Fri, 5 Dec 2014 03:08:28 +0000 (22:08 -0500)]
gcc thinks it can see how 'entry' can be accessed uninitialized.
Jarkko Hietaniemi [Fri, 5 Dec 2014 02:58:56 +0000 (21:58 -0500)]
POSIX nan: declaring s always potentially unused.
Jarkko Hietaniemi [Fri, 5 Dec 2014 02:41:11 +0000 (21:41 -0500)]
Unused hv_store() result.
Jarkko Hietaniemi [Fri, 5 Dec 2014 02:40:19 +0000 (21:40 -0500)]
Unused var.
Jarkko Hietaniemi [Fri, 5 Dec 2014 02:23:59 +0000 (21:23 -0500)]
printf type-matching continues. again.
Father Chrysostomos [Fri, 5 Dec 2014 22:46:53 +0000 (14:46 -0800)]
Deparse PVMG stubs
Creating a weak reference to a stash entry will cause it to be of type
PVMG, if it was not a GV already. B::Deparse was trying to determine,
based on the internal SV type, whether it had a sub stub. It should
be checking flags instead, otherwise valid stubs get omitted.
Father Chrysostomos [Fri, 5 Dec 2014 14:21:35 +0000 (06:21 -0800)]
Deparse predeclared prototyped subs
A predeclared sub without a prototype works fine:
$ ./perl -Ilib -MO=Deparse -e 'sub f; sub f{}; foo()'
sub f {
}
foo();
-e syntax OK
A prototyped sub with no predeclaration is fine:
$ ./perl -Ilib -MO=Deparse -e ' sub f($){}; foo()'
sub f ($) {
}
foo();
-e syntax OK
A prototyped stub is fine:
$ ./perl -Ilib -MO=Deparse -e 'sub f($); foo()'
sub f ($);
foo();
-e syntax OK
Only a predeclared prototyped sub seems to have trouble appear-
ing properly:
$ ./perl -Ilib -MO=Deparse -e 'sub f($); sub f($){}; foo()'
sub f;
foo();
-e syntax OK
The code that searches the stashes (stash_subs) was assuming that any-
thing of type B::PV was a prototype. In this case, the stash entry
started as a string and then got ‘downgraded’ to a reference, so
internally it is of type PV (which can hold a ref), which B represents
as B::PV, so the assumption that a PV is a prototyped stub is wrong.
Steffen Mueller [Fri, 5 Dec 2014 19:43:08 +0000 (20:43 +0100)]
Revert "Remove branch seemingly untaken"
This reverts commit
9349a6bbb9de151e5385038b962ceff7c7278b53.
It is taken. Sigh. I'm sorry.
Steffen Mueller [Fri, 5 Dec 2014 16:23:55 +0000 (17:23 +0100)]
Remove branch seemingly untaken
An HV* that is not an SVt_PVHV? Maybe I don't have sufficient fantasy.
This branch goes back to 1994, so things have changed ... a bit since
then.
Father Chrysostomos [Fri, 5 Dec 2014 06:41:02 +0000 (22:41 -0800)]
Restore profile dump under PERL_DESTRUCT_LEVEL
$ ./perl -Ilib -DP -e0
filter_add func
1000dfa20 ()
filter_read 0: via function
7f8fd302fe88 ()
filter_read 0: via function
7f8fd302fe88 ()
filter_del func
1000dfa20
EXECUTING...
1 nextstate
1 enter
1 leave
$ PERL_DESTRUCT_LEVEL=2 ./perl -Ilib -DP -e0
filter_add func
107b81a20 ()
filter_read 0: via function
7f81e882fea0 ()
filter_read 0: via function
7f81e882fea0 ()
filter_del func
107b81a20
EXECUTING...
The list of ops executed is omitted if I set PERL_DESTRUCT_LEVEL=2.
This was probably broken by
bf9cdc68d2.
Father Chrysostomos [Fri, 5 Dec 2014 01:28:19 +0000 (17:28 -0800)]
Correct dependencies for charclass_invlists.h
regen.t should fail if Unicode tables are updated and this header is
not regenerated.
See commit
713f4b7fa and the thread beginning at
<
20141204124705.472.qmail@lists-nntp.develooper.com>.
Father Chrysostomos [Fri, 5 Dec 2014 00:13:19 +0000 (16:13 -0800)]
op.c:fold_constants: Remove OP_RV2GV/newGVOP
OP_RV2GV is not foldable, so it never reaches this code, which
goes back to
79072805 (perl 5.0 alpha 2). Even back then it was
unreachable.
Father Chrysostomos [Fri, 5 Dec 2014 00:11:02 +0000 (16:11 -0800)]
op.c:fold_constants: Simplify OP_STRINGIFY logic
Don’t put the same condition in two places. We are already using a bool-
ean. We can put the result of the condition in it.
Father Chrysostomos [Fri, 5 Dec 2014 00:07:45 +0000 (16:07 -0800)]
Return fresh scalar from join(const,const)
$ perl5.20.1 -Ilib -le 'for(1,2) { push @_, \join "x", 1 } print for @_'
SCALAR(0x7fb131005438)
SCALAR(0x7fb131005648)
$ ./perl -Ilib -le 'for(1,2) { push @_, \join "x", 1 } print for @_'
SCALAR(0x7fe612831b30)
SCALAR(0x7fe612831b30)
Notice how we now get two references to the same scalar. I broke this
accidentally in
987c9691. If join has two arguments, it gets con-
verted to a stringify op. The stringify op might get constant-folded,
and folding of stringify is special, because the parser uses it
itself to implement qq(). So I had ck_join set op_folded to flag
the op as being a folded join. Only that came too late, because
op_convert_list(OP_STRINGIFY,...) folds the op before it returns it.
Hence, the folded constant was flagged the wrong way, and stopped
being implicitly copied by refgen (\).
Chris 'BinGOs' Williams [Fri, 5 Dec 2014 00:05:50 +0000 (00:05 +0000)]
Locale-Maketext 1.26 is now on CPAN
Todd Rinaldo [Thu, 4 Dec 2014 23:54:22 +0000 (18:54 -0500)]
Syncing back Changelog to be consistent with CPAN release
Whitespace corrections; update perldelta.
For: RT #121671
Chris 'BinGOs' Williams [Thu, 4 Dec 2014 22:59:24 +0000 (22:59 +0000)]
Update Encode to CPAN version 2.67
[DELTA]
$Revision: 2.67 $ $Date: 2014/12/04 20:13:00 $
! t/taint.t
Now skips nonexistent methods like Encode::Detect->encode() should
that be installed. This resolves RT#100105.
https://rt.cpan.org/Ticket/Display.html?id=100105
Father Chrysostomos [Thu, 4 Dec 2014 20:32:55 +0000 (12:32 -0800)]
Don’t deparse formats with #line directives
$ perl5.20.1 -mO=Deparse,-l -e 'format =' -e\@ -e'$foo' -e.
format STDOUT =
@
$foo
.
-e syntax OK
$ ./perl -Ilib -mO=Deparse,-l -e 'format =' -e\@ -e'$foo' -e.
format STDOUT =
@
#line 3 "-e"
; $foo
.
-e syntax OK
The second is not valid syntax.
I probably broke that when fixing BEGIN blocks.
Father Chrysostomos [Thu, 4 Dec 2014 19:16:27 +0000 (11:16 -0800)]
dump.c: Don’t dump CvOUTSIDE SV when there is none
$ ./perl -Ilib -MDevel::Peek -Mfeature=:all -Xle 'my sub f; Dump \&f'
SV = IV(0x7fd7138312b0) at 0x7fd7138312c0
REFCNT = 1
FLAGS = (TEMP,ROK)
RV = 0x7fd713831b90
SV = PVCV(0x7fd7138303d0) at 0x7fd713831b90
REFCNT = 2
FLAGS = (CLONED,DYNFILE,NAMED,LEXICAL)
COMP_STASH = 0x7fd713807ce8 "main"
ROOT = 0x0
NAME = "f"
FILE = "-e"
DEPTH = 0
FLAGS = 0x19040
OUTSIDE_SEQ = 187
PADLIST = 0x7fd7134067e8
PADNAME = 0x7fd713411f88(0x7fd713406d48) PAD = 0x7fd713807e68(0x7fd71340d2f8)
OUTSIDE = 0x0 (null)
SV = 0
That final ‘SV = 0’ is very confusing!
Father Chrysostomos [Thu, 4 Dec 2014 16:39:28 +0000 (08:39 -0800)]
[perl #123357] Fix deparsing of $; at stmt end
Instead of sometimes appending ; to statements and then removing it
later, to avoid doubling it up, *only* append ; to a statement when
actually joining them together or emitting them. That fixes bugs with
do{$;} becoming do {$} and ‘$_=$;; $;=7;’ becoming ‘$_=$; $;=7;’.
I also removed the boilerplate from pp_stub, since it was redundant
(and slow) and also partially wrong. The $name var was bogus.
Father Chrysostomos [Thu, 4 Dec 2014 13:45:01 +0000 (05:45 -0800)]
Deparse.pm: Remove temp pre-PADNAME code
added in
d4f1bfe749f, which got merged before the PADNAME changes.
Father Chrysostomos [Thu, 4 Dec 2014 13:43:23 +0000 (05:43 -0800)]
Deparse.pm: Remove special \0 marker
In
4b1385ee6 I did not realise we already had \cK, which served almost
the same purpose.
Craig A. Berry [Thu, 4 Dec 2014 14:02:09 +0000 (08:02 -0600)]
Unescape directory portion of path in unixify.
Basically I missed a spot in
812e68ff314e, so the escaped space
in [foo^_bar], for example, was not translated correctly.
Father Chrysostomos [Thu, 4 Dec 2014 06:41:45 +0000 (22:41 -0800)]
Add checksum to regcharclass.h
and check that checksum in t/porting/regen.t. This makes the tests
run faster.
Father Chrysostomos [Thu, 4 Dec 2014 06:37:22 +0000 (22:37 -0800)]
Add checksum to charclass_invlists.h
and check that checksum in t/porting/regen.t. This makes the tests
run faster.
Father Chrysostomos [Thu, 4 Dec 2014 06:07:39 +0000 (22:07 -0800)]
Deparse $x =~ (1?/$a/:0) under taint mode
This code deparses incorrectly under taint mode:
$ ./perl -Ilib -mO=Deparse -e '$x =~ (1?/$a/:0)'
$x =~ ($_ =~ /$a/);
-e syntax OK
$ ./perl -Ilib -mO=Deparse -T -e '$x =~ (1?/$a/:0)'
$x =~ /$a/;
-e syntax OK
The branch folding makes it deparse as ‘$x =~ /$a/’, whereas the /$a/
on the rhs, since it was not the argument to =~, is bound to $_, not
to $x. That’s why B::Deparse adds the $_ =~, but it fails to do so
under taint mode.
It was broken by:
commit
7fb31b92fa6bf56dff7d4240b7051b9158f7df43
Author: David Mitchell <davem@iabyn.com>
Date: Sun Apr 1 10:21:22 2012 +0100
make OP_REGCRESET only for taint handling
The OP_REGCRESET op, which is sometimes prepended to the chain of ops
leading to OP_REGCOMP, currently serves two purposes; first to reset the
taint flag, and second to initialise PL_reginterp_cnt. The second purpose
is no longer needed, and the first has a bug, in that the op isn't
prepended when "use re 'eval'" is in scope.
Fix this by prepending the op solely when PL_tainting is in effect.
This also makes run-time regexes slightly more efficient in the
non-tainting case.
which has a typo in it.
Shlomi Fish [Thu, 16 Oct 2014 09:25:30 +0000 (12:25 +0300)]
perlfork.pod: convert "\t"s to spaces.
For: RT #122987 (second part)
Shlomi Fish [Thu, 16 Oct 2014 09:20:22 +0000 (12:20 +0300)]
Remove trailing whitespace.
For: RT #122987 (first part)
Shlomi Fish [Thu, 16 Oct 2014 08:43:06 +0000 (11:43 +0300)]
Convert "\t"s to spaces in perlref.pod.
For: RT #122986
Aristotle Pagaltzis [Thu, 10 Oct 2013 05:24:10 +0000 (07:24 +0200)]
perldata: document corrected list slicing behaviour
Father Chrysostomos [Wed, 3 Dec 2014 21:55:03 +0000 (13:55 -0800)]
[perl #114498] lslice returning empty vs undef
Formerly, list slice would return an empty list if all the indices
fell outside the actual list, but would return ‘undef’ for every index
specified if but one of them fell within the list.
This was not implemented according to the original design, according
to which list slice would give an empty list (for a non-zero number of
indices) only if the list on the left-hand side were empty.
This commit rectifies that. See ticket #114498 for the discussion.
Father Chrysostomos [Thu, 4 Dec 2014 01:45:31 +0000 (17:45 -0800)]
[Merge] Deparse regexp code blocks
The actual ops that make up the code blocks are now deparsed.
B::Deparse no longer uses the stringified form stored in the regexp.
This fixes a few bugs. See the individual commits for details.
Father Chrysostomos [Wed, 3 Dec 2014 20:52:13 +0000 (12:52 -0800)]
Deparse s/// with code blocks
Before, s/$a(?{die})// would deparse like this:
s/${a}do {
die
}(?{die})//;
Now it deparses correctly.
Father Chrysostomos [Wed, 3 Dec 2014 06:25:59 +0000 (22:25 -0800)]
Deparse.pm: Fold some logic into sub code_list
Both callers were doing $op->first->sibling, so just have code_list
do that itself.
Father Chrysostomos [Wed, 3 Dec 2014 06:22:25 +0000 (22:22 -0800)]
Deparse qr// and m// with code blocks and vars
Before, this:
/$a(?{ die $b; })/;
qr/$a(?{ die $b; })/;
would deparse as this:
/${a}do {
die $b
}(?{ die $b; })/;
qr/sub : lvalue {
$a, do {
die $b
}, '(?{ die $b; })'
}
->()/;
Now it deparses correctly.
Father Chrysostomos [Wed, 3 Dec 2014 02:10:35 +0000 (18:10 -0800)]
Deparse regexp code blocks in m// and split //
The blocks themselves are now deparsed, rather than the original strings
being emitted. This fixes problems with newlines turning into \n and
here-docs missing their bodies. It only applies to compile-time patterns.
Run-time patterns (with variables interpolated outside the code blocks)
are still unfixed and deparse with do{...} embedded in the pattern.
Father Chrysostomos [Tue, 2 Dec 2014 22:53:32 +0000 (14:53 -0800)]
Deparse.t: Put a line break after the test code
The line break gets removed when it is extracted from the __DATA__
section, and then it gets wrapped in sub{$input}. That breaks
here-docs.
Father Chrysostomos [Tue, 2 Dec 2014 17:33:38 +0000 (09:33 -0800)]
Deparse qr/(?{code_blocks})/ with no interpolation
This is a preliminary patch that only applies when there are no varia-
bles interpolated into the pattern outside of the code blocks.
The code blocks are now actually deparsed, instead of the stringified
form just being reproduced. This means the \n bug is gone:
Before:
$ ./perl -Ilib -mO=Deparse -e '{ qr/aaaaa\\\\\\(?{;' -e '$y})' -e '/}'
{
qr/aaaaa\\\\\\(?{;\n\$y})\n/;
}
-e syntax OK
After:
$ ./perl -Ilib -mO=Deparse -e '{ qr/aaaaa\\\\\\(?{;' -e '$y})' -e '/}'
{
qr/aaaaa\\\\\\(?{ $y; })\n/;
}
-e syntax OK
You can see the \n translation now happens only outside of the block.
It also means here-docs work:
Before:
$ ./perl -Ilib -mO=Deparse -e 'qr/(??{<<END})/' -efoo -eEND
qr/(??{<<END})/;
-e syntax OK
(The output is a syntax error.)
After:
$ ./perl -Ilib -mO=Deparse -e 'qr/(??{<<END})/' -efoo -eEND
qr/(??{ "foo\n"; })/;
-e syntax OK
Father Chrysostomos [Tue, 2 Dec 2014 14:06:05 +0000 (06:06 -0800)]
Deparse FOO =~ y///r correctly
Apparently anything =~ y///r with the /r never deparsed properly (just
the lhs deparsed) until
05a502dc, when lexicals on the lhs started
being emitted.
Father Chrysostomos [Tue, 2 Dec 2014 06:32:41 +0000 (22:32 -0800)]
To-do tests for deparsing regexp code blocks
Currently we have various bugs:
• Line breaks often come out as \n, changing the meaning.
• Some blocks are doubled up with do{...} for the first instance.
• qr/sub { .... }/ madness
Father Chrysostomos [Tue, 2 Dec 2014 13:57:40 +0000 (05:57 -0800)]
Fix deparsing of $lexical =~ //
I broke this in
05a502dc.
Father Chrysostomos [Tue, 2 Dec 2014 13:51:36 +0000 (05:51 -0800)]
Deparse: matchop: Remove double method+function call
Father Chrysostomos [Wed, 3 Dec 2014 20:37:24 +0000 (12:37 -0800)]
perldelta for the prev. commit
based on https://rt.perl.org/Ticket/Display.html?id=40565#txn-1321149
Father Chrysostomos [Wed, 3 Dec 2014 18:30:06 +0000 (10:30 -0800)]
[perl #40565] Fix localisation in pseudo-fork
Several SAVEt_* types were giving the SVs the wrong reference counts
in ss_dup, causing child process to lose SVs too soon.
See <https://rt.perl.org/Ticket/Display.html?id=40565#txn-1180404>
and <https://rt.perl.org/Ticket/Display.html?id=40565#txn-1277127>.
Karl Williamson [Wed, 26 Nov 2014 21:01:43 +0000 (14:01 -0700)]
dump.c: Clarify pod
Karl Williamson [Sun, 30 Nov 2014 05:40:34 +0000 (22:40 -0700)]
perly.c: Fix off-by-1 error for EBCDIC platforms
Code point 255 was being omitted in the translation. It's better to use
the macro (that has it correctly) and avoid a redundant copy of the
test.
David Mitchell [Wed, 3 Dec 2014 16:55:46 +0000 (16:55 +0000)]
special-case Pod::Checker ABSTRACT
Currently the auto-generated Makefile.PL for Pod::Checker raises a
warning with MakeMaker, since the abstract in the pod isn't parseable.
Also, the package's own Makefile.PL doesn't work with blead (I didn't
exactly understand what the issue was, but porting/dual_lift.t complained
about missing utilities).
So the most expedient hack is to special-case the ABSTRACT in make_ext.pl.
David Mitchell [Wed, 3 Dec 2014 15:49:15 +0000 (15:49 +0000)]
reinstate cpan/IO-Compress/Makefile.PL
This was removed a year ago, but it causes problems with
ABSTACT and ABSTACT_FROM; since there isn't an IO/Compress.pm
file. make_ext.pl special-cases Makefile.PL to get the abstract
from IO/Compress/Base.pm; but MakeMaker looks for, and fails to
find, 'IO::Compress - ...' in the pod for that file,and prints an error.
Rather than more special-casing, it's easier to just restore the
distribution's Makefile.PL, which already contains the correct
'ABSTRACT => ...' entry.
Chris 'BinGOs' Williams [Wed, 3 Dec 2014 13:46:27 +0000 (13:46 +0000)]
Update IO-Socket-IP to CPAN version 0.34
[DELTA]
0.34 2014/12/03 00:04:56
[BUGFIXES]
* Don't select() for read-readiness when waiting for non-blocking
connect() because it upsets VMS (RT100654)
Chris 'BinGOs' Williams [Wed, 3 Dec 2014 13:44:45 +0000 (13:44 +0000)]
Update Encode to CPAN version 2.66
[DELTA]
$Revision: 2.66 $ $Date: 2014/12/02 23:30:34 $
! bin/enc2xs
Resolved RT#100656: enc2xs -C fails if URL::Encode::XS is installed
https://rt.cpan.org/Ticket/Display.html?id=100656
Craig A. Berry [Wed, 3 Dec 2014 04:09:12 +0000 (22:09 -0600)]
Eliminate eliminate_macros and fixpath.
These functions have been deprecated outside of MakeMaker for
many years, but due to the complicated inheritance situation
in EUMM have been difficult to get rid of because sometimes the
File::Spec versions would get called when we thought we were
calling the MakeMaker versions. As of MakeMaker 7.04, the last
call to the File::Spec version of fixpath is gone, so we can
finally remove these from File::Spec.
And bump PathTools versions once again.
David Mitchell [Wed, 3 Dec 2014 13:30:12 +0000 (13:30 +0000)]
reduce stderr noise in build
Ideally you should be able to do
(Configure && make test) 2> /tmp/err
with /tmp/err being empty. This is not the case, and this commit
is a first step towards that goal.
The
fprintf (stderr, "Sizeof time_t = %ld\n", sizeof (time_t));
in Configure appears to be just a debugging aid; it's also a copy of the
code in Porting/timecheck.c, which people can always run if need-be.
hints/linux.sh appears to be looking for symbols in libdb.so; if the
library is stripped, this produces to stderr:
/bin/nm: /lib/libdb.so: no symbols
I've silenced it for now with a 2>/dev/null, but I'm not sure if the whole
test is flawed, since with no symbols, 'nm libdb.so | grep pthread' is a
no-op.
make_patchnum.pl, when running backticks, prints $? to stderr if it's
non-zero; since a similar print in the other branch is already commented
out, I assume its just left-over debugging.
David Mitchell [Wed, 3 Dec 2014 10:53:00 +0000 (10:53 +0000)]
Stop test suite filling /tmp
Some test files use File::Temp in such a way that the temporary files and
directories under /tmp aren't deleted at the end. On a smoker system, this
can gradually accumulate thousands of entries under /tmp.
The general culprits fixed by this commit are:
1) using tempfile() without the UNLINK => 1 argument;
2) Using Test::More (which uses Test::Stream), which creates a test
directory in such a way that only the original parent thread will
remove it; for some reason I still don't fully understand, detaching a
thread rather than joining it stops this clean up happening. In the
affected test files, I replaced the ->detach() with a ->join() just
before exit, and the problem went away.
Some tests under cpan/ are still leaky; these will be addressed upstream.