From: Nicholas Clark Date: Fri, 26 Dec 2008 17:14:44 +0000 (+0000) Subject: Add MRO_GET_PRIVATE_DATA() to use the cached mro private data where possible. X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=123892d916359369839f3896f283189be71dc32c;p=p5sagit%2Fp5-mst-13.2.git Add MRO_GET_PRIVATE_DATA() to use the cached mro private data where possible. --- diff --git a/hv.h b/hv.h index 66fb6f2..1481d5b 100644 --- a/hv.h +++ b/hv.h @@ -57,6 +57,11 @@ struct mro_meta { HV *isa; /* Everything this class @ISA */ }; +#define MRO_GET_PRIVATE_DATA(smeta, which) \ + (((smeta)->mro_which && (which) == (smeta)->mro_which) \ + ? MUTABLE_SV((smeta)->mro_linear_c3) \ + : Perl_mro_get_private_data(aTHX_ (smeta), (which))) + /* Subject to change. Don't access this directly. */ diff --git a/mro.c b/mro.c index 23070d9..4ce939b 100644 --- a/mro.c +++ b/mro.c @@ -231,7 +231,7 @@ S_mro_get_linear_isa_dfs(pTHX_ HV *stash, U32 level) meta = HvMROMETA(stash); /* return cache if valid */ - if((retval = MUTABLE_AV(Perl_mro_get_private_data(aTHX_ meta, dfs_alg)))) { + if((retval = MUTABLE_AV(MRO_GET_PRIVATE_DATA(meta, dfs_alg)))) { return retval; } @@ -382,7 +382,7 @@ S_mro_get_linear_isa_c3(pTHX_ HV* stash, U32 level) meta = HvMROMETA(stash); /* return cache if valid */ - if((retval = MUTABLE_AV(Perl_mro_get_private_data(aTHX_ meta, c3_alg)))) { + if((retval = MUTABLE_AV(MRO_GET_PRIVATE_DATA(meta, c3_alg)))) { return retval; }