lightning
[Top][All Lists]
Advanced

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

Re: [Lightning] Re: Predicting generated code size


From: Sandro Magi
Subject: Re: [Lightning] Re: Predicting generated code size
Date: Sun, 30 Sep 2007 20:51:09 -0400

Accidentally sent this reply to Paulo only. Sorry!

On 9/30/07, Paolo Bonzini <address@hidden> wrote:
>
> > Hmm, I would expect branch prediction rate to be 100% since it's an
> > unconditional jump, so it should only be a minor hit, if any.
>
> Yes, this is probably the best thing to do.

This strikes me as something that might be useful to add at
Lightning's macro-instruction level. By this I mean, each instruction
macro for a given arch knows how many bytes it requires, so it can
perform the overflow check before writing out the bytes and insert the
branch if necessary. I'm not quite sure what consequences this might
have for the instruction-macro however, since the buffers are all
client-provided. Perhaps the additional complexity isn't warranted.

> You can expect more or less
> an instruction to take at most 20 bytes, I'd say, surely less than 32.

Surely not 20 or 32 bytes for simple moves and adds? Are you referring
to function call preludes and other more complicated instructions?

Also, this estimate is probably inappropriate for 64-bit architectures
(should Lightning ever support UltraSparc or x86-64). Perhaps
Lightning should provide a macro which is an "average expanded
instruction length" which clients can use as a scaling factor when
allocating buffers.

Sandro




reply via email to

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