-
-
Notifications
You must be signed in to change notification settings - Fork 5.5k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
RFC: Also change lowering of getproperty
So after thinking about #37268, I was wondering what would happen if one applied the same trick to the lowering of `getproperty` as well. This PR starts at that, but is mostly a placeholder for discussion of whether this is something we want to do. In particular, this PR lowers `a.b` to: ``` getproperty(a)(a, :b) ``` with a default implementation of ``` getproperty(a) = getfield ``` The inference benefit is as expected. Timing end-to-end inference&optimize time of: ``` struct Foo; end f(a::Foo) = a.x ``` shows that time to infer `f` drops by about a third (because it doesn't need to infer getproperty twice). Overall build time of the system image drops by 6% for me. If we do decide to go this way, things that would still need to be fixed: - [] Do the same for `setproperty!` - [] `ccall` doesn't like this lowering. Didn't look into it too closely - [] Needs a fallback to backwards compatibility. I'm thinking something along the lines of ``` getproperty(x) = hasmethod(getproperty, Tuple{typeof(x), Symbol}) ? getproperty : getfield ``` but obviously it would need inference integration to be fast.
- Loading branch information
Showing
9 changed files
with
24 additions
and
12 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
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