[Mono-dev] Long execution time on first execution (in AOT case)
mdae at cs.tu-chemnitz.de
Tue Jun 8 10:58:34 EDT 2010
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 necessarily
> "fast". That is, I tolerate a kind of "initialization" at startup time
> 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.
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
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:
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.
With kind regards,
More information about the Mono-devel-list