diff options
author | Nicholas Clark <nick@ccl4.org> | 2005-05-27 09:18:26 +0000 |
---|---|---|
committer | Nicholas Clark <nick@ccl4.org> | 2005-05-27 09:18:26 +0000 |
commit | 9b9d0b15bd9c5c0115200324ab9b04803069c7ce (patch) | |
tree | c511e92870e2a03c965812bc3304d8d554e7e1d4 /pp_hot.c | |
parent | 62aa563719d028e176ee9e4eb16701b5a2193e4c (diff) | |
download | perl-9b9d0b15bd9c5c0115200324ab9b04803069c7ce.tar.gz |
Get the HEK once only in the hot code (class method calls)
p4raw-id: //depot/perl@24594
Diffstat (limited to 'pp_hot.c')
-rw-r--r-- | pp_hot.c | 26 |
1 files changed, 21 insertions, 5 deletions
@@ -3085,14 +3085,30 @@ S_method_common(pTHX_ SV* meth, U32* hashp) sep = p, leaf = p + 2; } if (!sep || ((sep - name) == 5 && strnEQ(name, "SUPER", 5))) { - /* the method name is unqualified or starts with SUPER:: */ - packname = sep ? CopSTASHPV(PL_curcop) : - stash ? HvNAME_get(stash) : packname; - if (!packname) + /* the method name is unqualified or starts with SUPER:: */ + bool need_strlen = 1; + if (sep) { + packname = CopSTASHPV(PL_curcop); + } + else if (stash) { + HEK *packhek = HvNAME_HEK(stash); + if (packhek) { + packname = HEK_KEY(packhek); + packlen = HEK_LEN(packhek); + need_strlen = 0; + } else { + goto croak; + } + } + + if (!packname) { + croak: Perl_croak(aTHX_ "Can't use anonymous symbol table for method lookup"); - else + } + else if (need_strlen) packlen = strlen(packname); + } else { /* the method name is qualified */ |