In perl.git, the branch blead has been updated

<http://perl5.git.perl.org/perl.git/commitdiff/3f6e436ff0889330b44f87823bf8f712a6da6aba?hp=3b91d897677547cb4be755c60725a628ac435fe1>

- Log -----------------------------------------------------------------
commit 3f6e436ff0889330b44f87823bf8f712a6da6aba
Author: Daniel Dragan <[email protected]>
Date:   Fri Dec 12 05:16:50 2014 -0500

    document + improve ancient optimization in ParseXS
    
    From commit 8990e30710 "perl 5.0 alpha 6". The DESTROY XSUB with T_PTROBJ
    as INPUT arg was refusing to obey my custom typemap for T_PTROBJ, but all
    other XSUBs followed the custom T_PTROBJ override. Extend this
    optimization to other rarely used typemap types and document this behavior.
-----------------------------------------------------------------------

Summary of changes:
 dist/ExtUtils-ParseXS/lib/ExtUtils/ParseXS.pm |  5 ++++-
 dist/ExtUtils-ParseXS/lib/perlxstypemap.pod   | 15 +++++++++++++--
 2 files changed, 17 insertions(+), 3 deletions(-)

diff --git a/dist/ExtUtils-ParseXS/lib/ExtUtils/ParseXS.pm 
b/dist/ExtUtils-ParseXS/lib/ExtUtils/ParseXS.pm
index 8c7b09d..fedc494 100644
--- a/dist/ExtUtils-ParseXS/lib/ExtUtils/ParseXS.pm
+++ b/dist/ExtUtils-ParseXS/lib/ExtUtils/ParseXS.pm
@@ -1867,7 +1867,10 @@ sub generate_init {
 
   my $typem = $typemaps->get_typemap(ctype => $type);
   my $xstype = $typem->xstype;
-  $xstype =~ s/OBJ$/REF/ if $self->{func_name} =~ /DESTROY$/;
+  #this is an optimization from perl 5.0 alpha 6, class check is skipped
+  #T_REF_IV_REF is missing since it has no untyped analog at the moment
+  $xstype =~ s/OBJ$/REF/ || $xstype =~ s/^T_REF_IV_PTR$/T_PTRREF/
+    if $self->{func_name} =~ /DESTROY$/;
   if ($xstype eq 'T_PV' and exists $self->{lengthof}->{$var}) {
     print "\t$var" unless $printed_name;
     print " = ($type)SvPV($arg, STRLEN_length_of_$var);\n";
diff --git a/dist/ExtUtils-ParseXS/lib/perlxstypemap.pod 
b/dist/ExtUtils-ParseXS/lib/perlxstypemap.pod
index 5b1c639..7d1f73c 100644
--- a/dist/ExtUtils-ParseXS/lib/perlxstypemap.pod
+++ b/dist/ExtUtils-ParseXS/lib/perlxstypemap.pod
@@ -469,6 +469,9 @@ The pointer is blessed into a class that is derived from 
the name
 of type of the pointer but with all '*' in the name replaced with
 'Ptr'.
 
+For C<DESTROY> XSUBs only, a T_PTROBJ is optimized to a T_PTRREF. This means
+the class check is skipped.
+
 =item T_REF_IV_REF
 
 NOT YET
@@ -477,12 +480,16 @@ NOT YET
 
 Similar to T_PTROBJ in that the pointer is blessed into a scalar object.
 The difference is that when the object is passed back into XS it must be
-of the correct type (inheritance is not supported).
+of the correct type (inheritance is not supported) while T_PTROBJ supports
+inheritance.
 
 The pointer is blessed into a class that is derived from the name
 of type of the pointer but with all '*' in the name replaced with
 'Ptr'.
 
+For C<DESTROY> XSUBs only, a T_REF_IV_PTR is optimized to a T_PTRREF. This
+means the class check is skipped.
+
 =item T_PTRDESC
 
 NOT YET
@@ -498,7 +505,11 @@ are no known users in core or on CPAN.
 
 =item T_REFOBJ
 
-NOT YET
+Like T_REFREF, except it does strict type checking (inheritance is not
+supported).
+
+For C<DESTROY> XSUBs only, a T_REFOBJ is optimized to a T_REFREF. This means
+the class check is skipped.
 
 =item T_OPAQUEPTR
 

--
Perl5 Master Repository

Reply via email to