From: Steve Peters Date: Fri, 4 Nov 2005 21:39:44 +0000 (+0000) Subject: I barely knew ya pp_dor. Merged into pp_defined from whence you came. X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=25a55bd7167f6c07d7f1a4edc143de02e6cd234e;p=p5sagit%2Fp5-mst-13.2.git 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 --- diff --git a/mathoms.c b/mathoms.c index 4721cb2..ce5f182 100644 --- a/mathoms.c +++ b/mathoms.c @@ -995,6 +995,11 @@ PP(pp_semop) return pp_shmwrite(); } +PP(pp_dor) +{ + return pp_dor(); +} + U8 * Perl_uvuni_to_utf8(pTHX_ U8 *d, UV uv) { diff --git a/opcode.h b/opcode.h index 216f1d9..3cec861 100644 --- a/opcode.h +++ b/opcode.h @@ -1117,7 +1117,7 @@ EXT Perl_ppaddr_t PL_ppaddr[] /* or perlvars.h */ MEMBER_TO_FPTR(Perl_unimplemented_op), /* Perl_pp_threadsv */ MEMBER_TO_FPTR(Perl_pp_setstate), MEMBER_TO_FPTR(Perl_pp_method_named), - MEMBER_TO_FPTR(Perl_pp_dor), + MEMBER_TO_FPTR(Perl_pp_defined), /* Perl_pp_dor */ MEMBER_TO_FPTR(Perl_pp_dorassign), } #endif diff --git a/opcode.pl b/opcode.pl index 9f0a24c..4a099ec 100755 --- a/opcode.pl +++ b/opcode.pl @@ -73,6 +73,7 @@ my @raw_alias = ( fteexec)], Perl_pp_shmwrite => [qw(shmread msgsnd msgrcv semop)], Perl_pp_send => ['syswrite'], + Perl_pp_defined => ['dor'], ); while (my ($func, $names) = splice @raw_alias, 0, 2) { diff --git a/pp.c b/pp.c index a13c6a6..eb217d0 100644 --- a/pp.c +++ b/pp.c @@ -722,36 +722,6 @@ PP(pp_chomp) RETURN; } -PP(pp_defined) -{ - dSP; - register SV* const 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))) - RETPUSHYES; - break; - case SVt_PVHV: - if (HvARRAY(sv) || SvGMAGICAL(sv) - || (SvRMAGICAL(sv) && mg_find(sv, PERL_MAGIC_tied))) - RETPUSHYES; - break; - case SVt_PVCV: - if (CvROOT(sv) || CvXSUB(sv)) - RETPUSHYES; - break; - default: - SvGETMAGIC(sv); - if (SvOK(sv)) - RETPUSHYES; - } - RETPUSHNO; -} - PP(pp_undef) { dSP; diff --git a/pp_hot.c b/pp_hot.c index 908ee0b..ef20f9e 100644 --- a/pp_hot.c +++ b/pp_hot.c @@ -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)