diff options
author | Nicholas Clark <nick@ccl4.org> | 2005-12-21 19:37:48 +0000 |
---|---|---|
committer | Nicholas Clark <nick@ccl4.org> | 2005-12-21 19:37:48 +0000 |
commit | 2f349aa0467489cdcb72a1f72b53c21a8f771721 (patch) | |
tree | 8ace9a9164c899ded56e68722496e49f9b6754f4 /pp_hot.c | |
parent | 867bef193ba790d4f06f4e5549e8b8b4c2f6a389 (diff) | |
download | perl-2f349aa0467489cdcb72a1f72b53c21a8f771721.tar.gz |
Undo my goto spaghetti from change 18340 - what we really need are
hints to compilers about likey/unlikely branches.
p4raw-id: //depot/perl@26436
Diffstat (limited to 'pp_hot.c')
-rw-r--r-- | pp_hot.c | 67 |
1 files changed, 29 insertions, 38 deletions
@@ -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 |