> On Jun 17, 2020, at 4:13 PM, Brian Goetz <[email protected]> wrote:
> 
>> - Where necessary (depending on the operations being performed), the 
>> compiler generates conversions between 'I' and 'java/lang/Integer$val'. 'I' 
>> is preferred wherever possible.
> 
> We have to use QInteger$val whenever we use int as a type parameter, the rest 
> of the time, we can use I.  

Right. Specifically, if we support inline types as type arguments before we get 
to specialization, we'll use erasure, which looks like:

new java/util/ArrayList;
// dup, init
astore 1

aload 1
iconst_0
invokestatic Qjava/lang/Integer$val;.<new>(I)Qjava/lang/Integer$val; // <-- 
conversion
invokevirtual java/util/ArrayList.add:(Ljava/lang/Object;)Z
pop

aload1
iconst_0
invokevirtual java/util/ArrayList.get(I)Ljava/lang/Object;
checkcast Qjava/lang/Integer$val;
invokevirtual Qjava/lang/Integer$val;.intValue()I  // <-- conversion

And then there's also instance method invocations:

iconst_0
invokestatic Qjava/lang/Integer$val;.<new>(I)Qjava/lang/Integer$val; // <-- 
conversion
invokevirtual Qjava/lang/Integer$val;.floatValue()F

(Note that none of these conversions are "boxing" or "unboxing". They're 
strictly compilation artifacts. It may be useful to come up with a new word for 
them.)

Reply via email to