From: Aleksey Demakov Date: Thu, 20 Dec 2007 13:47:22 +0000 (+0000) Subject: remove jit_function_recompile X-Git-Tag: before.move.to.git~127 X-Git-Url: https://git.unchartedbackwaters.co.uk/w/?a=commitdiff_plain;h=74e984980cc7ee636aaaba2369f6d88b8be8ccbc;p=francis%2Flibjit.git remove jit_function_recompile --- diff --git a/ChangeLog b/ChangeLog index 7ca62ef..8c0568e 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,15 @@ +2007-12-20 Aleksey Demakov + + * 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 * configure.in: Add support for multi os archs (like x86_64). Put the diff --git a/include/jit/jit-function.h b/include/jit/jit-function.h index d2851bb..3313d1f 100644 --- a/include/jit/jit-function.h +++ b/include/jit/jit-function.h @@ -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; diff --git a/include/jit/jit-plus.h b/include/jit/jit-plus.h index cefd8d0..3bfd2d6 100644 --- a/include/jit/jit-plus.h +++ b/include/jit/jit-plus.h @@ -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); } diff --git a/jit/jit-function.c b/jit/jit-function.c index b5afd9a..5fb2d9c 100644 --- a/jit/jit-function.c +++ b/jit/jit-function.c @@ -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. diff --git a/jitplus/jit-plus-context.cpp b/jitplus/jit-plus-context.cpp index a7a6ca0..e174f94 100644 --- a/jitplus/jit-plus-context.cpp +++ b/jitplus/jit-plus-context.cpp @@ -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 diff --git a/jitplus/jit-plus-function.cpp b/jitplus/jit-plus-function.cpp index 4931fb3..b47f95a 100644 --- a/jitplus/jit-plus-function.cpp +++ b/jitplus/jit-plus-function.cpp @@ -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 diff --git a/tutorial/t3.c b/tutorial/t3.c index d40f19d..10f4c42 100644 --- a/tutorial/t3.c +++ b/tutorial/t3.c @@ -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; diff --git a/tutorial/t4.cpp b/tutorial/t4.cpp index 6354a58..480cc0d 100644 --- a/tutorial/t4.cpp +++ b/tutorial/t4.cpp @@ -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;