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

Quan Anh Mai qamai at openjdk.org
Tue Nov 26 18:27:47 UTC 2024


On Tue, 26 Nov 2024 18:00:16 GMT, Vladimir Kozlov <kvn at openjdk.org> wrote:

>> Quan Anh Mai has updated the pull request with a new target base due to a merge or a rebase. The incremental webrev excludes the unrelated changes brought in by the merge/rebase. The pull request contains four additional commits since the last revision:
>> 
>>  - indentation
>>  - Merge branch 'master' into constanttable
>>  - Merge branch 'master' into constanttable
>>  - refactor array constant, fix codebuffer reallocation
>
> src/hotspot/cpu/x86/x86.ad line 2771:
> 
>> 2769:     int offset = i * type2aelembytes(bt);
>> 2770:     switch (bt) {
>> 2771:       case T_BYTE: val->at(i) = con; break;
> 
> I don't like that switch is executed for each copied element. What is typical `len` value?

`len` is at most 16 and is typically 1 (you only emit 1 element and the broadcast instruction will fill the whole register). Also, this function is only invoked a couple of times for each compilation and I think the compiler can do unswitching, too.

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

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


More information about the hotspot-compiler-dev mailing list