SVt_PVHV, /* 12 */
SVt_PVCV, /* 13 */
SVt_PVFM, /* 14 */
- SVt_PVIO /* 15 */
+ SVt_PVIO, /* 15 */
+ SVt_LAST /* keep last in enum. used to size arrays */
} svtype;
+#ifdef PERL_IN_SV_C
+#define PTE_SVSLOT SVt_RV
+#endif
+#if defined(PERL_IN_HV_C) || defined(PERL_IN_XS_APITEST)
+#define HE_SVSLOT SVt_NULL
+#endif
/* typedefs to eliminate some typing */
typedef struct he HE;
#define SVTYPEMASK 0xff
#define SvTYPE(sv) ((sv)->sv_flags & SVTYPEMASK)
+/* Sadly there are some parts of the core that have pointers to already-freed
+ SV heads, and rely on being able to tell that they are now free. So mark
+ them all by using a consistent macro. */
+#define SvIS_FREED(sv) ((sv)->sv_flags == SVTYPEMASK)
+
#define SvUPGRADE(sv, mt) (SvTYPE(sv) >= (mt) || (sv_upgrade(sv, mt), 1))
#define SVs_PADSTALE 0x00000100 /* lexical has gone out of scope */