dotgnu-libjit
[Top][All Lists]
Advanced

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

Re: [Dotgnu-libjit] Constant folding


From: Aleksey Demakov
Subject: Re: [Dotgnu-libjit] Constant folding
Date: Fri, 22 Feb 2013 14:12:34 +0300

Hi Alexey,

Thanks for the report. I will take a look.

Regards,
Aleksey

On Fri, Feb 22, 2013 at 1:30 PM, Alexey Galakhov
<address@hidden> wrote:
> Hello,
>
> I recently discovered that libjit does not fold constants. Consider the
> following:
>
> jit_value_t a = jit_value_create_nint_constant(func, jit_type_int, 2);
> jit_value_t b = jit_value_create_nint_constant(func, jit_type_int, 3);
> jit_value_t x = jit_insn_add(func, a, b);
> jit_insn_return(func, x);
>
> After compiling, the jit_dump_function() prints the following:
>
> b777203d:       55                      push   %ebp
> b777203e:       8b ec                   mov    %esp,%ebp
> b7772040:       b8 02 00 00 00          mov    $0x2,%eax
> b7772045:       05 03 00 00 00          add    $0x3,%eax
> b777204a:       5d                      pop    %ebp
> b777204b:       c3                      ret
>
> I found that the constant folding seems to be done using
> _jit_opcode_apply() function from jit-opcode-apply.c. However, it seems
> not to be used at all:
>
> $ grep -rI _jit_opcode_apply
> jit/jit-internal.h:_jit_opcode_apply(jit_function_t func, jit_uint
> opcode, jit_type_t dest_type,
> jit/jit-opcode-apply.c: * This is checked on entry of the public
> _jit_opcode_apply function.
> jit/jit-opcode-apply.c:_jit_opcode_apply(jit_function_t func, jit_uint
> opcode, jit_type_t dest_type,
>
> Why?..
>
> My version of libjit is the most recent git one.
>
> Regards,
> Alex
>
> _______________________________________________
> 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]