X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=blobdiff_plain;f=xs-src%2FMouse.xs;h=eff6ab7960b2617d11f4c240e9365c07e08fba56;hb=559f35335d5ddba6baeff5a8a50c0d67a3297c87;hp=6a571e658017af446461b458be5251e4951fd28f;hpb=bdf225bbcd670b28b2ddd59aaa2fb5ebbd63e4a3;p=gitmo%2FMouse.git diff --git a/xs-src/Mouse.xs b/xs-src/Mouse.xs index 6a571e6..eff6ab7 100644 --- a/xs-src/Mouse.xs +++ b/xs-src/Mouse.xs @@ -184,7 +184,7 @@ mouse_get_xc_wo_check(pTHX_ SV* const metaclass) { } static int -mouse_xc_is_fresh(aTHX_ AV* const xc) { +mouse_xc_is_fresh(pTHX_ AV* const xc) { HV* const stash = MOUSE_xc_stash(xc); SV* const gen = MOUSE_xc_gen(xc); if(SvUVX(gen) != 0U && MOUSE_xc_flags(xc) & MOUSEf_XC_IS_IMMUTABLE) { @@ -193,7 +193,7 @@ mouse_xc_is_fresh(aTHX_ AV* const xc) { return SvUVX(gen) == mro_get_pkg_gen(stash); } -static AV* +STATIC_INLINE AV* mouse_get_xc(pTHX_ SV* const metaclass) { AV* const xc = mouse_get_xc_wo_check(aTHX_ metaclass); return mouse_xc_is_fresh(aTHX_ xc) @@ -624,6 +624,19 @@ CODE: mouse_class_initialize_object(aTHX_ meta, object, args, is_cloning); } +void +_invalidate_metaclass_cache(SV* meta) +CODE: +{ + AV* const xc = mouse_get_xc_if_fresh(aTHX_ meta); + if(xc) { + SV* const gen = MOUSE_xc_gen(xc); + sv_setuv(gen, 0U); + } + delete_slot(meta, newSVpvs_flags("_mouse_cache_", SVs_TEMP)); +} + + MODULE = Mouse PACKAGE = Mouse::Meta::Role BOOT: