summaryrefslogtreecommitdiff
path: root/perl.h
diff options
context:
space:
mode:
authorNicholas Clark <nick@ccl4.org>2005-12-23 16:55:35 +0000
committerNicholas Clark <nick@ccl4.org>2005-12-23 16:55:35 +0000
commitcd1541b29232033fba1800a2ccd9ae38b4e1b8c3 (patch)
tree7d0c570a4819c555372f89aae04dc4631db455a5 /perl.h
parent6f226cd7e2e174eaee90c21b4e6e1408383e3e75 (diff)
downloadperl-cd1541b29232033fba1800a2ccd9ae38b4e1b8c3.tar.gz
If PERL_TRACK_MEMPOOL and PERL_POISON are in use, then scribble all
over memory to invalidate it just before free()ing it. p4raw-id: //depot/perl@26476
Diffstat (limited to 'perl.h')
-rw-r--r--perl.h30
1 files changed, 20 insertions, 10 deletions
diff --git a/perl.h b/perl.h
index b31418418b..f478c22b9f 100644
--- a/perl.h
+++ b/perl.h
@@ -138,8 +138,6 @@
#define pVAR register struct perl_vars* my_vars PERL_UNUSED_DECL
-typedef struct interpreter PerlInterpreter;
-
#ifdef PERL_GLOBAL_STRUCT
# define dVAR pVAR = (struct perl_vars*)PERL_GET_VARS()
#else
@@ -151,14 +149,6 @@ typedef struct interpreter PerlInterpreter;
# define MULTIPLICITY
# endif
# define tTHX PerlInterpreter*
-
-struct perl_memory_debug_header {
- tTHX interpreter;
-};
-
-# define sTHX (sizeof(struct perl_memory_debug_header) + \
- (MEM_ALIGNBYTES - sizeof(struct perl_memory_debug_header) \
- %MEM_ALIGNBYTES) % MEM_ALIGNBYTES)
# define pTHX register tTHX my_perl PERL_UNUSED_DECL
# define aTHX my_perl
# ifdef PERL_GLOBAL_STRUCT
@@ -2164,6 +2154,8 @@ typedef struct padop PADOP;
typedef struct pvop PVOP;
typedef struct loop LOOP;
+typedef struct interpreter PerlInterpreter;
+
/* Amdahl's <ksync.h> has struct sv */
/* SGI's <sys/sema.h> has struct sv */
#if defined(UTS) || defined(__sgi)
@@ -3734,6 +3726,24 @@ typedef Sighandler_t Sigsave_t;
# define MALLOC_TERM
#endif
+#if defined(PERL_IMPLICIT_CONTEXT)
+struct perl_memory_debug_header {
+ tTHX interpreter;
+# ifdef PERL_POISON
+ MEM_SIZE size;
+ U8 in_use;
+# endif
+
+#define PERL_POISON_INUSE 29
+#define PERL_POISON_FREE 159
+};
+
+# define sTHX (sizeof(struct perl_memory_debug_header) + \
+ (MEM_ALIGNBYTES - sizeof(struct perl_memory_debug_header) \
+ %MEM_ALIGNBYTES) % MEM_ALIGNBYTES)
+
+#endif
+
typedef int (CPERLscope(*runops_proc_t)) (pTHX);
typedef void (CPERLscope(*share_proc_t)) (pTHX_ SV *sv);