summaryrefslogtreecommitdiff
path: root/mro.c
diff options
context:
space:
mode:
authorNicholas Clark <nick@ccl4.org>2007-10-18 17:13:34 +0000
committerNicholas Clark <nick@ccl4.org>2007-10-18 17:13:34 +0000
commit190d0b226d68d16dfd6e8c8e99625bca713613f1 (patch)
tree1b1baa57a17b2e7565f3147ce905999fb805b63a /mro.c
parent82af65938b18604bedb1e907fce033a213303aaf (diff)
downloadperl-190d0b226d68d16dfd6e8c8e99625bca713613f1.tar.gz
By using the HEK that holds the stash name in S_mro_get_linear_isa_c3()
and S_mro_get_linear_isa_dfs() we can create scalars more efficiently. p4raw-id: //depot/perl@32133
Diffstat (limited to 'mro.c')
-rw-r--r--mro.c26
1 files changed, 12 insertions, 14 deletions
diff --git a/mro.c b/mro.c
index 87c102e34d..ed40bdd9d9 100644
--- a/mro.c
+++ b/mro.c
@@ -117,19 +117,19 @@ S_mro_get_linear_isa_dfs(pTHX_ HV *stash, I32 level)
GV** gvp;
GV* gv;
AV* av;
- const char* stashname;
+ const HEK* stashhek;
struct mro_meta* meta;
assert(stash);
assert(HvAUX(stash));
- stashname = HvNAME_get(stash);
- if (!stashname)
+ stashhek = HvNAME_HEK(stash);
+ if (!stashhek)
Perl_croak(aTHX_ "Can't linearize anonymous symbol table");
if (level > 100)
Perl_croak(aTHX_ "Recursive inheritance detected in package '%s'",
- stashname);
+ HEK_KEY(stashhek));
meta = HvMROMETA(stash);
@@ -141,7 +141,7 @@ S_mro_get_linear_isa_dfs(pTHX_ HV *stash, I32 level)
/* not in cache, make a new one */
retval = (AV*)sv_2mortal((SV *)newAV());
- av_push(retval, newSVpv(stashname, 0)); /* add ourselves at the top */
+ av_push(retval, newSVhek(stashhek)); /* add ourselves at the top */
/* fetch our @ISA */
gvp = (GV**)hv_fetchs(stash, "ISA", FALSE);
@@ -231,21 +231,19 @@ S_mro_get_linear_isa_c3(pTHX_ HV* stash, I32 level)
GV** gvp;
GV* gv;
AV* isa;
- const char* stashname;
- STRLEN stashname_len;
+ const HEK* stashhek;
struct mro_meta* meta;
assert(stash);
assert(HvAUX(stash));
- stashname = HvNAME_get(stash);
- stashname_len = HvNAMELEN_get(stash);
- if (!stashname)
+ stashhek = HvNAME_HEK(stash);
+ if (!stashhek)
Perl_croak(aTHX_ "Can't linearize anonymous symbol table");
if (level > 100)
Perl_croak(aTHX_ "Recursive inheritance detected in package '%s'",
- stashname);
+ HEK_KEY(stashhek));
meta = HvMROMETA(stash);
@@ -329,7 +327,7 @@ S_mro_get_linear_isa_c3(pTHX_ HV* stash, I32 level)
/* Initialize retval to build the return value in */
retval = newAV();
- av_push(retval, newSVpvn(stashname, stashname_len)); /* us first */
+ av_push(retval, newSVhek(stashhek)); /* us first */
/* This loop won't terminate until we either finish building
the MRO, or get an exception. */
@@ -408,14 +406,14 @@ S_mro_get_linear_isa_c3(pTHX_ HV* stash, I32 level)
Safefree(heads);
Perl_croak(aTHX_ "Inconsistent hierarchy during C3 merge of class '%s': "
- "merging failed on parent '%"SVf"'", stashname, SVfARG(cand));
+ "merging failed on parent '%"SVf"'", HEK_KEY(stashhek), SVfARG(cand));
}
}
}
else { /* @ISA was undefined or empty */
/* build a retval containing only ourselves */
retval = newAV();
- av_push(retval, newSVpvn(stashname, stashname_len));
+ av_push(retval, newSVhek(stashhek));
}
/* we don't want anyone modifying the cache entry but us,