-
Notifications
You must be signed in to change notification settings - Fork 573
[TrimmableTypeMap] Implement reflection-free TrimmableTypeMapValueManager and TrimmableTypeMapTypeManager #11617
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
Closed
Closed
Changes from 106 commits
Commits
Show all changes
169 commits
Select commit
Hold shift + click to select a range
6bae3ac
[TrimmableTypeMap] Remove post-trim generation pass
simonrozsival 579ea8a
Bump external/Java.Interop from `b881d21` to `d7dbad5`
dependabot[bot] f79c0cc
Implement Android JavaMarshal value manager split
simonrozsival 676dca4
Use pure trimmable typemap value manager
simonrozsival 01dfd04
Use pure trimmable typemap type manager
simonrozsival b77c841
Propagate trimmable typemap DAM annotations
simonrozsival 0554d57
Prefer Requires annotations for reflection managers
simonrozsival 7d81397
Remove manager suppression attributes
simonrozsival 1fe2ef5
Remove invoker lookup suppression attributes
simonrozsival 7228982
Use feature guards for runtime manager selection
simonrozsival 326f0fd
Inline CoreCLR JavaMarshal peer delegation
simonrozsival 6a8ec68
Throw unreachable from trimmable native registration
simonrozsival 7d3d1e3
Remove SimpleValueManager
simonrozsival 725d433
Simplify changes to the ManagedTypeManager
simonrozsival caaea85
Remove the option to use ManagedTypeManager
simonrozsival b489d1f
Cleanup value managers
simonrozsival f1ce2a2
Refine trimmable typemap runtime paths
simonrozsival 0a1072a
Reuse Java.Interop value marshalers in trimmable runtime
simonrozsival 78cb7d6
Support JavaObjectArray in trimmable value marshaling
simonrozsival 169bc8f
Generalize trimmable primitive value marshaling
simonrozsival 869f183
Apply trimmable test exclusions to new runner
simonrozsival 93ddc73
Remove LayoutInflater test contamination
simonrozsival 933a38d
Address trimmable review cleanup
simonrozsival 65a2cf5
Flow excluded NUnit categories from MSBuild
simonrozsival 6b4aedb
Extract trimmable primitive marshaler helpers
simonrozsival 80997b8
Address trimmable review feedback
simonrozsival 6071fd0
Support trimmable custom value marshalers
simonrozsival d45a519
Unwrap trimmable proxy throwables
simonrozsival 4282882
Support trimmable type manager lookups
simonrozsival 152845b
Use trimmable CrossReferenceBridge fixture
simonrozsival 8105789
Use trimmable method binding fixtures
simonrozsival 7a7ca23
Support trimmable marshaler expressions
simonrozsival fece7d7
Remove generated value marshaler registry
simonrozsival b134621
Address trimmable test review feedback
simonrozsival 6e1a69a
Fix trimmable typemap CI failures
simonrozsival 8447f63
Simplify generated proxy trim suppression
simonrozsival 18f39bc
Address trimmable runtime review feedback
simonrozsival 4e40404
Clean stale trimmable typemap Java sources
simonrozsival 7496a32
Simplify trimmable marshaler integration
simonrozsival f2c59bd
Re-enable trimmable GC bridge coverage
simonrozsival 298f262
Re-enable trimmable replacement method lookup test
simonrozsival 7ab9659
Re-enable trimmable method binding coverage
simonrozsival 12946a7
Remove JavaProxyThrowable Exception wrapper
simonrozsival 1cae90b
Remove ManagedPeer workarounds from trimmable PR
simonrozsival a53fb70
Document built-in type signature mapping choice
simonrozsival 25a0526
Split Java marshal value manager types
simonrozsival a5b39d1
Simplify trimmable object array marshaling
simonrozsival 5dff3a8
Return object references from trimmable marshaling
simonrozsival f928f99
Clarify trimmable local reference ownership
simonrozsival 66c29f3
Merge origin/main into dev/simonrozsival/java-interop-1441-android
simonrozsival f7b0fec
Fix AndroidRuntime merge follow-ups
simonrozsival 39583fa
Update tests + cleanup
simonrozsival db14c80
Remove unnecessary code
simonrozsival 4bbc8fa
Merge remote-tracking branch 'origin/main' into android-remove-second…
Copilot a23c1f2
Merge latest main, resolve conflicts (keep post-trim pass removal)
Copilot 7412129
Fix more stuff
simonrozsival 6a0b25f
Merge remote-tracking branch 'origin/main' into dev/simonrozsival/jav…
simonrozsival dcdfbae
Use Java.Interop from main
simonrozsival 89e133e
Merge PR #11604 post-trim typemap cleanup
simonrozsival d95a356
Remove unnecessary MakeArrayType
simonrozsival 2ba985f
Annotate JNINativeWrapper.CreateDelegate method
simonrozsival 8ec4aee
Drop assertions which expect AOT and trimming warnings
simonrozsival 200b6a4
Update apkdesc files
simonrozsival 0aa8bad
Avoid more MakeArrayType
simonrozsival ebc9b9e
Suppress expected runtime manager trim warnings
simonrozsival 46bb3ff
We removed AOT warning, do not assert that there will be a warning
simonrozsival 1392c44
Address trimmable typemap review feedback
simonrozsival d4dd398
[TrimmableTypeMap] Support built-in reference arrays
simonrozsival b76c959
[TrimmableTypeMap] Prefer dynamic array creation on CoreCLR
simonrozsival 94eeb39
Merge branch 'main' of github.com:dotnet/android into dev/simonrozsiv…
simonrozsival 9b41a8f
[typemap] Fix trimmable typemap CI failures
simonrozsival 2a12f82
[typemap] Include runtime version in root fingerprint
simonrozsival 48a1e77
[typemap] Extract deterministic hash builder
simonrozsival 46bf686
[typemap] Restore span-based MVID hashing
simonrozsival a9336e4
[typemap] Keep NativeAOT managed typemap default
simonrozsival c2522ea
[typemap] Restore managed NativeAOT runtime managers
simonrozsival 1d45090
Revert "[typemap] Restore managed NativeAOT runtime managers"
simonrozsival a0d0fb7
Revert "[typemap] Keep NativeAOT managed typemap default"
simonrozsival f54ef34
[deps] Update android-tools for task hashing compatibility
simonrozsival b50a4c8
[runtime] Proxy opaque objects in trimmable value manager
simonrozsival 0152cc1
Merge remote-tracking branch 'origin/main' into dev/simonrozsival/jav…
simonrozsival ef8cbb3
[deps] Update android-tools task hashing fix
simonrozsival 78efb4f
[runtime] Override Java proxy object methods
simonrozsival 705fc27
[runtime] Override Java proxy object methods
simonrozsival 9d5110b
Remove DAM where they're causing more harm than good
simonrozsival c6bafae
Merge remote-tracking branch 'origin/main' into dev/simonrozsival/jav…
simonrozsival 97eb32e
[runtime] Disable ManagedPeer for trimmable apps
simonrozsival 158fa0c
Merge remote-tracking branch 'origin/dev/simonrozsival/java-interop-1…
simonrozsival 828dbe9
Improve array handling
simonrozsival 8a8cbde
Clean-up trimmable value manager
simonrozsival 33de611
Add support for nullable primitive types without unwrapping Nullable
simonrozsival 2d5fef1
Fix incrementality
simonrozsival 6645710
Temporary bump to external/Java.Interop
simonrozsival 840d342
Revert "Temporary bump to external/Java.Interop"
simonrozsival 18f3b9d
Merge branch 'main' of github.com:dotnet/android into dev/simonrozsiv…
simonrozsival 8fe902d
Temporary bump to external/Java.Interop
simonrozsival f8964c7
Temporary bump to external/Java.Interop
simonrozsival 9d3217b
Reuse array handling code between the type and value managers
simonrozsival 4f23922
Redo array type mapping for Native AOT
simonrozsival dcf1c96
Bump Java.Interop to 8d54473
simonrozsival 9bd6825
Preserve trimmable array proxies for wrapper types
simonrozsival 8d5969d
Fix array proxy association duplication
simonrozsival a05be93
Scope array proxy associations to rank maps
simonrozsival dd3155c
Use reverse typemap entries for peer proxy lookup
simonrozsival fc65df3
Use array types as array proxy trim targets
simonrozsival 5c20adc
Revert "Use array types as array proxy trim targets"
simonrozsival ea922d4
Fix collections of generic types
simonrozsival 87cea50
Fix trimmable collection wrapper reuse
simonrozsival e966fd5
Skip unresolvable trimmable typemap peers
simonrozsival 54a0df4
Update package versions to avoid test failures
simonrozsival f1a1491
Simplify SmokeTestBuildWithSpecialCharacters test
simonrozsival 62652db
Refactor ModelBuilder and SingleUniverseTypeMap to remove ManagedType…
simonrozsival 7c75e61
Fix inherited generic base typemap refs
simonrozsival 6d5ca25
Fix package version
simonrozsival 4c0d418
Restore typemap proxy associations
simonrozsival 003e118
Fix msbuild
simonrozsival 48288f0
Update msbuild targets
simonrozsival 45a7e62
Fix typo
simonrozsival 68c438b
Avoid null dereference
simonrozsival 807df5f
Fix trimmable value manager create semantics
simonrozsival c82b464
Fix trimmable manifest generation parity
simonrozsival ef8085f
Fix NativeAOT trimmable build integration
simonrozsival d13fde4
Revert accidental android tools submodule bump
simonrozsival a7ea92e
Preserve NativeAOT proguard keep rules
simonrozsival 21e297b
Write NativeAOT keep rules to primary proguard config
simonrozsival d86671f
Stop R8 from generating NativeAOT app keep config
simonrozsival 5c8463c
Disable NativeAOT DGML proguard filtering
simonrozsival 24186b8
Accept NativeAOT R8 mapping output in DotNetBuild test
simonrozsival 7ef0463
[typemap] Restore NativeAOT managed typemap default
simonrozsival 71adeb2
Switch back to ManagedTypeManager as the default for NativeAOT
simonrozsival 425542a
Default NativeAOT to trimmable typemaps
simonrozsival 05d1451
[Tests] Skip NativeAOT tests that inspect illink's `linked/` output
simonrozsival fbcd702
[Tests] Fully skip BuildReleaseArm64 on NativeAOT
simonrozsival fe41750
[TrimmableTypeMap] Fix manifest content gaps on NativeAOT (B2)
simonrozsival 4a1f51e
[TrimmableTypeMap] Complete activity manifest attribute mappings (B2)
simonrozsival 7d44fd4
[TrimmableTypeMap] Produce android/AndroidManifest.xml for the legacy…
simonrozsival 9bf113b
[TrimmableTypeMap] Resolve parentActivityName and fix persistableMode…
simonrozsival 107ece2
Fix uses-sdk without specifying min version
simonrozsival 5dd97b0
[build] Guard staging-dir globs when extraction is skipped
simonrozsival 6a1555a
[Tests] Adjust NativeAOT cases for unsupported/different-trimmer beha…
simonrozsival 49f3378
[TrimmableTypeMap] Honor AndroidApplicationJavaClass for the JCW base…
simonrozsival 44c9a98
[Tests] Expect trimmable scrc64 JCW package names on NativeAOT (J2)
simonrozsival b7977de
[TrimmableTypeMap] Sort component manifest attributes alphabetically
simonrozsival 494d0e6
[TrimmableTypeMap] Warn XA1010 for invalid manifest placeholders
simonrozsival c892216
[TrimmableTypeMap] Resolve placeholder package names in the manifest
simonrozsival ae860a4
[TrimmableTypeMap] Normalize manifest placeholder values like the leg…
simonrozsival 570afc8
[TrimmableTypeMap] Don't touch typemap assemblies so incremental buil…
simonrozsival 79a144c
[TrimmableTypeMap] Direct-dispatch interface-implementation proxy met…
simonrozsival 552e290
[TrimmableTypeMap] Use non-generic JavaPeerProxy base for interface p…
simonrozsival 3ea9d59
[TrimmableTypeMap] Run FixLegacyResourceDesigner before ILC on NativeAOT
simonrozsival 40cf921
[Tests] Fix GenerateTrimmableTypeMapTests for string[] ManifestPlaceh…
simonrozsival 97ba631
Remove more suppressions
simonrozsival 99511eb
Fix null ref warning
simonrozsival cb09b6e
[TrimmableTypeMap] Merge library manifests for the legacy manifest me…
simonrozsival 7611484
[Tests] ExportedErrorMessage: assert AMM0000 code, not exact line, on…
simonrozsival 9a0d987
[TrimmableTypeMap] Don't direct-dispatch interface-implementation met…
simonrozsival b5d106f
Merge branch 'main' into dev/simonrozsival/java-interop-1441-android
simonrozsival 5293815
[Tests] Ignore flaky BuildReleaseArm64
simonrozsival efae987
[TrimmableTypeMap] Fix DesignTimeBuildSignAndroidPackage on NativeAOT
simonrozsival 9e74ff7
[TrimmableTypeMap] Keep user AndroidJavaSource Java under R8 shrinking
simonrozsival 31bfd46
[Mono.Android] Fix IL2077 build break in JavaConvert.ArrayElementConv…
simonrozsival a6cd268
[TrimmableTypeMap] Don't stage shrunk assemblies into the shared runt…
simonrozsival 140d9a8
[TrimmableTypeMap] Gate IDE-sign typemap target on _OuterIntermediate…
simonrozsival d6bf397
Suppress trimming warnings in CoreCLR branch
simonrozsival f36b5b7
Merge branch 'main' into dev/simonrozsival/java-interop-1441-android
simonrozsival f415d7e
Merge branch 'dev/simonrozsival/java-interop-1441-android' of github.…
simonrozsival 9271b3c
Undo unnecessary change
simonrozsival 98f6ad8
[submodule] Align xamarin-android-tools with main (bcce35f5)
simonrozsival 0debcd7
Fix bad merge
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 was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
Submodule Java.Interop
updated
21 files
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
96 changes: 96 additions & 0 deletions
96
src/Microsoft.Android.Sdk.TrimmableTypeMap/Generator/DeterministicHashBuilder.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,96 @@ | ||
| using System; | ||
| using System.Buffers; | ||
| using System.Security.Cryptography; | ||
| using System.Text; | ||
|
|
||
| namespace Microsoft.Android.Sdk.TrimmableTypeMap; | ||
|
|
||
| sealed class DeterministicHashBuilder : IDisposable | ||
| { | ||
| readonly HashAlgorithm hash = SHA256.Create (); | ||
| readonly byte [] intBuffer = new byte [4]; | ||
| readonly byte [] byteBuffer = new byte [1]; | ||
| bool finished; | ||
|
|
||
| public void AddString (string value) | ||
| { | ||
| var bytes = Encoding.UTF8.GetBytes (value); | ||
| AddInt32 (bytes.Length); | ||
| AddBytes (bytes); | ||
| } | ||
|
|
||
| public void AddVersion (Version version) | ||
| { | ||
| AddInt32 (version.Major); | ||
| AddInt32 (version.Minor); | ||
| AddInt32 (version.Build); | ||
| AddInt32 (version.Revision); | ||
| } | ||
|
|
||
| public void AddInt32 (int value) | ||
| { | ||
| intBuffer [0] = (byte) value; | ||
| intBuffer [1] = (byte) (value >> 8); | ||
| intBuffer [2] = (byte) (value >> 16); | ||
| intBuffer [3] = (byte) (value >> 24); | ||
| AddBytes (intBuffer); | ||
| } | ||
|
|
||
| public void AddByte (byte value) | ||
| { | ||
| byteBuffer [0] = value; | ||
| AddBytes (byteBuffer); | ||
| } | ||
|
|
||
| public void AddBytes (byte [] bytes) | ||
| { | ||
| EnsureNotFinished (); | ||
| if (bytes.Length != 0) { | ||
| hash.TransformBlock (bytes, 0, bytes.Length, null, 0); | ||
| } | ||
| } | ||
|
|
||
| public void AddBytes (ReadOnlySpan<byte> bytes) | ||
| { | ||
| EnsureNotFinished (); | ||
| if (bytes.IsEmpty) { | ||
| return; | ||
| } | ||
|
|
||
| var buffer = ArrayPool<byte>.Shared.Rent (Math.Min (bytes.Length, 4096)); | ||
| try { | ||
| while (!bytes.IsEmpty) { | ||
| var count = Math.Min (bytes.Length, buffer.Length); | ||
| bytes.Slice (0, count).CopyTo (buffer); | ||
| hash.TransformBlock (buffer, 0, count, null, 0); | ||
| bytes = bytes.Slice (count); | ||
| } | ||
| } finally { | ||
| ArrayPool<byte>.Shared.Return (buffer); | ||
| } | ||
| } | ||
|
|
||
| public byte [] ToHash () | ||
| { | ||
| if (!finished) { | ||
| hash.TransformFinalBlock ([], 0, 0); | ||
| finished = true; | ||
| } | ||
| if (hash.Hash is not null) { | ||
| return hash.Hash; | ||
| } | ||
| throw new InvalidOperationException ("SHA256 did not produce a hash."); | ||
| } | ||
|
|
||
| void EnsureNotFinished () | ||
| { | ||
| if (finished) { | ||
| throw new InvalidOperationException ("Cannot add data after finalizing the hash."); | ||
| } | ||
| } | ||
|
|
||
| public void Dispose () | ||
| { | ||
| hash.Dispose (); | ||
| } | ||
| } |
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is probably not intentional?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yeah, copilot changed it for some reason. that needs to be reset. only the java.interop submodule is supposed to be modified.