summaryrefslogtreecommitdiff
path: root/cv.h
diff options
context:
space:
mode:
authorNicholas Clark <nick@ccl4.org>2006-02-20 13:42:47 +0000
committerNicholas Clark <nick@ccl4.org>2006-02-20 13:42:47 +0000
commitd04ba5897acce6425e3b231fbf36336ea42f8165 (patch)
tree0300fa64efa15fc65f2c48cc2938c1fe8afa0e5a /cv.h
parentbf53b3a5f249ae2a059ca8014f7a62d301c554bc (diff)
downloadperl-d04ba5897acce6425e3b231fbf36336ea42f8165.tar.gz
xcv_root and xcv_xsub can also be merged into a union, providing a new
flag is added to denote whether the PVCV is perl or XSUB. p4raw-id: //depot/perl@27244
Diffstat (limited to 'cv.h')
-rw-r--r--cv.h16
1 files changed, 11 insertions, 5 deletions
diff --git a/cv.h b/cv.h
index d082146a25..9e1dce0499 100644
--- a/cv.h
+++ b/cv.h
@@ -27,8 +27,10 @@ struct xpvcv {
OP * xcv_start;
ANY xcv_xsubany;
} xcv_start_u;
- OP * xcv_root;
- void (*xcv_xsub) (pTHX_ CV*);
+ union {
+ OP * xcv_root;
+ void (*xcv_xsub) (pTHX_ CV*);
+ } xcv_root_u;
GV * xcv_gv;
char * xcv_file;
long xcv_depth; /* >= 2 indicates recursive call */
@@ -58,8 +60,8 @@ Returns the stash of the CV.
#define CvSTASH(sv) ((XPVCV*)SvANY(sv))->xcv_stash
#define CvSTART(sv) ((XPVCV*)SvANY(sv))->xcv_start_u.xcv_start
-#define CvROOT(sv) ((XPVCV*)SvANY(sv))->xcv_root
-#define CvXSUB(sv) ((XPVCV*)SvANY(sv))->xcv_xsub
+#define CvROOT(sv) ((XPVCV*)SvANY(sv))->xcv_root_u.xcv_root
+#define CvXSUB(sv) ((XPVCV*)SvANY(sv))->xcv_root_u.xcv_xsub
#define CvXSUBANY(sv) ((XPVCV*)SvANY(sv))->xcv_start_u.xcv_xsubany
#define CvGV(sv) ((XPVCV*)SvANY(sv))->xcv_gv
#define CvFILE(sv) ((XPVCV*)SvANY(sv))->xcv_file
@@ -92,6 +94,7 @@ Returns the stash of the CV.
(esp. useful for special XSUBs) */
#define CVf_CONST 0x0400 /* inlinable sub */
#define CVf_OLDSTYLE 0x0800
+#define CVf_ISXSUB 0x1000 /* CV is an XSUB, not pure perl. */
/* This symbol for optimised communication between toke.c and op.c: */
#define CVf_BUILTIN_ATTRS (CVf_METHOD|CVf_LOCKED|CVf_LVALUE|CVf_ASSERTION)
@@ -155,7 +158,10 @@ Returns the stash of the CV.
#define CvWEAKOUTSIDE_on(cv) (CvFLAGS(cv) |= CVf_WEAKOUTSIDE)
#define CvWEAKOUTSIDE_off(cv) (CvFLAGS(cv) &= ~CVf_WEAKOUTSIDE)
-#define CvISXSUB(cv) (CvXSUB(cv) ? TRUE : FALSE)
+#define CvISXSUB(cv) (CvFLAGS(cv) & CVf_ISXSUB)
+#define CvISXSUB_on(cv) (CvFLAGS(cv) |= CVf_ISXSUB)
+#define CvISXSUB_off(cv) (CvFLAGS(cv) &= ~CVf_ISXSUB)
+
/*
=head1 CV reference counts and CvOUTSIDE