RFR: 8342651: Refactor array constant to use an array of jbyte [v2]

Tobias Hartmann thartmann at openjdk.org
Thu Nov 14 06:46:54 UTC 2024


On Wed, 13 Nov 2024 14:06:24 GMT, Quan Anh Mai <qamai at openjdk.org> wrote:

>> src/hotspot/cpu/x86/x86.ad line 2743:
>> 
>>> 2741:     case T_BYTE: val->at(i) = con; break;
>>> 2742:     case T_SHORT: {
>>> 2743:       jshort c = con;
>> 
>> Why are these casts needed? Isn't `T con` already of the appropriate j-type?
>
> No for example when `bt == T_BYTE`, `T` is actual `jint`. As a result, I do this for all the cases for uniformity, also a mismatch will not result in a crash but may silently write the wrong data so I'm extra cautious here.

Makes sense, thanks for the clarification.

-------------

PR Review Comment: https://git.openjdk.org/jdk/pull/21596#discussion_r1841648097


More information about the hotspot-compiler-dev mailing list