Linkage error on recent JDKs
Charles Oliver Nutter
headius at headius.com
Fri Feb 24 12:12:14 PST 2012
On Fri, Feb 24, 2012 at 12:33 PM, Mark Roos <mroos at roos.com> wrote:
> Hi Charles
>
> Two quick ones:
>
> Do you put your code on the bootClassPath?
When running from the command line only. For test runs, where I'm
seeing this issue, it be somewhere above the system classloader.
> Are you generating classes dynamically to which you add instance methods to?
We generate classes dynamically, one per jitted Ruby method, but we
don't make any modifications to them after that.
> I currently use all static methods on a root class for my dynamics but was
> thinking of
> using a more specialized class + instances approach to get closer to a java
> like structure.
> My prior/current issues with classes not on the boot class path has held me
> back.
Yeah, because we have supported non-indy JVMs for so long, we've got
every trick in the book. JRuby code loads from .rb files pretty much
all the time, and we don't immediately compile those files. Instead,
as methods are hit hard, we JIT compile them to JVM bytecode. That's
one class per jitted Ruby method, and to make them GCable that's one
classloader per class. So if we eventually JIT 1000 Ruby methods, you
have 1000 classes and 1000 classloaders.
What I'm seeing here is that one of those jitted methods from JRuby
runtime A is getting confused with the same method jitted by runtime
B. Different classloader hierarchies, different classes (named the
same), but the MethodHandle logic seems to be mixing them up.
- Charlie
More information about the mlvm-dev
mailing list