| Commit message (Collapse) | Author | Age | Files | Lines |
|
|
|
|
|
|
|
|
|
|
|
|
| |
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.
|
|
|
|
|
| |
The names of ops, context types, functions, etc., all change in accordance
with the change of keyword.
|
|
|
|
|
| |
These were used to identify foreach loops that qualify as topicalizers.
That's no longer a relevant classification.
|
|
|
|
| |
A "given" construct is now officially a one-iteration loop.
|
|
|
|
| |
This context frame type doesn't need to cater for "given" any more.
|
|
|
|
|
|
|
|
|
|
| |
When giving a function-style prototype for a macro taking a literal string
parameter, put a string literal in place of a type for that parameter.
This goofy appearance makes it obvious that this isn't really a function,
and clues the reader in that the parameter can't actually be an arbitrary
expression of the right type. Also change the nonsensical "NUL-terminated
literal string" to "literal string" to describe these parameters.
Fixes [perl #116286].
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
RT #131942
My commit v5.27.1-114-g9449f0d added a field je_old_stack_hwm to
the jmpenv structure on debugging builds.
However, one field in the interpreter structure is a JMPENV (rather than
JMPENV*), so this can make the interpreter structure size vary on
debugging and non-debugging builds.
This is usually a no-no, since it breaks re.pm, which recompiles
the various re functions with DEBUGGING enabled, even on non-debugging
fields.
This was supposed to be handled by the extra '!defined DEBUGGING_RE_ONLY'
condition, and indeed all core XS modules including re.xs work ok.
However, it seems to have broken several CPAN modules. I still don't
understand why, but the easiest fix is to just always include the
debugging je_old_stack_hwm field in all builds.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
RT #131732
With v5.27.1-66-g87058c3, I introduced a DEBUGGING-only mechanism in the
runops loop for checking whether an op extended the stack by as many slots
as values it returned on the stack. It did this by setting a
high-water-mark just before calling each pp function, and checking its
result on return.
It saved and restored the old value of PL_curstackinfo->si_stack_hwm
whenever it entered or left a runops loop or did a JMPENV_PUSH /
JMPENV_POP. However, the restoring could restore to an old value that was
smaller than the current value, leading to false-positive stack-extend
panics. So only restore if the old value was larger.
In particular this was causing false positives in DBI.
|
|
|
|
|
|
|
|
|
| |
When continuing after an exception (JMPENV_PUSH() returns 3),
restore the value of PL_curstackinfo->si_stack_hwm.
This is a recently added variable on debugging builds that detects
attempts to push stuff on the stack without extending it.
After an exception its value may be invalid and trigger a false panic.
|
| |
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
On debugging builds only, add a mechanism for checking pp function calls
for insufficient stack extending. It works by:
* make the runops loop set a high-water-mark (HWM) variable equal to
PL_stack_sp just before calling each pp function;
* make EXTEND() etc update this HWM;
* on return from the pp function, panic if PL_stack_sp is > HWM.
This detects whether pp functions are pushing more items onto the stack
than they are requesting space for.
There's a possibility of false positives if the code is doing weird stuff
like direct manipulation of stacks via PL_curstack, SWITCHSTACK() etc.
It's also possible that one pp function "knows" that a previous pp
function will have already grown the stack enough. Currently the only
place in core that seems to do this is pp_enteriter, which allocates 1
stack slot so that pp_iter doesn't have to check each time it returns
&PL_sv_yes/no. To accommodate this, the new macro EXTEND_SKIP() has been
added, that tells perl that it's safely skipping an EXTEND() here.
|
|
|
|
|
|
|
|
| |
Currently the SvSCREAM flag is set on the sv pointed to by
cx->blk_eval.cur_text, to indicate that it is ref counted.
Instead, use a spare bit in the blk_u16 field of the eval context.
This is to reduce the number of odd special cases for the SvSCREAM flag.
|
|
|
|
|
|
|
|
|
|
|
| |
Under -Wshadow, CX_POP_SAVEARRAY's local var 'av' can generate this
warning:
warning: declaration shadows a local variable [-Wshadow]
So rename it to cx_pop_savearay_av to reduce the risk of a clash.
(See http://nntp.perl.org/group/perl.perl5.porters/236444)
|
|
|
|
|
|
|
|
|
| |
* in pp_return(), some comments were out of date about how
leave_adjust_stacks() is called ;
* add a comment to all the functions that pp_return() tail-calls to the
effect that they can be tail-called;
* make it clearer when/why OPf_SPECIAL is set on OP_LEAVE;
* CXt_LOOP_PLAIN can be a while loop as well as a plain block.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Clang has taken it upon itself to warn when an equality is wrapped in
double parentheses, e.g.
((foo == bar))
Which is a bit dumb, as any code along the lines of
#define isBAR (foo == BAR)
if (isBAR) {}
will trigger the warning.
This commit shuts clang up by putting in a harmless cast:
#define isBAR cBOOL(foo == BAR)
|
|
|
|
| |
Some entries already had this. For those, it standardizes the text.
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
The value of gimme stored in the context stack is U8.
Make all other uses in the main core consistent with this.
My primary motivation on this was that the new function cx_pushblock(),
which I gave a 'U8 gimme' parameter, was generating warnings where callers
were passing I32 gimme vars to it. Rather than play whack-a-mole, it
seemed simpler to just uniformly use U8 everywhere.
Porting/bench.pl shows a consistent reduction of about 2 instructions on
the loop and sub benchmarks, so this change isn't harming performance.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
About 25 commits ago in this branch I added a commit:
MULTICALL should clear scope after each call
To fix RT #116577, which reported that lexicals were only being freed
at the end of the MULTICALL, not after each individual call to the sub.
In that commit, I added a LEAVE_SCOPE() to the end of the MULTICALL()
definition. However, after further thought I realise that's wrong. If a
multicall sub does something like { my $x = $_*2; $x }, then the returned
value would be freed before the XS code which calls MULTICALL() has a
chance to do anything with it (e.g. test for truth, or add it to the return
args or whatever).
So I think popping the save stack should be the responsibility of the
caller of MULTICALL(), rather than of MULTICALL() itself.
|
|
|
|
|
|
|
|
| |
Add
#define blk_old_tmpsfloor cx_u.cx_blk.blku_old_tmpsfloor
to match all the other 'struct block' fields which have similar short cuts
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
dMULTICALL declares several vars that are used either to maintain
state across multiple calls, or to pass values to PUSHSUB etc, where
those macros expected to obtain some of their args by values being
implicitly passed via local vars. Since PUSHSUB has been replaced by
cx_pushsub() which now has all parameters explicitly passed, there is
no longer any need for those vars. So this commit eliminates them:
newsp
hasargs
There are also a couple vars which are no longer used due to changes to
the implementation over time; these can also be eliminated:
cx multicall_cv
Finally, this branch introduced a new var, saveix_floor; rename it to
multicall_saveix_floor for consistency with other dMULTICALL vars.
Although none of these vars are listed in the documentation, its possible
that some code out there may rely on them in some way, and will need to be
fixed up.
|
|
|
|
| |
Replace CX_PUSHGIVEN() with cx_pushgiven() etc.
|
|
|
|
| |
Replace CX_PUSHLOOP_FOR() with cx_pushfloop_for() etc.
|
|
|
|
|
|
| |
Replace CX_PUSHEVAL() with cx_pusheval() etc.
No functional changes.
|
|
|
|
|
|
| |
Replace CX_PUSHFORMAT() with cx_pushformat() etc.
No functional changes.
|
|
|
|
|
|
| |
Replace CX_PUSHSUB() with cx_pushsub() etc.
No functional changes.
|
|
|
|
|
|
| |
Replace CX_PUSHBLOCK() with cx_pushblock() etc.
No functional changes.
|
|
|
|
|
|
|
| |
Earlier all the POPFOO macros were renamed to CX_POPFOO to reflect
the changed API (like POPBLOCK no longer decremented cxstack_ix).
Now rename the PUSH ones for consistency.
|
|
|
|
|
|
| |
These are both NOOPs now, and were introduced within this branch
as a temporary measure while extra stuff needed doing when pushing or
popping a CXt_BOCK (pp_enter/pp_leave).
|
| |
|
|
|
|
|
|
|
|
|
|
| |
Rather than doing
cx->blk_eval.old_namesv = (n ? newSVpv(n,0) : NULL);
make the caller responsible for creating and passing in the SV. Since
only only place (pp_require) passes a non-null value, this saves the
other places having to test for nullness.
|
|
|
|
|
|
| |
Rather than doing cx->blk_sub.retop = NULL in PUSHSUB, then relying on
the caller to subsequently change it to something more useful, make it an
arg to PUSHSUB.
|
|
|
|
|
|
| |
Rather than doing cx->blk_eval.retop = NULL in PUSHEVAL, then relying on
the caller to subsequently change it to something more useful, make it an
arg to PUSHEVAL.
|
|
|
|
|
| |
Make cv and gv explicit parameters of PUSHFORMAT(), rather than just
assuming that there are such vars in scope.
|
|
|
|
|
| |
Make cv and hasargs explicit parameters of PUSHSUB(), rather than just
assuming that there are such vars in scope.
|
|
|
|
|
| |
Make gimme a parameter of PUSHBLOCK() rather than just assuming that
there's a 'gimme' var in scope.
|
|
|
|
|
|
|
|
|
|
|
|
| |
Currently blku_oldsaveix was being set by the various PUSHFOO macros,
except for PUSHSUB and PUSHEVAL which expected their caller to do it
manually.
Now that all the main context state is stored on the context stack
rather than than some on the save stack too, things are a lot simpler,
and this messy transitional state can now be rationalised, whereby
blku_oldsaveix is now always set by PUSHBLOCK; the exact value being
specified by a new arg to PUSHBLOCK.
|
|
|
|
|
| |
SAVEOP() should be more efficient than SAVEVPTR(PL_op), since it
uses the dedicated SAVEt_OP.
|
|
|
|
|
|
|
|
| |
This macro is defined as NOOP on all platforms except for MacOS classic,
where it was added as a hook to allow for OSes that have a small CPU
stack size. Since pp_entersub et al don't actually use the CPU stack,
this hook looks misconceived from the beginning. So remove all
uses of it in the core.
|
|
|
|
|
|
|
| |
RT #116577
Lexicals etc were only being freed at the end of the MULTICALL, not
after each individual call to the sub.
|
| |
|
|
|
|
|
| |
At the start of each CX_POPFOO(cx) macro, add an assertion that cx is of
type CXt_FOO.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Rename all the context-popping macros such as POPBLOCK and POPSUB, by
giving them a CX_ prefix. (Do TOPBLOCK too).
This is principally to deliberately break any existing non-core use of
these non-API macros, as their behaviour has changed in this branch.
In particular, POPBLOCK(cx) no longer decrements the cxt stack pointer
nor sets cx; instead, cx is now expected to already point to the stack
frame which POPBLOCK should process.
At the same time, giving them a CX_ prefix makes it clearer that these
are all part of a family of macros that manipulate the context stack.
The PUSHFOO() macros will be renamed in a later commit.
|
| |
|
|
|
|
|
|
|
| |
Re-arrange the order of the CXt_LOOP_* to make it easier for compilers
to produce efficient code, and tweak POPLOOP so that the code for
freeing ary and cur is shared (as they occupy the same position in the
union).
|
|
|
|
|
|
| |
It wasn't detecting CXt_LOOP_LAZYIV as a 'for' loop type. This only
affected 'given' and 'break' (which need to distinguish between being
in a 'given' block and being in a 'for' block).
|
|
|
|
|
|
|
|
|
|
| |
C<for (...)> is a special-case of C<for $pkg_var (...)>, so CXp_FOR_DEF
should only be set when CXp_FOR_GV also is. So in pp_enteriter(), only
test for (PL_op->op_private & OPpITER_DEF) in the GV branch and assert
that it's otherwise unset. This is slightly more efficient in the non-GV
branches.
Also add some more commentary to the CXp_FOR_* flag definitions.
|
|
|
|
| |
rather than just assuming that there's a 'cx' var in scope
|
| |
|
| |
|