[LLVMdev] Avoiding jump (branch) instructions in a LLVM JavaScript backend

me22 me22.ca at gmail.com
Sun Jan 4 11:10:19 PST 2009


On Sun, Jan 4, 2009 at 12:29, Charles Ying <charles.ying at gmail.com> wrote:
> Sadly, JavaScript does not support a "goto" style of jump instruction,
> making it "tricky" to code generate a jump instruction.
>
> What might you recommend for avoiding jump instructions? Is there a
> transformation for something like this or any other ideas? The only solution
> I see at the moment is to write a small VM execution loop in JavaScript, but
> I was hoping that there might be other solutions.
>

What about splitting each block into a javascript function and calling
it with setTimeout( function() {...}, 0)?  Or, similarly, having a
while (1) { continuation(); } loop, where goto becomes continuation =
function() {...};.



More information about the llvm-dev mailing list