Status of Anno Class loader with constant patches?

Rémi Forax forax at univ-mlv.fr
Thu Dec 30 08:21:09 PST 2010


On 12/30/2010 01:40 PM, Thomas Wuerthinger wrote:

Hi Thomas,

>> In fact for hotspot, this kind of constant can be even more optimized
>> than a static final field containing a non-primitive values which is
>> not a real constant
>> (it can be modified by reflection).
> I don't think final fields can be modified via reflection. An
> IllegalAccessException with the message "field is final" is thrown at
> the end of Reflection::resolve_field in reflection.cpp.

resolve_field is not used anymore,
there is an #ifdef SUPPORT_OLD_REFLECTION before resolve_interface_call.

Since 1.4, fields are created with Reflection::new_field
and set() is done using sun.misc.Unsafe.putVolatile or by spinning 
bytecodes.
(see subtypes of sun.reflect.UnsafeQualifiedFieldAccessorImpl).

To sumarize:
1.2 allows to modify final fields,
1.3 forbids,
1.4+ allows using a new code.


> - thomas

Rémi


More information about the mlvm-dev mailing list