Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix undeterministic tail call identification results exposed in paral…
…lel code parsing The tail call identification algorithm contains two related heuristics: (1) A jump to a block within the same function is not a tail call (2) A jump to a known entry point is a tail call For (1), whether or not the jump target is within the current function depends on the parsing order of other functions, especially the callee functions. To have a consistent tail call identification results, I add a tail call cleaning phase in the parsing finalizing phase. Because we already know the complete function boundary at function finalizing time, we can rectify the bogus tail calls and removed the functions caused by those bogus tail calls. For (2), if a known entry point is created by a bogus tail call, (2) will lead to more bogus tail calls. This is exposed by a special case. Suppose function A contains multiple jumps to block B. Block B has no incoming edges from any other function, nor does it has a symbol associated. So, B should be part of A. One of the jump in A (denoted as J1) will be marked as tail call because it tears down the stack frame before the jump, while other jumps (denoted as non-J1) will not be marked as tail calls. If J1 is parsed before non-J1, block B will be marked as a tail call entry, and all non-J1 will be marked as tail calls because they jump to ``a known entry''. Function A will thus not contain B, and the rectify method mentioned in the previous parapgraph will not work. So, I change to only mark a jump as a tail call when the target is a hint.
- Loading branch information
Showing
5 changed files
with
61 additions
and
3 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