[Mono-dev] Long execution time on first execution (in AOT case)
kumpera at gmail.com
Thu Jun 17 10:22:36 EDT 2010
On Tue, Jun 8, 2010 at 11:58 AM, Martin Däumler <mdae at cs.tu-chemnitz.de>wrote:
> On 26.05.10 4:57 pm, Miguel de Icaza wrote:
> > I want to know how to make the execution of a code snippet/method
> > deterministic, i.e., like C code can be deterministic, not
> > "fast". That is, I tolerate a kind of "initialization" at startup
> > of Mono, but the first execution must not take (much) more time than
> > following executions of the code snippet.
> > A low-tech solution is to make sure you execute all the code paths that
> > you will need before entering your deterministic phase.
> Hello Miguel,
> thanks for your answer. That is a possible solution, but I want to use
> as much infrastructure of Mono as possible. So, I decided to do a kind
> of pre-compilation like it was intended do be done by
> "mono_precompile_assemblies()" (mono/mini/driver.c)?!
> So I use a lot of AOT-code to pre-compile all referenced assemblies,
> maybe in combination with the tool "monolinker" in order to reduce
> overhead. While pre-compilation, the compiled code is inserted into
> a mono-internal cache by "mono_jit_compile_method_inner()"
> (mono/mini/mini.c). While executing the assembly, the pre-compiled
> code is already in the cache and JIT-compilation is avoided.
> Unfortunately, there is a problem with icall-wrappers. I adapted the
> code from "add_wrappers()" (mono/mini/aot-compiler.c) to use it in my
> own pre-compilation code. This line:
> g_hash_table_foreach (mono_get_jit_icall_info
> is used to AOT-compile icall-wrappers. Icall-wrappers that are now
> pre-compiled in scope of that code are not inserted into the
> mono-internal hash correctly. That is, during execution those
> icall-wrappers have to be JIT-compiled. Also, there is a FIXME comment
> on that code about locking! Can anyone tell me which locks have to be
> used to protect my pre-compilation? A comment in
> "mono_icall_get_wrapper_full()" (mono/mini/mini.c) tells me, I have to
> use the loader lock, right?
> According to , I want to use the LockTracer in order to find the
> bug, but I did not find the referenced source file in the tarball.
The LockTracer is a compile time define. Look into
Once it's compiled in and a log has been produced, you can inspect it with
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the Mono-devel-list