From: Nicholas Clark Date: Thu, 9 Sep 2004 15:54:18 +0000 (+0000) Subject: A single version of B that supports 5.8 and 5.10 X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=f5ba13079587260a0b8a2a6958a44e80adc29fe2;p=p5sagit%2Fp5-mst-13.2.git A single version of B that supports 5.8 and 5.10 p4raw-id: //depot/perl@23300 --- diff --git a/ext/B/B.pm b/ext/B/B.pm index 5961c07..0274711 100644 --- a/ext/B/B.pm +++ b/ext/B/B.pm @@ -7,7 +7,7 @@ # package B; -our $VERSION = '1.06'; +our $VERSION = '1.07'; use XSLoader (); require Exporter; @@ -36,7 +36,8 @@ use strict; @B::PVIV::ISA = qw(B::PV B::IV); @B::PVNV::ISA = qw(B::PV B::NV); @B::PVMG::ISA = 'B::PVNV'; -@B::PVLV::ISA = 'B::GV'; +# Change in the inheritance hierarchy post 5.8 +@B::PVLV::ISA = $] > 5.009 ? 'B::GV' : 'B::PVMG'; @B::BM::ISA = 'B::PVMG'; @B::AV::ISA = 'B::PVMG'; @B::GV::ISA = 'B::PVMG'; @@ -529,7 +530,8 @@ using this module. B::IV, B::NV, B::RV, B::PV, B::PVIV, B::PVNV, B::PVMG, B::BM, B::PVLV, B::AV, B::HV, B::CV, B::GV, B::FM, B::IO. These classes correspond in the obvious way to the underlying C structures of similar names. The -inheritance hierarchy mimics the underlying C "inheritance": +inheritance hierarchy mimics the underlying C "inheritance". For 5.9 and +later this is: B::SV | @@ -555,6 +557,20 @@ inheritance hierarchy mimics the underlying C "inheritance": B::FM +For 5.8 and earlier, PVLV is a direct subclass of PVMG, so the base of this +diagram is + + | + B::PVMG + | + +------+-----+----+------+-----+-----+ + | | | | | | | + B::PVLV B::BM B::AV B::GV B::HV B::CV B::IO + | + | + B::FM + + Access methods correspond to the underlying C macros for field access, usually with the leading "class indication" prefix removed (Sv, Av, Hv, ...). The leading prefix is only left in cases where its removal diff --git a/ext/B/B.xs b/ext/B/B.xs index 43b91fe..63f5a99 100644 --- a/ext/B/B.xs +++ b/ext/B/B.xs @@ -505,7 +505,7 @@ BOOT: specialsv_list[4] = pWARN_ALL; specialsv_list[5] = pWARN_NONE; specialsv_list[6] = pWARN_STD; -#if PERL_VERSION <= 9 +#if PERL_VERSION <= 8 # define CVf_ASSERTION 0 #endif #include "defsubs.h" @@ -721,7 +721,16 @@ cchar(sv) void threadsv_names() PPCODE: +#if PERL_VERSION <= 8 +# ifdef USE_5005THREADS + int i; + STRLEN len = strlen(PL_threadsv_names); + EXTEND(sp, len); + for (i = 0; i < len; i++) + PUSHs(sv_2mortal(newSVpvn(&PL_threadsv_names[i], 1))); +# endif +#endif #define OP_next(o) o->op_next #define OP_sibling(o) o->op_sibling diff --git a/ext/B/B/C.pm b/ext/B/B/C.pm index 245f6f0..9279317 100644 --- a/ext/B/B/C.pm +++ b/ext/B/B/C.pm @@ -5,10 +5,13 @@ # You may distribute under the terms of either the GNU General Public # License or the Artistic License, as specified in the README file. # -package B::C::Section; + +package B::C; our $VERSION = '1.04'; +package B::C::Section; + use B (); use base B::Section; @@ -1433,6 +1436,14 @@ typedef struct { long xcv_depth; /* >= 2 indicates recursive call */ AV * xcv_padlist; CV * xcv_outside; +EOT + print <<'EOT' if $] < 5.009; +#ifdef USE_5005THREADS + perl_mutex *xcv_mutexp; + struct perl_thread *xcv_owner; /* current owner thread */ +#endif /* USE_5005THREADS */ +EOT + print <<'EOT'; cv_flags_t xcv_flags; U32 xcv_outside_seq; /* the COP sequence (at the point of our * compilation) in the lexically enclosing diff --git a/ext/B/ramblings/runtime.porting b/ext/B/ramblings/runtime.porting index f237cef..20d05b3 100644 --- a/ext/B/ramblings/runtime.porting +++ b/ext/B/ramblings/runtime.porting @@ -352,5 +352,6 @@ egrent getlogin syscall lock 6 1 +threadsv 6 2 unused if not USE_5005THREADS, absent post 5.8 setstate 1 1 currently unused anywhere method_named 10 2 diff --git a/ext/B/t/lint.t b/ext/B/t/lint.t index 04d8f83..2b49024 100644 --- a/ext/B/t/lint.t +++ b/ext/B/t/lint.t @@ -46,7 +46,7 @@ SKIP : { use Config; skip("Doesn't work with threaded perls",11) - if $Config{useithreads}; + if $Config{useithreads} || ($] < 5.009 && $Config{use5005threads}); runlint 'implicit-read', '1 for @ARGV', <<'RESULT', 'implicit-read in foreach'; Implicit use of $_ in foreach at -e line 1