Skip to content

Commit

Permalink
Merge master HEAD into openj9-staging
Browse files Browse the repository at this point in the history
Signed-off-by: J9 Build <j9build@ca.ibm.com>
  • Loading branch information
j9build committed Oct 4, 2023
2 parents 8232fd3 + 45ced56 commit d0c7ea5
Show file tree
Hide file tree
Showing 153 changed files with 3,890 additions and 3,752 deletions.
31 changes: 14 additions & 17 deletions make/autoconf/flags-cflags.m4
Original file line number Diff line number Diff line change
Expand Up @@ -799,15 +799,6 @@ AC_DEFUN([FLAGS_SETUP_CFLAGS_CPU_DEP],
$1_TOOLCHAIN_CFLAGS="${$1_GCC6_CFLAGS}"
$1_WARNING_CFLAGS_JVM="-Wno-format-zero-length -Wtype-limits -Wuninitialized"
elif test "x$TOOLCHAIN_TYPE" = xclang; then
NO_DELETE_NULL_POINTER_CHECKS_CFLAG="-fno-delete-null-pointer-checks"
FLAGS_COMPILER_CHECK_ARGUMENTS(ARGUMENT: [$NO_DELETE_NULL_POINTER_CHECKS_CFLAG],
PREFIX: $3,
IF_FALSE: [
NO_DELETE_NULL_POINTER_CHECKS_CFLAG=
]
)
$1_TOOLCHAIN_CFLAGS="${NO_DELETE_NULL_POINTER_CHECKS_CFLAG}"
fi
if test "x$TOOLCHAIN_TYPE" = xmicrosoft; then
Expand Down Expand Up @@ -852,6 +843,17 @@ AC_DEFUN([FLAGS_SETUP_CFLAGS_CPU_DEP],
FILE_MACRO_CFLAGS=
]
)
if test "x$FILE_MACRO_CFLAGS" != x; then
# Add -pathmap for all VS system include paths using Windows
# full Long path name that is generated by the compiler
for ipath in ${$3SYSROOT_CFLAGS}; do
if test "x${ipath:0:2}" == "x-I"; then
ipath_path=${ipath#"-I"}
UTIL_FIXUP_WIN_LONG_PATH(ipath_path)
FILE_MACRO_CFLAGS="$FILE_MACRO_CFLAGS -pathmap:\"$ipath_path\"=vsi"
fi
done
fi
fi
AC_MSG_CHECKING([how to prevent absolute paths in output])
Expand Down Expand Up @@ -929,17 +931,12 @@ AC_DEFUN([FLAGS_SETUP_CFLAGS_CPU_DEP],
# $2 - Prefix for compiler variables (either BUILD_ or nothing).
AC_DEFUN([FLAGS_SETUP_GCC6_COMPILER_FLAGS],
[
# These flags are required for GCC 6 builds as undefined behavior in OpenJDK code
# runs afoul of the more aggressive versions of these optimizations.
# Notably, value range propagation now assumes that the this pointer of C++
# member functions is non-null.
NO_DELETE_NULL_POINTER_CHECKS_CFLAG="-fno-delete-null-pointer-checks"
FLAGS_COMPILER_CHECK_ARGUMENTS(ARGUMENT: [$NO_DELETE_NULL_POINTER_CHECKS_CFLAG],
PREFIX: $2, IF_FALSE: [NO_DELETE_NULL_POINTER_CHECKS_CFLAG=""])
# This flag is required for GCC 6 builds as undefined behavior in OpenJDK code
# runs afoul of the more aggressive versions of this optimization.
NO_LIFETIME_DSE_CFLAG="-fno-lifetime-dse"
FLAGS_COMPILER_CHECK_ARGUMENTS(ARGUMENT: [$NO_LIFETIME_DSE_CFLAG],
PREFIX: $2, IF_FALSE: [NO_LIFETIME_DSE_CFLAG=""])
$1_GCC6_CFLAGS="${NO_DELETE_NULL_POINTER_CHECKS_CFLAG} ${NO_LIFETIME_DSE_CFLAG}"
$1_GCC6_CFLAGS="${NO_LIFETIME_DSE_CFLAG}"
])

AC_DEFUN_ONCE([FLAGS_SETUP_BRANCH_PROTECTION],
Expand Down
17 changes: 17 additions & 0 deletions make/autoconf/util_paths.m4
Original file line number Diff line number Diff line change
Expand Up @@ -118,6 +118,23 @@ AC_DEFUN([UTIL_FIXUP_PATH],
fi
])

##############################################################################
# Fixup path to be a Windows full long path
AC_DEFUN([UTIL_FIXUP_WIN_LONG_PATH],
[
# Only process if variable expands to non-empty
path="[$]$1"
if test "x$path" != x; then
if test "x$OPENJDK_BUILD_OS" = "xwindows"; then
win_path=$($PATHTOOL -wl "$path")
if test "x$win_path" != "x$path"; then
$1="$win_path"
fi
fi
fi
])


###############################################################################
# Check if the given file is a unix-style or windows-style executable, that is,
# if it expects paths in unix-style or windows-style.
Expand Down
16 changes: 1 addition & 15 deletions src/java.base/share/classes/java/net/URLDecoder.java
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,6 @@

package java.net;

import jdk.internal.util.StaticProperty;

import java.io.*;
import java.nio.charset.Charset;
import java.nio.charset.IllegalCharsetNameException;
Expand Down Expand Up @@ -90,9 +88,6 @@ public class URLDecoder {
*/
private URLDecoder() {}

// The default charset
private static final String DEFAULT_ENCODING_NAME = StaticProperty.fileEncoding();

/**
* Decodes a {@code x-www-form-urlencoded} string.
* The default charset is used to determine what characters
Expand All @@ -106,16 +101,7 @@ private URLDecoder() {}
*/
@Deprecated
public static String decode(String s) {

String str = null;

try {
str = decode(s, DEFAULT_ENCODING_NAME);
} catch (UnsupportedEncodingException e) {
// The system should always have the default charset
}

return str;
return decode(s, Charset.defaultCharset());
}

/**
Expand Down
17 changes: 2 additions & 15 deletions src/java.base/share/classes/java/net/URLEncoder.java
Original file line number Diff line number Diff line change
Expand Up @@ -34,14 +34,13 @@
import java.nio.charset.CoderResult;
import java.nio.charset.CodingErrorAction;
import java.nio.charset.IllegalCharsetNameException;
import java.nio.charset.UnsupportedCharsetException ;
import java.nio.charset.UnsupportedCharsetException;
import java.util.BitSet;
import java.util.Objects;
import java.util.HexFormat;
import java.util.function.IntPredicate;

import jdk.internal.util.ImmutableBitSetPredicate;
import jdk.internal.util.StaticProperty;

/**
* Utility class for HTML form encoding. This class contains static methods
Expand Down Expand Up @@ -87,7 +86,6 @@
*/
public class URLEncoder {
private static final IntPredicate DONT_NEED_ENCODING;
private static final String DEFAULT_ENCODING_NAME;

static {

Expand Down Expand Up @@ -139,8 +137,6 @@ public class URLEncoder {
bitSet.set('*');

DONT_NEED_ENCODING = ImmutableBitSetPredicate.of(bitSet);

DEFAULT_ENCODING_NAME = StaticProperty.fileEncoding();
}

/**
Expand All @@ -161,16 +157,7 @@ private URLEncoder() { }
*/
@Deprecated
public static String encode(String s) {

String str = null;

try {
str = encode(s, DEFAULT_ENCODING_NAME);
} catch (UnsupportedEncodingException e) {
// The system should always have the default charset
}

return str;
return encode(s, Charset.defaultCharset());
}

/**
Expand Down
4 changes: 2 additions & 2 deletions src/java.base/share/classes/java/text/ListFormat.java
Original file line number Diff line number Diff line change
Expand Up @@ -353,8 +353,8 @@ public String format(List<String> input) {
* @return the string buffer passed in as {@code toAppendTo},
* with formatted text appended
* @throws NullPointerException if {@code obj} or {@code toAppendTo} is null
* @throws IllegalArgumentException if the given object cannot
* be formatted
* @throws IllegalArgumentException if {@code obj} is neither a {@code List}
* nor an array of {@code Object}s, or its length is zero.
*/
@Override
public StringBuffer format(Object obj, StringBuffer toAppendTo, FieldPosition pos) {
Expand Down
4 changes: 4 additions & 0 deletions src/java.base/share/classes/sun/security/pkcs/PKCS7.java
Original file line number Diff line number Diff line change
Expand Up @@ -152,6 +152,10 @@ private void parse(DerInputStream derin, boolean oldStyle)
ObjectIdentifier contentType = block.contentType;
DerValue content = block.getContent();

if (content == null) {
throw new ParsingException("content is null");
}

if (contentType.equals(ContentInfo.SIGNED_DATA_OID)) {
parseSignedData(content);
} else if (contentType.equals(ContentInfo.OLD_SIGNED_DATA_OID)) {
Expand Down
7 changes: 6 additions & 1 deletion src/java.rmi/share/native/librmi/GC.c
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 1998, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1998, 2023, 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
Expand All @@ -25,8 +25,13 @@

#include <jni.h>
#include <jvm.h>
#include "jni_util.h"
#include "sun_rmi_transport_GC.h"

/*
* Declare library specific JNI_Onload entry if static build
*/
DEF_STATIC_JNI_OnLoad

JNIEXPORT jlong JNICALL
Java_sun_rmi_transport_GC_maxObjectInspectionAge(JNIEnv *env, jclass cls)
Expand Down
3 changes: 3 additions & 0 deletions test/hotspot/jtreg/ProblemList-Xcomp.txt
Original file line number Diff line number Diff line change
Expand Up @@ -43,3 +43,6 @@ vmTestbase/vm/mlvm/indy/func/jvmti/mergeCP_indy2manySame_a/TestDescription.java
vmTestbase/vm/mlvm/indy/func/jvmti/redefineClassInTarget/TestDescription.java 8308367 windows-x64

vmTestbase/nsk/jvmti/scenarios/capability/CM03/cm03t001/TestDescription.java 8299493 macosx-x64

gc/arguments/TestNewSizeFlags.java 8299116 macosx-aarch64
compiler/interpreter/TestVerifyStackAfterDeopt.java 8316392 macosx-aarch64
2 changes: 2 additions & 0 deletions test/hotspot/jtreg/ProblemList.txt
Original file line number Diff line number Diff line change
Expand Up @@ -134,6 +134,8 @@ serviceability/sa/ClhsdbDumpclass.java 8316342 generic-all

serviceability/attach/ConcAttachTest.java 8290043 linux-all

serviceability/jvmti/stress/StackTrace/NotSuspended/GetStackTraceNotSuspendedStressTest.java 8315980 linux-all,windows-x64

#############################################################################

# :hotspot_misc
Expand Down
118 changes: 118 additions & 0 deletions test/hotspot/jtreg/compiler/vectorization/TestMaskedVectors.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,118 @@
/*
* Copyright (c) 2023, 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 8317121
* @summary Test masked vectors and unsafe access to memory modified by arraycopy
* @requires vm.compiler2.enabled
* @modules java.base/jdk.internal.misc
* @library /test/lib /
* @run main/othervm -XX:+IgnoreUnrecognizedVMOptions -XX:+UnlockDiagnosticVMOptions -XX:-TieredCompilation -Xbatch -XX:CompileCommand=quiet -XX:CompileCommand=compileonly,TestMaskedVectors::test* -XX:+StressLCM -XX:+StressGCM -XX:StressSeed=2210259638 TestMaskedVectors
* @run main/othervm -XX:+IgnoreUnrecognizedVMOptions -XX:+UnlockDiagnosticVMOptions -XX:-TieredCompilation -Xbatch -XX:CompileCommand=quiet -XX:CompileCommand=compileonly,TestMaskedVectors::test* -XX:+StressLCM -XX:+StressGCM TestMaskedVectors
*/

import java.lang.reflect.*;
import java.util.*;

import jdk.internal.misc.Unsafe;

public class TestMaskedVectors {

private static Unsafe UNSAFE = Unsafe.getUnsafe();
private static final long BASE_OFFSET = UNSAFE.arrayBaseOffset(byte[].class);

static void testLoadVectorMasked(byte[] src, byte[] dst, int len) {
byte[] tmp = new byte[64];

// (3) The LoadVectorMasked is found to be dependent on below arraycopy and
// therefore scheduled just below it. As a result, the LoadVectorMasked misses the
// updated elements at index 16..48 and dst will contain incorrect values.
System.arraycopy(src, 0, tmp, 0, 16);

// (2) The LoadVectorMasked is incorrectly found to be independent of this arraycopy
// because the LoadVectorMasked has offset 0 whereas the arraycopy writes offset >= 16.
// The problem is that MemNode::find_previous_store() -> LoadNode::find_previous_arraycopy()
// -> ArrayCopyNode::modifies does not account for the size of the load.
System.arraycopy(src, 0, tmp, 16, 48);

// (1) The following arraycopy is expanded into a LoadVectorMasked and a
// StoreVectorMasked in PhaseMacroExpand::generate_partial_inlining_block().
System.arraycopy(tmp, 0, dst, 0, len);
}

static long testUnsafeGetLong(byte[] src) {
byte[] tmp = new byte[16];

// (3) The unsafe load is found to be dependent on below arraycopy and
// therefore scheduled just below it. As a result, the unsafe load misses the
// updated elements at index 1..16 and therefore returns an incorrect result.
System.arraycopy(src, 0, tmp, 0, 16);

// (2) The unsafe load is incorrectly found to be independent of this arraycopy
// because the load has offset 0 in 'tmp' whereas the arraycopy writes offsets >= 1.
// The problem is that MemNode::find_previous_store() -> LoadNode::find_previous_arraycopy()
// -> ArrayCopyNode::modifies does not account for the size of the load.
System.arraycopy(src, 0, tmp, 1, 15);

// (1) Below unsafe load reads the first 8 (byte) array elements.
return UNSAFE.getLong(tmp, BASE_OFFSET);
}

public static void main(String[] args) {
// Initialize src array with increasing byte values
byte[] src = new byte[64];
for (byte i = 0; i < src.length; ++i) {
src[i] = (byte)i;
}

// Compute expected outputs once
byte[] golden1 = new byte[64];
testLoadVectorMasked(src, golden1, 64);

long golden2 = testUnsafeGetLong(src);

// Trigger compilation of test methods and verify the results
for (int i = 0; i < 50_000; ++i) {
int len = i % 32;
byte[] dst = new byte[len];
testLoadVectorMasked(src, dst, len);

boolean error = false;
for (int j = 0; j < dst.length; ++j) {
if (dst[j] != golden1[j]) {
System.out.println("Incorrect value of element " + j + ": Expected " + golden1[j] + " but got " + dst[j]);
error = true;
}
}
if (error) {
throw new RuntimeException("Test LoadVectorMasked failed");
}

long res = testUnsafeGetLong(src);
if (res != golden2) {
throw new RuntimeException("Incorrect result in test UnsafeGetLong: Expected " + golden2 + " but got " + res);
}
}
}
}
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2002, 2022, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2002, 2023, 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
Expand Down Expand Up @@ -152,7 +152,7 @@ private boolean checkCommands(String[] reply) {

// check 'threads', searching for "java.lang.Thread" followed by the main thread name.
v.add("java.lang.Thread");
if (System.getProperty("main.wrapper") != null) {
if (System.getProperty("test.thread.factory") != null) {
v.add(nsk.share.MainWrapper.OLD_MAIN_THREAD_NAME);
} else {
v.add("main");
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2002, 2022, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2002, 2023, 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
Expand Down Expand Up @@ -90,7 +90,7 @@ protected void runCases() {
int count;
Vector v;
String[] threads;
boolean vthreadMode = "Virtual".equals(System.getProperty("main.wrapper"));
boolean vthreadMode = "Virtual".equals(System.getProperty("test.thread.factory"));

if (!vthreadMode) {
// This test is only meant to be run in vthread mode.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2002, 2022, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2002, 2023, 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
Expand Down Expand Up @@ -186,7 +186,7 @@ private boolean checkCommands(String[] reply) {

// check 'threads', searching for "java.lang.Thread" followed by the main thread name.
v.add("java.lang.Thread");
if (System.getProperty("main.wrapper") != null) {
if (System.getProperty("test.thread.factory") != null) {
v.add(nsk.share.MainWrapper.OLD_MAIN_THREAD_NAME);
} else {
v.add("main");
Expand Down
Loading

0 comments on commit d0c7ea5

Please sign in to comment.