[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Lightning] On the benefits of inlining
From: |
Paolo Bonzini |
Subject: |
Re: [Lightning] On the benefits of inlining |
Date: |
Fri, 02 Sep 2005 19:12:25 +0200 |
User-agent: |
Mozilla Thunderbird 0.9 (Macintosh/20041103) |
While it works, it turns out to be quite inefficient. It's even
slightly less efficient than the function-call-style equivalent.
the overhead is high and patching is not lightweight, either. i have
not understood exactly when you do it.
but be careful, you do need to call jit_prolog to set up lightning
before generating the first instruction. GNU Smalltalk has some
examples of compiling prolog-less subroutines that are used by the
jit-ed code.
Instead of the goto you can put an asm ("jmp *%0" : : "r" (&&abc) :
"eax", "ecx", "edx"); so you can avoid the push/pop and GCC does not
think that no instruction will execute after the jump (which it does, if
you have a goto). It is unportable, however. :-(
Have you ever tried such things? Clearly, this would only make sense
for very small pieces of code like this one (there's actually only one
useful instruction so making it a function induces too much overhead).
This would *not* make sense for very small pieces of code like this one,
or did I miss something?
I believe it would be useful to have back-ends export a mapping between
the Lightning register names and the corresponding GCC register names
for that architecture. In the above example, it would allow to pass the
input operand directly into the appropriate register (via an `asm'
statement) and fetch the result likewise.
What do you think?
Yes, that's right. I have not thought about it, though.
Paolo