<html><head><meta http-equiv="Content-Type" content="text/html; charset=utf-8"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; line-break: after-white-space;" class=""><br class=""><div><br class=""><blockquote type="cite" class=""><div class="">On 14 Jun 2019, at 12:36, Tianxiao Gu <<a href="mailto:tianxiao.gu@gmail.com" class="">tianxiao.gu@gmail.com</a>> wrote:</div><br class="Apple-interchange-newline"><div class=""><div dir="ltr" class="">Hi Doug,<div class=""><br class=""></div><div class="">Thank you very much for your reply.</div><div class=""><br class=""></div><div class="">First, I am not sure whether the bug applies to AOT execution only. I used AOT to create the test case because in AOT I can easily force inline and also trigger the invocation of <font face="courier new, monospace" class="">resolve_klass_by_symbol</font>. I think this bug should apply to AOT only if method <span style="font-family:"courier new",monospace" class="">resolve_klass_by_symbol </span>is only used by AOT.</div></div></div></blockquote><div><br class=""></div><div>I think that must be the case since CompilerRuntime is not present in <a href="https://github.com/graalvm/graal-jvmci-8" class="">https://github.com/graalvm/graal-jvmci-8</a>.</div><br class=""><blockquote type="cite" class=""><div dir="ltr" class=""><div class="">In my opinion, CompilerRutime in JVMCI should be consistent with SharedRuntime, where SharedRuntime uses the <font face="courier new, monospace" class="">vframeStream</font> to do the stack walk in the similar case.</div></div></blockquote><div><br class=""></div>Sounds reasonable but I’m not so familiar with CompilerRuntime so will others comment on that.</div><div><br class=""></div><div>-Doug</div><div><br class=""><blockquote type="cite" class=""><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Fri, Jun 14, 2019 at 2:35 AM Doug Simon <<a href="mailto:doug.simon@oracle.com" class="">doug.simon@oracle.com</a>> wrote:<br class=""></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div style="overflow-wrap: break-word;" class=""><div class="">Hi Tianxiao,</div><div class=""><br class=""></div>Just for clarification, this only applies to AOT execution if I understand correctly?<div class=""><br class=""><div class="">-Doug<br class=""><div class=""><br class=""><blockquote type="cite" class=""><div class="">On 14 Jun 2019, at 10:09, Tianxiao Gu <<a href="mailto:tianxiao.gu@gmail.com" target="_blank" class="">tianxiao.gu@gmail.com</a>> wrote:</div><br class="gmail-m_-7534576364231132385Apple-interchange-newline"><div class=""><div dir="ltr" class=""><div class="">Hi All,</div><br class="">JVMCI may use a wrong classloader to resolve a callee class when the caller frame (obtained by <font face="courier new, monospace" class="">frame caller_frame = thread->last_frame().sender(&cbl_map);</font>) is a compiled inlined method (see <font face="courier new, monospace" class="">CompilerRuntime::resolve_klass_helper</font> at <a href="http://hg.openjdk.java.net/jdk/jdk/file/1afe0cb93482/src/hotspot/share/jvmci/compilerRuntime.cpp#l60" target="_blank" class="">http://hg.openjdk.java.net/jdk/jdk/file/1afe0cb93482/src/hotspot/share/jvmci/compilerRuntime.cpp#l60</a>).<div class=""><br class=""></div><div class="">In an inlined method, the actual, direct caller of an unresolved callee may not be the root of the inline tree. The actual caller and the root of the inline tree may even have different classloaders. This should be a bug and can be reproduced with the attached test case in JDK 11. A patch would use <font face="courier new, monospace" class="">vframeStream</font> to walk the stack.<div class=""><br class=""></div><div class="">The test case is based on AOT and uses custom classloaders. In JDK 11, we are still able to use AOT with custom classloaders though it is not type-safe. (See bug report <a href="https://bugs.openjdk.java.net/browse/JDK-8206963" target="_blank" class="">https://bugs.openjdk.java.net/browse/JDK-8206963</a>). Custom classloaders have been disabled in AOT in <a href="http://hg.openjdk.java.net/jdk/jdk/rev/ccfa71bacd6f" target="_blank" class="">http://hg.openjdk.java.net/jdk/jdk/rev/ccfa71bacd6f</a>. That means this bug will not be able to be reproduced in the latest JDK with the attached test case.</div><div class=""><div class=""><br class=""></div><div class="">Environment:</div><div class=""><div style="margin:0px;font-variant-numeric:normal;font-variant-east-asian:normal;font-stretch:normal;font-size:11px;line-height:normal;font-family:Menlo" class=""><span class="gmail-m_-7534576364231132385gmail-s1" style="font-variant-ligatures:no-common-ligatures">$ uname -a</span></div><div style="margin:0px;font-variant-numeric:normal;font-variant-east-asian:normal;font-stretch:normal;font-size:11px;line-height:normal;font-family:Menlo" class=""><span class="gmail-m_-7534576364231132385gmail-s1" style="font-variant-ligatures:no-common-ligatures">Darwin US-204496-MP.local 18.6.0 Darwin Kernel Version 18.6.0: Thu Apr 25 23:16:27 PDT 2019; root:xnu-4903.261.4~2/RELEASE_X86_64 x86_64</span></div><div style="margin:0px;font-variant-numeric:normal;font-variant-east-asian:normal;font-stretch:normal;font-size:11px;line-height:normal;font-family:Menlo" class=""><span class="gmail-m_-7534576364231132385gmail-s1" style="font-variant-ligatures:no-common-ligatures">$ </span><span style="font-variant-ligatures:no-common-ligatures" class="">java -version</span></div><div style="margin:0px;font-variant-numeric:normal;font-variant-east-asian:normal;font-stretch:normal;font-size:11px;line-height:normal;font-family:Menlo" class=""><span class="gmail-m_-7534576364231132385gmail-s1" style="font-variant-ligatures:no-common-ligatures">java version "11.0.2" 2019-01-15 LTS</span></div><div style="margin:0px;font-variant-numeric:normal;font-variant-east-asian:normal;font-stretch:normal;font-size:11px;line-height:normal;font-family:Menlo" class=""><span class="gmail-m_-7534576364231132385gmail-s1" style="font-variant-ligatures:no-common-ligatures">Java(TM) SE Runtime Environment 18.9 (build 11.0.2+9-LTS)</span></div><div style="margin:0px;font-variant-numeric:normal;font-variant-east-asian:normal;font-stretch:normal;font-size:11px;line-height:normal;font-family:Menlo" class=""><span class="gmail-m_-7534576364231132385gmail-s1" style="font-variant-ligatures:no-common-ligatures">Java HotSpot(TM) 64-Bit Server VM 18.9 (build 11.0.2+9-LTS, mixed mode)</span></div><div style="margin:0px;font-variant-numeric:normal;font-variant-east-asian:normal;font-stretch:normal;font-size:11px;line-height:normal;font-family:Menlo" class=""><span class="gmail-m_-7534576364231132385gmail-s1" style="font-variant-ligatures:no-common-ligatures">$ jaotc --version</span></div></div><div class=""><div style="margin:0px;font-variant-numeric:normal;font-variant-east-asian:normal;font-stretch:normal;font-size:11px;line-height:normal;font-family:Menlo" class=""><span class="gmail-m_-7534576364231132385gmail-s1" style="font-variant-ligatures:no-common-ligatures">jaotc 11.0.2+9-LTS</span></div><div style="margin:0px;font-variant-numeric:normal;font-variant-east-asian:normal;font-stretch:normal;font-size:11px;line-height:normal;font-family:Menlo" class=""><span class="gmail-m_-7534576364231132385gmail-s1" style="font-variant-ligatures:no-common-ligatures"><br class=""></span></div><div style="margin:0px;font-variant-numeric:normal;font-variant-east-asian:normal;font-stretch:normal;font-size:11px;line-height:normal;font-family:Menlo" class=""><span class="gmail-m_-7534576364231132385gmail-s1" style="font-variant-ligatures:no-common-ligatures"><br class=""></span></div></div><div class="">Reproducing Steps:</div><div class="">1. Unzip the attached test case and run script <font face="courier new, monospace" class="">run.sh.</font></div><div class="">2. In AOT mode, we will see a message "<font face="courier new, monospace" class="">Should not load me!</font>", which indicates that a wrong classloader is used.</div><div class="">3. In interpreter mode, we will not see the message.</div><div class=""><br class=""></div><div class="">Best regards,</div><div class="">Tianxiao</div><div dir="ltr" class="gmail-m_-7534576364231132385gmail_signature"><br class=""><div class=""></div></div></div></div></div>
<span id="gmail-m_-7534576364231132385cid:f_jwvt3ueu0" class=""><incorrect-caller.zip></span></div></blockquote></div><br class=""></div></div></div></blockquote></div><br clear="all" class=""><div class=""><br class=""></div>-- <br class=""><div dir="ltr" class="gmail_signature"><br class=""><div class=""></div></div>
</blockquote></div><br class=""></body></html>