summaryrefslogtreecommitdiff
path: root/ext
diff options
context:
space:
mode:
authorNicholas Clark <nick@ccl4.org>2010-11-07 09:56:50 +0000
committerNicholas Clark <nick@ccl4.org>2010-11-08 07:55:09 +0000
commitff1a9fc06750e1a1a1480a987a9d24fd2f4824c7 (patch)
tree364b09875a0ce7361efea10b5a140f90712cac01 /ext
parent2726813d9af5d50f1451663cd931317e7172da50 (diff)
downloadperl-ff1a9fc06750e1a1a1480a987a9d24fd2f4824c7.tar.gz
Move the aliasing of B::IV::RV as B::PV::RV from XS to Perl code.
This results in the same CV being used twice, rather than two CVs being created that point to the same XS code implementation, shrinking the memory usage of B slightly (168 bytes on this platform). It also is fewer source lines. :-)
Diffstat (limited to 'ext')
-rw-r--r--ext/B/B.pm7
-rw-r--r--ext/B/B.xs12
2 files changed, 7 insertions, 12 deletions
diff --git a/ext/B/B.pm b/ext/B/B.pm
index 587b809583..773d9f189c 100644
--- a/ext/B/B.pm
+++ b/ext/B/B.pm
@@ -108,6 +108,13 @@ sub B::NULL::as_string() {""}
*B::IV::as_string = \&B::IV::int_value;
*B::PV::as_string = \&B::PV::PV;
+# The input typemap checking makes no distinction between different SV types,
+# so the XS body will generate the same C code, despite the different XS
+# "types". So there is no change in behaviour from doing "newXS" like this,
+# compared with the old approach of having a (near) duplicate XS body.
+# We should fix the typemap checking.
+*B::IV::RV = \&B::PV::RV if $] > 5.012;
+
my $debug;
my $op_count = 0;
my @parents = ();
diff --git a/ext/B/B.xs b/ext/B/B.xs
index bf9331755e..fb450ef119 100644
--- a/ext/B/B.xs
+++ b/ext/B/B.xs
@@ -1564,18 +1564,6 @@ packiv(sv)
ST(0) = newSVpvn_flags((char *)&w, 4, SVs_TEMP);
}
-#if PERL_VERSION >= 11
-# The input typemap checking makes no distinction between different SV types,
-# so the XS body will generate the same C code, despite the different XS
-# "types". So there is no change in behaviour from doing newXS like this,
-# compared with the old approach of having a (near) duplicate XS body.
-# We should fix the typemap checking.
-
-BOOT:
- newXS("B::IV::RV", XS_B__PV_RV, __FILE__);
-
-#endif
-
MODULE = B PACKAGE = B::NV PREFIX = Sv
NV