Bug 18142 - Ability to pass runtime options to Mono
Summary: Ability to pass runtime options to Mono
Alias: None
Product: Android
Classification: Xamarin
Component: Mono runtime / AOT Compiler ()
Version: 4.13.x
Hardware: All All
: Normal normal
Target Milestone: ---
Assignee: Jonathan Pryor
Depends on:
Reported: 2014-03-03 21:31 UTC by Virgile Bello
Modified: 2017-06-29 18:46 UTC (History)
3 users (show)

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

Notice (2018-05-24): bugzilla.xamarin.com is now in read-only mode.

Please join us on Visual Studio Developer Community and in the Xamarin and Mono organizations on GitHub to continue tracking issues. Bugzilla will remain available for reference in read-only mode. We will continue to work on open Bugzilla bugs, copy them to the new locations as needed for follow-up, and add the new items under Related Links.

Our sincere thanks to everyone who has contributed on this bug tracker over the years. Thanks also for your understanding as we make these adjustments and improvements for the future.

Please create a new report on Developer Community or GitHub with your current version information, steps to reproduce, and relevant error messages or log files if you are hitting an issue that looks similar to this resolved bug and you do not yet see a matching new report.

Related Links:

Description Virgile Bello 2014-03-03 21:31:30 UTC
In bug #18068, a new flag has been added to Mono runtime to support locals init=false.

This result in various speedup in JIT (it avoids double clearing/setting of memory in many cases, especially combined with "out" memory). This is very useful in game programming, especially for mathematics code and some very tight loop that we have to put in separate functions due to "ref" array accesses.

However, the platform that needs this the most (Android) doesn't have a way (that I know of) to pass flags to the runtime. On Windows it would be "mono -O=unsafe app.exe" but on Android there is no way to add "-O=unsafe" somewhere.
Would it be possible to add this flag somewhere in Xamarin.Android?

Comment 1 Virgile Bello 2014-03-03 21:33:31 UTC
Note: this speedup apply also when stack is reused differently during branching (if/else).
On Windows, we measured performance increase around 10+%, so we hope it could be even better on Android.
Comment 2 Virgile Bello 2014-03-13 22:16:06 UTC
BTW, the previous 10+% I mentionned was overall, but on the actual specific code, it could sometime takes up to 80% of the function time (i.e. a function with lot of branching => few instructions, and lot of potentially unused stack).
Comment 3 Tom Opgenorth 2017-06-29 18:46:19 UTC
You should be able to ass these flags using the `debug.mono.runtimeargs` property: