Skip to content

Commit 5de179c

Browse files
kripkenyuri91
authored andcommitted
Clarify the meaning of branch hints
1 parent 707a3fb commit 5de179c

File tree

2 files changed

+8
-8
lines changed

2 files changed

+8
-8
lines changed

document/metadata/code/binary.rst

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ A Branch Hint is a code metadata item with format *branch_hint*.
4545

4646
It can only be attached to |BRIF| and |IF| instructions.
4747

48-
Its payload indicates whether the branch is likely or unlikely to be taken.
48+
Its payload indicates whether the branch's condition is likely or unlikely to be true.
4949

5050
All branch hints for a module are contained in a single code metadata section
5151
with name *'metadata.code.branch_hint'*.
@@ -64,6 +64,6 @@ with name *'metadata.code.branch_hint'*.
6464
\end{array}
6565
.. index:: ! branch hint section
6666

67-
A value of |Blikely| means that the branch is likely to be taken, while a
67+
A value of |Blikely| means that the branch's condition is likely to be true, while a
6868
value of |Bunlikely| means the opposite. A branch with no hints is considered
69-
equally likely to be taken or not.
69+
equally likely to have its condition be true or not.

proposals/branch-hinting/Overview.md

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,7 @@ https://github.com/WebAssembly/meetings/blob/main/main/2021/CG-11-09.md
8686
The *branch hint section* is a **custom section** whose name string is `metadata.code.branch_hint`.
8787
The branch hints section should appear only once in a module, and only before the code section.
8888

89-
The purpose of this section is to aid the compilation of conditional branch instructions, by providing a hint that a branch is very likely (or unlikely) to be taken.
89+
The purpose of this section is to aid the compilation of conditional branch instructions, by providing a hint that a branch's condition is very likely (or unlikely) to be true.
9090

9191
The section contains a vector of *function branch hints* each representing the branch hints for a single function.
9292

@@ -104,10 +104,10 @@ Each *branch hint* structure consists of
104104
* A |U32| with value `1`,
105105
* a |U32| indicating the meaning of the hint:
106106

107-
| value | meaning |
108-
|-------|-------------------|
109-
| 0 | likely not taken |
110-
| 1 | likely taken |
107+
| value | meaning |
108+
|-------|---------------------------|
109+
| 0 | condition is likely false |
110+
| 1 | condition is likely true |
111111

112112
Elements of the vector of *branch hint* must appear in increasing byte offset order,
113113
and a byte offset can appear at most once. A |BRIF| or |IF| instruction must be present

0 commit comments

Comments
 (0)