dotgnu-libjit
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Libjit-developers] jit_function_recompile


From: Aleksey Demakov
Subject: [Libjit-developers] jit_function_recompile
Date: Thu, 20 Dec 2007 14:22:43 +0600

Hi all,

I am going to remove the jit_function_recompile function
from libjit. This function is inconsistent with use patterns
of jit_function_create and jit_function_compile functions.
It makes jit_context_build_start and jit_context_build_end
calls internally while other functions imply that these calls
are made by the user.

So it is possible to create and compile multiple functions
in single context lock section. I do not see why this rule
should not be used for recompilation as well.

Additinally for some users jit_context_build_start and
jit_context_build_end functions alone do not provide
adequate means of synchronization. For on-demand
compilation this problem was resolved by introduction
of user-defined compilation drivers that let override the
default synchronization scheme. For recompilation this
problem was not addressed so far.

Apart from synchronization jit_function_recompile also calls
function's on-demand compiler if necessary. It should be
trivial for a libjit user to call it by hand so the best way to
resolve the jit_function_recompile inconsistency is to
remove it altogether.

As the result the the code like this

jit_function_recompile(func1);
jit_function_recompile(func2);

has to be rewritten to something like this:

jit_context_build_start(context);
jit_function_get_on_demand_compiler(func1)(func1);
jit_function_compile(func1);
jit_function_get_on_demand_compiler(func2)(func2);
jit_function_compile(func2);
jit_context_build_end(context);

Yes, it is a bit more code but also more flexibility. The user
may choose to do synchronization differently - like queue
the compilation task to a dedicated thread. Also the user
supplied on-demand compiler could do jit_function_compile
internally so there may be no need to call it explicitely here.

Regards,
Aleksey


reply via email to

[Prev in Thread] Current Thread [Next in Thread]