Change 29488 by [EMAIL PROTECTED] on 2006/12/08 22:20:41
add missing OP_REFCNT_LOCK/UNLOCKs and document it
Affected files ...
... //depot/perl/op.h#158 edit
... //depot/perl/sv.c#1330 edit
Differences ...
==== //depot/perl/op.h#158 (text) ====
Index: perl/op.h
--- perl/op.h#157~29360~ 2006-11-23 04:57:18.000000000 -0800
+++ perl/op.h 2006-12-08 14:20:41.000000000 -0800
@@ -520,6 +520,15 @@
#define OA_SCALARREF 7
#define OA_OPTIONAL 8
+/* Op_REFCNT is a reference count at the head of each op tree: needed
+ * since the tree is shared between threads, and between cloned closure
+ * copies in the same thread. OP_REFCNT_LOCK/UNLOCK is used when modifying
+ * this count.
+ * The same mutex is used to protect the refcounts of the reg_trie_data
+ * and reg_ac_data structures, which are shared between duplicated
+ * regexes.
+ */
+
#ifdef USE_ITHREADS
# define OP_REFCNT_INIT MUTEX_INIT(&PL_op_mutex)
# ifdef PERL_CORE
==== //depot/perl/sv.c#1330 (text) ====
Index: perl/sv.c
--- perl/sv.c#1329~29430~ 2006-12-01 05:59:27.000000000 -0800
+++ perl/sv.c 2006-12-08 14:20:41.000000000 -0800
@@ -10421,7 +10421,9 @@
case OP_LEAVEWRITE:
TOPPTR(nss,ix) = ptr;
o = (OP*)ptr;
+ OP_REFCNT_LOCK;
OpREFCNT_inc(o);
+ OP_REFCNT_UNLOCK;
break;
default:
TOPPTR(nss,ix) = NULL;
@@ -10993,7 +10995,9 @@
/* current interpreter roots */
PL_main_cv = cv_dup_inc(proto_perl->Imain_cv, param);
+ OP_REFCNT_LOCK;
PL_main_root = OpREFCNT_inc(proto_perl->Imain_root);
+ OP_REFCNT_UNLOCK;
PL_main_start = proto_perl->Imain_start;
PL_eval_root = proto_perl->Ieval_root;
PL_eval_start = proto_perl->Ieval_start;
End of Patch.