libjit
[Top][All Lists]
Advanced

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

Re: [Libjit] [PATCH] Allow deletion of a single function


From: Aleksey Demakov
Subject: Re: [Libjit] [PATCH] Allow deletion of a single function
Date: Sun, 25 Mar 2018 03:46:01 +0300

Hi Tom,

Please be aware that the default memory manager is not able to free
the memory for generated code. It will take a custom manager to do
this (and furthermore this was never tested). So the comment you added
("Destroy the function, freeing all resources associated with it") is
not entirely correct. It should mention that the code area associated
with the destroyed function can be freed only with a custom memory
manager. I wanted to expose this function myself but only after trying
in practice some custom manager. But this never happened so there is
no point to wait anymore. Could you please edit the comment as I trust
your English skills more than mine?

Regards,
Aleksey

On Thu, Mar 1, 2018 at 2:40 AM, Tom Tromey <address@hidden> wrote:
> This renames and exports _jit_function_destroy, so that a function can
> be destroyed.
> ---
>  ChangeLog                  | 10 ++++++++++
>  include/jit/jit-function.h |  1 +
>  jit/jit-context.c          |  2 +-
>  jit/jit-function.c         | 12 ++++++++++--
>  jit/jit-internal.h         |  5 -----
>  5 files changed, 22 insertions(+), 8 deletions(-)
>
> diff --git a/ChangeLog b/ChangeLog
> index 91b251e..3f726ab 100644
> --- a/ChangeLog
> +++ b/ChangeLog
> @@ -1,3 +1,13 @@
> +2018-02-28  Tom Tromey  <address@hidden>
> +
> +       * jit/jit-internal.h (_jit_function_destroy) Don't declare.
> +       * jit/jit-function.c (jit_function_destroy): Rename from
> +       _jit_function_destroy.  Add doc comment.
> +       (jit_function_abandon): Call jit_function_destroy.
> +       * jit/jit-context.c (jit_context_destroy): Call
> +       jit_function_destroy.
> +       * include/jit/jit-function.h (jit_function_destroy): Declare.
> +
>  2018-02-10  Evan Klitzke  <address@hidden>
>
>         * README: fix some typos.
> diff --git a/include/jit/jit-function.h b/include/jit/jit-function.h
> index e24271a..b71e1cd 100644
> --- a/include/jit/jit-function.h
> +++ b/include/jit/jit-function.h
> @@ -80,6 +80,7 @@ unsigned int jit_function_get_optimization_level
>  unsigned int jit_function_get_max_optimization_level(void) JIT_NOTHROW;
>  jit_label_t jit_function_reserve_label(jit_function_t func) JIT_NOTHROW;
>  int jit_function_labels_equal(jit_function_t func, jit_label_t label, 
> jit_label_t label2);
> +void jit_function_destroy(jit_function_t func);
>
>  #ifdef __cplusplus
>  };
> diff --git a/jit/jit-context.c b/jit/jit-context.c
> index a38d93f..4658842 100644
> --- a/jit/jit-context.c
> +++ b/jit/jit-context.c
> @@ -120,7 +120,7 @@ jit_context_destroy(jit_context_t context)
>
>         while(context->functions != 0)
>         {
> -               _jit_function_destroy(context->functions);
> +               jit_function_destroy(context->functions);
>         }
>
>         _jit_memory_destroy(context);
> diff --git a/jit/jit-function.c b/jit/jit-function.c
> index 0f88642..c0a8b97 100644
> --- a/jit/jit-function.c
> +++ b/jit/jit-function.c
> @@ -224,8 +224,16 @@ void _jit_function_free_builder(jit_function_t func)
>         }
>  }
>
> +/*@
> + * @deftypefun jit_function_t jit_function_destroy (jit_function_t 
> @var{function})
> + * Destroy the function, freeing all resources associated with it.
> + *
> + * The front end is responsible for ensuring that the function is not
> + * referenced anywhere, or currently being invoked anywhere.
> + * @end deftypefun
> address@hidden/
>  void
> -_jit_function_destroy(jit_function_t func)
> +jit_function_destroy(jit_function_t func)
>  {
>         jit_context_t context;
>
> @@ -294,7 +302,7 @@ void jit_function_abandon(jit_function_t func)
>                 else
>                 {
>                         /* This function was never compiled, so abandon 
> entirely */
> -                       _jit_function_destroy(func);
> +                       jit_function_destroy(func);
>                 }
>         }
>  }
> diff --git a/jit/jit-internal.h b/jit/jit-internal.h
> index b1fa3b8..92d4401 100644
> --- a/jit/jit-internal.h
> +++ b/jit/jit-internal.h
> @@ -522,11 +522,6 @@ int _jit_function_ensure_builder(jit_function_t func);
>  void _jit_function_free_builder(jit_function_t func);
>
>  /*
> - * Destroy all memory associated with a function.
> - */
> -void _jit_function_destroy(jit_function_t func);
> -
> -/*
>   * Compute value liveness and "next use" information for a function.
>   */
>  void _jit_function_compute_liveness(jit_function_t func);
> --
> 2.13.6
>
>



reply via email to

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