This commit is contained in:
Jesper Wilhelmsson 2021-12-14 02:15:15 +00:00
commit 8401a059bd
6 changed files with 118 additions and 34 deletions

View File

@ -6261,6 +6261,9 @@ address generate_avx_ghash_processBlocks() {
__ cmpl(length, 63); __ cmpl(length, 63);
__ jcc(Assembler::lessEqual, L_finalBit); __ jcc(Assembler::lessEqual, L_finalBit);
__ mov64(rax, 0x0000ffffffffffff);
__ kmovql(k2, rax);
__ align32(); __ align32();
__ BIND(L_process64Loop); __ BIND(L_process64Loop);
@ -6282,7 +6285,7 @@ address generate_avx_ghash_processBlocks() {
__ vpmaddwd(merged0, merge_ab_bc0, pack32_op, Assembler::AVX_512bit); __ vpmaddwd(merged0, merge_ab_bc0, pack32_op, Assembler::AVX_512bit);
__ vpermb(merged0, pack24bits, merged0, Assembler::AVX_512bit); __ vpermb(merged0, pack24bits, merged0, Assembler::AVX_512bit);
__ evmovdquq(Address(dest, dp), merged0, Assembler::AVX_512bit); __ evmovdqub(Address(dest, dp), k2, merged0, true, Assembler::AVX_512bit);
__ subl(length, 64); __ subl(length, 64);
__ addptr(source, 64); __ addptr(source, 64);

View File

@ -1056,38 +1056,57 @@ JNIEXPORT jintArray JNICALL Java_sun_awt_shell_Win32ShellFolder2_getIconBits
bmi.bmiHeader.biCompression = BI_RGB; bmi.bmiHeader.biCompression = BI_RGB;
// Extract the color bitmap // Extract the color bitmap
int nBits = iconSize * iconSize; int nBits = iconSize * iconSize;
long colorBits[MAX_ICON_SIZE * MAX_ICON_SIZE];
GetDIBits(dc, iconInfo.hbmColor, 0, iconSize, colorBits, &bmi, DIB_RGB_COLORS); long *colorBits = NULL;
// XP supports alpha in some icons, and depending on device. long *maskBits = NULL;
// This should take precedence over the icon mask bits.
BOOL hasAlpha = FALSE; try {
if (IS_WINXP) { entry_point();
for (int i = 0; i < nBits; i++) { colorBits = (long*)safe_Malloc(MAX_ICON_SIZE * MAX_ICON_SIZE * sizeof(long));
if ((colorBits[i] & 0xff000000) != 0) { GetDIBits(dc, iconInfo.hbmColor, 0, iconSize, colorBits, &bmi, DIB_RGB_COLORS);
hasAlpha = TRUE; // XP supports alpha in some icons, and depending on device.
break; // This should take precedence over the icon mask bits.
BOOL hasAlpha = FALSE;
if (IS_WINXP) {
for (int i = 0; i < nBits; i++) {
if ((colorBits[i] & 0xff000000) != 0) {
hasAlpha = TRUE;
break;
}
} }
} }
} if (!hasAlpha) {
if (!hasAlpha) { // Extract the mask bitmap
// Extract the mask bitmap maskBits = (long*)safe_Malloc(MAX_ICON_SIZE * MAX_ICON_SIZE * sizeof(long));
long maskBits[MAX_ICON_SIZE * MAX_ICON_SIZE]; GetDIBits(dc, iconInfo.hbmMask, 0, iconSize, maskBits, &bmi, DIB_RGB_COLORS);
GetDIBits(dc, iconInfo.hbmMask, 0, iconSize, maskBits, &bmi, DIB_RGB_COLORS); // Copy the mask alphas into the color bits
// Copy the mask alphas into the color bits for (int i = 0; i < nBits; i++) {
for (int i = 0; i < nBits; i++) { if (maskBits[i] == 0) {
if (maskBits[i] == 0) { colorBits[i] |= 0xff000000;
colorBits[i] |= 0xff000000; }
} }
} }
// Create java array
iconBits = env->NewIntArray(nBits);
if (!(env->ExceptionCheck())) {
// Copy values to java array
env->SetIntArrayRegion(iconBits, 0, nBits, colorBits);
}
} catch(std::bad_alloc&) {
handle_bad_alloc();
} }
// Release DC // Release DC
ReleaseDC(NULL, dc); ReleaseDC(NULL, dc);
// Create java array
iconBits = env->NewIntArray(nBits); // Free bitmap buffers if they were allocated
if (!(env->ExceptionCheck())) { if (colorBits != NULL) {
// Copy values to java array free(colorBits);
env->SetIntArrayRegion(iconBits, 0, nBits, colorBits); }
}
if (maskBits != NULL) {
free(maskBits);
}
} }
// Fix 4745575 GDI Resource Leak // Fix 4745575 GDI Resource Leak
// MSDN // MSDN

View File

@ -48,6 +48,7 @@ import java.util.Base64.Decoder;
import java.util.Base64.Encoder; import java.util.Base64.Encoder;
import java.util.Objects; import java.util.Objects;
import java.util.Random; import java.util.Random;
import java.util.Arrays;
import compiler.whitebox.CompilerWhiteBoxTest; import compiler.whitebox.CompilerWhiteBoxTest;
import sun.hotspot.code.Compiler; import sun.hotspot.code.Compiler;
@ -79,9 +80,9 @@ public class TestBase64 {
private static void warmup() { private static void warmup() {
final int warmupCount = 20_000; final int warmupCount = 20_000;
final int bufSize = 60; final int bufSize = 15308;
byte[] srcBuf = new byte[bufSize]; byte[] srcBuf = new byte[bufSize];
byte[] encBuf = new byte[(bufSize / 3) * 4]; byte[] encBuf = new byte[((bufSize + 2) / 3) * 4];
byte[] decBuf = new byte[bufSize]; byte[] decBuf = new byte[bufSize];
ran.nextBytes(srcBuf); ran.nextBytes(srcBuf);
@ -163,10 +164,13 @@ public class TestBase64 {
assertEqual(resEncodeStr, encodedStr); assertEqual(resEncodeStr, encodedStr);
// test int decode(byte[], byte[]) // test int decode(byte[], byte[])
resArr = new byte[srcArr.length]; // JDK-8273108: Test for output buffer overrun
resArr = new byte[srcArr.length + 2];
resArr[srcArr.length + 1] = (byte) 167;
len = decoder.decode(encodedArr, resArr); len = decoder.decode(encodedArr, resArr);
assertEqual(len, srcArr.length); assertEqual(len, srcArr.length);
assertEqual(resArr, srcArr); assertEqual(Arrays.copyOfRange(resArr, 0, srcArr.length), srcArr);
assertEqual(resArr[srcArr.length + 1], (byte) 167);
// test byte[] decode(byte[]) // test byte[] decode(byte[])
resArr = decoder.decode(encodedArr); resArr = decoder.decode(encodedArr);

View File

@ -567,7 +567,6 @@ com/sun/management/OperatingSystemMXBean/GetSystemCpuLoad.java 8030957 aix-all
java/lang/management/MemoryMXBean/Pending.java 8158837 generic-all java/lang/management/MemoryMXBean/Pending.java 8158837 generic-all
java/lang/management/MemoryMXBean/PendingAllGC.sh 8158837 generic-all java/lang/management/MemoryMXBean/PendingAllGC.sh 8158837 generic-all
java/lang/management/ThreadMXBean/ThreadMXBeanStateTest.java 8247426 generic-all java/lang/management/ThreadMXBean/ThreadMXBeanStateTest.java 8247426 generic-all
java/lang/management/ThreadMXBean/ThreadLists.java 8132785 generic-all
sun/management/jdp/JdpDefaultsTest.java 8241865 linux-aarch64,macosx-all sun/management/jdp/JdpDefaultsTest.java 8241865 linux-aarch64,macosx-all
sun/management/jdp/JdpJmxRemoteDynamicPortTest.java 8241865 macosx-all sun/management/jdp/JdpJmxRemoteDynamicPortTest.java 8241865 macosx-all
@ -749,7 +748,7 @@ javax/swing/JMenu/4515762/bug4515762.java 8276074 macosx-all
sanity/client/SwingSet/src/ToolTipDemoTest.java 8225012 windows-all,macosx-all sanity/client/SwingSet/src/ToolTipDemoTest.java 8225012 windows-all,macosx-all
sanity/client/SwingSet/src/ScrollPaneDemoTest.java 8225013 linux-all sanity/client/SwingSet/src/ScrollPaneDemoTest.java 8225013 linux-all
sanity/client/SwingSet/src/ButtonDemoScreenshotTest.java 8265770 macosx-all sanity/client/SwingSet/src/ButtonDemoScreenshotTest.java 8265770 macosx-all
javax/swing/JTree/4908142/bug4908142.java 8278348 macosx-aarch64 javax/swing/JTree/4908142/bug4908142.java 8278348 macosx-all
############################################################################ ############################################################################

View File

@ -1,5 +1,5 @@
/* /*
* Copyright (c) 2004, 2015, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 2004, 2021, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* *
* This code is free software; you can redistribute it and/or modify it * This code is free software; you can redistribute it and/or modify it
@ -23,9 +23,11 @@
/* /*
* @test * @test
* @bug 5047639 * @bug 5047639 8132785
* @summary Check that the "java-level" APIs provide a consistent view of * @summary Check that the "java-level" APIs provide a consistent view of
* the thread list * the thread list
* @comment Must run in othervm mode to avoid interference from other tests.
* @run main/othervm ThreadLists
*/ */
import java.lang.management.ManagementFactory; import java.lang.management.ManagementFactory;
import java.lang.management.ThreadMXBean; import java.lang.management.ThreadMXBean;
@ -50,6 +52,19 @@ public class ThreadLists {
// get the thread count // get the thread count
int activeCount = top.activeCount(); int activeCount = top.activeCount();
// Now enumerate to see if we find any extras yet.
// Ensure the array is big enough for a few extras.
Thread[] threads = new Thread[activeCount * 2];
int newCount = top.enumerate(threads);
if (newCount != activeCount) {
System.out.println("Found different threads after enumeration:");
} else {
System.out.println("Initial set of enumerated threads:");
}
for (int i = 0; i < newCount; i++) {
System.out.println(" - Thread: " + threads[i].getName());
}
Map<Thread, StackTraceElement[]> stackTraces = Thread.getAllStackTraces(); Map<Thread, StackTraceElement[]> stackTraces = Thread.getAllStackTraces();
ThreadMXBean threadBean = ManagementFactory.getThreadMXBean(); ThreadMXBean threadBean = ManagementFactory.getThreadMXBean();
@ -68,6 +83,11 @@ public class ThreadLists {
if (activeCount != threadIds.length) failed = true; if (activeCount != threadIds.length) failed = true;
if (failed) { if (failed) {
System.out.println("Set of stack-traced threads:");
for (Thread t : stackTraces.keySet()) {
System.out.println(" - Thread: " +
(t != null ? t.getName() : "null!"));
}
throw new RuntimeException("inconsistent results"); throw new RuntimeException("inconsistent results");
} }
} }

View File

@ -0,0 +1,39 @@
/*
* Copyright (c) 2021, 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
* 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 8277299
* @requires (os.family == "windows")
* @summary STACK_OVERFLOW in Java_sun_awt_shell_Win32ShellFolder2_getIconBits
* @run main/othervm -Xss320k ShellFolderStackOverflow
*/
import javax.swing.UIManager;
public class ShellFolderStackOverflow {
public static void main(final String... args) throws Exception {
UIManager.setLookAndFeel("com.sun.java.swing.plaf.windows.WindowsLookAndFeel");
// With default stack size for 32-bit VM next call will cause VM crash
UIManager.getIcon("Tree.openIcon");
}
}