mono / mono

Mono open source ECMA CLI, C# and .NET implementation.
https://www.mono-project.com
Other
11.14k stars 3.83k forks source link

Linker conditionals for WASM System.Private.CoreLib #17823

Open vargaz opened 5 years ago

vargaz commented 5 years ago

Here is a list of possible linker conditionals which a linker tool can use to optimize corelib for a particular platform:

vargaz commented 5 years ago

Related linker issues:

jkotas commented 5 years ago

System.Console PAL for mobile systems which would allow only simple output

Agree. I believe a separate build of System.Console for mobile systems would be the best way to handle this.

type is TypeBuilder

This may be rather handled by a more general optimization for never allocated types that would kick in many other places. The linker should be able to see that TypeBuilder is never allocated and short-circuit this condition.

stephentoub commented 5 years ago

Is this only existing properties / parameterless methods?

I'd expect some decent wins to come from things like Environment.GetEnvironmentVaraible being used to check for some well-known value, AppContext switches, etc. If the linker isn't yet capable of that and the resulting dataflow analysis, e.g. a static readonly bool field being set based on those and used as a const, it might be something we should look at adding.

Another would be Debugger.IsAttached. is that already factored in as part of telling the linker to throw away debugging-related code? We have some code paths that only kick in when a debugger is active.

Similarly, EventSource.IsEnabled; do we have switches that would let someone link away an entire EventSource(s) if they don't care about a particular component's logging?

What about encodings? Calendars? Etc?

marek-safar commented 5 years ago

Only static properties and static parameterless methods are supported.

richlander commented 5 years ago

Questions I asked on email that should be shared more broadly.

Answers: