summaryrefslogtreecommitdiff
path: root/pp_ctl.c
diff options
context:
space:
mode:
authorGurusamy Sarathy <gsar@cpan.org>1999-12-20 16:28:51 +0000
committerGurusamy Sarathy <gsar@cpan.org>1999-12-20 16:28:51 +0000
commit2360cd68127e75c48ae54a165bf882455ec55e1c (patch)
tree8b8398fdb200898dd176f1d1efcdd579a1c019d9 /pp_ctl.c
parent40b7eeef93cf0584b0d7d850beb70a00e3135bc3 (diff)
downloadperl-2360cd68127e75c48ae54a165bf882455ec55e1c.tar.gz
avoid pp_regcomp() changing optree at run time under USE_*THREADS (or
we have a race on our hands) p4raw-id: //depot/perl@4700
Diffstat (limited to 'pp_ctl.c')
-rw-r--r--pp_ctl.c11
1 files changed, 11 insertions, 0 deletions
diff --git a/pp_ctl.c b/pp_ctl.c
index feec3634ee..0bb6919709 100644
--- a/pp_ctl.c
+++ b/pp_ctl.c
@@ -87,6 +87,13 @@ PP(pp_regcomp)
STRLEN len;
MAGIC *mg = Null(MAGIC*);
+#if defined(USE_ITHREADS) || defined(USE_THREADS)
+ if ((pm->op_pmflags & PMf_KEEP) && !(pm->op_private & OPpRUNTIME)) {
+ /* no point compiling again */
+ RETURN;
+ }
+#endif
+
tmpstr = POPs;
if (SvROK(tmpstr)) {
SV *sv = SvRV(tmpstr);
@@ -134,9 +141,13 @@ PP(pp_regcomp)
else if (strEQ("\\s+", pm->op_pmregexp->precomp))
pm->op_pmflags |= PMf_WHITE;
+ /* XXX runtime compiled output needs to move to the pad */
if (pm->op_pmflags & PMf_KEEP) {
pm->op_private &= ~OPpRUNTIME; /* no point compiling again */
+#if !defined(USE_ITHREADS) && !defined(USE_THREADS)
+ /* XXX can't change the optree at runtime either */
cLOGOP->op_first->op_next = PL_op->op_next;
+#endif
}
RETURN;
}