summaryrefslogtreecommitdiff
path: root/cv.h
Commit message (Collapse)AuthorAgeFilesLines
* Define a CvSIGNATURE flagPaul "LeoNerd" Evans2022-01-311-0/+5
|
* style: Detabify indentation of the C code maintained by the core.Michael G. Schwern2021-01-171-24/+24
| | | | | | | | | | | 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.
* autodoc.pl: Specify scn for single-purpose filesKarl Williamson2020-11-061-5/+0
| | | | | | | | Many of the files in perl are for one thing only, and hence their embedded documentation will be for that one thing. By creating a hash here of them, those files don't have to worry about what section that documentation goes under, and so it can be completely changed without affecting them.
* Make some flags accessible from /extKarl Williamson2020-10-161-1/+1
| | | | | | Nothing in the test suite (nor apparently CPAN) had exercised this area of the code, and so this flaw hadn't been discovered. But new code about to be commited does.
* cv.h: Note CV is documented hereKarl Williamson2020-10-081-0/+2
|
* Reorganize perlapiKarl Williamson2020-09-041-7/+4
| | | | | This uses a new organization of sections that I came up with. I asked for comments on p5p, but there were none.
* Add embed.fnc entries for Cv inline fcnsKarl Williamson2019-09-151-2/+2
| | | | | | and change the name of one. CvDEPTH shouldn't have a trailing 'p' to indicate private memeber access. It may do so internally, but the name shouldn't indicate that.
* inline.h: Change fcn name prefix from S_ to Perl_Karl Williamson2019-09-151-2/+2
| | | | | | | | | | | | | | | | This is being done only for those functions that don't have a guard preventing them from being seen outside of the Perl core. Talking to Tony Cook, we agreed that this was a good idea for two reasons: 1) The 'Perl_' prefix does not pollute XS caller's name space. The 'S_' one could be argued that it doesn't much either, but it does more so than 'Perl_', and the next reason is the clincher: 2) It allows us to change our minds about whether a function should be static inline or not, without affecting callers who use the Perl_ form, which they would be accustomed to anyway if they're using the full name form.
* Fix apidoc macro entriesKarl Williamson2019-06-251-1/+1
| | | | | | | | | | 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.
* Improve description of CVf_DYNFILE flagDavid Mitchell2019-03-071-1/+1
|
* Add CvGvNAME_HEK helperNicolas R2017-09-211-1/+11
| | | | | | | CvGvNAME_HEK can be used instead of the boilerplate: CvNAMED(sv) ? CvNAME_HEK((CV *)sv) : GvNAME_HEK(CvGV(sv)) This is also saving an extra CvNAMED check from CvNAME_HEK.
* perlapi: Change some 'eg' to 'e.g.'Karl Williamson2015-09-031-1/+1
| | | | To make more standard
* Replace common Emacs file-local variables with dir-localsDagfinn Ilmari Mannsåker2015-03-221-6/+0
| | | | | | | | | | | | | | | | An empty cpan/.dir-locals.el stops Emacs using the core defaults for code imported from CPAN. Committer's work: To keep t/porting/cmp_version.t and t/porting/utils.t happy, $VERSION needed to be incremented in many files, including throughout dist/PathTools. perldelta entry for module updates. Add two Emacs control files to MANIFEST; re-sort MANIFEST. For: RT #124119.
* cv.h: Add CVf_ANONCONST flagFather Chrysostomos2015-01-191-1/+6
|
* Remove context param from set_padlistFather Chrysostomos2014-11-211-1/+1
| | | | It doesn’t need it.
* PoisonPADLIST should not be totally empty.Jarkko Hietaniemi2014-11-091-1/+1
| | | | (It is e.g. used as "... else PoisonPADLIST();" in sv.c)
* add xs_handshake APIDaniel Dragan2014-11-071-3/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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
* free up CvPADLIST slot for XSUBs for future useDaniel Dragan2014-10-311-1/+27
| | | | | | | | | | | | | | | | | | | 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].
* refactor Perl_cv_undef_flagsDaniel Dragan2014-10-291-3/+6
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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
* embed.fnc: cv_name is documentedFather Chrysostomos2014-09-241-0/+2
|
* Stop undef &foo from temporarily anonymisingFather Chrysostomos2014-09-151-0/+4
| | | | | 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.
* Add cv_set_call_checker_flagsFather Chrysostomos2014-09-151-0/+2
| | | | | | | | 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.
* For lexical subs, reify CvGV from CvSTASH and CvNAME_HEKFather Chrysostomos2014-09-151-8/+2
| | | | | From now on, the presence of a name hek implies a GV. Any access to CvGV will cause that implicit GV to be reified.
* Add CVf_LEXICAL flagFather Chrysostomos2014-09-151-0/+5
| | | | | Lexical subs will use this instead of CvNAMED to indicate that the name should not include the package.
* Consistent spaces after dots in perlintern.podFather Chrysostomos2013-12-291-10/+10
|
* perlapi: Consistent spaces after dotsFather Chrysostomos2013-12-291-1/+1
| | | | plus some typo fixes. I probably changed some things in perlintern, too.
* Add a const qualifier for the arg to the S_CvGV inline function in cv.h.Andy Dougherty2013-07-121-2/+2
| | | | | | 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.
* CvNAME_HEK_setFather Chrysostomos2012-09-151-0/+9
|
* Allow CVs to point to HEKs rather than GVsFather Chrysostomos2012-09-151-1/+21
| | | | This will allow named lexical subs to exist independent of GVs.
* Unify CvDEPTH for formats and subsFather Chrysostomos2012-09-111-1/+0
| | | | | | | | 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.
* Move S_CvDEPTHp from cv.h to inline.h; shrink macrosFather Chrysostomos2012-08-211-16/+1
| | | | | 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.
* sv.h: Don’t repeat _XPV_HEADFather Chrysostomos2012-08-171-5/+1
|
* Restore VC++ 6 build on WindowsSteve Hay2012-08-181-0/+4
| | | | | | | | | | | 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>
* cv.h: macro parenthesesFather Chrysostomos2012-08-061-1/+1
| | | | | I forgot about -- having higher precedence than unary *. And then I forgot to test it, convincing myself I had. :-(
* Add a depth field to formatsFather Chrysostomos2012-08-051-3/+11
| | | | | Instead of lengthening the struct, we can reuse SvCUR, which is cur- rently unused.
* Eliminate PL_OP_SLAB_ALLOCFather Chrysostomos2012-07-121-4/+0
| | | | | | | | | | | | 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.
* Define cv_forget_slab under PL_OP_SLAB_ALLOCFather Chrysostomos2012-06-291-0/+4
| | | | | Instead of using #ifndef every time we call cv_forget_slab, just define it as a no-op under PL_OP_SLAB_ALLOC.
* Add CVf_SLABBED flagFather Chrysostomos2012-06-291-0/+9
| | | | | This will indicate that a CV has a reference count on, and ownership of, a slab used for allocating ops.
* [perl #89544] Non-eval closures don’t need CvOUTSIDEFather Chrysostomos2012-06-201-0/+5
| | | | | | | | | | 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.
* cv.h: Add commentsFather Chrysostomos2012-06-081-0/+2
|
* update the editor hints for spaces, not tabsRicardo Signes2012-05-291-2/+2
| | | | | This updates the editor hints in our files for Emacs and vim to request that tabs be inserted as spaces.
* cv.h: comment typoFather Chrysostomos2011-10-161-1/+1
| | | | Commit 7c60e434 removed the ‘match’.
* Improve documentation of XS autoloadingFather Chrysostomos2011-10-111-0/+3
|
* Resolve XS AUTOLOAD-prototype conflictFather Chrysostomos2011-10-091-0/+22
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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.
* [perl #96126] Allocate CvFILE more simplyFather Chrysostomos2011-08-171-2/+9
| | | | | | | | | | | | | | | | | | | 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.
* perlapi.pod EnhancementsShlomi Fish2011-07-181-1/+6
| | | | | This is a patch to enhance perlapi.pod by providing Perl equivalents and clarifying documentation where appropriate.
* add CvSTASH_set() macro and make CvSTASH() rvalue onlyZefram2010-10-251-1/+2
| | | | | | 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().
* plugin mechanism to rewrite calls to a subroutineZefram2010-10-101-0/+2
| | | | | | | | | | | | | | | | | | | | | | | | 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.)
* add CvGV_set() macro and make CvGV() rvalue onlyDavid Mitchell2010-07-181-1/+2
| | | | | | 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()
* add CVf_CVGV_RC flagDavid Mitchell2010-07-181-4/+6
| | | | | | | | | | | | | 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.