platform/upstream/perl.git
11 years agopadcv op type
Father Chrysostomos [Sun, 1 Jul 2012 05:29:28 +0000 (22:29 -0700)]
padcv op type

11 years agoDon’t allow name after our/state sub
Father Chrysostomos [Sun, 1 Jul 2012 00:31:32 +0000 (17:31 -0700)]
Don’t allow name after our/state sub

It was a mistake that this was ever allowed.

11 years agoPATCH: [perl #82954] Make "Can't do {n,m} with n > m into warning
Karl Williamson [Sat, 15 Sep 2012 18:27:22 +0000 (12:27 -0600)]
PATCH: [perl #82954] Make "Can't do {n,m} with n > m into warning

This commit now causes this situation to warn instead of dying.  The
portion of the regular expression that can't match is optimized into an
OPFAIL.

11 years agoUpdate Sys-Syslog to CPAN version 0.32
Chris 'BinGOs' Williams [Sat, 15 Sep 2012 11:45:06 +0000 (12:45 +0100)]
Update Sys-Syslog to CPAN version 0.32

  [DELTA]

  0.32 -- 2012.09.14 -- Sebastien Aperghis-Tramoni (SAPER)
        [BUGFIX] CPAN-RT#69040: Don't modify @_ in syslog().
        [BUGFIX] Restore compatibility with Perl 5.6.0.
        [DOC] Perl-RT#81858: Fix some spelling errors (Peter J. Acklam).

11 years agoFix build under C++
Father Chrysostomos [Sat, 15 Sep 2012 05:55:56 +0000 (22:55 -0700)]
Fix build under C++

Commit 9ac6f7d90 was missing a few casts.

11 years ago[perl #114888] Localise PL_comppad_name in cv_clone
Father Chrysostomos [Sat, 15 Sep 2012 05:08:19 +0000 (22:08 -0700)]
[perl #114888] Localise PL_comppad_name in cv_clone

In 9ef8d56 I made closures share their pad name lists, and not just
the names themselves, for speed (no need to SvREFCNT_inc each name and
copy the list).

To make that work, I had to set PL_comppad_name in cv_clone, before
the pad_new call.  But I failed to move the PL_comppad_name localisa-
tion from pad_new to cv_clone.

So cv_clone would merrily clobber the previous value of
PL_comppad_name *before* localising it.

This only manifested itself in source filters.  Most of the time,
pp_anoncode is called at run time when either no code is being com-
piled (PL_comppad_name is only used at compile time) or inside a
BEGIN block which itself localises PL_comppad_name.  But inside a
Filter::Util::Call source filter there was no buffer like that to
protect it.

This meant that pad name creation (my $x) would create the name in the
PL_comppad_name belonging to the last-cloned sub.  A subsequent name
lookup ($x) would look in the correct place, as it uses the moral
equivalent of PadlistNAMES(CvPADLIST(PL_compcv)), not PL_comppad_name.
So it would not find it, resulting in a global variable or a stricture
violation.

11 years agoMake SUPER::method respect method changes in moved pkg
Father Chrysostomos [Fri, 14 Sep 2012 21:20:07 +0000 (14:20 -0700)]
Make SUPER::method respect method changes in moved pkg

->SUPER::method calls inside the Foo package cache the method for
reuse inside the stash Foo::SUPER.

Before the call, @Foo::SUPER::ISA is set to "Foo", so that those
caches will be invalidated properly.  (@ISA has the magic to make that
work.)  The actual value in @Foo::SUPER::ISA unused.

Now we have two types of package names.  If you alias the Foo package
and then clobber the original entry:

    *Bar:: = *Foo::;
    undef *Foo::;

__PACKAGE__ and HvNAME will return Foo still, but HvENAME (the effec-
tive name) will return Bar, because that is where the package is to be
found.

As of the previous commit, the package used for ISA is based on the
effective name, Bar::SUPER in this case.

But @Bar::SUPER::ISA is still set to Foo.  So even if we make changes
to methods inherited by what is now the Bar package, a previous method
cached in *Bar::SUPER::method will be reused.

BEGIN {
    *Bar:: = *Foo::;
    undef *Foo::;
}
package Bar;
@ISA = 'Baz';
*Baz::m = sub { "method 1" };
anthying->SUPER::m;
undef *Baz::m;
*Baz::m = sub { "method 2" };
warn anything->SUPER::m;
__END__
method 1 at - line 11.

11 years agoMake SUPER::method calls work in moved stashes
Father Chrysostomos [Fri, 14 Sep 2012 20:35:53 +0000 (13:35 -0700)]
Make SUPER::method calls work in moved stashes

BEGIN {
  *foo:: = *bar::;
  *bar:: = *baz;
}
package foo;
@ISA = 'door';
sub door::dohtem { 'dohtem' }
warn bar->SUPER::dohtem;
__END__
Can't locate object method "dohtem" via package "bar::SUPER" at - line 8.

When gv_fetchmethod_pvn_flags looks up a package it changes SUPER to
__PACKAGE__ . "::SUPER" first.  Then gv_fetchmeth_pvn uses HvNAME on
the package and strips off the ::SUPER suffix if any, before doing
isa lookup.

The problem with using __PACKAGE__ (actually HvNAME) is that it might
not be possible to find the current stash under that name.  HvENAME
should be used instead.

The above example happens to work if @ISA is changed to ‘our @ISA’,
but that is because of an @ISA bug.

11 years agoMake SUPER:: in main less sensitive
Father Chrysostomos [Fri, 14 Sep 2012 20:13:30 +0000 (13:13 -0700)]
Make SUPER:: in main less sensitive

$ perl -e '$main::SUPER::; sub bar::bar{} @ISA = bar; main->SUPER::bar'
$ perl -e '$SUPER::; sub bar::bar{} @ISA = bar; main->SUPER::bar'
Can't locate object method "bar" via package "main" at -e line 1.

(That’s 5.10.1.  More recent perls say package "SUPER".)

The only differnce that $SUPER:: variable makes is the name of
the SUPER:: package.  It ends up being called SUPER instead of
main::SUPER.

This causes problems because gv_fetchmeth_pvn, seeing a package end-
ing in ::SUPER, strips off the ::SUPER before doing isa lookup.

But SUPER does not end in ::SUPER, so this commit adjusts
gv_fetchmeth_pvn to account.

11 years agomethod.t: Add basic tests for SUPER
Father Chrysostomos [Fri, 14 Sep 2012 19:32:28 +0000 (12:32 -0700)]
method.t: Add basic tests for SUPER

11 years agomethod.t: Test more method-BLOCK edge cases
Father Chrysostomos [Fri, 14 Sep 2012 17:19:58 +0000 (10:19 -0700)]
method.t: Test more method-BLOCK edge cases

11 years agocop.h: Remove obsolete comment
Father Chrysostomos [Fri, 14 Sep 2012 17:12:33 +0000 (10:12 -0700)]
cop.h: Remove obsolete comment

623e6609 (2 Apr 2006) added this to cop.h:

+/* FIXME NATIVE_HINTS if this is changed from op_private (see perl.h)  */
+#define CopHINTS_get(c)                ((c)->op_private + 0)
+#define CopHINTS_set(c, h)     STMT_START {                            \
+                                   (c)->op_private                     \
+                                        = (U8)((h) & HINT_PRIVATE_MASK); \
+                               } STMT_END
+

d5ec2987 (20 May 2006) made this change, ignoring the FIXME:

 /* FIXME NATIVE_HINTS if this is changed from op_private (see perl.h)  */
-#define CopHINTS_get(c)                ((c)->op_private + 0)
+#define CopHINTS_get(c)                ((c)->cop_hints + 0)
 #define CopHINTS_set(c, h)     STMT_START {                            \
-                                   (c)->op_private                     \
-                                        = (U8)((h) & HINT_PRIVATE_MASK); \
+                                   (c)->cop_hints = (h);               \
                                } STMT_END

There is nothing to be fixed here, as vmsish.h uses ->op_private
directly, instead of using the CopHINTS macros.  Even having caller
return cop_hints instead of op_private doesn’t hurt, as newly-created
cops copy the vms hints from PL_hints to op_private.  So assigning
(caller $n)[8] to $^H will still work.

11 years agopp_ctl.c:caller: Remove obsolete comment
Father Chrysostomos [Fri, 14 Sep 2012 13:28:21 +0000 (06:28 -0700)]
pp_ctl.c:caller: Remove obsolete comment

This was added in f3aa04c29a, but stopped being relevant in
d5ec2987912.

11 years agoPrevent assertion failure with ‘no a a 3’
Father Chrysostomos [Fri, 14 Sep 2012 13:20:34 +0000 (06:20 -0700)]
Prevent assertion failure with ‘no a a 3’

This particular syntax error, whittled down from ‘no if $] >= 5.17.4
warnings => "deprecated"’ (which contains a type), causes the parser
to try to free an op from the new sub (for the BEGIN block) after
freeing the new sub.

This happens on line 526 of perly.c.  It should not be necessary for
the parser to free the op at this point, since after an error any ops
owned by incomplete subs’ slabs will be freed.

I’m leaving the other three instances of op_free in perly.c in place,
at least for now, since there are cases where the forced token stack
prevents ops from being freed when their subs are.

11 years agoIncrease $warnings::VERSION to 1.14
Father Chrysostomos [Fri, 14 Sep 2012 07:16:35 +0000 (00:16 -0700)]
Increase $warnings::VERSION to 1.14

11 years agoStop lexical warnings from turning off deprecations
Father Chrysostomos [Fri, 14 Sep 2012 06:46:46 +0000 (23:46 -0700)]
Stop lexical warnings from turning off deprecations

Some warnings, such as deprecation warnings, are on by default:

$ perl5.16.0 -e '$*'
$* is no longer supported at -e line 1.

But turning *on* other warnings will turn them off:

$ perl5.16.0 -e 'use warnings "void"; $*'
Useless use of a variable in void context at -e line 1.

Either all warnings in any given scope are controlled by lexical
hints, or none of them are.

When a single warnings category is turned on or off, if the warn-
ings were controlled by $^W, then all warnings are first turned on
lexically if $^W is 1 and all warnings are turned off lexically
if $^W is 0.

That has the unfortunate affect of turning off warnings when it was
only requested that warnings be turned on.

These categories contain default warnings:

ambiguous
debugging
deprecated
inplace
internal
io
malloc
utf8
redefine
syntax
glob
inplace
overflow
precedence
prototype
threads
misc

Most also contain regular warnings, but these contain *only*
default warnings:

debugging
deprecated
glob
inplace
malloc

So we can treat $^W==0 as equivalent to qw(debugging deprecated glob
inplace malloc) when enabling lexical warnings.

While this means that some default warnings will still be turned off
by ‘use warnings "void"’, it won’t be as many as before.  So at least
this is a step in the right direction.

(The real solution, of course, is to allow each warning to be turned
off or on on its own.)

11 years agoMake (caller $n)[9] respect std warnings
Father Chrysostomos [Fri, 14 Sep 2012 06:33:03 +0000 (23:33 -0700)]
Make (caller $n)[9] respect std warnings

In commit 7e4f04509c6 I forgot about caller.  This commit makes the
value returned by (caller $n)[9] assignable to ${^WARNING_BITS} to
produce exactly the same warnings settings, including warnings con-
trolled by $^W.

11 years agoperldiag: 13 years for reserved word deprec. is enough
Father Chrysostomos [Fri, 14 Sep 2012 04:23:34 +0000 (21:23 -0700)]
perldiag: 13 years for reserved word deprec. is enough

Use of ‘our’ (which was not a keyword yet) was deprecated in 1997 in
commit 85b81015bd, so that it could be used as a keyword later.

‘our’ variables were introduced in 1999 in commit 77ca0c92d2c, remov-
ing the deprecation warning.

The notice in perldiag survived, ...till now.

11 years agoperldiag: ‘Attempt to free unreffed scalar’ is S
Father Chrysostomos [Fri, 14 Sep 2012 01:01:44 +0000 (18:01 -0700)]
perldiag: ‘Attempt to free unreffed scalar’ is S

11 years agoperlhacktips.pod: readonly ops update (again)
Father Chrysostomos [Fri, 14 Sep 2012 00:50:15 +0000 (17:50 -0700)]
perlhacktips.pod: readonly ops update (again)

11 years agosv.c: %vd printf format microöptimisation
Father Chrysostomos [Thu, 13 Sep 2012 21:08:46 +0000 (14:08 -0700)]
sv.c: %vd printf format microöptimisation

The %vd printf format does not need to make two copies of a version
object’s stringification or stringify the object twice.

11 years agoFix %vd with alpha version
Father Chrysostomos [Thu, 13 Sep 2012 20:00:12 +0000 (13:00 -0700)]
Fix %vd with alpha version

There are five problems with it:

First, this warning is not suppressible, even with -X:

$ perl -Xe' sprintf "[%vd]\n", new version v1.1_1'
vector argument not supported with alpha versions at -e line 1.

To keep the behaviour as close as possible to what it was already
without the incorrect behaviour, I have made it a default warning.

Secondly, putting it in the internal category does not make sense.
internal is a subset of severe, and contains warnings that indicate
internal inconsistencies, like ‘Scalars leaked’ and ‘Unbalanced string
table refcount’.  It should be in the printf warnings category.

Thirdly, if we turn warnings on explicitly, we see this:

$ perl -we '() = sprintf "[%vd]\n", new version v1.1_1'
vector argument not supported with alpha versions at -e line 1.
Invalid conversion in printf: "%v" at -e line 1.

%vd is not invalid.  That warning is bogus.

Fourthly, %vd itself gets output when fed an alpha version:

$ perl -Xe 'printf "[%vd]\n", new version v1.1_1'
vector argument not supported with alpha versions at -e line 1.
[%vd]

If an argument is missing or invalid or what have you, the %-format
itself should not be output.  An empty string makes the most sense.

Fifthly, it leaks memory.  Run this and watch memory usage go up:

$ perl -e '
   warn $$; $SIG{__WARN__} = sub {}; $v = new version v1.1_1;
   sprintf "%vd", $v while 1
'

It does savesvpv before shortcircuiting for alphas.  But the corres-
ponding Safefree comes after the shortcircuiting, which skips it.

11 years agoperldiag: ‘Unbalanced string table’ is a default warning
Father Chrysostomos [Thu, 13 Sep 2012 15:35:39 +0000 (08:35 -0700)]
perldiag: ‘Unbalanced string table’ is a default warning

11 years agoperldiag: ‘Scalars leaked’ is a default warning
Father Chrysostomos [Thu, 13 Sep 2012 15:33:41 +0000 (08:33 -0700)]
perldiag: ‘Scalars leaked’ is a default warning

11 years agoAdd another include directory for the x2p files on VMS.
Craig A. Berry [Sat, 15 Sep 2012 00:43:05 +0000 (19:43 -0500)]
Add another include directory for the x2p files on VMS.

Because we now have:

  #include "../unicode_constants.h"

which is a Unix-style path and cannot be combined with [.x2p] and
get a valid result.

11 years ago[MERGE] eliminate PL_reginput
David Mitchell [Fri, 14 Sep 2012 07:53:26 +0000 (08:53 +0100)]
[MERGE] eliminate PL_reginput

The variable PL_reginput (which is actually part of the
global/per-interpreter variable PL_reg_state), is mainly used just
locally within the S_regmatch() function. In this role, it effectively
competes with the local-to-regmatch() variable locinput, as a pointer
that tracks the current match position.

Having two variables that do this is less efficient,and makes the code
harder to understand. So this series of commits:

1) removes PL_reginput, and replaces it with a var, reginput, local to
   regmatch();
2) successively removes more and uses of the reginput variable, until
3) it is eliminated altogether, leaving locinput as the sole 'here we are'
   pointer.

Looking at the CPU usage of running the t/re/*.t tests on a -O2,
non-threaded build, running each test suite 3 times, gives:

before: 55.35 55.66 55.69
after:  55.10 55.13 55.33

which indicates a small performance improvement of around 0.5%.

(The CPU usage of a single run of the whole perl test suite dropped from
783.31s to 777.23s).

11 years agoregmatch(): eliminate reginput variable
David Mitchell [Thu, 13 Sep 2012 21:41:02 +0000 (22:41 +0100)]
regmatch(): eliminate reginput variable

The remaining uses of reginput are all assignments; its value is
never used. So eliminate it.

Also, update the description of S_regrepeat(), which was woefully out of
date (but mentioned reginput).

11 years agoregmatch(): remove remaining reads of reginput
David Mitchell [Thu, 13 Sep 2012 19:28:01 +0000 (20:28 +0100)]
regmatch(): remove remaining reads of reginput

In the remaining place where the value of reginput is used, its value
should always be equal to locinput, so it can be eliminated there.

This is part of a campaign to eliminate the reginput variable.

11 years agoregmatch(): remove reginput from CURLY etc
David Mitchell [Thu, 13 Sep 2012 18:58:25 +0000 (19:58 +0100)]
regmatch(): remove reginput from CURLY etc

reginput mostly tracked locinput, except when regrepeat() was called.
With a bit of jiggling, it could be eliminated for these blocks of code.

This is part of a campaign to eliminate the reginput variable.

11 years agoregmatch(): remove reginput from CURLYM
David Mitchell [Thu, 13 Sep 2012 10:38:26 +0000 (11:38 +0100)]
regmatch(): remove reginput from CURLYM

reginput, locinput and st->locinput were being used in a little
ballet to determine the length of the first match.
This is now simply locinput - st->locinput, or its unicode equivalent;
so the code can be simplified.

Elsewhere in the block: where reginput was being used, locinput and/or
nextchr already contain the same info, so use them instead.

This is part of a campaign to eliminate the reginput variable.

11 years agoregmatch(): remove reginput from IFMATCH etc
David Mitchell [Thu, 13 Sep 2012 10:12:40 +0000 (11:12 +0100)]
regmatch(): remove reginput from IFMATCH etc

It was being used essentially as a temporary var within the branch,
so replace it with a temp var in a new block scope.

On return in IFMATCH_A / IFMATCH_A_fail, there's no need to set reginput
any more, so don't. The SUSPEND case used to set locinput = reginput, but
at that point, the two variables already always had the same value anyway.

This is part of a campaign to eliminate the reginput variable.

11 years agoregmatch(): remove reginput from TRIE_next_fail:
David Mitchell [Thu, 13 Sep 2012 09:28:11 +0000 (10:28 +0100)]
regmatch(): remove reginput from TRIE_next_fail:

It was being used essentially as a temporary var within the branch,
so replace it with a temp var in a new block scope.

This is part of a campaign to eliminate the reginput variable.

11 years agoregmatch(): make PUSH_STATE_GOTO dest explicit
David Mitchell [Thu, 13 Sep 2012 08:22:38 +0000 (09:22 +0100)]
regmatch(): make PUSH_STATE_GOTO dest explicit

Currently, the string position from where matching continues after a PUSH
is implicitly specified by the value of reginput, which is usually just
equal to locinput. Make this explicit by adding an extra argument to
PUSH_STATE_GOTO() etc.

This is part of a campaign to eliminate the reginput variable.

11 years agoeliminate PL_reginput
David Mitchell [Wed, 12 Sep 2012 19:10:44 +0000 (20:10 +0100)]
eliminate PL_reginput

PL_reginput (which is actually #defined to PL_reg_state.re_state_reginput)
is, to all intents and purposes, state that is only used within
S_regmatch().

The only other places it is referenced are in S_regtry() and S_regrepeat(),
where it is used to pass the current match position back and forth between
the subs.

Do this passing instead via function args, and bingo! PL_reginput is now
just a local var of S_regmatch().

11 years agoFix compilation for -DPERL_POISON and -DPERL_OLD_COPY_ON_WRITE together.
Nicholas Clark [Thu, 13 Sep 2012 20:22:29 +0000 (22:22 +0200)]
Fix compilation for -DPERL_POISON and -DPERL_OLD_COPY_ON_WRITE together.

These have been present since PERL_POISON was added in June 2005 by commit
94010e71b67db040. It seems that no-one has tried compiling with both defined
together.

11 years agoFix buggy -DPERL_POISON code in S_rxres_free(), exposed by a recent test.
Nicholas Clark [Thu, 13 Sep 2012 16:13:43 +0000 (18:13 +0200)]
Fix buggy -DPERL_POISON code in S_rxres_free(), exposed by a recent test.

The code had been buggily attempting to overwrite just-freed memory since
PERL_POISON was added by commit 94010e71b67db040 in June 2005. However, no
regression test exercised this code path until recently.

Also fix the offset in the array of UVs used by PERL_OLD_COPY_ON_WRITE to
store RX_SAVED_COPY(). It now uses p[2]. Previously it had used p[1],
directly conflicting with the use of p[1] to store RX_NPARENS().

The code is too intertwined to meaningfully do these as separate commits.

11 years agoRestore the build under -DPERL_OLD_COPY_ON_WRITE
Nicholas Clark [Thu, 13 Sep 2012 15:05:58 +0000 (17:05 +0200)]
Restore the build under -DPERL_OLD_COPY_ON_WRITE

This was broken as a side effect of commit 6502e08109cd003b, recently merged
to blead.

11 years agoRefactor t/op/push.t to use test.pl instead of making TAP by hand.
Colin Kuskie [Fri, 14 Sep 2012 02:25:24 +0000 (19:25 -0700)]
Refactor t/op/push.t to use test.pl instead of making TAP by hand.

11 years agoRefactor t/run/switch0.t to use test.pl instead of making TAP by hand.
Colin Kuskie [Fri, 14 Sep 2012 02:06:02 +0000 (19:06 -0700)]
Refactor t/run/switch0.t to use test.pl instead of making TAP by hand.

11 years agoRefactor t/op/overload_integer.t to use test.pl instead of making TAP by hand.
Colin Kuskie [Fri, 14 Sep 2012 01:54:13 +0000 (18:54 -0700)]
Refactor t/op/overload_integer.t to use test.pl instead of making TAP by hand.

With minor change from committer: Always assign $@ asap after an eval.

11 years agoRefactor t/op/exists_sub.t to use test.pl instead of making TAP by hand.
Colin Kuskie [Fri, 14 Sep 2012 01:42:37 +0000 (18:42 -0700)]
Refactor t/op/exists_sub.t to use test.pl instead of making TAP by hand.

11 years agoMerge branch for mostly regen/regcharclass.pl into blead
Karl Williamson [Fri, 14 Sep 2012 03:14:54 +0000 (21:14 -0600)]
Merge branch for mostly regen/regcharclass.pl into blead

I started this work planning to enhance regen/regcharclass.pl to accept
Unicode properties as input so that some small properties used in \X
could be compiled in, instead of having to be read from disk.  In doing
so, I saw some opportunities to move some EBCDIC dependencies down to a
more basic level, thus replacing quite a few existing ones with just a
couple at the lower levels.  This also led to my enhancing the macros
output by regcharclass.pl to be at least as good (in terms of numbers of
branches, etc) as the hand-coded ones it replaces.

I also spotted a few bugs in existing code that hadn't been triggered
yet.

11 years agoutf8.h: Use machine generated IS_UTF8_CHAR()
Karl Williamson [Thu, 6 Sep 2012 02:56:09 +0000 (20:56 -0600)]
utf8.h: Use machine generated IS_UTF8_CHAR()

This takes the output of regen/regcharclass.pl for all the 1-4 byte
UTF8-representations of Unicode code points, and replaces the current
hand-rolled definition there.  It does this only for ASCII platforms,
leaving EBCDIC to be machine generated when run on such a platform.

I would rather have both versions to be regenerated each time it is
needed to save an EBCDIC dependency, but it takes more than 10 minutes
on my computer to process the 2 billion code points that have to be
checked for on ASCII platforms, and currently t/porting/regen.t runs
this program every times; and that slow down would be unacceptable.  If
this is ever run under EBCDIC, the macro should be machine computed
(very slowly).  So, even though there is an EBCDIC dependency, it has
essentially been solved.

11 years agoregen/regcharclass.pl: Add ability to restrict platforms
Karl Williamson [Thu, 6 Sep 2012 02:48:15 +0000 (20:48 -0600)]
regen/regcharclass.pl: Add ability to restrict platforms

This adds the capability to skip definitions if they are for other than
a desired platform.

11 years agoutf8.h: Remove some EBCDIC dependencies
Karl Williamson [Thu, 6 Sep 2012 02:32:29 +0000 (20:32 -0600)]
utf8.h: Remove some EBCDIC dependencies

regen/regcharclass.pl has been enhanced in previous commits so that it
generates as good code as these hand-defined macro definitions for
various UTF-8 constructs.  And, it should be able to generate EBCDIC
ones as well.  By using its definitions, we can remove the EBCDIC
dependencies for them.  It is quite possible that the EBCDIC versions
were wrong, since they have never been tested.  Even if
regcharclass.pl has bugs under EBCDIC, it is easier to find and fix
those in one place, than all the sundry definitions.

11 years agoregen/regcharclass.pl: Add optimization
Karl Williamson [Wed, 5 Sep 2012 21:18:09 +0000 (15:18 -0600)]
regen/regcharclass.pl: Add optimization

On UTF-8 input known to be valid, continuation bytes must be in the
range 0x80 .. 0x9F.  Therefore, any tests for being within those bounds
will always be true, and may be omitted.

11 years agoregen/regcharclass.pl: White-space only
Karl Williamson [Wed, 5 Sep 2012 21:14:59 +0000 (15:14 -0600)]
regen/regcharclass.pl: White-space only

Indent a newly-formed block

11 years agoregen/regcharclass.pl: Extend previously added optimization
Karl Williamson [Wed, 5 Sep 2012 21:00:52 +0000 (15:00 -0600)]
regen/regcharclass.pl: Extend previously added optimization

A previous commit added an optimization to save a branch in the
generated code at the expense of an extra mask when the input class has
certain characteristics.  This extends that to the case where
sub-portions of the class have similar characteristics.  The first
optimization for the entire class is moved to right before the new loop
that checks each range in it.

11 years agoregen/regcharclass.pl: Rmv always true components from gen'd macro
Karl Williamson [Wed, 5 Sep 2012 15:30:34 +0000 (09:30 -0600)]
regen/regcharclass.pl: Rmv always true components from gen'd macro

This adds a test and returns 1 from a subroutine if the condition will
always match; and in the caller it adds a check for that, and omits the
condition from the generated macro.

11 years agoregen/regcharclass.pl: Add an optimization
Karl Williamson [Tue, 4 Sep 2012 20:54:26 +0000 (14:54 -0600)]
regen/regcharclass.pl: Add an optimization

Branches can be eliminated from the macros that are generated here
by using a mask in cases where applicable.  This adds checking to see if
this optimization is possible, and applies it if so.

11 years agoregen/regcharclass.pl: Rename a variable
Karl Williamson [Wed, 5 Sep 2012 16:26:22 +0000 (10:26 -0600)]
regen/regcharclass.pl: Rename a variable

I find it confusing that the array element name is the same as the full array

11 years agoregen/regcharclass.pl: Pass options deeper into call stack
Karl Williamson [Tue, 4 Sep 2012 20:12:13 +0000 (14:12 -0600)]
regen/regcharclass.pl: Pass options deeper into call stack

This is to prepare for future commits which will act differently at the
deep level depending on some of the options.

11 years agoUse macro not swash for utf8 quotemeta
Karl Williamson [Mon, 3 Sep 2012 22:59:09 +0000 (16:59 -0600)]
Use macro not swash for utf8 quotemeta

The rules for matching whether an above-Latin1 code point are now saved
in a macro generated from a trie by regen/regcharclass.pl, and these are
now used by pp.c to test these cases.  This allows removal of a wrapper
subroutine, and also there is no need for dynamic loading at run-time
into a swash.

This macro is about as big as I'm comfortable compiling in, but it
saves the building of a hash that can grow over time, and removes a
subroutine and interpreter variables.  Indeed, performance benchmarks
show that it is about the same speed as a hash, but it does not require
having to load the rules in from disk the first time it is used.

11 years agoregen/regcharclass.pl: Add new output macro type
Karl Williamson [Mon, 3 Sep 2012 22:54:56 +0000 (16:54 -0600)]
regen/regcharclass.pl: Add new output macro type

The new type 'high' is used on only above-Latin1 code points.  It is
designed for code that already knows the tested code point is not
Latin1, and avoids unnecessary tests.

11 years agoregen/regcharclass.pl: Add documentation
Karl Williamson [Mon, 3 Sep 2012 00:29:42 +0000 (18:29 -0600)]
regen/regcharclass.pl: Add documentation

11 years agoregen/regcharclass.pl: Error check input better
Karl Williamson [Mon, 3 Sep 2012 00:28:19 +0000 (18:28 -0600)]
regen/regcharclass.pl: Error check input better

This makes sure that the modifiers specified in the input are known to
the program.

11 years agoregen/regcharclass.pl: Allow comments in input
Karl Williamson [Sun, 2 Sep 2012 22:48:14 +0000 (16:48 -0600)]
regen/regcharclass.pl: Allow comments in input

Lines whose first non-blank character is a '#' are now considered to be
comments, and ignored.  This allows the moving of some lines that have
been commented out back to after the __DATA__ where they really belong.

11 years agoregen/unicode_constants.pl: Add name parameter
Karl Williamson [Sun, 2 Sep 2012 21:58:41 +0000 (15:58 -0600)]
regen/unicode_constants.pl: Add name parameter

A future commit will want to use the first surrogate code point's UTF-8
value.  Add this to the generated macros, and give it a name, since
there is no official one.  The program has to be modified to cope with
this.

11 years agoMove 2 functions from utf8.c to regexec.c
Karl Williamson [Sun, 2 Sep 2012 21:29:32 +0000 (15:29 -0600)]
Move 2 functions from utf8.c to regexec.c

One of these functions is currently commented out.  The other is called
only in regexec.c in one place, and was recently revised to no longer
require the static function in utf8.c that it formerly called.  They can
be made static inline.

11 years agoregexec.c: Use new macros instead of swashes
Karl Williamson [Sun, 2 Sep 2012 20:46:38 +0000 (14:46 -0600)]
regexec.c: Use new macros instead of swashes

A previous commit has caused macros to be generated that will match
Unicode code points of interest to the \X algorithm.  This patch uses
them.  This speeds up modern Korean processing by 15%.

Together with recent previous commits, the throughput of modern Korean
under \X has more than doubled, and is now comparable to other
languages (which have increased themselved by 35%)

11 years agoregen/regcharclass.pl: Generate macros for \X processing
Karl Williamson [Sun, 2 Sep 2012 20:31:59 +0000 (14:31 -0600)]
regen/regcharclass.pl: Generate macros for \X processing

\X is implemented in regexec.c as a complicated series of property
look-ups.  It turns out that many of those are for just a few code
points, and so can be more efficiently implemented with a macro than a
swash.  This generates those.

11 years agoregen/regcharclass.pl: Change to work on an empty class
Karl Williamson [Sun, 2 Sep 2012 20:26:20 +0000 (14:26 -0600)]
regen/regcharclass.pl: Change to work on an empty class

Future commits will add Unicode properties for this to generate macros,
and some of them may be empty in some Unicode releases.  This just
causes such a generated macro to evaluate to 0.

11 years agoregen/regcharclass.pl: Fix bug for character '0'
Karl Williamson [Fri, 31 Aug 2012 23:04:30 +0000 (17:04 -0600)]
regen/regcharclass.pl: Fix bug for character '0'

The character '0' could be omitted from some generated macros due to
it's testing the value of a hash entry (getting 0 or false) instead
of if it exists or not.

11 years agoregen/regcharclass.pl: Work on EBCDIC platforms
Karl Williamson [Fri, 31 Aug 2012 23:00:27 +0000 (17:00 -0600)]
regen/regcharclass.pl: Work on EBCDIC platforms

This will now automatically generate macros for non-ASCII platforms,
by mapping the Unicode input to native output.

Doing this will allow several cases of EBCDIC dependencies in other code
to be removed, and fixes the bug that this previously had with non-ASCII
platforms.

11 years agoregen/regcharclass.pl: Remove Encode:: dependency
Karl Williamson [Mon, 3 Sep 2012 22:22:32 +0000 (16:22 -0600)]
regen/regcharclass.pl: Remove Encode:: dependency

Newer options to unpack alleviate the need for Encode, and run faster.

11 years agoregen/regcharclass.pl: Handle ranges, \p{}
Karl Williamson [Fri, 31 Aug 2012 22:39:31 +0000 (16:39 -0600)]
regen/regcharclass.pl: Handle ranges, \p{}

Instead of having to list all code points in a class, you can now use
\p{} or a range.

This changes some classes to use the \p{}, so that any changes Unicode
makes to the definitions don't have to manually be done here as well.

11 years agoutf8.h: Save a branch in a macro
Karl Williamson [Sun, 2 Sep 2012 19:09:48 +0000 (13:09 -0600)]
utf8.h: Save a branch in a macro

By adding a mask, we can save a branch.  The two expressions match the
exact same code points.

11 years agoutf8.h: White-space only
Karl Williamson [Sun, 2 Sep 2012 19:08:21 +0000 (13:08 -0600)]
utf8.h: White-space only

This reflows some lines to fit into 80 columns

11 years agoutf8.h: Correct improper EBCDIC conversion
Karl Williamson [Sun, 2 Sep 2012 19:01:50 +0000 (13:01 -0600)]
utf8.h: Correct improper EBCDIC conversion

These macros were incorrect for EBCDIC.  The relationships are based on
I8, the intermediate-utf8 defined for UTF-EBCDIC, not the final encoding.
I was the culprit who did this orginally; I was confused by the names of
the conversion macros.  I'm adding names that are clearer to me; which
have already been defined in utfebcdic.h, but weren't defined for
non-EBCDIC platforms.

11 years agoext/B/B.xs: Remove EBCDIC dependency
Karl Williamson [Sun, 2 Sep 2012 16:37:26 +0000 (10:37 -0600)]
ext/B/B.xs: Remove EBCDIC dependency

These are unnecessary EBCDIC dependencies: It uses isPRINT() on EBCDIC,
and an expression on ASCII, but isPRINT() is defined to be precisely
that expression on ASCII platforms.

11 years agoRemove some EBCDIC dependencies
Karl Williamson [Sun, 2 Sep 2012 16:30:32 +0000 (10:30 -0600)]
Remove some EBCDIC dependencies

A new regen'd header file has been created that contains the native
values for certain characters.  By using those macros, we can eliminate
EBCDIC dependencies.

11 years agoRename regen'd hdr to reflect expanded capabilities
Karl Williamson [Sun, 2 Sep 2012 15:58:43 +0000 (09:58 -0600)]
Rename regen'd hdr to reflect expanded capabilities

The recently added utf8_strings.h has been expanded to include more than
just strings.  I'm renaming it to avoid confusion.

11 years agoregen/utf8_strings.pl: Add ability to get native charset
Karl Williamson [Sun, 2 Sep 2012 15:44:22 +0000 (09:44 -0600)]
regen/utf8_strings.pl: Add ability to get native charset

This adds a new capability to this program: to input a Unicode code point and
create a macro that expands to the platform's native value for it.

This will allow removal of a bunch of EBCDIC dependencies in the core.

11 years agoregen/utf8_strings.pl: Allow explicit default on input
Karl Williamson [Sun, 2 Sep 2012 15:28:55 +0000 (09:28 -0600)]
regen/utf8_strings.pl: Allow explicit default on input

An input line without a command is considered to be a request for the
UTF-8 encoded string of the code point.  This allows an explicit
'string' to be used.

11 years agoregen/utf8_strings.pl: Copy empty input lines to output
Karl Williamson [Sun, 2 Sep 2012 15:22:16 +0000 (09:22 -0600)]
regen/utf8_strings.pl: Copy empty input lines to output

This allows the generated .h to look better.

11 years ago/regcharclass.pl, utf8_strings.pl: Add guard to .h
Karl Williamson [Fri, 31 Aug 2012 23:41:14 +0000 (17:41 -0600)]
/regcharclass.pl, utf8_strings.pl: Add guard to .h

Future commits will have other headers #include the headers generated by
these programs.  It is best to guard against the preprocessor from
trying to process these twice

11 years agoUnicode/UCD.pm: Clarify pod
Karl Williamson [Fri, 31 Aug 2012 23:39:04 +0000 (17:39 -0600)]
Unicode/UCD.pm: Clarify pod

11 years agoFix \X handling for Unicode 5.1 - 6.0
Karl Williamson [Tue, 28 Aug 2012 23:41:41 +0000 (17:41 -0600)]
Fix \X handling for Unicode 5.1 - 6.0

Commit 27d4fc33343f0dd4287f0e7b9e6b4ff67c5d8399 neglected to include a
change required for a few Unicode releases where the \X prepend property
is not empty.  This does that, and suppresses a mktables warning for
Unicode releases prior to 6.2

11 years agoregcomp.c: Wrap some long lines
Karl Williamson [Thu, 6 Sep 2012 16:01:38 +0000 (10:01 -0600)]
regcomp.c: Wrap some long lines

11 years agoperldelta for 8700fd3876
Steve Hay [Thu, 13 Sep 2012 22:27:22 +0000 (23:27 +0100)]
perldelta for 8700fd3876

11 years agoDocument how to create and use smoke-me branches
Steve Hay [Thu, 13 Sep 2012 22:09:19 +0000 (23:09 +0100)]
Document how to create and use smoke-me branches

The instructions are based on the following helpful email from Tony Cook:
http://www.xray.mpe.mpg.de/mailing-lists/perl5-porters/2012-09/msg00747.html
after I tested them myself in course of commit 8700fd3876.

11 years agoFix a couple of headings in perlgit.pod which look to be the wrong level
Steve Hay [Thu, 13 Sep 2012 21:16:44 +0000 (22:16 +0100)]
Fix a couple of headings in perlgit.pod which look to be the wrong level

11 years agoAvoid POSIX::close when closing files by descriptor in IPC::Open3
Steve Hay [Wed, 12 Sep 2012 22:36:41 +0000 (23:36 +0100)]
Avoid POSIX::close when closing files by descriptor in IPC::Open3

Closing a file descriptor with POSIX::close bypasses PerlIO's ref-counting
of file descriptors and leads to MSVC++'s invalid parameter handler being
triggered when the PerlIO stream is closed later because that attempts to
close the underlying file descriptor again, but it's already closed.

So instead, we effectively fdopen() a new PerlIO stream and then close it
again to effect the closure of the file descriptor.

11 years agowhoops, move this back where it was
Jesse Luehrs [Thu, 13 Sep 2012 00:15:59 +0000 (19:15 -0500)]
whoops, move this back where it was

apparently utf8->SWASHNEW calls "require 'unicore/Heavy.pl'" too

11 years agoop.c: Document newGIVENOP(..., 0)
Father Chrysostomos [Wed, 12 Sep 2012 23:19:01 +0000 (16:19 -0700)]
op.c: Document newGIVENOP(..., 0)

Something I missed in b5a648148c.

11 years agoFix listop-hash-infix parsing
Father Chrysostomos [Wed, 12 Sep 2012 21:03:08 +0000 (14:03 -0700)]
Fix listop-hash-infix parsing

With some list operators, this happens:

$ ./miniperl -e 'warn({$_ => 1} + 1) if 0'
syntax error at -e line 1, near "} +"
Execution of -e aborted due to compilation errors.

Putting + before the { or changing warn to print makes the prob-
lem go away.

The lexer is losing track of what token it expects next, so it ends
up interpreting the + as a unary plus, instead of an infix plus.  The
parser doesn’t like that.

It happens because of this logic under case '{' (aka leftbracket:) in
toke.c:yylex:

switch (PL_expect) {
case XTERM:
    if (PL_oldoldbufptr == PL_last_lop)
PL_lex_brackstack[PL_lex_brackets++] = XTERM;
    else
PL_lex_brackstack[PL_lex_brackets++] = XOPERATOR;
    PL_lex_allbrackets++;
    OPERATOR(HASHBRACK);

The value we put on the brackstack is what we expect to find after the
closing brace (case '}' pops it off).

This particular if/else goes all the back to ef6361f9c226 (perl
5.000), or at least that was when it moved inside the XTERM case.
Before that, we had this:

if (oldoldbufptr == last_lop)
    lex_brackstack[lex_brackets++] = XTERM;
else
    lex_brackstack[lex_brackets++] = XOPERATOR;
if (expect == XTERM)
    OPERATOR(HASHBRACK);

So it appears that the XTERM/XOPERATOR distinction, based on last_lop
was the ‘old’ (and wrong) way of doing it, but it had to be changed in
perl 5.000 for cases other than XTERM.  That it remained for XTERM was
probably an oversight, which is easy to understand, since I seem to be
the first one to stumble across this after 18 years (what’s the rele-
vant Klortho number?).

Removing this last_lop check causes no tests to fail.  And it makes
sense, since anything coming right after an anonymous hash that could
be either an infix or prefix operator must be infix.

11 years agotoke.c: Under -DT, dump complement properly
Father Chrysostomos [Wed, 12 Sep 2012 20:31:40 +0000 (13:31 -0700)]
toke.c: Under -DT, dump complement properly

Before:

$ ./miniperl -DT -e '~foo'
....
### 0:LEX_NORMAL/XSTATE ""
### <== ?? 126
....

After:

$ ./miniperl -DT -e '~foo'
....
### 0:LEX_NORMAL/XSTATE ""
### <== '~'
....

11 years agoAdd PL_subname to the save stack
Peter Martini [Sun, 9 Sep 2012 14:45:11 +0000 (10:45 -0400)]
Add PL_subname to the save stack

Otherwise, PL_subname is left as utf8::SWASHNEW after isIDFIRST_lazy_if
(etc) is called in UTF context

11 years agoEradicate race condition in t/op/sigsystem.t (#114562)
Leon Timmermans [Wed, 12 Sep 2012 13:38:44 +0000 (15:38 +0200)]
Eradicate race condition in t/op/sigsystem.t (#114562)

11 years agostop ""-overloaded Regex recursing
David Mitchell [Wed, 12 Sep 2012 11:36:08 +0000 (12:36 +0100)]
stop ""-overloaded Regex recursing

There was code to detect this, but it checked for the returned value being
the same as before, but in this case it was returning a *new* temporary
reference to the same Regexp object; so check for that too.

11 years agoadd test for 6502e08, s/(.)/die/e
David Mitchell [Wed, 12 Sep 2012 11:03:22 +0000 (12:03 +0100)]
add test for 6502e08, s/(.)/die/e

Forgot to add a test along with the commit that fixed this

11 years agoperldelta: add recent regex API changes
David Mitchell [Wed, 12 Sep 2012 10:51:03 +0000 (11:51 +0100)]
perldelta: add recent regex API changes

11 years agoupdate docs for $`, $&, $' changes
David Mitchell [Wed, 12 Sep 2012 10:32:12 +0000 (11:32 +0100)]
update docs for $`, $&, $' changes

mention that they're now detected individually, and mention in reapi
the new RX_BUFF_IDX_* symbolic constants.

11 years agoRefactor to use test.pl instead of making TAP by hand. Add test names.
Colin Kuskie [Sun, 9 Sep 2012 20:26:49 +0000 (13:26 -0700)]
Refactor to use test.pl instead of making TAP by hand. Add test names.

11 years agoUnify CvDEPTH for formats and subs
Father Chrysostomos [Wed, 12 Sep 2012 03:22:57 +0000 (20:22 -0700)]
Unify CvDEPTH for formats and subs

As Dave Mitchell pointed out, while putting the CvDEPTH field for for-
mats in the SvCUR slot might save memory for formats, it slows down
sub calls because CvDEPTH is used on subs in very hot code paths.
Checking the SvTYPE to determine which field to use should not be
necessary.

11 years agopad.c: Share pad name lists between clones
Father Chrysostomos [Mon, 3 Sep 2012 05:27:52 +0000 (22:27 -0700)]
pad.c: Share pad name lists between clones

Pad names are immutable once the sub is compiled.  They are shared
between clones.  Instead of creating a new array containing the same
pad name SVs, just share the whole array.

cv_undef does not need to modify the pad name list when removing an
anonymous sub, so we can just delete that code.  That was the only
thing modifying them between compilation and freeing, as far as I
could tell.

11 years agoUpdated Search::Dict to 1.07 as on CPAN
David Golden [Fri, 30 Mar 2012 18:02:37 +0000 (20:02 +0200)]
Updated Search::Dict to 1.07 as on CPAN

11 years agoPerldelta up to 5e96eee9
Florian Ragwitz [Tue, 11 Sep 2012 14:53:37 +0000 (10:53 -0400)]
Perldelta up to 5e96eee9

11 years agoText::Abbrev has been synchronised to CPAN
Florian Ragwitz [Tue, 11 Sep 2012 14:36:31 +0000 (10:36 -0400)]
Text::Abbrev has been synchronised to CPAN

11 years agoTerm::ReadLine has been synchronised to CPAN
Florian Ragwitz [Tue, 11 Sep 2012 14:32:12 +0000 (10:32 -0400)]
Term::ReadLine has been synchronised to CPAN