RFR: 8358592: Assert in Assembler::ptest due to missing SSE42 support [v3]

Tobias Hartmann thartmann at openjdk.org
Wed Jul 9 14:16:45 UTC 2025


On Wed, 9 Jul 2025 06:17:59 GMT, Guanqiang Han <duke at openjdk.org> wrote:

>> Setting "-XX:UseSSE=1" in command line prevents the code from entering the block shown below, which causes UseSSE42Intrinsics to not be correctly set. Because supports_sse3() return false.
>> ![图片1](https://github.com/user-attachments/assets/d3cdb1fe-f0e0-41dc-98c9-4427eaffdb0e)
>> in addition , setting "-XX:+UseSSE42Intrinsics" in command line set UseVectorizedMismatchIntrinsic to True shown below.
>> ![图片2](https://github.com/user-attachments/assets/bbe623a3-453a-483d-b34c-1cdb394f2d4e)
>> The above code causes the ptest instruction to be invoked.
>> The assertion "assert(VM_Version::supports_sse4_1() || VM_Version::supports_avx(), "")" in ptest was triggered and caused the crash because of the following reason:
>> Setting "-XX:UseSSE=1" in command line  cause "CPU_SSE4_1" was cleared and cause "VM_Version::supports_sse4_1()" return false ,related code as below:
>> ![图片3](https://github.com/user-attachments/assets/e9a8a690-dd4d-4216-b09f-be8439a9a73b)
>> Setting "-XX:UseSSE=1" in command line  cause "UseAVX=0" and cause "VM_Version::supports_avx()" return false ,related code as below:
>> ![image](https://github.com/user-attachments/assets/6d9e770b-0a7a-43cd-a4bc-d15247f6478e)
>> all of these above cause this issue.
>> i fix this issue by correcting UseSSE42Intrinsics to false when "UseSSE" in command line was set to 1, so that UseVectorizedMismatchIntrinsic will be set false and ptest was not triggered.
>
> Guanqiang Han has updated the pull request incrementally with one additional commit since the last revision:
> 
>   Update Test8358592.java
>   
>   run on x86_64

The fix looks reasonable to me but I'm not an expert in this code.

src/hotspot/cpu/x86/vm_version_x86.cpp line 1494:

> 1492:         FLAG_SET_DEFAULT(UseSSE42Intrinsics, false);
> 1493:       }
> 1494:     }else{

Suggestion:

    } else {

src/hotspot/cpu/x86/vm_version_x86.cpp line 1648:

> 1646:         FLAG_SET_DEFAULT(UseSSE42Intrinsics, false);
> 1647:       }
> 1648:     }else{

Suggestion:

    } else {

test/hotspot/jtreg/compiler/intrinsics/Test8358592.java line 31:

> 29:  * @requires os.arch == "x86_64"
> 30:  * @library /test/lib
> 31:  * @run main/othervm Test8358592

I think this test should go to `/hotspot/jtreg/compiler/arguments/` and have a more descriptive name (we generally try not use bug numbers for tests anymore).

test/hotspot/jtreg/compiler/intrinsics/Test8358592.java line 39:

> 37: public class Test8358592 {
> 38:     public static void main(String[] args) throws Exception {
> 39:         ProcessBuilder pb = ProcessTools.createTestJavaProcessBuilder(

Instead of spawning a new process, you can just pass the arguments via `@run main/othervm`, see for example `test/hotspot/jtreg/compiler/arguments/TestC1Globals.java`.

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

Changes requested by thartmann (Reviewer).

PR Review: https://git.openjdk.org/jdk/pull/26151#pullrequestreview-3001515723
PR Review Comment: https://git.openjdk.org/jdk/pull/26151#discussion_r2195017641
PR Review Comment: https://git.openjdk.org/jdk/pull/26151#discussion_r2195017946
PR Review Comment: https://git.openjdk.org/jdk/pull/26151#discussion_r2195003179
PR Review Comment: https://git.openjdk.org/jdk/pull/26151#discussion_r2195004480


More information about the hotspot-dev mailing list