Error Message: value -> inline

forax at univ-mlv.fr forax at univ-mlv.fr
Mon Jul 8 17:48:43 UTC 2019


----- Mail original -----
> De: "Peter" <graphhopper at gmx.de>
> À: "Remi Forax" <forax at univ-mlv.fr>
> Cc: "valhalla-dev" <valhalla-dev at openjdk.java.net>
> Envoyé: Lundi 8 Juillet 2019 10:49:45
> Objet: Re: Error Message: value -> inline

> Hello Remi,
> 
> Thanks, also for the link!
> 
> The code for your ArrayList looks very crazy :) ... what is the reason
> for that?

yes,
it's a research code not a use case code :)

There are several layers to introduce reified generics, roughly 3 levels
  level 1: we need to have reified type accessible from the VM opcodes
  level 2: at runtime, we need different constant pools (or parts of the constant pool) for the same class (species)
  level 3: we need a way to have several specialized methods and activate/deactivate them

This code test the level 1, the code is weird because it emulates the VM opcodes in Java (we have used a similar technique in the past when introducing invokedynamic).
In term of expressiveness, you have parameterized classes/methods done at compile time only using the stack, so no runtime support for wildcards/raw types/dynamic cast from Object.

> 
> And Java's ArrayList is not as good because it has Object[] instead of
> E[]? Or would be more changes necessary to make it memory efficient for
> inline types?

ArrayList is special because the VM already allows E[] (Object[] at runtime) to be an array of indirect types or an array of inline types,
so a quick hack is to have a constructor that take a class as argument and use it to create the array.
see https://github.com/forax/valuetype-lworld/blob/master/src/main/java/fr.umlv.valuetype/fr/umlv/valuetype/ReifiedList.java

But this trick doesn't work when your data structure need an internal class with one of its field being either an indirect type or an inline type,
in that case, you have to modify the VM to teach it what i've called the level 2.

> 
> Regards
> Peter

regards,
Rémi

> 
> On 07.07.19 11:38, Remi Forax wrote:
>> ----- Mail original -----
>>> De: "Peter" <graphhopper at gmx.de>
>>> À: "valhalla-dev" <valhalla-dev at openjdk.java.net>
>>> Envoyé: Dimanche 7 Juillet 2019 01:40:51
>>> Objet: Error Message: value -> inline
>>> Hi,
>> Hi
>>
>>> I'm currently playing with the prototype of Project Valhalla - thanks
>>> for your huge work!
>>>
>>> I've studied the tests but is more documentation or better examples what
>>> is currently possible? E.g. I think that primitive lists like List<int>
>>> is not yet possible - is this right?
>> yes,
>> no specialized generics yet !
>>
>> you have more examples here:
>>   https://github.com/forax/valuetype-lworld
>>
>>> Now I caught an error message that needs a small change. With:
>>>
>>> inline class Point { double lat; double lon; }
>>> inline class Point3d { double ele; inline Point point; }
>>>
>>> I get:
>>>
>>> Point3d.java:[5,25] modifier value not allowed here
>>>
>>> instead of:
>>>
>>> Point3d.java:[5,25] modifier inline not allowed here
>>>
>>> Regards
>>> Peter
>> cheers,
>> Rémi
> 
> 
> --
> GraphHopper.com - fast and flexible route planning


More information about the valhalla-dev mailing list