<p>Ok I see. Of course, at runtime, it's enough for dynamic linking or for deoptimization. However, wmkit acts both as a jit and as an aot. For the aot, it means that I can not use patchpoint and that I should have two different compilation strategy. It's not so difficult, but in this case, I can not use patchpoints to generate gc's stackmap for the aot (basically, I think that I could use a patchpoint to generate a safepoint where I know the locations of my roots by ysing them as arguments of the patchpoint?)?</p>

<p>Do you think that using a symbol for my targets is easy to implement? Or maybe that there is a conceptual problem for symbols in this case?</p>
<p>By the way, were can I find the metadata at the end of the compilation? They are generated in a special symbol/section?</p>
<p>Anyway, thank you for your answer,<br>
Gaël </p>
<div class="gmail_quote">Le 18 déc. 2013 02:17, "Filip Pizlo" <<a href="mailto:fpizlo@apple.com">fpizlo@apple.com</a>> a écrit :<br type="attribution"><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div style="word-wrap:break-word">patchpoint is intended to be used in VMs that do their own linking, and so you wouldn't expect the function parameter to be resolved by LLVM.<div><br></div><div>Presumably, in VMKit, you could just plant a pointer constant to the function you wish to call initially?</div>
<div><br></div><div>-Filip</div><div><br></div><div><br><div><div>On Dec 17, 2013, at 2:42 PM, Gaël Thomas <<a href="mailto:gael.thomas00@gmail.com" target="_blank">gael.thomas00@gmail.com</a>> wrote:</div><br><blockquote type="cite">
<div style="font-size:12px;font-style:normal;font-variant:normal;font-weight:normal;letter-spacing:normal;line-height:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px">Hi all,<br>
<br>I'm trying to play with patchoint (with MCJIT and VMKit) and I don't<br>understand something. I generate this call for my first patch point.<br>Basically, I want to call f(0).<br><br>%5 = call i64 (i64, i32, i8*, i32, ...)* @llvm.experimental.patchpoint.i64(<br>
 i64 42, ;; patch point id is 42<br> i32 0,   ;; 0 bytes for the padding<br> i8* bitcast (i32 (i32)* @f to i8*), ;; my function f<br> i32 1,   ;; 1 argument<br> i32 0)   ;; the argument<br><br>I think that the types are correct (at least, the compiler seems happy<br>
with that:)). But when I'm trying to compile the code (that I generate<br>from C++, it's not a bitcode file), I have this message:<br><br>Assertion failed: (isa<X>(Val) && "cast<Ty>() argument of incompatible<br>
type!"), function cast, file<br>/Users/gthomas/research/vmkit4/llvm-src/include/llvm/Support/Casting.h,<br>line 232.<br><br>With this stack (I only give the relevant part):<br><br>   frame #5: 0x000000010092ed44<br>libjvm.dylib`llvm::SelectionDAGBuilder::visitPatchpoint() + 3780 at<br>
SelectionDAGNodes.h:610<br>   frame #6: 0x000000010091f511<br>libjvm.dylib`llvm::SelectionDAGBuilder::visitIntrinsicCall(this=0x0000000106ff4d20,<br>I=0x0000000106fea460) + 10961 at SelectionDAGBuilder.cpp:5349<br>   frame #7: 0x0000000100904c4a<br>
libjvm.dylib`llvm::SelectionDAGBuilder::visitCall(this=0x0000000106ff4d20,<br>I=0x0000000106fea460) + 234 at SelectionDAGBuilder.cpp:5870<br>   frame #8: 0x00000001008fc9ea<br>libjvm.dylib`llvm::SelectionDAGBuilder::visit(this=0x0000000106ff4d20,<br>
I=0x0000000106fea460) + 74 at SelectionDAGBuilder.cpp:971<br>   frame #9: 0x0000000100947e98<br>libjvm.dylib`llvm::SelectionDAGISel::SelectBasicBlock(this=0x0000000106ff40d0,<br>HadTailCall=0x00007fff5fbfe31e) + 40 at SelectionDAGISel.cpp:579<br>
   frame #10: 0x0000000100947aee<br>libjvm.dylib`llvm::SelectionDAGISel::SelectAllBasicBlocks(this=0x0000000106ff40d0,<br>Fn=0x0000000106fe7020) + 8174 at SelectionDAGISel.cpp:1192<br>   frame #11: 0x0000000100944b94<br>libjvm.dylib`llvm::SelectionDAGISel::runOnMachineFunction(this=0x0000000106ff40d0)<br>
+ 1588 at SelectionDAGISel.cpp:434<br>   frame #12: 0x0000000100afefc0<br>libjvm.dylib`llvm::MachineFunctionPass::runOnFunction() + 128 at<br>MachineFunctionPass.cpp:33<br>   frame #13: 0x00000001010837fb<br>libjvm.dylib`llvm::FPPassManager::runOnFunction(this=0x0000000106fedf20,<br>
F=0x0000000106fe7020) + 331 at LegacyPassManager.cpp:1538<br>   frame #14: 0x0000000101083abb<br>libjvm.dylib`llvm::FPPassManager::runOnModule(this=0x0000000106fedf20)<br>+ 59 at LegacyPassManager.cpp:1558<br>   frame #15: 0x000000010108402d<br>
libjvm.dylib`llvm::legacy::PassManagerImpl::run(llvm::Module&)<br>[inlined] llvm::legacy::PassManagerImpl::getContainedManager(N=0,<br>this=0x0000000106feb9f0) + 429 at LegacyPassManager.cpp:1616<br>   frame #16: 0x0000000101083e80<br>
libjvm.dylib`llvm::legacy::PassManagerImpl::run(this=0x0000000106feb9f0,<br>M=0x0000000106fe6f30) + 544 at LegacyPassManager.cpp:1711<br>   frame #17: 0x000000010108466d<br>libjvm.dylib`llvm::legacy::PassManager::run() + 13 at<br>
LegacyPassManager.cpp:1746<br>   frame #18: 0x0000000100eeaf8c<br>libjvm.dylib`llvm::MCJIT::emitObject(this=0x0000000106fa69a0,<br>M=0x0000000106fe6f30) + 236 at MCJIT.cpp:131<br>   frame #19: 0x0000000100eeb2d3<br>libjvm.dylib`llvm::MCJIT::generateCodeForModule(this=0x0000000106fa69a0,<br>
M=0x0000000106fe6f30) + 323 at MCJIT.cpp:169<br>   frame #20: 0x0000000100eec022<br>libjvm.dylib`llvm::MCJIT::getFunctionAddress(std::string const&)<br>[inlined] llvm::MCJIT::getSymbolAddress(this=0x0000000106fa69a0,<br>
CheckFunctionsOnly=true) + 58 at MCJIT.cpp:279<br>   frame #21: 0x0000000100eebfe8<br>libjvm.dylib`llvm::MCJIT::getFunctionAddress(this=0x0000000106fa69a0,<br>Name=0x00007fff5fbfe7b0) + 40 at MCJIT.cpp:295<br>...<br><br>So, I don't understand where could be my mistake?<br>
<br>Thank you in advance,<br>Gaël<br><br><br><br>--<span> </span><br>-------------------------------------------------------------------<br>Gaël Thomas, Associate Professor, UPMC<br><a href="http://pagesperso-systeme.lip6.fr/Gael.Thomas/" target="_blank">http://pagesperso-systeme.lip6.fr/Gael.Thomas/</a><br>
-------------------------------------------------------------------<br><br>_______________________________________________<br>LLVM Developers mailing list<br><a href="mailto:LLVMdev@cs.uiuc.edu" target="_blank">LLVMdev@cs.uiuc.edu</a><span> </span>        <a href="http://llvm.cs.uiuc.edu/" target="_blank">http://llvm.cs.uiuc.edu</a><br>
<a href="http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev" target="_blank">http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev</a></div></blockquote></div><br></div></div></blockquote></div>