Have I understood this right, if
statements are more dependent on branch prediction and v-table look-up is more dependent on branch target prediction? Regarding v-tables, there is no "branch prediction", just the target prediction?
Trying to understand how a v-table is processed by the CPU.
Branch prediction is predicting whether or not the branch will be taken . Branch target prediction is prediction where the branch is going to. These two things are independent and can occur in all combinations.
Examples of these might be:
goto
statement break
or continue
statement if/else
statement (to jump past the else
clause) switch
statement (if compiled into a jump table) if
statement switch
statement (if compiled into a series of if/else
statements) &&
and ||
operators ?:
operator if (condition) { obj->VirtualFunctionCall(); }
if (condition) { obj->VirtualFunctionCall(); }
into a conditional indirect jump like jne *%eax
if it appears at the end of a function due to tail call optimization.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.