Skip to content

Commit

Permalink
[aot] Add JustInterp Mode to the MonoAOTCompiler task (#52560)
Browse files Browse the repository at this point in the history
In this mode we pass `--aot=interp` to the AOT compiler.  This will _not_ AOT
the managed methods in the specified assemblies, but it will AOT the
trampolines and wrappers necessary for the interpreter to run the methods and
to interoperate with native P/Invokes and unmanaged callbacks.
  • Loading branch information
lambdageek authored May 11, 2021
1 parent 16083f9 commit 5a47690
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions src/tasks/AotCompilerTask/MonoAOTCompiler.cs
Original file line number Diff line number Diff line change
Expand Up @@ -99,9 +99,10 @@ public class MonoAOTCompiler : Microsoft.Build.Utilities.Task
public string? AotModulesTableLanguage { get; set; } = nameof(MonoAotModulesTableLanguage.C);

/// <summary>
/// Choose between 'Normal', 'Full', 'FullInterp', 'LLVMOnly', 'LLVMOnlyInterp'.
/// Choose between 'Normal', 'JustInterp', 'Full', 'FullInterp', 'LLVMOnly', 'LLVMOnlyInterp'.
/// LLVMOnly means to use only LLVM for FullAOT, AOT result will be a LLVM Bitcode file (the cross-compiler must be built with LLVM support)
/// The "interp" options ('LLVMOnlyInterp' and 'FullInterp') mean generate necessary support to fall back to interpreter if AOT code is not possible for some methods.
/// The difference between 'JustInterp' and 'FullInterp' is that 'FullInterp' will AOT all the methods in the given assemblies, while 'JustInterp' will only AOT the wrappers and trampolines necessary for the runtime to execute the managed methods using the interpreter and to interoperate with P/Invokes and unmanaged callbacks.
/// </summary>
public string Mode { get; set; } = nameof(MonoAotMode.Normal);

Expand Down Expand Up @@ -327,7 +328,7 @@ private bool PrecompileLibrary(ITaskItem assemblyItem, string? monoPaths)
aotArgs.Add("full");
}

if (parsedAotMode == MonoAotMode.FullInterp)
if (parsedAotMode == MonoAotMode.FullInterp || parsedAotMode == MonoAotMode.JustInterp)
{
aotArgs.Add("interp");
}
Expand Down Expand Up @@ -509,6 +510,7 @@ private void GenerateAotModulesTable(ITaskItem[] assemblies, string[]? profilers
public enum MonoAotMode
{
Normal,
JustInterp,
Full,
FullInterp,
LLVMOnly,
Expand Down

0 comments on commit 5a47690

Please sign in to comment.