On 01/06/2011 04:08 PM, Helmut Eller wrote:
> * Rémi Forax [2011-01-06 13:30] writes:
>
>>> that is essentially a constant but<exp>   must be evaluated at load time
>>> and not later (as would be done with lazy linking).
>> why not using a static final field initialized in<clinit>  in that case ?
> Because final static fields can't be optimized as well as constant method
> handles (you said that).

I say that constant method handles *can* be optimized more easily.
static final fields can be optimized as well if changing a static field by
reflection trigger a VM deoptimization.

Anyway, you can store your load-time constant in a static field,
initialize it in a static block and use invokedynamic to load it.
In the bootstrap method, do a field lookup to get the value and
return a constant method handle created using the value.

> Helmut
>

Rémi
_______________________________________________
mlvm-dev mailing list
mlvm-dev@openjdk.java.net
http://mail.openjdk.java.net/mailman/listinfo/mlvm-dev

Reply via email to