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

db4
Slava Pestov 2008-11-06 11:48:55 -06:00
parent 666100a07b
commit 4e55cd973b
1 changed files with 23 additions and 12 deletions

View File

@ -156,7 +156,17 @@ 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 )
over trivial-dispatch-branch? [
drop first word>>
] [
gensym [ gensym [
[ [
V{ } clone node-stack set V{ } clone node-stack set
@ -168,7 +178,8 @@ M: #if emit-node
end-basic-block end-basic-block
] when ] when
] with-cfg-builder ] with-cfg-builder
] keep ; ] keep
] if ;
: dispatch-branches ( node -- ) : dispatch-branches ( node -- )
children>> [ children>> [