lightning
[Top][All Lists]
Advanced

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

Re: [Lightning] About using lightning on a dynamically typed language


From: Paolo Bonzini
Subject: Re: [Lightning] About using lightning on a dynamically typed language
Date: Sun, 16 May 2010 09:14:30 +0200

>  The language vm is currently implemented using computed gotos, and
> I plan to add several "super instructions" to it to attempt to reduce
> the cost of indirect jumps.

You can expect 15-40% performance improvement from that, depending on
the architecture (unfortunately 40% was on the Pentium 4...).

So you have three types, int64/float64/object?

>  I understand that it may make it significantly hard to implement as
> pure jit, but I was wondering how/if it could be made in a way where
> it kind of "cut&paste" blocks of compiled code

People tried that but it's very difficult as more optimizations were
added to modern GCC. lightning could be used to cut&paste those blocks
after you converted them from C to lightning's pseudo-assembly.

> and have it to choose
> the next opcode in a way where it can tell in advance the processor
> where it is jumping next; if you look in the code, you can see that
> it sets a "register void *const *label" variable significantly before
> jumping to the next instruction, but that doesn't help branch prediction,
> and I don't know if I could somehow instruct gcc to generate code to
> tell about it...

On ia64 you can add __asm__("bNN") to the declaration of the variable.
 You can look at GCC's generated assembly to find a suitable value of
NN.  On PPC, GCC should take care of splitting the mtctr and bctr
instructions.  But on i686 there's no instruction to aid branch
prediction (better, instruction fetch speculation) in the presence of
indirect jumps.

> [the language doesn't have yet a defined name, it is also a kind of
> hobby, doesn't have yet a defined usage either, it is "just for fun",

Nothing wrong with it!

Paolo



reply via email to

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