platform/upstream/perl.git
11 years ago[perl #96230] Stop qr// from reusing last pattern
Father Chrysostomos [Sat, 22 Sep 2012 14:13:36 +0000 (07:13 -0700)]
[perl #96230] Stop qr// from reusing last pattern

qr// should not be using the last-successful pattern, because it is
"(?^:)", not the empty pattern.  A stringified qr// does not use the
last-successful pattern.

11 years agoLet qr.t run from the top level
Father Chrysostomos [Sat, 22 Sep 2012 05:44:00 +0000 (22:44 -0700)]
Let qr.t run from the top level

11 years agoqr.t: Load test.pl in BEGIN
Father Chrysostomos [Sat, 22 Sep 2012 05:43:34 +0000 (22:43 -0700)]
qr.t: Load test.pl in BEGIN

so lazy people like me can omit parentheses

11 years agohv.c: comment typo
Father Chrysostomos [Fri, 21 Sep 2012 04:31:15 +0000 (21:31 -0700)]
hv.c: comment typo

11 years agoAdd #!/bin/sh when re-ordering config_h.SH
H.Merijn Brand [Sat, 22 Sep 2012 09:59:25 +0000 (11:59 +0200)]
Add #!/bin/sh when re-ordering config_h.SH

Also add a small comment to indicate the use of this script

Based on
Subject: [PATCH] Giving config_h.SH a shebang via Porting/config_h.pl
From: Sawyer X <xsawyerx@gmail.com>
Date: Fri, 21 Sep 2012 21:15:43 +0300
Message-ID: <505CAECF.1060600@gmail.com>

11 years agoWe don't want statistics for every single blead release
Florian Ragwitz [Fri, 21 Sep 2012 14:50:15 +0000 (10:50 -0400)]
We don't want statistics for every single blead release

11 years agoThe repository is called perlweb
Florian Ragwitz [Thu, 20 Sep 2012 13:05:36 +0000 (09:05 -0400)]
The repository is called perlweb

11 years agoRemove a couple of tentacles from MiNT missed by commit cd86ed9d430a95bb.
Nicholas Clark [Fri, 21 Sep 2012 10:22:27 +0000 (12:22 +0200)]
Remove a couple of tentacles from MiNT missed by commit cd86ed9d430a95bb.

11 years agoRemove the MPE/iX port.
Nicholas Clark [Thu, 20 Sep 2012 10:04:24 +0000 (12:04 +0200)]
Remove the MPE/iX port.

MPE/iX was a business-oriented minicomputer operating system made by
Hewlett-Packard. Support from HP terminated at the end of 2010.

11 years agoRefactor t/run/switcha.t to use test.pl instead of making TAP by hand.
Colin Kuskie [Sat, 15 Sep 2012 07:53:57 +0000 (00:53 -0700)]
Refactor t/run/switcha.t to use test.pl instead of making TAP by hand.

11 years agoRestore mymalloc build with ithreads
Steve Hay [Thu, 20 Sep 2012 23:25:03 +0000 (00:25 +0100)]
Restore mymalloc build with ithreads

Broken by commit 7cd83f6573.

11 years agoIncrease $File::Glob::VERSION to 1.18
Father Chrysostomos [Thu, 20 Sep 2012 21:48:48 +0000 (14:48 -0700)]
Increase $File::Glob::VERSION to 1.18

11 years ago[perl #114984] Glob.xs: Extend stack when returning
Father Chrysostomos [Thu, 20 Sep 2012 21:25:38 +0000 (14:25 -0700)]
[perl #114984] Glob.xs: Extend stack when returning

If a pattern passed to File::Glob consists of a space-separated list
of patterns, the stack will only be extended by doglob() enough for
the list returned by each subpattern.  So iterate() needs to extend
the stack before copying the list of files from an AV to the stack.

This fixes a regression introduced in 5.16.0.

11 years ago[perl #107002] No warnings test for require a::b+1
Father Chrysostomos [Thu, 20 Sep 2012 16:56:18 +0000 (09:56 -0700)]
[perl #107002] No warnings test for require a::b+1

This used to produce an erroneous ambiguity warning.  The . case
stopped warning in 5.12.0.  The + case stopped warning earlier today
with commit c31f6d3b.

11 years agopp_hot.c: Clean up after the prev commit
Father Chrysostomos [Wed, 4 Jul 2012 19:51:31 +0000 (12:51 -0700)]
pp_hot.c: Clean up after the prev commit

Even before that it was more complicated than necessary, as
SvPV_nomg_const  never returns null.

11 years ago[perl #105922] Allow any string before ->meth
Father Chrysostomos [Thu, 20 Sep 2012 15:56:38 +0000 (08:56 -0700)]
[perl #105922] Allow any string before ->meth

The rules for filtering out what do not look like package names are
not logical and disallow valid things like "::main", while allowing
q"_#@*$!@*^(".

This commit simply lets any non-empty string be used as a package
name.  If it is a typo, you’ll get an error anyway.  This allows
autobox-style calls like "3foo"->CORE::uc, or even "3foo"->uc if you
set up @ISA first.

I made an exception for the empty string because it messes up caches
somehow and causes subsequent method calls all to be called on the
main package.  I haven’t looked into that yet.  I don’t know whether
it’s worth it.

The changes to the tests in cpan/Test-Simple have been submit-
ted upstream.

11 years ago...and we have a 5.17.9 volunteer
Ricardo Signes [Thu, 20 Sep 2012 16:36:48 +0000 (12:36 -0400)]
...and we have a 5.17.9 volunteer

11 years agorelease schedule updates
Ricardo Signes [Thu, 20 Sep 2012 16:26:31 +0000 (12:26 -0400)]
release schedule updates

11 years ago[perl #105924] require 1 << 2
Father Chrysostomos [Thu, 20 Sep 2012 13:24:25 +0000 (06:24 -0700)]
[perl #105924] require 1 << 2

Setting PL_expect after force_next has no effect, as force_next
(called by force_version and force_word) picks up the current value of
PL_expect and arranges for it to be reset thereto after the forced
token is force-fed to the parser.

The KEY_require case should be setting PL_expect to XTERM (as it
already does) when there is no forced token (version or bareword),
because we expect a term after ‘require’, but to XOPERATOR when
there is a forced token, because we expect an operator after that
forced token.

Since the PL_expect assignment has no effect after force_next, we can
set it to XOPERATOR before calling potentially calling force_next, and
then to XTERM afterwards.

Loop exits had the same bug, so this fixes them all.

11 years agoEliminate the vestigial comment "magical thingies" from intrpvar.h
Nicholas Clark [Thu, 20 Sep 2012 08:20:35 +0000 (10:20 +0200)]
Eliminate the vestigial comment "magical thingies" from intrpvar.h

The original comment "magical thingies" was added to perl.c by commit
8ebc5c0145d2e355 in Jan 1997. It is above code which frees 4 interpreter-
global SVs in perl_destruct.

The comment "magical thingies" was in intrpvar.h since the file was created
by commit 49f531dad558d800 on 29 Nov 1997. At that time, it was followed by
a block of 13 relevant interpreter global variables. However, by commit
d4cce5f1785350c2 (30 Nov 1997) all bar two were now in other places, mostly
in thrdvar.h. With the abolition of PL_formfeed, the comment now annotates
just one "magical" thingy, PL_basetime, which isn't even one of the SVs
freed at the analogous location in perl.c. Hence the comment adds no value.

11 years agoUse gv_fetchpvs() instead of gv_fetchpv(), and GV_ADD, not TRUE.
Nicholas Clark [Thu, 20 Sep 2012 08:00:35 +0000 (10:00 +0200)]
Use gv_fetchpvs() instead of gv_fetchpv(), and GV_ADD, not TRUE.

This avoids a needless strlen(), and corrects a classic usage error for the
gv_fetch*() functions.

11 years agoGet rid of PL_formfeed.
Enache Adrian [Sat, 5 Jul 2003 19:08:07 +0000 (22:08 +0300)]
Get rid of PL_formfeed.

$^L is neither a magical variable, nor a normal one (like $;) but
it's just a little bit special :)

This patch removes PL_formfeed - IMHO, an extra gv_fetchpv per page
when using formats isn't going to cause a sensible speed regression.

I suppose that removing the intrpvar.h hunk from the patch is enough
to keep binary compatibility - unless someone used PL_formfeed from
an XS module.

[with regen.pl run as noted by the author, and an additional change to
perl.c to remove the reference to PL_formfeed added soon after this patch
was sent]

11 years agoFor backcompat, B::formfeed can use gv_fetchpvs() if there is no PL_formfeed.
Nicholas Clark [Wed, 19 Sep 2012 20:55:37 +0000 (22:55 +0200)]
For backcompat, B::formfeed can use gv_fetchpvs() if there is no PL_formfeed.

11 years agoop.c: Disentangle apply_attrs_my from apply_attrs
Father Chrysostomos [Thu, 20 Sep 2012 05:03:55 +0000 (22:03 -0700)]
op.c: Disentangle apply_attrs_my from apply_attrs

apply_attrs consisted of a top-level if/else conditional upon a bool-
ean argument.  It was being called with a TRUE argument in only one
place, apply_attrs_my.  Inlining that branch into apply_attrs_my actu-
ally reduces the amount of code slightly.

11 years ago[perl #114764] Stop my vars with attrs from leaking
Father Chrysostomos [Thu, 20 Sep 2012 04:53:51 +0000 (21:53 -0700)]
[perl #114764] Stop my vars with attrs from leaking

S_apply_attrs was creating a SV containing a stash name, that was
later to be put in a const op, which would take care of freeing it.
But it didn’t free it for a my variable, because the branch where that
const op was created didn’t apply.  So move the creation of that SV
inside the branch that uses it, otherwise it leaks.  This leak was the
result of commit 95f0a2f1ffc6.

11 years agoembed.fnc: Remove d flag from cv_clone_into
Father Chrysostomos [Wed, 19 Sep 2012 16:59:46 +0000 (09:59 -0700)]
embed.fnc: Remove d flag from cv_clone_into

I copied it from another entry by mistake.  I don’t think this should
be documented, at least not yet, as I am not confident the interface
is stable yet.  There may be significant changes before 5.18.

11 years agoBump the perl version to 5.17.5
Florian Ragwitz [Wed, 19 Sep 2012 20:23:12 +0000 (16:23 -0400)]
Bump the perl version to 5.17.5

11 years agoAdd a new perldelta
Florian Ragwitz [Wed, 19 Sep 2012 20:09:18 +0000 (16:09 -0400)]
Add a new perldelta

11 years agoAdd the 5.17.4 epigraph
Florian Ragwitz [Wed, 19 Sep 2012 20:07:28 +0000 (16:07 -0400)]
Add the 5.17.4 epigraph

11 years agoFix a few perldelta nits
Florian Ragwitz [Thu, 20 Sep 2012 00:13:17 +0000 (20:13 -0400)]
Fix a few perldelta nits

11 years agoSpecify what to push in the RMG
Florian Ragwitz [Wed, 19 Sep 2012 19:03:27 +0000 (15:03 -0400)]
Specify what to push in the RMG

11 years agoAdd 5.17.4 to perlhist
Florian Ragwitz [Wed, 19 Sep 2012 18:50:55 +0000 (14:50 -0400)]
Add 5.17.4 to perlhist

11 years agoUpdate Module::CoreList for v5.17.4
Florian Ragwitz [Wed, 19 Sep 2012 18:43:43 +0000 (14:43 -0400)]
Update Module::CoreList for v5.17.4

11 years agoMake a note of $Module::CoreList::TieHashDelta::VERSION
Florian Ragwitz [Wed, 19 Sep 2012 18:43:09 +0000 (14:43 -0400)]
Make a note of $Module::CoreList::TieHashDelta::VERSION

11 years agoQuote corelist bugtracker urls
Florian Ragwitz [Wed, 19 Sep 2012 18:42:03 +0000 (14:42 -0400)]
Quote corelist bugtracker urls

XSLoader started to have a bugtracker URL containing single quotes, which is
also what we currently quote bug trackers with.

11 years agoFinalise perldelta
Florian Ragwitz [Wed, 19 Sep 2012 17:52:28 +0000 (13:52 -0400)]
Finalise perldelta

11 years agoRemove an unused variable
Florian Ragwitz [Wed, 19 Sep 2012 17:39:27 +0000 (13:39 -0400)]
Remove an unused variable

11 years agoPerldelta up to 3b9aea0
Florian Ragwitz [Wed, 19 Sep 2012 17:23:48 +0000 (13:23 -0400)]
Perldelta up to 3b9aea0

11 years agoAdd new warning about sleep's limitation on Windows
Steve Hay [Wed, 19 Sep 2012 16:39:17 +0000 (17:39 +0100)]
Add new warning about sleep's limitation on Windows

This also came up recently in [perl #33096]. On Windows, sleep's unsigned
int argument range is effectively reduced by a factor of 1000 because the
emulation uses milliseconds rather than seconds.

11 years agoNote that sleep is emulated on Windows to allow alarm interrupts
Steve Hay [Wed, 19 Sep 2012 16:32:10 +0000 (17:32 +0100)]
Note that sleep is emulated on Windows to allow alarm interrupts

This came up recently in [perl #33096].

11 years agoRemove MAD-only debugging code from Perl_newATTRSUB_flags().
Nicholas Clark [Wed, 19 Sep 2012 15:43:21 +0000 (17:43 +0200)]
Remove MAD-only debugging code from Perl_newATTRSUB_flags().

When MAD was enabled, if the cv under compilation was named "import" it was
assigned to PL_formfeed, and its address issued as an mandatory warning.
The use of PL_formfeed was only ever intended as a way to enter a debugger.
See commits a2edbdc9c7ad6335 and c1bd9b63a6f9fb1f, which removed the other
places that co-opted PL_formfeed for MAD debugging purposes.

11 years agoDocument when the early return in Perl_newPROG() is bypassed completely.
Nicholas Clark [Tue, 4 Sep 2012 19:55:22 +0000 (21:55 +0200)]
Document when the early return in Perl_newPROG() is bypassed completely.

11 years ago[perl #114942] Correct scoping for ‘for my $x(){} $x’
Father Chrysostomos [Wed, 19 Sep 2012 06:19:52 +0000 (23:19 -0700)]
[perl #114942] Correct scoping for ‘for my $x(){} $x’

This was broken by commit 60ac52eb5d5.

What that commit did was to merge two different queues that the
lexer had for pending tokens.  Since bison requires that yylex
return exactly one token for each call, when the lexer sometimes has
to set aside tokens in a queue and return them from the next few
calls to yylex.

Formerly, there were two mechanism: the forced token queue (used by
force_next), and PL_pending_ident.  PL_pending_ident was used for
names that had to be looked up in the pads.

$foo was handled like this:

  First call to yylex:
    1. Put '$foo' in PL_tokenbuf.
    2. Set PL_pending_ident.
    3. Return a '$' token.
  Second call:
    PL_pending_ident is set, so call S_pending_ident, which looks up
    the name from PL_tokenbuf, and return the THING token containing
    the appropriate op.

The forced token queue took precedence over PL_pending_ident.  Chang-
ing the order (necessary for parsing ‘our sub foo($)’) caused some
XS::APItest tests to fail.  So I concluded that the two queues needed
to be merged.

As a result, the $foo handling changed to this:

  First call to yylex:
    1. Put '$foo' in PL_tokenbuf.
    2. Call force_ident_maybe_lex (S_pending_ident renamed and modi-
       fied), which looks up the symbol and adds it to the forced
       token queue.
    3. Return a '$' token.
  Second call:
    Return the token from the forced token queue.

That had the unforeseen consequence of changing this:

    for my $x (...) { ... }
    $x;

such that the $x was still visible after the for loop.  It only hap-
pened when the $ was the next token after the closing }:

$ ./miniperl -e 'for my $x(()){} $x = 3; warn $x'
Warning: something's wrong at -e line 1.
$ ./miniperl -e 'for my $x(()){} ;$x = 3; warn $x'
3 at -e line 1.

This broke Class::Declare.

The name lookup in the pad must not happen before the '$' token is
emitted.  At that point, the parser has not yet created the for loop
(which includes exiting its scope), as it does not yet know whether
there is a continue block.  (See the ‘FOR MY...’ branch of the
barestmt rule in perly.y.)  So we must delay the name lookup till the
second call.

So we rename force_ident_maybe_lex back to S_pending_ident, removing
the force_next stuff.  And we add a new force_ident_maybe_lex function
that adds a special ‘pending ident’ token to the forced token queue.

The part of yylex that handles pending tokens (case LEX_KNOWNEXT) is
modified to account for these special ‘pending ident’ tokens and call
S_pending_ident.

11 years agoUpdate CPANPLUS to CPAN version 0.9131
Chris 'BinGOs' Williams [Wed, 19 Sep 2012 11:40:02 +0000 (12:40 +0100)]
Update CPANPLUS to CPAN version 0.9131

  [DELTA]

  Changes for 0.9131      Tue Sep 18 14:10:16 2012
  ================================================
  * Add Pod::* modules to reported toolchain modules
  * Resolve issue with $cb->search() and SQLite
    source engine

11 years agoSync version, erm, version in Maintainers.pl
Chris 'BinGOs' Williams [Wed, 19 Sep 2012 11:38:02 +0000 (12:38 +0100)]
Sync version, erm, version in Maintainers.pl

11 years ago[perl #99382] 'stat' call documentation is poorly worded
Craig A. Berry [Wed, 19 Sep 2012 06:24:56 +0000 (23:24 -0700)]
[perl #99382] 'stat' call documentation is poorly worded

The use of "block" to describe both the file-or-device-specific sweet
spot for I/O operations and the number of file-system-specific chunks
(not necessarily 512-byte chunks) is unfortunate.  I think we came by
it honestly because Perl just provides a wrapper around:

http://pubs.opengroup.org/onlinepubs/009695399/basedefs/sys/stat.h.html

which says:

blksize_t st_blksize A file system-specific preferred I/O block size for
                     this object. In some file system types, this may
                     vary from file to file.
blkcnt_t  st_blocks  Number of blocks allocated for this object.

and in the "Rationale" section they say:

"The unit for the st_blocks member of the stat structure is not
defined within IEEE Std 1003.1-2001. In some implementations it is 512
bytes. It may differ on a file system basis. There is no correlation
between values of the st_blocks and st_blksize, and the f_bsize (from
<sys/statvfs.h>) structure members."

The existing piece in perlfunc.pod was written in 1997 for Perl 5.003.
 Screens were smaller then.  Perhaps we could afford to wrap to a
second line now and say something like:

11 years agoembed.fnc: Clarify o comments
Father Chrysostomos [Wed, 19 Sep 2012 03:30:24 +0000 (20:30 -0700)]
embed.fnc: Clarify o comments

It applies also to S_ for static functions.

11 years agoperlgit: bare ‘git push’ is dangerous
Father Chrysostomos [Wed, 19 Sep 2012 03:16:20 +0000 (20:16 -0700)]
perlgit: bare ‘git push’ is dangerous

About three times now I have made changes on a branch, to try things
out, and then later on tried to push to blead with ‘git push’ and
modified other people’s branches at the same time.

11 years agoSquash two win32.c warnings which have crept in recently
Steve Hay [Tue, 18 Sep 2012 19:47:09 +0000 (20:47 +0100)]
Squash two win32.c warnings which have crept in recently

Ensure a non-void function always returns something, and a signed/unsigned
mismatch.

11 years agoAdd missing articles.
Shlomi Fish [Tue, 18 Sep 2012 16:55:36 +0000 (19:55 +0300)]
Add missing articles.

11 years agomake perlhist_calculate.pl emit ready-to-use text
Ricardo Signes [Mon, 17 Sep 2012 15:55:03 +0000 (11:55 -0400)]
make perlhist_calculate.pl emit ready-to-use text

format the data for the line in a line (and right now that line matches
up with the lines in the current table)

format the table in a table so that you can block-select it and paste
into the file

the last two edits were done by hand, which was a drag

11 years agoadd Porting/perlhist_calculate.pl to RMG
Ricardo Signes [Mon, 17 Sep 2012 15:17:14 +0000 (11:17 -0400)]
add Porting/perlhist_calculate.pl to RMG

11 years agoadd 5.16.0 sizes and filecounts to perlhist
Ricardo Signes [Mon, 17 Sep 2012 15:08:07 +0000 (11:08 -0400)]
add 5.16.0 sizes and filecounts to perlhist

running and using the output of Porting/perlhist_calculate.pl
has not been done regularly, presumably because I had no idea
that it existed!

11 years agoadd 5.14.0 sizes and filecounts to perlhist
Ricardo Signes [Mon, 17 Sep 2012 15:08:07 +0000 (11:08 -0400)]
add 5.14.0 sizes and filecounts to perlhist

running and using the output of Porting/perlhist_calculate.pl
has not been done regularly, presumably because I had no idea
that it existed!

11 years agoupdate the release schedule
Ricardo Signes [Mon, 17 Sep 2012 15:07:15 +0000 (11:07 -0400)]
update the release schedule

October is now up in the air, probably rjbs.

Dominic is working on 5.14.3

11 years agoMinor fixups from 001e9f8966
Steve Hay [Tue, 18 Sep 2012 16:48:11 +0000 (17:48 +0100)]
Minor fixups from 001e9f8966

11 years agofix over/underflow issues in win32_msgwait
Daniel Dragan [Tue, 18 Sep 2012 08:17:21 +0000 (04:17 -0400)]
fix over/underflow issues in win32_msgwait

This commit does not completely fix 33096, since the real problem is that
VS IDE's debugger causes a Windows message to be sent to perl on each
breakpoint. Depending on where the breakpoint was set. The BP may make it
impossible to exit the loop because of the Visual Studio IDE Debugger's
design. Various overflow and underflow issues were fixed in win32_msgwait.
Specifically, the time count rolling forwards through zero
(GetSystemTimeAsFileTime), and the time count running ahead of the end
time (rolling backwards through zero) were fixed ("<=" check).

11 years agoperldelta for ${^LAST_FH}
Father Chrysostomos [Tue, 18 Sep 2012 15:29:25 +0000 (08:29 -0700)]
perldelta for ${^LAST_FH}

11 years ago${^LAST_FH}
Father Chrysostomos [Tue, 18 Sep 2012 06:18:08 +0000 (23:18 -0700)]
${^LAST_FH}

This was brought up in ticket #96672.

This variable gives access to the last-read filehandle that Perl uses
when it appends ", <STDIN> line 1" to a warning or error message.

11 years agoHandle xhv_super in thread cloning
Father Chrysostomos [Tue, 18 Sep 2012 04:44:29 +0000 (21:44 -0700)]
Handle xhv_super in thread cloning

11 years agot/run/mad.t: Avoid %ENV assignment
Father Chrysostomos [Sun, 16 Sep 2012 14:20:45 +0000 (07:20 -0700)]
t/run/mad.t: Avoid %ENV assignment

I see no skip on VMS, so use an %ENV localisation that it supports.

11 years agog++ + mad fails t/run/mad.t
Father Chrysostomos [Sun, 16 Sep 2012 14:13:41 +0000 (07:13 -0700)]
g++ + mad fails t/run/mad.t

For some reason, g++ causes $^X to have a relative path when called
with one, whereas gcc causes it to have an absolute path:

g++:

$ ./perl -le 'print $^X'
./perl

gcc:

$ ./perl -le 'print $^X'
/Users/sprout/Perl/perl.git-copy/perl

(This is on 32-bit darwin.)

This affects mad.t’s ability to find the current perl interpreter
after a chdir.

11 years agoperldelta for #114924
Father Chrysostomos [Mon, 17 Sep 2012 23:55:36 +0000 (16:55 -0700)]
perldelta for #114924

11 years ago[perl #114924] Make method calls work with ::SUPER packages
Father Chrysostomos [Mon, 17 Sep 2012 23:24:40 +0000 (16:24 -0700)]
[perl #114924] Make method calls work with ::SUPER packages

Perl caches SUPER methods inside packages named Foo::SUPER.  But this
interferes with actual method calls on those packages (SUPER->foo,
foo::SUPER->foo).

The first time a package is looked up, it is vivified under the name
with which it is looked up.  So *SUPER:: will cause that package
to be called SUPER, and *main::SUPER:: will cause it to be named
main::SUPER.

main->SUPER::isa used to be very sensitive to the name of the
main::FOO package (where the cache is kept).  If it happened to be
called SUPER, that call would fail.

Fixing that bug (commit 3c104e59d83f) caused the CPAN module named
SUPER to fail, because SUPER->foo was now being treated as a
SUPER::method call.  gv_fetchmeth_pvn was using the ::SUPER suffix to
determine where to look for the method.  The package passed to it (the
::SUPER package) was being used to look for cached methods, but the
package with ::SUPER stripped off was being used for the rest of
lookup.  3c104e59d83f made main->SUPER::foo work by treating SUPER
as main::SUPER in that case.  Mentioning *main::SUPER:: or doing a
main->SUPER::foo call before loading SUPER.pm also caused it to fail,
even before 3c104e59d83f.

Instead of using publicly-visible packages for internal caches, we
should be keeping them internal, to avoid such side effects.

This commit adds a new member to the HvAUX struct, where a hash of GVs
is stored, to cache super methods.  I cannot simpy use a hash of CVs,
because I need GvCVGEN.  Using a hash of GVs allows the existing
method cache code to be used.

This new hash of GVs is not actually a stash, as it has no HvAUX
struct (i.e., no name, no mro_meta).  It doesn’t even need an @ISA
entry as before (which was only used to make isa caches reset), as it
shares its owner stash’s mro_meta generation numbers.  In fact, the
GVs inside it have their GvSTASH pointers pointing to the owner stash.

In terms of memory use, it is probably the same as before.  Every
stash and every iterated or weakly-referenced hash is now one pointer
larger than before, but every SUPER cache is smaller (no HvAUX, no
*ISA + @ISA + $ISA[0] + magic).

The code is a lot simpler now and uses fewer stash lookups, so it
should be faster.

This will break any XS code that expects the gv_fetchmeth_pvn to treat
the ::SUPER suffix as magical.  This behaviour was only barely docu-
mented (the suffix was mentioned, but what it did was not), and is
unused on CPAN.

11 years agoRevert "Set PL_comppad_name on sub entry"
Father Chrysostomos [Sun, 16 Sep 2012 07:20:23 +0000 (00:20 -0700)]
Revert "Set PL_comppad_name on sub entry"

This reverts commit d2c8bf052f5a8bb99050f6d2418d77151eb4b468.

11 years agopp.c:pp_clonecv: Use find_runcv to find the padname
Father Chrysostomos [Sun, 16 Sep 2012 07:20:07 +0000 (00:20 -0700)]
pp.c:pp_clonecv: Use find_runcv to find the padname

See: https://rt.perl.org/rt3/Ticket/Display.html?id=113930#txn-1153156

By using find_runcv, we can revert d2c8bf052f.  This may not be the
best tradeoff in the long run, as it makes code using experimental my
subs (my experimental subs?) slower.  But at least we avoid slowing
down existing code.

11 years agopod/perlsub.pod: Warn about possible lexsub removal
Father Chrysostomos [Sun, 16 Sep 2012 06:48:40 +0000 (23:48 -0700)]
pod/perlsub.pod: Warn about possible lexsub removal

11 years agoRemove duplicate paragraph from perlref.pod
Steve Hay [Mon, 17 Sep 2012 17:03:07 +0000 (18:03 +0100)]
Remove duplicate paragraph from perlref.pod

Spotted by Vincent Belaïche <vincent.b.1@hotmail.fr>
Date: Fri, 14 Sep 2012 20:23:31 +0200
Message-ID: <DUB102-W243A350D79540D31E95E2884900@phx.gbl>

11 years agoregexec.c: Avoid unnecessary calculation
Karl Williamson [Sun, 16 Sep 2012 16:51:01 +0000 (10:51 -0600)]
regexec.c: Avoid unnecessary calculation

When matching an EXACT node and the target string and the pattern differ
in utf8ness, the code prior to this patch calculated each code point from
the utf8 version in order to do the EXACT comparision with the non-utf8
version.  But it is unnecessary to do this full calculation.  Code
points above Latin1 cannot possibly match a non-UTF8 string; there is no
need to know precisely which code point it is in order to know that it
won't match.  Similarly, invariant code points can be checked directly;
and the Latin1 variants can be downgraded for comparison by a simple
macro.

11 years agoutf8.h: Add macro to test if UTF8 code point isn't Latin1
Karl Williamson [Sun, 16 Sep 2012 16:58:26 +0000 (10:58 -0600)]
utf8.h: Add macro to test if UTF8 code point isn't Latin1

11 years agoRefactor t/run/noswitch.t to use test.pl instead of making TAP by hand.
Colin Kuskie [Sat, 15 Sep 2012 07:51:28 +0000 (00:51 -0700)]
Refactor t/run/noswitch.t to use test.pl instead of making TAP by hand.

11 years agoRefactor t/run/switchF.t to use test.pl instead of making TAP by hand.
Colin Kuskie [Sat, 15 Sep 2012 07:45:44 +0000 (00:45 -0700)]
Refactor t/run/switchF.t to use test.pl instead of making TAP by hand.

11 years agoRefactor t/run/switchn.t to use test.pl instead of making TAP by hand.
Colin Kuskie [Sat, 15 Sep 2012 07:42:36 +0000 (00:42 -0700)]
Refactor t/run/switchn.t to use test.pl instead of making TAP by hand.

11 years agoRefactor t/lib/1_compile.t to use test.pl instead of making TAP by hand.
Colin Kuskie [Fri, 14 Sep 2012 06:25:58 +0000 (23:25 -0700)]
Refactor t/lib/1_compile.t to use test.pl instead of making TAP by hand.

11 years agoMake cx_dump() display the correct gimme description
Vincent Pit [Sun, 16 Sep 2012 14:31:23 +0000 (16:31 +0200)]
Make cx_dump() display the correct gimme description

Contexts are no longer what they used to be back in 1996.

11 years agoFix perl with -DPERL_POISON after commit 22ade07
Vincent Pit [Sun, 16 Sep 2012 14:44:13 +0000 (16:44 +0200)]
Fix perl with -DPERL_POISON after commit 22ade07

The third argument to PoisonNew is the type, not the size. Also, poisoning
the contents of the sv itself is incorrect.

11 years agoSave one NULL assignment per TMP
Steffen Mueller [Wed, 12 Sep 2012 12:52:46 +0000 (14:52 +0200)]
Save one NULL assignment per TMP

This assignment looks really rather like overzealous cleanliness.
It's a hot path. Now it's death by 999 cuts instead of 1000.

11 years agoBring bleadperl up to parity with CPAN for version.pm
John Peacock [Sun, 16 Sep 2012 11:09:59 +0000 (07:09 -0400)]
Bring bleadperl up to parity with CPAN for version.pm

Please find attached a patch to bleadperl to bring up to date with the
CPAN release of version.pm.  This release was to deal primarily with an
edge case in numifying alpha decimal versions:

   https://rt.cpan.org/Ticket/Display.html?id=79259

I've also synchronized all of the other version.pm test cases, so that
the code in core is identical to the CPAN release.

Signed-off-by: David Golden <dagolden@cpan.org>
11 years agoperlδ
Father Chrysostomos [Sun, 16 Sep 2012 07:12:51 +0000 (00:12 -0700)]
perlδ

This completes the entries for all the patches that I authored plus a
few things by others that I happened to understand.

11 years ago[Merge] [perl #113930] Lexical subs
Father Chrysostomos [Sun, 16 Sep 2012 05:46:03 +0000 (22:46 -0700)]
[Merge] [perl #113930] Lexical subs

11 years agoDocument lexical subs
Father Chrysostomos [Sun, 16 Sep 2012 05:03:51 +0000 (22:03 -0700)]
Document lexical subs

11 years agoDisable lexsubs outside of feature.pm
Father Chrysostomos [Sun, 16 Sep 2012 05:03:35 +0000 (22:03 -0700)]
Disable lexsubs outside of feature.pm

11 years agoAdd experimental lexical_subs feature
Father Chrysostomos [Sun, 16 Sep 2012 05:02:42 +0000 (22:02 -0700)]
Add experimental lexical_subs feature

11 years agofeature.pm: Missing space
Father Chrysostomos [Sun, 16 Sep 2012 05:00:12 +0000 (22:00 -0700)]
feature.pm: Missing space

11 years agoIncrease $feature::VERSION to 1.30
Father Chrysostomos [Sun, 16 Sep 2012 04:59:45 +0000 (21:59 -0700)]
Increase $feature::VERSION to 1.30

11 years agoAdd experimental warnings categ and :lexical_subs warn ID
Father Chrysostomos [Sun, 16 Sep 2012 04:56:25 +0000 (21:56 -0700)]
Add experimental warnings categ and :lexical_subs warn ID

I reindented the tree in perllexwarn because I was simply copying and
pasting the output from:

    perl regen/warnings.pl tree

11 years agoperlsub: Document state variables better
Father Chrysostomos [Tue, 11 Sep 2012 06:44:11 +0000 (23:44 -0700)]
perlsub: Document state variables better

11 years agoAllow lexical sub redefinition inside eval
Father Chrysostomos [Tue, 11 Sep 2012 05:29:15 +0000 (22:29 -0700)]
Allow lexical sub redefinition inside eval

For non-clonable state subs, this already happened to work.

For any clonable subs, we need to clone the sub as soon as it
is defined.

For redefined state subs, we need to apply the new sub to all recur-
sion levels, as state subs are shared.

11 years agoMove my sub prototype CVs to the pad names
Father Chrysostomos [Tue, 11 Sep 2012 04:59:51 +0000 (21:59 -0700)]
Move my sub prototype CVs to the pad names

my subs are cloned on scope entry.  To make closures work, a stub
stored in the pad (and closed over elsewhere) is cloned into.

But we need somewhere to store the prototype from which the clone is
made.  I was attaching the prototype via magic to the stub in the pad,
since the pad is available at run time, but not the pad names.

That leads to lots of little games all over the place to make sure
the prototype isn’t lost when the pad is swiped on scope exit
(SAVEt_CLEARSV in scope.c).  We also run the risk of losing it if an
XS module replaces the sub with another.

Instead, we should be storing it with the pad name.  The previous com-
mit made the pad names available at run time, so we can move it there
(still stuffed inside a magic box) and delete much code.

This does mean that newMYSUB cannot rely on the behaviour of non-clon-
able subs that close over variables (or subs) immediately.  Previ-
ously, we would dig through outer scopes to find the stub in cases
like this:

    sub y {
        my sub foo;
        sub x {
            sub {
                sub foo { ... }
            }
        }
    }

We would stop at x, which happens to have y’s stub in its pad, so
that’s no problem.

If we attach it to the pad name, we definitely have to dig past x to
get to the pad name in y’s pad.

Usually, immediate closures do not store the parent pad index, since
it will never be used.  But now we do need to use it, so we modify the
code in pad.c:S_pad_findlex to set it always for my/state.

11 years agoSet PL_comppad_name on sub entry
Father Chrysostomos [Mon, 10 Sep 2012 23:07:30 +0000 (16:07 -0700)]
Set PL_comppad_name on sub entry

11 years agolexsub.t: Test state sub defined inside eval
Father Chrysostomos [Sun, 9 Sep 2012 18:09:53 +0000 (11:09 -0700)]
lexsub.t: Test state sub defined inside eval

11 years agoHonour lexical prototypes
Father Chrysostomos [Sun, 9 Sep 2012 02:28:00 +0000 (19:28 -0700)]
Honour lexical prototypes

newCVREF is changed to return a PADCV op, not an RV2CV with a PADCV
kid, to keep the rv2cv_op_cv changes to a minimum.  (For some reason,
if newCVREF returns an RV2CV, we end up with two inside each other.)

I also added a test for recursion, since I nearly broke it.

11 years agoDon’t mention pkg in proto warnings for lex subs
Father Chrysostomos [Fri, 7 Sep 2012 05:57:50 +0000 (22:57 -0700)]
Don’t mention pkg in proto warnings for lex subs

11 years agopad.c: Put unavailability warning in one spot
Father Chrysostomos [Fri, 7 Sep 2012 05:11:36 +0000 (22:11 -0700)]
pad.c: Put unavailability warning in one spot

11 years agoUse the same outside logic for mysubs and formats
Father Chrysostomos [Fri, 7 Sep 2012 03:32:47 +0000 (20:32 -0700)]
Use the same outside logic for mysubs and formats

By using find_runcv_where both for formats and my subs nested in inner
clonable subs, we can simplify the code.

It happens to make this work ($x is visible):

use 5.01;
sub not_lexical8 {
  my sub foo;
  foo();
  sub not_lexical9 {
    my sub bar {
      my $x = 'khaki car keys for the khaki car';
      not_lexical8();
      sub foo { warn $x }
    }
    bar()
  }
}
not_lexical9();

This is definitely iffy code, but if making it work makes the imple-
mentation simpler, so why not?

11 years agoFix subroutine unavailability during cloning
Father Chrysostomos [Fri, 7 Sep 2012 01:05:35 +0000 (18:05 -0700)]
Fix subroutine unavailability during cloning

sub foo {
  my $x;
  format =
@
$x||'#'
.
}
write;
__END__
Variable "$x" is not available at - line 9.

That one’s OK.

sub foo {
  my sub x {};
  format =
@
&x
.
}
write;
__END__
Variable "&x" is not available at - line 9.
Assertion failed: (SvTYPE(_svmagic) >= SVt_PVMG), function S_mg_findext_flags, file mg.c, line 404.
Abort trap

That should say ‘Subroutine’.  And it shouldn’t crash.

The my-sub-cloning code was not taking this case into account.  The
value in the proto pad is an undef scalar.

11 years ago‘Subroutine "&x" is not available’ during compilation
Father Chrysostomos [Thu, 6 Sep 2012 23:03:20 +0000 (16:03 -0700)]
‘Subroutine "&x" is not available’ during compilation

sub {
  my $x;
  sub { eval '$x' }
}->()()
__END__
Variable "$x" is not available at (eval 1) line 2.

That one’s OK (though I wonder about the line number).

sub {
  my sub x {};
  sub { eval '\&x' }
}->()()
__END__
Variable "&x" is not available at (eval 1) line 1.

That should say ‘Subroutine’.

11 years agoIn cv_clone, use pad ID to identify mysub outside
Father Chrysostomos [Tue, 4 Sep 2012 17:24:57 +0000 (10:24 -0700)]
In cv_clone, use pad ID to identify mysub outside

This code prints ARRAY(0x802e10), whereas it should print
SCALAR(0xfedbee):

undef &bar;
eval 'sub bar { my @x }';
{
  my sub foo;
  foo();
  sub bar {
    CORE::state $x;
    sub foo { warn \$x }
  }
}

The foo sub has a strong CvOUTSIDE pointer, but what it points to
can still be undefined and redefined.  So we need to identify it
by its pad.

11 years agoCvOUTSIDE should be strong for lexsub declared in inner pack sub
Father Chrysostomos [Tue, 4 Sep 2012 04:26:37 +0000 (21:26 -0700)]
CvOUTSIDE should be strong for lexsub declared in inner pack sub

PadnameOUTER (SvFAKE) entries in pads of clonable subs contain the
offset in the parent pad where the closed-over entry is to be found.
The pad itself does not reference the outer lexical until the sub is
cloned at run time.

newMYSUB had to account for that by following CvOUTSIDE for
PadnameOUTER entries, to account for cases like this:

    my sub foo;
    my sub bar { sub foo {} }

The sub foo{} definition would have to find the my sub foo declaration
from outside and store the sub there.

That code was not accounting for named package subs, which close over
variables at compile time, so they don’t need (and don’t) store a par-
ent offset.

So outcv would point to bar in this case:

    my sub foo;
    sub bar { sub foo {} }

If outcv matched CvOUTSIDE(foo), then CvOUTSIDE was made weak.

That does not help in cases like this:

    undef *bar;
    {
        my sub foo;
        sub bar { sub foo {} }
    }

If foo has a weak CvOUTSIDE pointer, then it will still point to bar
after bar is freed, which does not help when the sub is cloned and
tries to look at CvROOT(CvOUTSIDE).

If the pad name is marked PadnameOUTER, even if it has no parent pad
index, newMYSUB needs to leave the CvOUTSIDE pointer strongc.

Also, pad_fixup_inner_anons did not account for subs with strong
CvOUTSIDE pointers whose CvOUTSIDE point to the sub whose pad is being
iterated through.

11 years agoUse the right outside for my subs defined in inner subs
Father Chrysostomos [Wed, 15 Aug 2012 01:10:40 +0000 (18:10 -0700)]
Use the right outside for my subs defined in inner subs

In this example,

{
  my sub foo;
  sub bar {
    sub foo { }
  }
}

the foo sub is cloned when the scope containing the ‘my sub’ declara-
tion is entered, but foo’s CvOUTSIDE pointer points to something other
than the active sub.  cv_clone assumes that the currently-running sub
is the right sub to close over (at least for subs; formats are another
matter).  That was true in the absence of my subs.  This commit
changes it to account.

I had to tweak the test, which was wrong, because sub foo was closing
over a stale var.