MonoTouch AOT Compiler - Big Methods Don't Work

I am working on a game and we save information about our level in JSON format. These levels are quite large, so we switched them to plain C #:

  • The top level method has a switch statement for the level / object name
  • There are several automated methods that β€œupdate” our object tree with standard property initializers.

Example:

private OurObject Autogenerated_Object1() { return new OurObject { Name = "Object1", X = 1, Y = 2, Width = 200, Height = 100 }; } 

In addition to these methods, they are very large and have nested lists / dictionaries of other objects, etc.

This accelerated the boot time of the level from 2-3 seconds to a split second (on Windows). The size of our data is also significantly smaller since compiled IL compared to JSON.

The problem is when we compile them in MonoDevelop for MonoTouch, we get:

mtouch exited with code 1

When you turn on -v -v -v we can see the error:

 MONO_PATH=/Users/jonathanpeppers/Desktop/DrawAStickman/Game/Code/iOS/DrawAStickman.iPhone/bin/iPhone/Release/DrawAStickmaniPhone.app /Developer/MonoTouch/usr/bin/arm-darwin-mono --aot=mtriple=armv7-darwin,full,static,asmonly,nodebug,outfile=/var/folders/4s/lcvdj54x0g72nrsw9vzq6nm80000gn/T/tmp54777849.tmp/monotouch.dll.7.s "/Users/jonathanpeppers/Desktop/DrawAStickman/Game/Code/iOS/DrawAStickman.iPhone/bin/iPhone/Release/DrawAStickmaniPhone.app/monotouch.dll" AOT Compilation exited with code 134, command: MONO_PATH=/Users/jonathanpeppers/Desktop/DrawAStickman/Game/Code/iOS/DrawAStickman.iPhone/bin/iPhone/Release/DrawAStickmaniPhone.app /Developer/MonoTouch/usr/bin/arm-darwin-mono --aot=mtriple=armv7-darwin,full,static,asmonly,nodebug,outfile=/var/folders/4s/lcvdj54x0g72nrsw9vzq6nm80000gn/T/tmp54777849.tmp/DrawAStickmanCore.dll.7.s "/Users/jonathanpeppers/Desktop/DrawAStickman/Game/Code/iOS/DrawAStickman.iPhone/bin/iPhone/Release/DrawAStickmaniPhone.app/DrawAStickmanCore.dll" Mono Ahead of Time compiler - compiling assembly /Users/jonathanpeppers/Desktop/DrawAStickman/Game/Code/iOS/DrawAStickman.iPhone/bin/iPhone/Release/DrawAStickmaniPhone.app/DrawAStickmanCore.dll * Assertion: should not be reached at ../../../../../mono/mono/mini/mini-arm.c:2758 

Is there a limit on the number of lines in a method when compiling for AOT? Is there any argument we can pass to mtouch to fix this? Some files work fine, but in particular, the reason the error has a 3000 line method. Compilation for the simulator works great no matter what.

This is still an experiment, so we understand that this is a pretty crazy situation.

+7
source share
2 answers

These statements occur when you click on a condition that should never occur in the AOT compiler. Please report such cases to http://bugzilla.xamarin.com

Is there any argument we can pass to mtouch to fix this?

You may be able to get around this with LLVM (or not use it), as this is a different mechanism for generating code. Depending on at what stage this happens (some of them are divided), you may not encounter the same condition.

Of course, LLVM builds are slower and do not support debugging, so this is not an ideal solution for any situation.

+4
source

Just a recommendation for storing levels. Have you considered storing the layers in a very fast binary format such as protocol buffers? .NET has a wonderful protocol buffer library called Protobuf-net that you can check.

+1
source

All Articles