Skip to content

Commit

Permalink
Checking in changes prior to tagging of version 2.02.
Browse files Browse the repository at this point in the history
Changelog diff is:

diff --git a/Changes b/Changes
index 7538b98..bfd4db1 100644
--- a/Changes
+++ b/Changes
@@ -1,5 +1,8 @@
 Revision history of B::Size2

+2.02 2013-02-01 15:08:51
+	- Fix a SEGV
+
 2.01 2013-01-17 16:33:46
 	- Suppress warnings (hirose31++)
  • Loading branch information
Fuji, Goro committed Feb 1, 2013
1 parent aa21f52 commit 9fe867d
Show file tree
Hide file tree
Showing 4 changed files with 22 additions and 6 deletions.
3 changes: 3 additions & 0 deletions Changes
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
Revision history of B::Size2

2.02 2013-02-01 15:08:51
- Fix a SEGV

2.01 2013-01-17 16:33:46
- Suppress warnings (hirose31++)

Expand Down
21 changes: 17 additions & 4 deletions lib/B/Size2.pm
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ use XSLoader ();
use B ();

BEGIN {
our $VERSION = '2.01';
our $VERSION = '2.02';

XSLoader::load(__PACKAGE__, $VERSION);
}
Expand All @@ -24,6 +24,16 @@ BEGIN {
*B::UNOP::size = \&B::Sizeof::UNOP;
}

use constant _CHECK_SVPAD_OUR_FOR_MAGIC => $] < 5.016;

use constant _SVpad_NAME => 0x40000000; # sv.h
use constant _SVpad_OUR => 0x00040000; # sv.h

sub _SvPAD_OUR { # see SvPAD_OUR()@sv.h
my($sv) = @_;
return ($sv->FLAGS() & _SVpad_NAME|_SVpad_OUR) == (_SVpad_NAME|_SVpad_OUR);
}

sub B::SVOP::size {
B::Sizeof::SVOP + shift->sv->size;
}
Expand Down Expand Up @@ -79,9 +89,12 @@ sub B::PVLV::size {
sub B::PVMG::size {
my $sv = shift;
my $size = B::Sizeof::SV + B::Sizeof::XPVMG;
my(@chain) = $sv->MAGIC;
for my $mg (@chain) {
$size += B::Sizeof::MAGIC + $mg->LENGTH;

if (_CHECK_SVPAD_OUR_FOR_MAGIC && !_SvPAD_OUR($sv)){
my(@chain) = $sv->MAGIC;
for my $mg (@chain) {
$size += B::Sizeof::MAGIC + $mg->LENGTH;
}
}
$size;
}
Expand Down
2 changes: 1 addition & 1 deletion lib/B/Size2/Terse.pm
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ use constant MP2 => ($ENV{MOD_PERL_API_VERSION} || 0) == 2 ? 1 : 0;
use B ();
use B::Size2 ();

our $VERSION = "2.01";
our $VERSION = "2.02";

my $opcount;
my $opsize;
Expand Down
2 changes: 1 addition & 1 deletion t/002.terse.t
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ use Test::More tests => 1;
use B::Size2;
use B::Size2::Terse;

foreach my $pkg (qw(main B::Size2 B::Size2::Terse)) {
foreach my $pkg (qw(main B::Size2 B::Size2::Terse Test::More)) {
my($subs, $opcount, $opsize) = B::Size2::Terse::package_size($pkg);
}
pass "use of package_size()";

0 comments on commit 9fe867d

Please sign in to comment.