Error Message: value -> inline

Peter graphhopper at gmx.de
Tue Jul 9 12:22:26 UTC 2019


Hi Rémi,

Thanks a lot for taking the time for an "ordinary" Java developer who is
interested to try this feature :) ! (have no experience with hacking the
JVM)

> so no runtime support for wildcards/raw types/dynamic cast from Object.

What do you mean here?

I also do not understand the ArrayList part. On the one hand it seems
that inline types should already work, as you say:

/> 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/

but on the other hand you say:

/> //in that case, you have to modify the VM to teach it what i've
called the level 2. /

(When I say "the inline type works" I mean that a list of it uses the
same memory like an array of structs in C)

And allow me one last (the main) question:

What is the best way at the moment to force my application to use the
ArrayList where the inline type works? You can assume I have a very
simple class like:

inline class Point { double latitude; double longitude; }

Or would I have to implement my own "XArrayList" class and replace all
code occurrences of ArrayList?

Regards
Peter

On 08.07.19 19:48, forax at univ-mlv.fr wrote:
> ----- 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




More information about the valhalla-dev mailing list