[LLVMdev] Importance of VMKit JIT function cache
Gaël Thomas
gael.thomas00 at gmail.com
Thu Apr 17 15:34:10 PDT 2014
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/
-------------------------------------------------------------------
More information about the llvm-dev
mailing list