Skip to content

Commit

Permalink
Backport 11fb5b2209124bbf1100657e340ba5aebc3820d7
Browse files Browse the repository at this point in the history
  • Loading branch information
duke committed Oct 5, 2023
1 parent 31422d7 commit 12b30de
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

0 comments on commit 12b30de

Please sign in to comment.