[9] RFR (S): 8148753: Compilation fails due to field accesses on array types

Zoltán Majó zoltan.majo at oracle.com
Tue Feb 2 15:05:43 UTC 2016


Hi Vladimir,


thank you for the feedback!

On 02/01/2016 06:43 PM, Vladimir Kozlov wrote:
> Extend comment:
>
> +     // handling in ciField::will_link.
>
> "and throw a java.lang.NoSuchFieldError exception (the expected 
> behavior in this case)."
>
> Give different name to first local 'declared_holder' and after array 
> type check do cast:
>
> ciInstanceKlass* declared_holder = holder->as_instance_klass();
>
> then you don't need to change following code.

Here is the updated webrev:

http://cr.openjdk.java.net/~zmajo/8148753/webrev.01/

Thank you and best regards,


Zoltan
>
> Thanks,
> Vladimir
>
> On 2/1/16 7:14 AM, Zoltán Majó wrote:
>> Hi,
>>
>>
>> please review the patch for 8148753.
>>
>> https://bugs.openjdk.java.net/browse/JDK-8148753
>>
>> Problem: Compiling methods that access fields of array types fails. The
>> problem is that both compilers assume that only fields of instance types
>> (but not field of array types) can be accessed. However, an array can be
>> also seen as an instance type, as every array is a subclass of
>> java.lang.Object.
>>
>> Solution: Treat accesses to fields of array types as accesses to fields
>> of java.lang.Object. By convention, the java.lang.Object does not have
>> any fields. As a result, the generated code will throw a
>> java.lang.NoSuchFieldError exception (the expected behavior in this 
>> case).
>>
>> Webrev:
>> http://cr.openjdk.java.net/~zmajo/8148753/webrev.00/
>>
>> Testing:
>> - JPRT;
>> - all JTREG hotspot/compiler tests on all supported platforms.
>>
>> Thank you and best regards,
>>
>>
>> Zoltan
>>



More information about the hotspot-compiler-dev mailing list