summaryrefslogtreecommitdiff
path: root/pp_hot.c
diff options
context:
space:
mode:
authorsyber <syber@crazypanda.ru>2014-11-24 18:55:15 +0300
committerFather Chrysostomos <sprout@cpan.org>2014-11-24 22:12:53 -0800
commitd648ffcb179b885089e064ec1d58c60027c80915 (patch)
tree404bde96f9e794940e8551eeb46f3b4807db57ea /pp_hot.c
parentf5fdb0259d5e9470e8291544a8b209e202d36334 (diff)
downloadperl-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.c20
1 files changed, 10 insertions, 10 deletions
diff --git a/pp_hot.c b/pp_hot.c
index 8ec576a0e8..cde1d9ff4d 100644
--- a/pp_hot.c
+++ b/pp_hot.c
@@ -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;