In order to ensure that a reclaimable object remains so, the referent of
* a phantom reference may not be retrieved: The {@code get} method of a
* phantom reference always returns {@code null}.
+ * The {@link #refersTo(Object) refersTo} method can be used to test
+ * whether some object is the referent of a phantom reference.
*
* @author Mark Reinhold
* @since 1.2
@@ -75,9 +77,7 @@ public T get() {
* is registered with the given queue.
*
*
It is possible to create a phantom reference with a {@code null}
- * queue, but such a reference is completely useless: Its {@code get}
- * method will always return {@code null} and, since it does not have a queue,
- * it will never be enqueued.
+ * queue. Such a reference will never be enqueued.
*
* @param referent the object the new phantom reference will refer to
* @param q the queue with which the reference is to be registered,
diff --git a/src/java.base/share/classes/java/util/Locale.java b/src/java.base/share/classes/java/util/Locale.java
index 9bacdd61468fa..a91c562ae5f96 100644
--- a/src/java.base/share/classes/java/util/Locale.java
+++ b/src/java.base/share/classes/java/util/Locale.java
@@ -455,9 +455,11 @@
*
*
For the backward compatible behavior, the system property
* {@systemProperty java.locale.useOldISOCodes} reverts the behavior
- * back to prior to Java SE 17 one. If the system property is set
- * to {@code true}, those three current language codes are mapped to their
- * backward compatible forms.
+ * back to that of before Java SE 17. If the system property is set to
+ * {@code true}, those three current language codes are mapped to their
+ * backward compatible forms. The property is only read at Java runtime
+ * startup and subsequent calls to {@code System.setProperty()} will
+ * have no effect.
*
*
The APIs added in 1.7 map between the old and new language codes,
* maintaining the mapped codes internal to Locale (so that
diff --git a/src/jdk.compiler/share/classes/com/sun/tools/javac/comp/Attr.java b/src/jdk.compiler/share/classes/com/sun/tools/javac/comp/Attr.java
index c0bfbb5d2ac35..9e02112aabf6f 100644
--- a/src/jdk.compiler/share/classes/com/sun/tools/javac/comp/Attr.java
+++ b/src/jdk.compiler/share/classes/com/sun/tools/javac/comp/Attr.java
@@ -169,6 +169,8 @@ protected Attr(Context context) {
allowStaticInterfaceMethods = Feature.STATIC_INTERFACE_METHODS.allowedInSource(source);
allowReifiableTypesInInstanceof = Feature.REIFIABLE_TYPES_INSTANCEOF.allowedInSource(source);
allowRecords = Feature.RECORDS.allowedInSource(source);
+ allowPatternSwitch = (preview.isEnabled() || !preview.isPreview(Feature.PATTERN_SWITCH)) &&
+ Feature.PATTERN_SWITCH.allowedInSource(source);
sourceName = source.name;
useBeforeDeclarationWarning = options.isSet("useBeforeDeclarationWarning");
@@ -209,6 +211,10 @@ protected Attr(Context context) {
*/
private final boolean allowRecords;
+ /** Are patterns in switch allowed
+ */
+ private final boolean allowPatternSwitch;
+
/**
* Switch: warn about use of variable before declaration?
* RFE: 6425594
@@ -1724,14 +1730,22 @@ private void handleSwitch(JCTree switchTree,
rs.basicLogResolveHelper = prevResolveHelper;
}
} else {
- Type pattype = attribExpr(expr, switchEnv, seltype);
+ ResultInfo valTypInfo = new ResultInfo(KindSelector.VAL_TYP,
+ !seltype.hasTag(ERROR) ? seltype
+ : Type.noType);
+ Type pattype = attribTree(expr, switchEnv, valTypInfo);
if (!pattype.hasTag(ERROR)) {
- if (!stringSwitch && !types.isAssignable(seltype, syms.intType)) {
- log.error(pat.pos(), Errors.ConstantLabelNotCompatible(pattype, seltype));
- }
if (pattype.constValue() == null) {
- log.error(expr.pos(),
- (stringSwitch ? Errors.StringConstReq : Errors.ConstExprReq));
+ Symbol s = TreeInfo.symbol(expr);
+ if (s != null && s.kind == TYP && allowPatternSwitch) {
+ log.error(expr.pos(),
+ Errors.PatternExpected);
+ } else {
+ log.error(expr.pos(),
+ (stringSwitch ? Errors.StringConstReq : Errors.ConstExprReq));
+ }
+ } else if (!stringSwitch && !types.isAssignable(seltype, syms.intType)) {
+ log.error(pat.pos(), Errors.ConstantLabelNotCompatible(pattype, seltype));
} else if (!labels.add(pattype.constValue())) {
log.error(c.pos(), Errors.DuplicateCaseLabel);
} else {
diff --git a/src/jdk.compiler/share/classes/com/sun/tools/javac/jvm/Gen.java b/src/jdk.compiler/share/classes/com/sun/tools/javac/jvm/Gen.java
index 833410b8a0436..d43cfc6450276 100644
--- a/src/jdk.compiler/share/classes/com/sun/tools/javac/jvm/Gen.java
+++ b/src/jdk.compiler/share/classes/com/sun/tools/javac/jvm/Gen.java
@@ -1375,8 +1375,7 @@ private void handleSwitch(JCTree swtch, JCExpression selector, List case
if (switchEnv.info.cont != null) {
Assert.check(patternSwitch);
- code.resolve(switchEnv.info.cont);
- code.resolve(code.branch(goto_), switchStart);
+ code.resolve(switchEnv.info.cont, switchStart);
}
// Resolve all breaks.
diff --git a/src/jdk.compiler/share/classes/com/sun/tools/javac/resources/compiler.properties b/src/jdk.compiler/share/classes/com/sun/tools/javac/resources/compiler.properties
index 03c81a0727195..209b891982e3b 100644
--- a/src/jdk.compiler/share/classes/com/sun/tools/javac/resources/compiler.properties
+++ b/src/jdk.compiler/share/classes/com/sun/tools/javac/resources/compiler.properties
@@ -1189,6 +1189,9 @@ compiler.err.static.imp.only.classes.and.interfaces=\
compiler.err.string.const.req=\
constant string expression required
+compiler.err.pattern.expected=\
+ type pattern expected
+
# 0: symbol, 1: fragment
compiler.err.cannot.generate.class=\
error while generating class {0}\n\
diff --git a/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/resources/stylesheet.css b/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/resources/stylesheet.css
index b560814eb14c0..836c62da83a86 100644
--- a/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/resources/stylesheet.css
+++ b/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/resources/stylesheet.css
@@ -350,14 +350,12 @@ ul.see-list-long li:not(:last-child):after {
/*
* Styles for tables.
*/
-.summary-table {
+.summary-table, .details-table {
width:100%;
border-spacing:0;
border-left:1px solid #EEE;
border-right:1px solid #EEE;
border-bottom:1px solid #EEE;
-}
-.summary-table {
padding:0;
}
.caption {
@@ -445,7 +443,7 @@ div.table-tabs > button.table-tab {
grid-template-columns: minmax(15%, max-content) minmax(15%, auto);
}
}
-.summary-table > div {
+.summary-table > div, .details-table > div {
text-align:left;
padding: 8px 3px 3px 7px;
}
diff --git a/test/hotspot/jtreg/ProblemList-Xcomp.txt b/test/hotspot/jtreg/ProblemList-Xcomp.txt
index 376d22908dbd8..855f3b1a1adcb 100644
--- a/test/hotspot/jtreg/ProblemList-Xcomp.txt
+++ b/test/hotspot/jtreg/ProblemList-Xcomp.txt
@@ -32,3 +32,5 @@ compiler/intrinsics/bmi/verifycode/BzhiTestI2L.java 8268033 generic-x64
vmTestbase/nsk/jvmti/SetFieldAccessWatch/setfldw001/TestDescription.java 8205957 generic-all
vmTestbase/vm/mlvm/mixed/stress/regression/b6969574/INDIFY_Test.java 8265295 linux-x64,windows-x64
+
+vmTestbase/nsk/jvmti/scenarios/sampling/SP07/sp07t002/TestDescription.java 8245680 windows-x64
diff --git a/test/hotspot/jtreg/compiler/compilercontrol/share/MultiCommand.java b/test/hotspot/jtreg/compiler/compilercontrol/share/MultiCommand.java
index ae7a4264e976c..50e11bad53467 100644
--- a/test/hotspot/jtreg/compiler/compilercontrol/share/MultiCommand.java
+++ b/test/hotspot/jtreg/compiler/compilercontrol/share/MultiCommand.java
@@ -72,7 +72,9 @@ public static AbstractTestBase generateRandomTest(boolean validOnly) {
Executable exec = Utils.getRandomElement(METHODS).first;
MethodDescriptor md;
- if (validOnly) {
+
+ // Command.quiet discards the method descriptor - can never fail on the method descriptor
+ if (validOnly || cmd == Command.QUIET) {
md = AbstractTestBase.getValidMethodDescriptor(exec);
} else {
md = AbstractTestBase.METHOD_GEN.generateRandomDescriptor(exec);
diff --git a/test/hotspot/jtreg/compiler/vectorapi/TestVectorShuffleIota.java b/test/hotspot/jtreg/compiler/vectorapi/TestVectorShuffleIota.java
new file mode 100644
index 0000000000000..4762b84db8b91
--- /dev/null
+++ b/test/hotspot/jtreg/compiler/vectorapi/TestVectorShuffleIota.java
@@ -0,0 +1,58 @@
+/*
+ * Copyright (c) 2021, Huawei Technologies Co. Ltd. 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
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package compiler.vectorapi;
+
+import jdk.incubator.vector.IntVector;
+import jdk.incubator.vector.VectorSpecies;
+import jdk.incubator.vector.VectorShuffle;
+
+/*
+ * @test
+ * @bug 8265907
+ * @modules jdk.incubator.vector
+ * @run main/othervm compiler.vectorapi.TestVectorShuffleIota
+ */
+
+public class TestVectorShuffleIota {
+ static final VectorSpecies SPECIESi = IntVector.SPECIES_128;
+
+ static final int INVOC_COUNT = 50000;
+
+ static int[] ai = {87, 65, 78, 71};
+
+ static void testShuffleI() {
+ IntVector iv = (IntVector) VectorShuffle.iota(SPECIESi, 0, 2, false).toVector();
+ iv.intoArray(ai, 0);
+ }
+
+ public static void main(String[] args) {
+ for (int i = 0; i < INVOC_COUNT; i++) {
+ testShuffleI();
+ }
+ for (int i = 0; i < ai.length; i++) {
+ System.out.print(ai[i] + ", ");
+ }
+ System.out.println();
+ }
+}
diff --git a/test/hotspot/jtreg/gc/arguments/TestParallelRefProc.java b/test/hotspot/jtreg/gc/arguments/TestParallelRefProc.java
index 648ce69b3addb..2af16cf506e30 100644
--- a/test/hotspot/jtreg/gc/arguments/TestParallelRefProc.java
+++ b/test/hotspot/jtreg/gc/arguments/TestParallelRefProc.java
@@ -51,7 +51,7 @@ public static void main(String args[]) throws Exception {
}
if (GC.Parallel.isSupported()) {
noneGCSupported = false;
- testFlag(new String[] { "-XX:+UseParallelGC" }, false);
+ testFlag(new String[] { "-XX:+UseParallelGC" }, true);
}
if (GC.G1.isSupported()) {
noneGCSupported = false;
diff --git a/test/hotspot/jtreg/vmTestbase/vm/mlvm/anonloader/stress/oome/metaspace/Test.java b/test/hotspot/jtreg/vmTestbase/vm/mlvm/anonloader/stress/oome/metaspace/Test.java
index c68ba4dbd9e45..1984555708ef4 100644
--- a/test/hotspot/jtreg/vmTestbase/vm/mlvm/anonloader/stress/oome/metaspace/Test.java
+++ b/test/hotspot/jtreg/vmTestbase/vm/mlvm/anonloader/stress/oome/metaspace/Test.java
@@ -24,38 +24,70 @@
/*
* @test
+ * @modules java.base/jdk.internal.misc
*
* @summary converted from VM Testbase vm/mlvm/anonloader/stress/oome/metaspace.
* VM Testbase keywords: [feature_mlvm, nonconcurrent]
*
- * @library /test/lib
+ * @library /vmTestbase
+ * /test/lib
*
- * @run driver vm.mlvm.anonloader.stress.oome.metaspace.Test
+ * @comment build test class and indify classes
+ * @build vm.mlvm.anonloader.stress.oome.metaspace.Test
+ * @run driver vm.mlvm.share.IndifiedClassesBuilder
+ *
+ * @run main/othervm -XX:MaxRAMPercentage=25 -XX:-UseGCOverheadLimit -XX:MetaspaceSize=10m
+ * -XX:MaxMetaspaceSize=20m vm.mlvm.anonloader.stress.oome.metaspace.Test
*/
package vm.mlvm.anonloader.stress.oome.metaspace;
-import jdk.test.lib.process.OutputAnalyzer;
-import jdk.test.lib.process.ProcessTools;
-
-public class Test {
-
- public static void main(String[] args) throws Exception {
- ProcessBuilder pb = ProcessTools.createJavaProcessBuilder(
- "-Xshare:off", "-XX:MaxMetaspaceSize=512k", "-version");
-
- OutputAnalyzer analyzer = new OutputAnalyzer(pb.start());
+import java.lang.invoke.MethodHandles;
+import java.lang.invoke.MethodHandles.Lookup;
+import java.util.List;
+import java.io.IOException;
- analyzer.shouldNotHaveExitValue(0);
+import vm.mlvm.anonloader.share.AnonkTestee01;
+import vm.mlvm.share.MlvmOOMTest;
+import vm.mlvm.share.MlvmTestExecutor;
+import vm.mlvm.share.Env;
+import vm.share.FileUtils;
- if (!analyzer.getStdout().contains("OutOfMemoryError")) {
- throw new RuntimeException("TEST FAIL : no OOME");
+/**
+ * This test loads classes using defineHiddenClass and stores them,
+ * expecting Metaspace OOME.
+ *
+ */
+public class Test extends MlvmOOMTest {
+ @Override
+ protected void checkOOME(OutOfMemoryError oome) {
+ String message = oome.getMessage();
+ if (!"Metaspace".equals(message) && !"Compressed class space".equals(message)) {
+ throw new RuntimeException("TEST FAIL : wrong OOME", oome);
}
+ }
- if (!analyzer.getStdout().contains("Metaspace") &&
- !analyzer.getStdout().contains("Compressed class space")) {
- throw new RuntimeException("TEST FAIL : wrong OOME");
+ @Override
+ protected void eatMemory(List