From: Zefram Date: Fri, 10 May 2013 08:42:12 +0000 (+0200) Subject: Update Devel-Size for the new form of pad list. X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=e0d4117e5dc4fe3966f1b0a7782b494d5d94d8bc;p=p5sagit%2FDevel-Size.git Update Devel-Size for the new form of pad list. --- diff --git a/CHANGES b/CHANGES index 1f7cd06..fe605c7 100644 --- a/CHANGES +++ b/CHANGES @@ -1,5 +1,6 @@ Revision history for Perl extension Devel::Size. + * v5.17 changes the type of PADLIST [CPAN #83904] * stubbed subs no longer have CvOUTSIDE set [CPAN #77913] * Fix for v5.17.2's OP slab allocator [CPAN #83903] * Spelling fix to docs from gregor herrmann [CPAN #78766] diff --git a/Size.xs b/Size.xs index 3226910..f06f85e 100644 --- a/Size.xs +++ b/Size.xs @@ -660,6 +660,30 @@ const U8 body_sizes[SVt_LAST] = { #endif }; +#ifdef PadlistNAMES +static void +padlist_size(pTHX_ struct state *const st, const PADLIST * const padl, + const int recurse) { + SSize_t i; + if (!check_new(st, padl)) + return; + /* This relies on PADNAMELIST and PAD being typedefed to AV. If that + ever changes, this code will need an update. */ + st->total_size += sizeof(PADLIST); + sv_size(aTHX_ st, (SV*)PadlistNAMES(padl), recurse); + i = PadlistMAX(padl) + 1; + st->total_size += sizeof(PAD*) * i; + while (--i) + sv_size(aTHX_ st, (SV*)PadlistARRAY(padl)[i], recurse); +} +#else +static void +padlist_size(pTHX_ struct state *const st, const AV * const padl, + const int recurse) { + sv_size(aTHX_ st, (SV*)padl, recurse); +} +#endif + static void sv_size(pTHX_ struct state *const st, const SV * const orig_thing, const int recurse) { @@ -785,7 +809,7 @@ sv_size(pTHX_ struct state *const st, const SV * const orig_thing, case SVt_PVFM: TAG; - sv_size(aTHX_ st, (SV *)CvPADLIST(thing), SOME_RECURSION); + padlist_size(aTHX_ st, CvPADLIST(thing), SOME_RECURSION); sv_size(aTHX_ st, (SV *)CvOUTSIDE(thing), recurse); if (st->go_yell && !st->fm_whine) { @@ -798,7 +822,7 @@ sv_size(pTHX_ struct state *const st, const SV * const orig_thing, sv_size(aTHX_ st, (SV *)CvSTASH(thing), SOME_RECURSION); sv_size(aTHX_ st, (SV *)SvSTASH(thing), SOME_RECURSION); sv_size(aTHX_ st, (SV *)CvGV(thing), SOME_RECURSION); - sv_size(aTHX_ st, (SV *)CvPADLIST(thing), SOME_RECURSION); + padlist_size(aTHX_ st, CvPADLIST(thing), SOME_RECURSION); sv_size(aTHX_ st, (SV *)CvOUTSIDE(thing), recurse); if (CvISXSUB(thing)) { sv_size(aTHX_ st, cv_const_sv((CV *)thing), recurse);