platform/upstream/perl.git
13 years agoFurther tests for POSIX trigonometric and hyperbolic functions.
Nicholas Clark [Thu, 8 Sep 2011 14:08:16 +0000 (16:08 +0200)]
Further tests for POSIX trigonometric and hyperbolic functions.

13 years agoChange POSIX::localeconv() to a table-driven implementation.
Nicholas Clark [Thu, 8 Sep 2011 13:28:04 +0000 (15:28 +0200)]
Change POSIX::localeconv() to a table-driven implementation.

This removes a lot of copy-paste code.

[with a tweak by Ilmari that removed residual duplication]

13 years agoAdd tests for POSIX::localeconv().
Nicholas Clark [Thu, 8 Sep 2011 12:37:09 +0000 (14:37 +0200)]
Add tests for POSIX::localeconv().

13 years agoMerge the implementations of 2 sets of POSIX functions.
Nicholas Clark [Thu, 8 Sep 2011 11:05:05 +0000 (13:05 +0200)]
Merge the implementations of 2 sets of POSIX functions.

Using ALIAS to merge POSIX::sig{pending,suspend} and
POSIX::tc{flow,flush,sendbreak} reduces the size of POSIX.so by about 2K
on this platform.

13 years agoMerge the implementations of 4 sets of POSIX::Termios methods.
Nicholas Clark [Thu, 8 Sep 2011 10:41:10 +0000 (12:41 +0200)]
Merge the implementations of 4 sets of POSIX::Termios methods.

Using ALIAS to merge cfget[io]speed(), get[cloi]flag(), cfset[io]speed()
and set[cloi]flag() reduces the size of POSIX.so by almost 2K on this
platform.

13 years agoMerge the implementations of 2 pairs of POSIX::SigSet methods.
Nicholas Clark [Thu, 8 Sep 2011 10:05:06 +0000 (12:05 +0200)]
Merge the implementations of 2 pairs of POSIX::SigSet methods.

Using ALIAS to merge addset() with delset() and emptyset() with fillset()
reduces the shared object size, by removing duplicate marshaling code for
arguments and return values. On this platform the saving is over .5K

13 years agoAdd tests for POSIX::sigpending().
Nicholas Clark [Thu, 8 Sep 2011 08:11:55 +0000 (10:11 +0200)]
Add tests for POSIX::sigpending().

13 years agoStore sigset_t used by POSIX::SigSet directly in the object SV.
Nicholas Clark [Wed, 7 Sep 2011 16:52:36 +0000 (18:52 +0200)]
Store sigset_t used by POSIX::SigSet directly in the object SV.

Previously POSIX::SigSet was using the PTROBJ typemap to store a pointer to
a dynamically-allocated sigset_t as an IV (blessed into the class)
This requires an explicit DESTROY to free the dynamic allocation, but fails
badly if any POSIX::SigSet objects exist at ithread clone time, as the
dynamic allocation is not duplicated in the new thread. (DESTROY is called
in both threads, free-from-wrong pool or other jollity occurs.)

Removing dynamic allocation removes the need for a DESTROY method.

This change is analogous to the previous change in POSIX::Termios, and is
made for the same reason.

13 years agoIn POSIX.xs, extract allocate_struct() from POSIX::Termios::new().
Nicholas Clark [Wed, 7 Sep 2011 14:57:03 +0000 (16:57 +0200)]
In POSIX.xs, extract allocate_struct() from POSIX::Termios::new().

The same code will be needed for POSIX::SigSet::new(), so share it as a small
static function.

13 years agoAdd tests for POSIX::SigSet.
Nicholas Clark [Wed, 7 Sep 2011 14:22:33 +0000 (16:22 +0200)]
Add tests for POSIX::SigSet.

13 years agoStore struct termios used by POSIX::Termios directly in the object SV.
Nicholas Clark [Wed, 7 Sep 2011 11:15:04 +0000 (13:15 +0200)]
Store struct termios used by POSIX::Termios directly in the object SV.

Previously POSIX::Termios was using the PTROBJ typemap to store a pointer to
a dynamically-allocated struct termios as an IV (blessed into the class).
This requires an explicit DESTROY to free the dynamic allocation, but fails
badly if any POSIX::Termios objects exist at ithread clone time, as the
dynamic allocation is not duplicated in the new thread. (DESTROY is called
in both threads, free-from-wrong pool or other jollity occurs.)

Removing dynamic allocation removes the need for a DESTROY method.

This introduces a new OPAQUEPTROBJ typemap, but currently doesn't use the
OUTPUT section, as that copies an existing structure, whereas
POSIX::Termios->new() only needs to zero-allocate the right space. Assuming
that this typemap should be of general applicability, it should be moved to
the main typemap file.

13 years agoAdd tests for POSIX::tc{drain,flow,flush,sendbreak}()
Nicholas Clark [Tue, 6 Sep 2011 20:22:36 +0000 (22:22 +0200)]
Add tests for POSIX::tc{drain,flow,flush,sendbreak}()

We don't want to mess with the user's terminal (as we might mess it up), so
attempt to call each function on a disk file, and verify that it fails with
ENOTTY.

13 years agoAdd tests for POSIX::Termios->setattr().
Nicholas Clark [Tue, 6 Sep 2011 20:11:49 +0000 (22:11 +0200)]
Add tests for POSIX::Termios->setattr().

We don't want to mess with the user's terminal (as we might mess it up), so
attempt to call tcsetattr() on a disk file, and verify that it fails with
ENOTTY.

13 years agoAdd tests for POSIX::Termios->setcc().
Nicholas Clark [Tue, 6 Sep 2011 19:58:09 +0000 (21:58 +0200)]
Add tests for POSIX::Termios->setcc().

13 years agoAdd tests for POSIX::Termios->get[iocf]flags().
Nicholas Clark [Tue, 6 Sep 2011 17:37:35 +0000 (19:37 +0200)]
Add tests for POSIX::Termios->get[iocf]flags().

13 years agoAdd tests for POSIX::Termios->get[io]speed().
Nicholas Clark [Tue, 6 Sep 2011 16:38:21 +0000 (18:38 +0200)]
Add tests for POSIX::Termios->get[io]speed().

13 years agoAdd tests for passing POSIX::Termios->getcc() out of range subscripts.
Nicholas Clark [Tue, 6 Sep 2011 12:23:53 +0000 (14:23 +0200)]
Add tests for passing POSIX::Termios->getcc() out of range subscripts.

13 years agoIn termios.t, avoid reading uninitialised memory in the tests.
Nicholas Clark [Tue, 6 Sep 2011 12:12:22 +0000 (14:12 +0200)]
In termios.t, avoid reading uninitialised memory in the tests.

If no terminal devices are found, or getattr() fails on all of them, then
the struct termios wrapped by the POSIX:Termios object will consist of
initialised memory. In this case, it's not possible to use getcc() or the
other get*() methods on it.

Try harder to find a terminal device - as well as STDIN, STDOUT and STDERR
also try to open the controlling terminal directly.

13 years agoRefactor ext/POSIX/t/termios.t
Nicholas Clark [Tue, 6 Sep 2011 11:36:07 +0000 (13:36 +0200)]
Refactor ext/POSIX/t/termios.t

* Only import termios.h functions and constants from POSIX
* Loop over STDIN, STDOUT, STDERR instead of duplicating code.
* Avoid a needless defined? test, as isa_ok() handles undef.
* Switch to done_testing(), which also allows @getters to be inlined and
  eliminated.
* The various get*() methods return integer values, so check this.
* Enable warnings.

13 years agoRemove if(isGV_with_GP(PL_defoutgv)) checks from mg.c
Father Chrysostomos [Tue, 13 Sep 2011 06:31:18 +0000 (23:31 -0700)]
Remove if(isGV_with_GP(PL_defoutgv)) checks from mg.c

Commit 099be4f1d added code to cope with this:

    my $x = *STDERR; select($x); $x = 1;

which would cause PL_defoutgv to hold something other than a GV,
resulting in various crashes.

Commit 2acc3314 changed the way rv2gv works on fake globs, and inad-
vertently fixed this problem, too, so PL_defoutgv can no longer end up
holding something other than a GV.

So the code that checks if(isGV_with_GP(PL_defoutgv)) can go.

13 years agoFix misspellings in gv.t
Father Chrysostomos [Tue, 13 Sep 2011 06:01:52 +0000 (23:01 -0700)]
Fix misspellings in gv.t

13 years agoMake \&$tied call get-magic when it holds a glob
Father Chrysostomos [Tue, 13 Sep 2011 05:42:54 +0000 (22:42 -0700)]
Make \&$tied call get-magic when it holds a glob

This is a follow-up to ff55a0191f1, but this bug has probably existed
as long as ties.

\&$tied_scalar was ignoring get-magic on $tied if it happened to
hold a glob.

13 years agoAdd diag_listed_as for lstat error msg
Father Chrysostomos [Tue, 13 Sep 2011 05:28:55 +0000 (22:28 -0700)]
Add diag_listed_as for lstat error msg

to let porting/diag.t know how it’s listed in perldiag.

13 years agoMake (l)stat respect get-magic on globs and globrefs
Father Chrysostomos [Tue, 13 Sep 2011 03:41:07 +0000 (20:41 -0700)]
Make (l)stat respect get-magic on globs and globrefs

They were ignoring get-magic for those.

A side effect of this fix is that lstat filehandle warnings and errors
are now consistent:

lstat _ used to die if the previous stat was not an lstat, but
lstat *_ and lstat \*_ would happily return what was in the buffer.
Now they die.

lstat FH and \*FH used to warn, but not lstat *FH.  Now it does.

See bug #98864.

13 years agoUpdate CPAN-Meta-YAML to CPAN version 0.004
Chris 'BinGOs' Williams [Mon, 12 Sep 2011 18:44:07 +0000 (19:44 +0100)]
Update CPAN-Meta-YAML to CPAN version 0.004

  [DELTA]

  0.004     2011-09-06 09:42:52 America/New_York

    - Generated from ADAMK/YAML-Tiny-1.50.tar.gz

13 years agoUpdate Exporter to CPAN version 5.65
Chris 'BinGOs' Williams [Mon, 12 Sep 2011 18:19:35 +0000 (19:19 +0100)]
Update Exporter to CPAN version 5.65

  [DELTA]

  5.65 Tue Aug 30 2011 Todd Rinaldo
        - No changes. Tests clean. Bumping to production release.

  5.64_04 Wed Aug 24 2011 Todd Rinaldo
        - Re-vamp module to work in Git.
        - Update Makefile.PL with extra META bits.
        - Point bugs to perl's RT.
        - Add a README from Exporter.pm perldoc.
        - Depend on Carp 1.05 now we're assuming a fix from 1.05

13 years agoUpdate perlfaq to CPAN version 5.0150034
Chris 'BinGOs' Williams [Mon, 12 Sep 2011 17:57:18 +0000 (18:57 +0100)]
Update perlfaq to CPAN version 5.0150034

  [DELTA]

  5.0150034 Mon 12 Sep 2011 18:41:25 +0100
    * Copy edit Perl 6 a bit more (ranguard)
    * Add blog section (ranguard)
    * Update much of the copy about emails in perlfaq9 (apeiron)
    * Many small changes (bigpresh)
    * Add descriptions to doc list (bigpresh)
    * Start moving away from global file handles (shlomif)
    * Typos, clarity and other cleanups (shlomif)
    * Cleanup copy (ranguard)
    * Start to add "my" to variables (shlomif)
    * Remove verbose/history copy (ranguard)
    * Switch to L<> around URLs (ranguard)

13 years agoMake tie_fetch_count.t pass on ‘broken’ platforms
Father Chrysostomos [Mon, 12 Sep 2011 13:28:09 +0000 (06:28 -0700)]
Make tie_fetch_count.t pass on ‘broken’ platforms

by which I mean platforms on which some -X $file ops don’t work.

13 years agot/TEST: clean up cachegrind.out.$pid intermediate files
Jim Cromie [Mon, 12 Sep 2011 05:32:50 +0000 (23:32 -0600)]
t/TEST: clean up cachegrind.out.$pid intermediate files

running cachegrind leaves lots of intermediate files, delete them at
the end.  Killing make test leaves them around, but this may be useful
for some debugging purposes.

Rework _find_tests($dir) into _find_files($patt,$dir) and wrapper,
to support existing uses and new one.

13 years agoadd 3 test.valgrind outputs to .gitignore
Jim Cromie [Sun, 11 Sep 2011 01:16:18 +0000 (19:16 -0600)]
add 3 test.valgrind outputs to .gitignore

13 years agoUpdate CPAN tracking version of ExtUtils::ParseXS
Steffen Mueller [Mon, 12 Sep 2011 06:26:52 +0000 (08:26 +0200)]
Update CPAN tracking version of ExtUtils::ParseXS

13 years agoperldelta galore for ExtUtils::ParseXS changes
Steffen Mueller [Mon, 12 Sep 2011 06:25:31 +0000 (08:25 +0200)]
perldelta galore for ExtUtils::ParseXS changes

This also rephrases the "XSUBs are now static" section since the
exact behaviour has changed since 5.15.2.

13 years agoExtUtils::ParseXS changelog
Steffen Mueller [Mon, 12 Sep 2011 06:25:04 +0000 (08:25 +0200)]
ExtUtils::ParseXS changelog

13 years agoMake cpan officially upstream for Text::Balanced
Father Chrysostomos [Mon, 12 Sep 2011 03:00:18 +0000 (20:00 -0700)]
Make cpan officially upstream for Text::Balanced

13 years agoMake truncate respect get-magic on globs and globrefs
Father Chrysostomos [Sun, 11 Sep 2011 05:49:12 +0000 (22:49 -0700)]
Make truncate respect get-magic on globs and globrefs

It was ignoring get-magic for those.

13 years agoUpdate Devel-PPPort to CPAN version 3.20
Chris 'BinGOs' Williams [Sun, 11 Sep 2011 21:23:46 +0000 (22:23 +0100)]
Update Devel-PPPort to CPAN version 3.20

  [DELTA]

  3.20 - 2011-09-10

    * fix CPAN #56749: isASCII and isCNTRL macros are buggy
      (thanks to Karl Williamson for providing a patch and patiently
       waiting almost two years for me to integrate it)
    * fix CPAN #70427: RealPPPort.xs:1587: error: lvalue required as unary â€˜&’ operand

  3.19_03 - 2011-04-13

    * keep up with latest core changes

  3.19_02 - 2010-03-07

    * fix a warning emitted by the test suite with older perls
    * added support for the following API
        newSVpvs_share
        get_cvn_flags
        get_cvs
      (thanks to Goro Fuji for providing a patch to
      implement all of these, fixes CPAN #47174)

  3.19_01 - 2010-02-20

    * fix CPAN #50763: mistaken use of $[
      (thanks to Zefram for spotting this)
    * remove spurious PUSHMARK from Perl_ppaddr_t
      (thanks to Gerard Goossen for providing a patch)
    * improved support for newer compilers in buildperl.pl
      (thanks to Philippe Bruhat (BooK) for providing a patch)
    * added support for the following API
        memEQs
        memNEs
    * lots of small toolchain updates

13 years agoAdd links to Windows documentation of shell and CRT quote parsing rules
Steve Hay [Sun, 11 Sep 2011 22:01:57 +0000 (23:01 +0100)]
Add links to Windows documentation of shell and CRT quote parsing rules

13 years agoRemove Windows 95 support from win32/makefile.mk
Steve Hay [Sun, 11 Sep 2011 18:50:33 +0000 (19:50 +0100)]
Remove Windows 95 support from win32/makefile.mk

All supporting code for Windows 95 was already removed in 8cbe99e5b6.

13 years agoEliminate warnings from XSLoader on 5.005 and 5.004.
Nicholas Clark [Sat, 10 Sep 2011 15:10:55 +0000 (17:10 +0200)]
Eliminate warnings from XSLoader on 5.005 and 5.004.

Don't pass parameters that old ExtUtil::MakeMaker doesn't understand.
Ensure that $DynaLoader::dl_debug exists prior to calling into DynaLoader's
XS code.

13 years agoupdated podcheck data file to know about the changes from Leon's patch
Jesse Vincent [Sun, 11 Sep 2011 17:10:01 +0000 (13:10 -0400)]
updated podcheck data file to know about the changes from Leon's patch

13 years agoDoc patch to perlipc
Leon Timmermans [Sun, 11 Sep 2011 16:09:52 +0000 (12:09 -0400)]
Doc patch to perlipc

1. I've removed some erroneous code regarding signal names (it doesn't
handle signal aliases) with a reference to a module that does handle
it correctly.
2. Removed the sample on temporary signal ignoring; this is not likely
to do what users want it to do. Possibly this should be replaced by a
discussion on sigprocmask & friends, but perhaps we can skip in
altogether
3. Corrected the discussion on permissions to take the difference
between real, effective and saved UIDs into account.
4. Removed all mention of the SysV signaling issue. This was rather
relevant when perlipc was written 15 years ago but it isn't anymore
nowadays.
5. Removed the suggestion that you can longjmp out of a signal handler
(see CERT's SIG32-C).

13 years agoAdd missing win32/config_H.* files to Porting/makerel
Steve Hay [Sun, 11 Sep 2011 16:02:53 +0000 (17:02 +0100)]
Add missing win32/config_H.* files to Porting/makerel

Most Win32 shell environments take no notice of these permissions
anyway, but this seems like a safer option than removing them all.

13 years agoSimplify generated XS code by emitting a compatibility version of dVAR.
Nicholas Clark [Sat, 10 Sep 2011 11:11:21 +0000 (13:11 +0200)]
Simplify generated XS code by emitting a compatibility version of dVAR.

If ExtUtils::ParseXS emits conditional C pre-processor code once per XS file
to provide a default for dVAR, then it doesn't need to emit 4 lines per
function to cater for dVAR not being present.

13 years agoTeach B::Concise about OPpFT_STACKING
Father Chrysostomos [Sun, 11 Sep 2011 05:26:29 +0000 (22:26 -0700)]
Teach B::Concise about OPpFT_STACKING

13 years agoCollapse repetititive code in tie_fetch_count.t
Father Chrysostomos [Sun, 11 Sep 2011 05:10:19 +0000 (22:10 -0700)]
Collapse repetititive code in tie_fetch_count.t

13 years agoMake utime handle get-magic correctly for glob(ref)s
Father Chrysostomos [Sun, 11 Sep 2011 05:03:32 +0000 (22:03 -0700)]
Make utime handle get-magic correctly for glob(ref)s

It used to ignore get-magic for globs and globrefs.

13 years agoStop filetest ops from calling FETCH on parent op’s arg
Father Chrysostomos [Sun, 11 Sep 2011 02:47:59 +0000 (19:47 -0700)]
Stop filetest ops from calling FETCH on parent op’s arg

This is a regression in 5.14.0.

Commit 6f1401dc made ops call get-magic before overloading, but it
ended up making filetest ops call get-magic on the topmost item of the
stack even if the filetest op was not going to use the stack (which
happens for ‘-r bareword’ and plain ‘-r’).

This would affect cases like:

  push @foo, $tied, -r;

13 years agoMake filetest ops handle get-magic correctly for glob(ref)s
Father Chrysostomos [Sun, 11 Sep 2011 01:39:12 +0000 (18:39 -0700)]
Make filetest ops handle get-magic correctly for glob(ref)s

This patch uses the recently-added MAYBE_DEREF_GV macro which puts the
glob deref logic in one spot.  It also adds _nomg and _flags varia-
tions of it.  _flags understands the SV_GMAGIC flag.

13 years agoRestore changelog entry removed by 378eeda
Father Chrysostomos [Sat, 10 Sep 2011 21:08:25 +0000 (14:08 -0700)]
Restore changelog entry removed by 378eeda

Existence of this entry has nothing to do with Borland support. It
is merely history, that’s all.

13 years ago-l followed by bareword should leave the stack alone
Father Chrysostomos [Sat, 10 Sep 2011 21:02:45 +0000 (14:02 -0700)]
-l followed by bareword should leave the stack alone

$ ln -s /usr/bin/perl bar
$ perl -le' print "bar", -l foo'
1

The -l ate my bar.

It’s this naughty piece of code in doio.c:Perl_my_lstat_flags that is
the culprit:

  if (ckWARN(WARN_IO)) {
      Perl_warner(aTHX_ packWARN(WARN_IO), "Use of -l on filehandle %s",
      GvENAME(cGVOP_gv));
      return (PL_laststatval = -1);
  }

When -l is followed by a bareward, it has no argument on the stack,
but the filetest op itself is a gvop.  That snippet is from the bare-
word-handling code.

So, if warnings are off, it falls through to the argument-on-the-stack
code and pops off something does not belong to it (that belong to the
print, in the example above).

13 years agoUpdate Archive-Tar to CPAN version 1.78
Chris 'BinGOs' Williams [Sat, 10 Sep 2011 20:18:14 +0000 (21:18 +0100)]
Update Archive-Tar to CPAN version 1.78

  [DELTA]

  * important changes in version 1.78 08/09/2011
  - patch from Rocky Bernstein to add chown() method [rt#70623]
  - blead patch from Alexandr Ciornii to resolve [perl#78708]

13 years agoDon’t call get-magic on a referenced array in chdir, etc.
Father Chrysostomos [Sat, 10 Sep 2011 17:01:00 +0000 (10:01 -0700)]
Don’t call get-magic on a referenced array in chdir, etc.

Commit 557fbd17eb added the MAYBE_DEREF_GV macro, which 2ea1cce
applied to chdir, chmod and chown.

That macro calls get-magic on its arguments checks to see if it might
be a gv or ref and, if it’s a ref, calls get-magic on the referent,
to see whether it will turn into a gv.  That means we’ll end up with
chdir($array_obj) calling get-magic on the array.  While probably
harmless, calling get-magic is superfluous and probably incorrect.  I
don’t know that there is a reasonable way to test this.

13 years agoAnother update to comments about regen_config_h target
Steve Hay [Sat, 10 Sep 2011 20:02:58 +0000 (21:02 +0100)]
Another update to comments about regen_config_h target

(Support for gc64nox was added to the vc64 configurations by commit
925798f29c, and the gc64 and gc64nox files were not mentioned at all)

13 years agoUpdate comments about regen_config_h target
Steve Hay [Sat, 10 Sep 2011 19:52:49 +0000 (20:52 +0100)]
Update comments about regen_config_h target

(Support for disabling HAS_CRYPT via Makefile options was removed
by commit 9cef830622, so building with a "minimal configuration" no
longer involves switching that option off.)

13 years agoFix MSWin32 skip in porting/globvar.t
Steve Hay [Sat, 10 Sep 2011 19:46:00 +0000 (20:46 +0100)]
Fix MSWin32 skip in porting/globvar.t

(With VC it skipped anyway due to 'nm' not being available, but with GCC
it ran further and crashed out on the open '-|' call.)

13 years agoThe Borland Chainsaw Massacre
Steve Hay [Sat, 10 Sep 2011 16:21:58 +0000 (17:21 +0100)]
The Borland Chainsaw Massacre

Remove support for the Borland C++ compiler on Win32, as agreed here:
http://www.xray.mpe.mpg.de/mailing-lists/perl5-porters/2011-09/msg00034.html

13 years agoAdd plain ~ expansion for Windows system in File::Glob
Douglas Christopher Wilson [Sat, 10 Sep 2011 16:44:18 +0000 (09:44 -0700)]
Add plain ~ expansion for Windows system in File::Glob

Previously in File::Glob, a plain ~ expansion will check
the $HOME environment variable, but that does not normally
exist on Windows systems. There is another variable that
holds the appropriate home path value, which is $USERPROFILE.

This adds a fallback to check $USERPROFILE when $HOME is
not there, the system does not support checking the password
file and the system is DOSISH.

13 years agoAdd Douglas Christopher Wilson to AUTHORS
Father Chrysostomos [Sat, 10 Sep 2011 06:35:49 +0000 (23:35 -0700)]
Add Douglas Christopher Wilson to AUTHORS

13 years agoch(dir|mod|own) should also call FETCH on refs to tied globs
Father Chrysostomos [Sat, 10 Sep 2011 13:17:53 +0000 (06:17 -0700)]
ch(dir|mod|own) should also call FETCH on refs to tied globs

Following on from commit 935647290357b277, which corrected the beha-
viour for tied globs, this commit corrects the behaviour for refer-
ences to tied globs.

(With tests by Nicholas Clark.)

13 years agoAdd MAYBE_DEREF_GV macro
Father Chrysostomos [Sat, 10 Sep 2011 13:09:26 +0000 (06:09 -0700)]
Add MAYBE_DEREF_GV macro

There are so many parts of the core (mostly pp functions or functions
they call) that need a glob or a globref, including many that call
get-magic at the wrong time (or not at all in some cases, that it
makes sense to add a macro to do it.

It can be used like this:

   if (gv = MAYBE_DEREF_GV(sv)) /* calls get-magic */
   {

   }
   else { /* avoid magic here */

   }

13 years agoTweaks to tie_fetch_count.t
Nicholas Clark [Sat, 10 Sep 2011 13:08:21 +0000 (06:08 -0700)]
Tweaks to tie_fetch_count.t

Improve error diagnostics by reporting the caller's line number if
check_count() fails, and correct a thinko in a test description.

13 years ago"state" in perlfunc should point to "Persistent Private Variables"
Vincent Pit [Sat, 10 Sep 2011 13:20:55 +0000 (15:20 +0200)]
"state" in perlfunc should point to "Persistent Private Variables"

13 years agoAdd HOMEGROWN_POSIX_SIGNALS to PL_non_bincompat_options, and hence -V output.
Nicholas Clark [Thu, 8 Sep 2011 08:35:48 +0000 (10:35 +0200)]
Add HOMEGROWN_POSIX_SIGNALS to PL_non_bincompat_options, and hence -V output.

HOMEGROWN_POSIX_SIGNALS is only relevant on VMS.

13 years agoregen/opcode.pl: generate OP_IS_DIRHOP, use in gv.c
Jim Cromie [Thu, 2 Jun 2011 06:27:49 +0000 (00:27 -0600)]
regen/opcode.pl: generate OP_IS_DIRHOP, use in gv.c

Generate OP_IS_DIRHOP like other OP_IS_* macros,
use in gv.c:Perl_gv_add_by_type().
Modifies 'F' operand type to 'DF'.
This yields a micro-optimization.

13 years agoimplement OP_IS_NUMCOMPARE like other OP_IS macros
Jim Cromie [Mon, 18 Apr 2011 20:05:35 +0000 (14:05 -0600)]
implement OP_IS_NUMCOMPARE like other OP_IS macros

other macros are written by regen/opcode.pl into opnames.h
Generate OP_IS_NUMCOMPARE the same way, and get a micro-optimization.
Adds a new 'S<' operand type for the numeric comparison ops.
Needs make regen.

13 years ago[perl #92436] Filter::Simple can’t find end of POD
Father Chrysostomos [Sat, 10 Sep 2011 06:21:48 +0000 (23:21 -0700)]
[perl #92436] Filter::Simple can’t find end of POD

Filter::Simple’s $pod_or_DATA regexp was mistakenly written to look
for =end if the pod section began with =begin, and to look for the
end of the paragraph if the pod began with =for.  Only =cut and EOF
can end pod.

This patch does not fix Filter::Simple’s naïve way of finding the
beginning of pod.

13 years agoFixed repeated words
Walt Mankowski [Sat, 10 Sep 2011 04:00:31 +0000 (00:00 -0400)]
Fixed repeated words

13 years agoadjust TEST's valgrind invocation to also work with linux's perf stat
Jim Cromie [Sat, 10 Sep 2011 03:18:45 +0000 (20:18 -0700)]
adjust TEST's valgrind invocation to also work with linux's perf stat

Move --log-fd=3 option from unconditional invocation into VG_OPTS
default value.  A future version of perf will understand --log-fd=3,
but other tools probably will not, with this we can accommodate them,
and the current version of perf.

Makefile.SH:

Set VALGRIND var conditionally, to allow cmdline override (this is
probably non-portable, will need review at least).

perl.valgrind.config target's test of $(VALGRIND) is simplified to use
$(VG_TEST), which defaults to its legacy value: ./perl -e 1
2>/dev/null.  Setting it to '--help' is needed for perf, and would
also work to verify that valgrind is runnable, but current test is
slightly more comprehensive for valgrind, so Ive left that for user to
change in the environment.

t/TEST:

1. --log-fd=3 is in default, but can be overridden by setting VG_OPTS
2. several variable renames to clarify purpose
3. $toolnm to rename output file with flexible suffix,
    ie: valgrind, cachegrind, perf-stat
4. add perf to cachegrind as a special case, avoid culling of valgrind
   output files by their content

With above, and following env, make test.valgrind works:

  # --log-fd isnt mainline yet.
  VALGRIND=/home/jimc/projects/lx/linux-2.6/tools/perf/perf
  VG_TEST=--help
  VG_OPTS='stat --log-fd=3 -- '

$> make test.valgrind;
PERL_VALGRIND=1 VALGRIND='/home/jimc/projects/lx/linux-2.6/tools/perf/perf'  ./runtests choose
t/base/cond....................................................ok
t/base/if......................................................ok
t/base/lex.....................................................ok
...

[jimc@groucho perl]$ cat t/base/*.perf-stat

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

          5.882071 task-clock                #    0.850 CPUs utilized
                 1 context-switches          #    0.000 M/sec
                 1 CPU-migrations            #    0.000 M/sec
               483 page-faults               #    0.082 M/sec
         4,688,843 cycles                    #    0.797 GHz
   <not supported> stalled-cycles-frontend
   <not supported> stalled-cycles-backend
         3,368,118 instructions              #    0.72  insns per cycle
           718,821 branches                  #  122.205 M/sec
            48,053 branch-misses             #    6.68% of all branches

       0.006920536 seconds time elapsed

This patch will allow you to use released version of perf,
just drop the --log-fd from VG_OPTS.  The tests will fail,
because perf will write to STDOUT, and foul the harness.

The following runs cachegrind, creates t/*/*.cachegrind files.
It is much slower than using perf-stat.

$> export VG_OPTS='--tool=cachegrind --log-fd=3 -- '
$> make test.valgrind

==25822== Cachegrind, a cache and branch-prediction profiler
==25822== Copyright (C) 2002-2009, and GNU GPL'd, by Nicholas Nethercote et al.
==25822== Using Valgrind-3.5.0 and LibVEX; rerun with -h for copyright info
==25822== Command: ./perl base/cond.t
==25822==
==25822==
==25822== I   refs:      1,680,072
==25822== I1  misses:        8,129
==25822== L2i misses:        3,675
==25822== I1  miss rate:      0.48%
==25822== L2i miss rate:      0.21%
==25822==
==25822== D   refs:        604,393  (400,033 rd   + 204,360 wr)
==25822== D1  misses:       12,599  (  8,838 rd   +   3,761 wr)
==25822== L2d misses:        6,261  (  2,966 rd   +   3,295 wr)
==25822== D1  miss rate:       2.0% (    2.2%     +     1.8%  )
==25822== L2d miss rate:       1.0% (    0.7%     +     1.6%  )
==25822==
==25822== L2 refs:          20,728  ( 16,967 rd   +   3,761 wr)
==25822== L2 misses:         9,936  (  6,641 rd   +   3,295 wr)
==25822== L2 miss rate:        0.4% (    0.3%     +     1.6%  )

NB: The following almost works; t runs the 1st test 5 times, and
produces 1 statistics file, but it fails, because TEST sees multiple
leaders, (FAILED--seen duplicate leader) and exits immediately,
because it happens in t/base.  A work-around is easy enough, but adds
yet another knob. TBD.

$> VALGRIND=perf VG_OPTS='stat -r5 --log-fd=3 --' make test.valgrind

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

          5.568965 task-clock                #    0.833 CPUs utilized            ( +-  1.82% )
                 0 context-switches          #    0.000 M/sec                    ( +- 61.24% )
                 0 CPU-migrations            #    0.000 M/sec                    ( +-100.00% )
               478 page-faults               #    0.086 M/sec                    ( +-  0.37% )
         4,441,737 cycles                    #    0.798 GHz                      ( +-  1.84% )
   <not supported> stalled-cycles-frontend
   <not supported> stalled-cycles-backend
         3,183,574 instructions              #    0.72  insns per cycle          ( +-  2.30% )
           669,241 branches                  #  120.173 M/sec                    ( +-  2.87% )
            41,826 branch-misses             #    6.25% of all branches          ( +-  3.78% )

       0.006688160 seconds time elapsed                                          ( +-  1.49% )

This patch is really a proof-of-concept; perf tool has far more
capabilities than t/TEST can exploit well, but this is a start,
and makes perf foo experimentation easier.

13 years agot/TEST: collect user, sys cpu times for each testfile
Jim Cromie [Sun, 13 Mar 2011 20:13:15 +0000 (14:13 -0600)]
t/TEST: collect user, sys cpu times for each testfile

In t/TEST, run times() before and after each testfile, and save diffs
into $timings{$testname}, currently containing $etms only.

When run as HARNESS_TIMER=../../perl make test, (also when HARNESS_TIMER=2 or more)
harness output now looks like this:

t/base/cond ................................................... ok        7 ms     0 ms     0 ms
t/base/if ..................................................... ok        4 ms     0 ms     0 ms
t/base/lex .................................................... ok       13 ms     0 ms     0 ms
t/base/num .................................................... ok        9 ms    10 ms     0 ms
t/base/pat .................................................... ok        4 ms     0 ms    10 ms
t/base/rs ..................................................... ok       14 ms    10 ms     0 ms
t/base/term ................................................... ok       20 ms     0 ms    10 ms
t/base/while .................................................. ok        8 ms     0 ms    10 ms
t/comp/bproto ................................................. ok        9 ms    10 ms     0 ms

The additional timing data is also written into the Storable file:

  'perf' => {
    '../cpan/Archive-Extract/t/01_Archive-Extract.t' => [
      '3916.87417030334',
      '1700',
      '2380'
    ],
    '../cpan/Archive-Tar/t/01_use.t' => [
      '92.1041965484619',
      '70.0000000000003',
      '19.9999999999996'
    ],
    ...

The numbers are: elapsed time, user-time, system-time.  The latter 2
are children-times from times(); self-times are those of the harness,
which are uninteresting.

They often dont add up (in naive sense); ET can be greater than sum of
others, especially if the process blocks on IO, or can be less than
others, if the process forks and both children are busy.  Also, child
times have 10 ms resolution on Linux, other OS or kernel build options
may vary.

Calling times() in harness will likely also collect bogus child data
if 2 testfiles are run in parallel.

13 years agoif -d HARNESS_TIMER, t/TEST saves timings in Storable file
Jim Cromie [Sun, 13 Mar 2011 19:13:27 +0000 (13:13 -0600)]
if -d HARNESS_TIMER, t/TEST saves timings in Storable file

if HARNESS_TIMER envar is an existing directory, write timings data
and various platform and configuration data to a Storable file.
Given a large collection of files, the variance of each test can be
determined.

The configuration data should be sufficient to compare different
builds done on the same box.  The platform data will hopefully allow
meaningful comparison of tests done on similar boxes, with same or
other OS, compiler, memory, etc.  Both are subject to change, for both
content and format, latter being less important because of the
normalization possible during analysis, if the data is there.

Harness output still looks the same:

t/porting/cmp_version ......................................... ok      757 ms
t/porting/diag ................................................ ok     1172 ms
t/porting/dual-life ........................................... ok       88 ms
t/porting/exec-bit ............................................ ok       86 ms
t/porting/filenames ........................................... ok      176 ms
t/porting/globvar ............................................. ok       99 ms
t/porting/maintainers ......................................... ok      501 ms
t/porting/manifest ............................................ ok      251 ms
t/porting/podcheck ............................................ ok    15013 ms
t/porting/regen ............................................... ok     1033 ms
t/porting/test_bootstrap ...................................... ok       36 ms
All tests successful.
u=11.67  s=5.07  cu=375.07  cs=84.26  scripts=2045  tests=471995
wrote storable file: ../../perf/2011-9-7-2-45.ttimes

The Storable file data looks like:

$VAR1 = {
  'conf' => {
    'byacc' => 'byacc',
    'cc' => 'cc',
    'cccdlflags' => '-fPIC',
    'ccdlflags' => '-Wl,-E',
    ...
  },
  'host' => 'groucho.jimc.earth',
  'perf' => {
    '../cpan/Archive-Extract/t/01_Archive-Extract.t' => '3960.50214767456',
    '../cpan/Archive-Tar/t/01_use.t' => '94.3360328674316',
    '../cpan/Archive-Tar/t/02_methods.t' => '737.880945205688',
    '../cpan/Archive-Tar/t/03_file.t' => '118.676900863647',
    '../cpan/Archive-Tar/t/04_resolved_issues.t' => '130.842924118042',
    ...

13 years agosave elapsed-time-ms in global hash for later reporting
Jim Cromie [Sun, 13 Mar 2011 19:07:42 +0000 (13:07 -0600)]
save elapsed-time-ms in global hash for later reporting

13 years agoadd space after testfile name, and before ok/not ok
Jim Cromie [Sun, 13 Mar 2011 18:44:34 +0000 (12:44 -0600)]
add space after testfile name, and before ok/not ok

Adding space between testfile name and ...... lets user double-click
on just the name, instead of getting all the dots too, reducing the
cmdline editing to resubmit the test manually.  Space before ok/not-ok
allows easier parsing with split /\s/, $line.  Both make output agree
more closely with that from Test::*

13 years agoUpgrade to threads::shared 1.40
Jerry D. Hedden [Fri, 9 Sep 2011 23:54:52 +0000 (19:54 -0400)]
Upgrade to threads::shared 1.40

13 years agoremove index offsetting ($[)
Zefram [Fri, 9 Sep 2011 22:27:16 +0000 (23:27 +0100)]
remove index offsetting ($[)

$[ remains as a variable.  It no longer has compile-time magic.
At runtime, it always reads as zero, accepts a write of zero, but dies
on writing any other value.

13 years agoCorrect mro.c typo added by 006d9e7b3
Father Chrysostomos [Fri, 9 Sep 2011 20:48:28 +0000 (13:48 -0700)]
Correct mro.c typo added by 006d9e7b3

13 years agorelease Carp-1.23 to CPAN
Zefram [Fri, 9 Sep 2011 19:38:57 +0000 (20:38 +0100)]
release Carp-1.23 to CPAN

13 years agomake Carp::Heavy load Carp for backcompat
Zefram [Fri, 9 Sep 2011 19:09:47 +0000 (20:09 +0100)]
make Carp::Heavy load Carp for backcompat

13 years agoWhen probing strxfrm, consider a consistent return value of 0 as sane
Nicholas Clark [Fri, 9 Sep 2011 16:15:00 +0000 (18:15 +0200)]
When probing strxfrm, consider a consistent return value of 0 as sane

13 years agoProvide more information in the message for "strxfrm() gets absurd".
Nicholas Clark [Fri, 9 Sep 2011 13:53:06 +0000 (15:53 +0200)]
Provide more information in the message for "strxfrm() gets absurd".

Prefix it with "panic", report the two lengths that caused the sanity test
failure, and add the message to perldiag.pod.

13 years agoRemove a Devel::DProf error from perldiag.pod
Nicholas Clark [Fri, 9 Sep 2011 13:41:52 +0000 (15:41 +0200)]
Remove a Devel::DProf error from perldiag.pod

Devel::DProf is no longer in the core distribution, hence the core
distribution can no longer generate this particular warning message.

13 years agoIn pp_chdir, move SvGETMAGIC(sv) out of the if() condition.
Nicholas Clark [Fri, 9 Sep 2011 11:02:46 +0000 (13:02 +0200)]
In pp_chdir, move SvGETMAGIC(sv) out of the if() condition.

It was added to the if() condition as part of 935647290357b277.
Unfortunately the syntax used to implemented SvGETMAGIC(sv) is considered by
gcc to be valid in an expression, but is not valid in other compilers.

13 years agoCollapse some code in shared.xs
Father Chrysostomos [Fri, 9 Sep 2011 05:49:12 +0000 (22:49 -0700)]
Collapse some code in shared.xs

In the previous commit, I added duplicate code to make it obvious what
was going on.

13 years ago[perl #98204] Shared objects not destoryed
Father Chrysostomos [Fri, 9 Sep 2011 05:35:44 +0000 (22:35 -0700)]
[perl #98204] Shared objects not destoryed

Jerry wrote:
> threads::shared objects stored inside other
> threads::shared structures are not properly destroyed.
>  When a threads::shared object is 'removed' from a
> threads::shared structure (e.g., a hash), the object's
> DESTROY method is not called.

Later, he said:
> When PL_destroyhook and Perl_shared_object_destroy were
> added, the problem they were overcoming was that the
> destruction of each threads::shared proxy was causing the
> underlying shared object's DESTROY method to be called. The
> fix provided a refcount check on the shared object so that
> the DESTROY method was only called with the shared object
> was no longer in use.
>
> The above works fine when delete() and pop() are used,
> because a proxy is created for the stored shared object that
> is being deleted (i.e., the value returned by the delete()
> call), and when the proxy is destroyed, the object's DESTROY
> method is called.
>
> However, when the stored shared object is 'removed' in some
> other manner (e.g., setting the storage location to
> 'undef'), there is no proxy involved, and hence DESTROY does
> not get called for the object.

This commit fixes that by modifying sharedsv_scalar_store,
sharedsv_scalar_mg_free and sharedsv_array_mg_CLEAR.

Each of those functions now checks whether the current item being
freed has sub-items with reference counts of 1.  If so, that means the
sub-item will be freed as a result of the outer SV’s being freed.  It
also means that there are no proxy objects and that destructors will
hence not be called.  So it pushes a new proxy on to the calling con-
text’s mortals stack.  If there are multiple levels of nested objects,
then, when the proxy on the mortals stack is freed, it triggers
sharedsv_scalar_mg_free, which goes through the process again.

This does not fix the problem for shared objects that still exist
(without proxies) at global destruction time.  I cannot make that
work, as circularities will cause new proxies to be created continu-
ously and pushed on to the mortals stack.  Also, the proxies may end
up being created too late during global destruction, after the mor-
tals stack has been emptied, and when there is not enough of the run-
time environment left for destructors to run.  That will happen if
the shared object is referenced by a shared SV that is not an object.
The calling context doesn’t know about the object, so it won’t fire
the destructor at the object-destroying stage of global destruction.
Detecting circularities is also problematic: We would have to keep
a hash of ‘seen’ objects in the shared space, but then how would we
know when to free that?  Letting it leak would affect embedded
environments.

So this whole trick of creating mortal proxy objects is skipped during
global destruction.

13 years agoshared.xs: Refactor to simplify S_get_RV’s callers
Father Chrysostomos [Thu, 8 Sep 2011 05:43:34 +0000 (22:43 -0700)]
shared.xs: Refactor to simplify S_get_RV’s callers

Every function that calls S_get_RV needs this same incantation:

        S_get_RV(aTHX_ sv, ssv);
        /* Look ahead for refs of refs */
        if (SvROK(SvRV(ssv))) {
            SvROK_on(SvRV(sv));
            S_get_RV(aTHX_ SvRV(sv), SvRV(ssv));
        }

Also, S_get_RV keeps repeating SvRV(ssv), even though it assigns it to
sobj at the top.

Also, an upcoming commit will need the ability to pass the referent to
S_get_RV.

So this patch changes S_get_RV to accept a referent instead (eliminat-
ing its multiple use of SvRV) and adds a get_RV macro to take care of
the standard calling rite.

13 years agoSimplify example pack code in perlpacktut
Mark Jason Dominus [Fri, 9 Sep 2011 05:18:47 +0000 (00:18 -0500)]
Simplify example pack code in perlpacktut

13 years agoEnter gv_fetchsv_nomg
Father Chrysostomos [Fri, 9 Sep 2011 03:45:20 +0000 (20:45 -0700)]
Enter gv_fetchsv_nomg

There are so many cases that use this incantation to get around
gv_fetchsv’s calling of get-magic--

    STRLEN len;
    const char *name = SvPV_nomg_const(sv,len);
    gv = gv_fetchpvn_flags(name, len, flags | SvUTF8(sv), type);

--that it’s about time we had a shorthand.

13 years agoremove bogus < in B<> formatting code
Ricardo Signes [Fri, 9 Sep 2011 02:52:09 +0000 (22:52 -0400)]
remove bogus < in B<> formatting code

13 years agoadd known issues for new OO docs
Dave Rolsky [Fri, 9 Sep 2011 03:06:02 +0000 (22:06 -0500)]
add known issues for new OO docs

13 years agosome small fixes to make porting/podcheck.t happy
Dave Rolsky [Fri, 9 Sep 2011 03:04:12 +0000 (22:04 -0500)]
some small fixes to make porting/podcheck.t happy

13 years agoTweak line length of comment in verbatim section per podcheck.t
Dave Rolsky [Fri, 9 Sep 2011 02:58:12 +0000 (21:58 -0500)]
Tweak line length of comment in verbatim section per podcheck.t

13 years agoLots of updates based on feedback from sprout, including a few new sections
Dave Rolsky [Mon, 11 Jul 2011 02:58:33 +0000 (21:58 -0500)]
Lots of updates based on feedback from sprout, including a few new sections

13 years agoSome changes based no sprout's feedback
Dave Rolsky [Sun, 10 Jul 2011 23:52:33 +0000 (18:52 -0500)]
Some changes based no sprout's feedback

13 years agofix now-broken link to removed section in perlobj
Dave Rolsky [Fri, 8 Jul 2011 22:49:13 +0000 (17:49 -0500)]
fix now-broken link to removed section in perlobj

13 years agoAdd perldelta entries for all doc changes
Dave Rolsky [Thu, 7 Jul 2011 19:32:59 +0000 (14:32 -0500)]
Add perldelta entries for all doc changes

13 years agoRedo all examples using File and File::MP3
Dave Rolsky [Thu, 7 Jul 2011 19:07:53 +0000 (14:07 -0500)]
Redo all examples using File and File::MP3

13 years agoRemove all references to old OO tutorial docs, and add refs to perlootut where approp...
Dave Rolsky [Thu, 7 Jul 2011 18:45:45 +0000 (13:45 -0500)]
Remove all references to old OO tutorial docs, and add refs to perlootut where appropriate

Used buildtoc to regenerate pod-related files

13 years agoremove all old OO tutorials (and perlbot)
Dave Rolsky [Thu, 7 Jul 2011 16:43:25 +0000 (11:43 -0500)]
remove all old OO tutorials (and perlbot)

13 years agoSmall revisions to the text to increase clarity, suggested by Philip Monsen
Dave Rolsky [Thu, 7 Jul 2011 18:51:28 +0000 (13:51 -0500)]
Small revisions to the text to increase clarity, suggested by Philip Monsen

13 years agoAdd more details on inside-out objects from David Golden, and an inside-out class...
Dave Rolsky [Thu, 7 Jul 2011 15:47:35 +0000 (10:47 -0500)]
Add more details on inside-out objects from David Golden, and an inside-out class example from Abigail.

Add strict & warning to blessed scalar class example

13 years agoheavily revised perlobj.pod
Dave Rolsky [Thu, 7 Jul 2011 16:35:00 +0000 (11:35 -0500)]
heavily revised perlobj.pod