| Commit message (Collapse) | Author | Age | Files | Lines |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
This API elevates the amount of ABI compatibility protection between XS
modules and the interp. It also makes each boot XSUB smaller in machine
code by removing function calls and factoring out code into the new
Perl_xs_handshake and Perl_xs_epilog functions.
sv.c :
- revise padlist duping code to reduce code bloat/asserts on DEBUGGING
ext/DynaLoader/dlutils.c :
- disable version checking so interp startup is faster, ABI mismatches are
impossible because DynaLoader is never available as a shared library
ext/XS-APItest/XSUB-redefined-macros.xs :
- "" means dont check the version, so switch to " " to make the test in
xsub_h.t pass, see ML thread "XS_APIVERSION_BOOTCHECK and XS_VERSION
is CPP defined but "", mow what?"
ext/re/re.xs :
- disable API version checking until #123007 is resolved
ParseXS/Utilities.pm :
109-standard_XS_defs.t :
- remove context from S_croak_xs_usage similar to core commit cb077ed296 .
CvGV doesn't need a context until 5.21.4 and commit ae77754ae2 and
by then core's croak_xs_uage API has been long available and this
backport doesn't need to account for newer perls
- fix test where lack of having PERL_IMPLICIT_CONTEXT caused it to fail
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
CvRESERVED is a placeholder, it will be replaced with a sentinal value
from future revised BOOTCHECK API.
CvPADLIST_set was helpful during development of this patch, so keep it
around for now.
PoisonPADLIST's magic value is from PERL_POISON 0xEF pattern. Some
PoisonPADLIST locations will get code from future BOOTCHECK API.
Make padlist_dup a NN function to avoid overhead of calling it for XSUBs
during closing.
Perl_cv_undef_flags's else if (CvISXSUB(&cvbody)) is to avoid whitespace
changes.
Filed as perl [#123059].
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
On VC 2003 32bits size of this function decreased from 0x321 bytes of
machine code to 0x2d8.
cv.h:
- partially reorder Cv* macros to match XPVCV member order
- create CvDEPTHunsafe which never uses SV head except for SvANY ptr since
Perl_cv_undef_flags uses a fake SV head
pad.c
- remove var slabbed, frees a C auto/non-vol register, there are only 2
uses, on CvSTART branch, CvFLAGS is reused frm CvISXSUB test by optimizer
- use a CV struct to fake a CV, to avoid rereading SvANY ptr after each
func call, CVs can't be upgraded or have their bodies realloced
- dont write NULL to CvFILE if CvFILE is NULL, also move NULL assignment
so CPU address generation can be reused by compiler
- refactor CvROOT/CvSTART/CvXSUB freeing conditionals to simplify code and
dont check CvISXSUB twice
- CvDEPTH requires a real CV*/CV*, since it checks the SV head with an
assert, use CvDEPTHunsafe instead, and inline the assert using the real
CV*. Also move runtime, non-debug "SvTYPE(cv) == SVt_PVCV" check to
debug builds per ML post
"about FC commit "CV-based slab allocation for ops""
- Perl_croak->Perl_croak_nocontext, remove push arg my_perl instruction
- refactor CvPADLIST freeing for provision for future XSUB sub usage of
CvPADLIST in a union
- in CvOUTSIDE freeing, move NULL assignment so CPU address generation can
be reused by compiler
|
| |
|
|
|
|
|
| |
Instead of setting aside the name, calling cv_undef, and then naming
the sub anew, just pass a flag to tell cv_undef not to unname it.
|
|
|
|
|
|
|
|
| |
This is like cv_set_call_checker, except that it allows the caller to
decide whether the call checker needs a GV.
Currently the GV flag is recorded, but ck_subr does not do anything
with it yet.
|
|
|
|
|
| |
From now on, the presence of a name hek implies a GV. Any access to
CvGV will cause that implicit GV to be reified.
|
|
|
|
|
| |
Lexical subs will use this instead of CvNAMED to indicate that the
name should not include the package.
|
| |
|
|
|
|
| |
plus some typo fixes. I probably changed some things in perlintern, too.
|
|
|
|
|
|
| |
In addition to correctly describing the behavior of S_CvGV, this avoids
warnings in op.c:Perl_report_redefined_cv, where the old (CV *) cast
removed the 'const' qualifier. Observed on OpenBSD 5.2 with gcc-4.2.1.
|
| |
|
|
|
|
| |
This will allow named lexical subs to exist independent of GVs.
|
|
|
|
|
|
|
|
| |
As Dave Mitchell pointed out, while putting the CvDEPTH field for for-
mats in the SvCUR slot might save memory for formats, it slows down
sub calls because CvDEPTH is used on subs in very hot code paths.
Checking the SvTYPE to determine which field to use should not be
necessary.
|
|
|
|
|
| |
This allows us to use assert() inside S_CvDEPTHp, so we no longer need
GCC and non-GCC variants of the macro that calls it.
|
| |
|
|
|
|
|
|
|
|
|
|
|
| |
Commits bb02a38feb and 1bd3586145 resulted in VC++ 6 complaining "error
C2099: initializer is not a constant" when initializing bodies_by_type in
sv.c. Workaround the apparent compiler bug using a patch from Jan Dubois,
amended to be compiler-specific as suggested by Nicholas Clark since
anonymous unions are not valid C89.
Date: Wed, 15 Aug 2012 00:55:06 -0700
Message-ID: <005a01cd7abb$498294e0$dc87bea0$@activestate.com>
|
|
|
|
|
| |
I forgot about -- having higher precedence than unary *. And then
I forgot to test it, convincing myself I had. :-(
|
|
|
|
|
| |
Instead of lengthening the struct, we can reuse SvCUR, which is cur-
rently unused.
|
|
|
|
|
|
|
|
|
|
|
|
| |
This commit eliminates the old slab allocator. It had bugs in it, in
that ops would not be cleaned up properly after syntax errors. So why
not fix it? Well, the new slab allocator *is* the old one fixed.
Now that this is gone, we don’t have to worry as much about ops leak-
ing when errors occur, because it won’t happen any more.
Recent commits eliminated the only reason to hang on to it:
PERL_DEBUG_READONLY_OPS required it.
|
|
|
|
|
| |
Instead of using #ifndef every time we call cv_forget_slab, just
define it as a no-op under PL_OP_SLAB_ALLOC.
|
|
|
|
|
| |
This will indicate that a CV has a reference count on, and ownership
of, a slab used for allocating ops.
|
|
|
|
|
|
|
|
|
|
| |
A closure doesn’t need an outside pointer at run time, unless it has a
string eval in it. CvOUTSIDE is only used at compilation time to look
up variables by name.
Since CvOUTSIDE is reference-counted, a closure can unnecessarily hang
on to variables it is not using (see the test in the diff). So stop
setting it when cloning a closure, unless it is needed for eval.
|
| |
|
|
|
|
|
| |
This updates the editor hints in our files for Emacs and vim to request
that tabs be inserted as spaces.
|
|
|
|
| |
Commit 7c60e434 removed the ‘match’.
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Did you know that a subroutine’s prototype can be modified with s///?
Don’t look:
*AUTOLOAD = *Internals'SvREFCNT;
my $f = "Just another "; eval{main->$f};
print prototype AUTOLOAD;
$f =~ s/Just another /Perl hacker,\n/;
print prototype AUTOLOAD;
You did look, didn’t you? You must admit that’s creepy.
The problem goes back to this:
commit adb5a9ae91a0bed93d396bb0abda99831f9e2e6f
Author: Doug MacEachern <dougm@covalent.net>
Date: Sat Jan 6 01:30:05 2001 -0800
[patch] xsub AUTOLOAD fix/optimization
Message-ID: <Pine.LNX.4.10.10101060924280.24460-100000@mojo.covalent.net>
Allow AUTOLOAD to be an xsub and allow such xsubs
to avoid use of $AUTOLOAD.
p4raw-id: //depot/perl@8362
which includes this:
+ if (CvXSUB(cv)) {
+ /* rather than lookup/init $AUTOLOAD here
+ * only to have the XSUB do another lookup for $AUTOLOAD
+ * and split that value on the last '::',
+ * pass along the same data via some unused fields in the CV
+ */
+ CvSTASH(cv) = stash;
+ SvPVX(cv) = (char *)name; /* cast to loose constness warning */
+ SvCUR(cv) = len;
+ return gv;
+ }
That ‘unused’ field is not unused. It’s where the prototype is
stored. So, not only is it clobbering the prototype, it’s also leak-
ing it by assigning over the top of SvPVX. Furthermore, it’s blindly
assigning someone else’s string, which could be freed before it’s
even used.
Since it has been documented for a long time that SvPVX contains the
name of the AUTOLOADed sub, and since the use of SvPVX for prototypes
is documented nowhere, we have to preserve the former.
So this commit makes the prototype and the sub name share the same
buffer, in a manner resembling that which CvFILE used before I changed
it with bad4ae38.
There are two new internal macros, CvPROTO and CvPROTOLEN for retriev-
ing the prototype.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
See the thread starting at:
http://www.nntp.perl.org/group/perl.perl5.porters/2011/07/msg175161.html
Instead of assuming that only Perl subs have mallocked CvFILEs and
only under threads, resulting in various hackery to borrow parts of
the SvPVX buffer where that assumption proves wrong, we can simply
add another flag (DYNFILE) to indicate whether CvFILE is mallocked,
instead of trying to use the ISXSUB flag for two purposes.
This simplifies the code greatly, eliminating bug #96126 in the pro-
cess (which had to do with sv_dup not knowing about the hackery that
this commit removes).
I removed that comment from cv_ckproto_len about CONSTSUBs doubling up
the buffer field, as it is no longer relevant. But I still left the
code as it is, since it’s better to do an explicit length check.
|
|
|
|
|
| |
This is a patch to enhance perlapi.pod by providing Perl equivalents and
clarifying documentation where appropriate.
|
|
|
|
|
|
| |
Now that CvSTASH requires backreference bookkeeping, stop people from
directly assigning to it (by using CvSTASH() as an lvalue), and instead
force them to use CvSTASH_set().
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
New magic type PERL_MAGIC_checkcall attaches a function to a CV, which
will be called as the second half of the op checker for an entersub
op calling that CV. Default state, in the absence of this magic,
is to process the CV's prototype if it has one, or apply list context
to all the arguments if not. New API functions cv_get_call_checker()
and cv_set_call_checker() provide a clean interface to this facility,
hiding the internal use of magic.
Expose in the API the new functions rv2cv_op_cv(),
ck_entersub_args_list(), ck_entersub_args_proto(), and
ck_entersub_args_proto_or_list(), which are meaningful segments of
standard entersub op checking and are likely to be useful in plugged-in
call checker functions.
Expose new API function op_contextualize(), which is a public interface
to the internal scalar()/list()/scalarvoid() functions. This API is
likely to be required in most plugged-in call checker functions.
Incidentally add new function mg_free_type(), in the API, which will
remove magic of one type from an SV. (mg_free() removes all magic,
and there isn't anything else more selective.)
|
|
|
|
|
|
| |
Now that CvGV can sometimes be reference counted, stop people from directly
assigning to it (by using CvGV as an lvalue), and instead force them to use
CvGV_set()
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
after the recent commit 803f274831f937654d48f8cf0468521cbf8f5dff,
the CvGV field is sometimes reference counted. Since it was intended that
the reference counting would happen only for anonymous CVs, the CVf_ANON
flag was co-opted to indicate whether RC was being used. This is not
entirely robust; for example, sub __ANON__ {} is a non-anon sub which
points to the same GV used by anon subs, which while itself doesn't
directly break things, shows that the potential for breakage is there.
So add a separate flag just to indicate the reference count status of the
CvGV field.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Each CV usually has a pointer, CvGV(cv), back to the GV that corresponds
to the CV's name (or to *foo::__ANON__ for anon CVs). This pointer wasn't
reference counted, to avoid loops. This could leave it dangling if the GV
is deleted.
We fix this by:
For named subs, adding backref magic to the GV, so that when the GV is
freed, it can trigger processing the CV's CvGV field. This processing
consists of: if it looks like the freeing of the GV is about to trigger
freeing of the CV too, set it to NULL; otherwise make it point to
*foo::__ANON__ (and set CvAONON(cv)).
For anon subs, make CvGV a strong reference, i.e. increment the refcnt of
*foo::__ANON__. This doesn't cause a loop, since in this case the
__ANON__ glob doesn't point to the CV. This also avoids dangling pointers
if someone does an explicit 'delete $foo::{__ANON__}'.
Note that there was already some partial protection for CvGV with
commit f1c32fec87699aee2eeb638f44135f21217d2127. This worked by
anonymising any corresponding CV when freeing a stash or stash entry.
This had two drawbacks. First it didn't fix CVs that were anonmous or that
weren't currently pointed to by the GV (e.g. after local *foo), and
second, it caused *all* CVs to get anonymised during cleanup, even the
ones that would have been deleted shortly afterwards anyway. This commit
effectively removes that former commit, while reusing a bit of the
actual anonymising code.
|
|
|
|
|
| |
The removal of CVf_ASSERTION in 584420f022db5722 and CVf_LOCKED in
e95ab0c0d2aa1b35 left two gaps in the sequence of bits in use.
|
|
|
|
|
|
|
| |
Replaced with xcv_depth and xfm_lines respectively. Both structures might
benefit from some field re-ordering.
Update the descriptive comments in the definition of union _xivu.
|
| |
|
| |
|
| |
|
|
|
|
|
| |
MUTABLE_PTR(), to validate that there is no casting away of const.
p4raw-id: //depot/perl@34610
|
|
|
| |
p4raw-id: //depot/perl@34585
|
|
|
| |
p4raw-id: //depot/perl@34167
|
|
|
|
|
|
| |
From: "Reini Urban" <rurban@x-ray.at>
Message-ID: <6910a60806080717h1aaaef1fh425a2ef21a62c9ed@mail.gmail.com>
p4raw-id: //depot/perl@34030
|
|
|
|
|
| |
Nullhek and Nullhv. Nullop is going to be a bit less simple.
p4raw-id: //depot/perl@33051
|
|
|
|
|
| |
Message-ID: <20071229181742.1933db40@r2d2>
p4raw-id: //depot/perl@32783
|
|
|
| |
p4raw-id: //depot/perl@31333
|
|
|
|
|
| |
earlier we missed in av.h and hv.h)
p4raw-id: //depot/perl@29670
|
|
|
| |
p4raw-id: //depot/perl@29665
|
|
|
|
|
| |
is part of the xnv union.
p4raw-id: //depot/perl@29634
|