dotgnu-libjit
[Top][All Lists]
Advanced

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

Re: [Dotgnu-libjit] [PATCH] Enable constant folding


From: Aleksey Demakov
Subject: Re: [Dotgnu-libjit] [PATCH] Enable constant folding
Date: Mon, 4 Mar 2013 12:25:59 +0300

Hi Alexey,

As far as I see _jit_opcode_apply() currently does not properly
support opcode errors such as division by zero and integer
overflow. So your patch might break things in certain cases.

The opcode stuff was written by Klaus and now I need a little
bit more time to fully understand where to go with it.

Regards,
Aleksey

On Tue, Feb 26, 2013 at 7:19 PM, Alexey Galakhov <address@hidden> wrote:
> Signed-off-by: Alexey Galakhov <address@hidden>
> ---
>  jit/jit-insn.c |   18 ++++++++++++++++++
>  1 file changed, 18 insertions(+)
>
> diff --git a/jit/jit-insn.c b/jit/jit-insn.c
> index bbd60b6..baf438c 100644
> --- a/jit/jit-insn.c
> +++ b/jit/jit-insn.c
> @@ -288,6 +288,15 @@ static jit_value_t apply_unary
>         {
>                 return 0;
>         }
> +       if(value1->is_constant &&
> +          !jit_context_get_meta_numeric(func->context, JIT_OPTION_DONT_FOLD))
> +       {
> +               dest = _jit_opcode_apply(func, (short)oper, result_type, 
> value1, 0);
> +               if (dest)
> +               {
> +                       return dest;
> +               }
> +       }
>         insn = _jit_block_add_insn(func->builder->current_block);
>         if(!insn)
>         {
> @@ -322,6 +331,15 @@ static jit_value_t apply_binary
>         {
>                 return 0;
>         }
> +       if(value1->is_constant && value2->is_constant &&
> +          !jit_context_get_meta_numeric(func->context, JIT_OPTION_DONT_FOLD))
> +       {
> +               dest = _jit_opcode_apply(func, (short)oper, result_type, 
> value1, value2);
> +               if (dest)
> +               {
> +                       return dest;
> +               }
> +       }
>         insn = _jit_block_add_insn(func->builder->current_block);
>         if(!insn)
>         {
> --
> 1.7.10.4
>
>
> _______________________________________________
> Dotgnu-libjit mailing list
> address@hidden
> https://lists.gnu.org/mailman/listinfo/dotgnu-libjit



reply via email to

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