]> git.unchartedbackwaters.co.uk Git - francis/libjit.git/commitdiff
remove jit_function_recompile
authorAleksey Demakov <ademakov@gmail.com>
Thu, 20 Dec 2007 13:47:22 +0000 (13:47 +0000)
committerAleksey Demakov <ademakov@gmail.com>
Thu, 20 Dec 2007 13:47:22 +0000 (13:47 +0000)
ChangeLog
include/jit/jit-function.h
include/jit/jit-plus.h
jit/jit-function.c
jitplus/jit-plus-context.cpp
jitplus/jit-plus-function.cpp
tutorial/t3.c
tutorial/t4.cpp

index 7ca62efa4ec2525cc23026063197179ca2ec80af..8c0568e779c7c4b84621df5759261e76ee3cc4a7 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,15 @@
+2007-12-20  Aleksey Demakov  <ademakov@gmail.com>
+
+       * include/jit/jit-plus.h: add jit_context::build_start() and
+       jit_context::build_end() methods.
+
+       * include/jit/jit-function.h, jit/jit-function.c
+       (jit_function_recompile): remove.
+       * include/jit/jit-plus.h, jitplus/jit-plus-function.cpp
+       (jit_function::recompile): remove.
+       * tutorial/t3.c, tutorial/t4.cpp: recompile manually
+       instead of using removed recompile functions.
+
 2007-12-16  Klaus Treichel  <ktreichel@web.de>
 
        * configure.in: Add support for multi os archs (like x86_64). Put the
index d2851bb7ef971c31c5a137fbf5f12354029d8e09..3313d1fb1e31f42f313ea1357255b40b130ccc9c 100644 (file)
@@ -48,7 +48,6 @@ jit_block_t jit_function_get_entry(jit_function_t func) JIT_NOTHROW;
 jit_block_t jit_function_get_current(jit_function_t func) JIT_NOTHROW;
 jit_function_t jit_function_get_nested_parent(jit_function_t func) JIT_NOTHROW;
 int jit_function_compile(jit_function_t func) JIT_NOTHROW;
-int jit_function_recompile(jit_function_t func) JIT_NOTHROW;
 int jit_function_is_compiled(jit_function_t func) JIT_NOTHROW;
 void jit_function_set_recompilable(jit_function_t func) JIT_NOTHROW;
 void jit_function_clear_recompilable(jit_function_t func) JIT_NOTHROW;
index cefd8d038efe52af45c2456f1305e9e828e30af4..3bfd2d65f080b2c33e70243b38f647527b0cb811 100644 (file)
@@ -117,6 +117,8 @@ public:
        jit_context(jit_context_t context);
        ~jit_context();
 
+       void build_start() { jit_context_build_start(context); }
+       void build_end() { jit_context_build_end(context); }
        jit_context_t raw() const { return context; }
 
 private:
@@ -146,8 +148,6 @@ public:
 
        int is_compiled() const { return jit_function_is_compiled(func); }
 
-       int recompile();
-
        int is_recompilable() const { return jit_function_is_recompilable(func); }
 
        void set_recompilable() { jit_function_set_recompilable(func); }
index b5afd9a0f0014a0244107bc5eb548c6338dfd3dc..5fb2d9c2b56b39fca7a87b2e13edb3deec555434 100644 (file)
@@ -1031,58 +1031,6 @@ jit_function_setup_entry(jit_function_t func, void *entry_point)
        _jit_function_free_builder(func);
 }
 
-/*@
- * @deftypefun int jit_function_recompile (jit_function_t func)
- * Force @code{func} to be recompiled, by calling its on-demand
- * compiler again.  It is highly recommended that you set the
- * recompilable flag with @code{jit_function_set_recompilable}
- * when you initially create the function.
- *
- * This function returns one of @code{JIT_RESULT_OK},
- * @code{JIT_RESULT_COMPILE_ERROR}, or @code{JIT_RESULT_OUT_OF_MEMORY}.
- * @end deftypefun
-@*/
-int jit_function_recompile(jit_function_t func)
-{
-       int result;
-
-       /* Lock down the context */
-       jit_context_build_start(func->context);
-
-       /* Call the user's on-demand compiler if we don't have a builder yet.
-          Bail out with an error if there is no on-demand compiler */
-       if(!(func->builder))
-       {
-               if(func->on_demand)
-               {
-                       result = (*(func->on_demand))(func);
-                       if(result != JIT_RESULT_OK)
-                       {
-                               _jit_function_free_builder(func);
-                               jit_context_build_end(func->context);
-                               return result;
-                       }
-               }
-               else
-               {
-                       jit_context_build_end(func->context);
-                       return JIT_RESULT_COMPILE_ERROR;
-               }
-       }
-
-       /* Compile the function */
-       if(!jit_function_compile(func))
-       {
-               _jit_function_free_builder(func);
-               jit_context_build_end(func->context);
-               return JIT_RESULT_OUT_OF_MEMORY;
-       }
-
-       /* Unlock the context and report that we are ready to go */
-       jit_context_build_end(func->context);
-       return JIT_RESULT_OK;
-}
-
 /*@
  * @deftypefun int jit_function_is_compiled (jit_function_t func)
  * Determine if a function has already been compiled.
index a7a6ca085356fa76dc2902de6735bb98209e7ce8..e174f94d56ee1c0b9bd64ca7811eac92f437f2ef 100644 (file)
@@ -73,6 +73,15 @@ jit_context::~jit_context()
 }
 
 /*@
+ * @deftypemethod jit_context void build_start ()
+ * Start an explicit build process.  Not needed if you will be using
+ * on-demand compilation.
+ * @end deftypemethod
+ *
+ * @deftypemethod jit_context void build_end ()
+ * End an explicit build process.
+ * @end deftypemethod
+ *
  * @deftypemethod jit_context jit_context_t raw () const
  * Get the raw C context pointer that underlies this object.
  * @end deftypemethod
index 4931fb3ffb210613dc3c303495c9ceabae37b75f..b47f95a77cb85371925743c66ebe6606d6e2a241 100644 (file)
@@ -240,33 +240,6 @@ int jit_function::compile()
        }
 }
 
-/*@
- * @deftypemethod jit_function int recompile ()
- * Force a function to be recompiled.
- * @end deftypemethod
- *
- * @deftypemethod jit_function int is_recompilable () const
- * Determine if this function is recompilable.
- * @end deftypemethod
- *
- * @deftypemethod jit_function void set_recompilable ()
- * @deftypemethodx jit_function void clear_recompilable ()
- * @deftypemethodx jit_function void set_recompilable (int flag)
- * Modify the "recompilable" flag on this function.
- * @end deftypemethod
-@*/
-int jit_function::recompile()
-{
-       if(!func)
-       {
-               return JIT_RESULT_COMPILE_ERROR;
-       }
-       else
-       {
-               return jit_function_recompile(func);
-       }
-}
-
 /*@
  * @deftypemethod jit_function void set_optimization_level ({unsigned int} level)
  * @deftypemethodx jit_function {unsigned int} optimization_level () const
index d40f19d346b4d62d54f3ef4dae165e68803e9d7a..10f4c42fb13cd93d5787e6a2bdc785dc657932ef 100644 (file)
@@ -95,7 +95,10 @@ int main(int argc, char **argv)
 
        /* Force the function to be recompiled.  Normally we'd use another
           on-demand compiler with greater optimization capabilities */
-       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);
 
        /* Execute the function a third time, after it is recompiled */
        arg1 = 2;
index 6354a5890171e51984dceba453617fda92732970..480cc0d6d8119afc62249df50ca410e5e1127567 100644 (file)
@@ -25,9 +25,10 @@ public:
                set_recompilable();
        }
 
+       virtual void build();
+
 protected:
        virtual jit_type_t create_signature();
-       virtual void build();
 };
 
 jit_type_t mul_add_function::create_signature()
@@ -83,7 +84,10 @@ int main(int argc, char **argv)
        printf("mul_add(13, 5, 7) = %d\n", (int)result);
 
        // Force the function to be recompiled.
-       mul_add.recompile();
+       mul_add.build_start();
+       mul_add.build();
+       mul_add.compile();
+       mul_add.build_end();
 
        // Execute the function a third time, after it is recompiled.
        arg1 = 2;