This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
Add an optimisation to allow proxy constant subroutines to be copied
[perl5.git] / gv.h
diff --git a/gv.h b/gv.h
index 0c776ba..a97d4ba 100644 (file)
--- a/gv.h
+++ b/gv.h
@@ -24,7 +24,14 @@ struct gp {
 
 #define GvXPVGV(gv)    ((XPVGV*)SvANY(gv))
 
-#define GvGP(gv)       (GvXPVGV(gv)->xgv_gp)
+#ifdef DEBUGGING
+#  define GvGP(gv)     (*(assert(SvTYPE(gv) == SVt_PVGV || \
+                                 SvTYPE(gv) == SVt_PVLV), \
+                          &(GvXPVGV(gv)->xgv_gp)))
+#else
+#  define GvGP(gv)     (GvXPVGV(gv)->xgv_gp)
+#endif
+
 #define GvNAME(gv)     (GvXPVGV(gv)->xgv_name)
 #define GvNAMELEN(gv)  (GvXPVGV(gv)->xgv_namelen)
 #define GvSTASH(gv)    (GvXPVGV(gv)->xgv_stash)
@@ -128,8 +135,8 @@ Return the SV from the GV.
 #define GvIN_PAD_off(gv)       (GvFLAGS(gv) &= ~GVf_IN_PAD)
 
 #define GvUNIQUE(gv)            0
-#define GvUNIQUE_on(gv)         0
-#define GvUNIQUE_off(gv)        0
+#define GvUNIQUE_on(gv)
+#define GvUNIQUE_off(gv)
 
 #ifdef USE_ITHREADS
 #define GV_UNIQUE_CHECK
@@ -155,8 +162,15 @@ Return the SV from the GV.
 #define GV_ADDWARN     0x04    /* add, but warn if symbol wasn't already there */
 #define GV_ADDINEVAL   0x08    /* add, as though we're doing so within an eval */
 #define GV_NOINIT      0x10    /* add, but don't init symbol, if type != PVGV */
+/* This is used by toke.c to avoid turing placeholder constants in the symbol
+   table into full PVGVs with attached constant subroutines.  */
+#define GV_NOADD_NOINIT        0x20    /* Don't add the symbol if it's not there.
+                                  Don't init it if it is there but ! PVGV */
+#define GV_NOEXPAND    0x40    /* Don't expand SvOK() entries to PVGV */
+
 /*      SVf_UTF8 (more accurately the return value from SvUTF8) is also valid
        as a flag to gv_fetch_pvn_flags, so ensure it lies outside this range.
 */
 #define gv_fullname3(sv,gv,prefix) gv_fullname4(sv,gv,prefix,TRUE)
 #define gv_efullname3(sv,gv,prefix) gv_efullname4(sv,gv,prefix,TRUE)
+#define gv_fetchmethod(stash, name) gv_fetchmethod_autoload(stash, name, TRUE)