| Commit message (Collapse) | Author | Age | Files | Lines |
| |
|
|
|
|
|
|
|
| |
This reverts commit 57e785fdb86b4eb41afd139372aab7841223385f.
This uses the new logic instead of the workaround. Thanks to
Ilmari for the reminder.
|
|
|
|
|
|
|
| |
This trivial function should get optimized out. But I couldn't get it
to work for Windows, because the two likely hdr files don't have
PL_thr_key defined in them. I suppose a new hdr file could be created
that gets included later. But I didn't think it was worth it.
|
|
|
|
| |
This trivial function will likely get optimized out
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
In something like
for $package_var (....) { ... }
or more experimentally,
for \$lvref (....) { ... }
when entering the loop in pp_enteriter, perl would pop the GV/LVREF off
the stack, but didn't bump its refcount. Thus it was possible (if
unlikely) that it could be freed during the loop. In particular this
crashed:
$f = "foo";
for ${*$f} (1,2) {
delete $main::{$f}; # delete the glob *foo
...;
}
This will become more serious when the stack becomes refcounted, as
popping something off the stack will trigger a refcount decrement on it
and thus a possible immediate free of the GV.
This commit future-proofs for loops against this by ensuring that
the refcount of the SV referred to by cx->blk_loop.itervar_u.svp is
appropriately bumped up / down on entering / exiting the loop.
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
We had a bug where we processed the first one in the flags definition. Sorting
the flags or rearranging them changes the output, which shouldn't happen.
This also fixes the handling and specification of PerlEnv_putenv(), which was
marked "si" when it should have been marked "i". This required changing its
implementation from a Perl_ prefix to a S_ prefix and regenerating.
I have run embed.pl in a loop with a local patch to shuffle the flags to see
if there were any other order dependencies. No output files changed so I
assume with this patch we are free of such bugs.
|
|
|
|
|
| |
A second compilation of a workspace would fail. The first one would
succeed because miniperl was being used, which isn't threaded.
|
|
|
|
|
|
| |
This reverts commit 81620fbedd5f5cb87f240d7809dc669cd60d0139.
The original commit was wrongly blamed for breakage, when it was the
harness parallelism that was at fault; since fixed, mostly.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
In GH 20435 many typos in our C code were corrected. However, this pull
request was not applied to blead and developed merge conflicts. I
extracted diffs for the individual modified files and applied them with
'git apply', excepting four files where patch conflicts were reported.
Those files were:
handy.h
locale.c
regcomp.c
toke.c
We can handle these in a subsequent commit. Also, had to run these two
programs to keep 'make test_porting' happy:
$ ./perl -Ilib regen/uconfig_h.pl
$ ./perl -Ilib regen/regcomp.pl regnodes.h
|
|
|
|
|
|
| |
This reverts commit 5be23dd97e360d19c8abb4c0c534f5d5f9d3691a.
The original patch seems to break DBM.
|
|
|
|
| |
These short functions are reasonably frequently used.
|
|
|
|
|
|
|
| |
These short functions are moved from util.c to inline.h.
savesharedpv() and savesharedpvn() aren't moved because there is a
complication of needing also to move croak_no_mem(), which could be
done, but are these called enough to justify it?
|
|
|
|
|
|
|
| |
Fix most compiler warnings caused by building Perl extensions with
-Wcast-qual. This is realized by changing the type of multiple T *
arguments into const T * and by changing a few (T *) casts
into (const T *).
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
This splits a bunch of the subcomponents of the regex engine into
smaller files.
regcomp_debug.c
regcomp_internal.h
regcomp_invlist.c
regcomp_study.c
regcomp_trie.c
The only real change besides to the build machine to achieve the split
is to also adds some new defines which can be used in embed.fnc to control
exports without having to enumerate /every/ regex engine file. For
instance all of regcomp*.c defines PERL_IN_REGCOMP_ANY, and this is used
in embed.fnc to manage exports.
|
|
|
|
|
|
|
|
|
| |
This function conveniently sets the ->op_targ field of the returned op,
making it neater to use inline in larger trees of new*OP functions used
to build optree fragments.
This function is implemented as `static inline`, for speed and code-size
reasons.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Prior to this commit, when hopping forwards, and the initial position to
hop from is a continuation byte, it treats it and each such successive
one as a single character until it gets to a start byte, and switches
into normal mode.
In contrast, in hopping backwards, all the consecutive continuation
bytes are considered to be part of a single character (as they indeed
are).
Thus there is a discrepancy between forward/backwards hopping; and the
forward version seems wrong to me.
This commit removes the discrepancy. There is no change in behavior if
the starting position is to the beginning of a character. All calls in
the core except for the API test are of this form.
But, if the initial position is in the middle of a character, it now
moves to the beginning of the next character, subtracting just 1 from
the count of characters to hop (instead of subtracting however many
continuation bytes there are). This is how I would have expected it to
work all along.
Succinctly, getting to the next character now consumes one hop count, no
matter the direction nor which byte in the character is the starting
position.
|
| |
|
|
|
|
| |
Under verbose debugging, this shows cases where folds didn't match.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
This changes utf8_to_bytes() to do a per-word initial scan to see if the
source is actually downgradable, before starting the conversion. This
is significantly faster than the current per-character scan. However,
the speed advantage evaporates in doing the actual conversion to being a
wash with the previous scheme.
Thus it finds out quicker if the source is downgradable.
cache grind yields this, based on a 100K character string; the
non-downgradable one has the next character after that be the only one
that's too large.:
Key:
Ir Instruction read
Dr Data read
Dw Data write
COND conditional branches
IND indirect branches
_m branch predict miss
_m1 level 1 cache miss
_mm last cache (e.g. L3) miss
- indeterminate percentage (e.g. 1/0)
The numbers represent relative counts per loop iteration, compared to
blead at 100.0%.
Higher is better: for example, using half as many instructions gives 200%,
while using twice as many gives 50%.
unicode::bytes_to_utf8_legal_API_test
Downgrading 100K valid characters
blead proposed
------ ------
Ir 100.00 99.99
Dr 100.00 100.03
Dw 100.00 100.04
COND 100.00 100.05
IND 100.00 100.00
COND_m 100.00 87.25
IND_m 100.00 100.00
Ir_m1 100.00 123.25
Dr_m1 100.00 100.18
Dw_m1 100.00 99.94
Ir_mm 100.00 100.00
Dr_mm 100.00 100.00
Dw_mm 100.00 100.00
unicode::bytes_to_utf8_illegal
Finding too high a character after 100K valid ones
blead fast
------ ------
Ir 100.00 188.91
Dr 100.00 179.77
Dw 100.00 66.75
COND 100.00 278.47
IND 100.00 100.00
COND_m 100.00 88.71
IND_m 100.00 100.00
Ir_m1 100.00 121.86
Dr_m1 100.00 100.01
Dw_m1 100.00 100.03
Ir_mm 100.00 100.00
Dr_mm 100.00 100.00
Dw_mm 100.00 100.00
|
|
|
|
|
|
|
|
|
| |
Implemented as a static inline function call, so that it can return the
padname pointer itself. This would allow use in expressions such as
ptr->field = PadnameREFCNT_inc(pn);
That makes it similar to the familiar SvREFCNT_inc() macro.
|
|
|
|
|
| |
Prints more levels of C backtrace on SV allocation operations. Also
prints the perl caller file + line number.
|
| |
|
|
|
|
|
|
|
| |
This reverts commit d6ad3b72778369a84a215b498d8d60d5b03aa1af
and adds comments that it existed. This is so that this work which
isn't really needed based on current usage in core isn't lost, and can
be used in the future.
|
|
|
|
|
|
|
| |
This should speed up backing up a large distance in a UTF-8 string. But
we don't actually do that in core. I did this work 5 years ago before I
realized this. Rather than throw it away, this commit gets it into the
history, and the next commit will revert it.
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
A long standing bug in Perl that has gone undetected is that the array
is global that is created when changing locales and tells fc() and qr//i
matching what the folds are in the new locale.
What this means is that any program only has one set of fold definitions
that apply to all threads within it, even if we claim that the locales
are thread-safe on the given platform. One possibility for this going
undetected so long is that no one is using locales on multi-threaded
systems much. Another possibility is that modern UTF-8 locales have the
same set of folds as any other one.
It is a simple matter to make the fold array per-thread instead of
per-process, and that solves the problem transparently to other code.
I discovered this stress-testing locale handling under threads. That
test will be added in a future commit.
In order to keep from having a dTHX inside foldEQ_locale, it has to have
a pTHX_ parameter. This means that the other functions that function
pointer variables get assigned to point to have to have an identical
signature, which means adding pTHX_ to functions that don't require it.
The bodies of all these are known to the compiler, since they are all
in inline.h or in the same .c file as where they are called. Hence the
compiler can optimize out the unused parameter.
Two calls of STR_WITH_LEN also have to be changed because of C
preprocessor limitations; perhaps there is another way to do it that I'm
unfamiliar with.
|
| |
|
|
|
|
|
|
|
| |
There was less benefit in doing this prior to newSV_type becoming an inline
function. Now that it is, inlining av_new_alloc can help compilers eliminate
redundant setting of AvMAX/AvFILLp and unnecessary branches of any following
inlined calls to av_store_simple.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
A simplified version of av_push, along the lines of av_store_simple and
av_fetch_simple. This function is trivial, but having it makes refactoring
of existing code easier to read.
For example, changing:
av_push(some_av, val);
to:
av_push_simple(some_av,val);
is easier to read than:
av_store_simple(some_av, AvFILLp(some_av) + 1, val)
|
|
|
|
|
| |
so that all functions inlined from sv.* are in one place. This was
suggested by @khw.
|
|
|
|
| |
So that they will evaluate the argument just once.
|
| |
|
|
|
|
| |
by making the macro instead an inline function
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
The new bool "type" does not have the usual complement of utility
functions and macros. It only has one encapsulating function, which is
perfectly reasonable for most use cases where one wants to test if an
SV* is a bool, but does a bit too much if one is working on a
serialization tool which is likely to want to unroll a nice chunk of the
logic.
The new type also lacks the usual cohort of utility functions to create
new bool SV's.
This patch adds the following functions:
newSVbool(const bool bool_val)
newSV_true()
newSV_false()
sv_set_true(SV *sv)
sv_set_false(SV *sv)
sv_set_bool(SV *sv, const bool bool_val)
And the following macros:
SvIandPOK(sv)
SvIandPOK_off(sv)
SvIandPOK_on(sv)
The following three are intended very specifically for writing
serialization code like for Sereal, where it is reasonable to want to
unroll the logic contained in Perl_sv_isbool() and SvTRUE(). They are
documented as "you dont want to use this except under special
circumstances".
SvBoolFlagsOK(sv)
BOOL_INTERNALS_sv_isbool(sv)
BOOL_INTERNALS_sv_isbool_true(sv)
BOOL_INTERNALS_sv_isbool_false(sv)
SvBoolFlagsOK() is documented as being the same as SvIandPOK(),
but this abstracts the intent from the implementation.
|
| |
|
| |
|
| |
|
|
|
|
|
| |
Commit d1e771d8c533168553df9b2a858d967f707fc9fe broke EBCDIC builds by
doubly encoding some UTF-8 characters.
|
|
|
|
|
|
|
|
|
|
|
|
| |
When a function outside of sv.c creates a SV via newSV(0):
* There is a call to Perl_newSV
* A SV head is uprooted and its flags set
* A runtime check is made to effectively see if 0 > 0
* The new SV* is returned
Replacing newSV(0) with newSV_type(SVt_NULL) should be more efficient,
because (assuming there are SV heads to uproot), the only step is:
* A SV head is uprooted and its flags set
|
|
|
|
|
|
|
| |
Commit a460925186154b270b7a647a4f30b2f01fd97c4b broke calling this and
related functions from outside of core Perl, but only when the input is
empty (which is an error anyway, so was not caught except for deliberate
API edge case tests in Devel::PPPort).
|
|
|
|
| |
*s may not be valid here; check first.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Most such conversions occur in the inlined function
Perl_utf8n_to_uvchr_msgs(), which several macros like utf8n_to_uvchr()
expand to.
This commit effectively removes a conditional from inside the loop, and
avoids some conditionals when converting the common case of the input
being UTF-8 invariant (ASCII on ASCII platforms).
Prior to this commit, the code did something different the first time
through the loop than the other times. By hoisting that to pre-loop
initialization, that conditional is removed from each iteration. That
meant rearranging the loop to be a while(1), and have its exit
conditions in the middle.
All calls to this function from the Perl core pass in a non-empty
string. But outside calls could conceivably pass an empty one which
could lead to reading outside the buffer. An extra check is added to
non-core calls, as is already done elsewhere.
This change means that calls from core execute no more conditionals than
the typical:
if (UTF8_IS_INVARIANT(*s)) {
code_point = *s;
}
else {
code_point = utf8n_to_uvchr(s, ...)
}
I'm therefore thinking these can now just be replaced by the simpler
code_point = utf8n_to_uvchr(s, ...)
without a noticeable hit in performance. The essential difference is
that the former gets its code point from the string already being
examined, and the latter looks up data in a 450 byte static array that
is referred to constantly, so is likely to be cached.
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
On threaded builds CopFILEAV() calls gv_fetchfile(), which always
created the *{"::_<filenamehere"} glob, so the attempted clean up
here could recreate the glob, even if it has already been removed
when cleaning up a string eval.
To avoid this, add CopFILEAVn() that never creates the glob,
nor the AV so that the clean up never adds new objects.
This change makes the check for PL_phase unnecessary, but that check
is much cheaper than the call for gv_fetchfile_flags() that the
macro hides, so retain the check.
|
|
|
|
| |
Fixes #19205
|
|
|
|
| |
We no longer support Visual C++ 2012 and older.
|
|
|
|
|
|
|
| |
This reverts commit 632ce96a35d784df9e43bc8ad87b4e8f1f24a590.
Sereal hasn't been fixed yet to deal with the fallout of this change,
so we postpone this change for a later moment
|
|
|
|
|
|
|
|
|
| |
The core now permits some C99 code, so extensions need to ensure that any
C compiler flags they add or change permit C99 code.
This code is inlined by XS extensions in the core and on CPAN. The intent
is that this commit should show up for any failure bisection, making it
obvious what the cause is, and what the fix needs to be.
|