cvs commit: ponie/perl/ext/B B.pm
[email protected] (Nicholas Clark) 27 Apr 2005 14:30:02 -0000
| Newsgroups | perl.ponie.changes |
|---|---|
| Message-ID | <[email protected]> |
cvsuser 05/04/27 07:30:02
Modified: perl/ext/B B.pm
Log:
SVt_NV isn't SVt_IV, which means a simpler inheritance structure
Revision Changes Path
1.2 +52 -21 ponie/perl/ext/B/B.pm
Index: B.pm
===================================================================
RCS file: /cvs/public/ponie/perl/ext/B/B.pm,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- B.pm 9 Sep 2003 11:58:58 -0000 1.1
+++ B.pm 27 Apr 2005 14:30:02 -0000 1.2
@@ -7,7 +7,7 @@
#
package B;
-our $VERSION = '1.03';
+our $VERSION = '1.07';
use XSLoader ();
require Exporter;
@@ -31,12 +31,13 @@
@B::NULL::ISA = 'B::SV';
@B::PV::ISA = 'B::SV';
@B::IV::ISA = 'B::SV';
-@B::NV::ISA = 'B::IV';
+@B::NV::ISA = 'B::SV';
@B::RV::ISA = 'B::SV';
@B::PVIV::ISA = qw(B::PV B::IV);
-@B::PVNV::ISA = qw(B::PV B::NV);
+@B::PVNV::ISA = qw(B::PVIV B::NV);
@B::PVMG::ISA = 'B::PVNV';
-@B::PVLV::ISA = 'B::PVMG';
+# Change in the inheritance hierarchy post 5.9.0
+@B::PVLV::ISA = $] > 5.009 ? 'B::GV' : 'B::PVMG';
@B::BM::ISA = 'B::PVMG';
@B::AV::ISA = 'B::PVMG';
@B::GV::ISA = 'B::PVMG';
@@ -127,7 +128,7 @@
}
shift @parents;
}
- if (class($op) eq 'PMOP' && $op->pmreplroot && ${$op->pmreplroot}) {
+ if (class($op) eq 'PMOP' && ref($op->pmreplroot) && ${$op->pmreplroot}) {
unshift(@parents, $op);
walkoptree_slow($op->pmreplroot, $method, $level + 1);
shift @parents;
@@ -341,7 +342,7 @@
=head2 Functions Returning C<B::SV>, C<B::AV>, C<B::HV>, and C<B::CV> objects
-For descriptions of the class hierachy of these objects and the
+For descriptions of the class hierarchy of these objects and the
methods that can be called on them, see below, L<"OVERVIEW OF
CLASSES"> and L<"SV-RELATED CLASSES">.
@@ -367,6 +368,10 @@
way to get an initial "handle" on an internal perl data structure
which can then be followed with the other access methods.
+The returned object will only be valid as long as the underlying OPs
+and SVs continue to exist. Do not attempt to use the object after the
+underlying structures are freed.
+
=item amagic_generation
Returns the SV object corresponding to the C variable C<amagic_generation>.
@@ -429,7 +434,7 @@
=head2 Functions Returning C<B::OP> objects or for walking op trees
-For descriptions of the class hierachy of these objects and the
+For descriptions of the class hierarchy of these objects and the
methods that can be called on them, see below, L<"OVERVIEW OF
CLASSES"> and L<"OP-RELATED CLASSES">.
@@ -522,28 +527,47 @@
these structures.
Note that all access is read-only. You cannot modify the internals by
-using this module.
+using this module. Also, note that the B::OP and B::SV objects created
+by this module are only valid for as long as the underlying objects
+exist; their creation doesn't increase the reference counts of the
+underlying objects. Trying to access the fields of a freed object will
+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":
+inheritance hierarchy mimics the underlying C "inheritance". For 5.9.1
+and later this is:
B::SV
|
- +--------------+----------------------+
- | | |
- B::PV B::IV B::RV
- | \ / \
- | \ / \
- | B::PVIV B::NV
- \ /
- \____ __/
- \ /
- B::PVNV
- |
+ +--------------+----------+------------+
+ | | | |
+ B::PV B::IV B::NV B::RV
+ \ / /
+ \ / /
+ B::PVIV /
+ \ /
+ \ /
+ \ /
+ B::PVNV
+ |
+ |
+ B::PVMG
+ |
+ +-----+----+------+-----+-----+
+ | | | | | |
+ B::BM 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, so the base
+of this diagram is
+
|
B::PVMG
|
@@ -920,6 +944,9 @@
=head2 B::OP Methods
+These methods get the values of similarly named fields within the OP
+data structure. See top of C<op.h> for more info.
+
=over 4
=item next
@@ -944,12 +971,16 @@
=item type
-=item seq
+=item opt
+
+=item static
=item flags
=item private
+=item spare
+
=back
=head2 B::UNOP METHOD