Skip to content

Commit

Permalink
Merge branch 'master' into 8342062
Browse files Browse the repository at this point in the history
  • Loading branch information
wangweij committed Jan 10, 2025
2 parents 4d5bb30 + 89ee1a5 commit 9ebaac9
Show file tree
Hide file tree
Showing 1,011 changed files with 23,334 additions and 17,855 deletions.
11 changes: 0 additions & 11 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -325,17 +325,6 @@ jobs:
bootjdk-platform: linux-x64
runs-on: ubuntu-22.04

test-macos-x64:
name: macos-x64
needs:
- build-macos-x64
uses: ./.github/workflows/test.yml
with:
platform: macos-x64
bootjdk-platform: macos-x64
runs-on: macos-13
xcode-toolset-version: '14.3.1'

test-macos-aarch64:
name: macos-aarch64
needs:
Expand Down
7 changes: 6 additions & 1 deletion .jcheck/conf
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ jbs=JDK
version=25

[checks]
error=author,committer,reviewers,merge,issues,executable,symlink,message,hg-tag,whitespace,problemlists
error=author,committer,reviewers,merge,issues,executable,symlink,message,hg-tag,whitespace,problemlists,copyright
warning=issuestitle,binary

[repository]
Expand Down Expand Up @@ -34,3 +34,8 @@ pattern=^([124-8][0-9]{6}): (\S.*)$

[checks "problemlists"]
dirs=test/jdk|test/langtools|test/lib-test|test/hotspot/jtreg|test/jaxp

[checks "copyright"]
files=^(?!LICENSE|license\.txt|.*\.bin|.*\.gif|.*\.jpg|.*\.png|.*\.icon|.*\.tiff|.*\.dat|.*\.patch|.*\.wav|.*\.class|.*-header|.*\.jar|).*
oracle_locator=.*Copyright \(c\)(.*)Oracle and/or its affiliates\. All rights reserved\.
oracle_validator=.*Copyright \(c\) (\d{4})(?:, (\d{4}))?, Oracle and/or its affiliates\. All rights reserved\.
2 changes: 1 addition & 1 deletion doc/hotspot-unit-tests.html
Original file line number Diff line number Diff line change
Expand Up @@ -245,7 +245,7 @@ <h3 id="error-messages">Error messages</h3>
<p>All GoogleTest asserts print compared expressions and their values,
so there is no need to have them in error messages. Asserts print only
compared values, they do not print any of interim variables, e.g.
<code>ASSERT_TRUE((val1 == val2 &amp;&amp; isFail(foo(8)) || i == 18)</code>
<code>ASSERT_TRUE((val1 == val2 &amp;&amp; isFail(foo(8))) || i == 18)</code>
prints only one value. If you use some complex predicates, please
consider <code>EXPECT_PRED*</code> or <code>EXPECT_FORMAT_PRED</code>
assertions family, they check that a predicate returns true/success and
Expand Down
2 changes: 1 addition & 1 deletion doc/hotspot-unit-tests.md
Original file line number Diff line number Diff line change
Expand Up @@ -172,7 +172,7 @@ Provide informative, but not too verbose error messages.
All GoogleTest asserts print compared expressions and their values, so
there is no need to have them in error messages. Asserts print only
compared values, they do not print any of interim variables, e.g.
`ASSERT_TRUE((val1 == val2 && isFail(foo(8)) || i == 18)` prints only
`ASSERT_TRUE((val1 == val2 && isFail(foo(8))) || i == 18)` prints only
one value. If you use some complex predicates, please consider
`EXPECT_PRED*` or `EXPECT_FORMAT_PRED` assertions family, they check that
a predicate returns true/success and print out all parameters values.
Expand Down
5 changes: 4 additions & 1 deletion make/Main.gmk
Original file line number Diff line number Diff line change
Expand Up @@ -1310,7 +1310,10 @@ endif
################################################################################

# all-images builds all our deliverables as images.
all-images: product-images static-jdk-image test-image all-docs-images
all-images: product-images test-image all-docs-images
ifeq ($(call isTargetOs, linux macosx windows), true)
all-images: static-jdk-image
endif

# all-bundles packages all our deliverables as tar.gz bundles.
all-bundles: product-bundles test-bundles docs-bundles static-libs-bundles
Expand Down
39 changes: 20 additions & 19 deletions make/autoconf/flags-cflags.m4
Original file line number Diff line number Diff line change
Expand Up @@ -237,7 +237,7 @@ AC_DEFUN([FLAGS_SETUP_WARNINGS],
# Additional warnings that are not activated by -Wall and -Wextra
WARNINGS_ENABLE_ADDITIONAL="-Wpointer-arith -Wreturn-type -Wsign-compare \
-Wtrampolines -Wundef -Wunused-const-variable=1 -Wunused-function \
-Wunused-result -Wunused-value"
-Wunused-result -Wunused-value -Wtype-limits -Wuninitialized"
WARNINGS_ENABLE_ADDITIONAL_CXX="-Woverloaded-virtual -Wreorder"
WARNINGS_ENABLE_ALL_CFLAGS="-Wall -Wextra -Wformat=2 $WARNINGS_ENABLE_ADDITIONAL"
WARNINGS_ENABLE_ALL_CXXFLAGS="$WARNINGS_ENABLE_ALL_CFLAGS $WARNINGS_ENABLE_ADDITIONAL_CXX"
Expand Down Expand Up @@ -754,10 +754,9 @@ AC_DEFUN([FLAGS_SETUP_CFLAGS_CPU_DEP],
fi
if test "x$TOOLCHAIN_TYPE" = xgcc; then
FLAGS_SETUP_GCC6_COMPILER_FLAGS($1, $3)
$1_TOOLCHAIN_CFLAGS="${$1_GCC6_CFLAGS}"
$1_WARNING_CFLAGS_JVM="-Wno-format-zero-length -Wtype-limits -Wuninitialized"
# This flag is required since GCC 6 as undefined behavior in OpenJDK code
# runs afoul of the more aggressive versions of this optimization.
$1_TOOLCHAIN_CFLAGS="-fno-lifetime-dse"
fi
if test "x$TOOLCHAIN_TYPE" = xmicrosoft; then
Expand Down Expand Up @@ -831,6 +830,22 @@ AC_DEFUN([FLAGS_SETUP_CFLAGS_CPU_DEP],
FLAGS_SETUP_BRANCH_PROTECTION
if test "x$FLAGS_CPU" = xriscv64; then
AC_MSG_CHECKING([if RVV/vector sigcontext supported])
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([#include <linux/ptrace.h>],
[
return (int)sizeof(struct __riscv_v_ext_state);
])],
[
AC_MSG_RESULT([yes])
],
[
$1_DEFINES_CPU_JVM="${$1_DEFINES_CPU_JVM} -DNO_RVV_SIGCONTEXT"
AC_MSG_RESULT([no])
]
)
fi
# EXPORT to API
CFLAGS_JVM_COMMON="$ALWAYS_CFLAGS_JVM $ALWAYS_DEFINES_JVM \
$TOOLCHAIN_CFLAGS_JVM ${$1_TOOLCHAIN_CFLAGS_JVM} \
Expand Down Expand Up @@ -919,20 +934,6 @@ AC_DEFUN([FLAGS_SETUP_CFLAGS_CPU_DEP],
AC_SUBST($2SVE_CFLAGS)
])

# FLAGS_SETUP_GCC6_COMPILER_FLAGS([PREFIX])
# Arguments:
# $1 - Prefix for each variable defined.
# $2 - Prefix for compiler variables (either BUILD_ or nothing).
AC_DEFUN([FLAGS_SETUP_GCC6_COMPILER_FLAGS],
[
# 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_LIFETIME_DSE_CFLAG}"
])

AC_DEFUN_ONCE([FLAGS_SETUP_BRANCH_PROTECTION],
[
# Is branch protection available?
Expand Down
2 changes: 1 addition & 1 deletion make/conf/jib-profiles.js
Original file line number Diff line number Diff line change
Expand Up @@ -780,7 +780,7 @@ var getJibProfilesProfiles = function (input, common, data) {
target_os: input.build_os,
target_cpu: input.build_cpu,
dependencies: [
"boot_jdk", "devkit", "graphviz", "pandoc", buildJdkDep,
"autoconf", "boot_jdk", "devkit", "graphviz", "pandoc", buildJdkDep,
],
configure_args: concat(
"--enable-full-docs",
Expand Down
2 changes: 1 addition & 1 deletion make/hotspot/lib/CompileJvm.gmk
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ CFLAGS_VM_VERSION := \
# Disabled warnings

DISABLED_WARNINGS_gcc := array-bounds comment delete-non-virtual-dtor \
empty-body implicit-fallthrough int-in-bool-context \
empty-body format-zero-length implicit-fallthrough int-in-bool-context \
maybe-uninitialized missing-field-initializers \
shift-negative-value unknown-pragmas unused-but-set-variable \
unused-local-typedefs unused-variable
Expand Down
4 changes: 2 additions & 2 deletions make/jdk/src/classes/build/tools/depend/Depend.java
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2017, 2023, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2017, 2024, 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 @@ -446,7 +446,7 @@ public Void visitType(TypeElement e, Void p) {
}

@Override
public Void visitRecordComponent(@SuppressWarnings("preview")RecordComponentElement e, Void p) {
public Void visitRecordComponent(RecordComponentElement e, Void p) {
update(e.getSimpleName());
visit(e.asType());
return null;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -228,7 +228,6 @@ public class CreateSymbols {
/**Create sig files for ct.sym reading the classes description from the directory that contains
* {@code ctDescriptionFile}, using the file as a recipe to create the sigfiles.
*/
@SuppressWarnings("unchecked")
public void createSymbols(String ctDescriptionFileExtra, String ctDescriptionFile, String ctSymLocation,
long timestamp, String currentVersion, String preReleaseTag, String moduleClasses,
String includedModulesFile) throws IOException {
Expand Down Expand Up @@ -4634,7 +4633,6 @@ private static AnnotationDescription parseAnnotation(String value, int[] valuePo
/**Create sig files for ct.sym reading the classes description from the directory that contains
* {@code ctDescriptionFile}, using the file as a recipe to create the sigfiles.
*/
@SuppressWarnings("unchecked")
public void createJavadocData(String ctDescriptionFileExtra, String ctDescriptionFile,
String targetDir, int startVersion) throws IOException {
LoadDescriptions data = load(ctDescriptionFileExtra != null ? Paths.get(ctDescriptionFileExtra)
Expand Down
71 changes: 55 additions & 16 deletions make/langtools/tools/propertiesparser/gen/ClassGenerator.java
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@
import java.util.Collections;
import java.util.List;
import java.util.Map;
import java.util.Map.Entry;
import java.util.Properties;
import java.util.Set;
import java.util.TreeMap;
Expand Down Expand Up @@ -87,9 +88,12 @@ enum StubKind {
FACTORY_METHOD_DECL("factory.decl.method"),
FACTORY_METHOD_ARG("factory.decl.method.arg"),
FACTORY_METHOD_BODY("factory.decl.method.body"),
FACTORY_METHOD_BODY_LINT("factory.decl.method.body.lint"),
FACTORY_FIELD("factory.decl.field"),
FACTORY_FIELD_LINT("factory.decl.field.lint"),
WILDCARDS_EXTENDS("wildcards.extends"),
SUPPRESS_WARNINGS("suppress.warnings");
SUPPRESS_WARNINGS("suppress.warnings"),
LINT_CATEGORY("lint.category");

/** stub key (as it appears in the property file) */
String key;
Expand All @@ -114,6 +118,7 @@ String format(Object... args) {
enum FactoryKind {
ERR("err", "Error", "Errors"),
WARN("warn", "Warning", "Warnings"),
LINT_WARN("warn", "LintWarning", "LintWarnings"),
NOTE("note", "Note", "Notes"),
MISC("misc", "Fragment", "Fragments"),
OTHER(null, null, null);
Expand All @@ -136,13 +141,24 @@ enum FactoryKind {
/**
* Utility method for parsing a factory kind from a resource key prefix.
*/
static FactoryKind parseFrom(String prefix) {
static FactoryKind of(Entry<String, Message> messageEntry) {
String prefix = messageEntry.getKey().split("\\.")[1];
FactoryKind selected = null;
for (FactoryKind k : FactoryKind.values()) {
if (k.prefix == null || k.prefix.equals(prefix)) {
return k;
selected = k;
break;
}
}
return null;
if (selected == WARN) {
for (MessageLine line : messageEntry.getValue().getLines(false)) {
if (line.isLint()) {
selected = LINT_WARN;
break;
}
}
}
return selected;
}
}

Expand All @@ -155,7 +171,7 @@ public void generateFactory(MessageFile messageFile, File outDir) {
messageFile.messages.entrySet().stream()
.collect(
Collectors.groupingBy(
e -> FactoryKind.parseFrom(e.getKey().split("\\.")[1]),
FactoryKind::of,
TreeMap::new,
toList()));
//generate nested classes
Expand All @@ -165,7 +181,7 @@ public void generateFactory(MessageFile messageFile, File outDir) {
if (entry.getKey() == FactoryKind.OTHER) continue;
//emit members
String members = entry.getValue().stream()
.flatMap(e -> generateFactoryMethodsAndFields(e.getKey(), e.getValue()).stream())
.flatMap(e -> generateFactoryMethodsAndFields(entry.getKey(), e.getKey(), e.getValue()).stream())
.collect(Collectors.joining("\n\n"));
//emit nested class
String factoryDecl =
Expand Down Expand Up @@ -230,22 +246,35 @@ List<String> generateImports(Set<String> importedTypes) {
/**
* Generate a list of factory methods/fields to be added to a given factory nested class.
*/
List<String> generateFactoryMethodsAndFields(String key, Message msg) {
List<String> generateFactoryMethodsAndFields(FactoryKind k, String key, Message msg) {
MessageInfo msgInfo = msg.getMessageInfo();
List<MessageLine> lines = msg.getLines(false);
String javadoc = lines.stream()
.filter(ml -> !ml.isInfo() && !ml.isEmptyOrComment())
.map(ml -> ml.text)
.collect(Collectors.joining("\n *"));
String[] keyParts = key.split("\\.");
FactoryKind k = FactoryKind.parseFrom(keyParts[1]);
String lintCategory = lines.stream()
.filter(MessageLine::isLint)
.map(MessageLine::lintCategory)
.findFirst().orElse(null);
//System.out.println("category for " + key + " = " + lintCategory);
String factoryName = factoryName(key);
if (msgInfo.getTypes().isEmpty()) {
//generate field
String factoryField = StubKind.FACTORY_FIELD.format(k.keyClazz, factoryName,
"\"" + keyParts[0] + "\"",
"\"" + Stream.of(keyParts).skip(2).collect(Collectors.joining(".")) + "\"",
javadoc);
String factoryField;
if (lintCategory == null) {
factoryField = StubKind.FACTORY_FIELD.format(k.keyClazz, factoryName,
"\"" + keyParts[0] + "\"",
"\"" + Stream.of(keyParts).skip(2).collect(Collectors.joining(".")) + "\"",
javadoc);
} else {
factoryField = StubKind.FACTORY_FIELD_LINT.format(k.keyClazz, factoryName,
StubKind.LINT_CATEGORY.format("\"" + lintCategory + "\""),
"\"" + keyParts[0] + "\"",
"\"" + Stream.of(keyParts).skip(2).collect(Collectors.joining(".")) + "\"",
javadoc);
}
return Collections.singletonList(factoryField);
} else {
//generate method
Expand All @@ -255,12 +284,22 @@ List<String> generateFactoryMethodsAndFields(String key, Message msg) {
List<String> argNames = argNames(types.size());
String suppressionString = needsSuppressWarnings(msgTypes) ?
StubKind.SUPPRESS_WARNINGS.format() : "";
String methodBody;
if (lintCategory == null) {
methodBody = StubKind.FACTORY_METHOD_BODY.format(k.keyClazz,
"\"" + keyParts[0] + "\"",
"\"" + Stream.of(keyParts).skip(2).collect(Collectors.joining(".")) + "\"",
argNames.stream().collect(Collectors.joining(", ")));
} else {
methodBody = StubKind.FACTORY_METHOD_BODY_LINT.format(k.keyClazz,
StubKind.LINT_CATEGORY.format("\"" + lintCategory + "\""),
"\"" + keyParts[0] + "\"",
"\"" + Stream.of(keyParts).skip(2).collect(Collectors.joining(".")) + "\"",
argNames.stream().collect(Collectors.joining(", ")));
}
String factoryMethod = StubKind.FACTORY_METHOD_DECL.format(suppressionString, k.keyClazz,
factoryName, argDecls(types, argNames).stream().collect(Collectors.joining(", ")),
indent(StubKind.FACTORY_METHOD_BODY.format(k.keyClazz,
"\"" + keyParts[0] + "\"",
"\"" + Stream.of(keyParts).skip(2).collect(Collectors.joining(".")) + "\"",
argNames.stream().collect(Collectors.joining(", "))), 1),
indent(methodBody, 1),
javadoc);
factoryMethods.add(factoryMethod);
}
Expand Down
5 changes: 4 additions & 1 deletion make/langtools/tools/propertiesparser/parser/Message.java
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,9 @@ public final class Message {
public MessageInfo getMessageInfo() {
if (messageInfo == null) {
MessageLine l = firstLine.prev;
if (l != null && l.isLint()) {
l = l.prev;
}
if (l != null && l.isInfo())
messageInfo = new MessageInfo(l.text);
else
Expand All @@ -71,7 +74,7 @@ public List<MessageLine> getLines(boolean includeAllPrecedingComments) {
while (l.text.isEmpty())
l = l.next;
} else {
if (l.prev != null && l.prev.isInfo())
if (l.prev != null && (l.prev.isInfo() || l.prev.isLint()))
l = l.prev;
}

Expand Down
15 changes: 15 additions & 0 deletions make/langtools/tools/propertiesparser/parser/MessageLine.java
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@

package propertiesparser.parser;

import java.util.regex.Matcher;
import java.util.regex.Pattern;

/**
Expand All @@ -37,6 +38,7 @@ public class MessageLine {
static final Pattern typePattern = Pattern.compile("[-\\\\'A-Z\\.a-z ]+( \\([-A-Za-z 0-9]+\\))?");
static final Pattern infoPattern = Pattern.compile(String.format("# ([0-9]+: %s, )*[0-9]+: %s",
typePattern.pattern(), typePattern.pattern()));
static final Pattern lintPattern = Pattern.compile("# lint: ([a-z\\-]+)");

public String text;
MessageLine prev;
Expand All @@ -54,6 +56,19 @@ public boolean isInfo() {
return infoPattern.matcher(text).matches();
}

public boolean isLint() {
return lintPattern.matcher(text).matches();
}

public String lintCategory() {
Matcher matcher = lintPattern.matcher(text);
if (matcher.matches()) {
return matcher.group(1);
} else {
return null;
}
}

boolean hasContinuation() {
return (next != null) && text.endsWith("\\");
}
Expand Down
Loading

0 comments on commit 9ebaac9

Please sign in to comment.