TargetProfile: use SrcKey in public API to represent code position
commitc87f552d27a783a2491b5c7f3a700e2e5926de5b
authorJan Oravec <jan@fb.com>
Mon, 12 Oct 2020 17:37:31 +0000 (12 10:37 -0700)
committerFacebook GitHub Bot <facebook-github-bot@users.noreply.github.com>
Mon, 12 Oct 2020 17:39:31 +0000 (12 10:39 -0700)
tree6c4fcc799a841833e6cbc7ad9e446ff8119d2e22
parent261e1686ebe38b132dc10c920e497f95cbb203b6
TargetProfile: use SrcKey in public API to represent code position

Summary:
TargetProfile is taking an Offset, which can't properly represent prologues and
later function entries. Prologues currently use the Func's entry bytecode
position in TargetProfiles, which does not cause any issues, as TargetProfiles
are also keyed by TransIDs and prologues are in different translations, so they
have different TransIDs.

However, this won't work with function entries, as they will be in the same
translation as the first opcode. This could possibly cause a profiling clash.

So, use a special Offset for prologues (and later function entries) and take
SrcKey in all public APIs so that we can determine this situation. We can't use
SrcKey everywhere, as that would increase the size of the underlying RDS key
represented by the rds::Profile structure and also rds::Symbol, as rds::Profile
is its biggest component.

Reviewed By: paulbiss

Differential Revision: D24245433

fbshipit-source-id: fb956ae4813f2bd3096ac1123804bc996c630d00
hphp/runtime/vm/jit/prof-data-serialize.cpp
hphp/runtime/vm/jit/region-hot-cfg.cpp
hphp/runtime/vm/jit/target-profile.h