and time.
p4raw-id: //depot/perl@30857
}
#endif
- /* append to pm list */
- if (type != OP_TRANS && PL_curstash) {
- MAGIC *mg = mg_find((SV*)PL_curstash, PERL_MAGIC_symtab);
- U32 elements;
- if (!mg) {
- mg = sv_magicext((SV*)PL_curstash, 0, PERL_MAGIC_symtab, 0, 0, 0);
- }
- elements = mg->mg_len / sizeof(PMOP**);
- Renewc(mg->mg_ptr, elements + 1, PMOP*, char);
- ((PMOP**)mg->mg_ptr) [elements++] = pmop;
- mg->mg_len = elements * sizeof(PMOP**);
- PmopSTASH_set(pmop,PL_curstash);
- }
-
return CHECKOP(type, pmop);
}
REGEXP * op_pmregexp; /* compiled expression */
#endif
U32 op_pmflags;
+ /* This field is only needed so that PMOPs can delete themselves from the
+ list held by the stash. In turn, that list is only needed for reset
+ to work correctly, and is now only a list of ops used by ?? matches,
+ which are rare. Hence it would be useful if we could find a way to
+ shave it. */
#ifdef USE_ITHREADS
char * op_pmstashpv;
#else
}
pm = (PMOP*)newPMOP(type, 0);
- if (PL_multi_open == '?')
+ if (PL_multi_open == '?') {
+ /* This is the only point in the code that sets PMf_ONCE: */
pm->op_pmflags |= PMf_ONCE;
+
+ /* Hence it's safe to do this bit of PMOP book-keeping here, which
+ allows us to restrict the list needed by reset to just the ??
+ matches. */
+ assert(type != OP_TRANS);
+ if (PL_curstash) {
+ MAGIC *mg = mg_find((SV*)PL_curstash, PERL_MAGIC_symtab);
+ U32 elements;
+ if (!mg) {
+ mg = sv_magicext((SV*)PL_curstash, 0, PERL_MAGIC_symtab, 0, 0,
+ 0);
+ }
+ elements = mg->mg_len / sizeof(PMOP**);
+ Renewc(mg->mg_ptr, elements + 1, PMOP*, char);
+ ((PMOP**)mg->mg_ptr) [elements++] = pm;
+ mg->mg_len = elements * sizeof(PMOP**);
+ PmopSTASH_set(pm,PL_curstash);
+ }
+ }
#ifdef PERL_MAD
modstart = s;
#endif