diff options
author | Yves Orton <demerphq@gmail.com> | 2022-11-04 10:26:11 +0100 |
---|---|---|
committer | Yves Orton <demerphq@gmail.com> | 2022-11-04 10:35:40 +0100 |
commit | fdec6615b5832b7cecbb10b8782630b054a8de4a (patch) | |
tree | dfbb4c421d7467427355ce33208fb334f27d0e54 /scope.h | |
parent | 66964e141c6594291e27649d190bc6ca573861f2 (diff) | |
download | perl-fdec6615b5832b7cecbb10b8782630b054a8de4a.tar.gz |
scope.* - revert and rework SAVECOPWARNINGS change
We can't put PL_compiling or PL_curcop on the save stack as we don't
have a way to ensure they cross threads properly. This showed up as a
win32 t/op/fork.t failure in the thread based fork emulation layer.
This adds a new save type SAVEt_CURCOP_WARNINGS and macro
SAVECURCOPWARNINGS() to complement SAVEt_COMPILER_WARNINGS and
SAVECOMPILEWARNINGS(). By simply hard coding where the pointers should
be restored to we side step the issue of which thread we are in.
Thanks to Graham Knop for help identifying that one of my commits was
responsible.
Diffstat (limited to 'scope.h')
-rw-r--r-- | scope.h | 12 |
1 files changed, 5 insertions, 7 deletions
@@ -215,13 +215,11 @@ scope has the given name. C<name> must be a literal string. PL_curstackinfo->si_stack = (t); \ } STMT_END -/* Need to do the cop warnings like this, rather than a "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(cop) save_pushptrptr((cop),(cop)->cop_warnings, SAVEt_COMPILE_WARNINGS) -#define SAVECOMPILEWARNINGS() SAVECOPWARNINGS(&PL_compiling) +/* Note these are special, we can't just use a save_pushptrptr() on them + * as the target might change after a fork or thread start. */ +#define SAVECOMPILEWARNINGS() save_pushptr(PL_compiling.cop_warnings, SAVEt_COMPILE_WARNINGS) +#define SAVECURCOPWARNINGS() save_pushptr(PL_curcop->cop_warnings, SAVEt_CURCOP_WARNINGS) + #define SAVEPARSER(p) save_pushptr((p), SAVEt_PARSER) |