| Commit message (Collapse) | Author | Age | Files | Lines |
... | |
|
|
|
| |
This flag does not appear to have ever been used for anything.
|
|
|
|
| |
This flag does not appear ever have been used for anything in this context.
|
|
|
|
|
|
| |
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.
|
|
|
|
| |
Also renames the CvMETHOD* macro family to CvNOWARN_AMBIGUOUS*
|
| |
|
|
|
|
|
|
|
|
|
|
|
| |
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.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
The original code in toke.c tried to detect a bareword as a
file handle during tokenization rather than once the expression
following the LSTOP has been parsed.
I've moved the checking for a bareword filehandle to the ck functions
for each OP in most cases, which covers most OPs except for LSTOPs
like print.
To handle that I've added a check in newGVREF().
This means in most cases that the error is produced just as the
bareword would normally be wrapped in an OP_RV2GV.
The special case for that is readline(), which does it's own
rv2gv() at runtime, but it does have a ck function which can check
for the bareword handle.
|
| |
|
|
|
|
|
|
|
|
|
|
|
| |
* Create a new `peep.c` file
* Move the functions related to optree optimisation and finalisation
out of `op.c` into this new file
* Several previously-static functions now have to be non-static and
declared as internal API in order to be shared between these two
files.
|
|
|
|
|
|
|
| |
see it
Also defend it against side-effects in arguments, by allocating
temporary variables.
|
|
|
|
|
|
|
|
|
|
|
|
| |
I believe the '!!' is somewhat obscure; I for one didn't know about it
for years of programming C, and it was buggy in one compiler, which is why
cBOOL was created, I believe. And it is graphically dense, and
generally harder to read than the cBOOL() construct.
This commit dates from before we moved to C99 where we can simply cast
to (bool), and cBOOL() has been rewritten to do that. But the vast
majority of code uses cBOOL(), and this commit brings the remainder of
the core .[ch] files into uniformity.
|
| |
|
| |
|
| |
|
| |
|
| |
|
|
|
|
|
|
|
|
|
| |
function
The new combined function, named `S_warn_elem_scalar_context()`, is much
more meaningful and useful to become exported in an intended subsequent
change, than the previous (poorly-named) `S_op_pretty()` would have
been.
|
|
|
|
|
| |
This could trigger some optimisations, and makes it clear to maintainers
that they do not get modified.
|
| |
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
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.
|
|
|
|
| |
there's a general category for it
|
| |
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
| |
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
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
This reapplies two reverted patches as a single squashed commit.
Revert "Revert "avoid identical stack traces""
This reverts commit 79f75eaa716307235be78834c99ba0599a00319b
which itself reverted f2f32cd638746f538da6db804dab6dd54e654f30
Revert "Revert "fixup to "avoid identical stack traces" - try 2""
This reverts commit 2abf7efcc0ff8978340af661cb333175a899a84e
which itself reverted ad89278aa25475fb03971aec66692e18e35d9c07
Original Author: David Mitchell <davem@iabyn.com>
Original Date: Fri Dec 13 13:48:25 2019 +0000
avoid identical stack traces
GH #15109
The output of caller() (e.g. as produced by carp::Confess) produces
multiple identical outputs when within a nested use/require. This is
because at the time of calling the 'BEGIN { require ... }', PL_curcop is
set to &PL_compiling, which is a fixed buffer within the interpreter,
whose individual file and line fields are saved and restored when doing
a new require/eval. This means that within the innermost require,
PL_compiling has file:lineno of the innermost source file, and multiple
saved PL_curcop values in the context stack frames all point to the same
&PL_copmpiling. So all levels of the stack trace appear to come from the
innermost file.
This commit fixes this (after a fashion) by, at the start of calling a
BEGIN, making PL_curcop point to a temporary copy of PL_compiling
instead.
This is all a bit of a hack.
|
|
|
|
| |
creating new temporary "version" objects
|
| |
|
|
|
|
|
|
| |
Save/restore PL_prevailing_version at SAVEHINTS time
Have PL_prevailing_version track the applied use VERSION currently in scope
|
| |
|
|
|
|
| |
in signatured subs
|
| |
|
|
|
|
| |
"finally" and not "defer"
|
| |
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
@a = sort @empty; # unaffected
@a = sort; # now a compile-time error
the main motivation for this is to potentially be able to treat a
colon following the 'sort' keyword as part of the sort expression,
to then be able to add sort attributes at some point, e.g.
@a = sort :num, 1,2,3;
rather than the colon being seen as part of a ?: conditional.
See http://nntp.perl.org/group/perl.perl5.porters/262425.
|
| |
|
|
|
|
| |
The same holds for newSVpvs* wrappers around newSVpvn* functions.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
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.
|
|
|
|
|
|
|
|
|
|
| |
At this point there should be no further debugging code trying to
use the COP pointer.
On threaded builds the call to CopFILEAV() could cause a segmentation
fault, since during late destruction gv_fetchfile() could return
NULL, which the threaded version of CopFILEAV() would blindly call
GvAV() on.
|
|
|
|
|
|
|
| |
This could cause a bad read and write when the debugger tried to
set a breakpoint on the line.
Fixed #19198
|
|
|
|
|
| |
PADOFFSET is SSize_t, so %lu is wrong even if long and SSize_t are the
same size.
|
|
|
|
|
|
| |
Perl_newFOROP can now also take an OP_LIST corresponding to two or more
lexicals to iterate over n-at-a-time, where those lexicals are all
declared in the for statement, and occupy consecutive pad slots.
|
|
|
|
| |
The build has been broken since 2009.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
The bitwise ops, such as a '<<', have an op_private flag that is set
when compiled within the scope of 'use integer;'.
Unfortunately, due to historical reasons, the defined flag that
indicates this bit (bit 0) is HINT_INTEGER rather than an OPpfoo define.
But HINT_INTEGER is supposed to represent a bit within PL_hints, not a bit
within op_private. If someone reorganised the flags in PL_hints at some
point, it would mess up bitwise ops.
So this commit:
1) adds a new flag, OPpUSEINT, to indicate the bit within op_private.
2) Changes this flag's value from 0x1 to 0x4 to force it to be different
than HINT_INTEGER - thus potentially flushing out any misuse of this
flag anywhere (in core or XS code).
3) tells regen/op_private that the lower two bits of op_private in bitwise
ops don't contain the argument count. They never did, but not
specifying that in regen/op_private meant that the debugging code in
op_free() never spotted the unknown bit 0 sometimes being set.
4) Also tell that debugging code to skip the test if the op is banned.
This fixes a new fail in dist/Safe/t/safeops.t which was croaking
about a banned op having an unrecognised op_private flag bit set
before ck_bitop() had a chance to delete the arg count in op_private.
|
|
|
|
|
|
|
|
|
|
|
|
| |
In Sep 1999 commit cd06dffe59d6 added various "internal error" croak()s:
initial implementation of lvalue subroutines (slightly fixed
version of patch suggested by Ilya Zakharevich, which in turn
is based on the one suggested by Tuomas J. Lukka <lukka@iki.fi>)
One was "panic: unexpected lvalue entersub entry via type/targ %ld:%ld"
Another "Unexpected constant lvalue entersub entry via type/targ %ld:%ld"
Prefix the latter with "panic: " to make it consistent.
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
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.
|
| |
|
|
|
|
|
|
| |
Remove the code in Perl_ck_sort() that reads from PL_hintgv that sets these,
and the code in pp_sort that reads them and sets SORTf_STABLE and
SORTf_UNSTABLE (which were no longer read. Remove these too.)
|