diff options
author | Steve Peters <steve@fisharerojo.org> | 2005-11-04 21:39:44 +0000 |
---|---|---|
committer | Steve Peters <steve@fisharerojo.org> | 2005-11-04 21:39:44 +0000 |
commit | 25a55bd7167f6c07d7f1a4edc143de02e6cd234e (patch) | |
tree | d5430edc2c0ceec9bc8162de4e1b513a5f330983 /pp_hot.c | |
parent | 8a9c777e2c77e4986acca93933c193ed57804ec4 (diff) | |
download | perl-25a55bd7167f6c07d7f1a4edc143de02e6cd234e.tar.gz |
I barely knew ya pp_dor. Merged into pp_defined from whence you came.
This change has also caused pp_defined to be promoted to being a hot
op.
p4raw-id: //depot/perl@26004
Diffstat (limited to 'pp_hot.c')
-rw-r--r-- | pp_hot.c | 47 |
1 files changed, 33 insertions, 14 deletions
@@ -324,38 +324,57 @@ PP(pp_or) } } -PP(pp_dor) +PP(pp_defined) { - /* Most of this is lifted straight from pp_defined */ dSP; - register SV* const sv = TOPs; - - if (!sv || !SvANY(sv)) { - --SP; - RETURNOP(cLOGOP->op_other); + register SV* sv; + bool defined = FALSE; + const int op_type = PL_op->op_type; + + if(op_type == OP_DOR) { + sv = TOPs; + if (!sv || !SvANY(sv)) { + --SP; + RETURNOP(cLOGOP->op_other); + } + } else if (op_type == OP_DEFINED) { + sv = POPs; + if (!sv || !SvANY(sv)) + RETPUSHNO; } - + switch (SvTYPE(sv)) { case SVt_PVAV: if (AvMAX(sv) >= 0 || SvGMAGICAL(sv) || (SvRMAGICAL(sv) && mg_find(sv, PERL_MAGIC_tied))) - RETURN; + defined = TRUE; break; case SVt_PVHV: if (HvARRAY(sv) || SvGMAGICAL(sv) || (SvRMAGICAL(sv) && mg_find(sv, PERL_MAGIC_tied))) - RETURN; + defined = TRUE; break; case SVt_PVCV: if (CvROOT(sv) || CvXSUB(sv)) - RETURN; + defined = TRUE; break; default: SvGETMAGIC(sv); if (SvOK(sv)) - RETURN; + defined = TRUE; } - --SP; - RETURNOP(cLOGOP->op_other); + if(defined) { + if(op_type == OP_DOR) + RETURN; + else if (op_type == OP_DEFINED) + RETPUSHYES; + } + + if(op_type == OP_DOR) { + --SP; + RETURNOP(cLOGOP->op_other); + } else if (op_type == OP_DEFINED) { + RETPUSHNO; + } } PP(pp_add) |