Skip to content

Commit

Permalink
Merge upstream-jdk
Browse files Browse the repository at this point in the history
  • Loading branch information
corretto-github-robot committed Sep 21, 2023
2 parents 1142882 + 1749ba2 commit 68f1174
Show file tree
Hide file tree
Showing 94 changed files with 3,840 additions and 1,138 deletions.
9 changes: 5 additions & 4 deletions make/RunTests.gmk
Original file line number Diff line number Diff line change
Expand Up @@ -862,8 +862,9 @@ define SetupRunJtregTestBody

$$(eval $$(call SetupRunJtregTestCustom, $1))

clean-workdir-$1:
clean-outputdirs-$1:
$$(RM) -r $$($1_TEST_SUPPORT_DIR)
$$(RM) -r $$($1_TEST_RESULTS_DIR)

$1_COMMAND_LINE := \
$$(JAVA) $$($1_JTREG_LAUNCHER_OPTIONS) \
Expand Down Expand Up @@ -909,7 +910,7 @@ define SetupRunJtregTestBody
done
endif

run-test-$1: pre-run-test clean-workdir-$1
run-test-$1: pre-run-test clean-outputdirs-$1
$$(call LogWarn)
$$(call LogWarn, Running test '$$($1_TEST)')
$$(call MakeDir, $$($1_TEST_RESULTS_DIR) $$($1_TEST_SUPPORT_DIR) \
Expand Down Expand Up @@ -946,9 +947,9 @@ define SetupRunJtregTestBody
$$(eval $1_TOTAL := 1) \
)

$1: run-test-$1 parse-test-$1 clean-workdir-$1
$1: run-test-$1 parse-test-$1 clean-outputdirs-$1

TARGETS += $1 run-test-$1 parse-test-$1 clean-workdir-$1
TARGETS += $1 run-test-$1 parse-test-$1 clean-outputdirs-$1
TEST_TARGETS += parse-test-$1

endef
Expand Down
4 changes: 2 additions & 2 deletions make/ToolsJdk.gmk
Original file line number Diff line number Diff line change
Expand Up @@ -76,8 +76,8 @@ TOOL_GENERATECACERTS = $(JAVA_SMALL) -cp $(BUILDTOOLS_OUTPUTDIR)/jdk_tools_class
-Dkeystore.pkcs12.macAlgorithm=NONE \
build.tools.generatecacerts.GenerateCacerts

TOOL_GENERATEEMOJIDATA = $(JAVA_SMALL) -cp $(BUILDTOOLS_OUTPUTDIR)/jdk_tools_classes \
build.tools.generateemojidata.GenerateEmojiData
TOOL_GENERATEEXTRAPROPERTIES = $(JAVA_SMALL) -cp $(BUILDTOOLS_OUTPUTDIR)/jdk_tools_classes \
build.tools.generateextraproperties.GenerateExtraProperties

TOOL_MAKEZIPREPRODUCIBLE = $(JAVA_SMALL) -cp $(BUILDTOOLS_OUTPUTDIR)/jdk_tools_classes \
build.tools.makezipreproducible.MakeZipReproducible
Expand Down
2 changes: 1 addition & 1 deletion make/autoconf/basic.m4
Original file line number Diff line number Diff line change
Expand Up @@ -479,7 +479,7 @@ AC_DEFUN([BASIC_CHECK_DIR_ON_LOCAL_DISK],
# df on AIX does not understand -l. On modern AIXes it understands "-T local" which
# is the same. On older AIXes we just continue to live with a "not local build" warning.
if test "x$OPENJDK_TARGET_OS" = xaix; then
if "$DF -T local > /dev/null 2>&1"; then
if $DF -T local > /dev/null 2>&1; then
DF_LOCAL_ONLY_OPTION='-T local'
else # AIX may use GNU-utils instead
DF_LOCAL_ONLY_OPTION='-l'
Expand Down
1 change: 1 addition & 0 deletions make/autoconf/flags-cflags.m4
Original file line number Diff line number Diff line change
Expand Up @@ -818,6 +818,7 @@ AC_DEFUN([FLAGS_SETUP_CFLAGS_CPU_DEP],
REPRODUCIBLE_CFLAGS=
]
)
AC_SUBST(REPRODUCIBLE_CFLAGS)
fi
# Prevent the __FILE__ macro from generating absolute paths into the built
Expand Down
1 change: 1 addition & 0 deletions make/autoconf/spec.gmk.in
Original file line number Diff line number Diff line change
Expand Up @@ -424,6 +424,7 @@ LIBFFI_CFLAGS:=@LIBFFI_CFLAGS@
ENABLE_LIBFFI_BUNDLING:=@ENABLE_LIBFFI_BUNDLING@
LIBFFI_LIB_FILE:=@LIBFFI_LIB_FILE@
FILE_MACRO_CFLAGS := @FILE_MACRO_CFLAGS@
REPRODUCIBLE_CFLAGS := @REPRODUCIBLE_CFLAGS@
BRANCH_PROTECTION_CFLAGS := @BRANCH_PROTECTION_CFLAGS@

STATIC_LIBS_CFLAGS := @STATIC_LIBS_CFLAGS@
Expand Down
2 changes: 1 addition & 1 deletion make/hotspot/gensrc/GensrcAdlc.gmk
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ ifeq ($(call check-jvm-feature, compiler2), true)
ADLC_CFLAGS += -I$(TOPDIR)/src/hotspot/share

# Add file macro mappings
ADLC_CFLAGS += $(FILE_MACRO_CFLAGS)
ADLC_CFLAGS += $(FILE_MACRO_CFLAGS) $(REPRODUCIBLE_CFLAGS)

ifeq ($(UBSAN_ENABLED), true)
ADLC_CFLAGS += $(UBSAN_CFLAGS)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ private PropList(File file, int plane) throws IOException {

int i, j;
BufferedReader sbfr = new BufferedReader(new FileReader(file));
Matcher m = Pattern.compile("(\\p{XDigit}+)(?:\\.{2}(\\p{XDigit}+))?\\s*;\\s+(\\w+)\\s+#.*").matcher("");
Matcher m = Pattern.compile("(\\p{XDigit}+)(?:\\.{2}(\\p{XDigit}+))?\\s*;\\s+(\\w+)[;\\s].*").matcher("");
String line = null;
int lineNo = 0;
while ((line = sbfr.readLine()) != null) {
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,169 @@
/*
* 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. Oracle designates this
* particular file as subject to the "Classpath" exception as provided
* by Oracle in the LICENSE file that accompanied this code.
*
* 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 build.tools.generateextraproperties;

import java.io.IOException;
import java.nio.file.Files;
import java.nio.file.Paths;
import java.nio.file.StandardOpenOption;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.HashMap;
import java.util.List;
import java.util.function.Predicate;
import java.util.stream.Collectors;
import java.util.stream.Stream;

/**
* Parses extra properties files of UCD, and replaces the placeholders in
* the given template source file with the generated conditions, then emits
* .java files. For example, if the properties file has:
* <blockquote>
* 0009..000D ; Type (; Value)
* 0020 ; Type (; Value)
* 2000..200A ; Type (; Value)
* </blockquote>
* and the template file contains
* <blockquote>
* %%%Type(=Value)%%%
* </blockquote>
* then the generated .java file would have the following in place:
* <blockquote>
* (cp >= 0x0009 && cp <= 0x000D) ||
* cp == 0x0020 ||
* (cp >= 0x2000 && cp <= 0x200A);
* </blockquote>
* Note that those in parentheses in the properties file and the
* template file are optional.
*
* Arguments to this utility:
* args[0]: Full path string to the template file
* args[1]: Full path string to the properties file
* args[2]: Full path string to the generated .java file
* args[3...]: Names of the property to generate the conditions
*/
public class GenerateExtraProperties {
public static void main(String[] args) {
var templateFile = Paths.get(args[0]);
var propertiesFile = Paths.get(args[1]);
var gensrcFile = Paths.get(args[2]);
var propertyNames = Arrays.copyOfRange(args, 3, args.length);
var replacementMap = new HashMap<String, String>();

try {
for (var propertyName: propertyNames) {
var pn = "; " + propertyName.replaceFirst("=", "; ");

List<Range> ranges = Files.lines(propertiesFile)
.filter(Predicate.not(l -> l.startsWith("#") || l.isBlank()))
.filter(l -> l.contains(pn))
.map(l -> new Range(l.replaceFirst(" .*", "")))
.sorted()
.collect(ArrayList<Range>::new,
(list, r) -> {
// collapsing consecutive pictographic ranges
int lastIndex = list.size() - 1;
if (lastIndex >= 0) {
Range lastRange = list.get(lastIndex);
if (lastRange.last + 1 == r.start) {
list.set(lastIndex, new Range(lastRange.start, r.last));
return;
}
}
list.add(r);
},
ArrayList<Range>::addAll);


replacementMap.put("%%%" + propertyName + "%%%",
ranges.stream()
.map(GenerateExtraProperties::rangeToString)
.collect(Collectors.joining(" ||\n", "", ";")));
}

// Generate .java file
Files.write(gensrcFile,
Files.lines(templateFile)
.flatMap(l -> Stream.of(replacementMap.getOrDefault(l.trim(), l)))
.collect(Collectors.toList()),
StandardOpenOption.CREATE, StandardOpenOption.TRUNCATE_EXISTING);
} catch (IOException e) {
e.printStackTrace();
}
}

static String rangeToString(Range r) {
if (r.start == r.last) {
return (" ".repeat(12) + "cp == 0x" + toHexString(r.start));
} else if (r.start == r.last - 1) {
return " ".repeat(12) + "cp == 0x" + toHexString(r.start) + " ||\n" +
" ".repeat(12) + "cp == 0x" + toHexString(r.last);
} else {
return " ".repeat(11) + "(cp >= 0x" + toHexString(r.start) +
" && cp <= 0x" + toHexString(r.last) + ")";
}
}

static int toInt(String hexStr) {
return Integer.parseUnsignedInt(hexStr, 16);
}

static String toHexString(int cp) {
String ret = Integer.toUnsignedString(cp, 16).toUpperCase();
if (ret.length() < 4) {
ret = "0".repeat(4 - ret.length()) + ret;
}
return ret;
}

static class Range implements Comparable<Range> {
int start;
int last;

Range (int start, int last) {
this.start = start;
this.last = last;
}

Range (String input) {
input = input.replaceFirst("\\s#.*", "");
start = toInt(input.replaceFirst("[\\s\\.].*", ""));
last = input.contains("..") ?
toInt(input.replaceFirst(".*\\.\\.", "")
.replaceFirst(";.*", "").trim())
: start;
}

@Override
public String toString() {
return "Start: " + toHexString(start) + ", Last: " + toHexString(last);
}

@Override
public int compareTo(Range other) {
return Integer.compare(start, other.start);
}
}
}
1 change: 1 addition & 0 deletions make/modules/java.base/Gensrc.gmk
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ include gensrc/GensrcExceptions.gmk
include gensrc/GensrcVarHandles.gmk
include gensrc/GensrcModuleLoaderMap.gmk
include gensrc/GensrcScopedMemoryAccess.gmk
include gensrc/GensrcRegex.gmk

# GensrcLocaleData.gmk does not set TARGETS, so we must choose which targets
# to include.
Expand Down
46 changes: 46 additions & 0 deletions make/modules/java.base/gensrc/GensrcRegex.gmk
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
#
# 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. Oracle designates this
# particular file as subject to the "Classpath" exception as provided
# by Oracle in the LICENSE file that accompanied this code.
#
# 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.
#

#
# Rules to create java files under
# $(SUPPORT_OUTPUTDIR)/gensrc/java.base/jdk/internal/util/regex/
#

GENSRC_INDICCONJUNCTBREAK := $(SUPPORT_OUTPUTDIR)/gensrc/java.base/jdk/internal/util/regex/IndicConjunctBreak.java

INDICCONJUNCTBREAKTEMP := $(MODULE_SRC)/share/classes/jdk/internal/util/regex/IndicConjunctBreak.java.template
INDICCONJUNCTBREAKPROPS := $(MODULE_SRC)/share/data/unicodedata/DerivedCoreProperties.txt
INDICCONJUNCTBREAKPARAMS := InCB=Linker InCB=Extend InCB=Consonant

$(GENSRC_INDICCONJUNCTBREAK): $(BUILD_TOOLS_JDK) $(INDICCONJUNCTBREAKTEMP) $(INDICCONJUNCTBREAKPROPS)
$(call LogInfo, Generating $@)
$(call MakeTargetDir)
$(TOOL_GENERATEEXTRAPROPERTIES) \
$(INDICCONJUNCTBREAKTEMP) \
$(INDICCONJUNCTBREAKPROPS) \
$(GENSRC_INDICCONJUNCTBREAK) \
$(INDICCONJUNCTBREAKPARAMS)

TARGETS += $(GENSRC_INDICCONJUNCTBREAK)
9 changes: 5 additions & 4 deletions make/test/BuildMicrobenchmark.gmk
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#
# Copyright (c) 2018, 2022, Oracle and/or its affiliates. All rights reserved.
# Copyright (c) 2018, 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 @@ -105,6 +105,7 @@ $(eval $(call SetupJavaCompilation, BUILD_JDK_MICROBENCHMARK, \
--add-exports java.base/jdk.internal.org.objectweb.asm=ALL-UNNAMED \
--add-exports java.base/jdk.internal.org.objectweb.asm.tree=ALL-UNNAMED \
--add-exports java.base/jdk.internal.vm=ALL-UNNAMED \
--add-exports java.base/jdk.internal.event=ALL-UNNAMED \
--enable-preview, \
JAVA_FLAGS := --add-modules jdk.unsupported --limit-modules java.management \
--add-exports java.base/jdk.internal.vm=ALL-UNNAMED \
Expand Down Expand Up @@ -155,10 +156,10 @@ $(eval $(call SetupTestFilesCompilation, BUILD_MICROBENCHMARK_LIBRARIES, \

# Setup copy of native dependencies to image output dir
$(eval $(call SetupCopyFiles, COPY_MICROBENCHMARK_NATIVE, \
SRC := $(MICROBENCHMARK_NATIVE_OUTPUT), \
SRC := $(MICROBENCHMARK_NATIVE_OUTPUT)/lib, \
DEST := $(MICROBENCHMARK_IMAGE_DIR)/native, \
FILES := $(BUILD_MICROBENCHMARK_LIBRARIES), \
FLATTEN := true, \
FILES := $(filter $(MICROBENCHMARK_NATIVE_OUTPUT)/lib/%, \
$(BUILD_MICROBENCHMARK_LIBRARIES)), \
))

all: $(MICROBENCHMARK_JAR) $(BUILD_MICROBENCHMARK_LIBRARIES) $(COPY_MICROBENCHMARK_NATIVE)
Expand Down
9 changes: 8 additions & 1 deletion src/hotspot/share/gc/shared/c2/barrierSetC2.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -675,8 +675,15 @@ void BarrierSetC2::clone(GraphKit* kit, Node* src_base, Node* dst_base, Node* si
Node* payload_size = size;
Node* offset = kit->MakeConX(base_off);
payload_size = kit->gvn().transform(new SubXNode(payload_size, offset));
if (is_array) {
// Ensure the array payload size is rounded up to the next BytesPerLong
// multiple when converting to double-words. This is necessary because array
// size does not include object alignment padding, so it might not be a
// multiple of BytesPerLong for sub-long element types.
payload_size = kit->gvn().transform(new AddXNode(payload_size, kit->MakeConX(BytesPerLong - 1)));
}
payload_size = kit->gvn().transform(new URShiftXNode(payload_size, kit->intcon(LogBytesPerLong)));
ArrayCopyNode* ac = ArrayCopyNode::make(kit, false, src_base, offset, dst_base, offset, payload_size, true, false);
ArrayCopyNode* ac = ArrayCopyNode::make(kit, false, src_base, offset, dst_base, offset, payload_size, true, false);
if (is_array) {
ac->set_clone_array();
} else {
Expand Down
Loading

0 comments on commit 68f1174

Please sign in to comment.