diff options
author | Nicholas Clark <nick@ccl4.org> | 2006-04-12 22:45:12 +0000 |
---|---|---|
committer | Nicholas Clark <nick@ccl4.org> | 2006-04-12 22:45:12 +0000 |
commit | 72dc9ed5af65c946f73050becea29207a1af86c1 (patch) | |
tree | 77d02ca4340063d7184142085f9527f83a40992e /scope.h | |
parent | aa283a383ef6540d57dd786b93d8ba9bd303e3e6 (diff) | |
download | perl-72dc9ed5af65c946f73050becea29207a1af86c1.tar.gz |
Change cop_warnings from an SV holding the warnings bitmask to a
directly (shared) malloc()ed buffer holding the warnings bitmask.
This avoids bugs/crashes when the interpreter that created an optree
is freed but the optree remains in use by other interpreters.
p4raw-id: //depot/perl@27779
Diffstat (limited to 'scope.h')
-rw-r--r-- | scope.h | 21 |
1 files changed, 21 insertions, 0 deletions
@@ -51,6 +51,8 @@ #define SAVEt_SAVESWITCHSTACK 40 #define SAVEt_COP_ARYBASE 41 #define SAVEt_RE_STATE 42 +#define SAVEt_FREESHAREDPV 43 +#define SAVEt_COP_WARNINGS 44 #ifndef SCOPE_SAVES_SIGNAL_MASK #define SCOPE_SAVES_SIGNAL_MASK 0 @@ -192,6 +194,25 @@ Closing bracket on a callback. See C<ENTER> and L<perlcall>. SSPUSHINT(SAVEt_COP_ARYBASE); \ } STMT_END +#define SAVEFREESHAREDPV(pv) \ + STMT_START { \ + SSCHECK(2); \ + SSPUSHPTR(pv); \ + SSPUSHINT(SAVEt_FREESHAREDPV); \ + } STMT_END + +/* Need to do the cop warnings like this, rather than SAVEFREESHAREDPV, + because realloc() means that the value can actually change. Possibly + could have done savefreesharedpvREF, but this way actually seems cleaner, + as it simplifies the code that does the saves, and reduces the load on the + save stack. */ +#define SAVECOPWARNINGS(c) \ + STMT_START { \ + SSCHECK(3); \ + SSPUSHPTR((c)->cop_warnings); \ + SSPUSHPTR(c); \ + SSPUSHINT(SAVEt_COP_WARNINGS); \ + } STMT_END #ifdef USE_ITHREADS # define SAVECOPSTASH(c) SAVEPPTR(CopSTASHPV(c)) |