Dynamic Constants adoption IRL
Maxim Degtyarev
mdegtyarev at gmail.com
Thu Apr 15 15:53:05 UTC 2021
I'm asking about JEP 309: Dynamic Class-File Constants.
[1] https://openjdk.java.net/jeps/309
El jue, 15 abr 2021 a las 18:37, Remi Forax (<forax at univ-mlv.fr>) escribió:
>
> ----- Mail original -----
> > De: "Maxim Degtyarev" <mdegtyarev at gmail.com>
> > À: "amber-dev" <amber-dev at openjdk.java.net>
> > Envoyé: Jeudi 15 Avril 2021 17:04:15
> > Objet: Dynamic Constants adoption IRL
>
> > Hello,
> >
> > Is there currently real-life examples of dynamic constants adoption in
> > programming languages targeting JVM or either libraries and
> > frameworks?
> > Or are there currently no projects using dynamic constants? Maybe any
> > planned in the future?
> > Quick googling was unsuccessful.
>
> It depends what you mean by dynamic constant.
> For the VM, a simple static final field that is not a primitive types or String is a dynamic constant.
>
> A lambda that doesn't capture any variable value is a dynamic constant.
>
> A VarHandle, used for concurrency or by the Foreign Memory API is a dynamic constant, the same goes for the MethodHandles.
>
> The Vector API relies on the VectorSpecies being a dynamic constant.
>
> System.out and System.err, the ClassValue for a particular class, or Thread.currentThread() can all be seen as dynamic constants (but they are not constant for the JIT).
>
> The classData of an hidden class is also a dynamic constant [1].
>
> regards,
> Rémi
>
> [1] https://docs.oracle.com/en/java/javase/16/docs/api/java.base/java/lang/invoke/MethodHandles.html#classData(java.lang.invoke.MethodHandles.Lookup,java.lang.String,java.lang.Class)
>
>
More information about the amber-dev
mailing list