Re: [patch] improve B::Concise -src support
authorJim Cromie <jcromie@cpan.org>
Tue, 25 Sep 2007 17:34:09 +0000 (11:34 -0600)
committerRafael Garcia-Suarez <rgarciasuarez@gmail.com>
Wed, 26 Sep 2007 08:34:48 +0000 (08:34 +0000)
Message-ID: <46F99AF1.1080108@gmail.com>

p4raw-id: //depot/perl@31973

ext/B/B/Concise.pm
ext/B/t/concise.t
ext/B/t/optree_specials.t

index cd9a492..1d0691b 100644 (file)
@@ -14,7 +14,7 @@ use warnings; # uses #3 and #4, since warnings uses Carp
 
 use Exporter (); # use #5
 
-our $VERSION   = "0.73";
+our $VERSION   = "0.74";
 our @ISA       = qw(Exporter);
 our @EXPORT_OK = qw( set_style set_style_standard add_callback
                     concise_subref concise_cv concise_main
@@ -144,7 +144,6 @@ sub concise_subref {
 sub concise_stashref {
     my($order, $h) = @_;
     local *s;
-    print "stashref $h\n";
     foreach my $k (sort keys %$h) {
        next unless defined $h->{$k};
        *s = $h->{$k};
@@ -248,6 +247,8 @@ my @tree_decorations =
    [" ", map("$start_sym$_$end_sym", "q", "w", "t", "x", "m"), "", 0],
   );
 
+my @render_packs; # collect -stash=<packages>
+
 sub compileOpts {
     # set rendering state from options and args
     my (@options,@args);
@@ -282,6 +283,7 @@ sub compileOpts {
        } elsif ($o eq "-littleendian") {
            $big_endian = 0;
        }
+       # miscellaneous, presentation
        elsif ($o eq "-nobanner") {
            $banner = 0;
        } elsif ($o eq "-banner") {
@@ -293,7 +295,12 @@ sub compileOpts {
            $do_main = 0;
        } elsif ($o eq "-src") {
            $show_src = 1;
-           $^P |= 831;
+       }
+       elsif ($o =~ /^-stash=(.*)/) {
+           my $pkg = $1;
+           no strict 'refs';
+           eval "require $pkg" unless defined %{$pkg.'::'};
+           push @render_packs, $pkg;
        }
        # line-style options
        elsif (exists $style{substr($o, 1)}) {
@@ -356,7 +363,12 @@ sub compile {
                concise_subref($order, $objref, $objname);
            }
        }
-       if (!@args or $do_main) {
+       for my $pkg (@render_packs) {
+           no strict 'refs';
+           concise_stashref($order, \%{$pkg.'::'});
+       }
+
+       if (!@args or $do_main or @render_packs) {
            print $walkHandle "main program:\n" if $do_main;
            concise_main($order);
        }
@@ -714,20 +726,18 @@ sub concise_sv {
 my %srclines;
 
 sub fill_srclines {
-    my $file = shift;
-    my $fullnm = $file;
-    warn "-e not yet supported\n" and return if $file eq '-e';
-    unless (-f $fullnm) {
-       ($fullnm) = grep /$file$/, keys %:: ;
-       $fullnm =~ s/^_<//;
+    my $fullnm = shift;
+    if ($fullnm eq '-e') {
+       $srclines{$fullnm} = [ $fullnm, "-src not supported for -e" ];
+       return;
     }
-    open (my $fh, $fullnm)
+    open (my $fh, '<', $fullnm)
        or warn "# $fullnm: $!, (chdirs not supported by this feature yet)\n"
        and return;
     my @l = <$fh>;
     chomp @l;
-    unshift @l, $file; # like @{_<$filename} in debug, array starts at 1
-    $srclines{$file} = \@l;
+    unshift @l, $fullnm; # like @{_<$fullnm} in debug, array starts at 1
+    $srclines{$fullnm} = \@l;
 }
 
 sub concise_op {
@@ -815,17 +825,18 @@ sub concise_op {
        $h{coplabel} = $label;
        $label = $label ? "$label: " : "";
        my $loc = $op->file;
+       my $pathnm = $loc;
        $loc =~ s[.*/][];
-       $loc .= ":" . $op->line;
+       my $ln = $op->line;
+       $loc .= ":$ln";
        my($stash, $cseq) = ($op->stash->NAME, $op->cop_seq - $cop_seq_base);
        my $arybase = $op->arybase;
        $arybase = $arybase ? ' $[=' . $arybase : "";
        $h{arg} = "($label$stash $cseq $loc$arybase)";
        if ($show_src) {
-           my ($file,$ln) = split /:/, $loc;
-           fill_srclines($file) unless exists $srclines{$file};
-           $h{src} = "$ln: " . $srclines{$file}[$ln];
-           # print "$file:$ln $h{src}\n";
+           fill_srclines($pathnm) unless exists $srclines{$pathnm};
+           $h{src} = "$ln: " . ($srclines{$pathnm}[$ln]
+                                // "-src unavailable under -e");
        }
     } elsif ($h{class} eq "LOOP") {
        $h{arg} = "(next->" . seq($op->nextop) . " last->" . seq($op->lastop)
@@ -1088,11 +1099,11 @@ on threaded and un-threaded perls.
 =head1 OPTIONS
 
 Arguments that don't start with a hyphen are taken to be the names of
-subroutines to print the OPs of; if no such functions are specified,
-the main body of the program (outside any subroutines, and not
-including use'd or require'd files) is rendered.  Passing C<BEGIN>,
-C<UNITCHECK>, C<CHECK>, C<INIT>, or C<END> will cause all of the
-corresponding special blocks to be printed.
+subroutines to render; if no such functions are specified, the main
+body of the program (outside any subroutines, and not including use'd
+or require'd files) is rendered.  Passing C<BEGIN>, C<UNITCHECK>,
+C<CHECK>, C<INIT>, or C<END> will cause all of the corresponding
+special blocks to be printed.  Arguments must follow options.
 
 Options affect how things are rendered (ie printed).  They're presented
 here by their visual effect, 1st being strongest.  They're grouped
@@ -1256,6 +1267,11 @@ generates it.  For example:
     # 5:     print "$i\n";
     ...
 
+=item B<-stash="somepackage">
+
+With this, "somepackage" will be required, then the stash is
+inspected, and each function is rendered.
+
 =back
 
 The following options are pairwise exclusive.
@@ -1638,7 +1654,8 @@ program will have many subs.
 
 This renders all functions in the B::Concise package with the source
 lines.  It eschews the O framework so that the stashref can be passed
-directly to B::Concise::compile().
+directly to B::Concise::compile().  See -stash option for a more
+convenient way to render a package.
 
 =back
 
index 0f573de..175d540 100644 (file)
@@ -17,7 +17,7 @@ BEGIN {
     sub diag { print "# @_\n" } # but this is still handy
 }
 
-plan tests => 149;
+plan tests => 156;
 
 require_ok("B::Concise");
 
@@ -204,7 +204,7 @@ SKIP: {
        is(scalar split(/\n/, $res), 3,
           "'sub defd_empty {}' seen as 3 liner");
 
-       is(1, $res =~ /leavesub/ && $res =~ /nextstate/,
+       is(1, $res =~ /leavesub/ && $res =~ /(next|db)state/,
           "'sub defd_empty {}' seen as 2 ops: leavesub,nextstate");
 
        ($res,$err) = render('-basic', \&not_even_declared);
@@ -386,5 +386,44 @@ $out = runperl ( switches => ["-MO=Concise,Config::AUTOLOAD"],
 like($out, qr/Config::AUTOLOAD exists in stash, but has no START/,
     "coderef properly undefined");
 
-__END__
+# test -stash and -src rendering
+# todo: stderr=1 puts '-e syntax OK' into $out,
+# conceivably fouling one of the lines that are tested
+$out = runperl ( switches => ["-MO=Concise,-stash=B::Concise,-src"],
+                prog => '-e 1', stderr => 1 );
+
+like($out, qr/FUNC: \*B::Concise::concise_cv_obj/,
+     "stash rendering of B::Concise includes Concise::concise_cv_obj");
+
+like($out, qr/FUNC: \*B::Concise::walk_output/,
+     "stash rendering includes Concise::walk_output");
+
+like($out, qr/FUNC: \*B::Concise::PAD_FAKELEX_MULTI/,
+     "stash rendering includes constant sub: PAD_FAKELEX_MULTI");
+
+like($out, qr/PAD_FAKELEX_MULTI is a constant sub, optimized to a IV/,
+     "stash rendering identifies it as constant");
+
+like($out, qr/\# 4\d\d: \s+ \$l->concise\(\$level\);/,
+     "src-line rendering works");
 
+$out = runperl ( switches => ["-MO=Concise,-stash=Data::Dumper,-src,-exec"],
+                prog => '-e 1', stderr => 1 );
+
+like($out, qr/FUNC: \*Data::Dumper::format_refaddr/,
+     "stash rendering loads package as needed");
+
+my $prog = q{
+    package FOO;
+    sub bar { print "bar" }
+    package main;
+    FOO::bar();
+};
+# this would fail if %INC used for -stash test
+$out = runperl ( switches => ["-MO=Concise,-src,-stash=FOO,-main"],
+                prog => $prog, stderr => 1 );
+
+like($out, qr/FUNC: \*FOO::bar/,
+     "stash rendering works on inlined package");
+
+__END__
index 7e84076..83a0ded 100644 (file)
@@ -56,46 +56,102 @@ checkOptree ( name => 'BEGIN',
 # BEGIN 1:
 # b  <1> leavesub[1 ref] K/REFC,1 ->(end)
 # -     <@> lineseq KP ->b
-# 1        <;> nextstate(B::Concise -234 Concise.pm:328) v:*,&,{,$ ->2
+# 1        <;> nextstate(B::Concise -275 Concise.pm:356) v:*,&,{,$ ->2
 # 3        <1> require sK/1 ->4
-# 2           <$> const[PV "warnings.pm"] s/BARE ->3
-# 4        <;> nextstate(B::Concise -234 Concise.pm:328) v:*,&,{,$ ->5
+# 2           <$> const[PV "strict.pm"] s/BARE ->3
+# 4        <;> nextstate(B::Concise -275 Concise.pm:356) v:*,&,{,$ ->5
 # -        <@> lineseq K ->-
-# 5           <;> nextstate(B::Concise -234 Concise.pm:328) :*,&,{,$ ->6
+# 5           <;> nextstate(B::Concise -275 Concise.pm:356) :*,&,{,$ ->6
 # a           <1> entersub[t1] KS*/TARG,2 ->b
 # 6              <0> pushmark s ->7
-# 7              <$> const[PV "warnings"] sM ->8
-# 8              <$> const[PV "qw"] sM ->9
-# 9              <$> method_named[PV "import"] ->a
+# 7              <$> const[PV "strict"] sM ->8
+# 8              <$> const[PV "refs"] sM ->9
+# 9              <$> method_named[PV "unimport"] ->a
 # BEGIN 2:
-# f  <1> leavesub[1 ref] K/REFC,1 ->(end)
-# -     <@> lineseq KP ->f
-# c        <;> nextstate(main 2 -e:1) v:>,<,%,{ ->d
-# e        <1> postinc[t3] sK/1 ->f
-# -           <1> ex-rv2sv sKRM/1 ->e
-# d              <#> gvsv[*beg] s ->e
+# m  <1> leavesub[1 ref] K/REFC,1 ->(end)
+# -     <@> lineseq K ->m
+# c        <;> nextstate(B::Concise -265 Concise.pm:367) v:*,&,$ ->d
+# e        <1> require sK/1 ->f
+# d           <$> const[PV "strict.pm"] s/BARE ->e
+# f        <;> nextstate(B::Concise -265 Concise.pm:367) v:*,&,$ ->g
+# -        <@> lineseq K ->-
+# g           <;> nextstate(B::Concise -265 Concise.pm:367) :*,&,$ ->h
+# l           <1> entersub[t1] KS*/TARG,2 ->m
+# h              <0> pushmark s ->i
+# i              <$> const[PV "strict"] sM ->j
+# j              <$> const[PV "refs"] sM ->k
+# k              <$> method_named[PV "unimport"] ->l
+# BEGIN 3:
+# x  <1> leavesub[1 ref] K/REFC,1 ->(end)
+# -     <@> lineseq KP ->x
+# n        <;> nextstate(B::Concise -254 Concise.pm:386) v:*,&,{,$ ->o
+# p        <1> require sK/1 ->q
+# o           <$> const[PV "warnings.pm"] s/BARE ->p
+# q        <;> nextstate(B::Concise -254 Concise.pm:386) v:*,&,{,$ ->r
+# -        <@> lineseq K ->-
+# r           <;> nextstate(B::Concise -254 Concise.pm:386) :*,&,{,$ ->s
+# w           <1> entersub[t1] KS*/TARG,2 ->x
+# s              <0> pushmark s ->t
+# t              <$> const[PV "warnings"] sM ->u
+# u              <$> const[PV "qw"] sM ->v
+# v              <$> method_named[PV "unimport"] ->w
+# BEGIN 4:
+# 11 <1> leavesub[1 ref] K/REFC,1 ->(end)
+# -     <@> lineseq KP ->11
+# y        <;> nextstate(main 2 -e:1) v:{ ->z
+# 10       <1> postinc[t3] sK/1 ->11
+# -           <1> ex-rv2sv sKRM/1 ->10
+# z              <#> gvsv[*beg] s ->10
 EOT_EOT
 # BEGIN 1:
 # b  <1> leavesub[1 ref] K/REFC,1 ->(end)
 # -     <@> lineseq KP ->b
-# 1        <;> nextstate(B::Concise -234 Concise.pm:328) v:*,&,{,$ ->2
+# 1        <;> nextstate(B::Concise -275 Concise.pm:356) v:*,&,{,$ ->2
 # 3        <1> require sK/1 ->4
-# 2           <$> const(PV "warnings.pm") s/BARE ->3
-# 4        <;> nextstate(B::Concise -234 Concise.pm:328) v:*,&,{,$ ->5
+# 2           <$> const(PV "strict.pm") s/BARE ->3
+# 4        <;> nextstate(B::Concise -275 Concise.pm:356) v:*,&,{,$ ->5
 # -        <@> lineseq K ->-
-# 5           <;> nextstate(B::Concise -234 Concise.pm:328) :*,&,{,$ ->6
+# 5           <;> nextstate(B::Concise -275 Concise.pm:356) :*,&,{,$ ->6
 # a           <1> entersub[t1] KS*/TARG,2 ->b
 # 6              <0> pushmark s ->7
-# 7              <$> const(PV "warnings") sM ->8
-# 8              <$> const(PV "qw") sM ->9
-# 9              <$> method_named(PV "import") ->a
+# 7              <$> const(PV "strict") sM ->8
+# 8              <$> const(PV "refs") sM ->9
+# 9              <$> method_named(PV "unimport") ->a
 # BEGIN 2:
-# f  <1> leavesub[1 ref] K/REFC,1 ->(end)
-# -     <@> lineseq KP ->f
-# c        <;> nextstate(main 2 -e:1) v:>,<,%,{ ->d
-# e        <1> postinc[t2] sK/1 ->f
-# -           <1> ex-rv2sv sKRM/1 ->e
-# d              <$> gvsv(*beg) s ->e
+# m  <1> leavesub[1 ref] K/REFC,1 ->(end)
+# -     <@> lineseq K ->m
+# c        <;> nextstate(B::Concise -265 Concise.pm:367) v:*,&,$ ->d
+# e        <1> require sK/1 ->f
+# d           <$> const(PV "strict.pm") s/BARE ->e
+# f        <;> nextstate(B::Concise -265 Concise.pm:367) v:*,&,$ ->g
+# -        <@> lineseq K ->-
+# g           <;> nextstate(B::Concise -265 Concise.pm:367) :*,&,$ ->h
+# l           <1> entersub[t1] KS*/TARG,2 ->m
+# h              <0> pushmark s ->i
+# i              <$> const(PV "strict") sM ->j
+# j              <$> const(PV "refs") sM ->k
+# k              <$> method_named(PV "unimport") ->l
+# BEGIN 3:
+# x  <1> leavesub[1 ref] K/REFC,1 ->(end)
+# -     <@> lineseq KP ->x
+# n        <;> nextstate(B::Concise -254 Concise.pm:386) v:*,&,{,$ ->o
+# p        <1> require sK/1 ->q
+# o           <$> const(PV "warnings.pm") s/BARE ->p
+# q        <;> nextstate(B::Concise -254 Concise.pm:386) v:*,&,{,$ ->r
+# -        <@> lineseq K ->-
+# r           <;> nextstate(B::Concise -254 Concise.pm:386) :*,&,{,$ ->s
+# w           <1> entersub[t1] KS*/TARG,2 ->x
+# s              <0> pushmark s ->t
+# t              <$> const(PV "warnings") sM ->u
+# u              <$> const(PV "qw") sM ->v
+# v              <$> method_named(PV "unimport") ->w
+# BEGIN 4:
+# 11 <1> leavesub[1 ref] K/REFC,1 ->(end)
+# -     <@> lineseq KP ->11
+# y        <;> nextstate(main 2 -e:1) v:{ ->z
+# 10       <1> postinc[t2] sK/1 ->11
+# -           <1> ex-rv2sv sKRM/1 ->10
+# z              <$> gvsv(*beg) s ->10
 EONT_EONT
 
 
@@ -199,80 +255,128 @@ checkOptree ( name       => 'all of BEGIN END INIT CHECK UNITCHECK -exec',
              strip_open_hints => 1,
              expect    => <<'EOT_EOT', expect_nt => <<'EONT_EONT');
 # BEGIN 1:
-# 1  <;> nextstate(B::Concise -234 Concise.pm:328) v:*,&,{,$
-# 2  <$> const[PV "warnings.pm"] s/BARE
+# 1  <;> nextstate(B::Concise -275 Concise.pm:356) v:*,&,{,$
+# 2  <$> const[PV "strict.pm"] s/BARE
 # 3  <1> require sK/1
-# 4  <;> nextstate(B::Concise -234 Concise.pm:328) v:*,&,{,$
-# 5  <;> nextstate(B::Concise -234 Concise.pm:328) :*,&,{,$
+# 4  <;> nextstate(B::Concise -275 Concise.pm:356) v:*,&,{,$
+# 5  <;> nextstate(B::Concise -275 Concise.pm:356) :*,&,{,$
 # 6  <0> pushmark s
-# 7  <$> const[PV "warnings"] sM
-# 8  <$> const[PV "qw"] sM
+# 7  <$> const[PV "strict"] sM
+# 8  <$> const[PV "refs"] sM
 # 9  <$> method_named[PV "unimport"] 
 # a  <1> entersub[t1] KS*/TARG,2
 # b  <1> leavesub[1 ref] K/REFC,1
 # BEGIN 2:
-# c  <;> nextstate(main 2 -e:1) v:>,<,%,{
-# d  <#> gvsv[*beg] s
-# e  <1> postinc[t3] sK/1
-# f  <1> leavesub[1 ref] K/REFC,1
+# c  <;> nextstate(B::Concise -265 Concise.pm:367) v:*,&,$
+# d  <$> const[PV "strict.pm"] s/BARE
+# e  <1> require sK/1
+# f  <;> nextstate(B::Concise -265 Concise.pm:367) v:*,&,$
+# g  <;> nextstate(B::Concise -265 Concise.pm:367) :*,&,$
+# h  <0> pushmark s
+# i  <$> const[PV "strict"] sM
+# j  <$> const[PV "refs"] sM
+# k  <$> method_named[PV "unimport"] 
+# l  <1> entersub[t1] KS*/TARG,2
+# m  <1> leavesub[1 ref] K/REFC,1
+# BEGIN 3:
+# n  <;> nextstate(B::Concise -254 Concise.pm:386) v:*,&,{,$
+# o  <$> const[PV "warnings.pm"] s/BARE
+# p  <1> require sK/1
+# q  <;> nextstate(B::Concise -254 Concise.pm:386) v:*,&,{,$
+# r  <;> nextstate(B::Concise -254 Concise.pm:386) :*,&,{,$
+# s  <0> pushmark s
+# t  <$> const[PV "warnings"] sM
+# u  <$> const[PV "qw"] sM
+# v  <$> method_named[PV "unimport"] 
+# w  <1> entersub[t1] KS*/TARG,2
+# x  <1> leavesub[1 ref] K/REFC,1
+# BEGIN 4:
+# y  <;> nextstate(main 2 -e:1) v:{
+# z  <#> gvsv[*beg] s
+# 10 <1> postinc[t3] sK/1
+# 11 <1> leavesub[1 ref] K/REFC,1
 # END 1:
-# g  <;> nextstate(main 5 -e:1) v:>,<,%,{
-#  <#> gvsv[*end] s
-#  <1> postinc[t3] sK/1
-#  <1> leavesub[1 ref] K/REFC,1
+# 12 <;> nextstate(main 5 -e:1) v:{
+# 13 <#> gvsv[*end] s
+# 14 <1> postinc[t3] sK/1
+# 15 <1> leavesub[1 ref] K/REFC,1
 # INIT 1:
-# k  <;> nextstate(main 4 -e:1) v:>,<,%,{
-#  <#> gvsv[*init] s
-#  <1> postinc[t3] sK/1
-#  <1> leavesub[1 ref] K/REFC,1
+# 16 <;> nextstate(main 4 -e:1) v:{
+# 17 <#> gvsv[*init] s
+# 18 <1> postinc[t3] sK/1
+# 19 <1> leavesub[1 ref] K/REFC,1
 # CHECK 1:
-# o  <;> nextstate(main 3 -e:1) v:>,<,%,{
-#  <#> gvsv[*chk] s
-#  <1> postinc[t3] sK/1
-#  <1> leavesub[1 ref] K/REFC,1
+# 1a <;> nextstate(main 3 -e:1) v:{
+# 1b <#> gvsv[*chk] s
+# 1c <1> postinc[t3] sK/1
+# 1d <1> leavesub[1 ref] K/REFC,1
 # UNITCHECK 1:
-# s  <;> nextstate(main 6 -e:1) v:>,<,%,{
-#  <#> gvsv[*uc] s
-#  <1> postinc[t3] sK/1
-#  <1> leavesub[1 ref] K/REFC,1
+# 1e <;> nextstate(main 6 -e:1) v:{
+# 1f <#> gvsv[*uc] s
+# 1g <1> postinc[t3] sK/1
+# 1h <1> leavesub[1 ref] K/REFC,1
 EOT_EOT
 # BEGIN 1:
-# 1  <;> nextstate(B::Concise -234 Concise.pm:328) v:*,&,{,$
-# 2  <$> const(PV "warnings.pm") s/BARE
+# 1  <;> nextstate(B::Concise -275 Concise.pm:356) v:*,&,{,$
+# 2  <$> const(PV "strict.pm") s/BARE
 # 3  <1> require sK/1
-# 4  <;> nextstate(B::Concise -234 Concise.pm:328) v:*,&,{,$
-# 5  <;> nextstate(B::Concise -234 Concise.pm:328) :*,&,{,$
+# 4  <;> nextstate(B::Concise -275 Concise.pm:356) v:*,&,{,$
+# 5  <;> nextstate(B::Concise -275 Concise.pm:356) :*,&,{,$
 # 6  <0> pushmark s
-# 7  <$> const(PV "warnings") sM
-# 8  <$> const(PV "qw") sM
+# 7  <$> const(PV "strict") sM
+# 8  <$> const(PV "refs") sM
 # 9  <$> method_named(PV "unimport") 
 # a  <1> entersub[t1] KS*/TARG,2
 # b  <1> leavesub[1 ref] K/REFC,1
 # BEGIN 2:
-# c  <;> nextstate(main 2 -e:1) v:>,<,%,{
-# d  <$> gvsv(*beg) s
-# e  <1> postinc[t2] sK/1
-# f  <1> leavesub[1 ref] K/REFC,1
+# c  <;> nextstate(B::Concise -265 Concise.pm:367) v:*,&,$
+# d  <$> const(PV "strict.pm") s/BARE
+# e  <1> require sK/1
+# f  <;> nextstate(B::Concise -265 Concise.pm:367) v:*,&,$
+# g  <;> nextstate(B::Concise -265 Concise.pm:367) :*,&,$
+# h  <0> pushmark s
+# i  <$> const(PV "strict") sM
+# j  <$> const(PV "refs") sM
+# k  <$> method_named(PV "unimport") 
+# l  <1> entersub[t1] KS*/TARG,2
+# m  <1> leavesub[1 ref] K/REFC,1
+# BEGIN 3:
+# n  <;> nextstate(B::Concise -254 Concise.pm:386) v:*,&,{,$
+# o  <$> const(PV "warnings.pm") s/BARE
+# p  <1> require sK/1
+# q  <;> nextstate(B::Concise -254 Concise.pm:386) v:*,&,{,$
+# r  <;> nextstate(B::Concise -254 Concise.pm:386) :*,&,{,$
+# s  <0> pushmark s
+# t  <$> const(PV "warnings") sM
+# u  <$> const(PV "qw") sM
+# v  <$> method_named(PV "unimport") 
+# w  <1> entersub[t1] KS*/TARG,2
+# x  <1> leavesub[1 ref] K/REFC,1
+# BEGIN 4:
+# y  <;> nextstate(main 2 -e:1) v:{
+# z  <$> gvsv(*beg) s
+# 10 <1> postinc[t2] sK/1
+# 11 <1> leavesub[1 ref] K/REFC,1
 # END 1:
-# g  <;> nextstate(main 5 -e:1) v:>,<,%,{
-#  <$> gvsv(*end) s
-#  <1> postinc[t2] sK/1
-#  <1> leavesub[1 ref] K/REFC,1
+# 12 <;> nextstate(main 5 -e:1) v:{
+# 13 <$> gvsv(*end) s
+# 14 <1> postinc[t2] sK/1
+# 15 <1> leavesub[1 ref] K/REFC,1
 # INIT 1:
-# k  <;> nextstate(main 4 -e:1) v:>,<,%,{
-#  <$> gvsv(*init) s
-#  <1> postinc[t2] sK/1
-#  <1> leavesub[1 ref] K/REFC,1
+# 16 <;> nextstate(main 4 -e:1) v:{
+# 17 <$> gvsv(*init) s
+# 18 <1> postinc[t2] sK/1
+# 19 <1> leavesub[1 ref] K/REFC,1
 # CHECK 1:
-# o  <;> nextstate(main 3 -e:1) v:>,<,%,{
-#  <$> gvsv(*chk) s
-#  <1> postinc[t2] sK/1
-#  <1> leavesub[1 ref] K/REFC,1
+# 1a <;> nextstate(main 3 -e:1) v:{
+# 1b <$> gvsv(*chk) s
+# 1c <1> postinc[t2] sK/1
+# 1d <1> leavesub[1 ref] K/REFC,1
 # UNITCHECK 1:
-# s  <;> nextstate(main 6 -e:1) v:>,<,%,{
-#  <$> gvsv(*uc) s
-#  <1> postinc[t2] sK/1
-#  <1> leavesub[1 ref] K/REFC,1
+# 1e <;> nextstate(main 6 -e:1) v:{
+# 1f <$> gvsv(*uc) s
+# 1g <1> postinc[t2] sK/1
+# 1h <1> leavesub[1 ref] K/REFC,1
 EONT_EONT
 
 
@@ -286,28 +390,76 @@ checkOptree ( name        => 'regression test for patch 25352',
              @warnings_todo,
              expect    => <<'EOT_EOT', expect_nt => <<'EONT_EONT');
 # BEGIN 1:
-# 1  <;> nextstate(B::Concise -234 Concise.pm:359) v:*,&,{,$
-# 2  <$> const[PV "warnings.pm"] s/BARE
+# 1  <;> nextstate(B::Concise -275 Concise.pm:356) v:*,&,{,$
+# 2  <$> const[PV "strict.pm"] s/BARE
 # 3  <1> require sK/1
-# 4  <;> nextstate(B::Concise -234 Concise.pm:359) v:*,&,{,$
-# 5  <;> nextstate(B::Concise -234 Concise.pm:359) :*,&,{,$
+# 4  <;> nextstate(B::Concise -275 Concise.pm:356) v:*,&,{,$
+# 5  <;> nextstate(B::Concise -275 Concise.pm:356) :*,&,{,$
 # 6  <0> pushmark s
-# 7  <$> const[PV "warnings"] sM
-# 8  <$> const[PV "qw"] sM
+# 7  <$> const[PV "strict"] sM
+# 8  <$> const[PV "refs"] sM
 # 9  <$> method_named[PV "unimport"] 
 # a  <1> entersub[t1] KS*/TARG,2
 # b  <1> leavesub[1 ref] K/REFC,1
+# BEGIN 2:
+# c  <;> nextstate(B::Concise -265 Concise.pm:367) v:*,&,$
+# d  <$> const[PV "strict.pm"] s/BARE
+# e  <1> require sK/1
+# f  <;> nextstate(B::Concise -265 Concise.pm:367) v:*,&,$
+# g  <;> nextstate(B::Concise -265 Concise.pm:367) :*,&,$
+# h  <0> pushmark s
+# i  <$> const[PV "strict"] sM
+# j  <$> const[PV "refs"] sM
+# k  <$> method_named[PV "unimport"] 
+# l  <1> entersub[t1] KS*/TARG,2
+# m  <1> leavesub[1 ref] K/REFC,1
+# BEGIN 3:
+# n  <;> nextstate(B::Concise -254 Concise.pm:386) v:*,&,{,$
+# o  <$> const[PV "warnings.pm"] s/BARE
+# p  <1> require sK/1
+# q  <;> nextstate(B::Concise -254 Concise.pm:386) v:*,&,{,$
+# r  <;> nextstate(B::Concise -254 Concise.pm:386) :*,&,{,$
+# s  <0> pushmark s
+# t  <$> const[PV "warnings"] sM
+# u  <$> const[PV "qw"] sM
+# v  <$> method_named[PV "unimport"] 
+# w  <1> entersub[t1] KS*/TARG,2
+# x  <1> leavesub[1 ref] K/REFC,1
 EOT_EOT
 # BEGIN 1:
-# 1  <;> nextstate(B::Concise -234 Concise.pm:359) v:*,&,{,$
-# 2  <$> const(PV "warnings.pm") s/BARE
+# 1  <;> nextstate(B::Concise -275 Concise.pm:356) v:*,&,{,$
+# 2  <$> const(PV "strict.pm") s/BARE
 # 3  <1> require sK/1
-# 4  <;> nextstate(B::Concise -234 Concise.pm:359) v:*,&,{,$
-# 5  <;> nextstate(B::Concise -234 Concise.pm:359) :*,&,{,$
+# 4  <;> nextstate(B::Concise -275 Concise.pm:356) v:*,&,{,$
+# 5  <;> nextstate(B::Concise -275 Concise.pm:356) :*,&,{,$
 # 6  <0> pushmark s
-# 7  <$> const(PV "warnings") sM
-# 8  <$> const(PV "qw") sM
+# 7  <$> const(PV "strict") sM
+# 8  <$> const(PV "refs") sM
 # 9  <$> method_named(PV "unimport") 
 # a  <1> entersub[t1] KS*/TARG,2
 # b  <1> leavesub[1 ref] K/REFC,1
+# BEGIN 2:
+# c  <;> nextstate(B::Concise -265 Concise.pm:367) v:*,&,$
+# d  <$> const(PV "strict.pm") s/BARE
+# e  <1> require sK/1
+# f  <;> nextstate(B::Concise -265 Concise.pm:367) v:*,&,$
+# g  <;> nextstate(B::Concise -265 Concise.pm:367) :*,&,$
+# h  <0> pushmark s
+# i  <$> const(PV "strict") sM
+# j  <$> const(PV "refs") sM
+# k  <$> method_named(PV "unimport") 
+# l  <1> entersub[t1] KS*/TARG,2
+# m  <1> leavesub[1 ref] K/REFC,1
+# BEGIN 3:
+# n  <;> nextstate(B::Concise -254 Concise.pm:386) v:*,&,{,$
+# o  <$> const(PV "warnings.pm") s/BARE
+# p  <1> require sK/1
+# q  <;> nextstate(B::Concise -254 Concise.pm:386) v:*,&,{,$
+# r  <;> nextstate(B::Concise -254 Concise.pm:386) :*,&,{,$
+# s  <0> pushmark s
+# t  <$> const(PV "warnings") sM
+# u  <$> const(PV "qw") sM
+# v  <$> method_named(PV "unimport") 
+# w  <1> entersub[t1] KS*/TARG,2
+# x  <1> leavesub[1 ref] K/REFC,1
 EONT_EONT