Commit 903ba37
authored
[Xamarin.Android.Build.Tasks, monodroid] LLVM-IR Generator (#7163)
Context: e1af958
Commit e1af958 mentioned a TODO:
> * Finish the LLVM code generator so that LLVM Marshal Methods are
> emitted into `libxamarin-app.so`.
Implement LLVM Marshal Methods LLVM-IR executable code generator:
* LLVM-IR Generation Infrastructure:
* function and instruction attributes
* function parameter (declaration/definition) and argument
(runtime) handling
* function variable (including parameters) handling, including
unnamed local variables
* support for native function signatures and pointers to functions
* The ret, store, load, icmp, br, call and phi instructions
* LLVM-IR Marshal Method generator
* managed to JNI signature and symbol name translations
When `ENABLE_MARSHAL_METHODS` is defined, LLVM-IR code is generated,
compiled, and linked. Generated code is minimally tested for runtime
behavior, as not all the infrastructure on the Xamarin.Android side
is implemented yet. This is on purpose, to keep commits smaller.
Support for various LLVM IR instructions is limited only to those we
actually use and only to elements of those constructions that we use.
As such, it's not a general purpose code generator which allows us to
make some assumptions and take some shortcuts, without compromising
correctness and validity of the generated code.
The native type handling system portion of this commit is to be
treated as proof-of-concept: is is not as optimized (design wise) as
it should be. The reason for this limitation is that it requires
modifying the previous LLVM IR data generation code and it would
contribute to this commits' already substantial size.
~~ TODO ~~
Update/rewrite infrastructure to focus on implementing the runtime
side of marshal methods, making it possible to actually run
applications which use marshal methods.
Finish prototyping the infrastructure so that a MAUI app can be run
with LLVm Marshal Methods enabled.1 parent 31bad9c commit 903ba37
File tree
28 files changed
+2477
-54
lines changed- src
- Xamarin.Android.Build.Tasks
- Tasks
- Utilities
- LlvmIrGenerator
- monodroid/jni
28 files changed
+2477
-54
lines changedLines changed: 6 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
237 | 237 | | |
238 | 238 | | |
239 | 239 | | |
| 240 | + | |
| 241 | + | |
| 242 | + | |
240 | 243 | | |
241 | 244 | | |
242 | 245 | | |
| |||
384 | 387 | | |
385 | 388 | | |
386 | 389 | | |
| 390 | + | |
| 391 | + | |
| 392 | + | |
387 | 393 | | |
388 | 394 | | |
389 | 395 | | |
| |||
Lines changed: 14 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
16 | 16 | | |
17 | 17 | | |
18 | 18 | | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
19 | 25 | | |
20 | 26 | | |
21 | 27 | | |
| |||
25 | 31 | | |
26 | 32 | | |
27 | 33 | | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
28 | 42 | | |
29 | 43 | | |
Lines changed: 14 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
16 | 16 | | |
17 | 17 | | |
18 | 18 | | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
19 | 25 | | |
20 | 26 | | |
21 | 27 | | |
| |||
29 | 35 | | |
30 | 36 | | |
31 | 37 | | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
32 | 46 | | |
33 | 47 | | |
0 commit comments