diff options
author | Nicholas Clark <nick@ccl4.org> | 2011-04-24 16:37:17 +0100 |
---|---|---|
committer | Nicholas Clark <nick@ccl4.org> | 2011-06-12 11:25:48 +0200 |
commit | 93bad3fd55489cbd2d3157da1fcb3b524e960dd2 (patch) | |
tree | 295d059c38869a4b8ca10c2b9b6a8479748e1ffd /sv.c | |
parent | 464a08e7ffded0873dfb1539fceae173c22a1090 (diff) | |
download | perl-93bad3fd55489cbd2d3157da1fcb3b524e960dd2.tar.gz |
Split OP_AELEMFAST_LEX out from OP_AELEMFAST.
6a077020aea1c5f0 extended the OP_AELEMFAST optimisation to lexical arrays.
Previously OP_AELEMFAST was only used as an optimisation for OP_GV, which is a
PADOP/SVOP.
However, by reusing the same opcode, and signalling (pad) lexical vs package,
it introduced a myriad of special cases, because OP_PADAV is a BASEOP (not a
PADOP), whilst OP_AELEMFAST is a PADOP/SVOP (which is larger).
Using two OP numbers allows each variant to have the correct OP flags in
PL_opargs. Both can continue to share the same C code.
Diffstat (limited to 'sv.c')
-rw-r--r-- | sv.c | 27 |
1 files changed, 13 insertions, 14 deletions
@@ -13865,21 +13865,20 @@ S_find_uninit_var(pTHX_ const OP *const obase, const SV *const uninit_sv, break; return varname(gv, '$', 0, NULL, 0, FUV_SUBSCRIPT_NONE); - case OP_AELEMFAST: - if (obase->op_flags & OPf_SPECIAL) { /* lexical array */ - if (match) { - SV **svp; - AV *av = MUTABLE_AV(PAD_SV(obase->op_targ)); - if (!av || SvRMAGICAL(av)) - break; - svp = av_fetch(av, (I32)obase->op_private, FALSE); - if (!svp || *svp != uninit_sv) - break; - } - return varname(NULL, '$', obase->op_targ, - NULL, (I32)obase->op_private, FUV_SUBSCRIPT_ARRAY); + case OP_AELEMFAST_LEX: + if (match) { + SV **svp; + AV *av = MUTABLE_AV(PAD_SV(obase->op_targ)); + if (!av || SvRMAGICAL(av)) + break; + svp = av_fetch(av, (I32)obase->op_private, FALSE); + if (!svp || *svp != uninit_sv) + break; } - else { + return varname(NULL, '$', obase->op_targ, + NULL, (I32)obase->op_private, FUV_SUBSCRIPT_ARRAY); + case OP_AELEMFAST: + { gv = cGVOPx_gv(obase); if (!gv) break; |