summaryrefslogtreecommitdiff
path: root/ext
diff options
context:
space:
mode:
authorFather Chrysostomos <sprout@cpan.org>2012-04-30 18:18:03 -0700
committerFather Chrysostomos <sprout@cpan.org>2012-07-04 18:00:00 -0700
commitcc2ebcd790252079cb9b33d2eef133701a7eb63e (patch)
tree9d746020dfb4cd47c5501c69c93388452ef25d4d /ext
parentaba33b8a16881a79d8ef8ab7e7786e35cb84e6ae (diff)
downloadperl-cc2ebcd790252079cb9b33d2eef133701a7eb63e.tar.gz
Record folded constants in the op tree
Diffstat (limited to 'ext')
-rw-r--r--ext/B/B/Concise.pm4
-rw-r--r--ext/B/t/optree_constants.t52
-rw-r--r--ext/B/t/optree_samples.t4
3 files changed, 30 insertions, 30 deletions
diff --git a/ext/B/B/Concise.pm b/ext/B/B/Concise.pm
index 26fb34de65..7e2c20f0d8 100644
--- a/ext/B/B/Concise.pm
+++ b/ext/B/B/Concise.pm
@@ -635,8 +635,8 @@ $priv{$_}{16} = "TARGMY"
"exec", "kill", "getppid", "getpgrp", "setpgrp", "getpriority",
"setpriority", "time", "sleep");
$priv{$_}{4} = "REVERSED" for ("enteriter", "iter");
-@{$priv{"const"}}{2,4,8,16,64} =
- ("NOVER","SHORT","STRICT","ENTERED","BARE");
+@{$priv{"const"}}{2,4,8,16,64,128} =
+ ("NOVER","SHORT","STRICT","ENTERED","BARE","FOLD");
$priv{"flip"}{64} = $priv{"flop"}{64} = "LINENUM";
$priv{"list"}{64} = "GUESSED";
$priv{"delete"}{64} = "SLICE";
diff --git a/ext/B/t/optree_constants.t b/ext/B/t/optree_constants.t
index ebcf042d10..a986193950 100644
--- a/ext/B/t/optree_constants.t
+++ b/ext/B/t/optree_constants.t
@@ -110,12 +110,12 @@ for $func (sort keys %$want) {
3 <1> leavesub[2 refs] K/REFC,1 ->(end)
- <\@> lineseq KP ->3
1 <;> dbstate(main 833 (eval 44):1) v ->2
-2 <\$> const[$want->{$func}[0] $want->{$func}[1]] s* ->3
+2 <\$> const[$want->{$func}[0] $want->{$func}[1]] s*/FOLD ->3
EOT_EOT
3 <1> leavesub[2 refs] K/REFC,1 ->(end)
- <\@> lineseq KP ->3
1 <;> dbstate(main 833 (eval 44):1) v ->2
-2 <\$> const($want->{$func}[0] $want->{$func}[1]) s* ->3
+2 <\$> const($want->{$func}[0] $want->{$func}[1]) s*/FOLD ->3
EONT_EONT
}
@@ -143,14 +143,14 @@ checkOptree ( name => 'myyes() as coderef',
# 2 <;> nextstate(main 2 -e:1) v:>,<,%,{ ->3
# 5 <@> print vK ->6
# 3 <0> pushmark s ->4
-# 4 <$> const[SPECIAL sv_yes] s* ->5
+# 4 <$> const[SPECIAL sv_yes] s*/FOLD ->5
EOT_EOT
# 6 <@> leave[1 ref] vKP/REFC ->(end)
# 1 <0> enter ->2
# 2 <;> nextstate(main 2 -e:1) v:>,<,%,{ ->3
# 5 <@> print vK ->6
# 3 <0> pushmark s ->4
-# 4 <$> const(SPECIAL sv_yes) s* ->5
+# 4 <$> const(SPECIAL sv_yes) s*/FOLD ->5
EONT_EONT
@@ -167,14 +167,14 @@ checkOptree ( name => 'myno() as coderef',
# 2 <;> nextstate(main 2 -e:1) v:>,<,%,{ ->3
# 5 <@> print vK ->6
# 3 <0> pushmark s ->4
-# 4 <$> const[SPECIAL sv_no] s* ->5
+# 4 <$> const[SPECIAL sv_no] s*/FOLD ->5
EOT_EOT
# 6 <@> leave[1 ref] vKP/REFC ->(end)
# 1 <0> enter ->2
# 2 <;> nextstate(main 2 -e:1) v:>,<,%,{ ->3
# 5 <@> print vK ->6
# 3 <0> pushmark s ->4
-# 4 <$> const(SPECIAL sv_no) s* ->5
+# 4 <$> const(SPECIAL sv_no) s*/FOLD ->5
EONT_EONT
@@ -212,22 +212,22 @@ my ($expect, $expect_nt) = (<<'EOT_EOT', <<'EONT_EONT');
# 1 <;> nextstate(main 635 optree_constants.t:163) v:>,<,% ->2
# 8 <@> prtf sK ->9
# 2 <0> pushmark sM ->3
-# 3 <$> const[PV "myint %d mystr %s myfl %f pi %f\n"] sM ->4
-# 4 <$> const[IV 42] sM* ->5
-# 5 <$> const[PV "hithere"] sM* ->6
-# 6 <$> const[NV 1.414213] sM* ->7
-# 7 <$> const[NV 3.14159] sM* ->8
+# 3 <$> const[PV "myint %d mystr %s myfl %f pi %f\n"] sM/FOLD ->4
+# 4 <$> const[IV 42] sM*/FOLD ->5
+# 5 <$> const[PV "hithere"] sM*/FOLD ->6
+# 6 <$> const[NV 1.414213] sM*/FOLD ->7
+# 7 <$> const[NV 3.14159] sM*/FOLD ->8
EOT_EOT
# 9 <1> leavesub[1 ref] K/REFC,1 ->(end)
# - <@> lineseq KP ->9
# 1 <;> nextstate(main 635 optree_constants.t:163) v:>,<,% ->2
# 8 <@> prtf sK ->9
# 2 <0> pushmark sM ->3
-# 3 <$> const(PV "myint %d mystr %s myfl %f pi %f\n") sM ->4
-# 4 <$> const(IV 42) sM* ->5
-# 5 <$> const(PV "hithere") sM* ->6
-# 6 <$> const(NV 1.414213) sM* ->7
-# 7 <$> const(NV 3.14159) sM* ->8
+# 3 <$> const(PV "myint %d mystr %s myfl %f pi %f\n") sM/FOLD ->4
+# 4 <$> const(IV 42) sM*/FOLD ->5
+# 5 <$> const(PV "hithere") sM*/FOLD ->6
+# 6 <$> const(NV 1.414213) sM*/FOLD ->7
+# 7 <$> const(NV 3.14159) sM*/FOLD ->8
EONT_EONT
if($] < 5.015) {
@@ -257,14 +257,14 @@ checkOptree ( name => 'arithmetic constant folding in print',
# 1 <;> nextstate(main 937 (eval 53):1) v ->2
# 4 <@> print sK ->5
# 2 <0> pushmark s ->3
-# 3 <$> const[IV 6] s ->4
+# 3 <$> const[IV 6] s/FOLD ->4
EOT_EOT
# 5 <1> leavesub[1 ref] K/REFC,1 ->(end)
# - <@> lineseq KP ->5
# 1 <;> nextstate(main 937 (eval 53):1) v ->2
# 4 <@> print sK ->5
# 2 <0> pushmark s ->3
-# 3 <$> const(IV 6) s ->4
+# 3 <$> const(IV 6) s/FOLD ->4
EONT_EONT
checkOptree ( name => 'string constant folding in print',
@@ -276,14 +276,14 @@ checkOptree ( name => 'string constant folding in print',
# 1 <;> nextstate(main 942 (eval 55):1) v ->2
# 4 <@> print sK ->5
# 2 <0> pushmark s ->3
-# 3 <$> const[PV "foobar"] s ->4
+# 3 <$> const[PV "foobar"] s/FOLD ->4
EOT_EOT
# 5 <1> leavesub[1 ref] K/REFC,1 ->(end)
# - <@> lineseq KP ->5
# 1 <;> nextstate(main 942 (eval 55):1) v ->2
# 4 <@> print sK ->5
# 2 <0> pushmark s ->3
-# 3 <$> const(PV "foobar") s ->4
+# 3 <$> const(PV "foobar") s/FOLD ->4
EONT_EONT
checkOptree ( name => 'boolean or folding',
@@ -321,7 +321,7 @@ checkOptree ( name => 'lc*,uc*,gt,lt,ge,le,cmp',
# - <@> lineseq KP ->r
# 1 <;> nextstate(main 916 optree_constants.t:307) v:>,<,%,{ ->2
# 4 <2> sassign vKS/2 ->5
-# 2 <$> const[PV "FOO.Bar.low.lOW"] s ->3
+# 2 <$> const[PV "FOO.Bar.low.lOW"] s/FOLD ->3
# - <1> ex-rv2sv sKRM*/1 ->4
# 3 <#> gvsv[*s] s ->4
# 5 <;> nextstate(main 916 optree_constants.t:308) v:>,<,%,{ ->6
@@ -345,13 +345,13 @@ checkOptree ( name => 'lc*,uc*,gt,lt,ge,le,cmp',
# m <0> pushmark s ->n
# n <$> const[PV "b-cmp-a"] s ->o
# p <;> nextstate(main 916 optree_constants.t:313) v:>,<,%,{ ->q
-# q <$> const[PVNV 0] s/SHORT ->r
+# q <$> const[PVNV 0] s/FOLD,SHORT ->r
EOT_EOT
# r <1> leavesub[1 ref] K/REFC,1 ->(end)
# - <@> lineseq KP ->r
# 1 <;> nextstate(main 916 optree_constants.t:307) v:>,<,%,{ ->2
# 4 <2> sassign vKS/2 ->5
-# 2 <$> const(PV "FOO.Bar.low.lOW") s ->3
+# 2 <$> const(PV "FOO.Bar.low.lOW") s/FOLD ->3
# - <1> ex-rv2sv sKRM*/1 ->4
# 3 <$> gvsv(*s) s ->4
# 5 <;> nextstate(main 916 optree_constants.t:308) v:>,<,%,{ ->6
@@ -375,7 +375,7 @@ EOT_EOT
# m <0> pushmark s ->n
# n <$> const(PV "b-cmp-a") s ->o
# p <;> nextstate(main 916 optree_constants.t:313) v:>,<,%,{ ->q
-# q <$> const(SPECIAL sv_no) s/SHORT ->r
+# q <$> const(SPECIAL sv_no) s/FOLD,SHORT ->r
EONT_EONT
checkOptree ( name => 'mixed constant folding, with explicit braces',
@@ -387,14 +387,14 @@ checkOptree ( name => 'mixed constant folding, with explicit braces',
# 1 <;> nextstate(main 977 (eval 28):1) v ->2
# 4 <@> print sK ->5
# 2 <0> pushmark s ->3
-# 3 <$> const[PV "foobar5"] s ->4
+# 3 <$> const[PV "foobar5"] s/FOLD ->4
EOT_EOT
# 5 <1> leavesub[1 ref] K/REFC,1 ->(end)
# - <@> lineseq KP ->5
# 1 <;> nextstate(main 977 (eval 28):1) v ->2
# 4 <@> print sK ->5
# 2 <0> pushmark s ->3
-# 3 <$> const(PV "foobar5") s ->4
+# 3 <$> const(PV "foobar5") s/FOLD ->4
EONT_EONT
__END__
diff --git a/ext/B/t/optree_samples.t b/ext/B/t/optree_samples.t
index 3e0b7f8997..5db514c59d 100644
--- a/ext/B/t/optree_samples.t
+++ b/ext/B/t/optree_samples.t
@@ -617,14 +617,14 @@ checkOptree ( name => '-e use constant j => qq{junk}; print j',
# 1 <0> enter
# 2 <;> nextstate(main 71 -e:1) v:>,<,%,{
# 3 <0> pushmark s
-# 4 <$> const[PV "junk"] s*
+# 4 <$> const[PV "junk"] s*/FOLD
# 5 <@> print vK
# 6 <@> leave[1 ref] vKP/REFC
EOT_EOT
# 1 <0> enter
# 2 <;> nextstate(main 71 -e:1) v:>,<,%,{
# 3 <0> pushmark s
-# 4 <$> const(PV "junk") s*
+# 4 <$> const(PV "junk") s*/FOLD
# 5 <@> print vK
# 6 <@> leave[1 ref] vKP/REFC
EONT_EONT