| Commit message (Collapse) | Author | Age | Files | Lines |
| |
|
|
|
|
|
|
|
|
|
|
|
| |
* Free the attrlist OP fragment when applying class or field attribute
* Free the OP_PADxV ops we only use to get the pad index out for
fieldvar declarations
* Add a refcount to the `struct padname_fieldinfo` to keep track of its
capture in inner closures so it can be freed at the right time
* Free the class-related fields out of HvAUX
* Free the actual ObjectFIELDS() array when destroying an object instance
* Dup fieldinfo->paramname at sv_dup() time / free it at free time
|
|
|
|
|
|
|
| |
It needs to:
* clone SVt_PVOBJ instances
* clone the xhv_class_* fields of an SVt_PVHV
* clone the PadnameFIELDINFO structure of a padname
|
| |
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Adds a new experimental warning, feature, keywords and enough parsing to
implement basic classes with an empty `new` constructor method.
Inject a $self lexical into method bodies; populate it with the object instance, suitably shifted
Creates a new OP_METHSTART opcode to perform method setup
Define an aux flag to remark which stashes are classes
Basic implementation of fields.
Basic anonymous methods.
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
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
|
|
|
|
|
|
|
|
|
| |
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.
|
|
|
|
|
|
|
|
| |
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.
|
|
|
|
| |
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.
|
|
|
|
|
|
|
|
|
|
|
|
| |
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.
|
|
|
|
|
| |
7008caa915ad99e650acf2aea40612b5e48b7ba2 removed several deprecated
functions, but did not remove all the pods thereof.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
There's no efficient way to create a mortal SV of any type other than
SVt_NULL (via sv_newmortal). The options are either to do:
* SV* sv = sv_newmortal; sv_upgrade(sv, SVt_SOMETYPE);
but sv_upgrade is needlessly inefficient on new SVs.
* SV* sv = sv_2mortal(newSV_type(SVt_SOMETYPE)
but this will perform runtime checks to see if (sv) and if (SvIMMORTAL(sv),
and for a new SV we know that those answers will always be yes and no.
This commit adds a new inline function which is basically a mortalizing
wrapper around the now-inlined newSV_type.
|
|
|
|
|
|
|
|
|
|
|
|
| |
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
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
constant sub
Anonymous constant subs were changed to be implemented internally as
XSUBs in 5.21.6, commit 1567c65ac069266bfe65959430c185babd476538.
This broke DEBUGGING perls running under -DXv which weren't taught
about the new implementation. In ed958fa3156084f3cf4d8c4768716d9e1a11ce91
strict.pm also was changed to use such subs, which then breaks many
uses of -DXv.
See t/run/switchDx.t for an example of code that would trigger this that
does not depend on strict.pm
This fixes the problem and adds a test for -Dx.
|
|
|
|
|
|
|
|
| |
This finishes the perl-visible API required for RFC 0008
https://github.com/Perl/RFCs/blob/master/rfcs/rfc0008.md
It also begins the "builtin::" namespace of RFC 0009
https://github.com/Perl/RFCs/blob/master/rfcs/rfc0009.md
|
|
|
|
|
|
|
| |
This seems to have been forgotten in the public API, perhaps because it
was added later.
Fixes #19165
|
|
|
|
| |
The nature of PL_comppad allows this.
|
| |
|
| |
|
| |
|
|
|
|
|
|
|
|
|
|
|
| |
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.
|
| |
|
|
|
|
|
|
|
|
|
|
|
| |
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.
|
|
|
|
|
|
|
|
|
| |
For: https://github.com/Perl/perl5/pull/18201
Committer: Samanta Navarro is now a Perl author.
To keep 'make test_porting' happy: Increment $VERSION in several files.
Regenerate uconfig.h via './perl -Ilib regen/uconfig_h.pl'.
|
|
|
|
|
| |
This uses a new organization of sections that I came up with. I asked
for comments on p5p, but there were none.
|
|
|
|
|
| |
apidoc_section is slightly favored over head1, as it is known only to
autodoc, and can't be confused with real pod.
|
|
|
|
|
| |
It only does anything under PERL_GLOBAL_STRUCT, which is gone.
Keep the dNOOP defintion for CPAN back-compat
|
|
|
|
|
|
|
|
|
|
|
| |
This is useful in Devel::PPPort for generating its api-info data. That
useful feature of D:P allows someone to find out what was the first
release of Perl to have a function, macro, or flag. And whether using
ppport.h backports it further.
I went through apidoc.pod and looked for flags that were documented but
that D:P didn't know about. This commit adds entries for each so that
D:P can find them.
|
|
|
|
|
|
| |
A bunch of places were using "%se" and "subroutin" or "variabl" when
generating error messages that could refer to either a subroutine or
variable. Spell the words out and use plain "%s" instead.
|
|
|
|
|
|
|
|
|
|
| |
Transform previously deprecated cases into exceptions.
Update diagnostic; change D to F
remove now irrelevant code (TonyC)
For: RT 134138
|
|
|
|
|
|
|
|
|
|
| |
This makes various fixes to the text that is used to generate the
documentation. The dominant change is to add the 'n' flag to indicate
that the macro takes no arguments. A couple should have been marked
with a D (for deprecated) flag, and a couple were missing parameters,
and a couple were missing return values.
These were spotted by using Devel::PPPort on them.
|
|
|
|
|
|
|
|
|
| |
This information is already in embed.fnc, and we know it compiles. Some
of this information is now out-of-date. Get rid of it.
There was one bit of information that was (apparently) wrong in
embed.fnc. The apidoc line asked that there be no usage example
generated for newXS. I added that flag to the embed.fnc entry.
|
| |
|
| |
|
|
|
|
|
|
|
| |
[perl #131631] has a convoluted test case that messes up parser error
recovery and causes a segv via null pointer dereference. Turn the segv
into an assertion failure, by asserting non-nullness of the pointer.
This doesn't fix the actual problem with error recovery.
|
|
|
|
| |
As proposed in [perl #125330].
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
The sub-in-stash optimization introduced in 2eaf799e only applied to
subs in the main stash, not in other stashes, due to a problem with
the logic in newATTRSUB.
This comment:
Also, we may be called from load_module at run time, so
PL_curstash (which sets CvSTASH) may not point to the stash the
sub is stored in.
explains why we need the PL_curstash != CopSTASH(PL_curcop) check.
(Perl_load_module will fail without it.) But that logic does not work
properly at compile time (when PL_curcop == &PL_compiling).
The value of CopSTASH(&PL_compiling) is never actually used. It is
always set to the main stash. So if we check that PL_curstash !=
CopSTASH(PL_curcop) and forego the optimization in that case, we will
never optimize subs outside of the main stash.
What we really need is to check IN_PERL_RUNTIME && PL_curstash !=
opSTASH(PL_curcop). I.e., forego the optimization at run time if the
stashes differ. That is what this commit implements.
One observable side effect of this change is that deleting a stash
element no longer anonymizes the CV if the CV had no GV that it was
depending on to provide its name. Since the main thing in such situa-
tions is that we do not get a crash, I think this change (arguably an
improvement) is acceptable.)
-----------
A bit of explanation of various other changes:
gv.c:require_tie_mod needed a bit of help, since it could not handle
sub refs in stashes.
To keep localisation of stash elements working the same way,
local($Stash::{foo}) now upgrades a coderef to a full GV before the
localisation. (Changes in two pp*.c files and in scope.c:save_gp.)
t/op/stash.t contains a test that makes sure that perl does not crash
when a GV with a CV pointing to it gets deleted. This commit tweaks
the test so that it continues to test that. (There has to be a GV for
the test to test what it is meant to test.)
Similarly with t/uni/caller.t and t/uni/stash.t.
op.c:rv2cv_op_cv with the _MAYBE_NAME_GV flag was returning the cal-
ling GV in those cases where a GV-less sub is called via a GV. E.g.,
*main = \&Foo::foo; main(). This meant that errors like ‘Not enough
arguments’ were giving the wrong sub name.
newATTRSUB was not calling mro_method_changed_in when storing a
sub as an RV.
gv_init needs to arrange for the new GV to have the file and line num-
ber corresponding to the sub in it. These are taken from CvSTART,
which may be off by a few lines, but is the closest we have to the
place the sub was declared.
|
| |
|
| |
|
|
|
|
| |
It was already deprecated, but we're now adding a version number.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
C++11 requires space between the end of a string literal and a macro, so
that a feature can unambiguously be added to the language. Starting in
g++ 6.2, the compiler emits a warning when there isn't a space
(presumably so that future versions can support C++11). Unfortunately
there are many such instances in the perl core. This commit fixes
those, including those in ext/, but individual commits will be used for
the other modules, those in dist/ and cpan/.
This commit also inserts space at the end of a macro before a string
literal, even though that is not deprecated, and removes useless ""
literals following a macro (instead of inserting a blank). The result
is easier to read, making the macro stand out, and be clearer as to the
intention.
Code and modules included with the Perl core need to be compilable using
C++. This is so that perl can be embedded in C++ programs. (Actually,
only the hdr files need to be so compilable, but it would be hard to
test that just the hdrs are compilable.) So we need to accommodate
changes to the C++ language.
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
PVNV's used to be used to hold pad names (like '$lex'), but aren't used
for this purpose any more. So eliminate the xpad_cop_seq part of the
union.
Since S_scan_subst() was using xnv_u.xpad_cop_seq.xlow to store a
temporary line count, add a new union member for that.
The main usage of this field on CPAN is to define
COP_SEQ_RANGE_LOW()-style macros, so if the module is still using
xpad_cop_seq for that purpose, it's already broken.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Now that that PADOFFSET is signed, make
PL_comppad_name_fill
PL_comppad_name_floor
PL_padix
PL_constpadix
PL_padix_floor
PL_min_intro_pending
PL_max_intro_pending
be of type PADOFFSET rather than I32, to match the rest of the pad
interface.
At the same time, change various I32 local vars in pad.c functions to be
PADOFFSET.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
When in 2002 I moved a bunch of code from op.c etc into a new file,
pad.c, I left this comment at the top:
/* XXX DAPM
* As of Sept 2002, this file is new and may be in a state of flux for
* a while. I've marked things I intent to come back and look at further
* with an 'XXX DAPM' comment.
*/
Well, 12 years have passed since then, and if I was going to do any of
this stuff I would probably have done it by now, or someone else would.
So this commit removes the XXX's.
|
| |
|
|
|
|
| |
It had suffered some bitrot.
|