PPC64 / hhvm

A virtual machine designed for executing programs written in Hack and PHP.
http://hhvm.com
Other
4 stars 3 forks source link

Performance analysis for vasm jcc #152

Open igorsnunes opened 7 years ago

igorsnunes commented 7 years ago

Currently, a "jcc" executes all the following instructions, even if the branch is unlikely to happen.

li64 1/5
li64 2/5
li64 3/5
li64 4/5
li64 5/5
mtctr
nop for the overflow 1/2
nop for the overflow 2/2
bcctr with conditions

In order to avoid loading adresses when it is unlikely to execute a branch, we may use the following:

bc with negated conditions to the end of this block (+36 bytes)
li64 1/5
li64 2/5
li64 3/5
li64 4/5
li64 5/5
mtctr
nop for the overflow 1/2
nop for the overflow 2/2
bctr unconditionally
gut commented 7 years ago

Just a quick note: a branch (jcc vasm) is already sorted in a way that it's unlikely to branch.