This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
Jarkko Hietaniemi [Thu, 19 Nov 2015 02:18:37 +0000 (21:18 -0500)]
analysis does not like mutex being either held or released
threads.xs:1020:1: warning: mutex 'thread->mutex' is not held on every path through here [-Wthread-safety-analysis]
}
^
Jarkko Hietaniemi [Sat, 21 Nov 2015 02:40:00 +0000 (21:40 -0500)]
clang specific diagnostics ignore/restore
Jarkko Hietaniemi [Wed, 18 Nov 2015 03:15:09 +0000 (22:15 -0500)]
annotate S_ithread_create create_destruct_mutex use
If the pool is passed in, and the create_destruct_mutex unlocked also
on success (so that all the unlocks happen in S_ithread_create()),
the create_destruct_mutex use can be annotated.
threads.xs:757:9: warning: releasing mutex 'my_poolp->create_destruct_mutex' th
at was not held [-Wthread-safety-analysis]
MUTEX_UNLOCK(&MY_POOL.create_destruct_mutex);
threads.xs:1000:9: warning: releasing mutex 'my_poolp->create_destruct_mutex' t
hat was not held [-Wthread-safety-analysis]
MUTEX_UNLOCK(&MY_POOL.create_destruct_mutex);
threads.c:1319:1: warning: mutex 'my_poolp->create_destruct_mutex' is not held on every path through here [-Wthread-safety-analysis]
}
^
Jarkko Hietaniemi [Sat, 14 Nov 2015 14:09:38 +0000 (09:09 -0500)]
annotate S_ithread_count_inc mutex use
No warnings issued, but a clear case for annotations.
Jarkko Hietaniemi [Fri, 6 Nov 2015 00:13:22 +0000 (19:13 -0500)]
annotate S_ithread_free mutex use
threads.xs:276:13: warning: releasing mutex 'thread->mutex' that was not held [-Wthread-safety-analysis]
MUTEX_UNLOCK(&thread->mutex);
threads.xs:282:5: warning: releasing mutex 'thread->mutex' that was not held [-Wthread-safety-analysis]
MUTEX_UNLOCK(&thread->mutex);
threads.xs:394:1: warning: mutex 'thread->mutex' is still held at the end of
function [-Wthread-safety-analysis]
}
threads.xs:677:1: warning: mutex 'thread->mutex' is still held at the end of
function [-Wthread-safety-analysis]
}
Jarkko Hietaniemi [Thu, 5 Nov 2015 23:15:35 +0000 (18:15 -0500)]
split off the $0 setting so mutex use can be annotated
No warnings were emitted since the use of the PL_dollarzero_mutex
was correctly bracketed by mutex lock and unlock, but by splitting
off the code and annotating it is more likely to stay correct.
Jarkko Hietaniemi [Fri, 6 Nov 2015 00:00:01 +0000 (19:00 -0500)]
cleanup the mutex use of PerlIOStdio_close
Before: clang -Wthread-safety found the flow quite suspect:
one conditional mutex lock, with two conditional unlocks.
The code *looked* like the being okay logic-wise now, but
rather fragile, so let's make it clearer and more solid
by hoisting the locking earlier.
This is a fd close, this should not be a performance sensitive spot.
And it's in PerlIOStdio, so it should be pretty dead anyway.
perlio.c:3283:18: warning: mutex 'PL_perlio_mutex' is not held on every path through here [-Wthread-safety-analysis]
result = PerlSIO_fclose(stdio);
perlio.c:3299:6: warning: releasing mutex 'PL_perlio_mutex' that was not held [-Wthread-safety-analysis]
MUTEX_UNLOCK(&PL_perlio_mutex);
Jarkko Hietaniemi [Thu, 5 Nov 2015 23:58:56 +0000 (18:58 -0500)]
annotate the mutex use of S_more_refcounted_fds
perlio.c:2232:2: warning: releasing mutex 'PL_perlio_mutex' that was not held [-Wthread-safety-analysis]
MUTEX_UNLOCK(&PL_perlio_mutex);
Jarkko Hietaniemi [Thu, 5 Nov 2015 23:57:58 +0000 (18:57 -0500)]
annotate the mutex use of atfork_lock and atfork_unlock
util.c:2729:1: warning: mutex 'PL_perlio_mutex' is still held at the end of function [-Wthread-safety-analysis]
}
util.c:2729:1: warning: mutex 'PL_op_mutex' is still held at the end of function [-Wthread-safety-analysis]
}
util.c:2739:5: warning: releasing mutex 'PL_perlio_mutex' that was not held [-Wthread-safety-analysis]
MUTEX_UNLOCK(&PL_perlio_mutex);
util.c:2744:5: warning: releasing mutex 'PL_op_mutex' that was not held [-Wthread-safety-analysis]
OP_REFCNT_UNLOCK;
Jarkko Hietaniemi [Thu, 5 Nov 2015 23:57:17 +0000 (18:57 -0500)]
annotate the acquire/release of PL_op_mutex
op.c:1190:1: warning: mutex 'PL_op_mutex' is still held at the end of function
}
op.c:1199:5: warning: releasing mutex 'PL_op_mutex' that was not held
OP_REFCNT_UNLOCK;
Jarkko Hietaniemi [Sun, 22 Nov 2015 16:40:36 +0000 (11:40 -0500)]
add -Wthread-safety for clang 3.5 or later
With this change there is no need to explicitly e.g.
Configure ... -Accflags='-Wthread-safety'
since doing just -Dusethreads with recent enough clang
will automatically add the -Wthread-safety
Jarkko Hietaniemi [Thu, 5 Nov 2015 23:52:20 +0000 (18:52 -0500)]
clang thread safety annotations
http://clang.llvm.org/docs/ThreadSafetyAnalysis.html
Static (compile-time) annotations for declaring the multithreaded
behavior of functions, variables, and capabilities (like mutexes).
Available since about clang 3.5.
./Configure -des -Dusedevel -Dusethreads -Dcc=clang -Accflags='-Wthread-safety'
clang -Wthread-safety then checks the validity of the annotations.
David Mitchell [Mon, 23 Nov 2015 08:15:40 +0000 (08:15 +0000)]
assertion failure on foo(my $x : bar)
RT #126257
'my var : attr' injects a void-context sub call just after the
pad op. However, Perl_ck_entersub_args_list() tries to impose lvalue
context on each of its args, which causes an assertion failure.
This commit makes Perl_ck_entersub_args_list() skip calling op_lvalue()
on any args which are OP_ENTERSUB/OPf_WANT_VOID. Strictly
speaking it should check that the sub call is actually an attribute
method call (e.g. first child is a const("attibutes") etc), but this
was far too much like hard work.
Craig A. Berry [Sun, 22 Nov 2015 23:02:55 +0000 (17:02 -0600)]
TODO newish re/speed.t tests on VMS.
The tests that dump regex debug info get their output mangled by the
record-oriented pipes but otherwise look fine. So mark them to-do.
Tony Cook [Sun, 22 Nov 2015 23:37:47 +0000 (10:37 +1100)]
make_ext.pl: fix operator precedence error from
b4c079ca5
Ricardo Signes [Sat, 21 Nov 2015 21:31:31 +0000 (16:31 -0500)]
base: fix a mis-statement in Changes file
Ricardo Signes [Sat, 21 Nov 2015 20:01:09 +0000 (15:01 -0500)]
release schedule: use a verbatim block for a list-y paragraph
Karl Williamson [Sat, 21 Nov 2015 19:20:32 +0000 (12:20 -0700)]
Get re/uniprops.t to pass on minitest
locale handling doesn't work without POSIX module being able to load, so
doesn't work on minitest. Prior to this patch, the code checked for
only one case of locale handling to skip when there was no POSIX, but
there was a 2nd case if failed to detect.
Ricardo Signes [Sat, 21 Nov 2015 18:16:47 +0000 (13:16 -0500)]
base: new CPAN release
Abigail [Sat, 21 Nov 2015 16:55:07 +0000 (17:55 +0100)]
Tick!
Jarkko Hietaniemi [Fri, 20 Nov 2015 21:53:26 +0000 (16:53 -0500)]
Hash-Util-FieldHash version bump.
Jarkko Hietaniemi [Fri, 20 Nov 2015 21:43:19 +0000 (16:43 -0500)]
HUF_get_trigger0 unused since at least
d74d639b
The
0b057af7 exposed this by static-ing it, so that compilers
started warning about the unused static function.
Lukas Mai [Sat, 21 Nov 2015 00:15:24 +0000 (01:15 +0100)]
[perl #116677] always deparse <> as either glob or readline
Lukas Mai [Fri, 20 Nov 2015 23:16:31 +0000 (00:16 +0100)]
[perl #124280] don't warn for 'my $foo, *bar'
It doesn't make sense to warn 'Parentheses missing around "my" list' if
adding the parens causes a syntax error (you can't declare typeglobs).
But it does make sense to warn for 'local $foo, *bar' because typeglobs
can be localized.
Thus modify the heuristic to only warn for '*' if we're not lexically
declaring something.
Abigail [Fri, 20 Nov 2015 19:15:14 +0000 (20:15 +0100)]
Bump the perl version in various places for 5.23.6
Abigail [Fri, 20 Nov 2015 18:00:09 +0000 (19:00 +0100)]
New perldelta for 5.23.6
Karl Williamson [Wed, 21 Oct 2015 03:40:36 +0000 (21:40 -0600)]
Various tests: use centralized locale detection
These tests were using individually defined heuristics to decide whether
to do locale testing or not. However t/loc_tools.pl provides functions
that are more reliable and complete for determining this than the
hand-rolled ones in these tests.
Karl Williamson [Fri, 20 Nov 2015 02:57:11 +0000 (19:57 -0700)]
lib/locale.pm: Fix so works on platforms without LC_CTYPE
These may not actually exist in the wild, but it is better to be
general.
This also adds an XXX comment about future possibilities.
Karl Williamson [Fri, 20 Nov 2015 02:53:27 +0000 (19:53 -0700)]
t/loc_tools.pl: Improve locale detection
This would return FALSE if the platform didn't have LC_CTYPE; it really
should test if the desired locale category is available, and return TRUE
if so, regardless of LC_CTYPE's presence. Now it may be that all
platforms that have locales have LC_CTYPE, but it is better to not make
that assumption.
It also centralizes the tests for basic locale handling into one common
function called by the others.
Karl Williamson [Fri, 20 Nov 2015 02:51:53 +0000 (19:51 -0700)]
t/loc_tools.pl: Fix incomplete description in comment
Karl Williamson [Fri, 30 Oct 2015 16:14:08 +0000 (10:14 -0600)]
t/loc_tools.pl: White-space only
Karl Williamson [Fri, 20 Nov 2015 17:10:31 +0000 (10:10 -0700)]
op.c: Fix typo in comment
This was very recently introduced, by
09681a13f07600082e5a7efbc9c978f62b24c502
Abigail [Fri, 20 Nov 2015 17:27:31 +0000 (18:27 +0100)]
Added epigraph for 5.23.5
Abigail [Fri, 20 Nov 2015 17:15:03 +0000 (18:15 +0100)]
Merge branch 'release-5.23.5' into blead
Abigail [Fri, 20 Nov 2015 13:40:19 +0000 (14:40 +0100)]
perldelta: acknowledgements
Abigail [Fri, 20 Nov 2015 13:35:01 +0000 (14:35 +0100)]
perlhist: added entry for 5.23.5
Abigail [Fri, 20 Nov 2015 13:29:33 +0000 (14:29 +0100)]
perldelta: Modules and Pragmata
Jarkko Hietaniemi [Fri, 20 Nov 2015 01:47:49 +0000 (20:47 -0500)]
hexfp: if HEXFP_NV the shift2 is unused
HEXFP_NV happens with e.g. -Duselongdouble. The unusedness is
warned about by e.g. gcc/g++ at least since 4.6, but seemingly
not by clang, even at 3.7.
Abigail [Fri, 20 Nov 2015 10:34:11 +0000 (11:34 +0100)]
Update Module::CoreList for 5.23.5
Steve Hay [Fri, 20 Nov 2015 08:16:28 +0000 (08:16 +0000)]
Update Porting/Maintainers.pl for previous commit
(Customization is incorporated into the new CPAN release.)
Karen Etheridge [Fri, 20 Nov 2015 03:15:18 +0000 (19:15 -0800)]
Update Module-Metadata to version 1.000030
1.000030 2015-11-20 03:03:24Z (TRIAL RELEASE)
- temp dirs cleaned up during tests (Steve Hay)
- more accurately mark tests as TODO, so as to have a quieter and less
confusing test run without passing TODO tests. This release is primarily
intended for the perl 5.23.5 release.
Abigail [Thu, 19 Nov 2015 18:14:35 +0000 (19:14 +0100)]
pod/perldelta: Add punctuation
David Mitchell [Thu, 19 Nov 2015 15:49:03 +0000 (15:49 +0000)]
op_free(): don't assert op_private ok when erred
[perl #126258]
op_free includes an assert to make sure each op's op_private field
only has the flags set that are expected for that op. It's a thing I added
at the same time I added the regen/op_private mechanism, and is more a
general "make sure people are only setting the flags we know about" test.
However, if the op tree is being freed after a compilation error, some
op's flags may be in an inconsistent state; so skip the assert in that case.
e.g.
perl -e 'grep$0,0}'
Abigail [Thu, 19 Nov 2015 15:46:45 +0000 (16:46 +0100)]
Turn new diag message into a link.
This turned out to be a bit of work. When running the porting tests,
the pod checker checks whether all links are valid. To do so, it
creates a database of all valid targets, and then for all links,
checks whether the target exist. However, the targets have been POD
processed, while the links have not -- except for E<sol> and
E<verbar>. So, if the target contains S<>, the link *must not*.
Abigail [Thu, 19 Nov 2015 12:32:00 +0000 (13:32 +0100)]
podcheck.t: Deindent by 1 space to left margin.
Abigail [Thu, 19 Nov 2015 12:28:57 +0000 (13:28 +0100)]
podcheck.t: Line up comments.
A block with all comments lined up, save for one? That hurts the eyes.
Abigail [Thu, 19 Nov 2015 12:28:35 +0000 (13:28 +0100)]
podcheck.t: Fix typos in comments
Aaron Crane [Thu, 19 Nov 2015 11:29:24 +0000 (11:29 +0000)]
Quell "used only once" warning in test suite
Aaron Crane [Sun, 15 Nov 2015 15:10:54 +0000 (15:10 +0000)]
maint policy: allow fixes for new features
As (Steve Hay)++ said on-list:
I think it's a shame if users get a 5.X.0 release with some shiny new
features which I hope they're excited about and start making use of,
but then find bugs in those features and have to wait until 5.X+2.0,
rather than 5.X.1, for fixes.
rjbs++ clarified that, although such changes constitute a break in backwards
compatibility, there are two reasons why bugs in new features should be
fixed in maint:
* they delay people from using a feature for a year, because it does
something stupid
* they risk enshrining bad behavior under the usual program of bugward
compatibility
David Mitchell [Thu, 19 Nov 2015 10:03:04 +0000 (10:03 +0000)]
silence compiler warnings using INCMARK/POPMARK
v5.23.3-305-g6cae08a introduced debugging variants of INCMARK/POPMARK, and
replaced a number of "PL_markstack_ptr--;" with "POPMARK;" etc.
This spews a bunch of "value computed is not used" warnings; so
add some "(void)"s.
Also indent the new definitions of INCMARK/POPMARK correctly.
Abigail [Fri, 13 Nov 2015 22:46:02 +0000 (23:46 +0100)]
Initial work for pod/erldelta for 5.23.5
Processed commits up to
cb4547118517bc34243bbb938eeccfbd8016c64a.
Work that still needs to be done on perldelta before 5.23.5:
- New/Changed/Delete modules
- Acknowledgements
- And commits after
cb4547118517bc34243bbb938eeccfbd8016c64a.
- Get the L<> link to work referring to a new diagnostic message.
David Mitchell [Wed, 18 Nov 2015 15:30:37 +0000 (15:30 +0000)]
sv_inc/dec_nomg(): croak on GVs etc
RT #126637
Prior to v5.23.4-100-g20e9643, pp_postinc() etc checked whether the SV was
an AV, non-fake GV, or any other such non-modifiable thinngy; and if so,
called Perl_croak_no_modify(). That commit of mine removed the check, and
instead relied on the underlying sv_inc_nomg() function (called by
pp_postinc()) to do the checking instead. It turns out that while
sv_inc_nomg() etc does some checks, it wasn't as thorough as pp_postinc().
So something like
my $y = $_++ for *FOO;
now crashes with an assertion failure in sv_inc_nomg() rather than
croaking.
This commit adds such checks to sv_inc_nomg() and sv_dec_nomg() - which
need them anyway, since they may be called from places other than
pp_postinc() etc.
H.Merijn Brand [Wed, 18 Nov 2015 08:19:08 +0000 (09:19 +0100)]
Update Config::Perl::V to 0.25
Jarkko Hietaniemi [Tue, 17 Nov 2015 02:00:27 +0000 (21:00 -0500)]
tru64: Freshen the section on required process data size limits.
Steve Hay [Tue, 17 Nov 2015 13:24:36 +0000 (13:24 +0000)]
Upgrade Time::HiRes from version 1.9727_02 to 1.9728
Steve Hay [Tue, 17 Nov 2015 13:21:11 +0000 (13:21 +0000)]
Upgrade Math::BigInt::FastCalc from version 0.35 to 0.37
Steve Hay [Tue, 17 Nov 2015 13:18:20 +0000 (13:18 +0000)]
Upgrade Math::BigInt from version 1.999707 to 1.999710
Tony Cook [Wed, 11 Nov 2015 04:57:09 +0000 (15:57 +1100)]
[perl #126193] don't use a trash SV if no indexes are provided to pp_lslice
Tony Cook [Wed, 11 Nov 2015 00:29:03 +0000 (11:29 +1100)]
[perl #126602] make sure targ isn't freed from under us
Mohammed El-Afifi [Mon, 9 Nov 2015 21:49:08 +0000 (23:49 +0200)]
handle empty directory lists in File::Find
Jarkko Hietaniemi [Mon, 16 Nov 2015 00:45:06 +0000 (19:45 -0500)]
Configure: gcc 5 exists.
Chris 'BinGOs' Williams [Sun, 15 Nov 2015 18:25:07 +0000 (18:25 +0000)]
Updated Maintainers.pl for recent CPAN releases
Steve Hay [Sun, 15 Nov 2015 15:26:53 +0000 (15:26 +0000)]
Add epigraph for 5.22.1-RC2
Steve Hay [Sun, 15 Nov 2015 14:14:10 +0000 (14:14 +0000)]
Perl 5.22.1-RC2 today
Steve Hay [Sun, 15 Nov 2015 13:45:01 +0000 (13:45 +0000)]
Revert "Module::CoreList updates for 5.22.1"
This reverts commit
89a7d40e89d2f2e64fe5421cb28d5a1f29bb25b4.
(The need for 5.22.1-RC2 means that 5.22.1 will not be released before
5.23.5 now, so remove the 5.22.1 data from here for now. I will
reinstate it after 5.23.5 has been released.)
Karl Williamson [Sat, 14 Nov 2015 18:41:30 +0000 (11:41 -0700)]
PATCH: [perl #126615] Segfault/assert fail with regex_sets
This is a the result of where I added an assert to make sure that
where I didn't think a situation could happen, in fact couldn't. But it
turns out it can happen when there is a syntax error, so raise an error,
instead of doing the assert.
Jarkko Hietaniemi [Sat, 14 Nov 2015 16:25:38 +0000 (11:25 -0500)]
Appease the gods of stupid tests.
Jarkko Hietaniemi [Sat, 7 Nov 2015 23:24:16 +0000 (18:24 -0500)]
Some more threads.xs comments, courtesy jhedden
Jarkko Hietaniemi [Fri, 6 Nov 2015 21:59:54 +0000 (16:59 -0500)]
Document S_ithread_run lock+unlock in more detail, courtesy davem
Ricardo Signes [Fri, 13 Nov 2015 23:44:16 +0000 (18:44 -0500)]
PathTools: new CPAN release
This release gets the latest blead code onto CPAN, but blead gets
the updated Makefile.PL, which fixes INSTALLDIRS to use site
on 5.12-ish and later.
Ricardo Signes [Fri, 13 Nov 2015 16:27:56 +0000 (11:27 -0500)]
base: no longer works on v5.6, require v5.8
Dagfinn Ilmari Mannsåker [Tue, 10 Nov 2015 10:59:24 +0000 (10:59 +0000)]
Include the error message on IPC::Open3 exec() failure
Tony Cook [Thu, 22 Oct 2015 01:03:05 +0000 (12:03 +1100)]
[perl #126325] don't read past the end of the source for pack [Hh]
With a utf8 target but a non-utf8 source, pack Hh would read past the
end of the source when given a length, due to an incorrect condition.
Tony Cook [Tue, 10 Nov 2015 22:20:56 +0000 (09:20 +1100)]
fix symbian XS too, missed this when checking over the patch
Unfortunately the symbian SDK doesn't appear to be available anymore.
Reini Urban [Fri, 13 Mar 2015 23:31:41 +0000 (00:31 +0100)]
XSLoader 0.21: use dl_find_symbol 3rd optional argument
to skip the worthless dl_last_error message
Reini Urban [Wed, 11 Mar 2015 17:11:53 +0000 (18:11 +0100)]
DynaLoader: extend t/DynaLoader.t to be run from basedir also
This simplifies testing from core.
Reini Urban [Sat, 14 Mar 2015 09:04:53 +0000 (10:04 +0100)]
DynaLoader/dl_*.xs: Define all PERL_IN_DL_*_XS markers
On Symbian harmonize with the rest.
Reini Urban [Thu, 12 Mar 2015 22:45:51 +0000 (23:45 +0100)]
DynaLoader 1.36 dl_find_symbol add 3rd optional argument
On Darwin DynaLoader::bootstrap tries dl_find_symbol first with libhandle 0,
to see if the shlib with the symbol is already loaded, e.g. with libc.
We do not want to store the dl_last_error information for this mostly
failing probe, so add an optional ign_err=0 argument.
Similar for dl_find_symbol_anywhere, which is expected to fail for all librefs.
Also support dl_last_error on symbian, as on all other platforms.
TonyC: fix bad XS
David Mitchell [Tue, 10 Nov 2015 13:50:51 +0000 (13:50 +0000)]
[MERGE] faster arithmetic
David Mitchell [Sun, 25 Oct 2015 18:28:14 +0000 (18:28 +0000)]
split pp_postdec() from pp_postinc() and improve
pp_postinc() handles both $x++ and $x-- (and the integer variants
pp_i_postinc/dec). Split it into two separate functions, as handling
both inc and dec in the same function requires 3 extra conditionals.
At the same time make the code more efficient.
As currently written it:
1) checked for "bad" SVs (such as read-only) and croaked;
2) did a sv_setsv(TARG, TOPs) to return a copy of the original value;
2) checked for a IOK-only SV and if so, directly incremented the IVX slot;
3) else called out to sv_inc/dec() to handle the more complex cases.
This commit combines the checks in (1) and (3) into one single big
check of flags, and for the simple integer case, skips 2) and does
a more efficient SETi() instead.
For the non-simple case, both pp_postinc() and pp_postdec() now call a
common static function to handle everything else.
Porting/bench.pl shows the following raw numbers for
'$y = $x++' ($x and $y lexical and holding integers):
before after
------ -----
Ir 306.0 223.0
Dr 106.0 82.0
Dw 51.0 44.0
COND 48.0 33.0
IND 8.0 6.0
COND_m 1.9 0.0
IND_m 4.0 4.0
David Mitchell [Sun, 25 Oct 2015 08:41:50 +0000 (08:41 +0000)]
split pp_predec() from pp_preinc() and improve
pp_preinc() handles both ++$x and --$x (and the integer variants
pp_i_preinc/dec). Split it into two separate functions, as handling
both inc and dec in the same function requires 3 extra conditionals.
At the same time make the code more efficient.
As currently written it:
1) checked for "bad" SVs (such as read-only) and croaked;
2) checked for a IOK-only SV and directly incremented the IVX slot;
3) else called out to sv_inc() to handle the more complex cases.
This commit combines the checks in (1) and (2) into one single big
check of flags, and anything "bad" simply skips the IOK-only code
and calls sv_dec(), which can do its own checking of read-only etc
and croak if necessary. Porting/bench.pl shows the following raw numbers
for ++$x ($x lexical and holding an integer):
before after
-------- --------
Ir 77.0 56.0
Dr 30.0 24.0
Dw 10.0 10.0
COND 12.0 9.0
IND 2.0 2.0
COND_m -0.1 0.0
IND_m 2.0 2.0
Even having split the function into two, the combined size of the two new
functions is smaller than the single previous function.
David Mitchell [Thu, 22 Oct 2015 11:04:40 +0000 (12:04 +0100)]
faster add, subtract, multiply
In pp_add, pp_subtract and pp_multiply, special-case the following:
* both args IV, neither arg large enough to under/overflow
* both args NV.
Starting in 5.8.0, the implementation of the arithmetic pp functions
became a lot more complex (and famously, much slower), due to the need
to support 64-bit integers.
For example, formerly pp_add just converted both its args to an NV and
returned an NV. On 64-bit systems, that could gave bad results if the
mantissa of an NV was < 64 bits; for example:
$ perl561 -e'$x = 0x1000000000000000; printf "%x\n", $x+1'
1000000000000000
$ perl580 -e'$x = 0x1000000000000000; printf "%x\n", $x+1'
1000000000000001
This led to a lot of complex code that covered all the possibilities
of overflow etc.
This commit adds some special casing to these three common arithmetic ops.
It does some quick checks (mainly involving fast boolean and bit ops)
to determine if both args are valid IVs (and not UVs), are not magic,
and aren't very big (+ve or -ve). In this case, the result is simply
SvIVX(svl) + SvIVX(svr) (or - or *) with no possibility of overflow.
Failing that, if both args are NV's and not magic, then if both NVs
can be converted to IVs without loss, handle as for the IV case; failing
that, just return SvNVX(svl) + SvNVX(svr);
For all other cases, such as mixed IV and NV or PV, fall back to the old
code.
On my platform (x86_64), it (along with the previous commit) reduces the
execution time of the nbody benchmark (lots of floating-point vector
arithmetic) by a third and in fact makes it 10% faster than 5.6.1.
David Mitchell [Thu, 22 Oct 2015 15:43:49 +0000 (16:43 +0100)]
make SETi/u/n, (X)PUSHi/u/n more efficient
These macros are used by many pp functions to set TARG to an int or float
value and put it on the stack. The macros use a call to sv_setiv()
or similar.
However, there is a good chance that the target is ether a lexical var
or a PADTMP that has been assigned just an IV/NV in the past, in which
case its body is likely to still be of type SVt_IV/SVt_NV. If this is
the case, we can set its value much more efficiently.
Update those setting macros to first check if the target has a simple
body, and if so, set directly.
This makes quite a significant performance difference on code that does
a lot of arithmetic, at the cost of a larger binary (0.36% on my Linux
x86_64 system).
It also allows you (at compile time) to skip testing for taint if you
know that the value can't be tainted (e.g. pp_add() when both args are
non-magical and so can't have taint magic attached). The next commit will
make use of this.
Includes a couple of efficiency tweaks suggested by Daniel Dragan.
David Mitchell [Fri, 30 Oct 2015 13:44:11 +0000 (13:44 +0000)]
avoid (TAINTING_get && TAINT_get)
In various places we test for both (PL_tainting && PL_tainted).
Since if tainting isn't enabled PL_tainted should never get set, it's
more efficient to just test for (TAINT_get).
We ensure that PL_tainted doesn't actually get set when !PL_tainting
by changing some "setting" macros from PL_tainted = TRUE to
PL_tainted = PL_tainting.
Ricardo Signes [Mon, 9 Nov 2015 22:40:51 +0000 (17:40 -0500)]
base: prepare to make a new CPAN release
...eliminates some unneeded files, adds a Makefile.PL (for the
INSTALLDIRS-picking behavior).
Reini Urban [Mon, 16 Mar 2015 09:27:37 +0000 (10:27 +0100)]
MARK -Ds debugging
display the MARK arity and pointers with MARK macros.
assert on markptr underflow.
Aaron Crane [Tue, 10 Nov 2015 01:22:13 +0000 (01:22 +0000)]
perlexperiment.pod: use consistent style for Perl versions
Aaron Crane [Tue, 10 Nov 2015 01:16:28 +0000 (01:16 +0000)]
Mention warning categories for removed experimental features
This seems likely to be helpful for future code archæologists.
The string "autoderef" string didn't previously appear in perlexperiment.pod;
that looks like an oversight.
Dagfinn Ilmari Mannsåker [Mon, 9 Nov 2015 16:51:47 +0000 (16:51 +0000)]
Update perlexperiment for removal of lexical topic and autoderef
Karl Williamson [Mon, 9 Nov 2015 05:59:51 +0000 (22:59 -0700)]
t/op/utf8decode.t: print debugging info if test fails
Karl Williamson [Thu, 29 Oct 2015 15:27:48 +0000 (09:27 -0600)]
utf8.h: Move #define within file
This #define has, until the next commit, not been needed on EBCDIC
platforms; move it in preparation for that commit.
Karl Williamson [Fri, 30 Oct 2015 02:32:08 +0000 (20:32 -0600)]
utf8.h, utfebcdic.h: Use mnemonic constant
The magic number 13 is used in various places on ASCII platforms, and
7 correspondingly on EBCDIC. This moves the #defines for what these
represent to early in their files, and uses the symbolic name
thereafter.
Karl Williamson [Fri, 30 Oct 2015 02:24:14 +0000 (20:24 -0600)]
utf8.h: Reformat a couple of table lines
This is just an aesthetic issue, hopefully making things clearer.
Karl Williamson [Sun, 25 Oct 2015 02:08:47 +0000 (20:08 -0600)]
re/pat_advanced.t: Fix a test so also runs on EBCDIC
Karl Williamson [Sun, 25 Oct 2015 02:04:17 +0000 (20:04 -0600)]
Devel::Peek: document that uses STDERR
Tony Cook [Thu, 29 Oct 2015 04:07:09 +0000 (15:07 +1100)]
[perl #126469] document the ob parameter to sv_reftype()
Tony Cook [Thu, 29 Oct 2015 04:05:59 +0000 (15:05 +1100)]
make sv_ref() part of the API
The existing sv_reftype() returns the class of a blessed SV only
as a const char *, so we can't tell if it's UTF8 or not.
This probably should have been API from the beginning.
Tony Cook [Mon, 12 Oct 2015 03:02:33 +0000 (14:02 +1100)]
cygwin: look harder for a C: mapping and skip if we don't find it
Some recent update to df on cygwin changed the output from listing
all mappings for the drive with cygwin installed on it to listing
only the root directory, eg from:
$ df
Filesystem 1K-blocks Used Available Use% Mounted on
C:/cygwin/bin
76943280 45410396 31532884 60% /usr/bin
C:/cygwin/lib
76943280 45410396 31532884 60% /usr/lib
C:/cygwin
76943280 45410396 31532884 60% /
C:
76943280 45410396 31532884 60% /cygdrive/c
to:
$ df
Filesystem 1K-blocks Used Available Use% Mounted on
C:/cygwin
1953411068 1261572900 691838168 65% /
which meant the test used an incorrect fallback value.
So force df to display all the mappings, handle the differently
formatted mapping correctly, and if all that fails, skip the test.
Jarkko Hietaniemi [Sat, 7 Nov 2015 19:38:21 +0000 (14:38 -0500)]
perl #126586 hexfp may lose 1-3 low order bits (most often, 1)
Jarkko Hietaniemi [Fri, 6 Nov 2015 23:54:16 +0000 (18:54 -0500)]
perl #126582 hexfp overflow drops hi-order bits