This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
perl5.git
9 years agoRevert "manisort"
Jarkko Hietaniemi [Fri, 7 Nov 2014 11:39:47 +0000 (06:39 -0500)]
Revert "manisort"

This reverts commit b22d640684f6001bfd63316a6a3ce69127745943.

9 years agoDeparse Devel::Peek::Dump
Father Chrysostomos [Fri, 7 Nov 2014 06:41:46 +0000 (22:41 -0800)]
Deparse Devel::Peek::Dump

I’m not sure how or where to test this.  Maybe we should document this
‘accidental’ plug-in interface for B::Deparse and custom ops.

9 years agoBetter B::Deparse warning for custom ops
Father Chrysostomos [Fri, 7 Nov 2014 06:19:14 +0000 (22:19 -0800)]
Better B::Deparse warning for custom ops

9 years agoUpdate B::Deparse docs about BEGIN blocks
Father Chrysostomos [Fri, 7 Nov 2014 06:05:41 +0000 (22:05 -0800)]
Update B::Deparse docs about BEGIN blocks

9 years agoSpell optimise consistently in Deparse pod
Father Chrysostomos [Fri, 7 Nov 2014 05:42:52 +0000 (21:42 -0800)]
Spell optimise consistently in Deparse pod

also add a missing hyphen.

9 years agoMention Data::Dump::Streamer in B::Deparse docs
Father Chrysostomos [Fri, 7 Nov 2014 05:42:00 +0000 (21:42 -0800)]
Mention Data::Dump::Streamer in B::Deparse docs

9 years ago[perl #77452] Deparse BEGIN blocks in the right place
Father Chrysostomos [Fri, 7 Nov 2014 04:32:58 +0000 (20:32 -0800)]
[perl #77452] Deparse BEGIN blocks in the right place

In the op tree, a statement consists of a nextstate/dbstate op (of
class cop) followed by the contents of the statement.  This cop is
created after the statement has been parsed.  So if you have nested
statements, the outermost statement has the highest sequence number
(cop_seq).  Every sub (including BEGIN blocks) has a sequence number
indicating where it occurs in its containing sub.

So

 BEGIN { } #1
 # seq 2
 {
   # seq 1
   ...
 }

is indistinguishable from

 # seq 2
 {
   BEGIN { } #1
   # seq 1
   ...
 }

because the sequence number of the BEGIN block is 1 in both examples.

By reserving a sequence number at the start of every block and using
it once the block has finished parsing, we can do this:

 BEGIN { } #1
 # seq 1
 {
   # seq 2
   ...
 }

 # seq 1
 {
   BEGIN { } #2
   # seq 2
   ...
 }

and now B::Deparse can tell where to put the blocks.

PL_compiling.cop_seq was unused, so this is where I am stashing
the pending sequence number.

9 years agoIncrease $B::Concise::VERSION to 0.995
Father Chrysostomos [Fri, 7 Nov 2014 02:06:01 +0000 (18:06 -0800)]
Increase $B::Concise::VERSION to 0.995

9 years agoAdjust Peek.t for SEQ dumping
Father Chrysostomos [Fri, 7 Nov 2014 02:05:17 +0000 (18:05 -0800)]
Adjust Peek.t for SEQ dumping

9 years agodump.c: Use same code for cops and ex-cops
Father Chrysostomos [Thu, 6 Nov 2014 21:29:21 +0000 (13:29 -0800)]
dump.c: Use same code for cops and ex-cops

This also allows ex-dbstate ops to have their cop fields dumped, which
was not the case before.

9 years agodump.c: Dump seq field of nextstate ops
Father Chrysostomos [Thu, 6 Nov 2014 21:22:02 +0000 (13:22 -0800)]
dump.c: Dump seq field of nextstate ops

This is very useful for debugging.

9 years agoRemove Mac Classic code from B::Concise
Father Chrysostomos [Thu, 6 Nov 2014 16:21:53 +0000 (08:21 -0800)]
Remove Mac Classic code from B::Concise

9 years agoFix perldiag typo
Father Chrysostomos [Fri, 7 Nov 2014 06:06:41 +0000 (22:06 -0800)]
Fix perldiag typo

spotted by Lukas Mai.

9 years agoperldiag: rewrap an entry for better splain output
Father Chrysostomos [Fri, 7 Nov 2014 06:03:42 +0000 (22:03 -0800)]
perldiag: rewrap an entry for better splain output

9 years agosort perldiag
Father Chrysostomos [Fri, 7 Nov 2014 05:57:09 +0000 (21:57 -0800)]
sort perldiag

9 years agosimplify Perl_xs_apiversion_bootcheck
Daniel Dragan [Fri, 7 Nov 2014 04:57:14 +0000 (23:57 -0500)]
simplify Perl_xs_apiversion_bootcheck

We control both strings. Perl API versions are not old decimal or alphas
versions. Maints dont increase Perl API ver. Just do a memcmp. Faster and
less machine code. Before 0xA6 bytes of machine code on VC 2003 32b,
after 0x35. This patch is related to [perl #123136].

9 years agoperldelta for aa9d125313d7
Tony Cook [Fri, 7 Nov 2014 05:05:11 +0000 (16:05 +1100)]
perldelta for aa9d125313d7

9 years ago[perl #108276] re-indent the loop body
Tony Cook [Fri, 7 Nov 2014 04:23:31 +0000 (15:23 +1100)]
[perl #108276] re-indent the loop body

9 years agomove the closing ) out of the #ifdef USE_ITHREADS to avoid confusing tools
Tony Cook [Fri, 7 Nov 2014 04:38:19 +0000 (15:38 +1100)]
move the closing ) out of the #ifdef USE_ITHREADS to avoid confusing tools

emacs, in my case

9 years ago[perl #108276] avoid deep scalarvoid() self-recursion
Tony Cook [Fri, 7 Nov 2014 04:36:58 +0000 (15:36 +1100)]
[perl #108276] avoid deep scalarvoid() self-recursion

This fixes the original test case from the ticket.

It may be possible for code that alternates recursion between
scalarvoid() and scalar() to cause deep recursion, but I haven't seen
an example that does it.

This doesn't indent the scalarvoid() loop, which will be done in another
change.

9 years agoperldelta for ab4e48c10a / #123135
Father Chrysostomos [Fri, 7 Nov 2014 04:12:33 +0000 (20:12 -0800)]
perldelta for ab4e48c10a / #123135

9 years agomanisort
Jarkko Hietaniemi [Fri, 7 Nov 2014 02:06:50 +0000 (21:06 -0500)]
manisort

9 years agot/TEST: RFC start to separate out valgrind test support.
Jim Cromie [Fri, 6 Dec 2013 04:28:50 +0000 (21:28 -0700)]
t/TEST: RFC start to separate out valgrind test support.

This patch creates an empty t/TestValgrind.pm file, and requires it
from t/TEST when ENV{PERL_VALGRIND} is set.  As such its seeks to
reinterpret the comments at the top of t/TEST.

I propose that the "no require allowed" rule appply to code reached
from "make test" without options.

Code used only for special case testing, like "make test.valgrind", or
with options passed in via $ENV{TEST_OPTS}, need not be constrained
like this.

A broken require is not something seen until the statement is executed
and throws an error.  There is nothing special about require at
parse-time that must be avoided, unless we're more than typically
paranoid.

 make test.valgrind
   /bin/sh -e ./runtests choose
     ./perl TEST
       sh -c valgrind --log-fd=3 --suppressions=perl.supp --leak-check=yes --leak-resolution=high --show-reachable=yes --num-callers=50 --track-origins=yes ./perl -I.. -MTestInit porting/podcheck.t 3>podcheck.t.valgrind-current
         valgrind --log-fd=3 --suppressions=perl.supp --leak-check=yes --leak-resolution=high --show-reachable=yes --num-callers=50 --track-origins=yes ./perl -I.. -MTestInit porting/podcheck.t

If this argument is accepted, it looks simple to move the VALGRIND
related code blocks into new subroutines in the now-empty
TestValgrind.pm file, and call them appropriately.

9 years agot/TEST: suppress 2 uninitialized envars under make test.valgrind
Jim Cromie [Fri, 6 Dec 2013 02:29:15 +0000 (19:29 -0700)]
t/TEST: suppress 2 uninitialized envars under make test.valgrind

Recent addition of -w on shebang exposed 2 uninitialized vars, due to
VG_OPTS envar added in commit 11b1a7c9, which added glue to reuse
t/TEST's support for make test.valgrind to run linux perf.  The 2
use-cases are:

1. make test.valgrind
2. export VG_OPTS='stat -o perf-stat --append --'
   export VALGRIND=/usr/bin/perf
   export VG_TEST=--help
   make test.valgrind

Since 2 is rather non-obvious, clarify with comment here and in code.

TODO: this patch is old, and either needs to be revalidated, or
perhaps rethought; use-case 2 is mostly obsoleted by -lxperf option,
but case 1 still holds.

9 years agot/TEST: change timings Storable key: perf -> times, a better description
Jim Cromie [Thu, 21 Nov 2013 23:22:09 +0000 (16:22 -0700)]
t/TEST: change timings Storable key: perf -> times, a better description

Commit 8e03ad8f6c wrote the tests' timing data to a Storable file
using 'perf' as the storage key, but now that we can capture real perf
stat data during make test, the old name is misleading - change it to
"times" to better describe its origin and character.

9 years agot/TEST: simplify <$results> processing loop. - TAP13.1+
Jim Cromie [Wed, 20 Nov 2013 18:43:57 +0000 (11:43 -0700)]
t/TEST: simplify <$results> processing loop. - TAP13.1+

Support use of the --repeat=3 option of linux's perf stat.  This
basically means extending the TAPv13 spec (or t/TEST's implementation)
to allow repeated (ie R) plan executions (ie R occurrences of "1..N"
plus the preceding or following N * "ok"s), as long as all R plans
have the same N.

When a test script is run (under linux perf with --repeat=N), the
value of R is unavailable in the output; it is transparent other than
the repetition itself.  But we woundnt want it anyway; TAP readers
dont need to handle a new kind of input.  If we just allow R
repetitions of 1..N tests, we get loose coupling and dont care if
--repeat=5 were given.

Current legal TAP is essentially either:

  print "ok $_\n" for 1..N; # 1A
  print "1..N\n";
  # OR [1]
  print "1..N\n"; # 1B
  print "ok $_\n" for 1..N;

The big simplification here is that under --repeat, leading vs
trailing "1..N"s are an irrelevant detail.

- "1..N" plans are only allowed before any tests, or after all of
  them, ie ($next==0 or $next==$plan).  We just verify this when
  "1..N" is seen in test output.

- $plan = undef initially, updated to N when "1..N" is 1st seen.

- $next=0 when "1..N" is seen [2].

- when 2nd+ "1..N" plans are seen, they are allowed if they agree on N.

- The change to if (defined $plan) accepts "1..0" as legal (ie SKIPs).

- $seen_leader and $trailing_leader are thus obsolete, replaced where
  needed by "if ($plan)", which is set only when "1..N" is seen.

- $seen_ok was used with $seen_leader to reset $next (test-count).
  now handled in [2]

- $max is also taken right from "1..N", replaced with <some-expr>($plan)

NOTES:

[1]: this patch allows BOTH 1A then 1B to run successfully, but not 1B
followed by 1A; the latter would fail on N+1 th test, because the
now-trailing "1..N" failed to reset $next.  This is an unimportant
corner case and doesnt warrant cluttering details in the code.
We are running maintained regression tests here, not logic bombs.

- On "1..N" occurrences:
  $Reps++ to count repeats (tested at end)
  reset $next = 0 after validating it [1]
  $nextreps++, like $next w/o reset.

- post-loop tests:
  change ($next == $max) test to ($nextreps == $Reps * $plan),
  which avoids the now resetting $next.

TODO:

This patch supports --repeat N in t/TEST only; harness is strict wrt
"only 1 plan", ala TAPv13, so make test_harness complains as follows,
and fails the tests.

  comp/use.t ........................................................ All 84 subtests passed
  comp/retainedlines.t .............................................. All 75 subtests passed
  comp/cmdopt.t ..................................................... All 44 subtests passed

Sort whats reported in summary data; unique tests or repeated tests ?
Reduce $totmax vs $max vs $Reps a bit, extra/redundant state is not helpful.

9 years agot/TEST: add -lxperf option to run tests under linux's perf stat
Jim Cromie [Mon, 8 Oct 2012 02:22:08 +0000 (20:22 -0600)]
t/TEST: add -lxperf option to run tests under linux's perf stat

With this patch, TEST can run each test-script under linux's perf
stat.  Since previous patch honors options for $do_nothing / requires,
harness can use perf stat too.

 t]$ ./perl -I../lib TEST -lxperf
 t]$ ./perl harness -lxperf

"perf stat" output is comparable to that of "valgrind --tool=cachegrind"
but it takes very little extra CPU to run:

export TEST_OPTS=-lxperf
time make test time make test
-------------- --------------
real 25m41.122s real 26m30.719s
user 18m28.773s user 18m43.286s
sys 1m12.705s sys 1m33.398s

Given this small runtime cost, porters might be inclined to use it and
inspect the data.  There may be some core regression tests that are
useful for benchmarking purposes.

EXAMPLES:

 Performance counter stats for './perl base/cond.t':

          2.077911 task-clock                #    0.640 CPUs utilized
                 2 context-switches          #    0.963 K/sec
                 1 cpu-migrations            #    0.481 K/sec
               519 page-faults               #    0.250 M/sec
         2,753,978 cycles                    #    1.325 GHz
         1,725,265 stalled-cycles-frontend   #   62.65% frontend cycles idle
         2,405,122 stalled-cycles-backend    #   87.33% backend  cycles idle
         3,278,429 instructions              #    1.19  insns per cycle
                                             #    0.73  stalled cycles per insn [52.13%]
     <not counted> branches
     <not counted> branch-misses

       0.003244748 seconds time elapsed

perf stat --repeat N also computes std-deviation for each measurement
it does, so this patch makes that feature available.  Std-dev will
tell us when performance differences are lost in the noise.

 ./perl TEST -v -lxperf=10 re/pat_rt_report.t
   perf stat --repeat 10 -- ./perl -I.. -MTestInit re/pat_rt_report.t
     ./perl -I.. -MTestInit re/pat_rt_report.t

 Performance counter stats for './perl -I.. -MTestInit re/pat_rt_report.t' (10 runs):

         98.749506 task-clock                #    0.001 CPUs utilized            ( +- 23.68% )
                68 context-switches          #    0.686 K/sec                    ( +- 82.04% )
                10 cpu-migrations            #    0.097 K/sec                    ( +- 17.44% )
             2,956 page-faults               #    0.030 M/sec                    ( +- 23.22% )
       254,477,657 cycles                    #    2.577 GHz                      ( +- 26.02% ) [50.43%]
        75,556,485 stalled-cycles-frontend   #   29.69% frontend cycles idle     ( +- 19.50% ) [50.93%]
        62,921,965 stalled-cycles-backend    #   24.73% backend  cycles idle     ( +- 25.21% ) [51.50%]
       241,522,257 instructions              #    0.95  insns per cycle
                                             #    0.31  stalled cycles per insn  ( +- 34.07% ) [50.96%]
        53,147,072 branches                  #  538.201 M/sec                    ( +- 31.19% ) [50.18%]
         2,451,318 branch-misses             #    4.61% of all branches          ( +- 11.32% ) [49.95%]

     141.101988701 seconds time elapsed                                          ( +- 99.91% )

The patch has 3 parts:

An addition to TEST:_cmd() which wraps the test invocation inside a
"perf stat ..." as shown above, using a %cmdwrap template.

Option-parsing code, which handles several option forms:
  1) -lxperf
      writes file "$tstamp.perf" into ./t (after `cd $t && ...`)
  2) -lxperf=4
      adds "--repeat 4" to perf stat invocation.
  3) -lxperf=(key=val) pairs
      known key=value pairs (with =defaults given)
       - tool=perf # path to tool
       - cmd=stat # todo try others, perf record, etc
       - reps=1 #
       - rptdir # write reports to a separate data-repo, safe from git clean -dxf
       - name    # to convey branch-name and/or config-info, tstamp is prefixed,
       - opts # passthru options to perf-stat

$ENV{TEST_OPTS} is split on /;/ and prepended to @ARGV before option
handling, so the following export will affect both make jobs.

  export TEST_OPTS="-v;-lxperf=reps=3:rptdir=$HOME/perl/perfdata"
  make test
  make test_harness

NOTES:

Test script output under perf stat --repeat 4 violates the "plan just
once" rule of TAPv13 spec.  It could be extended:

   "The plan cannot appear in the middle of the output, only at
    beginning or end.  Multiple sets of (plan + tests) are allowed, if
    all plans agree"

perf stat --repeat N causes perf to compute std-deviation(s) for each
measure.  1st example below is w/o repeat, 2nd with it, corresponding
to the TEST and harness examples above.  I dont know how to read into
the numbers, but theres value in having them; they provide some
estimate of "noise-floor" on performance for a given test.

The -opts option passthru to perf stat allows "-x," to cause perf stat
to emit CSV output.  This is easier to parse than the human readable
output, but doesnt include the computed/normalized values, nor the
name that the "Performance counter stats" (see examples) are for.

TODO

Probable rework of -lxperf option parsing
- no way now to get output to STDOUT, only to file. maybe not worth having
- keep (k=v:)+ form
- use name="%B-%G-%T.perf" by default "$branch-$sha1st6-$timestamp.perf"
- use wr=1 to save file
- dir=$HOME/perfruns (shorten rptdir)

Using reps=2 yields "FAILED--seen duplicate leader" on every test.
Fixing this requires changes to TEST's <results> processing loop.  The
reps handling sub-option code is in this patch because it serves as a
test-case for further changes to optional behavior.

The command wrapper template is pretty minimal and constrained; the
output file name is "$dir/$timestamp$name.perfstat", chosen to match
with $timestamp.ttimes so that both file-types are browsable as a pair.

TEST_OPTS is split on ';', -lxperf is split on ':' into k=v pairs.
There may be scenarios where these delimiters are inconvenient, or the
simplistic parse is brittle.

   Performance counter stats for './perl base/cond.t' (3 runs):

9 years agot/TEST: move do_nothing test after option-handling code
Jim Cromie [Sat, 16 Nov 2013 18:32:44 +0000 (11:32 -0700)]
t/TEST: move do_nothing test after option-handling code

As explained in commit c537bcda1, $do_nothing's purpose is to prevent
TEST from actually running the tests, so that it can be required by
harness, and its routines reused.

This patch moves TEST's $do_nothing check after its option-handling
code, allowing those options to be used to alter the behavior of the
TEST subroutines when called by harness, the same as when they're
called from TEST::main.

TODO: With TEST's option handling done even for $do_nothing cases, it
consumes all options before harness sees them, so harness options -v
and -torture are broken.  There are multiple ways to handle it, all
needing some consensus:

- harness does selective option scanning before requiring TEST.  It
  could either consume its options or pass them thru once it handles
  them.

- both -v and -torture are implemented by TEST and harness, and mean
  qualitatively the same thing.  OTOH, any consumers of the respective
  outputs may care about differences.  Simply, could rename one of
  each option to avoid the conflict.

- use of $TEST::verbose (or are namespaces also to be avoided?)

9 years agot/TEST: comment some of the <$results> loop vars
Jim Cromie [Sat, 20 Oct 2012 03:26:35 +0000 (21:26 -0600)]
t/TEST: comment some of the <$results> loop vars

Add comments to var declarations, to help clarify loop operation.

9 years agot/TEST: add a common timestamp
Jim Cromie [Fri, 19 Oct 2012 19:43:11 +0000 (13:43 -0600)]
t/TEST: add a common timestamp

Commit 0978c4bed computed a timestamp string as part of an output
filename, make it available for others.

9 years agot/TEST: $failure doesnt need to use defined
Jim Cromie [Sun, 7 Oct 2012 17:10:16 +0000 (11:10 -0600)]
t/TEST: $failure doesnt need to use defined

$failure handling in <$results> processing loop does not need extra
subtlety of defined-ness checks - just give it an initial (false)
value, and check for truth.

9 years agot/TEST: move our @found out to its real scope
Jim Cromie [Sat, 20 Oct 2012 03:29:39 +0000 (21:29 -0600)]
t/TEST: move our @found out to its real scope

commit c96083ea8213 added our @found inside sub _find_tests,
but testing with strict exposes probs:

  $ perl -cw -Ilib -Mstrict t/TEST
  Variable "@found" is not imported at t/TEST line 198.
  Variable "@found" is not imported at t/TEST line 202.
  Global symbol "@found" requires explicit package name at t/TEST line 198.
  Global symbol "@found" requires explicit package name at t/TEST line 202.

No point in arguing, hoist decl out to file scope.

9 years agot/TEST: add -w to shebang, fix a used-once warning
Jim Cromie [Fri, 19 Oct 2012 19:22:39 +0000 (13:22 -0600)]
t/TEST: add -w to shebang, fix a used-once warning

Adding -w should be ok, despite peculiar code style; it avoids
require, unlike "use strict".  Added risk of perl brokenness seems
vanishingly small.  Fix one used-once warning thus exposed, and one
test in FileHandle.t surprised by t/TEST's new '-w' in the shebang.

9 years agoperldelta for 0997db6f4222
Tony Cook [Fri, 7 Nov 2014 00:12:28 +0000 (11:12 +1100)]
perldelta for 0997db6f4222

9 years ago[perl #108276] avoid deep recursion in Perl_op_free()
Tony Cook [Tue, 28 Oct 2014 00:18:28 +0000 (11:18 +1100)]
[perl #108276] avoid deep recursion in Perl_op_free()

Based on a patch by Niels Thykier, with the following changes:

- the stack is allocated dynamically, rather than with a fixed depth
  of 10

- reordered the loop to avoid pushing the argument and immediately
  popping it.  This wasn't a big deal with the auto stack, but avoids
  a Newx() call for freeing leaf nodes

9 years agoOptimise ‘return’ away at end of lv sub
Father Chrysostomos [Thu, 6 Nov 2014 18:30:40 +0000 (10:30 -0800)]
Optimise ‘return’ away at end of lv sub

9 years agoOptimise substr assignment at sub exit
Father Chrysostomos [Thu, 6 Nov 2014 18:28:02 +0000 (10:28 -0800)]
Optimise substr assignment at sub exit

The assignment in substr(...) = ... gets optimised away in void con-
text.  We can also optimise it away at sub exit as long as this is not
an lvalue sub and pp_substr returns the replacement when optimised.

9 years agoAdd optional GCC-only support for using long doubles on Win32
Steve Hay [Thu, 6 Nov 2014 08:57:35 +0000 (08:57 +0000)]
Add optional GCC-only support for using long doubles on Win32

9 years agoop.c: Skip pushmark for (...)x... in scalar cx
Father Chrysostomos [Thu, 6 Nov 2014 06:27:47 +0000 (22:27 -0800)]
op.c: Skip pushmark for (...)x... in scalar cx

(...)x... is marked as a list at compile time and given a pushmark,
before the context is known.  If it turns out to be called in scalar
or void context after all, then pp_repeat has to handle the mark that
has been pushed on to the markstack.

When the scalar context is applied, there is no reason not to undo
the listification, as long as there is only one left-hand argument.
That way we don’t have to execute a pushmark op and do the extra stack
fiddling at run time.

9 years ago[perl #121827] Fix repeat stack bugs
Father Chrysostomos [Thu, 6 Nov 2014 06:20:46 +0000 (22:20 -0800)]
[perl #121827] Fix repeat stack bugs

(...)x... is marked as a list at compile time and given a pushmark,
before the context is known.  If it turns out to be called in scalar
or void context after all, then pp_repeat has to handle the mark that
has been pushed on to the markstack.

It was not handling the mark for overloading.  Nor was it handling
void context correctly at all.  (The stack may have an empty list, in
which case we call FETCH on a potentially tied stack item that has
nothing to do with us.)

I tested it in void context, because I plan to undo the listification
when scalar context is applied, for speed.

9 years agoComment tweak.
Jarkko Hietaniemi [Thu, 6 Nov 2014 11:50:15 +0000 (06:50 -0500)]
Comment tweak.

9 years agohexfp: use the double-double fallback also for unknown formats.
Jarkko Hietaniemi [Wed, 5 Nov 2014 03:09:38 +0000 (22:09 -0500)]
hexfp: use the double-double fallback also for unknown formats.

9 years agoMention that packing inf/nan as integerish is deadly.
Jarkko Hietaniemi [Thu, 6 Nov 2014 02:24:08 +0000 (21:24 -0500)]
Mention that packing inf/nan as integerish is deadly.

9 years agoSome notes on floating point endianness and formats.
Jarkko Hietaniemi [Thu, 6 Nov 2014 02:18:12 +0000 (21:18 -0500)]
Some notes on floating point endianness and formats.

9 years agoSome notes on integer endianness.
Jarkko Hietaniemi [Thu, 6 Nov 2014 02:06:43 +0000 (21:06 -0500)]
Some notes on integer endianness.

9 years agoConfigure: if doublesize==longdblsize, return 0.
Jarkko Hietaniemi [Thu, 6 Nov 2014 01:25:03 +0000 (20:25 -0500)]
Configure: if doublesize==longdblsize, return 0.

9 years ago[perl #123135] Tests for utf8 %^N within match
Father Chrysostomos [Thu, 6 Nov 2014 04:29:46 +0000 (20:29 -0800)]
[perl #123135] Tests for utf8 %^N within match

9 years agoManually revert "Rationalise RX_MATCH_UTF8_set()"
Father Chrysostomos [Thu, 6 Nov 2014 04:28:28 +0000 (20:28 -0800)]
Manually revert "Rationalise RX_MATCH_UTF8_set()"

Commit 0254aed965 says in its message, among other things:

    Now that the RXf_MATCH_UTF8 flag on a regex is just used to indicate
    whether the captures on a successful match are utf8, only set
    this flag at the end of a successful match, rather than at the start of
    the match.

But if we only set the utf8 flag at the end of the match, then $^N
accessed within the match will have the flag wrongly set.

9 years agoDeparse +sub :attr{} correctly at stmt start
Father Chrysostomos [Wed, 5 Nov 2014 13:45:30 +0000 (05:45 -0800)]
Deparse +sub :attr{} correctly at stmt start

9 years agotoke.c: Allocate __SUB__ as a baseop if possible
Father Chrysostomos [Wed, 5 Nov 2014 13:26:22 +0000 (05:26 -0800)]
toke.c: Allocate __SUB__ as a baseop if possible

__SUB__ is a baseop, but it gets converted to a const op (a svop)
later if the sub is not clonable.  Since a svop is bigger, we allo-
cate it as a larger size initially.  But if we already know that
the sub is clonable by the time we see __SUB__, we can go with the
smaller op size.

9 years agopack 'D' only if nvsize > doublesize.
Jarkko Hietaniemi [Wed, 5 Nov 2014 12:06:41 +0000 (07:06 -0500)]
pack 'D' only if nvsize > doublesize.

9 years agoPropagate lvalue context to lhs of (...)x...
Father Chrysostomos [Wed, 5 Nov 2014 02:01:48 +0000 (18:01 -0800)]
Propagate lvalue context to lhs of (...)x...

This allows foreach(($#array)x$count) { $_++ } to work as expected.

9 years agodon't call SvPV and toss the result if no PerlIO ptr
Daniel Dragan [Wed, 5 Nov 2014 01:33:23 +0000 (20:33 -0500)]
don't call SvPV and toss the result if no PerlIO ptr

If f is NULL, SvPV and Perl_get_context are unnecessarily executed. Fix
it for efficiency. Move 2nd dTHX to the scope where it is first used
similar to commit 2bcd6579c4 .

9 years agochar * pv can never be null in S_is_safe_syscall
Daniel Dragan [Wed, 5 Nov 2014 01:16:45 +0000 (20:16 -0500)]
char * pv can never be null in S_is_safe_syscall

embed.fnc marks arg pv as NN, and PERL_ARGS_ASSERT_IS_SAFE_SYSCALL contains
assert(pv). Remove the test and branch for efficiency.

9 years agoRevert "Raise warnings for poorly supported locales"
Karl Williamson [Wed, 5 Nov 2014 01:54:49 +0000 (18:54 -0700)]
Revert "Raise warnings for poorly supported locales"

This reverts commit 3d3a881c1b0eb9c855d257a2eea1f72666e30fbc.

Win32 with a 1252 code page was failing blead.  Revert until I have time
to look at it.

9 years agochange 'make clean' to be equivalent to 'make realclean'
Tony Cook [Mon, 6 Oct 2014 23:33:58 +0000 (10:33 +1100)]
change 'make clean' to be equivalent to 'make realclean'

'make clean' hasn't been useful since at least 1997, change it to
something that is useful, 'make realclean'

9 years ago[perl #120487] make sure we're using an unmodified @INC to load Win32
Tony Cook [Wed, 29 Oct 2014 02:53:13 +0000 (13:53 +1100)]
[perl #120487] make sure we're using an unmodified @INC to load Win32

rmtree() indirectly loads Win32, and since the test adds
$Config{installsitelib) to @INC, if a previous perl has been installed
in the current build's installation directory, the wrong module may be
loaded.

This is made worse by Win32 perl not using the archname in the library
directory.

9 years agofuse returning branches in pp_goto
Daniel Dragan [Tue, 4 Nov 2014 07:20:41 +0000 (02:20 -0500)]
fuse returning branches in pp_goto

before 0xA08 bytes of machine code on miniperl VC2003, after 0x9B0

All 3 exit/return paths of pp_goto call PERL_ASYNC_CHECK, but due to
subtle differences between them, they were 3 separate branches in machine
code that shared nothing. In the first, a plain C return was done instead
of a RETURNOP (which contains "PL_stack_sp = sp"). In the 2 RETURNOPs, one
returned a OP * from a CV*, the other returned a C auto. They couldn't be
fused therefore, since PERL_ASYNC_CHECK could, according to C lang,
rewrite CvSTART. To fix this, reorder the order of operations so 1 instance
of PERL_ASYNC_CHECK is shared by the 3 different exit paths. Also due to
the "if (!(do_dump || label_len)) DIE" it is impossible to not run one or
the other.  The isolated if(do_dump) and if(label_len), mean that unless
a C optimizer was very smart (VC wasnt), there was an control path where
PERL_ASYNC_CHECK would execute twice in row. Remove that control path
explicitly.  There might be questionable stack usage/stack reallocation
near PERLDB_GOTO but I am not looking for that in this patch.

9 years agofix Win32 nmake cant rebuild DynaLoader.obj on Makefile regen bug
Daniel Dragan [Tue, 4 Nov 2014 06:14:04 +0000 (01:14 -0500)]
fix Win32 nmake cant rebuild DynaLoader.obj on Makefile regen bug

See [perl #123123] for details.

9 years agoop.c: ro ops for mysubs
Father Chrysostomos [Tue, 4 Nov 2014 22:46:40 +0000 (14:46 -0800)]
op.c: ro ops for mysubs

Bring the jollity of read-only ops to my subs

9 years agoconst fold OS versions in make_ext.pl
Daniel Dragan [Tue, 4 Nov 2014 08:46:09 +0000 (03:46 -0500)]
const fold OS versions in make_ext.pl

goto-LABEL is extremely slow in P5, so use a scalar to cache the result of
file not existing.

9 years agoMake Peek.t less sensitive to NO_COW config args
Father Chrysostomos [Tue, 4 Nov 2014 22:40:22 +0000 (14:40 -0800)]
Make Peek.t less sensitive to NO_COW config args

Maybe what I am doing is too clever, but I just take the last Configure
command line and add an S to -DPERL_NO_COW to disable it.  It doesn’t
hurt to make Peek.t more robust, though.

9 years agoop.c: Fix PERL_DEBUG_READONLY_OPS
Father Chrysostomos [Tue, 4 Nov 2014 22:09:26 +0000 (14:09 -0800)]
op.c: Fix PERL_DEBUG_READONLY_OPS

I accidentally broke this in 2eaf799e7.

9 years agoperllocale: Nits and clarifications
Karl Williamson [Tue, 4 Nov 2014 16:24:38 +0000 (09:24 -0700)]
perllocale: Nits and clarifications

9 years agolib/locale.t: Add knowledge about known bad locales
Karl Williamson [Fri, 31 Oct 2014 21:28:20 +0000 (15:28 -0600)]
lib/locale.t: Add knowledge about known bad locales

Some platforms currently have locale tests that always fail due to
platform-specific problems.  For example, we know that some Lithuanian
locales fail on Darwin because of a bad symbolic link there.

This commit adds the capability for locale.t to know about such issues
and not fail because of them.

9 years agoRaise warnings for poorly supported locales
Karl Williamson [Tue, 28 Oct 2014 03:18:45 +0000 (21:18 -0600)]
Raise warnings for poorly supported locales

Perl only supports single-byte locales (except for UTF-8 ones), and has
poor support for 7-bit locales that aren't supersets of ASCII (these
should be exceedingly rare these days).

This commit raises warnings in the new locale warning category when
such a locale is entered.

9 years agoperldiag: Remove message that is not raised
Karl Williamson [Tue, 28 Oct 2014 03:16:10 +0000 (21:16 -0600)]
perldiag: Remove message that is not raised

This message isn't raised these days.

9 years agoAdd 'locale' warning category
Karl Williamson [Tue, 28 Oct 2014 03:02:38 +0000 (21:02 -0600)]
Add 'locale' warning category

This category will be used in future commits for warnings that are
entirely because of locale issues.

9 years agofix build under -DPERL_GLOBAL_STRUCT
David Mitchell [Tue, 4 Nov 2014 16:09:48 +0000 (16:09 +0000)]
fix build under -DPERL_GLOBAL_STRUCT

broken by ddacf109924c0c8a66c97d6dedaa70047c373454

9 years agoI shouldn't think of fp formats when tired.
Jarkko Hietaniemi [Tue, 4 Nov 2014 12:07:19 +0000 (07:07 -0500)]
I shouldn't think of fp formats when tired.

Or awake, come to think of it.

9 years agoAIX noticed the broken comment and broke.
Jarkko Hietaniemi [Tue, 4 Nov 2014 11:48:25 +0000 (06:48 -0500)]
AIX noticed the broken comment and broke.

9 years agoperldelta for 7191ba826010
Tony Cook [Tue, 4 Nov 2014 04:20:44 +0000 (15:20 +1100)]
perldelta for 7191ba826010

9 years ago[perl #123103] Just set SVf_READONLY on magic vars
Father Chrysostomos [Tue, 4 Nov 2014 04:12:29 +0000 (20:12 -0800)]
[perl #123103] Just set SVf_READONLY on magic vars

a623f8939 was arguably a little too eager.  It’s purpose is to protect
vars whose modification can causes hangs and crashes.  I don’t believe
that is the case for any magic vars.

9 years ago[perl #123103] Allow ext magic on read-onlies
Father Chrysostomos [Tue, 4 Nov 2014 02:12:02 +0000 (18:12 -0800)]
[perl #123103] Allow ext magic on read-onlies

Perl cannot know whether the magic will modify the SV, so it should
give the benefit of the doubt.

9 years agoBetter handling of symlink creation
Andrew Fresh [Sat, 31 May 2014 22:37:52 +0000 (15:37 -0700)]
Better handling of symlink creation

OpenBSD heavily uses the mksymlinks define to build outside of the src
tree.  This combines two commits from OpenBSD that improve the
robustness and speed of creating the symlinks.

From r1.24 by deraadt@:
> After the MANIFEST-based symbolic link creation loop, there is a check
> for a specific link to see if things worked out.  Add a check for the very
> last file in the MANIFEST, as well, since we are trying to spot a very
> odd bug where symbolic links are not being created.  Hopefully this will
> help us diagnose it.

http://www.openbsd.org/cgi-bin/cvsweb/src/gnu/usr.bin/perl/Configure#rev1.24

And from r1.25 by millert@:
> More efficient method of building the symlink tree that makes better
> use of awk.  Slightly faster and works around an apparent namei or
> buffer cache related bug on arm.

http://www.openbsd.org/cgi-bin/cvsweb/src/gnu/usr.bin/perl/Configure#rev1.25

Re-worked by Andy Armstrong to support the old awk used by systems
such as Solaris, see [perl #122002].

9 years agomake regen
Jarkko Hietaniemi [Tue, 4 Nov 2014 02:58:53 +0000 (21:58 -0500)]
make regen

9 years agoRemove obsolete comment.
Jarkko Hietaniemi [Tue, 4 Nov 2014 02:53:10 +0000 (21:53 -0500)]
Remove obsolete comment.

9 years agoS_hextract for mixed endian doubles.
Jarkko Hietaniemi [Tue, 4 Nov 2014 02:32:19 +0000 (21:32 -0500)]
S_hextract for mixed endian doubles.

9 years agoAdd scan for ARM mixed-endian doubles.
Jarkko Hietaniemi [Tue, 4 Nov 2014 02:17:40 +0000 (21:17 -0500)]
Add scan for ARM mixed-endian doubles.

(Working in theory... no hardware.)

9 years ago8e581bbf covered up this bug.
Jarkko Hietaniemi [Tue, 4 Nov 2014 02:08:48 +0000 (21:08 -0500)]
8e581bbf covered up this bug.

9 years agoOops in bade9271.
Jarkko Hietaniemi [Tue, 4 Nov 2014 01:56:56 +0000 (20:56 -0500)]
Oops in bade9271.

9 years agoop.c: CHANGE_TYPE in Perl_ck_rvconst
Jim Cromie [Sun, 2 Nov 2014 20:33:48 +0000 (13:33 -0700)]
op.c: CHANGE_TYPE in Perl_ck_rvconst

Here, op_type and op_ppaddr inits were separated by many lines.
Move them together, then replace with CHANGE_TYPE call.

--
v2- actually remove the explicit op_ppaddr assignment.

9 years ago[Merge] Warnings for implicitly closed handles
Father Chrysostomos [Mon, 3 Nov 2014 02:23:58 +0000 (18:23 -0800)]
[Merge] Warnings for implicitly closed handles

This branch contains two notable changes:

• I/O errors now record the value of $! in the handle, and close
  restore the save value of $!, so close||die$! is more predictable
  than before.

• Implicitly closed handles now emit warnings if an I/O error has
  occurred [perl #57512].

9 years ago[perl #57512] Warnings for implicitly closed handles
Father Chrysostomos [Thu, 18 Sep 2014 05:16:58 +0000 (21:16 -0800)]
[perl #57512] Warnings for implicitly closed handles

If the implicit close() fails, warn about it, mentioning $! in the
message.  This is a default warning in the io category.

We do this in two spots, sv_clear and gp_free.  While sv_clear would
be sufficient to get the warning emitted, the warning won’t contain
the name of the handle when called from there, because lone IO thing-
ies are nameless.  Doing it also when a GV’s glob pointer is freed--as
long as the IO thingy in there has a reference count of 1--allows the
name to be included in the message, because we still have the glob,
which is where the name is stored.

The result:

$ ./miniperl -Ilib -e 'open fh, ">/Volumes/Disk Image/foo"; print fh "x"x1000, "\n" for 1..50; undef *fh'
Warning: unable to close filehandle fh properly: No space left on device at -e line 1.

9 years agoHave close() set $! and $^E
Father Chrysostomos [Thu, 18 Sep 2014 04:42:52 +0000 (21:42 -0700)]
Have close() set $! and $^E

This is what we used to get when close reported an error after a print
failure (‘Disk Image’ is a small disk image I made):

$ ./miniperl -Ilib -e 'open fh, ">/Volumes/Disk Image/foo"; print fh "x"x1000, "\n" for 1..50; unlink "ntoeuhnteo"; warn $!; close fh or die "error closing: $!"'
No such file or directory at -e line 1.
error closing: No such file or directory at -e line 1.

Notice how the value of $! as set by unlink is still present after
close fails.  So that means after close returns false, you can’t
depend on $! to have the reason for the failure, because it might come
from an unrelated system call.  Remove the ‘unlink’ statement and you
get ‘No space left on device’.

As of this commit, the output is more helpful:

$ ./miniperl -Ilib -e 'open fh, ">/Volumes/Disk Image/foo"; print fh "x"x1000, "\n" for 1..50; unlink "ntoeuhnteo"; warn $!; close fh or die "error closing: $!"'
No such file or directory at -e line 1.
error closing: No space left on device at -e line 1.

Three commits ago, I/O errors started recording the error number in
the handle itself.  Now ‘close’ restores $! and $^E to the values they
were when the I/O error associated with the closed handle occurred.

This is related to ticket #57512.

9 years agoIncrease $PerlIO::encoding::VERSION to 0.20
Father Chrysostomos [Thu, 18 Sep 2014 00:55:23 +0000 (17:55 -0700)]
Increase $PerlIO::encoding::VERSION to 0.20

9 years agoIncrease $PerlIO::scalar::VERSION to 0.20
Father Chrysostomos [Thu, 18 Sep 2014 00:55:10 +0000 (17:55 -0700)]
Increase $PerlIO::scalar::VERSION to 0.20

9 years agoRecord errno value in IO handles
Father Chrysostomos [Wed, 17 Sep 2014 01:14:34 +0000 (18:14 -0700)]
Record errno value in IO handles

9 years agoperliol.pod: Correct flags type in _PerlIO struct
Father Chrysostomos [Wed, 17 Sep 2014 00:58:50 +0000 (17:58 -0700)]
perliol.pod: Correct flags type in _PerlIO struct

This is not the only change that was not reflected in the docs.  There
is also a PerlIOl *head member, but I don’t know whether this should
be considered public and documented.

9 years agoop.c: use CHANGE_TYPE in S_alloc_LOGOP
Jim Cromie [Sun, 2 Nov 2014 21:00:50 +0000 (14:00 -0700)]
op.c: use CHANGE_TYPE in S_alloc_LOGOP

S_alloc_LOGOP inits the op_type field, but not op_ppaddr.
It has 8 uses, all of which are immediately followed by
o->op_ppaddr = PL_ppaddr[type].

So CHANGE_TYPE()s postcondition pertains, lets say so.

9 years agoend the pp_mapstart trickery
Jim Cromie [Sun, 2 Nov 2014 21:00:47 +0000 (14:00 -0700)]
end the pp_mapstart trickery

Current codebase wires Perl_pp_mapstart to Perl_unimplemented_op (by
regen/opcode.pl) [1], but then avoids runtime panics by Perl_ck_grep
changing all OP_MAPSTART nodes to use PL_ppaddr[OP_GREPSTART] [2].

This is all too clever by half, so this patch undoes the trickery, and
treats these 2 OPS like 93bad3fd5548 did for OP_AELEMFAST and \1_LEX.

I cant glean a reason for this historical arrangement:
Looking at regen/opcode.pl blamelog..

65bca31a68 added Perl_unimplemented_op() used by 3 'unreachable' ops,
and replaced a 'panic: mapstart' diag with a common one, so the trick
goes further back.

c78ff9799bf moved a minimal/DIEing pp_mapstart implementation to
mathoms.c from pp_ctl.c.  Perl_ck_grep also did the GREPSTART patching
back then.

f54cb97a39f did minor tweaks to a full pp_mapstart implementation.  I
couldnt find the commit between it and c78ff that changed pp_mapstart
to a DIEing one, or I fat-fingered it, or I got distracted.

looking at ck-grep(), the code doing [2] is from 22c35a8c23 in 1998.

So anyway, I tried the following, it worked, it seems the historical
reason is no longer relevant.

[1] change regen/opcode.pl generated mapping
   -#define Perl_pp_mapstart Perl_unimplemented_op
   +#define Perl_pp_mapstart Perl_pp_grepstart

   this sets PL_ppaddr[OP_MAPSTART] = PL_ppaddr[OP_GREPSTART] during
   init, which makes the optype trickery in ck_grep[2] unneeded.

[2] Drop re-type-ing of MAPSTARTs as GREPSTARTs by Perl_ck_grep(OP* o)
   Given 1, mapstart & grepstart share code, so just leave optype alone.

9 years agoop.c: use CHANGE_TYPE everywhere its obvious
Jim Cromie [Sun, 2 Nov 2014 21:00:46 +0000 (14:00 -0700)]
op.c: use CHANGE_TYPE everywhere its obvious

CHANGE_TYPE has been around for 4 years, since 23a8159b759.  Use it to
encapsulate "standard" opcode setting, where the postcondition:
o->op_ppaddr == PL_ppaddr[o->op_type] holds.  This leaves only a
handful of op_type, op_ppaddr refs where the invariant is not true.

9 years agoperldelta for 7eb3f2cf1bb0
Tony Cook [Mon, 3 Nov 2014 00:57:13 +0000 (11:57 +1100)]
perldelta for 7eb3f2cf1bb0

9 years agoGlenn D. Golden is now a perl AUTHOR
Tony Cook [Mon, 3 Nov 2014 00:39:57 +0000 (11:39 +1100)]
Glenn D. Golden is now a perl AUTHOR

9 years agobump $IO::Socket::VERSION to 1.38
Tony Cook [Mon, 3 Nov 2014 00:39:42 +0000 (11:39 +1100)]
bump $IO::Socket::VERSION to 1.38

9 years agoImprove connected() doc
Glenn D. Golden [Tue, 28 Oct 2014 10:24:04 +0000 (04:24 -0600)]
Improve connected() doc

9 years agoAdd a note about the buffer wastage of double-doubles.
Jarkko Hietaniemi [Sun, 2 Nov 2014 23:58:02 +0000 (18:58 -0500)]
Add a note about the buffer wastage of double-doubles.

9 years agoUse DOUBLEKIND in S_hextract() setup.
Jarkko Hietaniemi [Sun, 2 Nov 2014 23:15:21 +0000 (18:15 -0500)]
Use DOUBLEKIND in S_hextract() setup.

9 years agoIn tests, 'use strict' etc after the @INC manipulation.
Jarkko Hietaniemi [Sun, 2 Nov 2014 16:28:54 +0000 (11:28 -0500)]
In tests, 'use strict' etc after the @INC manipulation.

9 years agoForce LONG_DOUBLEKIND always to be probed for.
Jarkko Hietaniemi [Sun, 2 Nov 2014 18:51:48 +0000 (13:51 -0500)]
Force LONG_DOUBLEKIND always to be probed for.