value types at the jvm level?

Remi Forax forax at univ-mlv.fr
Fri Oct 19 10:53:06 PDT 2012


On 10/19/2012 07:31 PM, Mark Roos wrote:
> I see an interesting discussion here on value types.  I assume that at 
> least part of the
> intent is to solve the performance hit by using boxed integers.  As 
> such I was thinking
> about how that would affect my Smalltalk implementation.
>
> A simple case for me is the boxing of longs.  I use longs everywhere I 
> need an integer
> so both Character and Integer objects use a long to hold values.   My 
> encapsulating
> object is a instance of a Java object called RtObject which holds a 
> reference to a method lookup
> array and the value ( a long ).
>
> What I wonder is how my GWT would work if I use value types?  My 
> current GWT test compares the
> lookup array with the assumption that if the lookups are equal (==) 
> then the method resolution is as well.
> It seems like every GWT first needs to test for value types and if 
> true then to use a shared lookup array.
> I can see how Java classes could be handled invisibly but how would I 
> use them?  I would need a way
> to get a class tag of some sort that I could use for my own lookup. 
>  Or would I create a Java class for
> each value type I use and use the Java class as the test?  In any case 
> it seems like a fast way to check
> if its a value type is a minimum.

The idea is that you should change nothing of your GWT code.
Just uses the native method that tag your objects or classes to declare 
them as a value objects/classes,
the JIT will do the job.
The main issue in your case is that your boxed class should be not mutable.

>
> regards
> mark

Rémi



More information about the mlvm-dev mailing list