dotnet / runtime

.NET is a cross-platform runtime for cloud, mobile, desktop, and IoT apps.
https://docs.microsoft.com/dotnet/core/
MIT License
15.47k stars 4.76k forks source link

[mono] Enable AOT compiler to generate a dependency graph of the compiled code #73159

Open ivanpovazan opened 2 years ago

ivanpovazan commented 2 years ago

Motivation

Quite often it is required to understand why a method has been AOTed, which function, type or instantiation caused the compilation of the method and what are its dependencies.

This information is needed when we are trying to answer some of the following questions:

By just disassembling the binary and examining generated symbols, it is quite hard, and sometimes impossible, to answer these kind of questions.

Idea

Benefits

The generated dependency graphs would:


This is merely an idea for the improvement, not an official proposal, making this issue open for discussions and ideas.

CC: @lambdageek @vargaz

fanyang-mono commented 1 year ago

It would be nice to have a simpler version of this feature, which prints out a list of AOT compiled methods for il strip tool to consume. That feature would help with stripping IL's for MAUI Android apps, which used Profiled AOT mode. (https://github.com/dotnet/runtime/issues/44855)

fanyang-mono commented 1 year ago

It would be nice to have a simpler version of this feature, which prints out a list of AOT compiled methods for il strip tool to consume. That feature would help with stripping IL's for MAUI Android apps, which used Profiled AOT mode. (#44855)

Created a separated issue for this https://github.com/dotnet/runtime/issues/79551

ivanpovazan commented 1 year ago

Implementing this feature has been paused for now, as we are trying to prove whether it is possible to use NativeAOT's dependency analysis to drive MonoAOT compilation in order to reduce the generated code size (especially in case of generics): https://github.com/dotnet/runtime/issues/80941

ivanpovazan commented 1 year ago

Moving to 9.0.0