Tiered compilation leads to "unloaded signature class" inlining failures in JRuby

Vladimir Ivanov vladimir.x.ivanov at oracle.com
Thu Sep 3 10:20:04 UTC 2020


> I have also tried forcing String and other classes referenced in the
> generated code to load into each OneShotClassLoader, but the problem
> remains.

After taking a closer look at your patch, I noticed 2 important aspects 
needed to make it work:

   (1) Class loading request should go through the JVM, so its result is 
persisted in SystemDictionary. It means that ClassLoader::loadClass() is 
not enough, Class::forName() should be used instead.

   (2) Class loading request should be performed in the context of the 
script. Since JRuby classes have protection domain set for them, there's 
additional check required for them as part of class loading request. It 
is implemented on Java side by ClassLoader::checkPackageAccess, but 
since JIT-compilers aren't allowed to call into Java, they rely on the 
cache which keeps all protection domains for which the check succeeded.
So, there should be a class loading request performed which goes through 
the JVM with the very same protection domain instance.

So, triggering class loading from static initializer of the script class 
should do the job. But, while looking through Class::forName() 
implementation, I noticed that it optionally fills caller info depending 
on whether SecurityManager is set, but JVM always checks protection 
domain. So, the only reliable option left to satisfy both #1 and #2 is 
to trigger loading on bytecode level (for example, by using ldc + 
CP_Class).

Best regards,
Vladimir Ivanov

> Disabling tiered compilation again fixes it, but I suspect that's just
> a lucky side effect for this case.
> 
> So I am still without any leads on fixes or workarounds.
> 
> - Charlie
> 


More information about the hotspot-compiler-dev mailing list