Skip to content

Commit 351889f

Browse files
committed
8262508: Vector API's ergonomics is incorrect
Reviewed-by: vlivanov
1 parent 718d4d4 commit 351889f

File tree

2 files changed

+83
-1
lines changed

2 files changed

+83
-1
lines changed

src/hotspot/share/runtime/arguments.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -4084,7 +4084,7 @@ jint Arguments::apply_ergo() {
40844084
UseOptoBiasInlining = false;
40854085
}
40864086

4087-
if (!EnableVectorSupport) {
4087+
if (!FLAG_IS_DEFAULT(EnableVectorSupport) && !EnableVectorSupport) {
40884088
if (!FLAG_IS_DEFAULT(EnableVectorReboxing) && EnableVectorReboxing) {
40894089
warning("Disabling EnableVectorReboxing since EnableVectorSupport is turned off.");
40904090
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,82 @@
1+
/*
2+
* Copyright (C) 2021 THL A29 Limited, a Tencent company. All rights reserved.
3+
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4+
*
5+
* This code is free software; you can redistribute it and/or modify it
6+
* under the terms of the GNU General Public License version 2 only, as
7+
* published by the Free Software Foundation.
8+
*
9+
* This code is distributed in the hope that it will be useful, but WITHOUT
10+
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11+
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
12+
* version 2 for more details (a copy is included in the LICENSE file that
13+
* accompanied this code).
14+
*
15+
* You should have received a copy of the GNU General Public License version
16+
* 2 along with this work; if not, write to the Free Software Foundation,
17+
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
18+
*
19+
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
20+
* or visit www.oracle.com if you need additional information or have any
21+
* questions.
22+
*/
23+
24+
package compiler.vectorapi;
25+
26+
/*
27+
* @test TestVectorErgonomics
28+
* @bug 8262508
29+
* @requires vm.compiler2.enabled
30+
* @summary Check ergonomics for Vector API
31+
* @library /test/lib
32+
* @run main/othervm compiler.vectorapi.TestVectorErgonomics
33+
*/
34+
35+
import jdk.test.lib.process.ProcessTools;
36+
37+
public class TestVectorErgonomics {
38+
39+
public static void main(String[] args) throws Throwable {
40+
ProcessTools.executeTestJvm("--add-modules=jdk.incubator.vector", "-XX:+UnlockExperimentalVMOptions",
41+
"-XX:+EnableVectorReboxing", "-Xlog:compilation", "-version")
42+
.shouldHaveExitValue(0)
43+
.shouldContain("EnableVectorReboxing=true");
44+
45+
ProcessTools.executeTestJvm("--add-modules=jdk.incubator.vector", "-XX:+UnlockExperimentalVMOptions",
46+
"-XX:+EnableVectorAggressiveReboxing", "-Xlog:compilation", "-version")
47+
.shouldHaveExitValue(0)
48+
.shouldContain("EnableVectorAggressiveReboxing=true");
49+
50+
ProcessTools.executeTestJvm("--add-modules=jdk.incubator.vector", "-XX:+UnlockExperimentalVMOptions",
51+
"-XX:-EnableVectorReboxing", "-Xlog:compilation", "-version")
52+
.shouldHaveExitValue(0)
53+
.shouldContain("EnableVectorReboxing=false")
54+
.shouldContain("EnableVectorAggressiveReboxing=false");
55+
56+
ProcessTools.executeTestJvm("--add-modules=jdk.incubator.vector", "-XX:+UnlockExperimentalVMOptions",
57+
"-XX:-EnableVectorAggressiveReboxing", "-Xlog:compilation", "-version")
58+
.shouldHaveExitValue(0)
59+
.shouldContain("EnableVectorAggressiveReboxing=false");
60+
61+
ProcessTools.executeTestJvm("--add-modules=jdk.incubator.vector", "-XX:+UnlockExperimentalVMOptions",
62+
"-XX:-EnableVectorSupport", "-Xlog:compilation", "-version")
63+
.shouldHaveExitValue(0)
64+
.shouldContain("EnableVectorSupport=false")
65+
.shouldContain("EnableVectorReboxing=false")
66+
.shouldContain("EnableVectorAggressiveReboxing=false");
67+
68+
ProcessTools.executeTestJvm("--add-modules=jdk.incubator.vector", "-XX:+UnlockExperimentalVMOptions",
69+
"-XX:-EnableVectorSupport", "-XX:+EnableVectorReboxing", "-Xlog:compilation", "-version")
70+
.shouldHaveExitValue(0)
71+
.shouldContain("EnableVectorSupport=false")
72+
.shouldContain("EnableVectorReboxing=false")
73+
.shouldContain("EnableVectorAggressiveReboxing=false");
74+
75+
ProcessTools.executeTestJvm("--add-modules=jdk.incubator.vector", "-XX:+UnlockExperimentalVMOptions",
76+
"-XX:-EnableVectorSupport", "-XX:+EnableVectorAggressiveReboxing", "-Xlog:compilation", "-version")
77+
.shouldHaveExitValue(0)
78+
.shouldContain("EnableVectorSupport=false")
79+
.shouldContain("EnableVectorReboxing=false")
80+
.shouldContain("EnableVectorAggressiveReboxing=false");
81+
}
82+
}

0 commit comments

Comments
 (0)