On 27/02/2018 12:43, Laurent Desnogues wrote: > On Tue, Feb 27, 2018 at 12:33 PM, Paolo Bonzini <pbonz...@redhat.com> wrote: >> On 27/02/2018 06:39, Emilio G. Cota wrote: >>> Using a hash table or a binary tree to keep track of the jumps >>> doesn't really pay off, not only due to the increased memory usage, >>> but also because most TBs have only 0 or 1 jumps to them. The maximum >>> number of jumps when booting debian-arm that I measured is 35, but >>> as we can see in the histogram below a TB with that many incoming jumps >>> is extremely rare; the average TB has 0.80 incoming jumps. >>> >>> n_jumps: 379208; avg jumps/tb: 0.801099 >>> dist: [0.0,1.0)|▄█▁▁▁▁▁▁▁▁▁▁▁ ▁▁▁▁▁▁ ▁▁▁ ▁▁▁ ▁|[34.0,35.0] >> >> This makes sense, for example: >> >> while(...) { >> } >> >> 2 basic blocks, 0 and 1 incoming jumps (avg 0.5) >> >> if(...) { >> } >> >> 2 basic blocks, 0 and 1 incoming jumps (avg 0.5) >> >> if(...) { >> } else { >> } >> >> 3 basic blocks, 0, 1 and 1 incoming jumps (avg 0.66) >> >> So 0.8 is actually a lot. :) The long tail is probably for switch >> statements. > > And calls too :-)
Jumps are only chained within the same page, so probably only the smaller buckets can be for calls. Paolo