summaryrefslogtreecommitdiff
path: root/pp_hot.c
diff options
context:
space:
mode:
authorRichard Leach <richardleach@users.noreply.github.com>2022-06-13 11:41:42 +0000
committerKarl Williamson <khw@cpan.org>2022-06-15 16:20:40 -0600
commit5af5b232a2dc0e42e74fa716f7cf429ba9e386ac (patch)
treecd74f23139db9329d4a9fb7baacb0745ac1362e5 /pp_hot.c
parent0bf91cc9654c61052c0c525b894604f08b8d3069 (diff)
downloadperl-5af5b232a2dc0e42e74fa716f7cf429ba9e386ac.tar.gz
pp_aelemfast: include fast return for non-lvals
Within the "inlined av_fetch() for simple cases" fast path, we already operate within the bounding conditions of the if() statement. Once AvARRAY(av)[key] is found to be null, a call of av_fetch(av,key,lval) here just boils down to a single line: return lval ? av_store(av,key,newSV_type(SVt_NULL)) : NULL; Checking the rest of pp_aelemfast, it's clear that within the fast path, if (!sv) and (!lval), the function must eventually PUSHs(&PL_sv_undef). So the fast path might as well do that directly.
Diffstat (limited to 'pp_hot.c')
-rw-r--r--pp_hot.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/pp_hot.c b/pp_hot.c
index d3a0aa1770..2ec4bbc4eb 100644
--- a/pp_hot.c
+++ b/pp_hot.c
@@ -1637,6 +1637,9 @@ PP(pp_aelemfast)
if (sv) {
PUSHs(sv);
RETURN;
+ } else if (!lval) {
+ PUSHs(&PL_sv_undef);
+ RETURN;
}
}