Eviscerate README.macos to match the state of the world
[p5sagit/p5-mst-13.2.git] / ext / B / B.pm
index 5336169..f7d22f1 100644 (file)
@@ -7,7 +7,7 @@
 #
 package B;
 
-our $VERSION = '1.15';
+our $VERSION = '1.23';
 
 use XSLoader ();
 require Exporter;
@@ -22,7 +22,7 @@ require Exporter;
                walkoptree_slow walkoptree walkoptree_exec walksymtable
                parents comppadlist sv_undef compile_stats timing_info
                begin_av init_av check_av end_av regex_padav dowarn defstash
-               curstash warnhook diehook inc_gv
+               curstash warnhook diehook inc_gv @optype @specialsv_name
                );
 push @EXPORT_OK, qw(unitcheck_av) if $] > 5.009;
 
@@ -33,13 +33,16 @@ use strict;
 @B::PV::ISA = 'B::SV';
 @B::IV::ISA = 'B::SV';
 @B::NV::ISA = 'B::SV';
-@B::RV::ISA = 'B::SV';
+# RV is eliminated with 5.11.0, but effectively is a specialisation of IV now.
+@B::RV::ISA = $] >= 5.011 ? 'B::IV' : 'B::SV';
 @B::PVIV::ISA = qw(B::PV B::IV);
 @B::PVNV::ISA = qw(B::PVIV B::NV);
 @B::PVMG::ISA = 'B::PVNV';
+@B::REGEXP::ISA = 'B::PVMG' if $] >= 5.011;
 # Change in the inheritance hierarchy post 5.9.0
 @B::PVLV::ISA = $] > 5.009 ? 'B::GV' : 'B::PVMG';
-@B::BM::ISA = 'B::PVMG';
+# BM is eliminated post 5.9.5, but effectively is a specialisation of GV now.
+@B::BM::ISA = $] > 5.009005 ? 'B::GV' : 'B::PVMG';
 @B::AV::ISA = 'B::PVMG';
 @B::GV::ISA = 'B::PVMG';
 @B::HV::ISA = 'B::PVMG';
@@ -61,6 +64,13 @@ use strict;
 
 @B::SPECIAL::ISA = 'B::OBJECT';
 
+@B::optype = qw(OP UNOP BINOP LOGOP LISTOP PMOP SVOP PADOP PVOP LOOP COP);
+# bytecode.pl contained the following comment:
+# Nullsv *must* come first in the following so that the condition
+# ($$sv == 0) can continue to be used to test (sv == Nullsv).
+@B::specialsv_name = qw(Nullsv &PL_sv_undef &PL_sv_yes &PL_sv_no
+                       (SV*)pWARN_ALL (SV*)pWARN_NONE (SV*)pWARN_STD);
+
 {
     # Stop "-w" from complaining about the lack of a real B::OBJECT class
     package B::OBJECT;
@@ -230,7 +240,7 @@ sub walksymtable {
         $fullname = "*main::".$prefix.$sym;
        if ($sym =~ /::$/) {
            $sym = $prefix . $sym;
-           if ($sym ne "main::" && $sym ne "<none>::" && &$recurse($sym)) {
+           if (svref_2object(\*$sym)->NAME ne "main::" && $sym ne "<none>::" && &$recurse($sym)) {
                walksymtable(\%$fullname, $method, $recurse, $sym);
            }
        } else {
@@ -313,7 +323,7 @@ __END__
 
 =head1 NAME
 
-B - The Perl Compiler
+B - The Perl Compiler Backend
 
 =head1 SYNOPSIS
 
@@ -520,7 +530,26 @@ per-thread threadsv variables.
 
 =back
 
+=head2 Exported utility variabiles
+
+=over 4
+
+=item @optype
+
+  my $op_type = $optype[$op_type_num];
+
+A simple mapping of the op type number to its type (like 'COP' or 'BINOP').
+
+=item @specialsv_name
 
+  my $sv_name = $specialsv_name[$sv_index];
+
+Certain SV types are considered 'special'.  They're represented by
+B::SPECIAL and are referred to by a number from the specialsv_list.
+This array maps that number back to the name of the SV (like 'Nullsv'
+or '&PL_sv_undef').
+
+=back
 
 
 =head1 OVERVIEW OF CLASSES
@@ -544,20 +573,20 @@ give incomprehensible results, or worse.
 
 =head2 SV-RELATED CLASSES
 
-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". For 5.9.1
-and later this is:
-
-                             B::SV
-                               |
-                +--------------+----------+------------+
-                |              |          |            |
-              B::PV          B::IV      B::NV        B::RV
-                   \         /          /
-                    \       /          /
-                     B::PVIV          /
+B::IV, B::NV, B::RV, B::PV, B::PVIV, B::PVNV, B::PVMG, B::BM (5.9.5 and
+earlier), 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". For the
+5.10.x branch, (I<ie> 5.10.0, 5.10.1 I<etc>) this is:
+
+                           B::SV
+                             |
+                +------------+------------+------------+
+                |            |            |            |
+              B::PV        B::IV        B::NV        B::RV
+                  \         /           /
+                   \       /           /
+                    B::PVIV           /
                          \           /
                           \         /
                            \       /
@@ -566,26 +595,53 @@ and later this is:
                                |
                             B::PVMG
                                |
-                    +-----+----+------+-----+-----+
-                    |     |    |      |     |     |
-                  B::BM B::AV B::GV B::HV B::CV B::IO
-                               |            |
-                            B::PVLV         |
-                                          B::FM
+                   +-----+-----+-----+-----+
+                   |     |     |     |     |
+                 B::AV B::GV B::HV B::CV B::IO
+                         |           |
+                         |           |
+                      B::PVLV      B::FM
 
+For 5.9.0 and earlier, PVLV is a direct subclass of PVMG, and BM is still
+present as a distinct type, so the base of this diagram is
 
-For 5.9.0 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
+                               |
+                               |
+                            B::PVMG
+                               |
+            +------+-----+-----+-----+-----+-----+
+            |      |     |     |     |     |     |
+         B::PVLV B::BM B::AV B::GV B::HV B::CV B::IO
+                                           |
+                                           |
+                                         B::FM
+
+For 5.11.0 and later, B::RV is abolished, and IVs can be used to store
+references, and a new type B::REGEXP is introduced, giving this structure:
+
+                           B::SV
+                             |
+                +------------+------------+
+                |            |            |
+              B::PV        B::IV        B::NV
+                  \         /           /
+                   \       /           /
+                    B::PVIV           /
+                         \           /
+                          \         /
+                           \       /
+                            B::PVNV
+                               |
+                               |
+                            B::PVMG
+                               |
+           +-------+-------+---+---+-------+-------+
+           |       |       |       |       |       |
+         B::AV   B::GV   B::HV   B::CV   B::IO B::REGEXP
+                   |               |
+                   |               |
+                B::PVLV          B::FM
 
 
 Access methods correspond to the underlying C macros for field access,
@@ -991,8 +1047,6 @@ This returns the op description from the global C PL_op_desc array
 
 =item opt
 
-=item static
-
 =item flags
 
 =item private
@@ -1043,12 +1097,16 @@ This returns the op description from the global C PL_op_desc array
 
 =item pmnext
 
+Only up to Perl 5.9.4
+
 =item pmregexp
 
 =item pmflags
 
 =item extflags
 
+Since Perl 5.9.5
+
 =item precomp
 
 =item pmoffset
@@ -1119,6 +1177,8 @@ Only when perl was compiled with ithreads.
 
 =item hints
 
+=item hints_hash
+
 =back