Front page | perl.perl5.porters |
Postings from July 2009
mro::invalidate_*all_*method_caches
Thread Next
From:
Nicholas Clark
Date:
July 22, 2009 03:35
Subject:
mro::invalidate_*all_*method_caches
Message ID:
20090722103454.GE60303@plum.flirble.org
Bram noticed that mro::invalidate_all_method_caches has vanished between
5.10.0 and maint-5.10
This regression turns out to be a combination of ANSI, VMS, Craig and me.
&mro::invalidate_all_method_caches was initially implemented in mro.c with
XS_mro_invalidate_all_method_caches()
That's longer than 32 characters, so Craig patched (then-)blead to rename the
C function to XS_mro_invalidate_method_caches(), leaving the Perl space name
(correctly) unchanged in the call to newXSproto
http://perl5.git.perl.org/perl.git/blobdiff/222206208128104dd9837dda856fd43c0f121508..c5860d665910b046f6665f2f84e2a237a51bc322:/mro.c
I didn't spot this subtlety when I refactored the code to move the C3 parts of
mro.c into ext/mro.xs, generating the C code using xsubpp. So at that point I
did this:
void
mro_invalidate_method_caches(...)
which ends up as
newXSproto("mro::invalidate_method_caches", XS_mro_invalidate_method_caches, file, "");
which is wrong.
http://perl5.git.perl.org/perl.git/commitdiff/1e9bd1186a044d6e3506ed14fbe055b8
There are, of course, no tests. :-(
I'm not sure what the best fix is. The "obvious" fix of changing the XS code to
void
mro_invalidate_all_method_caches(...)
gets us back to square one, because xsubpp will generate XS_... which is >32
characters. There doesn't seem to be any keyword in XS to use a shorter name
for the C function. The best I can come up with is this:
diff --git a/ext/mro/mro.xs b/ext/mro/mro.xs
index 1208c6c..e7e65ff 100644
--- a/ext/mro/mro.xs
+++ b/ext/mro/mro.xs
@@ -251,6 +251,11 @@ __dopoptosub_at(const PERL_CONTEXT *cxstk, I32 startingblock) {
return i;
}
+#undef XSINTERFACE_FUNC
+#undef XSINTERFACE_FUNC_SET
+#define XSINTERFACE_FUNC(ret,cv,f) 0
+#define XSINTERFACE_FUNC_SET(cv,f)
+
MODULE = mro PACKAGE = mro PREFIX = mro_
void
@@ -388,6 +393,8 @@ mro_is_universal(...)
void
mro_invalidate_method_caches(...)
PROTOTYPE:
+ INTERFACE:
+ mro_invalidate_all_method_caches
PPCODE:
if (items != 0)
croak_xs_usage(cv, "");
which works, with only startup penalty, but feels a bit hacky.
(And if we adopt it, needs some comments referencing
http://perl5.git.perl.org/perl.git/blob/HEAD:/pod/perlxs.pod#l1341
)
1: Does anyone have any better suggestions?
2: Should we add code to xsupbb and a new keyword to XS, to specify the name
of the C routine to use (instead of the default)?
Nicholas Clark
Thread Next
-
mro::invalidate_*all_*method_caches
by Nicholas Clark