Here's something to think about as an alternative to the instanceof/cast/invoke dance for getting metaclasses.
At the Summit we were talking about managing metaobjects via a class-specific analogue of ThreadLocal. Here's a sketch of what the JSR 292 EG is thinking about in that vein: http://cr.openjdk.java.net/~jrose/pres/indy-javadoc-mlvm-0908/java/dyn/ClassValue.html The implementation of such a thing should be tuned (as ThreadLocal is tuned) to execute in a small number of memory references, without locks or volatiles. Ideally the code would use a one-element cache, like this: RubyClass metaClass = RUBY_META_OBJECT.get(object.getClass()); => mov (object+4), classtemp mov (classtemp+56), cachetemp cmp (cachetemp,8), RUBY_META_OBJECT jne slowpath mov (cachetemp,4), metaClass This provides an alternative path to interface injection for storing per-runtime data on *all* classes (RubyArray and java.lang.String alike). How useful would this be? Your feedback might help us decide on where ClassValue sits in a Plan A vs. Plan B feature cut, if such a cut comes about. See Mark Reinhold's blog for the A/B conversation. -- John -- You received this message because you are subscribed to the Google Groups "JVM Languages" group. To post to this group, send email to [email protected]. To unsubscribe from this group, send email to [email protected]. For more options, visit this group at http://groups.google.com/group/jvm-languages?hl=en.
