-
Notifications
You must be signed in to change notification settings - Fork 5.2k
Closed
Labels
area-Codegen-AOT-monountriagedNew issue has not been triaged by the area ownerNew issue has not been triaged by the area owner
Milestone
Description
Compile this sample for FullAOT, then make run
. Expected result: "Taking transition" is printed out. Actual result:
Unhandled Exception:
System.ExecutionEngineException: Attempting to JIT compile method 'St`1<Brz> Q:Delta<Brz> (St`1<Brz>,M`1<Brz>)' while running in aot-only mode. See https://docs.microsoft.com/xamarin/ios/internals/limitations for more information.
at HelloWorld.Program.Main(String[] args) in /Users/alklig/work/dotnet-runtime/runtime/src/mono/sample/HelloWorld/Program.cs:line 45
[ERROR] FATAL UNHANDLED EXCEPTION: System.ExecutionEngineException: Attempting to JIT compile method 'St`1<Brz> Q:Delta<Brz> (St`1<Brz>,M`1<Brz>)' while running in aot-only mode. See https://docs.microsoft.com/xamarin/ios/internals/limitations for more information.
at HelloWorld.Program.Main(String[] args) in /Users/alklig/work/dotnet-runtime/runtime/src/mono/sample/HelloWorld/Program.cs:line 45
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
using System;
public class St<T> {
public T t;
public T GetIt() => t;
}
public class M<T> {
public bool Matches(T state) => false;
}
public interface Itf<T> {
static abstract St<T> TakeTransition(M<T> matcher, T state);
}
public class Q {
public St<T> Delta<T> (St<T> src, M<T> matcher) where T : Itf<T>{
Console.WriteLine ("Taking transition");
return T.TakeTransition(matcher, src.GetIt());
}
}
public class Brz : Itf<Brz> {
public static St<Brz> TakeTransition (M<Brz> matcher, Brz state) {
return new St<Brz>() { t = state };
}
}
namespace HelloWorld
{
internal class Program
{
private static void Main(string[] args)
{
bool isMono = typeof(object).Assembly.GetType("Mono.RuntimeStructs") != null;
Console.WriteLine($"Hello World {(isMono ? "from Mono!" : "from CoreCLR!")}");
Console.WriteLine(typeof(object).Assembly.FullName);
Console.WriteLine(System.Reflection.Assembly.GetEntryAssembly ());
Console.WriteLine(System.Runtime.InteropServices.RuntimeInformation.FrameworkDescription);
Console.WriteLine (GetEE());
new Q().Delta<Brz> (new St<Brz>(), new M<Brz>());
}
public static string GetEE() {
if (!System.Runtime.CompilerServices.RuntimeFeature.IsDynamicCodeSupported)
return "FullAOT";
if (!System.Runtime.CompilerServices.RuntimeFeature.IsDynamicCodeCompiled)
return "Interp";
return "JIT";
}
}
}
Makefile:
TOP=../../../../
DOTNET:=$(TOP)./dotnet.sh
DOTNET_Q_ARGS=--nologo -v:q -consoleloggerparameters:NoSummary
MONO_CONFIG ?=Release
MONO_ARCH=x64
OS := $(shell uname -s)
ifeq ($(OS),Darwin)
TARGET_OS=osx
else
TARGET_OS=linux
endif
MONO_ENV_OPTIONS ?=--full-aot
ARTIFACTS_BIN=$(abspath $(TOP)artifacts/bin/HelloWorld/$(MONO_ARCH)/$(MONO_CONFIG)/$(TARGET_OS)-$(MONO_ARCH))
MONO_AOT_COMPILER=$(abspath $(TOP)artifacts/obj/mono/OSX.x64.Release/out/bin/mono-sgen)
publish: $(ARTIFACTS_BIN)/.touch-publish
$(ARTIFACTS_BIN)/.touch-publish: HelloWorld.csproj Program.cs
$(DOTNET) publish -c $(MONO_CONFIG) -r $(TARGET_OS)-$(MONO_ARCH) /p:RunAOTCompilation=true
touch $(ARTIFACTS_BIN)/.touch-publish
$(ARTIFACTS_BIN)/.touch-fullaot: $(ARTIFACTS_BIN)/.touch-publish
pushd $(ARTIFACTS_BIN)/publish ; \
for i in *.dll ; do \
MONO_PATH=$(ARTIFACTS_BIN)/publish \
$(MONO_AOT_COMPILER) --aot=full $${i} ; \
done ; \
popd
touch $(ARTIFACTS_BIN)/.touch-fullaot
aot: $(ARTIFACTS_BIN)/.touch-fullaot
.PHONY: run
run: $(ARTIFACTS_BIN)/.touch-fullaot
COMPlus_DebugWriteToStdErr=1 \
MONO_ENV_OPTIONS="$(MONO_ENV_OPTIONS)" \
$(TOP)artifacts/bin/HelloWorld/$(MONO_ARCH)/$(MONO_CONFIG)/$(TARGET_OS)-$(MONO_ARCH)/publish/HelloWorld
clean:
rm -rf $(TOP)artifacts/bin/HelloWorld/
stephentoub
Metadata
Metadata
Assignees
Labels
area-Codegen-AOT-monountriagedNew issue has not been triaged by the area ownerNew issue has not been triaged by the area owner