diff options
author | Nicholas Clark <nick@ccl4.org> | 2008-01-11 12:14:04 +0000 |
---|---|---|
committer | Nicholas Clark <nick@ccl4.org> | 2008-01-11 12:14:04 +0000 |
commit | 14a49a2428492a7a120f0254ff8085e99252f641 (patch) | |
tree | 32e1575fa0e68d4c2eb45dc0c44f5e6e312c862a /op.c | |
parent | ccb2c8b8ab146edc148e377cd6b108da77d1320b (diff) | |
download | perl-14a49a2428492a7a120f0254ff8085e99252f641.tar.gz |
REGEXPs are now stored directly in PL_regex_padav, rather than
indirectly via RVs. This saves memory, and removes 1 level of pointer
indirection.
p4raw-id: //depot/perl@32950
Diffstat (limited to 'op.c')
-rw-r--r-- | op.c | 13 |
1 files changed, 5 insertions, 8 deletions
@@ -624,10 +624,8 @@ clear_pmop: #ifdef USE_ITHREADS if(PL_regex_pad) { /* We could be in destruction */ ReREFCNT_dec(PM_GETRE(cPMOPo)); - av_push((AV*) PL_regex_pad[0], - (SV*) SvREFCNT_inc_simple_NN(PL_regex_pad[(cPMOPo)->op_pmoffset])); - SvREADONLY_off(PL_regex_pad[(cPMOPo)->op_pmoffset]); - PM_SETRE_OFFSET(cPMOPo, (cPMOPo)->op_pmoffset); + av_push((AV*) PL_regex_pad[0], newSViv((cPMOPo)->op_pmoffset)); + PL_regex_pad[(cPMOPo)->op_pmoffset] = &PL_sv_undef; } #else ReREFCNT_dec(PM_GETRE(cPMOPo)); @@ -3370,12 +3368,11 @@ Perl_newPMOP(pTHX_ I32 type, I32 flags) SV * const repointer = av_pop((AV*)PL_regex_pad[0]); const IV offset = SvIV(repointer); pmop->op_pmoffset = offset; - SvOK_off(repointer); - assert(repointer == PL_regex_pad[offset]); - /* One reference remains, in PL_regex_pad[offset] */ + /* This slot should be free, so assert this: */ + assert(PL_regex_pad[offset] == &PL_sv_undef); SvREFCNT_dec(repointer); } else { - SV * const repointer = newSViv(0); + SV * const repointer = &PL_sv_undef; av_push(PL_regex_padav, repointer); pmop->op_pmoffset = av_len(PL_regex_padav); PL_regex_pad = AvARRAY(PL_regex_padav); |