]> git.unchartedbackwaters.co.uk Git - francis/libjit.git/commitdiff
update tutorial wrt recomplation
authorAleksey Demakov <ademakov@gmail.com>
Thu, 20 Dec 2007 17:31:50 +0000 (17:31 +0000)
committerAleksey Demakov <ademakov@gmail.com>
Thu, 20 Dec 2007 17:31:50 +0000 (17:31 +0000)
ChangeLog
doc/libjit.texi

index 8c0568e779c7c4b84621df5759261e76ee3cc4a7..3d58cbe308b7518869c74ae8bfce602dd180d17b 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -10,6 +10,8 @@
        * tutorial/t3.c, tutorial/t4.cpp: recompile manually
        instead of using removed recompile functions.
 
+       * doc/libjit.texi: update tutorial.
+
 2007-12-16  Klaus Treichel  <ktreichel@web.de>
 
        * configure.in: Add support for multi os archs (like x86_64). Put the
index e49f773d27dac3c2d53ac547162968ba617d08c8..3357e05ead6f1646bf83704513f30dfd8ffc099d 100644 (file)
@@ -599,6 +599,9 @@ When the on-demand compiler returns, @code{libjit} will call
 @code{jit_function_compile} and then jump to the newly compiled code.
 Upon the second and subsequent calls to the function, @code{libjit}
 will bypass the on-demand compiler and call the compiled code directly.
+Note that in case of on-demand compilation @code{libjit} automatically
+locks and unlocks the corresponding context with
+@code{jit_context_build_start} and @code{jit_context_build_end} calls.
 
 Sometimes you may wish to force a commonly used function to
 be recompiled, so that you can apply additional optimization.
@@ -613,11 +616,18 @@ jit_function_set_recompilable(function);
 jit_function_set_on_demand_compiler(function, compile_mul_add);
 @end example
 
-Then, you force the function to be recompiled with a call to
-@code{jit_function_recompile}:
+Once the function is compiled (either on-demand or up-front) its
+intermediate representation built by @code{libjit} is discarded.
+To force the function to be recompiled you need to build it again
+and call @code{jit_function_compile} after that.  As always when
+the function is built and compiled manually it is necessary
+to take care of context locking:
 
 @example
-jit_function_recompile(function);
+jit_context_build_start(context);
+jit_function_get_on_demand_compiler(function)(function);
+jit_function_compile(function);
+jit_context_build_end(context);
 @end example
 
 After this, any existing references to the function will be redirected
@@ -677,9 +687,10 @@ public:
         set_recompilable();
     @}
 
+    virtual void build();
+
 protected:
     virtual jit_type_t create_signature();
-    virtual void build();
 @};
 @end example