This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
perlop: Make correction
[perl5.git] / pad.h
diff --git a/pad.h b/pad.h
index e19c7a8..1f86248 100644 (file)
--- a/pad.h
+++ b/pad.h
@@ -34,7 +34,8 @@ typedef U64TYPE PADOFFSET;
 struct padlist {
     SSize_t    xpadl_max;      /* max index for which array has space */
     PAD **     xpadl_alloc;    /* pointer to beginning of array of AVs */
-    PADNAMELIST*xpadl_outid;   /* Padnamelist of outer pad; used as ID */
+    U32                xpadl_id;       /* Semi-unique ID, shared between clones */
+    U32                xpadl_outid;    /* ID of outer pad */
 };
 
 struct padnamelist {
@@ -45,26 +46,46 @@ struct padnamelist {
     U32                xpadnl_refcnt;
 };
 
+/* PERL_PADNAME_MINIMAL uses less memory, but on some platforms
+   PERL_PADNAME_ALIGNED may be faster, so platform-specific hints can
+   define one or the other.  */
+#if defined(PERL_PADNAME_MINIMAL) && defined (PERL_PADNAME_ALIGNED)
+#  error PERL_PADNAME_MINIMAL and PERL_PADNAME_ALIGNED are exclusive
+#endif
+
+#if !defined(PERL_PADNAME_MINIMAL) && !defined(PERL_PADNAME_ALIGNED)
+#  define PERL_PADNAME_MINIMAL
+#endif
+
+#define _PADNAME_BASE \
+    char *     xpadn_pv;               \
+    HV *       xpadn_ourstash;         \
+    union {                            \
+       HV *    xpadn_typestash;        \
+       CV *    xpadn_protocv;          \
+    } xpadn_type_u;                    \
+    U32                xpadn_low;              \
+    U32                xpadn_high;             \
+    U32                xpadn_refcnt;           \
+    int                xpadn_gen;              \
+    U8         xpadn_len;              \
+    U8         xpadn_flags
+
 struct padname {
-    char *     xpadn_pv;
-    HV *       xpadn_ourstash;
-    union {
-       HV *    xpadn_typestash;
-       CV *    xpadn_protocv;
-    } xpadn_type_u;
-    U32                xpadn_low;
-    U32                xpadn_high;
-    U32                xpadn_refcnt;
-    int                xpadn_gen;
-    U8         xpadn_len;
-    U8         xpadn_flags;
+    _PADNAME_BASE;
 };
 
 struct padname_with_str {
+#ifdef PERL_PADNAME_MINIMAL
+    _PADNAME_BASE;
+#else
     struct padname     xpadn_padname;
+#endif
     char               xpadn_str[1];
 };
 
+#undef _PADNAME_BASE
+
 #define PADNAME_FROM_PV(s) \
     ((PADNAME *)((s) - STRUCT_OFFSET(struct padname_with_str, xpadn_str)))
 
@@ -494,11 +515,5 @@ of a string/length pair.
     Perl_pad_findmy_pvn(aTHX_ STR_WITH_LEN(name), flags)
 
 /*
- * Local variables:
- * c-indentation-style: bsd
- * c-basic-offset: 4
- * indent-tabs-mode: nil
- * End:
- *
  * ex: set ts=8 sts=4 sw=4 et:
  */