If a #dispatch branch is a call to another word which is not an intrinsic, we avoid generating the dispatch branch and just jump to the word directly
parent
666100a07b
commit
4e55cd973b
|
@ -156,19 +156,30 @@ M: #if emit-node
|
||||||
} cond iterate-next ;
|
} cond iterate-next ;
|
||||||
|
|
||||||
! #dispatch
|
! #dispatch
|
||||||
|
: trivial-dispatch-branch? ( nodes -- ? )
|
||||||
|
dup length 1 = [
|
||||||
|
first dup #call? [
|
||||||
|
word>> "intrinsic" word-prop not
|
||||||
|
] [ drop f ] if
|
||||||
|
] [ drop f ] if ;
|
||||||
|
|
||||||
: dispatch-branch ( nodes word -- label )
|
: dispatch-branch ( nodes word -- label )
|
||||||
gensym [
|
over trivial-dispatch-branch? [
|
||||||
[
|
drop first word>>
|
||||||
V{ } clone node-stack set
|
] [
|
||||||
##prologue
|
gensym [
|
||||||
emit-nodes
|
[
|
||||||
basic-block get [
|
V{ } clone node-stack set
|
||||||
##epilogue
|
##prologue
|
||||||
##return
|
emit-nodes
|
||||||
end-basic-block
|
basic-block get [
|
||||||
] when
|
##epilogue
|
||||||
] with-cfg-builder
|
##return
|
||||||
] keep ;
|
end-basic-block
|
||||||
|
] when
|
||||||
|
] with-cfg-builder
|
||||||
|
] keep
|
||||||
|
] if ;
|
||||||
|
|
||||||
: dispatch-branches ( node -- )
|
: dispatch-branches ( node -- )
|
||||||
children>> [
|
children>> [
|
||||||
|
|
Loading…
Reference in New Issue