| Commit message (Collapse) | Author | Age | Files | Lines |
|
|
|
|
|
|
|
|
|
|
| |
This just detabifies to get rid of the mixed tab/space indentation.
Applying consistent indentation and dealing with other tabs are another issue.
Done with `expand -i`.
* vutil.* left alone, it's part of version.
* Left regen managed files alone for now.
|
| |
|
|
|
|
|
|
|
|
| |
Many of the files in perl are for one thing only, and hence their
embedded documentation will be for that one thing. By creating a hash
here of them, those files don't have to worry about what section that
documentation goes under, and so it can be completely changed without
affecting them.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
which is the common case.
If strtod() is disabled, (and USE_PERL_ATOF isn't also disabled) this
code is used, so I moved it into the #elif block.
It's also possible to Configure disabling both strtod() and
USE_PERL_ATOF with:
./Configure ... -Ud_strtod -Accflags=-DUSE_PERL_ATOF=0 ...
which resulted in a build with a broken Perl_my_atof3(), so fail the
build early with #error in that case.
|
| |
|
|
|
|
|
| |
This uses a new organization of sections that I came up with. I asked
for comments on p5p, but there were none.
|
|
|
|
|
| |
These were not intended to go into perlapi, but the flag indicating so
was mistakenly left off.
|
|
|
|
|
|
| |
The grok_infnan() function was walking past the end of the string
while skipping over trailing '0' characters. This is another
variation of #17370.
|
|
|
|
|
| |
Mostly in comments and docs, but some in diagnostic messages and one
case of 'or die die'.
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
This led to about a 7% improvement, number of branches went 2.3kk->1.9kk
in perf, thanks to Sergey Aleynikov. cachegrind shows:
Key:
Ir Instruction read
Dr Data read
Dw Data write
COND conditional branches
IND indirect branches
_m branch predict miss
The numbers represent raw counts per loop iteration.
eight_hex_digits
87654321
blead latest Ratio %
----- ------ -------
Ir 306.0 297.0 103.0
Dr 76.0 76.0 100.0
Dw 41.0 39.0 105.1
COND 26.0 26.0 100.0
IND 2.0 2.0 100.0
COND_m 0.1 0.0 Inf
IND_m 3.0 3.0 100.0
|
|
|
|
|
|
| |
The multiplcation factor was itself overflowing, so need to change it to
an NV. Also, the first time through this factor is not needed as what
it is multiplying is 0, so set it to 0.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
These add enough functionality so that other code that rolled its own
version of this can call it instead and get the desired functionality.
One flag silences warnings about overflow. It would be more consistent
to use the existing flag that gets set when overflow is detected to
silence the warnings if set on input. But that would be a change in
(undocumented) behavior, and I thought it better to not chance breaking
something.
The other flag forbids an initial underscore when medial underscores are
allowed. I wasn't aware until I examined the code and documentation
carefully that the flag that I thought allowed single underscores
between digits, actually also allows for an initial underscore. I can't
imagine why that was the case, but \N{U+...} never allowed initial
underscores, and adding a flag to grok_hex to allow just medial
underscores allows \N{} in a future commit to change to use grok_hex()
without changing behavior.
Neither flag is currently exposed outside of the core or extensions
|
|
|
|
|
|
|
| |
Indent code that the previous commit added an enclosing block
surrounding it.
And vertically align some comments
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
This commit adds two output flags returned from this function to the one
previously existing, so that the caller can be informed of the problems
found and take its own action.
This involves the behavior of two existing flags, whose being set
suppresses the warning if particular conditions exist in the input being
parsed. Both flags were currently always cleared upon return.
One of those flags is non-public. I changed it so that it isn't cleared
upon return if the condition it describes is found.
The other flag is public. I thought that some existing code, though
unlikely, might be relying on the flag being always cleared. So I
added a completely new flag from a previously unused bit that, if clear
on input there is no change in behavior; but if set on input, it will
remain set on output if the condition is met; otherwise cleared. The
only code that could possibly be affected is that which sets this unused
bit, but expects it to be cleared after the return. This is very
unlikely.
|
|
|
|
|
|
|
|
| |
Earlier I was confused when I thought that 7 hex digits were the max
before we needed to start worrying about overflow. That's true for
signed results where everything above 7FFF_FFFF won't fit in a 32-bit
signed integer. But these functions return unsigned, and so any 8
digits will fit in a 32-bit word.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
This uses a variety of techniques to improve the performance.
The chief one is to switch on the input length for the unrolled part of
the loop, like is done in grok_bin_oct_hex(). This eliminates having to
check if we are at the end of the string each time we process and
advance a digit through it.
Explicit branch predictions were added. One assumes that the input
won't have a sign more frequently than it does have one.
Some setup conditionals were eliminated. One way is that this ignores
leading spaces. Previously, it just advanced through any and then
checked if we are at the end of the string after having done so. That
check can be eliminated if we didn't advance.
Also, I check for a sign with a single conditional, eliminating a check
for minus, then, if not found, one for plus. Instead, if it is a sign,
there is an extra check for which one. Thus it rewards unsigned input,
and penalizes signed, by a single conditional each way.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
This commit uses a variety of techniques for speeding this up. It is
now faster than blead, and has less maintenance cost than before.
Most of the checks that the current character isn't NUL are unnecssary.
The logic works on that character, even if, for some reason, you can't
trust the input length. A special test is added to not output the
illegal character message if that character is a NUL. This is simply
for backcompat.
And a switch statement is used to unroll the loop for the leading digits
in the number. This should handle most common cases. Beyond these, and
one has to start worrying about overflow. So this version has removed
that worrying from the common cases.
Extra conditionals are avoided for large numbers by extracting the
portability warning message code into a separate static function called
from two different places. Simplifying this logic led me to see that if
it overflowed, it must be non-portable, so another conditional could be
removed.
Other conditionals were removed at the expense of adding parameters to
the function. This function isn't public, but is called from the
grok_hex, et. al. macros. grok_hex knows, for example, that it is
looking for an 'x' prefix and not a 'b'. Previously the code had a
conditional to determine that.
Similarly in pp.c, we look for the prefix. Having found it we can start
the parse after the prefix, and tell this function not to look for it.
Previously, this work was duplicated.
The previous changes had left this function slower than blead. That is
in part due to the fact that the loop doesn't go through that many
iterations per function call, and the gcc compiler managed to optimize
away the conditionals in XDIGIT_VALUE in the call of it from the loop.
(The other call in this function did have the conditionals.)
Thanks to Sergey Aleynikov for his help on this
|
|
|
|
|
|
|
| |
This saves the input flags into a local variable and uses that in the
rest of the function, and initializes the output flags at the beginning
of the functions. This is in preparation for more output flags to be
set, as we go along.
|
|
|
|
|
| |
Outdent code whose enclosing block was removed by the previous commit.
A few other white space fixups.
|
|
|
|
|
| |
This removes a conditional in the loop, and improves the accuracy of the
overflow NV returned that approximates the desired input.
|
|
|
|
|
|
| |
This flag doesn't actually occur in the functions in which the
documentation for it is mentioned. Instead, move it to a function that
does mention it.
|
|
|
|
|
| |
In examining these functions in detail, I found some things in the pod
that were unclear or misleading. This is an attempt to clarify things.
|
|
|
|
| |
This makes adjacent all similar functions and their docs
|
| |
|
| |
|
|
|
|
|
|
|
|
|
|
| |
These functions are identical in logic in the main loop, the difference
being which digits they accept. The rest of the code had slight
variations. This commit unifies the functions.
I presume the reason they were kept separate was because of speed.
Future commits will make this unified function faster than blead, and
the reduced maintenance cost makes this worthwhile.
|
| |
|
|
|
|
|
|
|
| |
This replaces strchr("list", c) calls throughout the core. They don't
work properly when 'c' is a NUL, returning the position of the
terminating NUL in "list" instead of failure. This could lead to
segfaults or even security issues.
|
|
|
|
|
|
| |
I only added a test, but not the change in
9f16475a53933d1d9c547f871b97b3b12160cece. The test passes except when
run under address sanitizer or valgrind.
|
|
|
|
|
| |
This is a bug in grok_infnan() in which in one place it failed to check
that it was reading within bounds.
|
| |
|
|
|
|
| |
fix #17279
|
|
|
|
|
| |
Remove MS Visual C++ 6.0 support as agreed in the thread starting here:
https://www.nntp.perl.org/group/perl.perl5.porters/2019/07/msg255625.html
|
| |
|
| |
|
| |
|
|
|
|
|
|
| |
The prefix 'Perl_' was omitted, but this did not matter because there
was a macro that expanded to include the prefix. But it's customary to
have the expansion at the point of definition.
|
|
|
|
|
| |
It's best to have a #error case when nothing in the #if #else series is
true, as it catches the problem at compile time.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
This commit creates my_strod() and a synonym, Strtod(), to emulate
strtod() using the most precise function known to us that is available
on the platform. strtod() is not in K&R, but is in C90, so atof() may
be silently substituted instead on those few platforms without it.
This function also correctly handles locale issues, such as if the radix
character should be a dot or comma (or something else) depending on the
parent perl code is using locale or not, and which locale.
The symbol Perl_strtod continues to be defined on platforms which have
some version of strtod(), for backward compatibility, and can be called
as a function (or rather macro) but most applications should just use
Strtod() and not sweat the details.
This commit also fixes the problems with the prior commit:
commit 4ac6fab20b8950ee14756c6f2438809c572082cd
Author: Karl Williamson <khw@cpan.org>
Date: Mon Apr 15 11:10:31 2019 -0600
PATCH: [perl #133945] Perl_strtod failures
This commit wraps Perl_strtod() in macros that cause the proper
radix character to be used.
|
|
|
|
| |
as embed.fnc says it should be
|
|
|
|
| |
This commit halves the number of conditionals needed in this hot code.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
This bug showed up only on -Dusemymalloc without Debugging, and without
various other common Configure options.
It causes my_atof3() to return failure where in fact success was
achieved. It apparently got triggered due to slight differences in
malloc behaviors.
The bug is that it changed a string pointer to new memory and forgot to
change it back to the original value when that memory got freed. The
test that fails is an equal/not equal of two pointers, and usually two
pointers aren't the same, meaning the bug doesn't appear.
The only case where my_atof3() is called is in parsing certain
\p{nv=...} where "..." is not a rational number. So the scope of this
bug is limited.
Spotted by Ryan Voots.
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
This changes to use Perl_strtod() when available, and that turns out to
be the key to fixing this bug.
S_mulexp10() is removed from embed.fnc to avoid repeating the
complicated prerequisites for defining Perl_strtod(). This works
because this static function already was defined before use in
numeric.c, and always called in full form without using a macro.
James Keenan fixed a file permissions problem originally introduced by
this commit, but the fix has been squashed into it.
|
|
|
|
|
|
|
|
|
|
| |
For readability, this changes
if (f00) { MANY LINES } else { FEW LINES }
to
if (! f00) { FEW LINES } else { MANY LINES }
|
|
|
|
| |
Remove trailing blanks, add a few blank lines
|
|
|
|
|
| |
Previously the code compiled under quadmath did not bother to check for
locale. Fixing this was a simple matter of a little rearrangement.
|
|
|
|
|
|
| |
For: RT # 133380
Committer: Tina Müller is now a Perl AUTHOR.
|
|
|
|
|
|
|
|
| |
clang 6.0.0 was reporting:
=cut missing? numeric.c:1087:*/
Add =cut to correspond to previous =for.
|