Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Reduce module dependencies of B and O to simplify compiler second guessing. #15712

Closed
p5pRT opened this issue Nov 13, 2016 · 22 comments
Closed

Comments

@p5pRT
Copy link

p5pRT commented Nov 13, 2016

Migrated from rt.perl.org#130087 (status was 'resolved')

Searchable as RT130087$

@p5pRT
Copy link
Author

p5pRT commented Nov 13, 2016

From @toddr

Created by @toddr

While working with B​::C, it is impossible to tell what modules are
loaded by the program or by O/B. As a result, it's ideal if B/O do not
load modules if they can help it. I'm submitting a proposed patch to
address this.

Perl Info

Flags:
    category=library
    severity=low
    module=O

Site configuration information for perl 5.18.2:

Configured by root at Tue Aug 11 04:03:09 PDT 2015.

Summary of my perl5 (revision 5 version 18 subversion 2) configuration:

   Platform:
    osname=darwin, osvers=15.0, archname=darwin-thread-multi-2level
    uname='darwin osx219.apple.com 15.0 darwin kernel version 15.0.0:
fri may 22 22:03:51 pdt 2015;
root:xnu-3216.0.0.1.11~1development_x86_64 x86_64 '
    config_args='-ds -e -Dprefix=/usr -Dccflags=-g  -pipe  -Dldflags=
-Dman3ext=3pm -Duseithreads -Duseshrplib -Dinc_version_list=none
-Dcc=cc'
    hint=recommended, useposix=true, d_sigaction=define
    useithreads=define, usemultiplicity=define
    useperlio=define, d_sfio=undef, uselargefiles=define, usesocks=undef
    use64bitint=define, use64bitall=define, uselongdouble=undef
    usemymalloc=n, bincompat5005=undef

  Compiler:
    cc='cc', ccflags ='-arch i386 -arch x86_64 -g -pipe -fno-common
-DPERL_DARWIN -fno-strict-aliasing -fstack-protector',
    optimize='-Os',
    cppflags='-g -pipe -fno-common -DPERL_DARWIN -fno-strict-aliasing
-fstack-protector'
    ccversion='', gccversion='4.2.1 Compatible Apple LLVM 7.0.0
(clang-700.0.59.1)', gccosandvers=''
    intsize=4, longsize=8, ptrsize=8, doublesize=8, byteorder=12345678
    d_longlong=define, longlongsize=8, d_longdbl=define, longdblsize=16
    ivtype='long', ivsize=8, nvtype='double', nvsize=8, Off_t='off_t',
lseeksize=8
    alignbytes=8, prototype=define

  Linker and Libraries:
    ld='cc -mmacosx-version-min=10.11.3', ldflags ='-arch i386 -arch
x86_64 -fstack-protector'
    libpth=/usr/lib /usr/local/lib
    libs=
    perllibs=
    libc=, so=dylib, useshrplib=true, libperl=libperl.dylib
    gnulibc_version=''

  Dynamic Linking:
    dlsrc=dl_dlopen.xs, dlext=bundle, d_dlsymun=undef, ccdlflags=' '
    cccdlflags=' ', lddlflags='-arch i386 -arch x86_64 -bundle
-undefined dynamic_lookup -fstack-protector'

Locally applied patches:
    /Library/Perl/Updates/<version> comes before system perl directories
    installprivlib and installarchlib points to the Updates directory




@INC for perl 5.18.2:
    /Library/Perl/5.18/darwin-thread-multi-2level
    /Library/Perl/5.18
    /Network/Library/Perl/5.18/darwin-thread-multi-2level
    /Network/Library/Perl/5.18
    /Library/Perl/Updates/5.18.2
    /System/Library/Perl/5.18/darwin-thread-multi-2level
    /System/Library/Perl/5.18
    /System/Library/Perl/Extras/5.18/darwin-thread-multi-2level
    /System/Library/Perl/Extras/5.18
    .


Environment for perl 5.18.2:
    DYLD_LIBRARY_PATH (unset)
    HOME=/Users/toddr
    LANG=en_US.UTF-8
    LANGUAGE (unset)
    LD_LIBRARY_PATH (unset)
    LOGDIR (unset)
    PATH=:/sw/bin
    PERLDB_OPTS=RemotePort=:9000
    PERL_BADLANG (unset)
    SHELL=/bin/zsh

@p5pRT
Copy link
Author

p5pRT commented Nov 13, 2016

From @toddr

Patch attached.

@p5pRT
Copy link
Author

p5pRT commented Nov 13, 2016

From @toddr

0001-Remove-unnecessary-module-loads-from-B-and-O.patch
From e0054453534dd4b6f47fa3ae58cb26a39ac8928a Mon Sep 17 00:00:00 2001
From: Todd Rinaldo <toddr@cpan.org>
Date: Sat, 12 Nov 2016 03:30:49 -0600
Subject: [PATCH] Remove unnecessary module loads from B and O

This commit removes multiple unnecessary modules so that
perl -MO= can hand back to compile as cleanly as possible.

This change caused significant jitter in tests for B::Concise. While updating
the test to the new reality, OptreeCheck.pm was corrected to stop stripping
regexes off $got when it started failing so it would be easier to see where
the failure happened.
---
 ext/B/B.pm                |  11 +-
 ext/B/O.pm                |  11 +-
 ext/B/t/OptreeCheck.pm    |   5 +-
 ext/B/t/optree_specials.t | 694 +++++++++++++++++++++++++++++-----------------
 4 files changed, 458 insertions(+), 263 deletions(-)

diff --git a/ext/B/B.pm b/ext/B/B.pm
index 5cc253e..24cf246 100644
--- a/ext/B/B.pm
+++ b/ext/B/B.pm
@@ -6,16 +6,21 @@
 #      License or the Artistic License, as specified in the README file.
 #
 package B;
-use strict;
 
-require Exporter;
 @B::ISA = qw(Exporter);
 
+# If B is loaded without imports, we do not want to unnecessarily pollute the stash with Exporter.
+sub import {
+    return unless scalar @_ > 1; # Called as a method call.
+    require Exporter;
+    B->export_to_level(1, @_);
+}
+
 # walkoptree_slow comes from B.pm (you are there),
 # walkoptree comes from B.xs
 
 BEGIN {
-    $B::VERSION = '1.64';
+    $B::VERSION = '1.65';
     @B::EXPORT_OK = ();
 
     # Our BOOT code needs $VERSION set, and will append to @EXPORT_OK.
diff --git a/ext/B/O.pm b/ext/B/O.pm
index 2976a89..00cf091 100644
--- a/ext/B/O.pm
+++ b/ext/B/O.pm
@@ -1,9 +1,8 @@
 package O;
 
-our $VERSION = '1.01';
+our $VERSION = '1.02';
 
-use B qw(minus_c save_BEGINs);
-use Carp;
+use B ();
 
 sub import {
     my ($class, @options) = @_;
@@ -21,8 +20,8 @@ sub import {
     my $backend = shift (@options);
     eval q[
 	BEGIN {
-	    minus_c;
-	    save_BEGINs;
+	    B::minus_c;
+	    B::save_BEGINs;
 	}
 
 	CHECK {
@@ -38,7 +37,7 @@ sub import {
 	    # nice. Thanks. --smcc
 	    use B::].$backend.q[ ();
 	    if ($@) {
-		croak "use of backend $backend failed: $@";
+            die("use of backend $backend failed: $@");
 	    }
 
 
diff --git a/ext/B/t/OptreeCheck.pm b/ext/B/t/OptreeCheck.pm
index 3ae1930..f07e272 100644
--- a/ext/B/t/OptreeCheck.pm
+++ b/ext/B/t/OptreeCheck.pm
@@ -5,7 +5,7 @@ use warnings;
 use vars qw($TODO $Level $using_open);
 require "test.pl";
 
-our $VERSION = '0.14';
+our $VERSION = '0.15';
 
 # now export checkOptree, and those test.pl functions used by tests
 our @EXPORT = qw( checkOptree plan skip skip_all pass is like unlike
@@ -781,8 +781,9 @@ sub reduceDiffs {
         my $exp = shift @want;
         my $line = shift @got;
         # remove matches, and report
-        unless ($got =~ s/($rex\n)//msg) {
+        unless ($got =~ s/^($rex\n)//ms) {
             _diag("got:\t\t'$line'\nwant:\t $rex\n");
+            last;
         }
     }
     _diag("remainder:\n$got");
diff --git a/ext/B/t/optree_specials.t b/ext/B/t/optree_specials.t
index 83ea44e..3f575d5 100644
--- a/ext/B/t/optree_specials.t
+++ b/ext/B/t/optree_specials.t
@@ -39,108 +39,183 @@ checkOptree ( name	=> 'BEGIN',
 	      prog	=> $src,
 	      strip_open_hints => 1,
 	      expect	=> <<'EOT_EOT', expect_nt => <<'EONT_EONT');
-# BEGIN 1:
-# a  <1> leavesub[1 ref] K/REFC,1 ->(end)
-# -     <@> lineseq KP ->a
-# 1        <;> nextstate(B::Concise -275 Concise.pm:356) v:*,&,{,x*,x&,x$,$ ->2
-# 3        <1> require sK/1 ->4
-# 2           <$> const[PV "strict.pm"] s/BARE ->3
-# -        <;> ex-nextstate(B::Concise -837 Concise.pm:366) v:*,&,{,x*,x&,x$,$ ->4
-# -        <@> lineseq K ->-
-# 4           <;> nextstate(B::Concise -275 Concise.pm:356) :*,&,{,x*,x&,x$,$ ->5
-# 9           <1> entersub[t1] KRS*/TARG,STRICT ->a
-# 5              <0> pushmark s ->6
-# 6              <$> const[PV "strict"] sM ->7
-# 7              <$> const[PV "refs"] sM ->8
-# 8              <.> method_named[PV "unimport"] ->9
+# -     <@> lineseq KP ->7
+# 1        <;> nextstate(B::Concise -1151 Concise.pm:116) v:*,&,{,x*,x&,x$,$ ->2
+# 6        <2> sassign sKS/2 ->7
+# 4           <1> srefgen sK/1 ->5
+# -              <1> ex-list lKRM ->4
+# 3                 <1> rv2gv sKRM/STRICT,1 ->4
+# 2                    <#> gv[*STDOUT] s ->3
+# -           <1> ex-rv2sv sKRM*/STRICT,1 ->6
+# 5              <#> gvsv[*B::Concise::walkHandle] s ->6
 # BEGIN 2:
-# k  <1> leavesub[1 ref] K/REFC,1 ->(end)
-# -     <@> lineseq K ->k
-# b        <;> nextstate(B::Concise -265 Concise.pm:367) v:*,&,x*,x&,x$,$ ->c
-# d        <1> require sK/1 ->e
-# c           <$> const[PV "strict.pm"] s/BARE ->d
-# -        <;> ex-nextstate(B::Concise -812 Concise.pm:386) v:*,&,x*,x&,x$,$ ->e
+# h  <1> leavesub[1 ref] K/REFC,1 ->(end)
+# -     <@> lineseq K ->h
+# 8        <;> nextstate(B::Concise -1113 Concise.pm:181) v:*,&,x*,x&,x$,$ ->9
+# a        <1> require sK/1 ->b
+# 9           <$> const[PV "strict.pm"] s/BARE ->a
+# -        <;> ex-nextstate(B::Concise -1113 Concise.pm:181) v:*,&,x*,x&,x$,$ ->b
 # -        <@> lineseq K ->-
-# e           <;> nextstate(B::Concise -265 Concise.pm:367) :*,&,x*,x&,x$,$ ->f
-# j           <1> entersub[t1] KRS*/TARG,STRICT ->k
-# f              <0> pushmark s ->g
-# g              <$> const[PV "strict"] sM ->h
-# h              <$> const[PV "refs"] sM ->i
-# i              <.> method_named[PV "unimport"] ->j
+# b           <;> nextstate(B::Concise -1113 Concise.pm:181) :*,&,x*,x&,x$,$ ->c
+# g           <1> entersub[t1] KRS*/TARG,STRICT ->h
+# c              <0> pushmark s ->d
+# d              <$> const[PV "strict"] sM ->e
+# e              <$> const[PV "refs"] sM ->f
+# f              <.> method_named[PV "unimport"] ->g
 # BEGIN 3:
-# u  <1> leavesub[1 ref] K/REFC,1 ->(end)
-# -     <@> lineseq KP ->u
-# l        <;> nextstate(B::Concise -254 Concise.pm:386) v:*,&,{,x*,x&,x$,$ ->m
-# n        <1> require sK/1 ->o
-# m           <$> const[PV "warnings.pm"] s/BARE ->n
-# -        <;> ex-nextstate(B::Concise -798 Concise.pm:406) v:*,&,{,x*,x&,x$,$ ->o
+# r  <1> leavesub[1 ref] K/REFC,1 ->(end)
+# -     <@> lineseq K ->r
+# i        <;> nextstate(B::Concise -1010 Concise.pm:303) v:*,&,x*,x&,x$,$ ->j
+# k        <1> require sK/1 ->l
+# j           <$> const[PV "strict.pm"] s/BARE ->k
+# -        <;> ex-nextstate(B::Concise -1010 Concise.pm:303) v:*,&,x*,x&,x$,$ ->l
 # -        <@> lineseq K ->-
-# o           <;> nextstate(B::Concise -254 Concise.pm:386) :*,&,{,x*,x&,x$,$ ->p
-# t           <1> entersub[t1] KRS*/TARG,STRICT ->u
-# p              <0> pushmark s ->q
-# q              <$> const[PV "warnings"] sM ->r
-# r              <$> const[PV "qw"] sM ->s
-# s              <.> method_named[PV "unimport"] ->t
+# l           <;> nextstate(B::Concise -1010 Concise.pm:303) :*,&,x*,x&,x$,$ ->m
+# q           <1> entersub[t1] KRS*/TARG,STRICT ->r
+# m              <0> pushmark s ->n
+# n              <$> const[PV "strict"] sM ->o
+# o              <$> const[PV "refs"] sM ->p
+# p              <.> method_named[PV "unimport"] ->q
 # BEGIN 4:
-# y  <1> leavesub[1 ref] K/REFC,1 ->(end)
-# -     <@> lineseq KP ->y
-# v        <;> nextstate(main 2 -e:1) v:>,<,%,{ ->w
-# x        <1> postinc[t3] sK/1 ->y
-# -           <1> ex-rv2sv sKRM/1 ->x
-# w              <#> gvsv[*beg] s ->x
+# 11 <1> leavesub[1 ref] K/REFC,1 ->(end)
+# -     <@> lineseq KP ->11
+# s        <;> nextstate(B::Concise -963 Concise.pm:368) v:*,&,{,x*,x&,x$,$ ->t
+# u        <1> require sK/1 ->v
+# t           <$> const[PV "strict.pm"] s/BARE ->u
+# -        <;> ex-nextstate(B::Concise -963 Concise.pm:368) v:*,&,{,x*,x&,x$,$ ->v
+# -        <@> lineseq K ->-
+# v           <;> nextstate(B::Concise -963 Concise.pm:368) :*,&,{,x*,x&,x$,$ ->w
+# 10          <1> entersub[t1] KRS*/TARG,STRICT ->11
+# w              <0> pushmark s ->x
+# x              <$> const[PV "strict"] sM ->y
+# y              <$> const[PV "refs"] sM ->z
+# z              <.> method_named[PV "unimport"] ->10
+# BEGIN 5:
+# 1b <1> leavesub[1 ref] K/REFC,1 ->(end)
+# -     <@> lineseq K ->1b
+# 12       <;> nextstate(B::Concise -938 Concise.pm:388) v:*,&,x*,x&,x$,$ ->13
+# 14       <1> require sK/1 ->15
+# 13          <$> const[PV "strict.pm"] s/BARE ->14
+# -        <;> ex-nextstate(B::Concise -938 Concise.pm:388) v:*,&,x*,x&,x$,$ ->15
+# -        <@> lineseq K ->-
+# 15          <;> nextstate(B::Concise -938 Concise.pm:388) :*,&,x*,x&,x$,$ ->16
+# 1a          <1> entersub[t1] KRS*/TARG,STRICT ->1b
+# 16             <0> pushmark s ->17
+# 17             <$> const[PV "strict"] sM ->18
+# 18             <$> const[PV "refs"] sM ->19
+# 19             <.> method_named[PV "unimport"] ->1a
+# BEGIN 6:
+# 1l <1> leavesub[1 ref] K/REFC,1 ->(end)
+# -     <@> lineseq KP ->1l
+# 1c       <;> nextstate(B::Concise -924 Concise.pm:408) v:*,&,{,x*,x&,x$,$ ->1d
+# 1e       <1> require sK/1 ->1f
+# 1d          <$> const[PV "warnings.pm"] s/BARE ->1e
+# -        <;> ex-nextstate(B::Concise -924 Concise.pm:408) v:*,&,{,x*,x&,x$,$ ->1f
+# -        <@> lineseq K ->-
+# 1f          <;> nextstate(B::Concise -924 Concise.pm:408) :*,&,{,x*,x&,x$,$ ->1g
+# 1k          <1> entersub[t1] KRS*/TARG,STRICT ->1l
+# 1g             <0> pushmark s ->1h
+# 1h             <$> const[PV "warnings"] sM ->1i
+# 1i             <$> const[PV "qw"] sM ->1j
+# 1j             <.> method_named[PV "unimport"] ->1k
+# BEGIN 7:
+# 1p <1> leavesub[1 ref] K/REFC,1 ->(end)
+# -     <@> lineseq KP ->1p
+# 1m       <;> nextstate(main 3 -e:1) v:{ ->1n
+# 1o       <1> postinc[t3] sK/1 ->1p
+# -           <1> ex-rv2sv sKRM/1 ->1o
+# 1n             <#> gvsv[*beg] s ->1o
 EOT_EOT
 # BEGIN 1:
-# a  <1> leavesub[1 ref] K/REFC,1 ->(end)
-# -     <@> lineseq KP ->a
-# 1        <;> nextstate(B::Concise -275 Concise.pm:356) v:*,&,{,x*,x&,x$,$ ->2
-# 3        <1> require sK/1 ->4
-# 2           <$> const(PV "strict.pm") s/BARE ->3
-# -        <;> ex-nextstate(B::Concise -837 Concise.pm:366) v:*,&,{,x*,x&,x$,$ ->4
-# -        <@> lineseq K ->-
-# 4           <;> nextstate(B::Concise -275 Concise.pm:356) :*,&,{,x*,x&,x$,$ ->5
-# 9           <1> entersub[t1] KRS*/TARG,STRICT ->a
-# 5              <0> pushmark s ->6
-# 6              <$> const(PV "strict") sM ->7
-# 7              <$> const(PV "refs") sM ->8
-# 8              <.> method_named(PV "unimport") ->9
+# 7  <1> leavesub[1 ref] K/REFC,1 ->(end)
+# -     <@> lineseq KP ->7
+# 1        <;> nextstate(B::Concise -1151 Concise.pm:116) v:*,&,{,x*,x&,x$,$ ->2
+# 6        <2> sassign sKS/2 ->7
+# 4           <1> srefgen sK/1 ->5
+# -              <1> ex-list lKRM ->4
+# 3                 <1> rv2gv sKRM/STRICT,1 ->4
+# 2                    <$> gv(*STDOUT) s ->3
+# -           <1> ex-rv2sv sKRM*/STRICT,1 ->6
+# 5              <$> gvsv(*B::Concise::walkHandle) s ->6
 # BEGIN 2:
-# k  <1> leavesub[1 ref] K/REFC,1 ->(end)
-# -     <@> lineseq K ->k
-# b        <;> nextstate(B::Concise -265 Concise.pm:367) v:*,&,x*,x&,x$,$ ->c
-# d        <1> require sK/1 ->e
-# c           <$> const(PV "strict.pm") s/BARE ->d
-# -        <;> ex-nextstate(B::Concise -812 Concise.pm:386) v:*,&,x*,x&,x$,$ ->e
+# h  <1> leavesub[1 ref] K/REFC,1 ->(end)
+# -     <@> lineseq K ->h
+# 8        <;> nextstate(B::Concise -1113 Concise.pm:181) v:*,&,x*,x&,x$,$ ->9
+# a        <1> require sK/1 ->b
+# 9           <$> const(PV "strict.pm") s/BARE ->a
+# -        <;> ex-nextstate(B::Concise -1113 Concise.pm:181) v:*,&,x*,x&,x$,$ ->b
 # -        <@> lineseq K ->-
-# e           <;> nextstate(B::Concise -265 Concise.pm:367) :*,&,x*,x&,x$,$ ->f
-# j           <1> entersub[t1] KRS*/TARG,STRICT ->k
-# f              <0> pushmark s ->g
-# g              <$> const(PV "strict") sM ->h
-# h              <$> const(PV "refs") sM ->i
-# i              <.> method_named(PV "unimport") ->j
+# b           <;> nextstate(B::Concise -1113 Concise.pm:181) :*,&,x*,x&,x$,$ ->c
+# g           <1> entersub[t1] KRS*/TARG,STRICT ->h
+# c              <0> pushmark s ->d
+# d              <$> const(PV "strict") sM ->e
+# e              <$> const(PV "refs") sM ->f
+# f              <.> method_named(PV "unimport") ->g
 # BEGIN 3:
-# u  <1> leavesub[1 ref] K/REFC,1 ->(end)
-# -     <@> lineseq KP ->u
-# l        <;> nextstate(B::Concise -254 Concise.pm:386) v:*,&,{,x*,x&,x$,$ ->m
-# n        <1> require sK/1 ->o
-# m           <$> const(PV "warnings.pm") s/BARE ->n
-# -        <;> ex-nextstate(B::Concise -798 Concise.pm:406) v:*,&,{,x*,x&,x$,$ ->o
+# r  <1> leavesub[1 ref] K/REFC,1 ->(end)
+# -     <@> lineseq K ->r
+# i        <;> nextstate(B::Concise -1010 Concise.pm:303) v:*,&,x*,x&,x$,$ ->j
+# k        <1> require sK/1 ->l
+# j           <$> const(PV "strict.pm") s/BARE ->k
+# -        <;> ex-nextstate(B::Concise -1010 Concise.pm:303) v:*,&,x*,x&,x$,$ ->l
 # -        <@> lineseq K ->-
-# o           <;> nextstate(B::Concise -254 Concise.pm:386) :*,&,{,x*,x&,x$,$ ->p
-# t           <1> entersub[t1] KRS*/TARG,STRICT ->u
-# p              <0> pushmark s ->q
-# q              <$> const(PV "warnings") sM ->r
-# r              <$> const(PV "qw") sM ->s
-# s              <.> method_named(PV "unimport") ->t
+# l           <;> nextstate(B::Concise -1010 Concise.pm:303) :*,&,x*,x&,x$,$ ->m
+# q           <1> entersub[t1] KRS*/TARG,STRICT ->r
+# m              <0> pushmark s ->n
+# n              <$> const(PV "strict") sM ->o
+# o              <$> const(PV "refs") sM ->p
+# p              <.> method_named(PV "unimport") ->q
 # BEGIN 4:
-# y  <1> leavesub[1 ref] K/REFC,1 ->(end)
-# -     <@> lineseq KP ->y
-# v        <;> nextstate(main 2 -e:1) v:>,<,%,{ ->w
-# x        <1> postinc[t2] sK/1 ->y
-# -           <1> ex-rv2sv sKRM/1 ->x
-# w              <$> gvsv(*beg) s ->x
+# 11 <1> leavesub[1 ref] K/REFC,1 ->(end)
+# -     <@> lineseq KP ->11
+# s        <;> nextstate(B::Concise -963 Concise.pm:368) v:*,&,{,x*,x&,x$,$ ->t
+# u        <1> require sK/1 ->v
+# t           <$> const(PV "strict.pm") s/BARE ->u
+# -        <;> ex-nextstate(B::Concise -963 Concise.pm:368) v:*,&,{,x*,x&,x$,$ ->v
+# -        <@> lineseq K ->-
+# v           <;> nextstate(B::Concise -963 Concise.pm:368) :*,&,{,x*,x&,x$,$ ->w
+# 10          <1> entersub[t1] KRS*/TARG,STRICT ->11
+# w              <0> pushmark s ->x
+# x              <$> const(PV "strict") sM ->y
+# y              <$> const(PV "refs") sM ->z
+# z              <.> method_named(PV "unimport") ->10
+# BEGIN 5:
+# 1b <1> leavesub[1 ref] K/REFC,1 ->(end)
+# -     <@> lineseq K ->1b
+# 12       <;> nextstate(B::Concise -938 Concise.pm:388) v:*,&,x*,x&,x$,$ ->13
+# 14       <1> require sK/1 ->15
+# 13          <$> const(PV "strict.pm") s/BARE ->14
+# -        <;> ex-nextstate(B::Concise -938 Concise.pm:388) v:*,&,x*,x&,x$,$ ->15
+# -        <@> lineseq K ->-
+# 15          <;> nextstate(B::Concise -938 Concise.pm:388) :*,&,x*,x&,x$,$ ->16
+# 1a          <1> entersub[t1] KRS*/TARG,STRICT ->1b
+# 16             <0> pushmark s ->17
+# 17             <$> const(PV "strict") sM ->18
+# 18             <$> const(PV "refs") sM ->19
+# 19             <.> method_named(PV "unimport") ->1a
+# BEGIN 6:
+# 1l <1> leavesub[1 ref] K/REFC,1 ->(end)
+# -     <@> lineseq KP ->1l
+# 1c       <;> nextstate(B::Concise -924 Concise.pm:408) v:*,&,{,x*,x&,x$,$ ->1d
+# 1e       <1> require sK/1 ->1f
+# 1d          <$> const(PV "warnings.pm") s/BARE ->1e
+# -        <;> ex-nextstate(B::Concise -924 Concise.pm:408) v:*,&,{,x*,x&,x$,$ ->1f
+# -        <@> lineseq K ->-
+# 1f          <;> nextstate(B::Concise -924 Concise.pm:408) :*,&,{,x*,x&,x$,$ ->1g
+# 1k          <1> entersub[t1] KRS*/TARG,STRICT ->1l
+# 1g             <0> pushmark s ->1h
+# 1h             <$> const(PV "warnings") sM ->1i
+# 1i             <$> const(PV "qw") sM ->1j
+# 1j             <.> method_named(PV "unimport") ->1k
+# BEGIN 7:
+# 1p <1> leavesub[1 ref] K/REFC,1 ->(end)
+# -     <@> lineseq KP ->1p
+# 1m       <;> nextstate(main 3 -e:1) v:{ ->1n
+# 1o       <1> postinc[t2] sK/1 ->1p
+# -           <1> ex-rv2sv sKRM/1 ->1o
+# 1n             <$> gvsv(*beg) s ->1o
 EONT_EONT
 
-
 checkOptree ( name	=> 'END',
 	      bcopts	=> 'END',
 	      prog	=> $src,
@@ -163,7 +238,6 @@ EOT_EOT
 # 2              <$> gvsv(*end) s ->3
 EONT_EONT
 
-
 checkOptree ( name	=> 'CHECK',
 	      bcopts	=> 'CHECK',
 	      prog	=> $src,
@@ -231,205 +305,321 @@ EOT_EOT
 # 2              <$> gvsv(*init) s ->3
 EONT_EONT
 
-
 checkOptree ( name	=> 'all of BEGIN END INIT CHECK UNITCHECK -exec',
 	      bcopts	=> [qw/ BEGIN END INIT CHECK UNITCHECK -exec /],
 	      prog	=> $src,
 	      strip_open_hints => 1,
 	      expect	=> <<'EOT_EOT', expect_nt => <<'EONT_EONT');
 # BEGIN 1:
-# 1  <;> nextstate(B::Concise -275 Concise.pm:356) v:*,&,{,x*,x&,x$,$
-# 2  <$> const[PV "strict.pm"] s/BARE
-# 3  <1> require sK/1
-# 4  <;> nextstate(B::Concise -275 Concise.pm:356) :*,&,{,x*,x&,x$,$
-# 5  <0> pushmark s
-# 6  <$> const[PV "strict"] sM
-# 7  <$> const[PV "refs"] sM
-# 8  <.> method_named[PV "unimport"] 
-# 9  <1> entersub[t1] KRS*/TARG,STRICT
-# a  <1> leavesub[1 ref] K/REFC,1
+# 1  <;> nextstate(B::Concise -1151 Concise.pm:116) v:*,&,{,x*,x&,x$,$
+# 2  <#> gv[*STDOUT] s
+# 3  <1> rv2gv sKRM/STRICT,1
+# 4  <1> srefgen sK/1
+# 5  <#> gvsv[*B::Concise::walkHandle] s
+# 6  <2> sassign sKS/2
+# 7  <1> leavesub[1 ref] K/REFC,1
 # BEGIN 2:
-# b  <;> nextstate(B::Concise -265 Concise.pm:367) v:*,&,x*,x&,x$,$
-# c  <$> const[PV "strict.pm"] s/BARE
-# d  <1> require sK/1
-# e  <;> nextstate(B::Concise -265 Concise.pm:367) :*,&,x*,x&,x$,$
-# f  <0> pushmark s
-# g  <$> const[PV "strict"] sM
-# h  <$> const[PV "refs"] sM
-# i  <.> method_named[PV "unimport"] 
-# j  <1> entersub[t1] KRS*/TARG,STRICT
-# k  <1> leavesub[1 ref] K/REFC,1
+# 8  <;> nextstate(B::Concise -1113 Concise.pm:181) v:*,&,x*,x&,x$,$
+# 9  <$> const[PV "strict.pm"] s/BARE
+# a  <1> require sK/1
+# b  <;> nextstate(B::Concise -1113 Concise.pm:181) :*,&,x*,x&,x$,$
+# c  <0> pushmark s
+# d  <$> const[PV "strict"] sM
+# e  <$> const[PV "refs"] sM
+# f  <.> method_named[PV "unimport"] 
+# g  <1> entersub[t1] KRS*/TARG,STRICT
+# h  <1> leavesub[1 ref] K/REFC,1
 # BEGIN 3:
-# l  <;> nextstate(B::Concise -254 Concise.pm:386) v:*,&,{,x*,x&,x$,$
-# m  <$> const[PV "warnings.pm"] s/BARE
-# n  <1> require sK/1
-# o  <;> nextstate(B::Concise -254 Concise.pm:386) :*,&,{,x*,x&,x$,$
-# p  <0> pushmark s
-# q  <$> const[PV "warnings"] sM
-# r  <$> const[PV "qw"] sM
-# s  <.> method_named[PV "unimport"] 
-# t  <1> entersub[t1] KRS*/TARG,STRICT
-# u  <1> leavesub[1 ref] K/REFC,1
+# i  <;> nextstate(B::Concise -1010 Concise.pm:303) v:*,&,x*,x&,x$,$
+# j  <$> const[PV "strict.pm"] s/BARE
+# k  <1> require sK/1
+# l  <;> nextstate(B::Concise -1010 Concise.pm:303) :*,&,x*,x&,x$,$
+# m  <0> pushmark s
+# n  <$> const[PV "strict"] sM
+# o  <$> const[PV "refs"] sM
+# p  <.> method_named[PV "unimport"] 
+# q  <1> entersub[t1] KRS*/TARG,STRICT
+# r  <1> leavesub[1 ref] K/REFC,1
 # BEGIN 4:
-# v  <;> nextstate(main 2 -e:1) v:>,<,%,{
-# w  <#> gvsv[*beg] s
-# x  <1> postinc[t3] sK/1
-# y  <1> leavesub[1 ref] K/REFC,1
+# s  <;> nextstate(B::Concise -963 Concise.pm:368) v:*,&,{,x*,x&,x$,$
+# t  <$> const[PV "strict.pm"] s/BARE
+# u  <1> require sK/1
+# v  <;> nextstate(B::Concise -963 Concise.pm:368) :*,&,{,x*,x&,x$,$
+# w  <0> pushmark s
+# x  <$> const[PV "strict"] sM
+# y  <$> const[PV "refs"] sM
+# z  <.> method_named[PV "unimport"] 
+# 10 <1> entersub[t1] KRS*/TARG,STRICT
+# 11 <1> leavesub[1 ref] K/REFC,1
+# BEGIN 5:
+# 12 <;> nextstate(B::Concise -938 Concise.pm:388) v:*,&,x*,x&,x$,$
+# 13 <$> const[PV "strict.pm"] s/BARE
+# 14 <1> require sK/1
+# 15 <;> nextstate(B::Concise -938 Concise.pm:388) :*,&,x*,x&,x$,$
+# 16 <0> pushmark s
+# 17 <$> const[PV "strict"] sM
+# 18 <$> const[PV "refs"] sM
+# 19 <.> method_named[PV "unimport"] 
+# 1a <1> entersub[t1] KRS*/TARG,STRICT
+# 1b <1> leavesub[1 ref] K/REFC,1
+# BEGIN 6:
+# 1c <;> nextstate(B::Concise -924 Concise.pm:408) v:*,&,{,x*,x&,x$,$
+# 1d <$> const[PV "warnings.pm"] s/BARE
+# 1e <1> require sK/1
+# 1f <;> nextstate(B::Concise -924 Concise.pm:408) :*,&,{,x*,x&,x$,$
+# 1g <0> pushmark s
+# 1h <$> const[PV "warnings"] sM
+# 1i <$> const[PV "qw"] sM
+# 1j <.> method_named[PV "unimport"] 
+# 1k <1> entersub[t1] KRS*/TARG,STRICT
+# 1l <1> leavesub[1 ref] K/REFC,1
+# BEGIN 7:
+# 1m <;> nextstate(main 3 -e:1) v:{
+# 1n <#> gvsv[*beg] s
+# 1o <1> postinc[t3] sK/1
+# 1p <1> leavesub[1 ref] K/REFC,1
 # END 1:
-# z  <;> nextstate(main 5 -e:1) v:>,<,%,{
-# 10 <#> gvsv[*end] s
-# 11 <1> postinc[t3] sK/1
-# 12 <1> leavesub[1 ref] K/REFC,1
+# 1q <;> nextstate(main 9 -e:1) v:{
+# 1r <#> gvsv[*end] s
+# 1s <1> postinc[t3] sK/1
+# 1t <1> leavesub[1 ref] K/REFC,1
 # INIT 1:
-# 13 <;> nextstate(main 4 -e:1) v:>,<,%,{
-# 14 <#> gvsv[*init] s
-# 15 <1> postinc[t3] sK/1
-# 16 <1> leavesub[1 ref] K/REFC,1
+# 1u <;> nextstate(main 7 -e:1) v:{
+# 1v <#> gvsv[*init] s
+# 1w <1> postinc[t3] sK/1
+# 1x <1> leavesub[1 ref] K/REFC,1
 # CHECK 1:
-# 17 <;> nextstate(main 3 -e:1) v:>,<,%,{
-# 18 <#> gvsv[*chk] s
-# 19 <1> postinc[t3] sK/1
-# 1a <1> leavesub[1 ref] K/REFC,1
+# 1y <;> nextstate(main 5 -e:1) v:{
+# 1z <#> gvsv[*chk] s
+# 20 <1> postinc[t3] sK/1
+# 21 <1> leavesub[1 ref] K/REFC,1
 # UNITCHECK 1:
-# 1b <;> nextstate(main 6 -e:1) v:>,<,%,{
-# 1c <#> gvsv[*uc] s
-# 1d <1> postinc[t3] sK/1
-# 1e <1> leavesub[1 ref] K/REFC,1
+# 22 <;> nextstate(main 11 -e:1) v:{
+# 23 <#> gvsv[*uc] s
+# 24 <1> postinc[t3] sK/1
+# 25 <1> leavesub[1 ref] K/REFC,1
 EOT_EOT
 # BEGIN 1:
-# 1  <;> nextstate(B::Concise -275 Concise.pm:356) v:*,&,{,x*,x&,x$,$
-# 2  <$> const(PV "strict.pm") s/BARE
-# 3  <1> require sK/1
-# 4  <;> nextstate(B::Concise -275 Concise.pm:356) :*,&,{,x*,x&,x$,$
-# 5  <0> pushmark s
-# 6  <$> const(PV "strict") sM
-# 7  <$> const(PV "refs") sM
-# 8  <.> method_named(PV "unimport") 
-# 9  <1> entersub[t1] KRS*/TARG,STRICT
-# a  <1> leavesub[1 ref] K/REFC,1
+# 1  <;> nextstate(B::Concise -1151 Concise.pm:116) v:*,&,{,x*,x&,x$,$
+# 2  <$> gv(*STDOUT) s
+# 3  <1> rv2gv sKRM/STRICT,1
+# 4  <1> srefgen sK/1
+# 5  <$> gvsv(*B::Concise::walkHandle) s
+# 6  <2> sassign sKS/2
+# 7  <1> leavesub[1 ref] K/REFC,1
 # BEGIN 2:
-# b  <;> nextstate(B::Concise -265 Concise.pm:367) v:*,&,x*,x&,x$,$
-# c  <$> const(PV "strict.pm") s/BARE
-# d  <1> require sK/1
-# e  <;> nextstate(B::Concise -265 Concise.pm:367) :*,&,x*,x&,x$,$
-# f  <0> pushmark s
-# g  <$> const(PV "strict") sM
-# h  <$> const(PV "refs") sM
-# i  <.> method_named(PV "unimport") 
-# j  <1> entersub[t1] KRS*/TARG,STRICT
-# k  <1> leavesub[1 ref] K/REFC,1
+# 8  <;> nextstate(B::Concise -1113 Concise.pm:181) v:*,&,x*,x&,x$,$
+# 9  <$> const(PV "strict.pm") s/BARE
+# a  <1> require sK/1
+# b  <;> nextstate(B::Concise -1113 Concise.pm:181) :*,&,x*,x&,x$,$
+# c  <0> pushmark s
+# d  <$> const(PV "strict") sM
+# e  <$> const(PV "refs") sM
+# f  <.> method_named(PV "unimport") 
+# g  <1> entersub[t1] KRS*/TARG,STRICT
+# h  <1> leavesub[1 ref] K/REFC,1
 # BEGIN 3:
-# l  <;> nextstate(B::Concise -254 Concise.pm:386) v:*,&,{,x*,x&,x$,$
-# m  <$> const(PV "warnings.pm") s/BARE
-# n  <1> require sK/1
-# o  <;> nextstate(B::Concise -254 Concise.pm:386) :*,&,{,x*,x&,x$,$
-# p  <0> pushmark s
-# q  <$> const(PV "warnings") sM
-# r  <$> const(PV "qw") sM
-# s  <.> method_named(PV "unimport") 
-# t  <1> entersub[t1] KRS*/TARG,STRICT
-# u  <1> leavesub[1 ref] K/REFC,1
+# i  <;> nextstate(B::Concise -1010 Concise.pm:303) v:*,&,x*,x&,x$,$
+# j  <$> const(PV "strict.pm") s/BARE
+# k  <1> require sK/1
+# l  <;> nextstate(B::Concise -1010 Concise.pm:303) :*,&,x*,x&,x$,$
+# m  <0> pushmark s
+# n  <$> const(PV "strict") sM
+# o  <$> const(PV "refs") sM
+# p  <.> method_named(PV "unimport") 
+# q  <1> entersub[t1] KRS*/TARG,STRICT
+# r  <1> leavesub[1 ref] K/REFC,1
 # BEGIN 4:
-# v  <;> nextstate(main 2 -e:1) v:>,<,%,{
-# w  <$> gvsv(*beg) s
-# x  <1> postinc[t2] sK/1
-# y  <1> leavesub[1 ref] K/REFC,1
+# s  <;> nextstate(B::Concise -963 Concise.pm:368) v:*,&,{,x*,x&,x$,$
+# t  <$> const(PV "strict.pm") s/BARE
+# u  <1> require sK/1
+# v  <;> nextstate(B::Concise -963 Concise.pm:368) :*,&,{,x*,x&,x$,$
+# w  <0> pushmark s
+# x  <$> const(PV "strict") sM
+# y  <$> const(PV "refs") sM
+# z  <.> method_named(PV "unimport") 
+# 10 <1> entersub[t1] KRS*/TARG,STRICT
+# 11 <1> leavesub[1 ref] K/REFC,1
+# BEGIN 5:
+# 12 <;> nextstate(B::Concise -938 Concise.pm:388) v:*,&,x*,x&,x$,$
+# 13 <$> const(PV "strict.pm") s/BARE
+# 14 <1> require sK/1
+# 15 <;> nextstate(B::Concise -938 Concise.pm:388) :*,&,x*,x&,x$,$
+# 16 <0> pushmark s
+# 17 <$> const(PV "strict") sM
+# 18 <$> const(PV "refs") sM
+# 19 <.> method_named(PV "unimport") 
+# 1a <1> entersub[t1] KRS*/TARG,STRICT
+# 1b <1> leavesub[1 ref] K/REFC,1
+# BEGIN 6:
+# 1c <;> nextstate(B::Concise -924 Concise.pm:408) v:*,&,{,x*,x&,x$,$
+# 1d <$> const(PV "warnings.pm") s/BARE
+# 1e <1> require sK/1
+# 1f <;> nextstate(B::Concise -924 Concise.pm:408) :*,&,{,x*,x&,x$,$
+# 1g <0> pushmark s
+# 1h <$> const(PV "warnings") sM
+# 1i <$> const(PV "qw") sM
+# 1j <.> method_named(PV "unimport") 
+# 1k <1> entersub[t1] KRS*/TARG,STRICT
+# 1l <1> leavesub[1 ref] K/REFC,1
+# BEGIN 7:
+# 1m <;> nextstate(main 3 -e:1) v:{
+# 1n <$> gvsv(*beg) s
+# 1o <1> postinc[t2] sK/1
+# 1p <1> leavesub[1 ref] K/REFC,1
 # END 1:
-# z  <;> nextstate(main 5 -e:1) v:>,<,%,{
-# 10 <$> gvsv(*end) s
-# 11 <1> postinc[t2] sK/1
-# 12 <1> leavesub[1 ref] K/REFC,1
+# 1q <;> nextstate(main 9 -e:1) v:{
+# 1r <$> gvsv(*end) s
+# 1s <1> postinc[t2] sK/1
+# 1t <1> leavesub[1 ref] K/REFC,1
 # INIT 1:
-# 13 <;> nextstate(main 4 -e:1) v:>,<,%,{
-# 14 <$> gvsv(*init) s
-# 15 <1> postinc[t2] sK/1
-# 16 <1> leavesub[1 ref] K/REFC,1
+# 1u <;> nextstate(main 7 -e:1) v:{
+# 1v <$> gvsv(*init) s
+# 1w <1> postinc[t2] sK/1
+# 1x <1> leavesub[1 ref] K/REFC,1
 # CHECK 1:
-# 17 <;> nextstate(main 3 -e:1) v:>,<,%,{
-# 18 <$> gvsv(*chk) s
-# 19 <1> postinc[t2] sK/1
-# 1a <1> leavesub[1 ref] K/REFC,1
+# 1y <;> nextstate(main 5 -e:1) v:{
+# 1z <$> gvsv(*chk) s
+# 20 <1> postinc[t2] sK/1
+# 21 <1> leavesub[1 ref] K/REFC,1
 # UNITCHECK 1:
-# 1b <;> nextstate(main 6 -e:1) v:>,<,%,{
-# 1c <$> gvsv(*uc) s
-# 1d <1> postinc[t2] sK/1
-# 1e <1> leavesub[1 ref] K/REFC,1
+# 22 <;> nextstate(main 11 -e:1) v:{
+# 23 <$> gvsv(*uc) s
+# 24 <1> postinc[t2] sK/1
+# 25 <1> leavesub[1 ref] K/REFC,1
 EONT_EONT
 
-
 # perl "-I../lib" -MO=Concise,BEGIN,CHECK,INIT,END,-exec -e '$a=$b && print q/foo/'
 
-
-
 checkOptree ( name	=> 'regression test for patch 25352',
 	      bcopts	=> [qw/ BEGIN END INIT CHECK -exec /],
 	      prog	=> 'print q/foo/',
 	      expect	=> <<'EOT_EOT', expect_nt => <<'EONT_EONT');
 # BEGIN 1:
 # 1  <;> nextstate(B::Concise -275 Concise.pm:356) v:*,&,{,x*,x&,x$,$
-# 2  <$> const[PV "strict.pm"] s/BARE
-# 3  <1> require sK/1
-# 4  <;> nextstate(B::Concise -275 Concise.pm:356) :*,&,{,x*,x&,x$,$
-# 5  <0> pushmark s
-# 6  <$> const[PV "strict"] sM
-# 7  <$> const[PV "refs"] sM
-# 8  <.> method_named[PV "unimport"] 
-# 9  <1> entersub[t1] KRS*/TARG,STRICT
-# a  <1> leavesub[1 ref] K/REFC,1
+# 2  <#> gv[*STDOUT] s
+# 3  <1> rv2gv sKRM/STRICT,1
+# 4  <1> srefgen sK/1
+# 5  <#> gvsv[*B::Concise::walkHandle] s
+# 6  <2> sassign sKS/2
+# 7  <1> leavesub[1 ref] K/REFC,1
 # BEGIN 2:
-# b  <;> nextstate(B::Concise -265 Concise.pm:367) v:*,&,x*,x&,x$,$
-# c  <$> const[PV "strict.pm"] s/BARE
-# d  <1> require sK/1
-# e  <;> nextstate(B::Concise -265 Concise.pm:367) :*,&,x*,x&,x$,$
-# f  <0> pushmark s
-# g  <$> const[PV "strict"] sM
-# h  <$> const[PV "refs"] sM
-# i  <.> method_named[PV "unimport"] 
-# j  <1> entersub[t1] KRS*/TARG,STRICT
-# k  <1> leavesub[1 ref] K/REFC,1
+# 8  <;> nextstate(B::Concise -1113 Concise.pm:181) v:*,&,x*,x&,x$,$
+# 9  <$> const[PV "strict.pm"] s/BARE
+# a  <1> require sK/1
+# b  <;> nextstate(B::Concise -1113 Concise.pm:181) :*,&,x*,x&,x$,$
+# c  <0> pushmark s
+# d  <$> const[PV "strict"] sM
+# e  <$> const[PV "refs"] sM
+# f  <.> method_named[PV "unimport"] 
+# g  <1> entersub[t1] KRS*/TARG,STRICT
+# h  <1> leavesub[1 ref] K/REFC,1
 # BEGIN 3:
-# l  <;> nextstate(B::Concise -254 Concise.pm:386) v:*,&,{,x*,x&,x$,$
-# m  <$> const[PV "warnings.pm"] s/BARE
-# n  <1> require sK/1
-# o  <;> nextstate(B::Concise -254 Concise.pm:386) :*,&,{,x*,x&,x$,$
-# p  <0> pushmark s
-# q  <$> const[PV "warnings"] sM
-# r  <$> const[PV "qw"] sM
-# s  <.> method_named[PV "unimport"] 
-# t  <1> entersub[t1] KRS*/TARG,STRICT
-# u  <1> leavesub[1 ref] K/REFC,1
+# i  <;> nextstate(B::Concise -1010 Concise.pm:303) v:*,&,x*,x&,x$,$
+# j  <$> const[PV "strict.pm"] s/BARE
+# k  <1> require sK/1
+# l  <;> nextstate(B::Concise -1010 Concise.pm:303) :*,&,x*,x&,x$,$
+# m  <0> pushmark s
+# n  <$> const[PV "strict"] sM
+# o  <$> const[PV "refs"] sM
+# p  <.> method_named[PV "unimport"] 
+# q  <1> entersub[t1] KRS*/TARG,STRICT
+# r  <1> leavesub[1 ref] K/REFC,1
+# BEGIN 4:
+# s  <;> nextstate(B::Concise -963 Concise.pm:368) v:*,&,{,x*,x&,x$,$
+# t  <$> const[PV "strict.pm"] s/BARE
+# u  <1> require sK/1
+# v  <;> nextstate(B::Concise -963 Concise.pm:368) :*,&,{,x*,x&,x$,$
+# w  <0> pushmark s
+# x  <$> const[PV "strict"] sM
+# y  <$> const[PV "refs"] sM
+# z  <.> method_named[PV "unimport"] 
+# 10 <1> entersub[t1] KRS*/TARG,STRICT
+# 11 <1> leavesub[1 ref] K/REFC,1
+# BEGIN 5:
+# 12 <;> nextstate(B::Concise -938 Concise.pm:388) v:*,&,x*,x&,x$,$
+# 13 <$> const[PV "strict.pm"] s/BARE
+# 14 <1> require sK/1
+# 15 <;> nextstate(B::Concise -938 Concise.pm:388) :*,&,x*,x&,x$,$
+# 16 <0> pushmark s
+# 17 <$> const[PV "strict"] sM
+# 18 <$> const[PV "refs"] sM
+# 19 <.> method_named[PV "unimport"] 
+# 1a <1> entersub[t1] KRS*/TARG,STRICT
+# 1b <1> leavesub[1 ref] K/REFC,1
+# BEGIN 6:
+# 1c <;> nextstate(B::Concise -924 Concise.pm:408) v:*,&,{,x*,x&,x$,$
+# 1d <$> const[PV "warnings.pm"] s/BARE
+# 1e <1> require sK/1
+# 1f <;> nextstate(B::Concise -924 Concise.pm:408) :*,&,{,x*,x&,x$,$
+# 1g <0> pushmark s
+# 1h <$> const[PV "warnings"] sM
+# 1i <$> const[PV "qw"] sM
+# 1j <.> method_named[PV "unimport"] 
+# 1k <1> entersub[t1] KRS*/TARG,STRICT
+# 1l <1> leavesub[1 ref] K/REFC,1
 EOT_EOT
 # BEGIN 1:
-# 1  <;> nextstate(B::Concise -275 Concise.pm:356) v:*,&,{,x*,x&,x$,$
-# 2  <$> const(PV "strict.pm") s/BARE
-# 3  <1> require sK/1
-# 4  <;> nextstate(B::Concise -275 Concise.pm:356) :*,&,{,x*,x&,x$,$
-# 5  <0> pushmark s
-# 6  <$> const(PV "strict") sM
-# 7  <$> const(PV "refs") sM
-# 8  <.> method_named(PV "unimport") 
-# 9  <1> entersub[t1] KRS*/TARG,STRICT
-# a  <1> leavesub[1 ref] K/REFC,1
+# 1  <;> nextstate(B::Concise -1151 Concise.pm:116) v:*,&,{,x*,x&,x$,$
+# 2  <$> gv(*STDOUT) s
+# 3  <1> rv2gv sKRM/STRICT,1
+# 4  <1> srefgen sK/1
+# 5  <$> gvsv(*B::Concise::walkHandle) s
+# 6  <2> sassign sKS/2
+# 7  <1> leavesub[1 ref] K/REFC,1
 # BEGIN 2:
-# b  <;> nextstate(B::Concise -265 Concise.pm:367) v:*,&,x*,x&,x$,$
-# c  <$> const(PV "strict.pm") s/BARE
-# d  <1> require sK/1
-# e  <;> nextstate(B::Concise -265 Concise.pm:367) :*,&,x*,x&,x$,$
-# f  <0> pushmark s
-# g  <$> const(PV "strict") sM
-# h  <$> const(PV "refs") sM
-# i  <.> method_named(PV "unimport") 
-# j  <1> entersub[t1] KRS*/TARG,STRICT
-# k  <1> leavesub[1 ref] K/REFC,1
+# 8  <;> nextstate(B::Concise -1113 Concise.pm:181) v:*,&,x*,x&,x$,$
+# 9  <$> const(PV "strict.pm") s/BARE
+# a  <1> require sK/1
+# b  <;> nextstate(B::Concise -1113 Concise.pm:181) :*,&,x*,x&,x$,$
+# c  <0> pushmark s
+# d  <$> const(PV "strict") sM
+# e  <$> const(PV "refs") sM
+# f  <.> method_named(PV "unimport") 
+# g  <1> entersub[t1] KRS*/TARG,STRICT
+# h  <1> leavesub[1 ref] K/REFC,1
 # BEGIN 3:
-# l  <;> nextstate(B::Concise -254 Concise.pm:386) v:*,&,{,x*,x&,x$,$
-# m  <$> const(PV "warnings.pm") s/BARE
-# n  <1> require sK/1
-# o  <;> nextstate(B::Concise -254 Concise.pm:386) :*,&,{,x*,x&,x$,$
-# p  <0> pushmark s
-# q  <$> const(PV "warnings") sM
-# r  <$> const(PV "qw") sM
-# s  <.> method_named(PV "unimport") 
-# t  <1> entersub[t1] KRS*/TARG,STRICT
-# u  <1> leavesub[1 ref] K/REFC,1
+# i  <;> nextstate(B::Concise -1010 Concise.pm:303) v:*,&,x*,x&,x$,$
+# j  <$> const(PV "strict.pm") s/BARE
+# k  <1> require sK/1
+# l  <;> nextstate(B::Concise -1010 Concise.pm:303) :*,&,x*,x&,x$,$
+# m  <0> pushmark s
+# n  <$> const(PV "strict") sM
+# o  <$> const(PV "refs") sM
+# p  <.> method_named(PV "unimport") 
+# q  <1> entersub[t1] KRS*/TARG,STRICT
+# r  <1> leavesub[1 ref] K/REFC,1
+# BEGIN 4:
+# s  <;> nextstate(B::Concise -963 Concise.pm:368) v:*,&,{,x*,x&,x$,$
+# t  <$> const(PV "strict.pm") s/BARE
+# u  <1> require sK/1
+# v  <;> nextstate(B::Concise -963 Concise.pm:368) :*,&,{,x*,x&,x$,$
+# w  <0> pushmark s
+# x  <$> const(PV "strict") sM
+# y  <$> const(PV "refs") sM
+# z  <.> method_named(PV "unimport") 
+# 10 <1> entersub[t1] KRS*/TARG,STRICT
+# 11 <1> leavesub[1 ref] K/REFC,1
+# BEGIN 5:
+# 12 <;> nextstate(B::Concise -938 Concise.pm:388) v:*,&,x*,x&,x$,$
+# 13 <$> const(PV "strict.pm") s/BARE
+# 14 <1> require sK/1
+# 15 <;> nextstate(B::Concise -938 Concise.pm:388) :*,&,x*,x&,x$,$
+# 16 <0> pushmark s
+# 17 <$> const(PV "strict") sM
+# 18 <$> const(PV "refs") sM
+# 19 <.> method_named(PV "unimport") 
+# 1a <1> entersub[t1] KRS*/TARG,STRICT
+# 1b <1> leavesub[1 ref] K/REFC,1
+# BEGIN 6:
+# 1c <;> nextstate(B::Concise -924 Concise.pm:408) v:*,&,{,x*,x&,x$,$
+# 1d <$> const(PV "warnings.pm") s/BARE
+# 1e <1> require sK/1
+# 1f <;> nextstate(B::Concise -924 Concise.pm:408) :*,&,{,x*,x&,x$,$
+# 1g <0> pushmark s
+# 1h <$> const(PV "warnings") sM
+# 1i <$> const(PV "qw") sM
+# 1j <.> method_named(PV "unimport") 
+# 1k <1> entersub[t1] KRS*/TARG,STRICT
+# 1l <1> leavesub[1 ref] K/REFC,1
 EONT_EONT
-- 
2.10.2

@p5pRT
Copy link
Author

p5pRT commented Nov 13, 2016

The RT System itself - Status changed from 'new' to 'open'

@p5pRT
Copy link
Author

p5pRT commented Jun 5, 2017

From @iabyn

On Sun, Nov 13, 2016 at 09​:00​:33AM -0800, Todd Rinaldo wrote​:

While working with B​::C, it is impossible to tell what modules are
loaded by the program or by O/B. As a result, it's ideal if B/O do not
load modules if they can help it. I'm submitting a proposed patch to
address this.

Sorry, this seems to have gotten overlooked, and no longer cleanly
applies.

I'm happy with the patch, except for removing strict from B.pm.
If you really, really need to avoid loading strict.pm, then perhaps
replace

  use strict;

with something like

  BEGIN { $^H = 0x6e2 };

Then have a test somewhere which asserts somehow that the values of
%bitmask and %explicit_bitmask in strict.pm 'or' to 0x6e2.

--
In economics, the exam questions are the same every year.
They just change the answers.

@p5pRT
Copy link
Author

p5pRT commented Jun 10, 2017

From @toddr

On Mon, 05 Jun 2017 09​:12​:57 -0700, davem wrote​:

I'm happy with the patch, except for removing strict from B.pm.
If you really, really need to avoid loading strict.pm, then perhaps
replace

use strict;

with something like

BEGIN \{ $^H = 0x6e2 \};

Then have a test somewhere which asserts somehow that the values of
%bitmask and %explicit_bitmask in strict.pm 'or' to 0x6e2.

Thanks, I'll update and re-submit the patch soon.

@p5pRT
Copy link
Author

p5pRT commented Sep 13, 2017

From @toddr

Sorry, this seems to have gotten overlooked, and no longer cleanly
applies.

I'm happy with the patch, except for removing strict from B.pm.
If you really, really need to avoid loading strict.pm, then perhaps
replace

use strict;

with something like

BEGIN \{ $^H = 0x6e2 \};

Then have a test somewhere which asserts somehow that the values of
%bitmask and %explicit_bitmask in strict.pm 'or' to 0x6e2.

Dave,

How about a unit test instead to assure both warnings and strict are met? I had to do some fixups to meet that requirement.

See attached patches.

If this doesn't meet all of your needs, then I have concerns about your $^H value. I'm getting this?

$>perl -e'BEGIN {use strict; use warnings; print $^H . "\n"}'
256

Todd

@p5pRT
Copy link
Author

p5pRT commented Sep 13, 2017

From @toddr

0001-Remove-unnecessary-module-loads-from-B-and-O.patch
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Todd Rinaldo <toddr@cpan.org>
Date: Wed, 13 Sep 2017 14:35:21 -0500
Subject: [PATCH 1/4] Remove unnecessary module loads from B and O

This commit removes multiple unnecessary modules so that
perl -MO= can hand back to compile as cleanly as possible.

This change caused significant jitter in tests for B::Concise. While updating
the test to the new reality, OptreeCheck.pm was corrected to stop stripping
regexes off $got when it started failing so it would be easier to see where
the failure happened.
---
 ext/B/B.pm                |   9 +-
 ext/B/O.pm                |  11 +-
 ext/B/t/OptreeCheck.pm    |   3 +-
 ext/B/t/optree_specials.t | 694 +++++++++++++++++++++++++++++-----------------
 4 files changed, 457 insertions(+), 260 deletions(-)

diff --git a/ext/B/B.pm b/ext/B/B.pm
index daa576435e..47c43536dc 100644
--- a/ext/B/B.pm
+++ b/ext/B/B.pm
@@ -6,11 +6,16 @@
 #      License or the Artistic License, as specified in the README file.
 #
 package B;
-use strict;
 
-require Exporter;
 @B::ISA = qw(Exporter);
 
+# If B is loaded without imports, we do not want to unnecessarily pollute the stash with Exporter.
+sub import {
+    return unless scalar @_ > 1; # Called as a method call.
+    require Exporter;
+    B->export_to_level(1, @_);
+}
+
 # walkoptree_slow comes from B.pm (you are there),
 # walkoptree comes from B.xs
 
diff --git a/ext/B/O.pm b/ext/B/O.pm
index 94ee754293..7393441b05 100644
--- a/ext/B/O.pm
+++ b/ext/B/O.pm
@@ -2,8 +2,7 @@ package O;
 
 our $VERSION = '1.02';
 
-use B qw(minus_c save_BEGINs);
-use Carp;
+use B ();
 
 sub import {
     my ($class, @options) = @_;
@@ -21,8 +20,8 @@ sub import {
     my $backend = shift (@options);
     eval q[
 	BEGIN {
-	    minus_c;
-	    save_BEGINs;
+	    B::minus_c;
+	    B::save_BEGINs;
 	}
 
 	CHECK {
@@ -51,7 +50,9 @@ sub import {
 	}
     ];
     if ($@) {
-        croak "Loading compiler backend 'B::$backend' failed: $@";
+        my $msg = "$@";
+        require Carp;
+        Carp::croak("Loading compiler backend 'B::$backend' failed: $msg");
     }
 }
 
diff --git a/ext/B/t/OptreeCheck.pm b/ext/B/t/OptreeCheck.pm
index e7af99ece1..34d01e1532 100644
--- a/ext/B/t/OptreeCheck.pm
+++ b/ext/B/t/OptreeCheck.pm
@@ -781,8 +781,9 @@ sub reduceDiffs {
         my $exp = shift @want;
         my $line = shift @got;
         # remove matches, and report
-        unless ($got =~ s/($rex\n)//msg) {
+        unless ($got =~ s/^($rex\n)//ms) {
             _diag("got:\t\t'$line'\nwant:\t $rex\n");
+            last;
         }
     }
     _diag("remainder:\n$got");
diff --git a/ext/B/t/optree_specials.t b/ext/B/t/optree_specials.t
index 83ea44e52d..3f575d51bb 100644
--- a/ext/B/t/optree_specials.t
+++ b/ext/B/t/optree_specials.t
@@ -39,108 +39,183 @@ checkOptree ( name	=> 'BEGIN',
 	      prog	=> $src,
 	      strip_open_hints => 1,
 	      expect	=> <<'EOT_EOT', expect_nt => <<'EONT_EONT');
-# BEGIN 1:
-# a  <1> leavesub[1 ref] K/REFC,1 ->(end)
-# -     <@> lineseq KP ->a
-# 1        <;> nextstate(B::Concise -275 Concise.pm:356) v:*,&,{,x*,x&,x$,$ ->2
-# 3        <1> require sK/1 ->4
-# 2           <$> const[PV "strict.pm"] s/BARE ->3
-# -        <;> ex-nextstate(B::Concise -837 Concise.pm:366) v:*,&,{,x*,x&,x$,$ ->4
-# -        <@> lineseq K ->-
-# 4           <;> nextstate(B::Concise -275 Concise.pm:356) :*,&,{,x*,x&,x$,$ ->5
-# 9           <1> entersub[t1] KRS*/TARG,STRICT ->a
-# 5              <0> pushmark s ->6
-# 6              <$> const[PV "strict"] sM ->7
-# 7              <$> const[PV "refs"] sM ->8
-# 8              <.> method_named[PV "unimport"] ->9
+# -     <@> lineseq KP ->7
+# 1        <;> nextstate(B::Concise -1151 Concise.pm:116) v:*,&,{,x*,x&,x$,$ ->2
+# 6        <2> sassign sKS/2 ->7
+# 4           <1> srefgen sK/1 ->5
+# -              <1> ex-list lKRM ->4
+# 3                 <1> rv2gv sKRM/STRICT,1 ->4
+# 2                    <#> gv[*STDOUT] s ->3
+# -           <1> ex-rv2sv sKRM*/STRICT,1 ->6
+# 5              <#> gvsv[*B::Concise::walkHandle] s ->6
 # BEGIN 2:
-# k  <1> leavesub[1 ref] K/REFC,1 ->(end)
-# -     <@> lineseq K ->k
-# b        <;> nextstate(B::Concise -265 Concise.pm:367) v:*,&,x*,x&,x$,$ ->c
-# d        <1> require sK/1 ->e
-# c           <$> const[PV "strict.pm"] s/BARE ->d
-# -        <;> ex-nextstate(B::Concise -812 Concise.pm:386) v:*,&,x*,x&,x$,$ ->e
+# h  <1> leavesub[1 ref] K/REFC,1 ->(end)
+# -     <@> lineseq K ->h
+# 8        <;> nextstate(B::Concise -1113 Concise.pm:181) v:*,&,x*,x&,x$,$ ->9
+# a        <1> require sK/1 ->b
+# 9           <$> const[PV "strict.pm"] s/BARE ->a
+# -        <;> ex-nextstate(B::Concise -1113 Concise.pm:181) v:*,&,x*,x&,x$,$ ->b
 # -        <@> lineseq K ->-
-# e           <;> nextstate(B::Concise -265 Concise.pm:367) :*,&,x*,x&,x$,$ ->f
-# j           <1> entersub[t1] KRS*/TARG,STRICT ->k
-# f              <0> pushmark s ->g
-# g              <$> const[PV "strict"] sM ->h
-# h              <$> const[PV "refs"] sM ->i
-# i              <.> method_named[PV "unimport"] ->j
+# b           <;> nextstate(B::Concise -1113 Concise.pm:181) :*,&,x*,x&,x$,$ ->c
+# g           <1> entersub[t1] KRS*/TARG,STRICT ->h
+# c              <0> pushmark s ->d
+# d              <$> const[PV "strict"] sM ->e
+# e              <$> const[PV "refs"] sM ->f
+# f              <.> method_named[PV "unimport"] ->g
 # BEGIN 3:
-# u  <1> leavesub[1 ref] K/REFC,1 ->(end)
-# -     <@> lineseq KP ->u
-# l        <;> nextstate(B::Concise -254 Concise.pm:386) v:*,&,{,x*,x&,x$,$ ->m
-# n        <1> require sK/1 ->o
-# m           <$> const[PV "warnings.pm"] s/BARE ->n
-# -        <;> ex-nextstate(B::Concise -798 Concise.pm:406) v:*,&,{,x*,x&,x$,$ ->o
+# r  <1> leavesub[1 ref] K/REFC,1 ->(end)
+# -     <@> lineseq K ->r
+# i        <;> nextstate(B::Concise -1010 Concise.pm:303) v:*,&,x*,x&,x$,$ ->j
+# k        <1> require sK/1 ->l
+# j           <$> const[PV "strict.pm"] s/BARE ->k
+# -        <;> ex-nextstate(B::Concise -1010 Concise.pm:303) v:*,&,x*,x&,x$,$ ->l
 # -        <@> lineseq K ->-
-# o           <;> nextstate(B::Concise -254 Concise.pm:386) :*,&,{,x*,x&,x$,$ ->p
-# t           <1> entersub[t1] KRS*/TARG,STRICT ->u
-# p              <0> pushmark s ->q
-# q              <$> const[PV "warnings"] sM ->r
-# r              <$> const[PV "qw"] sM ->s
-# s              <.> method_named[PV "unimport"] ->t
+# l           <;> nextstate(B::Concise -1010 Concise.pm:303) :*,&,x*,x&,x$,$ ->m
+# q           <1> entersub[t1] KRS*/TARG,STRICT ->r
+# m              <0> pushmark s ->n
+# n              <$> const[PV "strict"] sM ->o
+# o              <$> const[PV "refs"] sM ->p
+# p              <.> method_named[PV "unimport"] ->q
 # BEGIN 4:
-# y  <1> leavesub[1 ref] K/REFC,1 ->(end)
-# -     <@> lineseq KP ->y
-# v        <;> nextstate(main 2 -e:1) v:>,<,%,{ ->w
-# x        <1> postinc[t3] sK/1 ->y
-# -           <1> ex-rv2sv sKRM/1 ->x
-# w              <#> gvsv[*beg] s ->x
+# 11 <1> leavesub[1 ref] K/REFC,1 ->(end)
+# -     <@> lineseq KP ->11
+# s        <;> nextstate(B::Concise -963 Concise.pm:368) v:*,&,{,x*,x&,x$,$ ->t
+# u        <1> require sK/1 ->v
+# t           <$> const[PV "strict.pm"] s/BARE ->u
+# -        <;> ex-nextstate(B::Concise -963 Concise.pm:368) v:*,&,{,x*,x&,x$,$ ->v
+# -        <@> lineseq K ->-
+# v           <;> nextstate(B::Concise -963 Concise.pm:368) :*,&,{,x*,x&,x$,$ ->w
+# 10          <1> entersub[t1] KRS*/TARG,STRICT ->11
+# w              <0> pushmark s ->x
+# x              <$> const[PV "strict"] sM ->y
+# y              <$> const[PV "refs"] sM ->z
+# z              <.> method_named[PV "unimport"] ->10
+# BEGIN 5:
+# 1b <1> leavesub[1 ref] K/REFC,1 ->(end)
+# -     <@> lineseq K ->1b
+# 12       <;> nextstate(B::Concise -938 Concise.pm:388) v:*,&,x*,x&,x$,$ ->13
+# 14       <1> require sK/1 ->15
+# 13          <$> const[PV "strict.pm"] s/BARE ->14
+# -        <;> ex-nextstate(B::Concise -938 Concise.pm:388) v:*,&,x*,x&,x$,$ ->15
+# -        <@> lineseq K ->-
+# 15          <;> nextstate(B::Concise -938 Concise.pm:388) :*,&,x*,x&,x$,$ ->16
+# 1a          <1> entersub[t1] KRS*/TARG,STRICT ->1b
+# 16             <0> pushmark s ->17
+# 17             <$> const[PV "strict"] sM ->18
+# 18             <$> const[PV "refs"] sM ->19
+# 19             <.> method_named[PV "unimport"] ->1a
+# BEGIN 6:
+# 1l <1> leavesub[1 ref] K/REFC,1 ->(end)
+# -     <@> lineseq KP ->1l
+# 1c       <;> nextstate(B::Concise -924 Concise.pm:408) v:*,&,{,x*,x&,x$,$ ->1d
+# 1e       <1> require sK/1 ->1f
+# 1d          <$> const[PV "warnings.pm"] s/BARE ->1e
+# -        <;> ex-nextstate(B::Concise -924 Concise.pm:408) v:*,&,{,x*,x&,x$,$ ->1f
+# -        <@> lineseq K ->-
+# 1f          <;> nextstate(B::Concise -924 Concise.pm:408) :*,&,{,x*,x&,x$,$ ->1g
+# 1k          <1> entersub[t1] KRS*/TARG,STRICT ->1l
+# 1g             <0> pushmark s ->1h
+# 1h             <$> const[PV "warnings"] sM ->1i
+# 1i             <$> const[PV "qw"] sM ->1j
+# 1j             <.> method_named[PV "unimport"] ->1k
+# BEGIN 7:
+# 1p <1> leavesub[1 ref] K/REFC,1 ->(end)
+# -     <@> lineseq KP ->1p
+# 1m       <;> nextstate(main 3 -e:1) v:{ ->1n
+# 1o       <1> postinc[t3] sK/1 ->1p
+# -           <1> ex-rv2sv sKRM/1 ->1o
+# 1n             <#> gvsv[*beg] s ->1o
 EOT_EOT
 # BEGIN 1:
-# a  <1> leavesub[1 ref] K/REFC,1 ->(end)
-# -     <@> lineseq KP ->a
-# 1        <;> nextstate(B::Concise -275 Concise.pm:356) v:*,&,{,x*,x&,x$,$ ->2
-# 3        <1> require sK/1 ->4
-# 2           <$> const(PV "strict.pm") s/BARE ->3
-# -        <;> ex-nextstate(B::Concise -837 Concise.pm:366) v:*,&,{,x*,x&,x$,$ ->4
-# -        <@> lineseq K ->-
-# 4           <;> nextstate(B::Concise -275 Concise.pm:356) :*,&,{,x*,x&,x$,$ ->5
-# 9           <1> entersub[t1] KRS*/TARG,STRICT ->a
-# 5              <0> pushmark s ->6
-# 6              <$> const(PV "strict") sM ->7
-# 7              <$> const(PV "refs") sM ->8
-# 8              <.> method_named(PV "unimport") ->9
+# 7  <1> leavesub[1 ref] K/REFC,1 ->(end)
+# -     <@> lineseq KP ->7
+# 1        <;> nextstate(B::Concise -1151 Concise.pm:116) v:*,&,{,x*,x&,x$,$ ->2
+# 6        <2> sassign sKS/2 ->7
+# 4           <1> srefgen sK/1 ->5
+# -              <1> ex-list lKRM ->4
+# 3                 <1> rv2gv sKRM/STRICT,1 ->4
+# 2                    <$> gv(*STDOUT) s ->3
+# -           <1> ex-rv2sv sKRM*/STRICT,1 ->6
+# 5              <$> gvsv(*B::Concise::walkHandle) s ->6
 # BEGIN 2:
-# k  <1> leavesub[1 ref] K/REFC,1 ->(end)
-# -     <@> lineseq K ->k
-# b        <;> nextstate(B::Concise -265 Concise.pm:367) v:*,&,x*,x&,x$,$ ->c
-# d        <1> require sK/1 ->e
-# c           <$> const(PV "strict.pm") s/BARE ->d
-# -        <;> ex-nextstate(B::Concise -812 Concise.pm:386) v:*,&,x*,x&,x$,$ ->e
+# h  <1> leavesub[1 ref] K/REFC,1 ->(end)
+# -     <@> lineseq K ->h
+# 8        <;> nextstate(B::Concise -1113 Concise.pm:181) v:*,&,x*,x&,x$,$ ->9
+# a        <1> require sK/1 ->b
+# 9           <$> const(PV "strict.pm") s/BARE ->a
+# -        <;> ex-nextstate(B::Concise -1113 Concise.pm:181) v:*,&,x*,x&,x$,$ ->b
 # -        <@> lineseq K ->-
-# e           <;> nextstate(B::Concise -265 Concise.pm:367) :*,&,x*,x&,x$,$ ->f
-# j           <1> entersub[t1] KRS*/TARG,STRICT ->k
-# f              <0> pushmark s ->g
-# g              <$> const(PV "strict") sM ->h
-# h              <$> const(PV "refs") sM ->i
-# i              <.> method_named(PV "unimport") ->j
+# b           <;> nextstate(B::Concise -1113 Concise.pm:181) :*,&,x*,x&,x$,$ ->c
+# g           <1> entersub[t1] KRS*/TARG,STRICT ->h
+# c              <0> pushmark s ->d
+# d              <$> const(PV "strict") sM ->e
+# e              <$> const(PV "refs") sM ->f
+# f              <.> method_named(PV "unimport") ->g
 # BEGIN 3:
-# u  <1> leavesub[1 ref] K/REFC,1 ->(end)
-# -     <@> lineseq KP ->u
-# l        <;> nextstate(B::Concise -254 Concise.pm:386) v:*,&,{,x*,x&,x$,$ ->m
-# n        <1> require sK/1 ->o
-# m           <$> const(PV "warnings.pm") s/BARE ->n
-# -        <;> ex-nextstate(B::Concise -798 Concise.pm:406) v:*,&,{,x*,x&,x$,$ ->o
+# r  <1> leavesub[1 ref] K/REFC,1 ->(end)
+# -     <@> lineseq K ->r
+# i        <;> nextstate(B::Concise -1010 Concise.pm:303) v:*,&,x*,x&,x$,$ ->j
+# k        <1> require sK/1 ->l
+# j           <$> const(PV "strict.pm") s/BARE ->k
+# -        <;> ex-nextstate(B::Concise -1010 Concise.pm:303) v:*,&,x*,x&,x$,$ ->l
 # -        <@> lineseq K ->-
-# o           <;> nextstate(B::Concise -254 Concise.pm:386) :*,&,{,x*,x&,x$,$ ->p
-# t           <1> entersub[t1] KRS*/TARG,STRICT ->u
-# p              <0> pushmark s ->q
-# q              <$> const(PV "warnings") sM ->r
-# r              <$> const(PV "qw") sM ->s
-# s              <.> method_named(PV "unimport") ->t
+# l           <;> nextstate(B::Concise -1010 Concise.pm:303) :*,&,x*,x&,x$,$ ->m
+# q           <1> entersub[t1] KRS*/TARG,STRICT ->r
+# m              <0> pushmark s ->n
+# n              <$> const(PV "strict") sM ->o
+# o              <$> const(PV "refs") sM ->p
+# p              <.> method_named(PV "unimport") ->q
 # BEGIN 4:
-# y  <1> leavesub[1 ref] K/REFC,1 ->(end)
-# -     <@> lineseq KP ->y
-# v        <;> nextstate(main 2 -e:1) v:>,<,%,{ ->w
-# x        <1> postinc[t2] sK/1 ->y
-# -           <1> ex-rv2sv sKRM/1 ->x
-# w              <$> gvsv(*beg) s ->x
+# 11 <1> leavesub[1 ref] K/REFC,1 ->(end)
+# -     <@> lineseq KP ->11
+# s        <;> nextstate(B::Concise -963 Concise.pm:368) v:*,&,{,x*,x&,x$,$ ->t
+# u        <1> require sK/1 ->v
+# t           <$> const(PV "strict.pm") s/BARE ->u
+# -        <;> ex-nextstate(B::Concise -963 Concise.pm:368) v:*,&,{,x*,x&,x$,$ ->v
+# -        <@> lineseq K ->-
+# v           <;> nextstate(B::Concise -963 Concise.pm:368) :*,&,{,x*,x&,x$,$ ->w
+# 10          <1> entersub[t1] KRS*/TARG,STRICT ->11
+# w              <0> pushmark s ->x
+# x              <$> const(PV "strict") sM ->y
+# y              <$> const(PV "refs") sM ->z
+# z              <.> method_named(PV "unimport") ->10
+# BEGIN 5:
+# 1b <1> leavesub[1 ref] K/REFC,1 ->(end)
+# -     <@> lineseq K ->1b
+# 12       <;> nextstate(B::Concise -938 Concise.pm:388) v:*,&,x*,x&,x$,$ ->13
+# 14       <1> require sK/1 ->15
+# 13          <$> const(PV "strict.pm") s/BARE ->14
+# -        <;> ex-nextstate(B::Concise -938 Concise.pm:388) v:*,&,x*,x&,x$,$ ->15
+# -        <@> lineseq K ->-
+# 15          <;> nextstate(B::Concise -938 Concise.pm:388) :*,&,x*,x&,x$,$ ->16
+# 1a          <1> entersub[t1] KRS*/TARG,STRICT ->1b
+# 16             <0> pushmark s ->17
+# 17             <$> const(PV "strict") sM ->18
+# 18             <$> const(PV "refs") sM ->19
+# 19             <.> method_named(PV "unimport") ->1a
+# BEGIN 6:
+# 1l <1> leavesub[1 ref] K/REFC,1 ->(end)
+# -     <@> lineseq KP ->1l
+# 1c       <;> nextstate(B::Concise -924 Concise.pm:408) v:*,&,{,x*,x&,x$,$ ->1d
+# 1e       <1> require sK/1 ->1f
+# 1d          <$> const(PV "warnings.pm") s/BARE ->1e
+# -        <;> ex-nextstate(B::Concise -924 Concise.pm:408) v:*,&,{,x*,x&,x$,$ ->1f
+# -        <@> lineseq K ->-
+# 1f          <;> nextstate(B::Concise -924 Concise.pm:408) :*,&,{,x*,x&,x$,$ ->1g
+# 1k          <1> entersub[t1] KRS*/TARG,STRICT ->1l
+# 1g             <0> pushmark s ->1h
+# 1h             <$> const(PV "warnings") sM ->1i
+# 1i             <$> const(PV "qw") sM ->1j
+# 1j             <.> method_named(PV "unimport") ->1k
+# BEGIN 7:
+# 1p <1> leavesub[1 ref] K/REFC,1 ->(end)
+# -     <@> lineseq KP ->1p
+# 1m       <;> nextstate(main 3 -e:1) v:{ ->1n
+# 1o       <1> postinc[t2] sK/1 ->1p
+# -           <1> ex-rv2sv sKRM/1 ->1o
+# 1n             <$> gvsv(*beg) s ->1o
 EONT_EONT
 
-
 checkOptree ( name	=> 'END',
 	      bcopts	=> 'END',
 	      prog	=> $src,
@@ -163,7 +238,6 @@ EOT_EOT
 # 2              <$> gvsv(*end) s ->3
 EONT_EONT
 
-
 checkOptree ( name	=> 'CHECK',
 	      bcopts	=> 'CHECK',
 	      prog	=> $src,
@@ -231,205 +305,321 @@ EOT_EOT
 # 2              <$> gvsv(*init) s ->3
 EONT_EONT
 
-
 checkOptree ( name	=> 'all of BEGIN END INIT CHECK UNITCHECK -exec',
 	      bcopts	=> [qw/ BEGIN END INIT CHECK UNITCHECK -exec /],
 	      prog	=> $src,
 	      strip_open_hints => 1,
 	      expect	=> <<'EOT_EOT', expect_nt => <<'EONT_EONT');
 # BEGIN 1:
-# 1  <;> nextstate(B::Concise -275 Concise.pm:356) v:*,&,{,x*,x&,x$,$
-# 2  <$> const[PV "strict.pm"] s/BARE
-# 3  <1> require sK/1
-# 4  <;> nextstate(B::Concise -275 Concise.pm:356) :*,&,{,x*,x&,x$,$
-# 5  <0> pushmark s
-# 6  <$> const[PV "strict"] sM
-# 7  <$> const[PV "refs"] sM
-# 8  <.> method_named[PV "unimport"] 
-# 9  <1> entersub[t1] KRS*/TARG,STRICT
-# a  <1> leavesub[1 ref] K/REFC,1
+# 1  <;> nextstate(B::Concise -1151 Concise.pm:116) v:*,&,{,x*,x&,x$,$
+# 2  <#> gv[*STDOUT] s
+# 3  <1> rv2gv sKRM/STRICT,1
+# 4  <1> srefgen sK/1
+# 5  <#> gvsv[*B::Concise::walkHandle] s
+# 6  <2> sassign sKS/2
+# 7  <1> leavesub[1 ref] K/REFC,1
 # BEGIN 2:
-# b  <;> nextstate(B::Concise -265 Concise.pm:367) v:*,&,x*,x&,x$,$
-# c  <$> const[PV "strict.pm"] s/BARE
-# d  <1> require sK/1
-# e  <;> nextstate(B::Concise -265 Concise.pm:367) :*,&,x*,x&,x$,$
-# f  <0> pushmark s
-# g  <$> const[PV "strict"] sM
-# h  <$> const[PV "refs"] sM
-# i  <.> method_named[PV "unimport"] 
-# j  <1> entersub[t1] KRS*/TARG,STRICT
-# k  <1> leavesub[1 ref] K/REFC,1
+# 8  <;> nextstate(B::Concise -1113 Concise.pm:181) v:*,&,x*,x&,x$,$
+# 9  <$> const[PV "strict.pm"] s/BARE
+# a  <1> require sK/1
+# b  <;> nextstate(B::Concise -1113 Concise.pm:181) :*,&,x*,x&,x$,$
+# c  <0> pushmark s
+# d  <$> const[PV "strict"] sM
+# e  <$> const[PV "refs"] sM
+# f  <.> method_named[PV "unimport"] 
+# g  <1> entersub[t1] KRS*/TARG,STRICT
+# h  <1> leavesub[1 ref] K/REFC,1
 # BEGIN 3:
-# l  <;> nextstate(B::Concise -254 Concise.pm:386) v:*,&,{,x*,x&,x$,$
-# m  <$> const[PV "warnings.pm"] s/BARE
-# n  <1> require sK/1
-# o  <;> nextstate(B::Concise -254 Concise.pm:386) :*,&,{,x*,x&,x$,$
-# p  <0> pushmark s
-# q  <$> const[PV "warnings"] sM
-# r  <$> const[PV "qw"] sM
-# s  <.> method_named[PV "unimport"] 
-# t  <1> entersub[t1] KRS*/TARG,STRICT
-# u  <1> leavesub[1 ref] K/REFC,1
+# i  <;> nextstate(B::Concise -1010 Concise.pm:303) v:*,&,x*,x&,x$,$
+# j  <$> const[PV "strict.pm"] s/BARE
+# k  <1> require sK/1
+# l  <;> nextstate(B::Concise -1010 Concise.pm:303) :*,&,x*,x&,x$,$
+# m  <0> pushmark s
+# n  <$> const[PV "strict"] sM
+# o  <$> const[PV "refs"] sM
+# p  <.> method_named[PV "unimport"] 
+# q  <1> entersub[t1] KRS*/TARG,STRICT
+# r  <1> leavesub[1 ref] K/REFC,1
 # BEGIN 4:
-# v  <;> nextstate(main 2 -e:1) v:>,<,%,{
-# w  <#> gvsv[*beg] s
-# x  <1> postinc[t3] sK/1
-# y  <1> leavesub[1 ref] K/REFC,1
+# s  <;> nextstate(B::Concise -963 Concise.pm:368) v:*,&,{,x*,x&,x$,$
+# t  <$> const[PV "strict.pm"] s/BARE
+# u  <1> require sK/1
+# v  <;> nextstate(B::Concise -963 Concise.pm:368) :*,&,{,x*,x&,x$,$
+# w  <0> pushmark s
+# x  <$> const[PV "strict"] sM
+# y  <$> const[PV "refs"] sM
+# z  <.> method_named[PV "unimport"] 
+# 10 <1> entersub[t1] KRS*/TARG,STRICT
+# 11 <1> leavesub[1 ref] K/REFC,1
+# BEGIN 5:
+# 12 <;> nextstate(B::Concise -938 Concise.pm:388) v:*,&,x*,x&,x$,$
+# 13 <$> const[PV "strict.pm"] s/BARE
+# 14 <1> require sK/1
+# 15 <;> nextstate(B::Concise -938 Concise.pm:388) :*,&,x*,x&,x$,$
+# 16 <0> pushmark s
+# 17 <$> const[PV "strict"] sM
+# 18 <$> const[PV "refs"] sM
+# 19 <.> method_named[PV "unimport"] 
+# 1a <1> entersub[t1] KRS*/TARG,STRICT
+# 1b <1> leavesub[1 ref] K/REFC,1
+# BEGIN 6:
+# 1c <;> nextstate(B::Concise -924 Concise.pm:408) v:*,&,{,x*,x&,x$,$
+# 1d <$> const[PV "warnings.pm"] s/BARE
+# 1e <1> require sK/1
+# 1f <;> nextstate(B::Concise -924 Concise.pm:408) :*,&,{,x*,x&,x$,$
+# 1g <0> pushmark s
+# 1h <$> const[PV "warnings"] sM
+# 1i <$> const[PV "qw"] sM
+# 1j <.> method_named[PV "unimport"] 
+# 1k <1> entersub[t1] KRS*/TARG,STRICT
+# 1l <1> leavesub[1 ref] K/REFC,1
+# BEGIN 7:
+# 1m <;> nextstate(main 3 -e:1) v:{
+# 1n <#> gvsv[*beg] s
+# 1o <1> postinc[t3] sK/1
+# 1p <1> leavesub[1 ref] K/REFC,1
 # END 1:
-# z  <;> nextstate(main 5 -e:1) v:>,<,%,{
-# 10 <#> gvsv[*end] s
-# 11 <1> postinc[t3] sK/1
-# 12 <1> leavesub[1 ref] K/REFC,1
+# 1q <;> nextstate(main 9 -e:1) v:{
+# 1r <#> gvsv[*end] s
+# 1s <1> postinc[t3] sK/1
+# 1t <1> leavesub[1 ref] K/REFC,1
 # INIT 1:
-# 13 <;> nextstate(main 4 -e:1) v:>,<,%,{
-# 14 <#> gvsv[*init] s
-# 15 <1> postinc[t3] sK/1
-# 16 <1> leavesub[1 ref] K/REFC,1
+# 1u <;> nextstate(main 7 -e:1) v:{
+# 1v <#> gvsv[*init] s
+# 1w <1> postinc[t3] sK/1
+# 1x <1> leavesub[1 ref] K/REFC,1
 # CHECK 1:
-# 17 <;> nextstate(main 3 -e:1) v:>,<,%,{
-# 18 <#> gvsv[*chk] s
-# 19 <1> postinc[t3] sK/1
-# 1a <1> leavesub[1 ref] K/REFC,1
+# 1y <;> nextstate(main 5 -e:1) v:{
+# 1z <#> gvsv[*chk] s
+# 20 <1> postinc[t3] sK/1
+# 21 <1> leavesub[1 ref] K/REFC,1
 # UNITCHECK 1:
-# 1b <;> nextstate(main 6 -e:1) v:>,<,%,{
-# 1c <#> gvsv[*uc] s
-# 1d <1> postinc[t3] sK/1
-# 1e <1> leavesub[1 ref] K/REFC,1
+# 22 <;> nextstate(main 11 -e:1) v:{
+# 23 <#> gvsv[*uc] s
+# 24 <1> postinc[t3] sK/1
+# 25 <1> leavesub[1 ref] K/REFC,1
 EOT_EOT
 # BEGIN 1:
-# 1  <;> nextstate(B::Concise -275 Concise.pm:356) v:*,&,{,x*,x&,x$,$
-# 2  <$> const(PV "strict.pm") s/BARE
-# 3  <1> require sK/1
-# 4  <;> nextstate(B::Concise -275 Concise.pm:356) :*,&,{,x*,x&,x$,$
-# 5  <0> pushmark s
-# 6  <$> const(PV "strict") sM
-# 7  <$> const(PV "refs") sM
-# 8  <.> method_named(PV "unimport") 
-# 9  <1> entersub[t1] KRS*/TARG,STRICT
-# a  <1> leavesub[1 ref] K/REFC,1
+# 1  <;> nextstate(B::Concise -1151 Concise.pm:116) v:*,&,{,x*,x&,x$,$
+# 2  <$> gv(*STDOUT) s
+# 3  <1> rv2gv sKRM/STRICT,1
+# 4  <1> srefgen sK/1
+# 5  <$> gvsv(*B::Concise::walkHandle) s
+# 6  <2> sassign sKS/2
+# 7  <1> leavesub[1 ref] K/REFC,1
 # BEGIN 2:
-# b  <;> nextstate(B::Concise -265 Concise.pm:367) v:*,&,x*,x&,x$,$
-# c  <$> const(PV "strict.pm") s/BARE
-# d  <1> require sK/1
-# e  <;> nextstate(B::Concise -265 Concise.pm:367) :*,&,x*,x&,x$,$
-# f  <0> pushmark s
-# g  <$> const(PV "strict") sM
-# h  <$> const(PV "refs") sM
-# i  <.> method_named(PV "unimport") 
-# j  <1> entersub[t1] KRS*/TARG,STRICT
-# k  <1> leavesub[1 ref] K/REFC,1
+# 8  <;> nextstate(B::Concise -1113 Concise.pm:181) v:*,&,x*,x&,x$,$
+# 9  <$> const(PV "strict.pm") s/BARE
+# a  <1> require sK/1
+# b  <;> nextstate(B::Concise -1113 Concise.pm:181) :*,&,x*,x&,x$,$
+# c  <0> pushmark s
+# d  <$> const(PV "strict") sM
+# e  <$> const(PV "refs") sM
+# f  <.> method_named(PV "unimport") 
+# g  <1> entersub[t1] KRS*/TARG,STRICT
+# h  <1> leavesub[1 ref] K/REFC,1
 # BEGIN 3:
-# l  <;> nextstate(B::Concise -254 Concise.pm:386) v:*,&,{,x*,x&,x$,$
-# m  <$> const(PV "warnings.pm") s/BARE
-# n  <1> require sK/1
-# o  <;> nextstate(B::Concise -254 Concise.pm:386) :*,&,{,x*,x&,x$,$
-# p  <0> pushmark s
-# q  <$> const(PV "warnings") sM
-# r  <$> const(PV "qw") sM
-# s  <.> method_named(PV "unimport") 
-# t  <1> entersub[t1] KRS*/TARG,STRICT
-# u  <1> leavesub[1 ref] K/REFC,1
+# i  <;> nextstate(B::Concise -1010 Concise.pm:303) v:*,&,x*,x&,x$,$
+# j  <$> const(PV "strict.pm") s/BARE
+# k  <1> require sK/1
+# l  <;> nextstate(B::Concise -1010 Concise.pm:303) :*,&,x*,x&,x$,$
+# m  <0> pushmark s
+# n  <$> const(PV "strict") sM
+# o  <$> const(PV "refs") sM
+# p  <.> method_named(PV "unimport") 
+# q  <1> entersub[t1] KRS*/TARG,STRICT
+# r  <1> leavesub[1 ref] K/REFC,1
 # BEGIN 4:
-# v  <;> nextstate(main 2 -e:1) v:>,<,%,{
-# w  <$> gvsv(*beg) s
-# x  <1> postinc[t2] sK/1
-# y  <1> leavesub[1 ref] K/REFC,1
+# s  <;> nextstate(B::Concise -963 Concise.pm:368) v:*,&,{,x*,x&,x$,$
+# t  <$> const(PV "strict.pm") s/BARE
+# u  <1> require sK/1
+# v  <;> nextstate(B::Concise -963 Concise.pm:368) :*,&,{,x*,x&,x$,$
+# w  <0> pushmark s
+# x  <$> const(PV "strict") sM
+# y  <$> const(PV "refs") sM
+# z  <.> method_named(PV "unimport") 
+# 10 <1> entersub[t1] KRS*/TARG,STRICT
+# 11 <1> leavesub[1 ref] K/REFC,1
+# BEGIN 5:
+# 12 <;> nextstate(B::Concise -938 Concise.pm:388) v:*,&,x*,x&,x$,$
+# 13 <$> const(PV "strict.pm") s/BARE
+# 14 <1> require sK/1
+# 15 <;> nextstate(B::Concise -938 Concise.pm:388) :*,&,x*,x&,x$,$
+# 16 <0> pushmark s
+# 17 <$> const(PV "strict") sM
+# 18 <$> const(PV "refs") sM
+# 19 <.> method_named(PV "unimport") 
+# 1a <1> entersub[t1] KRS*/TARG,STRICT
+# 1b <1> leavesub[1 ref] K/REFC,1
+# BEGIN 6:
+# 1c <;> nextstate(B::Concise -924 Concise.pm:408) v:*,&,{,x*,x&,x$,$
+# 1d <$> const(PV "warnings.pm") s/BARE
+# 1e <1> require sK/1
+# 1f <;> nextstate(B::Concise -924 Concise.pm:408) :*,&,{,x*,x&,x$,$
+# 1g <0> pushmark s
+# 1h <$> const(PV "warnings") sM
+# 1i <$> const(PV "qw") sM
+# 1j <.> method_named(PV "unimport") 
+# 1k <1> entersub[t1] KRS*/TARG,STRICT
+# 1l <1> leavesub[1 ref] K/REFC,1
+# BEGIN 7:
+# 1m <;> nextstate(main 3 -e:1) v:{
+# 1n <$> gvsv(*beg) s
+# 1o <1> postinc[t2] sK/1
+# 1p <1> leavesub[1 ref] K/REFC,1
 # END 1:
-# z  <;> nextstate(main 5 -e:1) v:>,<,%,{
-# 10 <$> gvsv(*end) s
-# 11 <1> postinc[t2] sK/1
-# 12 <1> leavesub[1 ref] K/REFC,1
+# 1q <;> nextstate(main 9 -e:1) v:{
+# 1r <$> gvsv(*end) s
+# 1s <1> postinc[t2] sK/1
+# 1t <1> leavesub[1 ref] K/REFC,1
 # INIT 1:
-# 13 <;> nextstate(main 4 -e:1) v:>,<,%,{
-# 14 <$> gvsv(*init) s
-# 15 <1> postinc[t2] sK/1
-# 16 <1> leavesub[1 ref] K/REFC,1
+# 1u <;> nextstate(main 7 -e:1) v:{
+# 1v <$> gvsv(*init) s
+# 1w <1> postinc[t2] sK/1
+# 1x <1> leavesub[1 ref] K/REFC,1
 # CHECK 1:
-# 17 <;> nextstate(main 3 -e:1) v:>,<,%,{
-# 18 <$> gvsv(*chk) s
-# 19 <1> postinc[t2] sK/1
-# 1a <1> leavesub[1 ref] K/REFC,1
+# 1y <;> nextstate(main 5 -e:1) v:{
+# 1z <$> gvsv(*chk) s
+# 20 <1> postinc[t2] sK/1
+# 21 <1> leavesub[1 ref] K/REFC,1
 # UNITCHECK 1:
-# 1b <;> nextstate(main 6 -e:1) v:>,<,%,{
-# 1c <$> gvsv(*uc) s
-# 1d <1> postinc[t2] sK/1
-# 1e <1> leavesub[1 ref] K/REFC,1
+# 22 <;> nextstate(main 11 -e:1) v:{
+# 23 <$> gvsv(*uc) s
+# 24 <1> postinc[t2] sK/1
+# 25 <1> leavesub[1 ref] K/REFC,1
 EONT_EONT
 
-
 # perl "-I../lib" -MO=Concise,BEGIN,CHECK,INIT,END,-exec -e '$a=$b && print q/foo/'
 
-
-
 checkOptree ( name	=> 'regression test for patch 25352',
 	      bcopts	=> [qw/ BEGIN END INIT CHECK -exec /],
 	      prog	=> 'print q/foo/',
 	      expect	=> <<'EOT_EOT', expect_nt => <<'EONT_EONT');
 # BEGIN 1:
 # 1  <;> nextstate(B::Concise -275 Concise.pm:356) v:*,&,{,x*,x&,x$,$
-# 2  <$> const[PV "strict.pm"] s/BARE
-# 3  <1> require sK/1
-# 4  <;> nextstate(B::Concise -275 Concise.pm:356) :*,&,{,x*,x&,x$,$
-# 5  <0> pushmark s
-# 6  <$> const[PV "strict"] sM
-# 7  <$> const[PV "refs"] sM
-# 8  <.> method_named[PV "unimport"] 
-# 9  <1> entersub[t1] KRS*/TARG,STRICT
-# a  <1> leavesub[1 ref] K/REFC,1
+# 2  <#> gv[*STDOUT] s
+# 3  <1> rv2gv sKRM/STRICT,1
+# 4  <1> srefgen sK/1
+# 5  <#> gvsv[*B::Concise::walkHandle] s
+# 6  <2> sassign sKS/2
+# 7  <1> leavesub[1 ref] K/REFC,1
 # BEGIN 2:
-# b  <;> nextstate(B::Concise -265 Concise.pm:367) v:*,&,x*,x&,x$,$
-# c  <$> const[PV "strict.pm"] s/BARE
-# d  <1> require sK/1
-# e  <;> nextstate(B::Concise -265 Concise.pm:367) :*,&,x*,x&,x$,$
-# f  <0> pushmark s
-# g  <$> const[PV "strict"] sM
-# h  <$> const[PV "refs"] sM
-# i  <.> method_named[PV "unimport"] 
-# j  <1> entersub[t1] KRS*/TARG,STRICT
-# k  <1> leavesub[1 ref] K/REFC,1
+# 8  <;> nextstate(B::Concise -1113 Concise.pm:181) v:*,&,x*,x&,x$,$
+# 9  <$> const[PV "strict.pm"] s/BARE
+# a  <1> require sK/1
+# b  <;> nextstate(B::Concise -1113 Concise.pm:181) :*,&,x*,x&,x$,$
+# c  <0> pushmark s
+# d  <$> const[PV "strict"] sM
+# e  <$> const[PV "refs"] sM
+# f  <.> method_named[PV "unimport"] 
+# g  <1> entersub[t1] KRS*/TARG,STRICT
+# h  <1> leavesub[1 ref] K/REFC,1
 # BEGIN 3:
-# l  <;> nextstate(B::Concise -254 Concise.pm:386) v:*,&,{,x*,x&,x$,$
-# m  <$> const[PV "warnings.pm"] s/BARE
-# n  <1> require sK/1
-# o  <;> nextstate(B::Concise -254 Concise.pm:386) :*,&,{,x*,x&,x$,$
-# p  <0> pushmark s
-# q  <$> const[PV "warnings"] sM
-# r  <$> const[PV "qw"] sM
-# s  <.> method_named[PV "unimport"] 
-# t  <1> entersub[t1] KRS*/TARG,STRICT
-# u  <1> leavesub[1 ref] K/REFC,1
+# i  <;> nextstate(B::Concise -1010 Concise.pm:303) v:*,&,x*,x&,x$,$
+# j  <$> const[PV "strict.pm"] s/BARE
+# k  <1> require sK/1
+# l  <;> nextstate(B::Concise -1010 Concise.pm:303) :*,&,x*,x&,x$,$
+# m  <0> pushmark s
+# n  <$> const[PV "strict"] sM
+# o  <$> const[PV "refs"] sM
+# p  <.> method_named[PV "unimport"] 
+# q  <1> entersub[t1] KRS*/TARG,STRICT
+# r  <1> leavesub[1 ref] K/REFC,1
+# BEGIN 4:
+# s  <;> nextstate(B::Concise -963 Concise.pm:368) v:*,&,{,x*,x&,x$,$
+# t  <$> const[PV "strict.pm"] s/BARE
+# u  <1> require sK/1
+# v  <;> nextstate(B::Concise -963 Concise.pm:368) :*,&,{,x*,x&,x$,$
+# w  <0> pushmark s
+# x  <$> const[PV "strict"] sM
+# y  <$> const[PV "refs"] sM
+# z  <.> method_named[PV "unimport"] 
+# 10 <1> entersub[t1] KRS*/TARG,STRICT
+# 11 <1> leavesub[1 ref] K/REFC,1
+# BEGIN 5:
+# 12 <;> nextstate(B::Concise -938 Concise.pm:388) v:*,&,x*,x&,x$,$
+# 13 <$> const[PV "strict.pm"] s/BARE
+# 14 <1> require sK/1
+# 15 <;> nextstate(B::Concise -938 Concise.pm:388) :*,&,x*,x&,x$,$
+# 16 <0> pushmark s
+# 17 <$> const[PV "strict"] sM
+# 18 <$> const[PV "refs"] sM
+# 19 <.> method_named[PV "unimport"] 
+# 1a <1> entersub[t1] KRS*/TARG,STRICT
+# 1b <1> leavesub[1 ref] K/REFC,1
+# BEGIN 6:
+# 1c <;> nextstate(B::Concise -924 Concise.pm:408) v:*,&,{,x*,x&,x$,$
+# 1d <$> const[PV "warnings.pm"] s/BARE
+# 1e <1> require sK/1
+# 1f <;> nextstate(B::Concise -924 Concise.pm:408) :*,&,{,x*,x&,x$,$
+# 1g <0> pushmark s
+# 1h <$> const[PV "warnings"] sM
+# 1i <$> const[PV "qw"] sM
+# 1j <.> method_named[PV "unimport"] 
+# 1k <1> entersub[t1] KRS*/TARG,STRICT
+# 1l <1> leavesub[1 ref] K/REFC,1
 EOT_EOT
 # BEGIN 1:
-# 1  <;> nextstate(B::Concise -275 Concise.pm:356) v:*,&,{,x*,x&,x$,$
-# 2  <$> const(PV "strict.pm") s/BARE
-# 3  <1> require sK/1
-# 4  <;> nextstate(B::Concise -275 Concise.pm:356) :*,&,{,x*,x&,x$,$
-# 5  <0> pushmark s
-# 6  <$> const(PV "strict") sM
-# 7  <$> const(PV "refs") sM
-# 8  <.> method_named(PV "unimport") 
-# 9  <1> entersub[t1] KRS*/TARG,STRICT
-# a  <1> leavesub[1 ref] K/REFC,1
+# 1  <;> nextstate(B::Concise -1151 Concise.pm:116) v:*,&,{,x*,x&,x$,$
+# 2  <$> gv(*STDOUT) s
+# 3  <1> rv2gv sKRM/STRICT,1
+# 4  <1> srefgen sK/1
+# 5  <$> gvsv(*B::Concise::walkHandle) s
+# 6  <2> sassign sKS/2
+# 7  <1> leavesub[1 ref] K/REFC,1
 # BEGIN 2:
-# b  <;> nextstate(B::Concise -265 Concise.pm:367) v:*,&,x*,x&,x$,$
-# c  <$> const(PV "strict.pm") s/BARE
-# d  <1> require sK/1
-# e  <;> nextstate(B::Concise -265 Concise.pm:367) :*,&,x*,x&,x$,$
-# f  <0> pushmark s
-# g  <$> const(PV "strict") sM
-# h  <$> const(PV "refs") sM
-# i  <.> method_named(PV "unimport") 
-# j  <1> entersub[t1] KRS*/TARG,STRICT
-# k  <1> leavesub[1 ref] K/REFC,1
+# 8  <;> nextstate(B::Concise -1113 Concise.pm:181) v:*,&,x*,x&,x$,$
+# 9  <$> const(PV "strict.pm") s/BARE
+# a  <1> require sK/1
+# b  <;> nextstate(B::Concise -1113 Concise.pm:181) :*,&,x*,x&,x$,$
+# c  <0> pushmark s
+# d  <$> const(PV "strict") sM
+# e  <$> const(PV "refs") sM
+# f  <.> method_named(PV "unimport") 
+# g  <1> entersub[t1] KRS*/TARG,STRICT
+# h  <1> leavesub[1 ref] K/REFC,1
 # BEGIN 3:
-# l  <;> nextstate(B::Concise -254 Concise.pm:386) v:*,&,{,x*,x&,x$,$
-# m  <$> const(PV "warnings.pm") s/BARE
-# n  <1> require sK/1
-# o  <;> nextstate(B::Concise -254 Concise.pm:386) :*,&,{,x*,x&,x$,$
-# p  <0> pushmark s
-# q  <$> const(PV "warnings") sM
-# r  <$> const(PV "qw") sM
-# s  <.> method_named(PV "unimport") 
-# t  <1> entersub[t1] KRS*/TARG,STRICT
-# u  <1> leavesub[1 ref] K/REFC,1
+# i  <;> nextstate(B::Concise -1010 Concise.pm:303) v:*,&,x*,x&,x$,$
+# j  <$> const(PV "strict.pm") s/BARE
+# k  <1> require sK/1
+# l  <;> nextstate(B::Concise -1010 Concise.pm:303) :*,&,x*,x&,x$,$
+# m  <0> pushmark s
+# n  <$> const(PV "strict") sM
+# o  <$> const(PV "refs") sM
+# p  <.> method_named(PV "unimport") 
+# q  <1> entersub[t1] KRS*/TARG,STRICT
+# r  <1> leavesub[1 ref] K/REFC,1
+# BEGIN 4:
+# s  <;> nextstate(B::Concise -963 Concise.pm:368) v:*,&,{,x*,x&,x$,$
+# t  <$> const(PV "strict.pm") s/BARE
+# u  <1> require sK/1
+# v  <;> nextstate(B::Concise -963 Concise.pm:368) :*,&,{,x*,x&,x$,$
+# w  <0> pushmark s
+# x  <$> const(PV "strict") sM
+# y  <$> const(PV "refs") sM
+# z  <.> method_named(PV "unimport") 
+# 10 <1> entersub[t1] KRS*/TARG,STRICT
+# 11 <1> leavesub[1 ref] K/REFC,1
+# BEGIN 5:
+# 12 <;> nextstate(B::Concise -938 Concise.pm:388) v:*,&,x*,x&,x$,$
+# 13 <$> const(PV "strict.pm") s/BARE
+# 14 <1> require sK/1
+# 15 <;> nextstate(B::Concise -938 Concise.pm:388) :*,&,x*,x&,x$,$
+# 16 <0> pushmark s
+# 17 <$> const(PV "strict") sM
+# 18 <$> const(PV "refs") sM
+# 19 <.> method_named(PV "unimport") 
+# 1a <1> entersub[t1] KRS*/TARG,STRICT
+# 1b <1> leavesub[1 ref] K/REFC,1
+# BEGIN 6:
+# 1c <;> nextstate(B::Concise -924 Concise.pm:408) v:*,&,{,x*,x&,x$,$
+# 1d <$> const(PV "warnings.pm") s/BARE
+# 1e <1> require sK/1
+# 1f <;> nextstate(B::Concise -924 Concise.pm:408) :*,&,{,x*,x&,x$,$
+# 1g <0> pushmark s
+# 1h <$> const(PV "warnings") sM
+# 1i <$> const(PV "qw") sM
+# 1j <.> method_named(PV "unimport") 
+# 1k <1> entersub[t1] KRS*/TARG,STRICT
+# 1l <1> leavesub[1 ref] K/REFC,1
 EONT_EONT

@p5pRT
Copy link
Author

p5pRT commented Sep 13, 2017

From @toddr

0002-Fix-warnings-used-once-for-B.pm.patch
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Todd Rinaldo <toddr@cpan.org>
Date: Wed, 13 Sep 2017 14:35:30 -0500
Subject: [PATCH 2/4] Fix warnings (used once) for B.pm

---
 ext/B/B.pm | 12 +++++++-----
 1 file changed, 7 insertions(+), 5 deletions(-)

diff --git a/ext/B/B.pm b/ext/B/B.pm
index 47c43536dc..9ffebbda82 100644
--- a/ext/B/B.pm
+++ b/ext/B/B.pm
@@ -79,12 +79,12 @@ push @B::EXPORT_OK, (qw(minus_c ppname save_BEGINs
 
 @B::SPECIAL::ISA = 'B::OBJECT';
 
-@B::optype = qw(OP UNOP BINOP LOGOP LISTOP PMOP SVOP PADOP PVOP LOOP COP
+our @optype = qw(OP UNOP BINOP LOGOP LISTOP PMOP SVOP PADOP PVOP LOOP COP
                 METHOP UNOP_AUX);
 # bytecode.pl contained the following comment:
 # Nullsv *must* come first in the following so that the condition
 # ($$sv == 0) can continue to be used to test (sv == Nullsv).
-@B::specialsv_name = qw(Nullsv &PL_sv_undef &PL_sv_yes &PL_sv_no
+our @specialsv_name = qw(Nullsv &PL_sv_undef &PL_sv_yes &PL_sv_no
 			(SV*)pWARN_ALL (SV*)pWARN_NONE (SV*)pWARN_STD
                         &PL_sv_zero);
 
@@ -120,15 +120,17 @@ sub B::IV::int_value {
 }
 
 sub B::NULL::as_string() {""}
-*B::IV::as_string = \*B::IV::int_value;
-*B::PV::as_string = \*B::PV::PV;
+*B::IV::as_string = *B::IV::as_string = \*B::IV::int_value;
+*B::PV::as_string = *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;
+
+#  Since perl 5.12.0
+*B::IV::RV = *B::IV::RV = \*B::PV::RV;
 
 my $debug;
 my $op_count = 0;

@p5pRT
Copy link
Author

p5pRT commented Sep 13, 2017

From @toddr

0003-Fix-warnings-used-once-for-O.pm.patch
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Todd Rinaldo <toddr@cpan.org>
Date: Wed, 13 Sep 2017 14:35:35 -0500
Subject: [PATCH 3/4] Fix warnings (used once) for O.pm

---
 ext/B/O.pm | 9 ++++++---
 1 file changed, 6 insertions(+), 3 deletions(-)

diff --git a/ext/B/O.pm b/ext/B/O.pm
index 7393441b05..09a905eaee 100644
--- a/ext/B/O.pm
+++ b/ext/B/O.pm
@@ -4,12 +4,15 @@ our $VERSION = '1.02';
 
 use B ();
 
+our $BEGIN_output;
+our $saveout_fh;
+
 sub import {
     my ($class, @options) = @_;
     my ($quiet, $veryquiet) = (0, 0);
     if ($options[0] eq '-q' || $options[0] eq '-qq') {
 	$quiet = 1;
-	open (SAVEOUT, ">&STDOUT");
+	open ($saveout_fh, ">&", STDOUT);
 	close STDOUT;
 	open (STDOUT, ">", \$O::BEGIN_output);
 	if ($options[0] eq '-qq') {
@@ -27,8 +30,8 @@ sub import {
 	CHECK {
 	    if ($quiet) {
 		close STDOUT;
-		open (STDOUT, ">&SAVEOUT");
-		close SAVEOUT;
+		open (STDOUT, ">&", $saveout_fh);
+		close $saveout_fh;
 	    }
 
 	    # Note: if you change the code after this 'use', please

@p5pRT
Copy link
Author

p5pRT commented Sep 13, 2017

From @toddr

0004-ext-B-t-strict.t-Assure-B.pm-and-O.pm-pass-strict-an.patch
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Todd Rinaldo <toddr@cpan.org>
Date: Wed, 13 Sep 2017 14:35:39 -0500
Subject: [PATCH 4/4] ext/B/t/strict.t: Assure B.pm and O.pm pass strict and
 warnings checks.

We need to test these in unit tests since they do not load these modules to
prevent pollution of the stash in compilers.
---
 MANIFEST         |  1 +
 ext/B/t/strict.t | 28 ++++++++++++++++++++++++++++
 2 files changed, 29 insertions(+)
 create mode 100644 ext/B/t/strict.t

diff --git a/MANIFEST b/MANIFEST
index ad24a2d28b..5bcafdc8c2 100644
--- a/MANIFEST
+++ b/MANIFEST
@@ -3915,6 +3915,7 @@ ext/B/t/optree_varinit.t	my,our,local var init optimization
 ext/B/t/OptreeCheck.pm		optree comparison tool
 ext/B/t/pragma.t	See if user pragmas work.
 ext/B/t/showlex.t	See if B::ShowLex works
+ext/B/t/strict.t	See if B works with strict and warnings.
 ext/B/t/sv_stash.t	See if SvSTASH() works
 ext/B/t/terse.t		See if B::Terse works
 ext/B/t/walkoptree.t	See if B::walkoptree (and friends) work
diff --git a/ext/B/t/strict.t b/ext/B/t/strict.t
new file mode 100644
index 0000000000..74693d4d3e
--- /dev/null
+++ b/ext/B/t/strict.t
@@ -0,0 +1,28 @@
+#!./perl -w
+
+BEGIN {
+    unshift @INC, 't';
+    require Config;
+    if ( ( $Config::Config{'extensions'} !~ /\bB\b/ ) ) {
+        print "1..0 # Skip -- Perl configured without B module\n";
+        exit 0;
+    }
+    require '../../t/test.pl';
+}
+
+use strict;
+use warnings;
+
+use B ();
+use O ();
+
+plan tests => 2;
+
+foreach my $module (qw/B O/) {
+    my $path  = $INC{ $module . '.pm' };
+    my $check = "$^X -cw -Mstrict $path 2>&1";
+    my $got   = `$check`;
+    is( $got, "$path syntax OK\n", "$module.pm compiles without errors" )
+      or diag($got);
+}
+

@p5pRT
Copy link
Author

p5pRT commented Sep 13, 2017

From zefram@fysh.org

Todd Rinaldo via RT wrote​:

$>perl -e'BEGIN {use strict; use warnings; print $^H . "\n"}'
256

That's showing $^H at *runtime* of the code that has the pragmata
in effect. $^H reflects the pragmata in effect at the current point
of compilation, which in this case is no pragmata. To get the hint
bits corresponding to the strict pragma, you need to look at $^H during
*compilation* of code with the pragma in effect​:

  $ perl -lwe 'use strict; BEGIN { printf "%x\n", $^H }'
  7e2

You could also pull hint bits from perl.h​:

  #define HINT_STRICT_REFS 0x00000002 /* strict pragma */
  #define HINT_EXPLICIT_STRICT_REFS 0x00000020 /* strict.pm */
  #define HINT_EXPLICIT_STRICT_SUBS 0x00000040 /* strict.pm */
  #define HINT_EXPLICIT_STRICT_VARS 0x00000080 /* strict.pm */
  #define HINT_BLOCK_SCOPE 0x00000100
  #define HINT_STRICT_SUBS 0x00000200 /* strict pragma */
  #define HINT_STRICT_VARS 0x00000400 /* strict pragma */

The warnings pragma doesn't affect $^H, but rather ${^WARNING_BITS}.
Similar compile-time/runtime considerations apply to it. However,
the bit assignment there isn't as stable as the hint bit assignments.

-zefram

@p5pRT
Copy link
Author

p5pRT commented Sep 13, 2017

From @tonycoz

On Wed, 13 Sep 2017 13​:21​:53 -0700, TODDR wrote​:

Sorry, this seems to have gotten overlooked, and no longer cleanly
applies.

I'm happy with the patch, except for removing strict from B.pm.
If you really, really need to avoid loading strict.pm, then perhaps
replace

use strict;

with something like

BEGIN { $^H = 0x6e2 };

Then have a test somewhere which asserts somehow that the values of
%bitmask and %explicit_bitmask in strict.pm 'or' to 0x6e2.

Dave,

How about a unit test instead to assure both warnings and strict are
met? I had to do some fixups to meet that requirement.

See attached patches.

+ }
+ require '../../t/test.pl';
+}
+
+use strict;
+use warnings;
+
+use B ();

Why use test.pl here instead of Test​::More - the code doesn't use any of the special functions (like runperl()) that test.pl provides.

Tony

@p5pRT
Copy link
Author

p5pRT commented Sep 14, 2017

From @toddr

On Wed, 13 Sep 2017 16​:41​:38 -0700, tonyc wrote​:

+ }
+ require '../../t/test.pl';
+}
+
+use strict;
+use warnings;
+
+use B ();

Why use test.pl here instead of Test​::More - the code doesn't use any
of the special functions (like runperl()) that test.pl provides.

Tony

Quite Right. Attaching a new patch 4

@p5pRT
Copy link
Author

p5pRT commented Sep 14, 2017

From @toddr

0004-ext-B-t-strict.t-Assure-B.pm-and-O.pm-pass-strict-an.patch
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Todd Rinaldo <toddr@cpan.org>
Date: Wed, 13 Sep 2017 14:35:39 -0500
Subject: [PATCH 4/4] ext/B/t/strict.t: Assure B.pm and O.pm pass strict and
 warnings checks.

We need to test these in unit tests since they do not load these modules to
prevent pollution of the stash in compilers.
---
 MANIFEST         |  1 +
 ext/B/t/strict.t | 30 ++++++++++++++++++++++++++++++
 2 files changed, 31 insertions(+)
 create mode 100644 ext/B/t/strict.t

diff --git a/MANIFEST b/MANIFEST
index ad24a2d28b..5bcafdc8c2 100644
--- a/MANIFEST
+++ b/MANIFEST
@@ -3915,6 +3915,7 @@ ext/B/t/optree_varinit.t	my,our,local var init optimization
 ext/B/t/OptreeCheck.pm		optree comparison tool
 ext/B/t/pragma.t	See if user pragmas work.
 ext/B/t/showlex.t	See if B::ShowLex works
+ext/B/t/strict.t	See if B works with strict and warnings.
 ext/B/t/sv_stash.t	See if SvSTASH() works
 ext/B/t/terse.t		See if B::Terse works
 ext/B/t/walkoptree.t	See if B::walkoptree (and friends) work
diff --git a/ext/B/t/strict.t b/ext/B/t/strict.t
new file mode 100644
index 0000000000..4d1b84aa20
--- /dev/null
+++ b/ext/B/t/strict.t
@@ -0,0 +1,30 @@
+#!./perl -w
+
+use strict;
+use warnings;
+
+use Config;
+use Test::More;
+
+BEGIN {
+    if ( ( $Config{'extensions'} !~ /\sB\s/ ) ) {
+        plan skip_all => "Perl was not compiled with B";
+        exit 0;
+    }
+}
+
+use strict;
+use warnings;
+
+use B ();
+use O ();
+
+foreach my $module (qw/B O/) {
+    my $path  = $INC{ $module . '.pm' };
+    my $check = "$^X -cw -Mstrict $path 2>&1";
+    my $got   = `$check`;
+    is( $got, "$path syntax OK\n", "$module.pm compiles without errors" )
+      or diag($got);
+}
+
+done_testing();

@p5pRT
Copy link
Author

p5pRT commented Sep 30, 2017

From @toddr

On Wed, 13 Sep 2017 18​:11​:51 -0700, TODDR wrote​:

On Wed, 13 Sep 2017 16​:41​:38 -0700, tonyc wrote​:

+ }
+ require '../../t/test.pl';
+}
+
+use strict;
+use warnings;
+
+use B ();

Why use test.pl here instead of Test​::More - the code doesn't use any
of the special functions (like runperl()) that test.pl provides.

Tony

Quite Right. Attaching a new patch 4

I think we're waiting on Dave to review and merge. Bump?

Todd

@p5pRT
Copy link
Author

p5pRT commented Oct 4, 2017

From @atoomic

bumping the case to check what is its status and what are the blockers for this case.
thanks

On Wed, 13 Sep 2017 18​:11​:51 -0700, TODDR wrote​:

On Wed, 13 Sep 2017 16​:41​:38 -0700, tonyc wrote​:

+ }
+ require '../../t/test.pl';
+}
+
+use strict;
+use warnings;
+
+use B ();

Why use test.pl here instead of Test​::More - the code doesn't use any
of the special functions (like runperl()) that test.pl provides.

Tony

Quite Right. Attaching a new patch 4

@p5pRT
Copy link
Author

p5pRT commented Nov 4, 2017

From @iabyn

On Wed, Oct 04, 2017 at 08​:51​:11AM -0700, Atoomic via RT wrote​:

bumping the case to check what is its status and what are the blockers for this case.
thanks

On Wed, 13 Sep 2017 18​:11​:51 -0700, TODDR wrote​:

On Wed, 13 Sep 2017 16​:41​:38 -0700, tonyc wrote​:

+ }
+ require '../../t/test.pl';
+}
+
+use strict;
+use warnings;
+
+use B ();

Why use test.pl here instead of Test​::More - the code doesn't use any
of the special functions (like runperl()) that test.pl provides.

Tony

Quite Right. Attaching a new patch 4

I'm happy with the patches.

--
"Strange women lying in ponds distributing swords is no basis for a system
of government. Supreme executive power derives from a mandate from the
masses, not from some farcical aquatic ceremony."
  -- Dennis, "Monty Python and the Holy Grail"

@p5pRT
Copy link
Author

p5pRT commented Nov 8, 2017

From @toddr

On Sat, 04 Nov 2017 15​:17​:55 -0700, davem wrote​:

I'm happy with the patches.

Merged to blead with commit 645a04a

@p5pRT
Copy link
Author

p5pRT commented Nov 8, 2017

@atoomic - Status changed from 'open' to 'pending release'

@p5pRT
Copy link
Author

p5pRT commented Jun 23, 2018

From @khwilliamson

Thank you for filing this report. You have helped make Perl better.

With the release yesterday of Perl 5.28.0, this and 185 other issues have been
resolved.

Perl 5.28.0 may be downloaded via​:
https://metacpan.org/release/XSAWYERX/perl-5.28.0

If you find that the problem persists, feel free to reopen this ticket.

@p5pRT
Copy link
Author

p5pRT commented Jun 23, 2018

@khwilliamson - Status changed from 'pending release' to 'resolved'

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant