Hi Gael I am sorry that I couldn't explain what I was trying to say, anyway I've got the answer :) . In the *parseFunction* method returns *llvmfunction* pointer of compiled method and then it will be stored in to cache. Could you please more elaborate on how those machine instructions ( native functions) executing by llvm. I was trying trace and I couldn't able to find out which component is taking those native functions and execute them once its compiled. Thank you for your help. Regards Sri. On 04/17/2014 08:05 PM, Gaël Thomas wrote:> > Hi Sri, > > I think that I don't understand your question :) We have a cache.of > compiled functions (native functions) and uses it to execute the Java > code in the JIT. And, we do not keep the llvm representation of Java > methods because we never reuse it (only in the AOT to generate the > llvm bitcode file). > > I hope that it helps? > Gaël > > Le 16 avr. 2014 14:19, "Sri" <emdcdeveloper at gmail.com > <mailto:emdcdeveloper at gmail.com>> a écrit : > > Hi > VMKit JIT has a function cache to store compiled IR code , > so, as soon as method is compiled , it will be stored in to > function cache. My question is , who will use this compiled > information from function cache. Since we are jitting , the > llvm translate source code in to native code and executing them . > So, how we relates this function cache with JIT ? > > Thanks > > Regards > Sri. > > _______________________________________________ > LLVM Developers mailing list > LLVMdev at cs.uiuc.edu <mailto:LLVMdev at cs.uiuc.edu> > http://llvm.cs.uiuc.edu > http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev >-------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20140417/ade1aaab/attachment.html>
Hi Sri, Basically, we use the functions generated in MetaJIT. Basically, we generate a stub for each Java signature to call a Java method from c++ code. If we call a method from c++ to Java, we directly use MetaJIT.h. Otherwise, it's a little bit more complicated. For an invokeVirtual, we use a virtual table to dispatch the call. The entry is initially filled up with a trampoline (invokeVirtual), and replaced with the compiled function after its compilation for the next calls. For a special or static call, we also use an indirection. We use the code pointer of the Java method descriptor (C++ class JavaMethod). And we are doing almost the same thing, we initially use a trampoline and then replace it with the compiled function. And we are using Interface Method Dispatch for interface calls (which also use trampolines). The trampolines retrieve the target method by using tricks (by using debug info), and, if I remember correctly, uses the stubs generated in MetaJIT for the first calls. If you want to understand this part of the code, it's maybe a little bit ugly :) Gaël 2014-04-18 0:10 GMT+02:00 Sri <emdcdeveloper at gmail.com>:> Hi Gael > I am sorry that I couldn't explain what I was trying to say, anyway > I've got the answer :) . In the parseFunction method returns llvmfunction > pointer of compiled method and then it will be stored in to cache. Could you > please more elaborate on how those machine instructions ( native functions) > executing by llvm. I was trying trace and I couldn't able to find out which > component is taking those native functions and execute them once its > compiled. > > Thank you for your help. > > > Regards > Sri. > On 04/17/2014 08:05 PM, Gaël Thomas wrote: > > Hi Sri, > > I think that I don't understand your question :) We have a cache.of compiled > functions (native functions) and uses it to execute the Java code in the > JIT. And, we do not keep the llvm representation of Java methods because we > never reuse it (only in the AOT to generate the llvm bitcode file). > > I hope that it helps? > Gaël > > Le 16 avr. 2014 14:19, "Sri" <emdcdeveloper at gmail.com> a écrit : >> >> Hi >> VMKit JIT has a function cache to store compiled IR code , so, as >> soon as method is compiled , it will be stored in to function cache. My >> question is , who will use this compiled information from function cache. >> Since we are jitting , the llvm translate source code in to native code >> and executing them . So, how we relates this function cache with JIT ? >> >> Thanks >> >> Regards >> Sri. >> >> _______________________________________________ >> LLVM Developers mailing list >> LLVMdev at cs.uiuc.edu http://llvm.cs.uiuc.edu >> http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev >> >-- ------------------------------------------------------------------- Gaël Thomas, Associate Professor, UPMC http://pagesperso-systeme.lip6.fr/Gael.Thomas/ -------------------------------------------------------------------
Hi Gael Thank you for your detailed answer, Hope I will trace out the actual work flow. Currently VMKit stores all the compiled function in the cache and calling func->deleteBody() which is basically drop all the reference and set to an external linkage. Is it possible to use executionEngine->getPointerToFunction(func) and then func->deleteBody(), so, it will drop the machine code from the memory ? How can I effectively remove the machine code which was generated for some specific Java method, for example , in the Java byte code , I want to drop the machine code to method test() { int a =0;} once generated , so that again I can compile with different optimization level and generate native code. Thanks. Regards Sri. On 04/17/2014 11:34 PM, Gaël Thomas wrote:> Hi Sri, > > Basically, we use the functions generated in MetaJIT. Basically, we > generate a stub for each Java signature to call a Java method from c++ > code. If we call a method from c++ to Java, we directly use MetaJIT.h. > Otherwise, it's a little bit more complicated. For an invokeVirtual, > we use a virtual table to dispatch the call. The entry is initially > filled up with a trampoline (invokeVirtual), and replaced with the > compiled function after its compilation for the next calls. For a > special or static call, we also use an indirection. We use the code > pointer of the Java method descriptor (C++ class JavaMethod). And we > are doing almost the same thing, we initially use a trampoline and > then replace it with the compiled function. And we are using Interface > Method Dispatch for interface calls (which also use trampolines). The > trampolines retrieve the target method by using tricks (by using debug > info), and, if I remember correctly, uses the stubs generated in > MetaJIT for the first calls. > > If you want to understand this part of the code, it's maybe a little bit ugly :) > Gaël > > > > > > > 2014-04-18 0:10 GMT+02:00 Sri <emdcdeveloper at gmail.com>: >> Hi Gael >> I am sorry that I couldn't explain what I was trying to say, anyway >> I've got the answer :) . In the parseFunction method returns llvmfunction >> pointer of compiled method and then it will be stored in to cache. Could you >> please more elaborate on how those machine instructions ( native functions) >> executing by llvm. I was trying trace and I couldn't able to find out which >> component is taking those native functions and execute them once its >> compiled. >> >> Thank you for your help. >> >> >> Regards >> Sri. >> On 04/17/2014 08:05 PM, Gaël Thomas wrote: >> >> Hi Sri, >> >> I think that I don't understand your question :) We have a cache.of compiled >> functions (native functions) and uses it to execute the Java code in the >> JIT. And, we do not keep the llvm representation of Java methods because we >> never reuse it (only in the AOT to generate the llvm bitcode file). >> >> I hope that it helps? >> Gaël >> >> Le 16 avr. 2014 14:19, "Sri" <emdcdeveloper at gmail.com> a écrit : >>> Hi >>> VMKit JIT has a function cache to store compiled IR code , so, as >>> soon as method is compiled , it will be stored in to function cache. My >>> question is , who will use this compiled information from function cache. >>> Since we are jitting , the llvm translate source code in to native code >>> and executing them . So, how we relates this function cache with JIT ? >>> >>> Thanks >>> >>> Regards >>> Sri. >>> >>> _______________________________________________ >>> LLVM Developers mailing list >>> LLVMdev at cs.uiuc.edu http://llvm.cs.uiuc.edu >>> http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev >>> > >