[Refactor] Peephole Semantics
Original Reporter info from Mantis: CuriousKit @CuriousKit
-
Reporter name: J. Gareth Moreton
Original Reporter info from Mantis: CuriousKit @CuriousKit
- Reporter name: J. Gareth Moreton
Description:
This patch, mentioned briefly in the core mailing list, seeks to improve maintainability, safety and efficiency in the peephole optimizer by slightly modifying some function headers based on their intended purpose. See "Additional Information" for a complete list.
Code generatd by the compiler should be completely identical.
Steps to reproduce:
Apply patch and confirm correct compilation on all platforms.
Additional information:
- Non-virtual methods and class methods that don't need to access any fields from the current object are now static methods, thus removing the hidden "Self" parameter and reducing overhead. This includes a large number of frequently-used functions such as SkipEntryExitMarker and SuperRegistersEqual.
- GetNextInstruction, GetLastInstruction, SkipEntryExitMarker and SkipLabels have had their 'var' parameter changed to an 'out' parameter because they shouldn't depend on its input value. This will cause the compiler to throw warnings if you start using the value without initialising it first, and may open up optimisation opportunities in the future (e.g. storing written values in a temporary register and only writing it to the actual variable when the routine exits).
Mantis conversion info:
- Mantis ID: 36353
- OS: Microsoft Windows
- OS Build: 10 Professional
- Build: r43582
- Platform: Cross-platform
- Version: 3.3.1
- Fixed in version: 3.3.1
- Fixed in revision: 43595 (#7e6eeebd)