Bug 17572 - Unfounded 'ExecutionEngineException: Attempting to JIT compile method while running with --aot-only"
Summary: Unfounded 'ExecutionEngineException: Attempting to JIT compile method while r...
Status: NEEDINFO
Alias: None
Product: Runtime
Classification: Mono
Component: JIT (show other bugs)
Version: unspecified
Hardware: PC Linux
: --- normal
Target Milestone: ---
Assignee: Bugzilla
URL:
Depends on:
Blocks:
 
Reported: 2014-02-03 12:09 UTC by Andres G. Aragoneses
Modified: 2017-10-14 00:21 UTC (History)
3 users (show)

See Also:
Tags:
Is this bug a regression?: ---
Last known good build:


Attachments

Description Andres G. Aragoneses 2014-02-03 12:09:32 UTC
The following code, when compiled with --aot=full and run with --full-aot, works perfectly:

using System;
using System.Collections.Generic;

namespace TestAot
{
	public class GridCellValue<TRow, TProperty>
	{
		private readonly TRow mRow;
		public TProperty Value { get; private set; }
	}
	public abstract class GridCellBase<TRow, TProperty>
	{
		public GridCellValue<TRow, TProperty> CellValue { get; set; }
		protected GridCellBase()
		{
			Size = new KeyValuePair<int,int>(0,0);
		}
		public KeyValuePair<int,int> Size { get; protected set; }
	}
	class GridBindingDemoViewModelRow
	{
	}
	public class GridCheckBoxCell<TRow> : GridCellBase<TRow, bool> {
	}
	public class GridDrawingHelper<TRow>
	{
		public GridDrawingHelper() {
			var c = new GridCheckBoxCell<TRow>();
		}
	}
	class MainClass
	{
		public static void Main (string[] args)
		{
			var h = new GridDrawingHelper<GridBindingDemoViewModelRow>();
			var c = new GridCheckBoxCell<GridBindingDemoViewModelRow>();
		}
	}
}


However, if the second line of the Main method above is commented out, you get an error.

Given that the main sample works, I believe I'm not hitting a current FullAOT limitation.

The error is:

System.ExecutionEngineException: Attempting to JIT compile method 'TestAot.GridCellBase`2<TestAot.GridBindingDemoViewModelRow, bool>:.ctor ()' while running with --aot-only. See http://docs.xamarin.com/ios/about/limitations for more information.

  at TestAot.GridCheckBoxCell`1[TestAot.GridBindingDemoViewModelRow]..ctor () [0x00000] in <filename unknown>:0 
  at TestAot.GridDrawingHelper`1[TestAot.GridBindingDemoViewModelRow]..ctor () [0x00000] in <filename unknown>:0 
  at TestAot.MainClass.Main (System.String[] args) [0x00000] in <filename unknown>:0
Comment 1 Andres G. Aragoneses 2014-02-04 05:32:10 UTC
Even more reduced testcase:

	public class Foo<T1> //: Bar<T1, bool>
	{
		public Foo() : base () {
			Console.WriteLine ("GridCheckBoxCell<{0}> ctor", new Bar<T1, bool>().ToString ());
		}
	}
	public class Bar<T1, T2>
	{
		public Bar()
		{
			Console.WriteLine ("T1:{0},T2:{1}", typeof(T1).FullName, typeof(T2).FullName);
		}
	}
	class Baz
	{
	}

	class MainClass
	{
		public static void Main (string[] args)
		{
			var c = new Foo<Baz>();
			Console.WriteLine (c.ToString ());
		}
	}

The way to make the testcase above work with AOT is have Foo<> inherit from Bar<,> (just uncomment the // part of the first line).

When compiling the testcase that doesn't work, only this Baz method is compiled:

@ mono --aot=print-skipped,full TestAot.exe  | grep Baz
add_method_with_index() called: Method 'TestAot.Baz:.ctor ()' 
compile_method() called: Method 'TestAot.Baz:.ctor ()' 

But when compiling the one with the extra inheritance, this happens:
@ mono --aot=print-skipped,full TestAot.exe  | grep Baz
add_method_with_index() called: Method 'TestAot.Baz:.ctor ()' 
add_method_with_index(): Method 'TestAot.Bar`2<TestAot.Baz, bool>:.ctor ()' 
compile_method(): Method 'TestAot.Baz:.ctor ()' 
compile_method(): Method 'TestAot.Bar`2<TestAot.Baz, bool>:.ctor ()'
Comment 2 Rodrigo Kumpera 2017-10-14 00:21:58 UTC
Thank you for your report!

It appears you are running a very old version of Mono. Could you please try to update to any recent version and try to reproduce the issue again.

If the issue still persists please include the version information and change the bug status to NEW.

Note You need to log in before you can comment on or make changes to this bug.