You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Encode BRANCHENTRY bits as bitmask for deduplicated entries.
Reduces BAT section size:
- large binary: to 11834216 bytes (0.31x original),
- medium binary: to 1565584 bytes (0.26x original),
- small binary: to 336 bytes (0.23x original).
Test Plan: Updated bolt/test/X86/bolt-address-translation.test
Copy file name to clipboardExpand all lines: bolt/docs/BAT.md
+9-4Lines changed: 9 additions & 4 deletions
Original file line number
Diff line number
Diff line change
@@ -61,7 +61,7 @@ Cold functions table header
61
61
```
62
62
63
63
### Functions table
64
-
Hot and cold functions tables share the encoding except difference marked below.
64
+
Hot and cold functions tables share the encoding except differences marked below.
65
65
Header:
66
66
| Entry | Encoding | Description |
67
67
| ------ | ----- | ----------- |
@@ -80,18 +80,23 @@ Hot indices are delta encoded, implicitly starting at zero.
80
80
|`Address`| Continuous, Delta, ULEB128 | Function address in the output binary |
81
81
|`HotIndex`| Delta, ULEB128 | Cold functions only: index of corresponding hot function in hot functions table |
82
82
|`NumEntries`| ULEB128 | Number of address translation entries for a function |
83
+
|`EqualElems`| ULEB128 | Hot functions only: number of equal offsets in the beginning of a function |
84
+
|`BranchEntries`| Bitmask, `alignTo(EqualElems, 8)` bits | Hot functions only: if `EqualElems` is non-zero, bitmask denoting entries with `BRANCHENTRY` bit |
83
85
84
-
Function header is followed by `NumEntries` pairs of offsets for current
85
-
function.
86
+
Function header is followed by `EqualElems` offsets (hot functions only) and
87
+
`NumEntries-EqualElems` (`NumEntries` for cold functions) pairs of offsets for
88
+
current function.
86
89
87
90
### Address translation table
88
91
Delta encoding means that only the difference with the previous corresponding
89
92
entry is encoded. Input offsets implicitly start at zero.
90
93
| Entry | Encoding | Description |
91
94
| ------ | ------| ----------- |
92
95
|`OutputOffset`| Continuous, Delta, ULEB128 | Function offset in output binary |
93
-
|`InputOffset`| Delta, SLEB128 | Function offset in input binary with `BRANCHENTRY` LSB bit |
96
+
|`InputOffset`|Optional, Delta, SLEB128 | Function offset in input binary with `BRANCHENTRY` LSB bit |
94
97
95
98
`BRANCHENTRY` bit denotes whether a given offset pair is a control flow source
96
99
(branch or call instruction). If not set, it signifies a control flow target
97
100
(basic block offset).
101
+
`InputAddr` is omitted for equal offsets in input and output function. In this
102
+
case, `BRANCHENTRY` bits are encoded separately in a `BranchEntries` bitvector.
0 commit comments