Am 27.04.2015 19:17, schrieb Charles Oliver Nutter:
It seems I may have to write some benchmarks for this then. Just so I
understand, the equivalent non-ClassValue-based store would need to:
* Be atomic; value may calculate more than once but only be set once.
* Be weak; classes given class values must not be rooted as a result
(an external impl like in JRuby or Groovy would have to use weak maps
for this).
Jochen: Is your class-to-metaclass map usable apart from the Groovy codebase?
Yes. Look for org.codehaus.groovy.reflection.GroovyClassValuePreJava7
which is normally wrapped by a factory. You can do for example
final AtomicInteger counter = new AtomicInteger();
GroovyClassValue<String> classValue = new GroovyClassValuePreJava7(new
ComputeValue<String>() {
String computeValue(Class<?> type){
counter.incrementAndGet()
return type.name;
}});
normally of course we don't store strings, normally we store ClassInfo
objects, which then break down to the meta classes and per instance meta
classes ;)
bye blackdrag
--
Jochen "blackdrag" Theodorou
blog: http://blackdragsview.blogspot.com/
_______________________________________________
mlvm-dev mailing list
mlvm-dev@openjdk.java.net
http://mail.openjdk.java.net/mailman/listinfo/mlvm-dev