This commit is contained in:
Jesper Wilhelmsson 2022-12-09 22:00:12 +00:00
commit 715bf70459
13 changed files with 261 additions and 12 deletions
src
hotspot
java.net.http/share/classes/jdk/internal/net/http
jdk.compiler/share/classes/com/sun/tools/javac/main
test
hotspot/jtreg
jdk
ProblemList.txt
java/net/httpclient
jdk/jfr/api/consumer/recordingstream
langtools/tools/javac/modules

@ -54,7 +54,7 @@ define_pd_global(intx, StackRedPages, DEFAULT_STACK_RED_PAGES);
define_pd_global(intx, StackShadowPages, DEFAULT_STACK_SHADOW_PAGES);
define_pd_global(intx, StackReservedPages, DEFAULT_STACK_RESERVED_PAGES);
define_pd_global(bool, VMContinuations, true);
define_pd_global(bool, VMContinuations, AIX_ONLY(false) NOT_AIX(true));
// Use large code-entry alignment.
define_pd_global(uintx, CodeCacheSegmentSize, 128);

@ -14377,6 +14377,12 @@ instruct safePoint_poll(iRegPdst poll) %{
// Call Java Static Instruction
source %{
#include "runtime/continuation.hpp"
%}
// Schedulable version of call static node.
instruct CallStaticJavaDirect(method meth) %{
match(CallStaticJava);

@ -1733,7 +1733,7 @@ Node* PhaseIdealLoop::compute_early_ctrl(Node* n, Node* n_ctrl) {
bool PhaseIdealLoop::ctrl_of_all_uses_out_of_loop(const Node* n, Node* n_ctrl, IdealLoopTree* n_loop) {
for (DUIterator_Fast imax, i = n->fast_outs(imax); i < imax; i++) {
Node* u = n->fast_out(i);
if (u->Opcode() == Op_Opaque1) {
if (u->is_Opaque1()) {
return false; // Found loop limit, bugfix for 4677003
}
// We can't reuse tags in PhaseIdealLoop::dom_lca_for_get_late_ctrl_internal() so make sure calls to

@ -1008,6 +1008,7 @@ class Http2Connection {
// This method is called when the HTTP/2 client is being
// stopped. Do not call it from anywhere else.
void closeAllStreams() {
if (debug.on()) debug.log("Close all streams");
for (var streamId : streams.keySet()) {
// safe to call without locking - see Stream::deRegister
decrementStreamsCount(streamId);

@ -273,6 +273,7 @@ class Stream<T> extends ExchangeImpl<T> {
if (debug.on()) debug.log("nullBody: streamid=%d", streamid);
// We should have an END_STREAM data frame waiting in the inputQ.
// We need a subscriber to force the scheduler to process it.
assert pendingResponseSubscriber == null;
pendingResponseSubscriber = HttpResponse.BodySubscribers.replacing(null);
sched.runOrSchedule();
}
@ -472,8 +473,14 @@ class Stream<T> extends ExchangeImpl<T> {
receiveDataFrame(new DataFrame(streamid, DataFrame.END_STREAM, List.of()));
}
} else if (frame instanceof DataFrame) {
if (cancelled) connection.dropDataFrame((DataFrame) frame);
else receiveDataFrame((DataFrame) frame);
if (cancelled) {
if (debug.on()) {
debug.log("request cancelled or stream closed: dropping data frame");
}
connection.dropDataFrame((DataFrame) frame);
} else {
receiveDataFrame((DataFrame) frame);
}
} else {
if (!cancelled) otherFrame(frame);
}
@ -1283,10 +1290,24 @@ class Stream<T> extends ExchangeImpl<T> {
}
}
}
if (closing) { // true if the stream has not been closed yet
if (responseSubscriber != null || pendingResponseSubscriber != null)
if (responseSubscriber != null || pendingResponseSubscriber != null) {
if (debug.on())
debug.log("stream %s closing due to %s", streamid, (Object)errorRef.get());
sched.runOrSchedule();
} else {
if (debug.on())
debug.log("stream %s closing due to %s before subscriber registered",
streamid, (Object)errorRef.get());
}
} else {
if (debug.on()) {
debug.log("stream %s already closed due to %s",
streamid, (Object)errorRef.get());
}
}
completeResponseExceptionally(e);
if (!requestBodyCF.isDone()) {
requestBodyCF.completeExceptionally(errorRef.get()); // we may be sending the body..
@ -1330,6 +1351,20 @@ class Stream<T> extends ExchangeImpl<T> {
if (debug.on()) debug.log("close stream %d", streamid);
Log.logTrace("Closing stream {0}", streamid);
connection.closeStream(streamid);
var s = responseSubscriber == null
? pendingResponseSubscriber
: responseSubscriber;
if (debug.on()) debug.log("subscriber is %s", s);
if (s instanceof Http2StreamResponseSubscriber<?> sw) {
if (debug.on()) debug.log("closing response subscriber stream %s", streamid);
// if the subscriber has already completed,
// there is nothing to do...
if (!sw.completed()) {
// otherwise make sure it will be completed
var cause = errorRef.get();
sw.complete(cause == null ? new IOException("stream closed") : cause);
}
}
Log.logTrace("Stream {0} closed", streamid);
}
@ -1554,10 +1589,12 @@ class Stream<T> extends ExchangeImpl<T> {
super.complete(t);
}
}
@Override
protected void onCancel() {
unregisterResponseSubscriber(this);
}
}
private static final VarHandle STREAM_STATE;

@ -30,7 +30,6 @@ import java.nio.ByteBuffer;
import java.util.Comparator;
import java.util.List;
import java.util.Objects;
import java.util.concurrent.CompletableFuture;
import java.util.concurrent.CompletionStage;
import java.util.concurrent.Flow;
import java.util.concurrent.Flow.Subscription;
@ -176,6 +175,14 @@ public class HttpBodySubscriberWrapper<T> implements TrustedSubscriber<T> {
}
}
/**
* {@return true if this subscriber has already completed, either normally
* or abnormally}
*/
public boolean completed() {
return completed.get();
}
@Override
public CompletionStage<T> getBody() {
return userSubscriber.getBody();

@ -608,13 +608,22 @@ public class JavaCompiler {
* @param content The characters to be parsed.
*/
protected JCCompilationUnit parse(JavaFileObject filename, CharSequence content) {
return parse(filename, content, false);
}
/** Parse contents of input stream.
* @param filename The name of the file from which input stream comes.
* @param content The characters to be parsed.
* @param silent true if TaskListeners should not be notified
*/
private JCCompilationUnit parse(JavaFileObject filename, CharSequence content, boolean silent) {
long msec = now();
JCCompilationUnit tree = make.TopLevel(List.nil());
if (content != null) {
if (verbose) {
log.printVerbose("parsing.started", filename);
}
if (!taskListener.isEmpty()) {
if (!taskListener.isEmpty() && !silent) {
TaskEvent e = new TaskEvent(TaskEvent.Kind.PARSE, filename);
taskListener.started(e);
keepComments = true;
@ -630,7 +639,7 @@ public class JavaCompiler {
tree.sourcefile = filename;
if (content != null && !taskListener.isEmpty()) {
if (content != null && !taskListener.isEmpty() && !silent) {
TaskEvent e = new TaskEvent(TaskEvent.Kind.PARSE, tree);
taskListener.finished(e);
}
@ -1800,7 +1809,7 @@ public class JavaCompiler {
DiagnosticHandler dh = new DiscardDiagnosticHandler(log);
JavaFileObject prevSource = log.useSource(fo);
try {
JCTree.JCCompilationUnit t = parse(fo, fo.getCharContent(false));
JCTree.JCCompilationUnit t = parse(fo, fo.getCharContent(false), true);
return tree2Name.apply(t);
} catch (IOException e) {
return null;

@ -79,6 +79,7 @@ gc/stress/gclocker/TestGCLockerWithParallel.java 8180622 generic-all
gc/stress/gclocker/TestGCLockerWithG1.java 8180622 generic-all
gc/stress/TestJNIBlockFullGC/TestJNIBlockFullGC.java 8192647 generic-all
gc/stress/TestStressG1Humongous.java 8286554 windows-x64
gc/TestFullGCCount.java 8298296 linux-x64
#############################################################################
@ -163,3 +164,5 @@ vmTestbase/vm/mlvm/indy/func/jvmti/mergeCP_indy2manySame_b/TestDescription.java
vmTestbase/nsk/jdwp/ThreadReference/ForceEarlyReturn/forceEarlyReturn001/forceEarlyReturn001.java 7199837 generic-all
vmTestbase/nsk/stress/except/except012.java 8297977 generic-all
vmTestbase/nsk/stress/strace/strace004.java 8297824 macosx-x64,windows-x64
vmTestbase/nsk/monitoring/ThreadMXBean/ThreadInfo/Multi/Multi005/TestDescription.java 8076494 windows-x64

@ -0,0 +1,79 @@
/*
* Copyright (c) 2022, Red Hat, Inc. 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.
*/
/**
* @test
* @bug 8298353
* @summary C2 fails with assert(opaq->outcnt() == 1 && opaq->in(1) == limit) failed
*
* @run main/othervm -XX:-TieredCompilation -XX:-UseOnStackReplacement -XX:-BackgroundCompilation TestBadCountedLoopLimit
*
*/
import java.util.Arrays;
public class TestBadCountedLoopLimit {
private static volatile int barrier;
private static int field;
public static void main(String[] args) {
boolean[] flag1 = new boolean[100];
boolean[] flag2 = new boolean[100];
Arrays.fill(flag2, true);
for (int i = 0; i < 20_000; i++) {
test(0, flag1, flag1);
test(0, flag2, flag2);
testHelper(true, 0, 0);
testHelper(false, 0, 0);
}
}
private static int test(int v, boolean[] flag, boolean[] flag2) {
int j = testHelper(flag2[0], 0, 1);
int i = 1;
int limit = 0;
for (;;) {
synchronized (new Object()) {
}
limit = j;
if (i >= 100) {
break;
}
if (flag[i]) {
return limit - 3;
}
j = testHelper(flag2[i], 100, 101);
i *= 2;
};
for (int k = 0; k < limit; k++) {
barrier = 0x42;
}
return j;
}
private static int testHelper(boolean flag2, int x, int x1) {
return flag2 ? x : x1;
}
}

@ -673,6 +673,7 @@ javax/swing/JFrame/8175301/ScaledFrameBackgroundTest.java 8274106 macosx-aarch64
java/awt/Mouse/EnterExitEvents/DragWindowTest.java 8297296 macosx-all
javax/swing/JFileChooser/8046391/bug8046391.java 8293862 windows-x64
javax/swing/JFileChooser/4847375/bug4847375.java 8293862 windows-x64
java/awt/Focus/NonFocusableWindowTest/NonfocusableOwnerTest.java 8280392 windows-x64
java/awt/Mixing/AWT_Mixing/OpaqueOverlapping.java 8294264 windows-x64
java/awt/Mixing/AWT_Mixing/ViewportOverlapping.java 8253184,8295813 windows-x64

@ -23,7 +23,7 @@
/*
* @test
* @bug 8245462 8229822 8254786 8297075 8297149
* @bug 8245462 8229822 8254786 8297075 8297149 8298340
* @summary Tests cancelling the request.
* @library /test/lib http2/server
* @key randomness

@ -38,7 +38,7 @@ import jdk.jfr.consumer.RecordingStream;
* @key jfr
* @requires vm.hasJFR
* @library /test/lib /test/jdk
* @run main/othervm jdk.jfr.api.consumer.recordingstream.TestClose
* @run main/othervm -Xlog:jfr+streaming+system=trace jdk.jfr.api.consumer.recordingstream.TestClose
*/
public class TestClose {

@ -23,7 +23,7 @@
/*
* @test
* @bug 8154283 8167320 8171098 8172809 8173068 8173117 8176045 8177311 8241519
* @bug 8154283 8167320 8171098 8172809 8173068 8173117 8176045 8177311 8241519 8297988
* @summary tests for multi-module mode compilation
* @library /tools/lib
* @modules
@ -39,6 +39,7 @@
import java.io.BufferedWriter;
import java.io.Writer;
import java.nio.file.Files;
import java.nio.file.FileSystems;
import java.nio.file.Path;
import java.nio.file.Paths;
import java.util.Arrays;
@ -65,10 +66,13 @@ import javax.tools.StandardJavaFileManager;
import javax.tools.ToolProvider;
import com.sun.source.tree.CompilationUnitTree;
import com.sun.source.util.TaskEvent;
import com.sun.source.util.TaskListener;
//import com.sun.source.util.JavacTask; // conflicts with toolbox.JavacTask
import com.sun.tools.javac.api.JavacTaskImpl;
import com.sun.tools.javac.code.Symbol.ModuleSymbol;
import com.sun.tools.javac.code.Symtab;
import java.util.ArrayList;
import toolbox.JarTask;
import toolbox.JavacTask;
@ -1047,4 +1051,106 @@ public class EdgeCases extends ModuleTestBase {
throw new Exception("expected output not found: " + log);
}
@Test //JDK-8297988
public void testExportedNameCheckFromSourceNoEvent(Path base) throws Exception {
//when validating "exports", javac may parse source(s) from the package to check their
//package name. The AST produced by this parse are thrown away, so listeners should not
//be notified:
Path src = base.resolve("src");
Path m = src.resolve("m");
tb.writeJavaFiles(m,
"""
module m {
exports test;
}
""",
"""
package test;
public class Test {}
""",
"""
package impl;
public class Impl {
void t() {
test.Test t;
}
}
""");
Path classes = base.resolve("classes");
tb.createDirectories(classes);
record TestCase(Path[] files, String... expectedLog){}
String nameSeparator = FileSystems.getDefault().getSeparator();
TestCase[] testCases = new TestCase[] {
new TestCase(new Path[] {m.resolve("module-info.java")},
"COMPILATION:started:<none>",
"PARSE:started:testExportedNameCheckFromSourceNoEvent/src/m/module-info.java",
"PARSE:finished:testExportedNameCheckFromSourceNoEvent/src/m/module-info.java",
"ENTER:started:testExportedNameCheckFromSourceNoEvent/src/m/module-info.java",
"ENTER:finished:testExportedNameCheckFromSourceNoEvent/src/m/module-info.java",
"ANALYZE:started:testExportedNameCheckFromSourceNoEvent/src/m/module-info.java",
"ANALYZE:finished:testExportedNameCheckFromSourceNoEvent/src/m/module-info.java",
"COMPILATION:finished:<none>"),
new TestCase(new Path[] {m.resolve("module-info.java"),
m.resolve("impl").resolve("Impl.java")},
"COMPILATION:started:<none>",
"PARSE:started:testExportedNameCheckFromSourceNoEvent/src/m/module-info.java",
"PARSE:finished:testExportedNameCheckFromSourceNoEvent/src/m/module-info.java",
"PARSE:started:testExportedNameCheckFromSourceNoEvent/src/m/impl/Impl.java",
"PARSE:finished:testExportedNameCheckFromSourceNoEvent/src/m/impl/Impl.java",
"ENTER:started:testExportedNameCheckFromSourceNoEvent/src/m/module-info.java",
"ENTER:started:testExportedNameCheckFromSourceNoEvent/src/m/impl/Impl.java",
"ENTER:finished:testExportedNameCheckFromSourceNoEvent/src/m/module-info.java",
"ENTER:finished:testExportedNameCheckFromSourceNoEvent/src/m/impl/Impl.java",
"ANALYZE:started:testExportedNameCheckFromSourceNoEvent/src/m/module-info.java",
"ANALYZE:finished:testExportedNameCheckFromSourceNoEvent/src/m/module-info.java",
"ANALYZE:started:testExportedNameCheckFromSourceNoEvent/src/m/impl/Impl.java",
"PARSE:started:testExportedNameCheckFromSourceNoEvent/src/m/test/Test.java",
"PARSE:finished:testExportedNameCheckFromSourceNoEvent/src/m/test/Test.java",
"ENTER:started:testExportedNameCheckFromSourceNoEvent/src/m/test/Test.java",
"ENTER:finished:testExportedNameCheckFromSourceNoEvent/src/m/test/Test.java",
"ANALYZE:finished:testExportedNameCheckFromSourceNoEvent/src/m/impl/Impl.java",
"ANALYZE:started:testExportedNameCheckFromSourceNoEvent/src/m/test/Test.java",
"ANALYZE:finished:testExportedNameCheckFromSourceNoEvent/src/m/test/Test.java",
"COMPILATION:finished:<none>")
};
for (TestCase tc : testCases) {
List<String> log = new ArrayList<>();
new JavacTask(tb)
.outdir(classes)
.options("--source-path", m.toString(),
"-XDshould-stop.ifNoError=FLOW")
.callback(task -> {
task.addTaskListener(new TaskListener() {
@Override
public void started(TaskEvent e) {
record(e, "started");
}
@Override
public void finished(TaskEvent e) {
record(e, "finished");
}
private void record(TaskEvent e, String phase) {
JavaFileObject source = e.getSourceFile();
String sourceName = source != null ? source.getName()
.replace(nameSeparator, "/")
: "<none>";
log.add(e.getKind() + ":" + phase + ":" + sourceName);
}
});
})
.files(tc.files)
.run()
.writeAll();
if (!List.of(tc.expectedLog).equals(log)) {
throw new AssertionError("Unexpected log, got: " + log +
", expected: " + List.of(tc.expectedLog));
}
}
}
}