Handbook
Glossary
live-branches ( #branch -- indices )
Vocabulary
compiler
.
tree
.
propagation
.
branches
Inputs
#branch
a
#branch
Outputs
indices
a
sequence
Word description
Outputs a sequence of true and false values indicating which of the branches that are possibly live.
Definition
IN:
compiler.tree.propagation.branches
GENERIC:
live-branches
( #branch -- indices )
Methods
USING:
accessors
arrays
combinators
compiler.tree
compiler.tree.propagation.branches
compiler.tree.propagation.info
kernel
math
sequences
;
M:
#dispatch
live-branches
[
children>>
]
[
in-d>>
first
value-info
]
bi
{
{
[
dup
class>>
null-class?
]
[
drop
length
f
<array>
]
}
{
[
dup
literal>>
integer?
not
]
[
drop
length
t
<array>
]
}
{
[
2dup
literal>>
swap
bounds-check?
not
]
[
drop
length
t
<array>
]
}
[
literal>>
swap
length
f
<array>
[
[
t
]
2dip
set-nth
]
keep
]
}
cond
;
USING:
accessors
combinators
compiler.tree
compiler.tree.propagation.branches
compiler.tree.propagation.info
kernel
sequences
;
M:
#if
live-branches
in-d>>
first
value-info
class>>
{
{
[
dup
null-class?
]
[
{
f
f
}
]
}
{
[
dup
true-class?
]
[
{
t
f
}
]
}
{
[
dup
false-class?
]
[
{
f
t
}
]
}
[
{
t
t
}
]
}
cond
nip
;