| Commit message (Collapse) | Author | Age | Files | Lines |
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
This commit introduces a new OP to replace simple cases
of OP_SASSIGN and OP_PADSV.
For example, 'my $x = 1' is currently implemented as:
1 <;> nextstate(main 1 -e:1) v:{
2 <$> const(IV 1) s
3 <0> padsv[$x:1,2] sRM*/LVINTRO
4 <2> sassign vKS/2
But now will be turned into:
1 <;> nextstate(main 1 -e:1) v:{
2 <$> const(IV 1) s
3 <1> padsv_store[$x:1,2] vKMS/LVINTRO
This intended to be a transparent performance optimization.
It should be applicable for RHS optrees of varying complexity.
|
|
|
|
|
|
|
|
| |
If this flag is set, then the CvXSUBANY(cv).any_sv pointer will have its
reference count decremented when the CV itself is freed. This is useful
for XS extensions that wish to store extra data in here. Without this
flag, such extensions have to resort to using magic with a 'free'
function to perform this work.
|
|
|
|
|
| |
The next commits will expose an existing Windows bug which will get
fixed in a later set of commits
|
|
|
|
| |
Improve test descriptions, with feedback from Tony Cook.
|
|
|
|
|
|
|
|
|
|
|
| |
Several of these were missing:
cMETHOP, cMETHOPo, kMETHOP
Also, the field-accessing ones:
cMETHOP_meth cMETHOP_rclass cMETHOPo_meth cMETHOPo_rclass
This commit adds them all, and use them to neaten other code where
appropriate.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
File::Find's code expects unix-style paths and it manipulates them using
basic string operations. That code is very fragile, and ideally we
should make it use File::Spec, but that would involve rewriting almost
the whole module.
Instead, we made it convert backslashes to slashes and handle drive
letters.
Note from xenu: this commit was adapted from the PR linked in this
blogpost[1]. I have squashed it, written the commit message and slightly
modified the code.
[1] - https://www.nu42.com/2021/09/canonical-paths-file-find-way-forward.html
Fixes #19995
|
|
|
|
|
|
| |
This commit doesn't contain any functional changes. If you're
seeing it in "git blame" output, try using -w switch, it will
hide whitespace-only changes.
|
|
|
|
| |
Not since 0d00729c03a1f68e1b51e986d1ce9000b0e3d301.
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
It turns out that this method has been mostly broken since its
introduction in 1998. It will normally successfully turn debugging on
with a 'true' argument but will fail to disable again with a 'false'
argument.
This is for two reasons. First the XS code only ever sets the internal
debugging flag, never disables it, and second, it was checking the
truthfulness of the arg one too high on the stack and thus was actually
checking the CV which had just been popped off the stack, which happened
to be true.
|
| |
|
|
|
|
|
|
| |
The implicit method calls use by `use` and `no` were setting the
OPf_SPECIAL bit on the ENTERSUB op, but that has never made any
difference to anything.
|
|
|
|
|
| |
If no LC_ALL, there won't be an LC_ALL() sub. Instead use the string
'LC_ALL" and an explicit check to see if it is there.
|
| |
|
| |
|
|
|
|
| |
Also renames the CvMETHOD* macro family to CvNOWARN_AMBIGUOUS*
|
|
|
|
|
|
|
|
| |
Make this recently-added test function always return something,
so that assigning its return value to a scalar variable doesn't underflow
the stack.
(I spotted this while debugging something else.)
|
| |
|
| |
|
|
|
|
|
| |
This is a follow on to 0e647b0520a120213d2074ede2609a10076f2f8d, to
finish changing the variable names to not be as confusing.
|
|
|
|
|
|
| |
These for hopping within a string had two items whose name both
contained 'offset', confusing things. One of them is the number of
characters to hop. Rename for clarity.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
GH #19188
in something like
sub foo { goto &xs_sub }
if the XS subroutine tries to get its caller context using GIMME_V,
it used to always be reported as scalar, since the OP_GOTO is the
current op being executed, and that op is marked as scalar.
The correct answer should be to return the context of the caller of
foo(), but that information is lost as, just before calling the XS sub,
pp_goto pops the CXt_SUB off the context stack which holds the recorded
value of the context of the caller.
The fix in principle is for goto, just before calling the XS sub, to
grab the gimme value from the about-to-be-popped CXt_SUB frame, and set
OP_GOTO op's op_flag field with that gimme value.
However, modifying ops at runtime isn't allowed, as ops are shared
between threads. So instead set up a fake copy of the OP_GOTO and alter
the gimme value in that instead.
I'm pretty confident that on an exception, a LEAVE_SCOPE() will always
be done before the JMPENV_JUMP(), so PL_op will be restored to its
original value *before* the CPU stack is restored to it's old value
(leaving the temporary OP_GOTO as garbage in an abandoned stack frame).
|
|
|
|
|
|
|
|
|
|
|
| |
Rename the `PADNAMEt_*` constants to `PADNAMEf_*`, as they're supposed
to represent bitflags, not a type enumeration.
Also updated the `B` and `B::Deparse` modules to make use of the new modern
names (and avoid the old `SVpad_*` flags).
Also added `PADNAMEt_*` back-compat defines, guarded by `#ifndef PERL_CORE`
so as not to permit their use accidentally within perl core.
|
|
|
|
|
| |
Also tweak the implementation of the other two boolean builtins (is_bool
& is_weak) to be slightly more efficient.
|
| |
|
| |
|
| |
|
|
|
|
|
|
|
|
|
| |
A platform shouldn't be required to use the Posix 2008 locale handling
functions if they are present. Perhaps they are buggy. So, a separate
define for using them was introduced, USE_POSIX_2008_LOCALE. But until
this commit there were cases that were looking at the underlying
availability of the functions, not if the Configuration called for their
use.
|
|
|
|
|
|
|
| |
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.
|
|
|
|
|
|
| |
Ultrix has been removed. Ultrix was the native Unix-like operating
system for various Digital Equipment Corporation machines. Its final
release was in 1995.
|
|
|
|
| |
Properly indent some nested preprocessor directives
|
|
|
|
|
| |
This #defines a macro and uses it to populate a structure, so that
strings don't have to be typed twice.
|
|
|
|
|
|
|
|
|
|
|
| |
On Win32 long is only 32-bits (even for x86_64), which meant
file sizes were limited to 2GB.
This successfully runs the example code, and can successfully read
all the keys back.
I didn't add a test, since creating a 2GB (or 8GB for the issue test)
would be unfriendly.
|
|
|
|
|
| |
This removes the last core use of the trivial accessor functions
get_op_names() and get_op_descs().
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
We can also remove many dMY_CXT declarations, as they are no longer needed
(and generate a now unused variable in threaded builds, hence compiler
warnings).
Previously it was part of the module's my_cxt_t, because it was a value
calculated from the interpreter variable PL_maxo. But PL_maxo itself is *not*
a variable - it was converted to a #define in Aug 2016 by commit
8d89205aa6324e7d:
Remove PL_maxo
We have an interpreter variable using memory, PL_maxo, which is
defined to be the same as MAXO, a #defined constant. As far as I can
tell, it is never used in lvalue context, in core or on CPAN, except
for the initialisation in intrpvar.h.
It can simply be removed and replaced with a macro defined as equiva-
lent to MAXO.
It was added in this commit:
commit 84ea024ac9cdf20f21223e686dddea82d5eceb4f
Author: Perl 5 Porters <perl5-porters.nicoh.com>
Date: Tue Jan 2 23:21:55 1996 +0000
perl 5.002beta1h patch: perl.h
5.002beta1 attempted some memory optimizations, but unfortunately
they can result in a memory leak problem. This can be
avoided by #define STRANGE_MALLOC. I do that here until
consensus is reached on a better strategy for handling the
memory optimizations.
Include maxo for the maximum number of operations (needed
for the Safe extension).
But apparently it is not needed for the Safe extension (tests pass
without it).
What the author of that commit didn't realise was that Opcode had been split
out from Safe - the code in question is in this module not Safe.
|
| |
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Originally this came up from a Coverity complaint.
GDBM_SETMAXMAPSIZE accepts any of unsigned, unsigned long or size_t,
but GDBM_GETMAXMAPSIZE only accepts size_t. Since this is the only
case that uses unsigned values we can safely switch it to size_t.
Unfortunately Coverity's analysis was pretty broken, it complained
about c_uv being uninitialised at the call to newSVuv, but its example
code flow went through the opt_dbname case, which sets vptr to != &c_uv
so the newSVuv() wouldn't execute anyway.
Before looking closely at the Coverity analysis and after finding the
bug fixed here I thought for a moment that Coverity had been tracing
into libgdbm, which could have caught the actual problem, but alas
that was not the case.
I expect this fix will not close CID 351943, and if it remains after
this is applied I'll close it as a false positive.
CID 351943.
|
|
|
|
|
|
| |
With the explicit flush this test will fail when PERLIO=stdio, because
stdio defaults to block-based buffering on pipes and therefore the
output will come out wrong.
|
|
|
|
|
|
|
| |
Now environ isn't owned by Perl and calling setenv/putenv in XS code
will no longer result in memory corruption.
Fixes #19399
|
| |
|
|
|
|
|
|
| |
This commit adds two new helpers to B::PADNAME.
- IsUndef to check if the PADNAME is PL_padname_undef
- GEN to access to the xpadn_gen slot of the pad.
|
|
|
|
|
|
|
|
| |
Bool are using PVNV. It makes it more convenient
to provide these helpers at the top level for any SVs.
So we can easily check if the SV is a boolean and check
if it's true or false.
|
|
|
|
|
|
| |
We do not have any tests for the bool internals. This creates a bunch of
them to test and validate the various new API calls for creating and
setting bools.
|
| |
|
|
|
|
|
| |
This line has a syntax error in it. Fix it, and split into two lines so
doesn't wrap on output in an 80 column terminal window
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
The new
for my ($x,$y,...) (...) { ... }
syntax has a couple of problems in the degenerate case of a single
variable:
for my ($x) (...) { ... }
First, the loop variable is marked as lexical, but not as a variable
to be introduced. So it behaves roughly as if written like:
{ my $x; for $x (...) { ... } }
I can't think of any user-visible runtime change in behaviour this bug
causes, so I haven't included a test for it.
Second, it was being incorrectly deparsed as
for $x (...) { ... }
(i.e. without the 'my').
This commit fixes both of these issues.
The basic problem is that the parser, in the case of multiple vars,
passes a list subtree of PADSVs as the 'sv' argument of Perl_newFOROP,
but in the case of a single var, passes a single PADSV op instead.
This single PADSV doesn't have the LVINTRO flag set, so is
indistinguishable from plain
my $x; for $x ....
This commit makes the parser set the OPf_PARENS flag on the lone PADSV
to signal to newFOROP() that it's a degenerate 1-var list, and
newFOROP() sets the OPf_PARENS flag on the ENTERITER op to signal to the
deparser that this is "for my (...)" syntax, even if it only has a
single var.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
The debug output leaks a large amount of information about the
implementation details of the regex engine and as such is highly likely
to change based on almost any change to the regex engine. Also from time
to time we make changes to the output to improve legibility, etc. While
the output of C<use re 'debug'> is intended for user consumption as well
as for debugging the regex engine itself I believe that we should not
provide any backcompat guarantees about its specific contents or format.
Similarly the list of options we provide for C<use re 'Debug'> may be
affected by changes in the internals of the engine, rending old
categories irrelevant, or requiring new categories to be added.
This patch adds language to the C<re.pm> docs that stipulate that the
debug options we provide under C<use re 'Debug'> and the output we
provide from C<use re 'debug'> and C<use re 'Debug'> are subject to
change without notice at any major or minor release.
While I do not anticipate changes to the output in a minor release I
believe it is wise to specify that we do not commit ourselves to
consistency in this regard in any way. For instance were the situation
to arise that we had a security issue or serious performance issues or
some other strong justification to make a change in a minor release then
this could very well change the output we provide or the options we
support.
|
|
|
|
|
|
|
|
| |
* ext/GDBM_File/Makefile.PL: Don't protect basic error codes by
ifdefs: they are not macros in recent versions of GDBM. Besides,
they are known to exist in any GDBM version.
For: https://github.com/Perl/perl5/pull/19602
|