From: Nicholas Clark Date: Wed, 21 Dec 2005 19:37:48 +0000 (+0000) Subject: Undo my goto spaghetti from change 18340 - what we really need are X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=2f349aa0467489cdcb72a1f72b53c21a8f771721;p=p5sagit%2Fp5-mst-13.2.git Undo my goto spaghetti from change 18340 - what we really need are hints to compilers about likey/unlikely branches. p4raw-id: //depot/perl@26436 --- diff --git a/pp_hot.c b/pp_hot.c index 6f6cb24..ffdd631 100644 --- a/pp_hot.c +++ b/pp_hot.c @@ -2676,7 +2676,35 @@ PP(pp_entersub) retry: if (!CvROOT(cv) && !CvXSUB(cv)) { - goto fooey; + GV* autogv; + SV* sub_name; + + /* anonymous or undef'd function leaves us no recourse */ + if (CvANON(cv) || !(gv = CvGV(cv))) + DIE(aTHX_ "Undefined subroutine called"); + + /* autoloaded stub? */ + if (cv != GvCV(gv)) { + cv = GvCV(gv); + } + /* should call AUTOLOAD now? */ + else { +try_autoload: + if ((autogv = gv_autoload4(GvSTASH(gv), GvNAME(gv), GvNAMELEN(gv), + FALSE))) + { + cv = GvCV(autogv); + } + /* sorry */ + else { + sub_name = sv_newmortal(); + gv_efullname3(sub_name, gv, Nullch); + DIE(aTHX_ "Undefined subroutine &%"SVf" called", sub_name); + } + } + if (!cv) + DIE(aTHX_ "Not a CODE reference"); + goto retry; } gimme = GIMME_V; @@ -2821,43 +2849,6 @@ PP(pp_entersub) LEAVE; return NORMAL; } - - /*NOTREACHED*/ - assert (0); /* Cannot get here. */ - /* This is deliberately moved here as spaghetti code to keep it out of the - hot path. */ - { - GV* autogv; - SV* sub_name; - - fooey: - /* anonymous or undef'd function leaves us no recourse */ - if (CvANON(cv) || !(gv = CvGV(cv))) - DIE(aTHX_ "Undefined subroutine called"); - - /* autoloaded stub? */ - if (cv != GvCV(gv)) { - cv = GvCV(gv); - } - /* should call AUTOLOAD now? */ - else { -try_autoload: - if ((autogv = gv_autoload4(GvSTASH(gv), GvNAME(gv), GvNAMELEN(gv), - FALSE))) - { - cv = GvCV(autogv); - } - /* sorry */ - else { - sub_name = sv_newmortal(); - gv_efullname3(sub_name, gv, Nullch); - DIE(aTHX_ "Undefined subroutine &%"SVf" called", sub_name); - } - } - if (!cv) - DIE(aTHX_ "Not a CODE reference"); - goto retry; - } } void