lightning
[Top][All Lists]
Advanced

[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: Mon, 05 Sep 2005 09:51:48 +0200
User-agent: Mozilla Thunderbird 0.9 (Macintosh/20041103)


However,
patching the `movi' instruction (in order to pass the input/output
parameter) is done every time before the dynamically compiled code is
used. I was assuming that patching was pretty lightweight, at least
on RISC machines.

That's why a register would be preferable. Patching is about as expensive as writing one instruction, or only slightly less. That is, jit_movi + jit_patch_movi is about as expensive as writing 2 movs.

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. :-(
Right, hence the need for a mapping of register names.  And a mapping
for some instructions (like `jmp') would come in handy as well.  ;-)

Yes... I have to think about it, I must admit I don't like the idea of providing asm statements within lightning.h. Even though the way you'd be using it is indeed cute.

This would *not* make sense for very small pieces of code like this one, or did I miss something?
Well, so long as the inlined code has to save registers and so on, this
doesn't make much sense anyway.

... or it makes sense only for moderately large pieces of code. I see your point now.,

Paolo




reply via email to

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