summaryrefslogtreecommitdiff
path: root/mro.c
diff options
context:
space:
mode:
Diffstat (limited to 'mro.c')
-rw-r--r--mro.c16
1 files changed, 15 insertions, 1 deletions
diff --git a/mro.c b/mro.c
index a7ea282dc0..ffb72abfc5 100644
--- a/mro.c
+++ b/mro.c
@@ -193,9 +193,23 @@ S_mro_get_linear_isa_dfs(pTHX_ HV *stash, I32 level)
/* It was newly created. Steal it for our new SV, and
replace it in the hash with the "real" thing. */
SV *const val = HeVAL(he);
+ HEK *const key = HeKEY_hek(he);
HeVAL(he) = &PL_sv_undef;
- sv_setsv(val, subsv);
+ /* Save copying by making a shared hash key scalar. We
+ inline this here rather than calling Perl_newSVpvn_share
+ because we already have the scalar, and we already have
+ the hash key. */
+ assert(SvTYPE(val) == SVt_NULL);
+ sv_upgrade(val, SVt_PV);
+ SvPV_set(val, HEK_KEY(share_hek_hek(key)));
+ SvCUR_set(val, HEK_LEN(key));
+ SvREADONLY_on(val);
+ SvFAKE_on(val);
+ SvPOK_on(val);
+ if (HEK_UTF8(key))
+ SvUTF8_on(val);
+
av_push(retval, val);
}
}