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
NativeAOT build support and doc improvements (#68038)
- Add IlcInstructionSet property that can be used to set the target instruction set from the command line.
- Moved link to the documentation of reflection-free mode to be in less prime location, so that people trying NativeAOT for the first time are not steared towards it.
- Copied help text improvements from crossgen2
Copy file name to clipboardExpand all lines: src/coreclr/nativeaot/docs/optimizing.md
+2-3Lines changed: 2 additions & 3 deletions
Original file line number
Diff line number
Diff line change
@@ -36,15 +36,14 @@ To aid in troubleshooting some of the most common problems related to trimming a
36
36
37
37
*`<IlcGenerateStackTraceData>false</IlcGenerateStackTraceData>`: this disables generation of stack trace metadata that provides textual names in stack traces. This is for example the text string one gets by calling `Exception.ToString()` on a caught exception. With this option disabled, stack traces will still be generated, but will be based on reflection metadata alone (they might be less complete).
38
38
*`<IlcTrimMetadata>true</IlcTrimMetadata>`: allows the compiler to remove reflection metadata from things that were not visible targets of reflection. By default, the compiler keeps metadata for everything that was compiled. With this option turned on, reflection metadata (and therefore reflection) will only be available for visible targets of reflection. Visible targets of reflection are things like assemblies rooted from the project file, RD.XML, ILLinkTrim descriptors, DynamicallyAccessedMembers annotations or DynamicDependency annotations.
39
-
*`<IlcDisableReflection>true</IlcDisableReflection>`: this completely disables the reflection metadata generation. Very basic reflection will still work (you can still use `typeof`, call `Object.GetType()`, compare the results, and query for basic properties such as `Type.IsValueType` or `Type.BaseType`), but most of the reflection stack will no longer work (no way to query/access methods and fields on types, or get names of types). This mode is experimental - more details in the [Reflection free mode](reflection-free-mode.md) document.
40
39
41
40
## Options related to code generation
42
41
*`<IlcOptimizationPreference>Speed</IlcOptimizationPreference>`: when generating optimized code, favor code execution speed.
43
42
*`<IlcOptimizationPreference>Size</IlcOptimizationPreference>`: when generating optimized code, favor smaller code size.
44
-
*`<IlcFoldIdenticalMethodBodies>true</IlcFoldIdenticalMethodBodies>`: folds method bodies with identical bytes (method body deduplication). This makes your app smaller, but the stack traces might sometimes look nonsensical (unexpected methods might show up in the stack trace because the expected method had the same bytes as the unexpected method). Note: the current implementation of deduplication doesn't attempt to make the folding unobservable to managed code: delegates pointing to two logically different methods that ended up being folded together will compare equal.
43
+
*`<IlcInstructionSet>`: By default, the compiler targets the minimum instruction set supported by the target OS and architecture. This option allows targeting newer instruction sets for better performance. The native binary will require the instruction sets to be supported by the hardware in order to run. For example, `<IlcInstructionSet>avx2,bmi2,fma,pclmul,popcnt,aes</IlcInstructionSet>` will produce binary that takes advantage of instruction sets that are typically present on current Intel and AMD processors. Run `ilc.exe --help` for the full list of available instruction sets.
45
44
46
45
## Special considerations for Linux/macOS
47
46
48
-
Debugging symbols (data about your program required for debugging) is by default part of native executable files on Unix-like operating systems. To minimize the size of your CoreRT-compiled executable, you can run the `strip` tool to remove the debugging symbols.
47
+
Debugging symbols (data about your program required for debugging) is by default part of native executable files on Unix-like operating systems. To minimize the size of your native executable, you can run the `strip` tool to remove the debugging symbols.
49
48
50
49
No action is needed on Windows since the platform convention is to generate debug information into a separate file (`*.pdb`).
Copy file name to clipboardExpand all lines: src/coreclr/nativeaot/docs/reflection-free-mode.md
+1-1Lines changed: 1 addition & 1 deletion
Original file line number
Diff line number
Diff line change
@@ -6,7 +6,7 @@ Reflection-free mode is a mode of the NativeAOT compiler and runtime that greatl
6
6
* Reduced working set and better code locality - parts of the program are more tightly packed together.
7
7
* Less metadata for people to reverese engineer - apps compiled in reflection-free mode are as hard to reverse engineer as apps written in e.g. C++.
8
8
9
-
Of course the benefits come with a drawback: not all .NET code can work in such environment. In fact, most of the existing code probably won't. Use this mode with caution.
9
+
Of course the benefits come with a drawback: not all .NET code can work in such environment. In fact, most of the existing code probably won't. Use this mode with caution.https://github.com/dotnet/runtime/issues/67193 tracks potential improvements of this mode.
10
10
11
11
To enable reflection-free mode in a project that is already using CoreRT, add the following property to a `PropertyGroup` in your project file:
Reflection-free mode is a an experimental mode of the NativeAOT compiler and runtime that greatly reduces the functionality of the reflection APIs and demonstrates how far can reflection trimming can get. See [Reflection Free Mode](reflection-free-mode.md) for mode details.
extraHelp.Add(String.Format("Valid switches for {0} are: '{1}'. The default value is '{2}'","--targetos",String.Join("', '",ValidOS),defaultOs.ToString().ToLowerInvariant()));
269
+
270
+
extraHelp.Add("");
271
+
272
+
extraHelp.Add(String.Format("Valid switches for {0} are: '{1}'. The default value is '{2}'","--targetarch",String.Join("', '",ValidArchitectures),defaultArch.ToString().ToLowerInvariant()));
273
+
274
+
extraHelp.Add("");
275
+
276
+
extraHelp.Add("The allowable values for the --instruction-set option are described in the table below. Each architecture has a different set of valid "+
277
+
"instruction sets, and multiple instruction sets may be specified by separating the instructions sets by a ','. For example 'avx2,bmi,lzcnt'");
0 commit comments