Choice of named vs anon classes as dynamic method holders

Rémi Forax forax at univ-mlv.fr
Thu Jan 27 13:41:19 PST 2011


On 01/27/2011 08:55 PM, Mark Roos wrote:
> Getting closer to running Smallalk on Java.  We are at the point of 
> importing the
> ST methods into the java side to use with invokeDynamic.
>
> We are planning on one java class per ST method ( and its blocks ) and 
> so would
> have about 45000 classes.  During a typical development session about 
> 1% of the
> classes would be added or replaced.  We were thinking of doing the 
> class creation on
> demand (during bootstrap) but could do it all at once as well.
>
> We could use normal classes with one class loader per class, one 
> global class loader and
> some naming convention,  or John's anonymous class loader (using unsafe).

One global classloader means no reloading.
One classloader by class is Ok. Anonymous classloader is faster and
consumes less memory but breaks this invariant:
   Class.forName(clazz.getName()) == clazz
which can be used by existing code (by example reflection invocation 
doesn't work).

In PHP.reboot which generates several classes for one method (I do code 
specialization),
I use an anonymous classloader if available or one classloader by class 
otherwise.

>
> Any suggestions?
>
> thanks
> mark

Rémi

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.openjdk.java.net/pipermail/mlvm-dev/attachments/20110127/4ee5ec33/attachment.html 


More information about the mlvm-dev mailing list