Commit 06cfd83
committed
[Java.Interop.Export] Use JniEnvironment in marshal methods.
As noted in commit 2f9fece, Java.Interop.Export.ExportedMemberBuilder
doesn't need to use JniEnvironment within it's generated code, as
JniType.RegisterNativeMethods() automagically wraps delegates with the
required JniEnvironment usage code.
Thus, ExportedMemberBuilder doesn't *need* to emit JniEnvironment use
RIGHT NOW.
The question is rather regarding the future: one of the performance
issues that needs investigation on Xamarin.Android is to improve
support for AOT, so that startup overhead can be reduced/minimized by
pre-JITing as much as possible via AOT.
The problem with providing AOT support is that Xamarin.Android -- just
like Java.Interop (unsurprisingly) -- ALSO automagically wraps all
methods registered with the JVM with System.Reflection.Emit-generated
code at runtime. It is thus not possible to AOT *everything*.
*Lots* of things can be AOT'd, just not everything, and this is
something that we would like to address, meaning all required sources
of runtime code generation need to be removable.
With that in mind, long-term we don't want ExportedMemberBuilder to
rely on JniType.RegisterNativeMethods() behavior. (In fact, we'd want
to REMOVE the currently required wrapping behavior from
JniType.RegisterNativeMethods()!)
Instead, long-term it would be "interesting" if we could use
ExportedMemberBuilder to process assemblies, generate the JNI method
marshaling code for ~everything, store that into a NEW assembly (as
part of the build process), and AOT the marshaling assembly!
How cool would that be? :-D
But to even get there, we need the marshal code to be self-contained,
and not rely upon runtime code generation semantics from "elsewhere".1 parent 53626b7 commit 06cfd83
File tree
2 files changed
+150
-33
lines changed- src/Java.Interop.Export
- Java.Interop
- Tests/Java.Interop
2 files changed
+150
-33
lines changedLines changed: 49 additions & 4 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
108 | 108 | | |
109 | 109 | | |
110 | 110 | | |
| 111 | + | |
| 112 | + | |
| 113 | + | |
| 114 | + | |
| 115 | + | |
| 116 | + | |
| 117 | + | |
| 118 | + | |
| 119 | + | |
111 | 120 | | |
112 | 121 | | |
113 | 122 | | |
| |||
152 | 161 | | |
153 | 162 | | |
154 | 163 | | |
| 164 | + | |
| 165 | + | |
| 166 | + | |
| 167 | + | |
| 168 | + | |
155 | 169 | | |
156 | 170 | | |
157 | 171 | | |
158 | 172 | | |
159 | 173 | | |
160 | | - | |
| 174 | + | |
161 | 175 | | |
162 | 176 | | |
163 | 177 | | |
| |||
170 | 184 | | |
171 | 185 | | |
172 | 186 | | |
173 | | - | |
174 | | - | |
175 | 187 | | |
| 188 | + | |
| 189 | + | |
| 190 | + | |
| 191 | + | |
| 192 | + | |
| 193 | + | |
| 194 | + | |
| 195 | + | |
176 | 196 | | |
177 | 197 | | |
178 | 198 | | |
| |||
188 | 208 | | |
189 | 209 | | |
190 | 210 | | |
191 | | - | |
| 211 | + | |
192 | 212 | | |
193 | 213 | | |
194 | 214 | | |
| |||
271 | 291 | | |
272 | 292 | | |
273 | 293 | | |
| 294 | + | |
| 295 | + | |
| 296 | + | |
| 297 | + | |
| 298 | + | |
| 299 | + | |
| 300 | + | |
| 301 | + | |
| 302 | + | |
| 303 | + | |
| 304 | + | |
| 305 | + | |
| 306 | + | |
| 307 | + | |
| 308 | + | |
| 309 | + | |
| 310 | + | |
| 311 | + | |
| 312 | + | |
| 313 | + | |
| 314 | + | |
| 315 | + | |
| 316 | + | |
| 317 | + | |
| 318 | + | |
274 | 319 | | |
275 | 320 | | |
276 | 321 | | |
| |||
Lines changed: 101 additions & 29 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
167 | 167 | | |
168 | 168 | | |
169 | 169 | | |
170 | | - | |
171 | | - | |
| 170 | + | |
172 | 171 | | |
173 | | - | |
174 | | - | |
175 | | - | |
| 172 | + | |
| 173 | + | |
| 174 | + | |
| 175 | + | |
| 176 | + | |
| 177 | + | |
| 178 | + | |
| 179 | + | |
| 180 | + | |
| 181 | + | |
| 182 | + | |
| 183 | + | |
| 184 | + | |
| 185 | + | |
| 186 | + | |
| 187 | + | |
| 188 | + | |
| 189 | + | |
176 | 190 | | |
177 | 191 | | |
178 | 192 | | |
| |||
209 | 223 | | |
210 | 224 | | |
211 | 225 | | |
212 | | - | |
| 226 | + | |
| 227 | + | |
| 228 | + | |
| 229 | + | |
| 230 | + | |
| 231 | + | |
213 | 232 | | |
214 | | - | |
215 | | - | |
| 233 | + | |
| 234 | + | |
| 235 | + | |
| 236 | + | |
| 237 | + | |
| 238 | + | |
| 239 | + | |
| 240 | + | |
| 241 | + | |
| 242 | + | |
| 243 | + | |
216 | 244 | | |
217 | 245 | | |
218 | 246 | | |
| |||
227 | 255 | | |
228 | 256 | | |
229 | 257 | | |
230 | | - | |
231 | | - | |
| 258 | + | |
| 259 | + | |
| 260 | + | |
| 261 | + | |
| 262 | + | |
| 263 | + | |
| 264 | + | |
232 | 265 | | |
233 | | - | |
234 | | - | |
235 | | - | |
| 266 | + | |
| 267 | + | |
| 268 | + | |
| 269 | + | |
| 270 | + | |
| 271 | + | |
| 272 | + | |
| 273 | + | |
| 274 | + | |
| 275 | + | |
| 276 | + | |
| 277 | + | |
236 | 278 | | |
237 | 279 | | |
238 | 280 | | |
| |||
247 | 289 | | |
248 | 290 | | |
249 | 291 | | |
250 | | - | |
251 | | - | |
| 292 | + | |
252 | 293 | | |
253 | | - | |
254 | 294 | | |
255 | | - | |
256 | | - | |
257 | | - | |
258 | | - | |
259 | | - | |
| 295 | + | |
| 296 | + | |
| 297 | + | |
| 298 | + | |
| 299 | + | |
| 300 | + | |
| 301 | + | |
| 302 | + | |
| 303 | + | |
| 304 | + | |
| 305 | + | |
| 306 | + | |
| 307 | + | |
| 308 | + | |
| 309 | + | |
| 310 | + | |
| 311 | + | |
| 312 | + | |
| 313 | + | |
| 314 | + | |
| 315 | + | |
| 316 | + | |
260 | 317 | | |
261 | 318 | | |
262 | 319 | | |
| |||
271 | 328 | | |
272 | 329 | | |
273 | 330 | | |
274 | | - | |
275 | | - | |
| 331 | + | |
276 | 332 | | |
277 | | - | |
278 | 333 | | |
279 | | - | |
280 | | - | |
281 | | - | |
282 | | - | |
283 | | - | |
| 334 | + | |
| 335 | + | |
| 336 | + | |
| 337 | + | |
| 338 | + | |
| 339 | + | |
| 340 | + | |
| 341 | + | |
| 342 | + | |
| 343 | + | |
| 344 | + | |
| 345 | + | |
| 346 | + | |
| 347 | + | |
| 348 | + | |
| 349 | + | |
| 350 | + | |
| 351 | + | |
| 352 | + | |
| 353 | + | |
| 354 | + | |
| 355 | + | |
284 | 356 | | |
285 | 357 | | |
286 | 358 | | |
| |||
0 commit comments