[cairo] JIT for pixman

Dan Amelang daniel.amelang at gmail.com
Thu Jan 8 14:20:53 PST 2009


On Thu, Jan 8, 2009 at 1:44 PM, Behdad Esfahbod <behdad at behdad.org> wrote:
>>> But linking cairo to LLVM is not something many people will be fond of.
>>
>> They will be if their concerns are met.
>
> Ideally the generated code should be cached on disk and mmapped by all
> processes.

Sure, replicated generated code could end up taking too much memory
and/or cause poor instruction cache behavior. Sharing the code between
processes is one solution. Another is to keep a small per-process
cache that tries to hold onto the working set of compositing
functions, like I did in jitblt.

Also, I found that the generated functions aren't prohibitively large
(hundreds of bytes). Consider how much program code pixman has when
compiled with MMX/SSE2 enabled. Given that that all would "go away",
replaced by generated code, I think the net increase won't be too bad.
Keep in mind, too, that code generation for a given function can take
less than a millisecond. That allows you to keep your cache small.

FWIW, I found that for a given machine and set of applications, the
number of compositing code paths actually taken is pretty small (5 -
25), both absolutely and relative to the number of all possible
compositing paths. This is because for a given environment, a small
subset of pixel formats are used, small subset of operators are used,
etc. And we're only talking about the image backend, xrender would
share generated code paths between the client apps, obviously.

> At that point, a heavier framework may be less of a concern.

Making the framework lighter may also make it less of a concern.

Dan


More information about the cairo mailing list