[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: GCC JIT vs others JIT ....
On Thu, 2013-10-24 at 21:53 +0200, Basile Starynkevitch wrote:
> On Thu, 2013-10-24 at 14:53 -0400, David Malcolm wrote:
> [...]
> > BTW, does lightning support self-modifying code? (e.g. for doing
> > inline caching of attribute lookup).
>
> But GCC does not (support self-modifying code). How would you make GCC
> JIT accept it if GCC does not?
By making GCC handle it ;)
There may be things that are reasonable to do in a JIT that make little
sense for an AOT compiler, and self-modifying code is one of them, e.g.
for conditionals that almost always take one branch such as for
guard-style conditionals inside a loop, where we're recording the
assumptions about the types we're working on, with a
if (expr != expected_value)
and we don't expect the non-equal branch to ever be followed, but for
correctness it must exist, and we need to be able to update
expected_value. In such a case, we want the most efficient check for
the commonly-executed case, and hardcoding expected_value inside the
compare instruction and then directly modifying it in place on the rare
chance it changes might be most efficient.
These are vague, long-term ideas, of course.