Commit 0c46395
committed
[Java.Interop.Tools.*] IMetadataResolver not TypeDefinitionCache
Context: b81cfbb
Context: dotnet/android#5748
Context: dotnet/android#5748 (comment)
Commit b81cfbb introduced `TypeDefinitionCache`, which caches
`TypeReference.Resolve()` invocations so as to speed things up.
Enter dotnet/android#5748: we want to adopt some linker API
changes, and mono/linker's [`LinkContext` API][0] *also* has a
`TypeDefinition` cache construct.
Consequently, to "fully embrace" the new `LinkContext` API changes,
*large portions* of `Java.Interop.Tools.Cecil.dll` are copied so that
`LinkContext`'s caching can be used instead of `TypeDefinitionCache`'s
caching, because mono/linker doesn't use Java.Interop, and thus
can't use `TypeDefinitionCache`.
Clean this up and split the difference: "duplicate" the APIs in
`Java.Interop.Tools.Cecil.dll`,
`Java.Interop.Tools.JavaCallableWrappers.dll`, and
`src/Java.Interop.Tools.TypeNameMappings` so that instead of
optionally using `TypeDefinitionCache`, we instead permit the use
of the [`Mono.Cecil.IMetadataResolver` interface][1], which is a
"superset" of `TypeDefinitionCache` functionality.
Update `TypeDefinitionCache` to implement the `IMetadataResolver`
interface, implementing `IMetadataResolver.Resolve()` so that
previous caching functionality is preserved.
This *should* result in no breakage of existing xamarin-android code,
while allowing for a reasonable integration point between
`Java.Interop.Tools.Cecil.dll` and mono/linker, by way of
`IMetadataResolver`.
[0]: https://github.com/mono/linker/blob/30f2498c2a3de1f7e236d5793f5f1aca6e5ba456/src/linker/Linker/LinkContext.cs
[1]: https://github.com/mono/cecil/blob/e069cd8d25d5b61b0e28fe65e75959c20af7aa80/Mono.Cecil/MetadataResolver.cs#L22-L261 parent 412e974 commit 0c46395
File tree
7 files changed
+223
-103
lines changed- src
- Java.Interop.Tools.Cecil/Java.Interop.Tools.Cecil
- Java.Interop.Tools.JavaCallableWrappers/Java.Interop.Tools.JavaCallableWrappers
- Java.Interop.Tools.TypeNameMappings/Java.Interop.Tools.TypeNameMappings
7 files changed
+223
-103
lines changedLines changed: 23 additions & 14 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
11 | 11 | | |
12 | 12 | | |
13 | 13 | | |
14 | | - | |
| 14 | + | |
15 | 15 | | |
16 | | - | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
17 | 20 | | |
18 | 21 | | |
19 | 22 | | |
20 | 23 | | |
21 | | - | |
| 24 | + | |
22 | 25 | | |
23 | 26 | | |
24 | 27 | | |
25 | 28 | | |
26 | | - | |
| 29 | + | |
27 | 30 | | |
28 | 31 | | |
29 | 32 | | |
| |||
33 | 36 | | |
34 | 37 | | |
35 | 38 | | |
36 | | - | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
37 | 43 | | |
38 | | - | |
| 44 | + | |
39 | 45 | | |
40 | 46 | | |
41 | 47 | | |
42 | 48 | | |
43 | | - | |
| 49 | + | |
44 | 50 | | |
45 | 51 | | |
46 | 52 | | |
| |||
49 | 55 | | |
50 | 56 | | |
51 | 57 | | |
52 | | - | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
53 | 62 | | |
54 | | - | |
| 63 | + | |
55 | 64 | | |
56 | 65 | | |
57 | 66 | | |
| |||
60 | 69 | | |
61 | 70 | | |
62 | 71 | | |
63 | | - | |
| 72 | + | |
64 | 73 | | |
65 | 74 | | |
66 | 75 | | |
67 | 76 | | |
68 | 77 | | |
69 | | - | |
| 78 | + | |
70 | 79 | | |
71 | 80 | | |
72 | 81 | | |
73 | 82 | | |
74 | 83 | | |
75 | 84 | | |
76 | 85 | | |
77 | | - | |
| 86 | + | |
78 | 87 | | |
79 | 88 | | |
80 | 89 | | |
| |||
85 | 94 | | |
86 | 95 | | |
87 | 96 | | |
88 | | - | |
| 97 | + | |
89 | 98 | | |
90 | 99 | | |
91 | 100 | | |
| |||
103 | 112 | | |
104 | 113 | | |
105 | 114 | | |
106 | | - | |
| 115 | + | |
107 | 116 | | |
108 | 117 | | |
109 | 118 | | |
| |||
Lines changed: 23 additions & 5 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
2 | 2 | | |
3 | 3 | | |
| 4 | + | |
| 5 | + | |
4 | 6 | | |
5 | 7 | | |
6 | 8 | | |
7 | 9 | | |
8 | 10 | | |
9 | 11 | | |
10 | | - | |
| 12 | + | |
11 | 13 | | |
12 | | - | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
13 | 17 | | |
14 | | - | |
| 18 | + | |
15 | 19 | | |
16 | | - | |
| 20 | + | |
17 | 21 | | |
18 | | - | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
19 | 37 | | |
20 | 38 | | |
21 | 39 | | |
Lines changed: 56 additions & 30 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
9 | 9 | | |
10 | 10 | | |
11 | 11 | | |
12 | | - | |
| 12 | + | |
13 | 13 | | |
14 | | - | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
15 | 18 | | |
16 | 19 | | |
17 | 20 | | |
18 | 21 | | |
19 | | - | |
20 | | - | |
| 22 | + | |
| 23 | + | |
21 | 24 | | |
22 | 25 | | |
23 | 26 | | |
24 | 27 | | |
25 | 28 | | |
26 | | - | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
27 | 33 | | |
28 | | - | |
| 34 | + | |
29 | 35 | | |
30 | 36 | | |
31 | 37 | | |
32 | 38 | | |
33 | 39 | | |
34 | | - | |
| 40 | + | |
35 | 41 | | |
36 | 42 | | |
37 | 43 | | |
38 | 44 | | |
39 | 45 | | |
40 | | - | |
| 46 | + | |
41 | 47 | | |
42 | | - | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
43 | 52 | | |
44 | 53 | | |
45 | 54 | | |
46 | | - | |
| 55 | + | |
47 | 56 | | |
48 | 57 | | |
49 | 58 | | |
50 | 59 | | |
51 | 60 | | |
52 | 61 | | |
53 | | - | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
54 | 66 | | |
55 | | - | |
| 67 | + | |
56 | 68 | | |
57 | 69 | | |
58 | 70 | | |
59 | | - | |
| 71 | + | |
60 | 72 | | |
61 | 73 | | |
62 | | - | |
| 74 | + | |
63 | 75 | | |
64 | 76 | | |
65 | 77 | | |
66 | 78 | | |
67 | | - | |
| 79 | + | |
68 | 80 | | |
69 | 81 | | |
70 | 82 | | |
| |||
73 | 85 | | |
74 | 86 | | |
75 | 87 | | |
76 | | - | |
| 88 | + | |
77 | 89 | | |
78 | | - | |
| 90 | + | |
| 91 | + | |
| 92 | + | |
79 | 93 | | |
80 | | - | |
| 94 | + | |
81 | 95 | | |
82 | 96 | | |
83 | 97 | | |
| |||
87 | 101 | | |
88 | 102 | | |
89 | 103 | | |
90 | | - | |
| 104 | + | |
91 | 105 | | |
92 | | - | |
| 106 | + | |
| 107 | + | |
| 108 | + | |
| 109 | + | |
93 | 110 | | |
94 | | - | |
| 111 | + | |
95 | 112 | | |
96 | 113 | | |
97 | 114 | | |
| |||
103 | 120 | | |
104 | 121 | | |
105 | 122 | | |
106 | | - | |
| 123 | + | |
| 124 | + | |
| 125 | + | |
| 126 | + | |
107 | 127 | | |
108 | | - | |
| 128 | + | |
109 | 129 | | |
110 | | - | |
| 130 | + | |
111 | 131 | | |
112 | 132 | | |
113 | 133 | | |
114 | 134 | | |
115 | 135 | | |
116 | | - | |
| 136 | + | |
117 | 137 | | |
118 | | - | |
| 138 | + | |
| 139 | + | |
| 140 | + | |
| 141 | + | |
119 | 142 | | |
120 | 143 | | |
121 | 144 | | |
122 | 145 | | |
123 | 146 | | |
124 | | - | |
| 147 | + | |
125 | 148 | | |
126 | 149 | | |
127 | 150 | | |
128 | 151 | | |
129 | | - | |
| 152 | + | |
| 153 | + | |
| 154 | + | |
| 155 | + | |
130 | 156 | | |
131 | | - | |
| 157 | + | |
132 | 158 | | |
133 | | - | |
| 159 | + | |
134 | 160 | | |
135 | 161 | | |
136 | 162 | | |
| |||
Lines changed: 14 additions & 9 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
23 | 23 | | |
24 | 24 | | |
25 | 25 | | |
26 | | - | |
| 26 | + | |
27 | 27 | | |
28 | 28 | | |
29 | 29 | | |
30 | | - | |
| 30 | + | |
31 | 31 | | |
32 | 32 | | |
33 | 33 | | |
| |||
54 | 54 | | |
55 | 55 | | |
56 | 56 | | |
57 | | - | |
| 57 | + | |
58 | 58 | | |
59 | 59 | | |
60 | 60 | | |
61 | | - | |
| 61 | + | |
62 | 62 | | |
63 | 63 | | |
64 | 64 | | |
65 | | - | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
66 | 71 | | |
67 | 72 | | |
68 | 73 | | |
| |||
103 | 108 | | |
104 | 109 | | |
105 | 110 | | |
106 | | - | |
| 111 | + | |
107 | 112 | | |
108 | 113 | | |
109 | 114 | | |
110 | | - | |
| 115 | + | |
111 | 116 | | |
112 | 117 | | |
113 | 118 | | |
| |||
655 | 660 | | |
656 | 661 | | |
657 | 662 | | |
658 | | - | |
| 663 | + | |
659 | 664 | | |
660 | 665 | | |
661 | 666 | | |
| |||
666 | 671 | | |
667 | 672 | | |
668 | 673 | | |
669 | | - | |
| 674 | + | |
670 | 675 | | |
671 | 676 | | |
672 | 677 | | |
| |||
0 commit comments