From 2f5e3d0d042cf95633e0d2b7eaf2164ca0c5ffda Mon Sep 17 00:00:00 2001 From: Mikael Vidstedt Date: Thu, 1 Aug 2019 09:27:24 -0700 Subject: [PATCH 1/8] Added tag jdk-13+32 for changeset 929f37a9c35d --- .hgtags | 1 + 1 file changed, 1 insertion(+) diff --git a/.hgtags b/.hgtags index 6e6f1266fa6..de677eb8ce9 100644 --- a/.hgtags +++ b/.hgtags @@ -569,3 +569,4 @@ b7f68ddec66f996ae3aad03291d129ca9f02482d jdk-13+27 3081f39a3d30d63b112098386ac2bb027c2b7223 jdk-13+29 2e63fb0a885fa908a97bbb0da8d7c3de11536aca jdk-13+30 6a159c6c23ccd0029140ab91653442e412305ce5 jdk-13+31 +929f37a9c35d530d4e866f6e832001aeb4cfb371 jdk-13+32 From 7ca72d55c3b62d636361f2bdfb83f5d860636267 Mon Sep 17 00:00:00 2001 From: Ichiroh Takiguchi Date: Thu, 1 Aug 2019 10:47:51 -0700 Subject: [PATCH 2/8] 8227919: 8213232 causes crashes on solaris sparc64 Reviewed-by: prr, vkempik --- src/java.desktop/unix/native/libawt_xawt/awt/awt_InputMethod.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/java.desktop/unix/native/libawt_xawt/awt/awt_InputMethod.c b/src/java.desktop/unix/native/libawt_xawt/awt/awt_InputMethod.c index f3dba4959dc..fca194b3792 100644 --- a/src/java.desktop/unix/native/libawt_xawt/awt/awt_InputMethod.c +++ b/src/java.desktop/unix/native/libawt_xawt/awt/awt_InputMethod.c @@ -1679,7 +1679,7 @@ JNIEXPORT jboolean JNICALL Java_sun_awt_X11InputMethodBase_isCompositionEnabledN { X11InputMethodData *pX11IMData = NULL; char * ret = NULL; -#if defined(_LP64) && !defined(_LITTLE_ENDIAN) +#if defined(__linux__) && defined(_LP64) && !defined(_LITTLE_ENDIAN) // XIMPreeditState value which is used for XGetICValues must be 32bit on BigEndian XOrg's xlib unsigned int state = XIMPreeditUnKnown; #else From 946d2b3197377881ba8b7fea8b51fc37ffa2f511 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Markus=20Gr=C3=B6nlund?= Date: Fri, 2 Aug 2019 10:43:30 +0200 Subject: [PATCH 3/8] 8228834: Regression caused by JDK-8214542 not installing complete checkpoint data to candidates Reviewed-by: egahlin --- .../checkpoint/objectSampleCheckpoint.cpp | 23 +++++++++---------- .../checkpoint/objectSampleCheckpoint.hpp | 2 +- .../jfr/recorder/checkpoint/types/jfrType.cpp | 6 ++--- 3 files changed, 15 insertions(+), 16 deletions(-) diff --git a/src/hotspot/share/jfr/leakprofiler/checkpoint/objectSampleCheckpoint.cpp b/src/hotspot/share/jfr/leakprofiler/checkpoint/objectSampleCheckpoint.cpp index 66567257adb..dee11169b2d 100644 --- a/src/hotspot/share/jfr/leakprofiler/checkpoint/objectSampleCheckpoint.cpp +++ b/src/hotspot/share/jfr/leakprofiler/checkpoint/objectSampleCheckpoint.cpp @@ -181,34 +181,33 @@ class SampleMark { } }; -void ObjectSampleCheckpoint::install(JfrCheckpointWriter& writer, bool class_unload) { +void ObjectSampleCheckpoint::install(JfrCheckpointWriter& writer, bool class_unload, bool type_set) { if (!writer.has_data()) { return; } assert(writer.has_data(), "invariant"); const JfrCheckpointBlobHandle h_cp = writer.checkpoint_blob(); + CheckpointInstall install(h_cp); // Class unload implies a safepoint. // Not class unload implies the object sampler is locked, because it was claimed exclusively earlier. // Therefore: direct access the object sampler instance is safe. - const ObjectSampler* const object_sampler = ObjectSampler::sampler(); + ObjectSampler* const object_sampler = ObjectSampler::sampler(); assert(object_sampler != NULL, "invariant"); ObjectSample* const last = const_cast(object_sampler->last()); const ObjectSample* const last_resolved = object_sampler->last_resolved(); - CheckpointInstall install(h_cp); - if (class_unload) { - // all samples need class unload information - do_samples(last, NULL, install); - return; - } - - // only new samples since last resolved checkpoint + // install only to new samples since last resolved checkpoint if (last != last_resolved) { do_samples(last, last_resolved, install); - const_cast(object_sampler)->set_last_resolved(last); + if (class_unload) { + return; + } + if (type_set) { + object_sampler->set_last_resolved(last); + } } } @@ -289,6 +288,6 @@ bool WriteObjectSampleStacktrace::process() { JfrStackTraceRepository::write_metadata(writer); // install the stacktrace checkpoint information to the candidates - ObjectSampleCheckpoint::install(writer, false); + ObjectSampleCheckpoint::install(writer, false, false); return true; } diff --git a/src/hotspot/share/jfr/leakprofiler/checkpoint/objectSampleCheckpoint.hpp b/src/hotspot/share/jfr/leakprofiler/checkpoint/objectSampleCheckpoint.hpp index 8b5e9fa73b3..b9043632c84 100644 --- a/src/hotspot/share/jfr/leakprofiler/checkpoint/objectSampleCheckpoint.hpp +++ b/src/hotspot/share/jfr/leakprofiler/checkpoint/objectSampleCheckpoint.hpp @@ -35,7 +35,7 @@ class ObjectSampler; class ObjectSampleCheckpoint : AllStatic { public: - static void install(JfrCheckpointWriter& writer, bool class_unload); + static void install(JfrCheckpointWriter& writer, bool class_unload, bool type_set); static void write(ObjectSampler* sampler, EdgeStore* edge_store, bool emit_all, Thread* thread); static int mark(ObjectSampler* sampler, ObjectSampleMarker& marker, bool emit_all); }; diff --git a/src/hotspot/share/jfr/recorder/checkpoint/types/jfrType.cpp b/src/hotspot/share/jfr/recorder/checkpoint/types/jfrType.cpp index 187b814a269..965a0b1972f 100644 --- a/src/hotspot/share/jfr/recorder/checkpoint/types/jfrType.cpp +++ b/src/hotspot/share/jfr/recorder/checkpoint/types/jfrType.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2016, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2016, 2019, 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 @@ -311,7 +311,7 @@ void ClassUnloadTypeSet::serialize(JfrCheckpointWriter& writer) { if (LeakProfiler::is_running()) { JfrCheckpointWriter leakp_writer(false, true, Thread::current()); type_set.write(writer, &leakp_writer); - ObjectSampleCheckpoint::install(leakp_writer, true); + ObjectSampleCheckpoint::install(leakp_writer, true, true); return; } type_set.write(writer, NULL); @@ -322,7 +322,7 @@ void TypeSet::serialize(JfrCheckpointWriter& writer) { if (LeakProfiler::is_running()) { JfrCheckpointWriter leakp_writer(false, true, Thread::current()); type_set.write(writer, &leakp_writer); - ObjectSampleCheckpoint::install(leakp_writer, false); + ObjectSampleCheckpoint::install(leakp_writer, false, true); return; } type_set.write(writer, NULL); From 01e4da68093b9b61334284b7fab79f274969b1a0 Mon Sep 17 00:00:00 2001 From: Matthias Baesken Date: Thu, 1 Aug 2019 08:59:31 +0200 Subject: [PATCH 4/8] 8228658: test GetTotalSafepointTime.java fails on fast Linux machines with Total safepoint time 0 ms Reviewed-by: dholmes, jcbeyler --- .../GetTotalSafepointTime.java | 50 +++++++------------ 1 file changed, 18 insertions(+), 32 deletions(-) diff --git a/test/jdk/sun/management/HotspotRuntimeMBean/GetTotalSafepointTime.java b/test/jdk/sun/management/HotspotRuntimeMBean/GetTotalSafepointTime.java index b2769e2c02a..13949149647 100644 --- a/test/jdk/sun/management/HotspotRuntimeMBean/GetTotalSafepointTime.java +++ b/test/jdk/sun/management/HotspotRuntimeMBean/GetTotalSafepointTime.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2019, 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 @@ -40,47 +40,33 @@ public class GetTotalSafepointTime { private static HotspotRuntimeMBean mbean = (HotspotRuntimeMBean)ManagementFactoryHelper.getHotspotRuntimeMBean(); - private static final long NUM_THREAD_DUMPS = 100; - // Careful with these values. private static final long MIN_VALUE_FOR_PASS = 1; - private static final long MAX_VALUE_FOR_PASS = Long.MAX_VALUE; - private static boolean trace = false; + // Thread.getAllStackTraces() should cause safepoints. + // If this test is failing because it doesn't, + // MIN_VALUE_FOR_PASS should be reset to 0 + public static long executeThreadDumps(long initial_value) { + long value; + do { + Thread.getAllStackTraces(); + value = mbean.getTotalSafepointTime(); + } while (value == initial_value); + return value; + } public static void main(String args[]) throws Exception { - if (args.length > 0 && args[0].equals("trace")) { - trace = true; - } + long value = executeThreadDumps(0); + System.out.println("Total safepoint time (ms): " + value); - // Thread.getAllStackTraces() should cause safepoints. - // If this test is failing because it doesn't, - // MIN_VALUE_FOR_PASS should be reset to 0 - for (int i = 0; i < NUM_THREAD_DUMPS; i++) { - Thread.getAllStackTraces(); - } - - long value = mbean.getTotalSafepointTime(); - - if (trace) { - System.out.println("Total safepoint time (ms): " + value); - } - - if (value < MIN_VALUE_FOR_PASS || value > MAX_VALUE_FOR_PASS) { + if (value < MIN_VALUE_FOR_PASS) { throw new RuntimeException("Total safepoint time " + "illegal value: " + value + " ms " + - "(MIN = " + MIN_VALUE_FOR_PASS + "; " + - "MAX = " + MAX_VALUE_FOR_PASS + ")"); + "(MIN = " + MIN_VALUE_FOR_PASS + ")"); } - for (int i = 0; i < 2 * NUM_THREAD_DUMPS; i++) { - Thread.getAllStackTraces(); - } - long value2 = mbean.getTotalSafepointTime(); - - if (trace) { - System.out.println("Total safepoint time2 (ms): " + value2); - } + long value2 = executeThreadDumps(value); + System.out.println("Total safepoint time (ms): " + value2); if (value2 <= value) { throw new RuntimeException("Total safepoint time " + From 1f088e0f3fa9fb7092af0782915f991b5bc319be Mon Sep 17 00:00:00 2001 From: Matthias Baesken Date: Fri, 26 Jul 2019 15:05:24 +0200 Subject: [PATCH 5/8] 8228650: runtime/SharedArchiveFile/CheckDefaultArchiveFile.java test fails on AIX Reviewed-by: mseledtsov --- .../CheckDefaultArchiveFile.java | 25 ++++++++++++------- 1 file changed, 16 insertions(+), 9 deletions(-) diff --git a/test/hotspot/jtreg/runtime/SharedArchiveFile/CheckDefaultArchiveFile.java b/test/hotspot/jtreg/runtime/SharedArchiveFile/CheckDefaultArchiveFile.java index 191471255f9..52fa82a1cd6 100644 --- a/test/hotspot/jtreg/runtime/SharedArchiveFile/CheckDefaultArchiveFile.java +++ b/test/hotspot/jtreg/runtime/SharedArchiveFile/CheckDefaultArchiveFile.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2018, 2019, 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 @@ -48,16 +48,23 @@ public class CheckDefaultArchiveFile { String vmName = System.getProperty("java.vm.name"); String vmString = vmName + "(" + osArch + ")"; String jsaString = wb.getDefaultArchivePath(); - Path jsa = Paths.get(jsaString); - if (Platform.isDefaultCDSArchiveSupported()) { - if (Files.exists(jsa)) { - System.out.println("Passed. " + vmString + - ": has default classes.jsa file"); - } else { - throw new RuntimeException(vmString + "has no " + jsaString); + System.out.println("classes.jsa location:" + jsaString); + if (jsaString == null) { + if (Platform.isDefaultCDSArchiveSupported()) { + throw new RuntimeException("default CDS archive supported, but classes.jsa path null"); } } else { - throw new SkippedException("Default CDS archive is not supported"); + Path jsa = Paths.get(jsaString); + if (Platform.isDefaultCDSArchiveSupported()) { + if (Files.exists(jsa)) { + System.out.println("Passed. " + vmString + + ": has default classes.jsa file"); + } else { + throw new RuntimeException(vmString + "has no " + jsaString); + } + } else { + throw new SkippedException("Default CDS archive is not supported"); + } } } } From adfa9a7eb1b22d3d8ee45387a5f388d3de50fcf5 Mon Sep 17 00:00:00 2001 From: Matthias Baesken Date: Thu, 25 Jul 2019 12:15:27 +0200 Subject: [PATCH 6/8] 8228585: jdk/internal/platform/cgroup/TestCgroupMetrics.java - NumberFormatException because of large long values (memory limit_in_bytes) Reviewed-by: dholmes, sgehwolf --- .../internal/platform/cgroupv1/SubSystem.java | 2 +- .../lib/containers/cgroup/MetricsTester.java | 23 +++++++++++++++++-- 2 files changed, 22 insertions(+), 3 deletions(-) diff --git a/src/java.base/linux/classes/jdk/internal/platform/cgroupv1/SubSystem.java b/src/java.base/linux/classes/jdk/internal/platform/cgroupv1/SubSystem.java index 5313a21b099..f1556375bac 100644 --- a/src/java.base/linux/classes/jdk/internal/platform/cgroupv1/SubSystem.java +++ b/src/java.base/linux/classes/jdk/internal/platform/cgroupv1/SubSystem.java @@ -132,7 +132,7 @@ public class SubSystem { retval = Long.parseLong(strval); } catch (NumberFormatException e) { // For some properties (e.g. memory.limit_in_bytes) we may overflow the range of signed long. - // In this case, return Long.max + // In this case, return Long.MAX_VALUE BigInteger b = new BigInteger(strval); if (b.compareTo(BigInteger.valueOf(Long.MAX_VALUE)) > 0) { return Long.MAX_VALUE; diff --git a/test/lib/jdk/test/lib/containers/cgroup/MetricsTester.java b/test/lib/jdk/test/lib/containers/cgroup/MetricsTester.java index cd914cf1547..13f4693f8e5 100644 --- a/test/lib/jdk/test/lib/containers/cgroup/MetricsTester.java +++ b/test/lib/jdk/test/lib/containers/cgroup/MetricsTester.java @@ -26,6 +26,7 @@ package jdk.test.lib.containers.cgroup; import java.io.File; import java.io.FileNotFoundException; import java.io.IOException; +import java.math.BigInteger; import java.nio.file.Files; import java.nio.file.Path; import java.nio.file.Paths; @@ -157,7 +158,24 @@ public class MetricsTester { private static long getLongValueFromFile(SubSystem subSystem, String fileName) { String data = getFileContents(subSystem, fileName); - return data.isEmpty() ? 0L : Long.parseLong(data); + return data.isEmpty() ? 0L : convertStringToLong(data); + } + + private static long convertStringToLong(String strval) { + long retval = 0; + if (strval == null) return 0L; + + try { + retval = Long.parseLong(strval); + } catch (NumberFormatException e) { + // For some properties (e.g. memory.limit_in_bytes) we may overflow the range of signed long. + // In this case, return Long.MAX_VALUE + BigInteger b = new BigInteger(strval); + if (b.compareTo(BigInteger.valueOf(Long.MAX_VALUE)) > 0) { + return Long.MAX_VALUE; + } + } + return retval; } private static long getLongValueFromFile(SubSystem subSystem, String metric, String subMetric) { @@ -165,7 +183,8 @@ public class MetricsTester { String[] tokens = stats.split("[\\r\\n]+"); for (int i = 0; i < tokens.length; i++) { if (tokens[i].startsWith(subMetric)) { - return Long.parseLong(tokens[i].split("\\s+")[1]); + String strval = tokens[i].split("\\s+")[1]; + return convertStringToLong(strval); } } return 0L; From 2f16ca0f59892fead80b209f7819bdbdb713329a Mon Sep 17 00:00:00 2001 From: Pankaj Bansal Date: Sat, 3 Aug 2019 13:53:19 +0530 Subject: [PATCH 7/8] 8226964: [Yaru] GTK L&F: There is no difference between menu selected and de-selected Reviewed-by: prr, kcr --- .../sun/java/swing/plaf/gtk/GTKPainter.java | 79 +++++++++++++++++++ .../com/sun/java/swing/plaf/gtk/GTKStyle.java | 8 ++ 2 files changed, 87 insertions(+) diff --git a/src/java.desktop/share/classes/com/sun/java/swing/plaf/gtk/GTKPainter.java b/src/java.desktop/share/classes/com/sun/java/swing/plaf/gtk/GTKPainter.java index 5fb1dfa2530..37dd3ec7772 100644 --- a/src/java.desktop/share/classes/com/sun/java/swing/plaf/gtk/GTKPainter.java +++ b/src/java.desktop/share/classes/com/sun/java/swing/plaf/gtk/GTKPainter.java @@ -535,6 +535,34 @@ class GTKPainter extends SynthPainter { } } + private int getBrightness(Color c) { + return Math.max(c.getRed(), Math.max(c.getGreen(), c.getBlue())); + } + + private int getMaxColorDiff(Color c1, Color c2) { + return Math.max(Math.abs(c1.getRed() - c2.getRed()), + Math.max(Math.abs(c1.getGreen() - c2.getGreen()), + Math.abs(c1.getBlue() - c2.getBlue()))); + } + + private int scaleColorComponent(int color, double scaleFactor) { + return (int)(color + color * scaleFactor); + } + private Color deriveColor(Color originalColor, int originalBrightness, + int targetBrightness) { + int r, g, b; + if (originalBrightness == 0) { + r = g = b = targetBrightness; + } else { + double scaleFactor = (targetBrightness - originalBrightness) + / originalBrightness ; + r = scaleColorComponent(originalColor.getRed(), scaleFactor); + g = scaleColorComponent(originalColor.getGreen(), scaleFactor); + b = scaleColorComponent(originalColor.getBlue(), scaleFactor); + } + return new Color(r, g, b); + } + // // MENU // @@ -551,6 +579,57 @@ class GTKPainter extends SynthPainter { int gtkState = GTKLookAndFeel.synthStateToGTKState( context.getRegion(), context.getComponentState()); if (gtkState == SynthConstants.MOUSE_OVER) { + if (GTKLookAndFeel.is3() && context.getRegion() == Region.MENU) { + GTKStyle style = (GTKStyle)context.getStyle(); + Color highlightColor = style.getGTKColor( + GTKEngine.WidgetType.MENU_ITEM.ordinal(), + gtkState, ColorType.BACKGROUND.getID()); + Color backgroundColor = style.getGTKColor( + GTKEngine.WidgetType.MENU_BAR.ordinal(), + SynthConstants.ENABLED, ColorType.BACKGROUND.getID()); + + int minBrightness = 0, maxBrightness = 255; + int minBrightnessDifference = 100; + int actualBrightnessDifference = + getMaxColorDiff(highlightColor, backgroundColor); + if (actualBrightnessDifference < minBrightnessDifference) { + int highlightBrightness = + getBrightness(highlightColor); + int backgroundBrightness = + getBrightness(backgroundColor); + int originalHighlightBrightness = + highlightBrightness; + if (highlightBrightness >= backgroundBrightness) { + if (backgroundBrightness + minBrightnessDifference <= + maxBrightness) { + highlightBrightness = + backgroundBrightness + + minBrightnessDifference; + } else { + highlightBrightness = + backgroundBrightness - + minBrightnessDifference; + } + } else { + if (backgroundBrightness - minBrightnessDifference >= + minBrightness) { + highlightBrightness = + backgroundBrightness - + minBrightnessDifference; + } else { + highlightBrightness = + backgroundBrightness + + minBrightnessDifference; + } + } + + g.setColor(deriveColor(highlightColor, + originalHighlightBrightness, + highlightBrightness)); + g.fillRect(x, y, w, h); + return; + } + } Region id = Region.MENU_ITEM; synchronized (UNIXToolkit.GTK_LOCK) { if (! ENGINE.paintCachedImage(g, x, y, w, h, id)) { diff --git a/src/java.desktop/share/classes/com/sun/java/swing/plaf/gtk/GTKStyle.java b/src/java.desktop/share/classes/com/sun/java/swing/plaf/gtk/GTKStyle.java index 10b96e43fa5..f875f5bc622 100644 --- a/src/java.desktop/share/classes/com/sun/java/swing/plaf/gtk/GTKStyle.java +++ b/src/java.desktop/share/classes/com/sun/java/swing/plaf/gtk/GTKStyle.java @@ -205,6 +205,14 @@ class GTKStyle extends SynthStyle implements GTKConstants { return getGTKColor(null, state, type); } + Color getGTKColor(int widgetType, int state, int colorType) { + synchronized (sun.awt.UNIXToolkit.GTK_LOCK) { + int rgb = nativeGetColorForState(widgetType, state, + colorType); + return new ColorUIResource(rgb); + } + } + /** * Returns the color for the specified state. * From d5ceec68b45ee01acb38b75a7497647d41da045d Mon Sep 17 00:00:00 2001 From: Alan Bateman Date: Mon, 5 Aug 2019 10:40:36 +0100 Subject: [PATCH 8/8] 8229018: Switching to an infinite socket timeout on Windows leads to high CPU load Reviewed-by: michaelm --- src/java.base/windows/native/libnio/ch/Net.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/src/java.base/windows/native/libnio/ch/Net.c b/src/java.base/windows/native/libnio/ch/Net.c index c4292d9405b..a20c32dd51b 100644 --- a/src/java.base/windows/native/libnio/ch/Net.c +++ b/src/java.base/windows/native/libnio/ch/Net.c @@ -623,9 +623,6 @@ Java_sun_nio_ch_Net_poll(JNIEnv* env, jclass this, jobject fdo, jint events, jlo fd_set rd, wr, ex; jint fd = fdval(env, fdo); - t.tv_sec = (long)(timeout / 1000); - t.tv_usec = (timeout % 1000) * 1000; - FD_ZERO(&rd); FD_ZERO(&wr); FD_ZERO(&ex); @@ -638,7 +635,12 @@ Java_sun_nio_ch_Net_poll(JNIEnv* env, jclass this, jobject fdo, jint events, jlo } FD_SET(fd, &ex); - rv = select(fd+1, &rd, &wr, &ex, &t); + if (timeout >= 0) { + t.tv_sec = (long)(timeout / 1000); + t.tv_usec = (timeout % 1000) * 1000; + } + + rv = select(fd+1, &rd, &wr, &ex, (timeout >= 0) ? &t : NULL); /* save last winsock error */ if (rv == SOCKET_ERROR) {