| Commit message (Collapse) | Author | Age | Files | Lines |
|
|
|
|
|
|
|
|
|
| |
In a few places, SVs can be created more efficiently or new SVs
can be assigned to more efficiently. Small changes included:
* Use sv_setpvn_fresh instead of sv_setpvn
* Use sv_mortalcopy_flags instead of sv_newmortal + sv_setsv_flags
* newSVsv_flags instead of newSV + sv_setsv_flags
* sv_newmortal instead of sv_2mortal(newSV(0))
* Remove a SvGROW(sv, 257) following a newSV(257)
|
| |
|
|
|
|
| |
break when it's done
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Adds syntax `defer { BLOCK }` to create a deferred block; code that is
deferred until the scope exits. This syntax is guarded by
use feature 'defer';
Adds a new opcode, `OP_PUSHDEFER`, which is a LOGOP whose `op_other` field
gives the start of an optree to be deferred until scope exit. That op
pointer will be stored on the save stack and invoked as part of scope
unwind.
Included is support for `B::Deparse` to deparse the optree back into
syntax.
|
|
|
|
|
| |
This avoids the SvUTF8(tmpstr) ? -(I32)SvCUR(tmpstr) : (I32)SvCUR(tmpstr)
code dance.
|
| |
|
|
|
|
| |
lives in pp_hot.c, not next to its sibling functions in pp_ctl.c
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
The try change added code to pp_return to skip past try contexts
when looking for the sub/sort/eval context to return from.
This was only needed because cx_pusheval() sets si_cxsubix to the
current frame and try uses that function to push it's context, that
value is then used by the dopopto_cursub() macro to shortcut
walking the context stack.
Since we don't need to treat try as a sub for return, list vs array
checks or lvalue sub checks, don't set si_cxsubix on try.
|
| |
|
|
|
|
| |
Add a guard to the chunk introduced by a1325b902d for "try" support.
|
|
|
|
|
|
|
|
|
| |
* Add feature, experimental warning, keyword
* Basic parsing
* Basic implementation as optree fragment
See also
https://github.com/Perl/perl5/issues/18504
|
|
|
|
|
|
| |
CxTRYBLOCK would be confusing when we add a real CxTRY for try/catch
Also renames the associated CXp_TRYBLOCK flag to CXp_EVALBLOCK
|
|
|
|
|
|
|
|
|
|
|
| |
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.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
These were occurring on FreeBSD smokes.
warning: implicit conversion from 'IV' (aka 'long') to 'double' changes value from 9223372036854775807 to 9223372036854775808 [-Wimplicit-int-float-conversion]
9223372036854775807 is IV_MAX. What needed to be done here was to use
the NV containing IV_MAX+1, a value that already exists in perl.h
In other instances, simply casting to an NV before doing the comparison
with the NV was what was needed.
This fixes #18328
|
|
|
|
|
|
|
|
|
|
|
| |
This feature allows documentation destined for perlapi or perlintern to
be split into sections of related functions, no matter where the
documentation source is. Prior to this commit the line had to contain
the exact text of the title of the section. Now it can be a $variable
name that autodoc.pl expands to the title. It still has to be an exact
match for the variable in autodoc, but now, the expanded text can be
changed in autodoc alone, without other files needing to be updated at
the same time.
|
| |
|
|
|
|
|
| |
This uses a new organization of sections that I came up with. I asked
for comments on p5p, but there were none.
|
|
|
|
|
|
|
|
|
|
| |
Fix #18063
During global destruction make sure we preserve
the string by using mortalcopy.
This is an update on 8c86f0238ecb5f32c2e7fba36e3edfdb54069068
change which avoided sv_mortalcopy in favor of sv_2mortal.
|
| |
|
|
|
|
|
| |
It only does anything under PERL_GLOBAL_STRUCT, which is gone.
Keep the dNOOP defintion for CPAN back-compat
|
|
|
|
|
| |
Also eliminate USE_HEAP_INSTEAD_OF_STACK and
SETSOCKOPT_OPTION_VALUE_T, since Symbian was the only user of those.
|
|
|
|
|
| |
Mostly in comments and docs, but some in diagnostic messages and one
case of 'or die die'.
|
|
|
|
|
|
|
|
|
|
|
| |
Previously require would check for the specific \&PL_sv_undef
SV in %INC, this meant that if %INC was copied, or undef
assigned to a member the entry would erroneously be treated as if
a previous require of that file was successful.
So check for SvOK() instead, with appropriate magic tests.
fixes #17428
|
|
|
|
|
|
|
|
|
|
|
| |
This includes:
- remove them from the API
- simplify quadmath_format_single()'s interface, and rename it
to match the new interface
fixes #17288
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Perform only a bit check instead of a much more expensive hash
lookup to test features.
For now I've just added a U32 to the cop structure to store the bits,
if we need more we could either add more bits directly, or make it a
pointer.
We don't have the immediate need for a pointer that warning do since
we don't dynamically add new features during compilation/runtime.
The changes to %^H are retained so that caller() can be used from perl
code to check the features enabled at a given caller's scope.
|
|
|
|
|
|
|
| |
My recent merge commit v5.31.3-198-gd2cd363728 (temporarily reverted by
v5.31.4-0-g20ef288c53) added a si_cxsubix field to the stackinfo struct
to track the most recent sub context. This field wasn't being restored
correctly with 'goto &XS-sub', and broke Test::Deep.
|
|
|
|
|
|
|
|
| |
original merge commit: v5.31.3-198-gd2cd363728
reverted by: v5.31.4-0-g20ef288c53
The commit following this commit fixes the breakage, which that means
the revert can be undone.
|
|
|
|
|
|
|
|
|
|
|
|
| |
This reverts commit d2cd363728088adada85312725ac9d96c29659be, reversing
changes made to 068b48acd4bdf9e7c69b87f4ba838bdff035053c.
This change breaks installing Test::Deep:
...
not ok 37 - Test 'isa eq' completed
ok 38 - Test 'isa eq' no premature diagnostication
...
|
|
|
|
|
|
| |
This function makes use of PL_curstackinfo->si_cxsubix to avoid the
overhead of a call to block_gimme() when the context of the op is
unknown.
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
This tracks the most recent sub/eval/format context pushed onto the
context stack. Then make dopopto_cursub use it.
The previous value is saved in the cxt struct, and is restored whenever
the context is popped.
This adds a tiny overhead for every sub call, but speeds up other
operations, such as determining the caller context when returning a
value from a sub - this has to be dpne for every sub call where the last
expression is context sensitive, so its often a win.
|
|
|
|
| |
short for dopoptosub(cxstack_ix), a common idiom in that file.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
RT #134409
In a repeated substitution, where the replacement is an expression,
and when the last replacement value is both tainted and utf8, and
everything earlier has been plain, and the final string is suitably
shorter than the original, a panic resulted:
sv_pos_b2u: bad byte offset, blen=1, byte=6
This is because when at the end, taint magic is being being added to
the target of the s///, the target SV has already had its buffer updated
with the shorter result string, but still has the pos() magic set which
corresponded to the original longer string (this pos value would, in the
normal flow of things, be reset shortly afterwards).
One quirk of sv_magic(), which adds any sort of magic including taint
magic, is that it always checks for the presence of pos() magic, and if
so, converts the byte to utf8 offset if necessary. This was seeing the
invalid pos() offset and panicing.
The check was added by v5.19.3-111-g25fdce4a16:
"Stop pos() from being confused by changing utf8ness"
It seems like a bit of hack to recalibrate pos() each time sv_magic()
is called, but I've left that alone (sleeping dogs and all that) and
instead added a hack in the taint code path in pp_substcont to reset pos
before setting taint.
|
|
|
|
|
|
|
|
| |
when unwinding.
Since except_sv might be ERRSV we try to preserve it's value,
if not the actual SV (which we have an extra refcount on if it is
except_sv).
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Previously, *any* string beginning with 0, including the string "0"
itself, would be subject to the magic string auto-increment, instead of
being treated like a number. This meant that "-2".."-1" was the same as
-2..-1 and "1".."-1" was the same as 1..-1, but "0".."-1" was the same
as "0".."99".
This patch fixes that inconsistency, while still allowing ranges like
"01".."31" to produce the strings "01", "02", ... "31", which is what
the "begins with 0" exception was intended for.
This patch also expands the documentation in perlop and states the rules
for the range operator in list context with both operands being strings
more explicitly.
See also #18165 and #18114.
|
| |
|
|
|
|
|
| |
This moves calculations definitely to compile time; some optimizing
compilers may already do this, but some may not.
|
|
|
|
|
|
|
|
|
|
|
|
| |
$ ./perl -Ilib -Xe 'goto foo; glob do { foo: $1}'
Can't "goto" into a binary or list expression at -e line 1.
What binary or list expression? True, glob has the *precedence* of a list operator, but so does not:
$ ./perl -Ilib -Xe 'goto foo; not do { foo: $1}; prt "ok\n"'
ok
Glob seems to be the only exception, due to its ‘special’ op tree.
|
|
|
|
|
| |
This particular case does not risk any stack corruption, and there is
a CPAN module depending on it working (PerlX::AsyncAwait).
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
When goto looks for a label, it builds up a list of ops to enter. But
it begins its search a little too far out relative to the ‘goto’.
Hence, the first op gets skipped.
In 6d90e983841, I forbade same cases of inward goto-into-expression to
avoid stack corruption and crashes. I did this by pushing a marker
on to the list of ops to enter, indicating that an error should be
thrown instead.
Because goto starts the search too far up the context stack, it would
sometimes end up looking inside an expression, which would cause the
first op on the entry list to be such a marker, meaning that the next
item, which should have been skipped, would not be.
That could really screw up the context stack for cases like:
my $e = eval { goto label; label: }
because the entry list would be:
<croak-marker> entertry
instead of the previous:
entertry
Hence, entertry (which enters eval{}) would be executed from *within*
the eval, causing the exit of the eval to leave an eval on the context
stack. Crashes ensued.
This commit fixes it by checking whether we have moved past the begin-
ning of the list of entry ops before pushing a croak-marker on to it.
Goto’s implementation is really complex, and always has been. It
could be greatly simplified now thot ops have parent pointers. But
that should wait for another developement cycle.
|
|
|
|
|
|
|
|
|
|
| |
More precisely, goto-to-jump-into-the-parameter-of-a-string-eval,
which is tested in goto.t as of 6d90e98384, but fails as of that
commit under PERL_UNICODE, because entereval gets a second kid
op (a hintseval op) and ‘looks like’ a list operator, which
6d90e98384 generally forbad.
The easiest way to fix this is simply to add another exception.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
This commit in general forbids entry into the parameter of a binary or
list operator, to avoid crashes and stack corruption.
In cases like
goto f;
push @array, do { f: }
and
goto f;
$a + do { f: };
it’s not possible to fix this in general. Cases like
goto f;
do { f: } + $a;
(jumping into the first parameter) have never caused problems, but I
went ahead and forbad that usage too, since it would be too compli-
cated to figure out exactly which parameter is being jumped into.
(It’s not impossible; it would just double the amount of code used to
find labels.)
List operators taking just a simple list, such as die(), have never
worked properly, because goto() bypasses the pushmark. They could be
made to work, but that would require extra work to distinguish cases
like push and print that have a first operand (sometimes implicit for
print) of a specific type. I figured it was easier just to forbid
jumping into any list operator. It’s also much easier to document.
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
The pumpking has determined that the CPAN breakage caused by changing
smartmatch [perl #132594] is too great for the smartmatch changes to
stay in for 5.28.
This reverts most of the merge in commit
da4e040f42421764ef069371d77c008e6b801f45. All core behaviour and
documentation is reverted. The removal of use of smartmatch from a couple
of tests (that aren't testing smartmatch) remains. Customisation of
a couple of CPAN modules to make them portable across smartmatch types
remains. A small bugfix in scope.c also remains.
|
|
|
|
| |
Fixes [perl #132634].
|
| |
|
|\ |
|
| |
| |
| |
| |
| | |
The names of ops, context types, functions, etc., all change in accordance
with the change of keyword.
|
| | |
|
| |
| |
| |
| |
| | |
The leaveloop op type can already do the whole job, with leavegiven being
a near duplicate of it. Replace all uses of leavegiven with leaveloop.
|
| |
| |
| |
| |
| |
| | |
The message for leaving a "when" block outside a loop had different
wording from the message for performing "next" et al outside a loop.
Make the "when" message consistent with the existing loop control ones.
|
| |
| |
| |
| |
| | |
These were used to identify foreach loops that qualify as topicalizers.
That's no longer a relevant classification.
|