summaryrefslogtreecommitdiff
path: root/cv.h
diff options
context:
space:
mode:
authorDavid Mitchell <davem@iabyn.com>2010-07-18 15:07:08 +0100
committerDavid Mitchell <davem@iabyn.com>2010-07-18 18:39:18 +0100
commitcfc1e951d98ba2b9a0e066aba9aadba4cd919eec (patch)
tree035e1c687d0f681990220c6e3f4db9317252fd3e /cv.h
parent00c0cb6d254eaba165c8445a6e68686b8285b5a3 (diff)
downloadperl-cfc1e951d98ba2b9a0e066aba9aadba4cd919eec.tar.gz
add CVf_CVGV_RC flag
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.
Diffstat (limited to 'cv.h')
-rw-r--r--cv.h10
1 files changed, 6 insertions, 4 deletions
diff --git a/cv.h b/cv.h
index fe96aa3e3a..d762a062cf 100644
--- a/cv.h
+++ b/cv.h
@@ -70,14 +70,12 @@ Returns the stash of the CV.
#define CVf_WEAKOUTSIDE 0x0010 /* CvOUTSIDE isn't ref counted */
#define CVf_CLONE 0x0020 /* anon CV uses external lexicals */
#define CVf_CLONED 0x0040 /* a clone of one of those */
-#define CVf_ANON 0x0080 /* implies: CV is not pointed to by a GV,
- CvGV is refcounted, and
- points to an __ANON__ GV;
- at compile time only, also implies sub {} */
+#define CVf_ANON 0x0080 /* CV is not pointed to by a GV */
#define CVf_UNIQUE 0x0100 /* sub is only called once (eg PL_main_cv,
* require, eval). */
#define CVf_NODEBUG 0x0200 /* no DB::sub indirection for this CV
(esp. useful for special XSUBs) */
+#define CVf_CVGV_RC 0x0400 /* CvGV is reference counted */
/* This symbol for optimised communication between toke.c and op.c: */
#define CVf_BUILTIN_ATTRS (CVf_METHOD|CVf_LVALUE)
@@ -131,6 +129,10 @@ Returns the stash of the CV.
#define CvISXSUB_on(cv) (CvFLAGS(cv) |= CVf_ISXSUB)
#define CvISXSUB_off(cv) (CvFLAGS(cv) &= ~CVf_ISXSUB)
+#define CvCVGV_RC(cv) (CvFLAGS(cv) & CVf_CVGV_RC)
+#define CvCVGV_RC_on(cv) (CvFLAGS(cv) |= CVf_CVGV_RC)
+#define CvCVGV_RC_off(cv) (CvFLAGS(cv) &= ~CVf_CVGV_RC)
+
/* Flags for newXS_flags */
#define XS_DYNAMIC_FILENAME 0x01 /* The filename isn't static */