summaryrefslogtreecommitdiff
path: root/cv.h
diff options
context:
space:
mode:
authorDaniel Dragan <bulk88@hotmail.com>2014-10-31 03:23:17 -0400
committerFather Chrysostomos <sprout@cpan.org>2014-10-31 12:37:08 -0700
commiteacbb37937698a035d5ed63fcbdf15dd4eab56cf (patch)
tree99f7dc0cbedf55df1391d054c456f5d2b52a3ae9 /cv.h
parent699ed31ec604580b23b25fc7a7fb44b59c92cbc6 (diff)
downloadperl-eacbb37937698a035d5ed63fcbdf15dd4eab56cf.tar.gz
free up CvPADLIST slot for XSUBs for future use
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].
Diffstat (limited to 'cv.h')
-rw-r--r--cv.h28
1 files changed, 27 insertions, 1 deletions
diff --git a/cv.h b/cv.h
index 2068ca06a0..f532b4524c 100644
--- a/cv.h
+++ b/cv.h
@@ -65,7 +65,33 @@ See L<perlguts/Autoloading with XSUBs>.
/* 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
+
+/* these CvPADLIST/CvRESERVED asserts can be reverted one day, once stabilized */
+#define CvPADLIST(sv) (*(assert_(!CvISXSUB((CV*)(sv))) \
+ &(((XPVCV*)MUTABLE_PTR(SvANY(sv)))->xcv_padlist_u.xcv_padlist)))
+/* CvPADLIST_set is not public API, it can be removed one day, once stabilized */
+#ifdef DEBUGGING
+# define CvPADLIST_set(sv, padlist) Perl_set_padlist(aTHX_ (CV*)sv, padlist)
+#else
+# define CvPADLIST_set(sv, padlist) (CvPADLIST(sv) = (padlist))
+#endif
+/* CvRESERVED is a placeholder and will be going away soon */
+#define CvRESERVED(sv) *(assert_(CvISXSUB((CV*)(sv))) \
+ &(((XPVCV*)MUTABLE_PTR(SvANY(sv)))->xcv_padlist_u.xcv_reserved))
+#ifdef DEBUGGING
+# if PTRSIZE == 8
+# define PoisonPADLIST(sv) \
+ (((XPVCV*)MUTABLE_PTR(SvANY(sv)))->xcv_padlist_u.xcv_padlist = (PADLIST *)UINT64_C(0xEFEFEFEFEFEFEFEF))
+# elif PTRSIZE == 4
+# define PoisonPADLIST(sv) \
+ (((XPVCV*)MUTABLE_PTR(SvANY(sv)))->xcv_padlist_u.xcv_padlist = (PADLIST *)0xEFEFEFEF)
+# else
+# error unknown pointer size
+# endif
+#else
+# define PoisonPADLIST(sv)
+#endif
+
#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