On 11/30/2011 04:28 PM, Jochen Theodorou wrote: > Am 30.11.2011 14:02, schrieb Rémi Forax: > [...] >>>> What kind of initialization work is this? Could the result of that work >>>> be cached? >>> we have to setup the initial meta class system, which requires to use >>> reflection to inspect some classes and other work. Yes, this could be >>> cached, if we would know how. >> It worth to give a try to java.lang.ClassValue, here. >> You you be able to create your metaclass only when needed. >> >> Also note that you can also lazyly initialize the list of methods, >> fields etc. because even if two threads ask the same list at the >> same time, the result will be the same, so there is no need >> to use synchronized here. >> (this is exactly what java.lang.Class code does) : > it is all lazy, but what gives it if you need it for even the most > simple script? For > > println 1+1 > > you will need the a meta class for the current class, you will need the > int meta class, you will need to load the default methods too... and one > second is burnt.
The only way I see to avoid that is to not load the meta-class until someone reference them so you can compile this example to System.out.println(2) and if there is a ref to a meta-class somewhere, discard the code and recompile it with meta-class check. I do something like that in PHP.reboot but my unit of compilation is the method and not the class, which also avoid to compile a code you never use. > > bye Jochen > Rémi _______________________________________________ mlvm-dev mailing list mlvm-dev@openjdk.java.net http://mail.openjdk.java.net/mailman/listinfo/mlvm-dev