summaryrefslogtreecommitdiff
path: root/pp.c
diff options
context:
space:
mode:
authorNicholas Clark <nick@ccl4.org>2006-02-25 00:39:30 +0000
committerNicholas Clark <nick@ccl4.org>2006-02-25 00:39:30 +0000
commitf7877b281b40407827939f44ea94226de573cdbc (patch)
treea9a5cac49427908841ae0bf5a3af524fee855e6a /pp.c
parentfb4fc1faf0cb0e6b2bec4f31ddbca2817f387a6e (diff)
downloadperl-f7877b281b40407827939f44ea94226de573cdbc.tar.gz
Store GvGP in the SV head union. For all the common lookups [eg GvCV()]
this avoids 1 pointer dereference and the associated risk of a CPU cache miss. Although this patch looks deceptively small, I fear its CBV(*) might be rather high. (* Crack By Volume) p4raw-id: //depot/perl@27323
Diffstat (limited to 'pp.c')
-rw-r--r--pp.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/pp.c b/pp.c
index d63f039809..1724ab0d7a 100644
--- a/pp.c
+++ b/pp.c
@@ -3016,7 +3016,9 @@ PP(pp_substr)
Perl_warner(aTHX_ packWARN(WARN_SUBSTR),
"Attempt to use reference as lvalue in substr");
}
- if (SvOK(sv)) /* is it defined ? */
+ if (isGV_with_GP(sv))
+ SvPV_force_nolen(sv);
+ else if (SvOK(sv)) /* is it defined ? */
(void)SvPOK_only_UTF8(sv);
else
sv_setpvn(sv,"",0); /* avoid lexical reincarnation */