summaryrefslogtreecommitdiff
path: root/pad.h
diff options
context:
space:
mode:
authorNicholas Clark <nick@ccl4.org>2006-12-28 21:21:22 +0000
committerNicholas Clark <nick@ccl4.org>2006-12-28 21:21:22 +0000
commit3441fb63c8a89050ee7151eb55228fe165595be1 (patch)
tree63644fc6c0ff184296ab16c31e79fc4eed1d9718 /pad.h
parent809abb02185a4df0f7a1a043727bae7a5c08a798 (diff)
downloadperl-3441fb63c8a89050ee7151eb55228fe165595be1.tar.gz
Move the low/high cop sequences from NVX/IVX to a two U32 structure
in the xnv union. This frees up IVX for the PL_generation code, which in turn will allow SvCUR to return to its real purpose. p4raw-id: //depot/perl@29630
Diffstat (limited to 'pad.h')
-rw-r--r--pad.h57
1 files changed, 53 insertions, 4 deletions
diff --git a/pad.h b/pad.h
index d057211914..bf91d0cc6b 100644
--- a/pad.h
+++ b/pad.h
@@ -33,12 +33,61 @@ typedef U64TYPE PADOFFSET;
/* B.xs needs these for the benefit of B::Deparse */
/* Low range end is exclusive (valid from the cop seq after this one) */
-#define COP_SEQ_RANGE_LOW(sv) U_32(SvNVX(sv))
/* High range end is inclusive (valid up to this cop seq) */
-#define COP_SEQ_RANGE_HIGH(sv) U_32(SvUVX(sv))
-#define PARENT_PAD_INDEX(sv) U_32(SvNVX(sv))
-#define PARENT_FAKELEX_FLAGS(sv) U_32(SvUVX(sv))
+#if defined (DEBUGGING) && defined(__GNUC__) && !defined(PERL_GCC_BRACE_GROUPS_FORBIDDEN)
+# define COP_SEQ_RANGE_LOW(sv) \
+ (({ SV *const _svi = (SV *) (sv); \
+ assert(SvTYPE(_svi) == SVt_NV || SvTYPE(_svi) >= SVt_PVNV); \
+ assert(SvTYPE(_svi) != SVt_PVAV); \
+ assert(SvTYPE(_svi) != SVt_PVHV); \
+ assert(SvTYPE(_svi) != SVt_PVCV); \
+ assert(SvTYPE(_svi) != SVt_PVFM); \
+ assert(!isGV_with_GP(_svi)); \
+ ((XPVNV*) SvANY(_svi))->xnv_u.xpad_cop_seq.xlow; \
+ }))
+# define COP_SEQ_RANGE_HIGH(sv) \
+ (({ SV *const _svi = (SV *) (sv); \
+ assert(SvTYPE(_svi) == SVt_NV || SvTYPE(_svi) >= SVt_PVNV); \
+ assert(SvTYPE(_svi) != SVt_PVAV); \
+ assert(SvTYPE(_svi) != SVt_PVHV); \
+ assert(SvTYPE(_svi) != SVt_PVCV); \
+ assert(SvTYPE(_svi) != SVt_PVFM); \
+ assert(!isGV_with_GP(_svi)); \
+ ((XPVNV*) SvANY(_svi))->xnv_u.xpad_cop_seq.xhigh; \
+ }))
+# define PARENT_PAD_INDEX(sv) \
+ (({ SV *const _svi = (SV *) (sv); \
+ assert(SvTYPE(_svi) == SVt_NV || SvTYPE(_svi) >= SVt_PVNV); \
+ assert(SvTYPE(_svi) != SVt_PVAV); \
+ assert(SvTYPE(_svi) != SVt_PVHV); \
+ assert(SvTYPE(_svi) != SVt_PVCV); \
+ assert(SvTYPE(_svi) != SVt_PVFM); \
+ assert(!isGV_with_GP(_svi)); \
+ ((XPVNV*) SvANY(_svi))->xnv_u.xpad_cop_seq.xlow; \
+ }))
+# define PARENT_FAKELEX_FLAGS(sv) \
+ (({ SV *const _svi = (SV *) (sv); \
+ assert(SvTYPE(_svi) == SVt_NV || SvTYPE(_svi) >= SVt_PVNV); \
+ assert(SvTYPE(_svi) != SVt_PVAV); \
+ assert(SvTYPE(_svi) != SVt_PVHV); \
+ assert(SvTYPE(_svi) != SVt_PVCV); \
+ assert(SvTYPE(_svi) != SVt_PVFM); \
+ assert(!isGV_with_GP(_svi)); \
+ ((XPVNV*) SvANY(_svi))->xnv_u.xpad_cop_seq.xhigh; \
+ }))
+#else
+# define COP_SEQ_RANGE_LOW(sv) \
+ (0 + (((XPVNV*) SvANY(sv))->xnv_u.xpad_cop_seq.xlow))
+# define COP_SEQ_RANGE_HIGH(sv) \
+ (0 + (((XPVNV*) SvANY(sv))->xnv_u.xpad_cop_seq.xhigh))
+
+
+# define PARENT_PAD_INDEX(sv) \
+ (0 + (((XPVNV*) SvANY(sv))->xnv_u.xpad_cop_seq.xlow))
+# define PARENT_FAKELEX_FLAGS(sv) \
+ (0 + (((XPVNV*) SvANY(sv))->xnv_u.xpad_cop_seq.xhigh))
+#endif
/* flags for the pad_new() function */