-
Notifications
You must be signed in to change notification settings - Fork 577
[CoreCLR] On-device decompressed AssemblyStore cache #11967
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
Merged
simonrozsival
merged 9 commits into
main
from
dev/simonrozsival/assembly-store-decompression-cache
Jul 17, 2026
Merged
Changes from all commits
Commits
Show all changes
9 commits
Select commit
Hold shift + click to select a range
4bcb28c
[experiment] On-device decompressed assembly store cache (CoreCLR)
simonrozsival 74d202d
Fix data race in decompressed-assembly cache writer
simonrozsival e560897
Simplify decompressed-assembly cache writer
simonrozsival 34974a6
Split cache file persistence out of writer_loop
simonrozsival 0c94c52
[assembly-store] Harden decompression cache
simonrozsival 6424e95
[assembly-store] Remove redundant writer.Flush before ComputeContentId
simonrozsival 355ee82
[assembly-store] Address code review feedback
simonrozsival 1811d90
[assembly-store] Fix CoreCLR application_config field count in tests
simonrozsival 2405aba
[assembly-store] Address decompression cache review feedback
simonrozsival File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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 hidden or 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 hidden or 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
57 changes: 57 additions & 0 deletions
57
...n.Android.Build.Tasks/Tests/Xamarin.Android.Build.Tests/Tasks/CreateAssemblyStoreTests.cs
This file contains hidden or 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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,57 @@ | ||
| #nullable enable | ||
| using System; | ||
| using System.Collections.Generic; | ||
| using System.IO; | ||
| using System.IO.Hashing; | ||
| using System.Linq; | ||
|
|
||
| using Microsoft.Build.Framework; | ||
| using Microsoft.Build.Utilities; | ||
| using NUnit.Framework; | ||
| using Xamarin.Android.Tasks; | ||
|
|
||
| namespace Xamarin.Android.Build.Tests.Tasks; | ||
|
|
||
| [TestFixture] | ||
| public class CreateAssemblyStoreTests : BaseTest | ||
| { | ||
| [Test] | ||
| public void ContentIdMatchesStoreContents () | ||
| { | ||
| string testDirectory = Path.Combine (Root, "temp", nameof (ContentIdMatchesStoreContents)); | ||
| Directory.CreateDirectory (testDirectory); | ||
|
|
||
| string assemblyPath = Path.Combine (testDirectory, "Example.dll.zst"); | ||
| byte [] assemblyData = [1, 3, 3, 7, 9, 11, 17, 23]; | ||
| File.WriteAllBytes (assemblyPath, assemblyData); | ||
|
|
||
| var metadata = new Dictionary<string, string> { | ||
| ["Abi"] = "arm64-v8a", | ||
| }; | ||
| var task = new CreateAssemblyStore { | ||
| BuildEngine = new MockBuildEngine (TestContext.Out), | ||
| AppSharedLibrariesDir = Path.Combine (testDirectory, "stores"), | ||
| ResolvedFrameworkAssemblies = [], | ||
| ResolvedUserAssemblies = [new TaskItem (assemblyPath, metadata)], | ||
| SupportedAbis = ["arm64-v8a"], | ||
| TargetRuntime = "CoreCLR", | ||
| UseAssemblyStore = true, | ||
| }; | ||
|
|
||
| Assert.IsTrue (task.Execute (), "CreateAssemblyStore should succeed."); | ||
|
|
||
| string storePath = task.AssembliesToAddToArchive.Single ().ItemSpec; | ||
| byte [] store = File.ReadAllBytes (storePath); | ||
| using var reader = new BinaryReader (new MemoryStream (store)); | ||
| Assert.AreEqual (0x41424158u, reader.ReadUInt32 (), "Unexpected assembly store magic."); | ||
| Assert.AreEqual (0x80010004u, reader.ReadUInt32 (), "Unexpected arm64 assembly store version."); | ||
| reader.BaseStream.Seek (3 * sizeof (uint), SeekOrigin.Current); | ||
| ulong contentId = reader.ReadUInt64 (); | ||
|
|
||
| Assert.AreEqual ( | ||
| XxHash3.HashToUInt64 (store.AsSpan (5 * sizeof (uint) + sizeof (ulong))), | ||
| contentId, | ||
| "The content ID should hash everything after the assembly store header." | ||
| ); | ||
| } | ||
| } |
This file contains hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.