-
-
Notifications
You must be signed in to change notification settings - Fork 121
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Create ProfileRuntime to handle all profiling operations
Summary: Trying to consolidate all the profiling APIs into one place. The idea is to use the same class both for recording profiling information and for fetching profiling information when emitting HIR. Currently the two operations are independent, profiling data captured during program execution is recorded as part of `TypeProfiler` objects in the `Runtime` singleton, and profiling data used by HIR generation is fetched from the `ProfileData` singleton after it's been read from a file. The goal is to enable HIR generation to use the profiling data that's been captured while the program has been executing. This will be a future change. The new API works mostly the same as before, but there are behavior changes to call out. * Clearing profile data now always clears both the `TypeProfiler` objects and `ProfileData`. This is fine because we only ever use one of them during execution, never both. There's an extra check in `ProfileRuntime` that prevents the use of `profileInstr()` after `deserialize()` has been called. It doesn't really make sense to load profiling information ahead-of-time and to try to combine it with profiling information that's been gathered during the current execution. * `HIRBuilder` will now re-fetch the profiling information for a given code object on every bytecode instruction. This is more work than the current API as we're accessing an extra hash map for every bytecode instruction, but it keeps the API cleaner. The `CodeProfile` objects we have for recording profiles don't match the `CodeProfileData` objects we get from file-based profiles. We could give them a shared interface but that would require virtual methods. * `ProfileRuntime` always returns a single vector of expected types, rather than a vector of vectors of all possible type combinations. This means that `HIRBuilder` will no longer emit `HintType` instructions for polymorphic bytecode instructions. `HintType` is currently unused, so the resulting machine code should look the same. * If there's no type associated with a specific value in the types vector returned by `getProfiledTypes()`, then it will be returned as `TTop`. These are skipped over when generating HIR like what was being done with `PyFrameObject*` values that were null. Reviewed By: swtaarrs Differential Revision: D47556446 fbshipit-source-id: 3b0831e1b148c2738f140fa964d3eed97a67a55e
- Loading branch information
1 parent
24da019
commit d498b39
Showing
14 changed files
with
497 additions
and
275 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.