diff options
author | syber <syber@crazypanda.ru> | 2014-11-24 18:55:15 +0300 |
---|---|---|
committer | Father Chrysostomos <sprout@cpan.org> | 2014-11-24 22:12:53 -0800 |
commit | d648ffcb179b885089e064ec1d58c60027c80915 (patch) | |
tree | 404bde96f9e794940e8551eeb46f3b4807db57ea /pp_hot.c | |
parent | f5fdb0259d5e9470e8291544a8b209e202d36334 (diff) | |
download | perl-d648ffcb179b885089e064ec1d58c60027c80915.tar.gz |
Remove op_const_class; just use the name on the stack
Instead of storing the class name in the op_const_class field of the
METHOP in addition to pushing it on to the stack, just use the item on
the stack. This also makes $class->method faster if $class is already
a shared hash string.
Diffstat (limited to 'pp_hot.c')
-rw-r--r-- | pp_hot.c | 20 |
1 files changed, 10 insertions, 10 deletions
@@ -3006,27 +3006,27 @@ S_method_common(pTHX_ SV* meth, U32* hashp) SV* ob; GV* gv; HV* stash; - SV *packsv = NULL, *const_class, *sv; + SV *packsv = NULL; - PERL_ARGS_ASSERT_METHOD_COMMON; - - if ((const_class = cMETHOPx_class(PL_op))) { - stash = gv_stashsv(const_class, GV_CACHE_ONLY); - if (stash) goto fetch; - } - - sv = PL_stack_base + TOPMARK == PL_stack_sp + SV* const sv = PL_stack_base + TOPMARK == PL_stack_sp ? (Perl_croak(aTHX_ "Can't call method \"%"SVf"\" without a " "package or object reference", SVfARG(meth)), (SV *)NULL) : *(PL_stack_base + TOPMARK + 1); + PERL_ARGS_ASSERT_METHOD_COMMON; + if (UNLIKELY(!sv)) undefined: Perl_croak(aTHX_ "Can't call method \"%"SVf"\" on an undefined value", SVfARG(meth)); - SvGETMAGIC(sv); + if (UNLIKELY(SvGMAGICAL(sv))) mg_get(sv); + else if (SvIsCOW_shared_hash(sv)) { /* MyClass->meth() */ + stash = gv_stashsv(sv, GV_CACHE_ONLY); + if (stash) goto fetch; + } + if (SvROK(sv)) ob = MUTABLE_SV(SvRV(sv)); else if (!SvOK(sv)) goto undefined; |