[LLVMdev] Dynamic (JIT) type resolution

BGB cr88192 at hotmail.com
Tue Nov 6 13:21:21 PST 2007


----- Original Message ----- 
From: "Nicolas Geoffray" <nicolas.geoffray at lip6.fr>
To: "LLVM Developers Mailing List" <llvmdev at cs.uiuc.edu>
Sent: Wednesday, November 07, 2007 6:17 AM
Subject: Re: [LLVMdev] Dynamic (JIT) type resolution


> Chris Lattner wrote:
>>
>> I don't see how it's the same issue.  Once you jit it, it is just machine
>> code.  Updating the machine code with better code seems like a reasonable
>> and obvious optimization.
>>
>>
>
> That's what I want to do! ;-) However, from what I understand, your
> solution is to recompile the method. And I don't want to do that. I only
> want to dynamically patch the field operation in the native code.

maybe a tradeoff is possible:
the function to get the offset is replaced by a function pointer and a stub 
(avoiding many of the general problems involved with using 
self-modifying-code).

the fist time it is called, the function pointer points to 'stub A', which 
calls the function to lookup the slot offset,
this function then stores the value in a variable, and updates the function 
pointer to point to 'stub B'.

'stub B', simply returns the value stored in the variable.


this should not be too difficult to implement I would think (albeit 
admittedly I still don't know a whole lot about LLVM).

hope this is of some use, in any case.


> _______________________________________________
> LLVM Developers mailing list
> LLVMdev at cs.uiuc.edu         http://llvm.cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev
> 




More information about the llvm-dev mailing list