Skip to content

Commit

Permalink
8309104: [JVMCI] compiler/unsafe/UnsafeGetStableArrayElement test ass…
Browse files Browse the repository at this point in the history
…erts wrong values with Graal

Reviewed-by: dnsimon, thartmann
  • Loading branch information
David Leopoldseder authored and Doug Simon committed Jun 5, 2023
1 parent a02d800 commit 11fb5b2
Showing 1 changed file with 11 additions and 11 deletions.
22 changes: 11 additions & 11 deletions test/hotspot/jtreg/compiler/unsafe/UnsafeGetStableArrayElement.java
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2016, 2022, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2016, 2023, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
Expand Down Expand Up @@ -224,12 +224,12 @@ static void testMatched(Callable<?> c, Runnable setDefaultAction) throws Excepti
}

static void testMismatched(Callable<?> c, Runnable setDefaultAction) throws Exception {
testMismatched(c, setDefaultAction, false);
testMismatched(c, setDefaultAction, false, true);
}

static void testMismatched(Callable<?> c, Runnable setDefaultAction, boolean objectArray) throws Exception {
if (Compiler.isGraalEnabled() && !objectArray) {
// Graal will constant fold mismatched reads from primitive stable arrays
static void testMismatched(Callable<?> c, Runnable setDefaultAction, boolean objectArray, boolean aligned) throws Exception {
if (Compiler.isGraalEnabled() && !objectArray && aligned) {
// Graal will constant fold mismatched reads from primitive stable arrays, except unaligned ones
run(c, setDefaultAction, null);
} else {
run(c, null, setDefaultAction);
Expand Down Expand Up @@ -319,15 +319,15 @@ static void testUnsafeAccess() throws Exception {
testMatched( Test::testD_D, Test::changeD);

// Object[], aligned accesses
testMismatched(Test::testL_J, Test::changeL, true); // long & double are always as large as an OOP
testMismatched(Test::testL_D, Test::changeL, true);
testMismatched(Test::testL_J, Test::changeL, true, true); // long & double are always as large as an OOP
testMismatched(Test::testL_D, Test::changeL, true, true);
testMatched( Test::testL_L, Test::changeL);

// Unaligned accesses
testMismatched(Test::testS_U, Test::changeS);
testMismatched(Test::testC_U, Test::changeC);
testMismatched(Test::testI_U, Test::changeI);
testMismatched(Test::testJ_U, Test::changeJ);
testMismatched(Test::testS_U, Test::changeS, false, false);
testMismatched(Test::testC_U, Test::changeC, false, false);
testMismatched(Test::testI_U, Test::changeI, false, false);
testMismatched(Test::testJ_U, Test::changeJ, true, false);

// No way to reliably check the expected behavior:
// (1) OOPs change during GC;
Expand Down

3 comments on commit 11fb5b2

@openjdk-notifier
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@GoeLin
Copy link
Member

@GoeLin GoeLin commented on 11fb5b2 Oct 5, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

/backport jdk17u-dev

@openjdk
Copy link

@openjdk openjdk bot commented on 11fb5b2 Oct 5, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@GoeLin the backport was successfully created on the branch GoeLin-backport-11fb5b22 in my personal fork of openjdk/jdk17u-dev. To create a pull request with this backport targeting openjdk/jdk17u-dev:master, just click the following link:

➡️ Create pull request

The title of the pull request is automatically filled in correctly and below you find a suggestion for the pull request body:

Hi all,

This pull request contains a backport of commit 11fb5b22 from the openjdk/jdk repository.

The commit being backported was authored by David Leopoldseder on 5 Jun 2023 and was reviewed by Doug Simon and Tobias Hartmann.

Thanks!

If you need to update the source branch of the pull then run the following commands in a local clone of your personal fork of openjdk/jdk17u-dev:

$ git fetch https://github.com/openjdk-bots/jdk17u-dev.git GoeLin-backport-11fb5b22:GoeLin-backport-11fb5b22
$ git checkout GoeLin-backport-11fb5b22
# make changes
$ git add paths/to/changed/files
$ git commit --message 'Describe additional changes made'
$ git push https://github.com/openjdk-bots/jdk17u-dev.git GoeLin-backport-11fb5b22

Please sign in to comment.