RFC: JDK-8031043: ClassValue's backing map should have a smaller initial size

Remi Forax forax at univ-mlv.fr
Wed Jan 8 00:21:36 PST 2014


On 01/07/2014 11:54 PM, Christian Thalinger wrote:
> Can I get some comments on this bug from people who are using ClassValue?
>
> [#JDK-8031043] ClassValue's backing map should have a smaller initial 
> size - Java Bug System <https://bugs.openjdk.java.net/browse/JDK-8031043>
>
> Is my assumption correct that most language runtimes only attach a 
> small number of values (maybe only one) or that it wouldn’t matter if 
> the map would grow as needed?

I see a good reason to have more than one ClassValue per runtime,
you want monkey patch realm, you want to be able to modify the class 
(meta class ?) of your runtime objects but you want several views of the 
class depending on the source file or the 'module' of the source file. 
There was some discussions about that in Ruby and Groovy 3 seems to 
support something like that too.

Anyway, monkey patching is not a fast operation usually because of the 
switch point invalidation so if it grows as needed, it should not be a 
problem.

Rémi



More information about the mlvm-dev mailing list