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.
----- 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 >
BGB wrote:> 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). >For me there are no problems of self-modifying code (the LLVM jit already does it)> 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. > > >That's again what I want to avoid. This is my current implementation, and I _really_ would like to avoid unnecessary calls once the type is resolved.> 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 >> >> > > _______________________________________________ > LLVM Developers mailing list > LLVMdev at cs.uiuc.edu http://llvm.cs.uiuc.edu > http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev >