summaryrefslogtreecommitdiff
path: root/pp_hot.c
diff options
context:
space:
mode:
authorNicholas Clark <nick@ccl4.org>2007-10-18 12:32:42 +0000
committerNicholas Clark <nick@ccl4.org>2007-10-18 12:32:42 +0000
commit8e3a4a3079a43c5cf5fb5f844ffb0b9d1d8b571d (patch)
tree7775ffd2f2d03da97de8ed26f88c0afbe070f700 /pp_hot.c
parent19bad6733a83fa572b0d6a19b4693ea22c241ab0 (diff)
downloadperl-8e3a4a3079a43c5cf5fb5f844ffb0b9d1d8b571d.tar.gz
No need to call strlen() on the result of CopSTASHPV() when unthreaded,
as the length is already known. Hence conditionally compile out the logic related to the call to strlen() from S_method_common(), and use newSVhek in S_gv_get_super_pkg(). p4raw-id: //depot/perl@32130
Diffstat (limited to 'pp_hot.c')
-rw-r--r--pp_hot.c14
1 files changed, 12 insertions, 2 deletions
diff --git a/pp_hot.c b/pp_hot.c
index 6fb53d49a4..423c4c8e76 100644
--- a/pp_hot.c
+++ b/pp_hot.c
@@ -3097,16 +3097,24 @@ S_method_common(pTHX_ SV* meth, U32* hashp)
}
if (!sep || ((sep - name) == 5 && strnEQ(name, "SUPER", 5))) {
/* the method name is unqualified or starts with SUPER:: */
+#ifndef USE_ITHREADS
+ if (sep)
+ stash = CopSTASH(PL_curcop);
+#else
bool need_strlen = 1;
if (sep) {
packname = CopSTASHPV(PL_curcop);
}
- else if (stash) {
+ else
+#endif
+ if (stash) {
HEK * const packhek = HvNAME_HEK(stash);
if (packhek) {
packname = HEK_KEY(packhek);
packlen = HEK_LEN(packhek);
+#ifdef USE_ITHREADS
need_strlen = 0;
+#endif
} else {
goto croak;
}
@@ -3117,8 +3125,10 @@ S_method_common(pTHX_ SV* meth, U32* hashp)
Perl_croak(aTHX_
"Can't use anonymous symbol table for method lookup");
}
- else if (need_strlen)
+#ifdef USE_ITHREADS
+ if (need_strlen)
packlen = strlen(packname);
+#endif
}
else {