summaryrefslogtreecommitdiff
path: root/pp_hot.c
diff options
context:
space:
mode:
authorNicholas Clark <nick@ccl4.org>2005-05-27 09:18:26 +0000
committerNicholas Clark <nick@ccl4.org>2005-05-27 09:18:26 +0000
commit9b9d0b15bd9c5c0115200324ab9b04803069c7ce (patch)
treec511e92870e2a03c965812bc3304d8d554e7e1d4 /pp_hot.c
parent62aa563719d028e176ee9e4eb16701b5a2193e4c (diff)
downloadperl-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.c26
1 files changed, 21 insertions, 5 deletions
diff --git a/pp_hot.c b/pp_hot.c
index 765a8c1147..f829f49a11 100644
--- a/pp_hot.c
+++ b/pp_hot.c
@@ -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 */