You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The changes made to solve #1164 will mean that we can't run the constant propagation and branch removal before MarkStep as not all assemblies will be loaded at that time. It also means the algorithm can't rely on having visibility into all assemblies at the same time.
So we need to change it to be:
per-method - it could be per-assembly, but it doesn't help much (not a big difference between per-method and per-assembly) and would be wasteful
on-demand - only compute the constant propagation and branch removal when needed - this is basically a fallback of making assembly loading on-demand
called from MarkStep right before ProcessMethod - this is basically an optimization to only perform the computations for methods which are actually going to be marked (no need to compute this for methods which will be trimmed from the app)
To do this the plan is to:
- refactor the RemoveUnreachableBlocksStep so that it doesn't precompute constant returns for all methods - do this on-demand from TryInlineBodyDependencies. But keep the iterative algorithm - meaning we will go over all methods multiple times to perform the recursive propagation. Only compute if method returns a constant when needed #1734
- refactor the RemoveUnreachableBlocksStep to perform constant propagation and branch removal truly on-demand - so basically introduce a method which will do it for a single method - remove the iterative part of the algorithm. Constant propagation without iterations and stack based #1756
This will probably mean to:
Introduce a queue of methods which must be processed
When reaching a method call to a method which hasn't been processed, add it to the queue and re-try the current method later on (this is basically avoiding recursion - and replacing it with re-try and a queue)
Ideally reduce the number of methods this needs to happen on even more
- remove the RemoveUnreachableBlocksStep completely and instead call the functionality from MarkStep right before ProcessMethod. So that it only happens on marked methods (but before we actually go and mark the method's body). Constant propagation directly from MarkStep #1771
The changes made to solve #1164 will mean that we can't run the constant propagation and branch removal before MarkStep as not all assemblies will be loaded at that time. It also means the algorithm can't rely on having visibility into all assemblies at the same time.
So we need to change it to be:
To do this the plan is to:
RemoveUnreachableBlocksStep
so that it doesn't precompute constant returns for all methods - do this on-demand fromTryInlineBodyDependencies
. But keep the iterative algorithm - meaning we will go over all methods multiple times to perform the recursive propagation. Only compute if method returns a constant when needed #1734RemoveUnreachableBlocksStep
to perform constant propagation and branch removal truly on-demand - so basically introduce a method which will do it for a single method - remove the iterative part of the algorithm. Constant propagation without iterations and stack based #1756This will probably mean to:
RemoveUnreachableBlocksStep
completely and instead call the functionality fromMarkStep
right beforeProcessMethod
. So that it only happens on marked methods (but before we actually go and mark the method's body). Constant propagation directly from MarkStep #1771/cc @sbomer @marek-safar
The text was updated successfully, but these errors were encountered: