[MVT] value type and getClass()
forax at univ-mlv.fr
forax at univ-mlv.fr
Sat Aug 5 07:55:14 UTC 2017
I want to use __Value as carrier type (between invokedynamic and the switch) in a possible alternative translation of a pattern matching.
When you translate a pattern maching, either you create one big value type with one field every each local variables for every patterns (technically you can share some fields), that's the proposed translation strategy by Brian and John, the other solution is to have one value type by pattern, mask them as a __Value and re-cast them as the correct value type inside the case corresponding to the pattern.
And in both cases, you can reuse a defined value type for several patterns (or pattern matching), if the extraction has the same component types.
and to answer to your other question, I want to use __Value in Java and in bytecode, ultimately it's in bytecode but if i want to test with Mjolnir, i have to surface it in Java (and pray that the checkcast introduced by Mjolnir can also be elided if it's a __Value.
----- Mail original -----
> De: "Maurizio Cimadamore" <maurizio.cimadamore at oracle.com>
> À: forax at univ-mlv.fr
> Cc: "valhalla-dev" <valhalla-dev at openjdk.java.net>
> Envoyé: Samedi 5 Août 2017 09:23:19
> Objet: Re: [MVT] value type and getClass()
> On 04/08/17 23:55, forax at univ-mlv.fr wrote:
>> ----- Mail original -----
>>> De: "Maurizio Cimadamore" <maurizio.cimadamore at oracle.com>
>>> À: "Remi Forax" <forax at univ-mlv.fr>, "valhalla-dev"
>>> <valhalla-dev at openjdk.java.net>
>>> Envoyé: Samedi 5 Août 2017 07:23:16
>>> Objet: Re: [MVT] value type and getClass()
>>> I'll have to try, but I don't think it will work w/o boxing (no methods
>>> on the value). That said, getClass() might be special enough that it
>>> might accidentally work. It will defo stop working once the verifier
>>> kicks in though.
>> getClass() on a value type should work without boxing given that the semantics
>> is well defined and getClass() is not defined in term of bytecode so not need
>> to box or to wait a type QObject;
>> (that said, i think i need getClass() on __Value :( )
> Can you expand a bit more on what is your need? I thought you were
> speaking bytecode, but now I think you were asking about the source
> code. To get the class of __Value (assuming that's what you need), you
> can use the same trick as here:
> [basically you have to 'switch off' the static type system, or you won't
> be able to assign it to Class<?> because of the val vs. ref mismatch]
>>> In any case, thanks for pointing that out, I'll double check this.
>>> On 04/08/17 20:09, Remi Forax wrote:
>>>> Does a getClass() on a value type works with the MVT ?
> >>> Rémi
More information about the valhalla-dev