<div dir="ltr"><div>Hi, All</div><div> </div><div>I have a problem to reuse mcjit jitted code loaded from ObjectCache from a file. In the first run, I use MCJIT generate function JittedOpExpr object code as following and it runs OK. 0x7fe4801fa1f8 at instruction 0x00007fe4cc6c2014 points to 0x69382E which is the beginning of ExecEvalVar function. Then I save the object code into a file after implementing notifyObjectCompiled method. </div><div> </div><div><br> IrExprGetValue:<br>0x00007fe4cc6c2000: push %rbp<br>0x00007fe4cc6c2001: mov %rsp,%rbp<br>0x00007fe4cc6c2004: mov 0x10(%rdi),%rax<br>0x00007fe4cc6c2008: pop %rbp<br>0x00007fe4cc6c2009: jmpq *%rax<br>0x00007fe4cc6c200b: nopl 0x0(%rax,%rax,1)<br> JittedOpExpr:<br>0x00007fe4cc6c2010: push %rbp<br>0x00007fe4cc6c2011: mov %rsp,%rbp<br><strong>0x00007fe4cc6c2014: movabs $0x7fe4801fa1f8,%rax</strong><br>0x00007fe4cc6c201e: movabs $0x7fe4801fa1e8,%rdi<br>0x00007fe4cc6c2028: callq *(%rax)<br>0x00007fe4cc6c202a: add $0x5,%rax<br>0x00007fe4cc6c202e: pop %rbp<br>0x00007fe4cc6c202f: retq <br>0x00007fe4cc6c2030: adc $0x0,%al<br>0x00007fe4cc6c2032: add %al,(%rax)<br>0x00007fe4cc6c2034: add %al,(%rax)</div><div> </div><div><strong>0x7fe4801fa1f8 -> 0x69382E</strong></div><div><strong> ExecEvalVar</strong>(ExprState*, ExprContext*, bool*, ExprDoneCond*):<br>0x000000000069382e: push %rbp<br>0x000000000069382f: mov %rsp,%rbp<br>0x0000000000693832: push %r12<br><br clear="all"></div><div>In the next run, I buildedunction of JittedOpExpr again and loaded compiled object from that saved binary file using getObject and went through getPointertoFunction from MCJIT execution engine, I got the following object code in memory. But this time 0x7fe4801fa1f8 points to 0x0, so when callq *(%rax) it couldn't find the ExecEvalVar anymore. I followed the blog "Object Caching with the Kaleidoscope Example Problem" written by Andy Kaylor by implementing my own MCJITObjectCache class. Did I miss anything here? Thank you very much. </div><div> </div><div> IrExprGetValue:<br>0x00007fe4cc6c2000: push %rbp<br>0x00007fe4cc6c2001: mov %rsp,%rbp<br>0x00007fe4cc6c2004: mov 0x10(%rdi),%rax<br>0x00007fe4cc6c2008: pop %rbp<br>0x00007fe4cc6c2009: jmpq *%rax<br>0x00007fe4cc6c200b: nopl 0x0(%rax,%rax,1)<br> JittedOpExpr:<br>0x00007fe4cc6c2010: push %rbp<br>0x00007fe4cc6c2011: mov %rsp,%rbp<br><strong>0x00007fe4cc6c2014: movabs $0x7fe4801fa1f8,%rax</strong><br>0x00007fe4cc6c201e: movabs $0x7fe4801fa1e8,%rdi<br>0x00007fe4cc6c2028: callq *(%rax)<br>0x00007fe4cc6c202a: add $0x5,%rax<br>0x00007fe4cc6c202e: pop %rbp<br>0x00007fe4cc6c202f: retq </div><div> </div><div><strong>but 0x7fe4801fa1f8 -> 000000000</strong><br><br>-- <br>Best regards<br><br>Cheng
</div></div>