diff options
author | Daniel Dragan <bulk88@hotmail.com> | 2014-10-29 02:56:16 -0400 |
---|---|---|
committer | Father Chrysostomos <sprout@cpan.org> | 2014-10-29 14:04:00 -0700 |
commit | 52ec28d5ff5fcb874bd7ffac4db0609315227668 (patch) | |
tree | fa7bf5076565c10c2789455e7dfc0a5b540e5b6b /cv.h | |
parent | 3028eff14993a097a4926fa6b0b6058cabb9abd3 (diff) | |
download | perl-52ec28d5ff5fcb874bd7ffac4db0609315227668.tar.gz |
refactor Perl_cv_undef_flags
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
Diffstat (limited to 'cv.h')
-rw-r--r-- | cv.h | 9 |
1 files changed, 6 insertions, 3 deletions
@@ -62,10 +62,13 @@ See L<perlguts/Autoloading with XSUBs>. #endif #define CvFILEGV(sv) (gv_fetchfile(CvFILE(sv))) #define CvDEPTH(sv) (*S_CvDEPTHp((const CV *)sv)) -#define CvPADLIST(sv) ((XPVCV*)MUTABLE_PTR(SvANY(sv)))->xcv_padlist -#define CvOUTSIDE(sv) ((XPVCV*)MUTABLE_PTR(SvANY(sv)))->xcv_outside -#define CvFLAGS(sv) ((XPVCV*)MUTABLE_PTR(SvANY(sv)))->xcv_flags +/* For use when you only have a XPVCV*, not a real CV*. + Must be assert protected as in S_CvDEPTHp before use. */ +#define CvDEPTHunsafe(sv) ((XPVCV*)MUTABLE_PTR(SvANY(sv)))->xcv_depth +#define CvPADLIST(sv) ((XPVCV*)MUTABLE_PTR(SvANY(sv)))->xcv_padlist +#define CvOUTSIDE(sv) ((XPVCV*)MUTABLE_PTR(SvANY(sv)))->xcv_outside #define CvOUTSIDE_SEQ(sv) ((XPVCV*)MUTABLE_PTR(SvANY(sv)))->xcv_outside_seq +#define CvFLAGS(sv) ((XPVCV*)MUTABLE_PTR(SvANY(sv)))->xcv_flags /* These two are sometimes called on non-CVs */ #define CvPROTO(sv) \ |