| Commit message (Collapse) | Author | Age | Files | Lines |
| |
|
|
|
|
|
|
| |
related to #17737 and fixes #17739
re-work of my original patch that only pushes the final result
|
|
|
|
| |
fixes #17737
|
|
|
|
|
|
|
|
|
| |
The comment referred to pp_addr, but the correct field is op_ppaddr,
and the function itself is called Perl_unimplemented_op, not
PL_unimplemented_op.
When indexing PL_op_name[], use the local op_type variable that we
just got from PL_op->op_type instead of going via PL_op again.
|
| |
|
|
|
|
|
|
|
|
|
| |
Old glibc versions had a buggy modulo implementation for 64 bit
integers on 32-bit architectures. This was fixed in glibc 2.3,
released in 2002 (the version check in the code is overly cautious).
Removing the alternate PP function support is left for the next
commit, in case we need to resurrect it in future.
|
|
|
|
|
|
| |
They were all over the place.
Whitespace-only.
|
|
|
|
|
|
|
|
|
|
|
| |
GH #16552
In 2003 a fix was added to workaround a bug in glibc's crypt_r()
implementation (which involved tweaking a private undocumented field
within the crypt_data struct). This bug has long since been fixed, but
the workaround remained. This commit finally removes that workaround.
See also v5.27.11-33-ge9c9cf5759.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
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
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Adds a new infix operator named `isa`, with the semantics that
$x isa SomeClass
is true if and only if `$x` is a blessed object reference that is either
`SomeClass` directly, or includes the class somewhere in its @ISA
hierarchy. It is false without warning or error for non-references or
non-blessed references.
This operator respects `->isa` method overloading, and is intended to
replace boilerplate code such as
use Scalar::Util 'blessed';
blessed($x) and $x->isa("SomeClass")
|
|
|
|
|
|
|
|
|
|
|
|
| |
These constants were undocumented and don't do anything useful.
Saving a few kilobytes of memory doesn't justify the complexity
caused by adding a new build flag.
All platforms except 64-bit Windows were using LIBERAL. It's not
clear why win64 was using -DCONSERVATIVE, but removing it doesn't
break anything.
[gh #17232]
|
|
|
|
|
|
|
| |
Casting a pointer to unsigned long will result in truncation when
sizeof(void*) > sizeof(unsigned long)
[gh #17232]
|
|
|
|
|
| |
Note that utf8_distance returns IV, while STR_LEN is an unsigned value
of varying sizes.
|
|
|
|
|
|
| |
For some reason I was storing the counts of sub signature parameters and
optional parameters as signed ints. Since these can never be negative,
change them to UV instead.
|
|
|
|
|
|
|
|
|
|
|
|
| |
This op is of class OP_UNOP_AUX, Ops of this class have an op_aux pointer
which typically points to a variable-length malloced array of IVs,
UVs, etc. However in the specific case of OP_ARGCHECK the data stored
in the aux struct is fixed. So this commit casts the aux pointer to a
struct containing the relevant fields (number of parameters etc), rather
than referring to them as aux[0], aux[1] etc. This makes the code more
readable.
Should be no functional changes.
|
|
|
|
| |
Also make the macros non-lvalues under PERL_CORE
|
|
|
|
|
|
| |
It is undefined behavior to shift a negative integer to the left. This
commit avoids that by treating the value as unsigned, then casting back
to integer for return.
|
|
|
|
| |
It should be uncommon to shift beyond a full word
|
|
|
|
|
|
|
|
| |
Essentially the same code was being used in three places, and had
undefined C behavior for some inputs.
This consolidates the code into one inline function, and rewrites it to
avoid undefined behavior.
|
|
|
|
|
| |
Fix indentation of this routine to current standards, in preparation for
making changes to it, and add a blank line for readability
|
|
|
|
| |
These are bogus warnings.
|
| |
|
|
|
|
| |
We have a macro to hide the details of this; use it
|
|
|
|
|
|
|
|
|
|
| |
This was caused by a lapse on my part about the inputs to this function
that grows memory. I was thinking the trailing NUL was included, but
it's not. This patch adds space for that to all calls of
sv_utf8_upgrade_flags_grow() in the file.
But it occurs to me that maybe the function itself should just add one
instead of having the caller do it. If you think so, let me know.
|
|
|
|
| |
for a list repeat in scalar/void context
|
|
|
|
|
|
| |
The perl build option -DPERL_GLOBAL_STRUCT_PRIVATE had bit-rotted
due to lack of smoking. The main fix is to just add 'dVAR;' to any
functions which have a pTHX arg. It's a NOOP on normal builds.
|
|
|
|
| |
Indent block newly formed by the previous commit.
|
|
|
|
|
|
|
|
| |
The functions lc() uc() ucfirst() lcfirst() and fc() are hereby expanded
to handle the differences required in Turkish locales.
No Turkish locales are recognized until later in this series of
commits.
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
I added this flag a few years ago when I revamped the overload macros
tryAMAGICbin() etc. It allowed two different classes of macros to
share the same functions (Perl_try_amagic_un/Perl_try_amagic_bin)
by indicating what type of action is required.
However, the last few commits have made those two functions able to
robustly always determine whether its an assign-type action
($x op= $y or $lex = $x op $x) or a plain set-result-on-stack operation
($x op $y).
So eliminate this flag.
Note that this makes the ops which have the AMGf_set flag hard-coded
infinitesimally slower, since Perl_try_amagic_bin no longer skips the
checks for assign-ness. But compared with the overhead of having
already called the overload method, this is is trivial.
On the plus side, it makes the code smaller and easier to understand.
|
|
|
|
| |
Indent block newly formed in the previous commit
|
|
|
|
|
|
| |
The function is unsafe because it doesn't check for running off the end
of the buffer if presented with illegal UTF-8. The only remaining use
now is from mathoms.c.
|
|
|
|
| |
This conditional is very rarely true
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Since 5.28, there has been a function that will calculate the expansion
of a string when converted into UTF-8, using per-word operations. This
means it runs 8 times faster than doing this count previously would have
taken.
I've come to believe it is better to calculate how much memory we need
than to overallocate based on worst-case scenarios. This is because in
very large strings, over allocating can lead to unnecessary inefficient
processing.
This commit changes several instances in pp.c where a string needs to be
converted to UTF-8 to not assume the worst case, but instead calculate
what's needed using the faster function.
|
|
|
|
|
|
|
|
|
|
| |
Like the previous commit, this code is adding the UTF-8 for a Greek
character to a string. It previously used Copy, but this character is
representable as two bytes in both ASCII and EBCDIC UTF-8, the only
character sets that Perl will ever supports, so we can use the
specialized code that is used most everywhere else for two byte UTF-8
characters, avoiding the function overhead, and having to treat this
character as particularly special.
|
|
|
|
|
|
|
|
|
| |
This code is adding the UTF-8 for a Greek character to a string. It
previously used Copy, but this character is representable as two bytes
in both ASCII and EBCDIC UTF-8, the only character sets that Perl will
ever supports, so we can use the specialized code that is used most
everywhere else for two byte UTF-8 characters, avoiding the function
overhead, and having to treat this character as particularly special.
|
|
|
|
|
|
| |
The function being called does everything that the code being eliminated
here did. We just pass the function the final destination instead of a
temporary.
|
| |
|
|
|
|
|
| |
This makes the test most likely to fail be first, and adding an
UNLIKELY() to it, thus saving a conditional in most instances.
|
|
|
|
|
|
| |
There is a special inline function that's used when converting a single
byte to UTF-8, that is faster than the more general one used prior to
this commit.
|
|
|
|
| |
The comments say there is an assert, but it wasn't there.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
This commit replaces all instances of code that looks like this:
uv = (iv == IV_MIN) ? (UV)iv : (UV)(-iv)
with simpler and more optimal:
uv = -(UV)iv
While -iv indeed results in an undefined behaviour when iv == IV_MIN,
-(UV)iv is perfectly well defined and does the right thing.
C standard guarantees that the result of (UV)iv (for negative iv) is
equal to iv + UV_MAX + 1 (see 6.3.1.3, paragraph 2 in C11). It also
guarantees that the result of -uv is UV_MAX - uv + 1 (6.2.5,
paragraph 9).
That means that the result of -(UV)iv is UV_MAX - (iv + UV_MAX + 1) + 1
which is equal to -iv for *all* possible negative values of iv.
[perl #133677]
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
RT #133538
The experimental ref assignment aliasing feature, when applied to
array or hash slices, was treating the slice as if it was always localized;
e.g.
\(@a[3,5,7]) = \(....);
was being interpreted as
local \(@a[3,5,7]) = \(....);
The fix is simple: check for the OPpLVAL_INTRO flag actually being set
on the op, rather than unconditionally localising the array/hash
elements.
|
|
|
|
|
|
|
|
|
|
|
|
| |
On most architectures with hardware integer division (like
x86 or aarch64), division instruction returns both the remainder
and the quotient. It means that performing modulo operation
immediately after division using the same operands is 100% free.
Essentially this commit changes "div" and "mul" into a single "div"
instruction, which results in minor speed up.
[perl #133511]
|
|
|
|
|
|
|
|
|
|
|
| |
RT #133184
pp_crypt() directly manipulates a field inside 'struct crypt_data' to work
around a bug in an ancient glibc version from circa 2002. New glibc
releases don't have this field so perl fails to compile. Make the hack
conditional on glibc version.
Stolen from a patch to the Fedora 28 distribution.
|
|
|
|
|
|
|
|
|
|
|
| |
This reverts commit 5bad3c4f3a4515aaa622eecdf6f5a84fcaff7ed9.
See RT #132142.
For now, re-introduce the bug that fails to convert weak refs to strong
refs when sorting in place.
This is commit 1 of 2.
|
|
|
|
|
|
|
|
| |
we have some coverity code scans here. They have found this
uninilialized variable in pp.c and the integer overrun in toke.c.
Though it might be possible that these are false positives (no
reasonable control path gets there), it's good to mute the scan here to
see the real problems easier.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
MSVC due to a bug doesn't merge identicals between .o'es or discard these
vars and their contents.
MEM_WRAP_CHECK_2 has never been used outside of core according to cpan grep
MEM_WRAP_CHECK_2 was removed on the "have PERL_MALLOC_WRAP" branch in
commit fabdb6c0879 "pre-likely cleanup" without explination, probably bc
it was unused. But MEM_WRAP_CHECK_2 was still left on the "no
PERL_MALLOC_WRAP" branch, so remove it from the "no" side for tidyness
since it was a mistake to leave it there if it was removed from the "yes"
side of the #ifdef.
Add MEM_WRAP_CHECK_s API, letter "s" means argument is string or static.
This lets us get rid of the "%s" argument passed to Perl_croak_nocontext at
a couple call sites since we fully control the next and only argument and
its guaranteed to be a string literal. This allows merging of 2
"Out of memory during array extend" c strings by linker now.
Also change the 2 op.h messages into macros which become string literals
at their call sites instead of "read char * from a global char **" which
was going on before.
VC 2003 32b perl527.dll section size before
.text name
DE503 virtual size
.rdata name
4B621 virtual size
after
.text name
DE503 virtual size
.rdata name
4B5D1 virtual size
|
|
|
|
|
|
|
|
| |
assign its value to a local var instead. GIMME_V can have a considerable
overhead when called in unknown context.
I audited the rest of the pp*.c files, but didn't find any similar
multiple calls.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
To avoid having to create deferred elements every time a sparse array
is pushed on to the stack, store a magic scalar in the array itself,
which av_exists and refto recognise as not existing.
This means there is only a one-time cost for putting such arrays on
the stack.
It also means that deferred elements that live long enough don’t
start pointing to the wrong array entry if the array gets shifted (or
unshifted/spliced) in the mean time. Instead, the scalar is already
in the array, so it cannot lose its place. This fix only applies
when the array as a whole is pushed on to the stack, but it could be
extended in future commits to apply to other places where we currently
use deferred elements.
|