To help illustrate a bit, here's a snippit of the code to create the
allocator. It succeeds, but the allocator later throws NoClassDefFoundError.

https://gist.github.com/headius/cce750221cf73df76cb7f7ce92c1a759

- Charlie

On Fri, Jun 29, 2018 at 8:00 PM, Charles Oliver Nutter <head...@headius.com>
wrote:

> Hello folks!
>
> I'm improving JRuby's support for instance variables-as-fields, which
> involves generating a new JVM class with a field per instance variable in
> the Ruby class.
>
> The construction process for these classes involves an implementation of
> my "ObjectAllocator" interface, which is stored with the Ruby class.
>
> Previously, the generated classes also included a generated child class
> that implenented ObjectAllocator appropriately. I was hoping to use
> LambdaMetafactory to avoid generating that class, but I'm running into a
> problem.
>
> Say we have a Ruby class with three instance variables. JRuby will
> generate a "RubyObject3" class that holds those variables in their own
> fields var0, var1, and var2. The process leading up to the bug goes like
> this:
>
> * Generate the RubyObject3 class, in its own classloader that's a child of
> the current one.
> * Acquire a constructor handle for that class.
> * Use that constructor with LambdaMetafactory.metafactory to produce an
> allocator-creating call site.
> * Invoke that call site to get the one allocator instance we need.
>
> Note that since the metafactory call requires a Lookup, I am providing it
> one from the parent classloader.
>
> I am able to get through this process without error. However, when I
> finally invoke the allocator, I get a NoClassDefFoundError and a stack
> trace that ends at the allocator call.
>
> So...what am I doing wrong?
>
> - Charlie
>
_______________________________________________
mlvm-dev mailing list
mlvm-dev@openjdk.java.net
http://mail.openjdk.java.net/mailman/listinfo/mlvm-dev

Reply via email to