Revision history for Perl extension Devel::Size.
+0.75_51 2011-05-05 nicholas
+ * Only use a static array of vtables on gcc.
+
0.75_50 2011-05-04 nicholas
* The core's magic vtables are global constants, so aren't part of the size.
* Follow mg_obj and mg_ptr.
open FH, ">$vtable_file" or die "Can't open $vtable_file: $!";
foreach (sort keys %vtables) {
- if ($special{$_}) {
- print FH <<"EOT";
-#ifdef $special{$_}
- &$_,
-#endif
-EOT
- } else {
+ print FH "#ifdef $special{$_}\n" if ($special{$_});
+ if ($Config{gccversion}) {
print FH " &$_,\n";
+ } else {
+ print FH " check_new(st, &$_);\n";
}
+ print FH "#endif\n" if ($special{$_});
}
close FH or die "Error closing $vtable_file: $!";
return TRUE;
}
+/* Frustratingly, the vtables aren't const in perl.h
+ gcc is happy enough to have non-const initialisers in a static array.
+ VC seems not to be. (Is it actually treating the file as C++?)
+ So do the maximally portable thing, unless we know it's gcc, in which case
+ we can do the more space efficient version. */
+
+#if __GNUC__
void *vtables[] = {
#include "vtables.inc"
NULL
};
+#endif
static struct state *
new_state(pTHX)
{
SV *warn_flag;
struct state *st;
+#if __GNUC__
void **vt_p = vtables;
+#endif
Newxz(st, 1, struct state);
st->go_yell = TRUE;
check_new(st, &PL_sv_undef);
check_new(st, &PL_sv_no);
check_new(st, &PL_sv_yes);
+#if __GNUC__
while(*vt_p)
check_new(st, *vt_p++);
+#else
+#include "vtables.inc"
+#endif
return st;
}