Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Custom setters implement Equals/GetHashCode and have optimized code gen #8675

Merged
merged 2 commits into from
Aug 9, 2022

Conversation

MrJul
Copy link
Member

@MrJul MrJul commented Aug 4, 2022

What does the pull request do?

This pull request updates the XamlX IL compiler to kekekeks/XamlX#65 (please see that PR for full details).

It also implements Equals, GetHashCode and IXamlILOptimizedEmitablePropertySetter on custom property setters to take advantage of the XamlX changes and generate fewer IL instructions.

What is the updated/expected behavior with this PR?

Equals and GetHashCode overrides allow the IL compiler to cache the generated dynamic setter methods when possible.
IXamlILOptimizedEmitablePropertySetter generates smaller IL code for static setters.
Everything should work the same as before, but with smaller assemblies emitted from XAML code.

Setters for IBinding and UnsetValueType now use AllowRuntimeNull = false to keep the same behavior as before (that setting wasn't respected before the XamlX PR: the generated code didn't allow null in practice).

Tests

New unit tests have been added to XamlX.
Avalonia already has all the relevant tests needed, which should all pass.

@avaloniaui-team
Copy link
Contributor

You can test this PR using the following package version. 0.10.999-cibuild0022862-beta. (feed url: https://nuget.avaloniaui.net/repository/avalonia-all/index.json) [PRBUILDID]

@MrJul
Copy link
Member Author

MrJul commented Aug 5, 2022

Rebased the PR onto master and implemented IXamlILOptimizedEmitablePropertySetter on the new AdderSetter class added by the lazy resources feature.

@avaloniaui-team
Copy link
Contributor

You can test this PR using the following package version. 0.10.999-cibuild0022883-beta. (feed url: https://nuget.avaloniaui.net/repository/avalonia-all/index.json) [PRBUILDID]

@danwalmsley
Copy link
Member

@MrJul we are unable to merge this because for some reason your repo settings prevent us from updating your branch to master.

@MrJul
Copy link
Member Author

MrJul commented Aug 9, 2022

@danwalmsley Sorry, "allow edit by maintainers" was unchecked, should be all good now!

@danwalmsley danwalmsley merged commit 8826921 into AvaloniaUI:master Aug 9, 2022
@avaloniaui-team
Copy link
Contributor

You can test this PR using the following package version. 0.10.999-cibuild0023050-beta. (feed url: https://nuget.avaloniaui.net/repository/avalonia-all/index.json) [PRBUILDID]

@MrJul MrJul deleted the size-optimization branch August 15, 2022 12:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants