Skip to content

Commit

Permalink
Merge branch 'master' into JDK-8334714-final
Browse files Browse the repository at this point in the history
  • Loading branch information
asotona authored Jul 17, 2024
2 parents 56c8573 + b9b0b85 commit e5f9646
Show file tree
Hide file tree
Showing 1,044 changed files with 22,823 additions and 10,588 deletions.
2 changes: 1 addition & 1 deletion .jcheck/conf
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ version=24

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

[repository]
tags=(?:jdk-(?:[1-9]([0-9]*)(?:\.(?:0|[1-9][0-9]*)){0,4})(?:\+(?:(?:[0-9]+))|(?:-ga)))|(?:jdk[4-9](?:u\d{1,3})?-(?:(?:b\d{2,3})|(?:ga)))|(?:hs\d\d(?:\.\d{1,2})?-b\d\d)
Expand Down
11 changes: 6 additions & 5 deletions doc/ide.html
Original file line number Diff line number Diff line change
Expand Up @@ -63,11 +63,12 @@ <h5 id="alternative-indexers">Alternative indexers</h5>
<p>The main <code>vscode-project</code> target configures the default
C++ support in Visual Studio Code. There are also other source indexers
that can be installed, that may provide additional features. It's
currently possible to generate configuration for two such indexers, <a
href="https://clang.llvm.org/extra/clangd/">clangd</a> and <a
href="https://github.com/Andersbakken/rtags">rtags</a>. These can be
configured by appending the name of the indexer to the make target, such
as:</p>
currently possible to generate configuration for three such indexers, <a
href="https://clang.llvm.org/extra/clangd/">clangd</a>, <a
href="https://github.com/MaskRay/ccls/wiki/Visual-Studio-Code">ccls</a>
and <a href="https://github.com/Andersbakken/rtags">rtags</a>. These can
be configured by appending the name of the indexer to the make target,
such as:</p>
<pre class="shell"><code>make vscode-project-clangd</code></pre>
<p>Additional instructions for configuring the given indexer will be
displayed after the workspace has been generated.</p>
Expand Down
3 changes: 2 additions & 1 deletion doc/ide.md
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,8 @@ choose `File -> Open Workspace...` in Visual Studio Code.
The main `vscode-project` target configures the default C++ support in Visual
Studio Code. There are also other source indexers that can be installed, that
may provide additional features. It's currently possible to generate
configuration for two such indexers, [clangd](https://clang.llvm.org/extra/clangd/)
configuration for three such indexers, [clangd](https://clang.llvm.org/extra/clangd/),
[ccls](https://github.com/MaskRay/ccls/wiki/Visual-Studio-Code)
and [rtags](https://github.com/Andersbakken/rtags). These can be configured by
appending the name of the indexer to the make target, such as:

Expand Down
15 changes: 8 additions & 7 deletions make/GenerateLinkOptData.gmk
Original file line number Diff line number Diff line change
Expand Up @@ -62,14 +62,14 @@ ifeq ($(EXTERNAL_BUILDJDK), true)
INTERIM_IMAGE_DIR := $(BUILD_JDK)
endif

# These are needed for deterministic classlist:
# To make the classlist deterministic:
# - The classlist can be influenced by locale. Always set it to en/US.
# - Run with -Xint, as the compiler can speculatively resolve constant pool entries.
# - ForkJoinPool parallelism can cause constant pool resolution to be non-deterministic.
# - Concurrency in the core libraries can cause constant pool resolution
# to be non-deterministic. Since the benefits of resolved CP references in the
# default classlist is minimal, let's filter out the '@cp' lines until we can
# find a proper solution.
CLASSLIST_FILE_VM_OPTS = \
-Duser.language=en -Duser.country=US \
-Xint \
-Djava.util.concurrent.ForkJoinPool.common.parallelism=0
-Duser.language=en -Duser.country=US

# Save the stderr output of the command and print it along with stdout in case
# something goes wrong.
Expand Down Expand Up @@ -101,9 +101,10 @@ $(CLASSLIST_FILE): $(INTERIM_IMAGE_DIR)/bin/java$(EXECUTABLE_SUFFIX) $(CLASSLIST
exit $$exitcode \
)
$(GREP) -v HelloClasslist [email protected] > [email protected]
$(GREP) -v @cp [email protected] > [email protected]
$(FIXPATH) $(INTERIM_IMAGE_DIR)/bin/java \
-cp $(SUPPORT_OUTPUTDIR)/classlist.jar \
build.tools.classlist.SortClasslist [email protected].3 > $@
build.tools.classlist.SortClasslist [email protected].4 > $@

# The jli trace is created by the same recipe as classlist. By declaring these
# dependencies, make will correctly rebuild both jli trace and classlist
Expand Down
10 changes: 5 additions & 5 deletions make/InitSupport.gmk
Original file line number Diff line number Diff line change
Expand Up @@ -63,14 +63,14 @@ ifeq ($(HAS_SPEC),)

# The variable MAKEOVERRIDES contains variable assignments from the command
# line, but in reverse order to what the user entered.
# The '\#' <=> '\ 'dance is needed to keep values with space in them connected.
COMMAND_LINE_VARIABLES := $(subst \#,\ , $(call reverse, $(subst \ ,\#,$(MAKEOVERRIDES))))
# The '§' <=> '\ 'dance is needed to keep values with space in them connected.
COMMAND_LINE_VARIABLES := $(subst §,\ , $(call reverse, $(subst \ ,§,$(MAKEOVERRIDES))))

# A list like FOO="val1" BAR="val2" containing all user-supplied make
# variables that we should propagate.
# The '\#' <=> '\ 'dance is needed to keep values with space in them connected.
USER_MAKE_VARS := $(subst \#,\ , $(filter-out $(addsuffix =%, $(INIT_CONTROL_VARIABLES)), \
$(subst \ ,\#,$(MAKEOVERRIDES))))
# The '§' <=> '\ 'dance is needed to keep values with space in them connected.
USER_MAKE_VARS := $(subst §,\ , $(filter-out $(addsuffix =%, $(INIT_CONTROL_VARIABLES)), \
$(subst \ ,§,$(MAKEOVERRIDES))))

# Setup information about available configurations, if any.
ifneq ($(CUSTOM_ROOT), )
Expand Down
24 changes: 20 additions & 4 deletions make/autoconf/jdk-options.m4
Original file line number Diff line number Diff line change
Expand Up @@ -197,9 +197,8 @@ AC_DEFUN_ONCE([JDKOPT_SETUP_JDK_OPTIONS],
# three different page sizes: 4K, 64K, and if run on Mac m1 hardware, 16K.
COMPATIBLE_CDS_ALIGNMENT_DEFAULT=false
if test "x$OPENJDK_TARGET_OS" = "xlinux" && test "x$OPENJDK_TARGET_CPU" = "xaarch64"; then
COMPATIBLE_CDS_ALIGNMENT_DEFAULT=true
COMPATIBLE_CDS_ALIGNMENT_DEFAULT=auto
fi
AC_SUBST(COMPATIBLE_CDS_ALIGNMENT_DEFAULT)
# Compress jars
COMPRESS_JARS=false
Expand Down Expand Up @@ -438,12 +437,23 @@ AC_DEFUN_ONCE([JDKOPT_SETUP_ADDRESS_SANITIZER],
# It's harmless to be suppressed in clang as well.
ASAN_CFLAGS="-fsanitize=address -Wno-stringop-truncation -fno-omit-frame-pointer -fno-common -DADDRESS_SANITIZER"
ASAN_LDFLAGS="-fsanitize=address"
# detect_stack_use_after_return causes ASAN to offload stack-local
# variables to c-heap and therefore breaks assumptions in hotspot
# that rely on data (e.g. Marks) living in thread stacks.
if test "x$TOOLCHAIN_TYPE" = "xgcc"; then
ASAN_CFLAGS="$ASAN_CFLAGS --param asan-use-after-return=0"
fi
if test "x$TOOLCHAIN_TYPE" = "xclang"; then
ASAN_CFLAGS="$ASAN_CFLAGS -fsanitize-address-use-after-return=never"
fi
elif test "x$TOOLCHAIN_TYPE" = "xmicrosoft"; then
# -Oy- is equivalent to -fno-omit-frame-pointer in GCC/Clang.
ASAN_CFLAGS="-fsanitize=address -Oy- -DADDRESS_SANITIZER"
# MSVC produces a warning if you pass -fsanitize=address to the linker. It also complains
$ if -DEBUG is not passed to the linker when building with ASan.
ASAN_LDFLAGS="-debug"
# -fsanitize-address-use-after-return is off by default in MS Visual Studio 22 (19.37.32824).
# cl : Command line warning D9002 : ignoring unknown option '-fno-sanitize-address-use-after-return'
fi
JVM_CFLAGS="$JVM_CFLAGS $ASAN_CFLAGS"
JVM_LDFLAGS="$JVM_LDFLAGS $ASAN_LDFLAGS"
Expand Down Expand Up @@ -496,9 +506,15 @@ AC_DEFUN_ONCE([JDKOPT_SETUP_LEAK_SANITIZER],
#
AC_DEFUN_ONCE([JDKOPT_SETUP_UNDEFINED_BEHAVIOR_SANITIZER],
[
UTIL_ARG_WITH(NAME: additional-ubsan-checks, TYPE: string,
DEFAULT: [],
DESC: [Customizes the ubsan checks],
OPTIONAL: true)
# GCC reports lots of likely false positives for stringop-truncation and format-overflow.
# Silence them for now.
UBSAN_CHECKS="-fsanitize=undefined -fsanitize=float-divide-by-zero -fno-sanitize=shift-base -fno-sanitize=alignment"
UBSAN_CHECKS="-fsanitize=undefined -fsanitize=float-divide-by-zero -fno-sanitize=shift-base -fno-sanitize=alignment \
$ADDITIONAL_UBSAN_CHECKS"
UBSAN_CFLAGS="$UBSAN_CHECKS -Wno-stringop-truncation -Wno-format-overflow -fno-omit-frame-pointer -DUNDEFINED_BEHAVIOR_SANITIZER"
UBSAN_LDFLAGS="$UBSAN_CHECKS"
UTIL_ARG_ENABLE(NAME: ubsan, DEFAULT: false, RESULT: UBSAN_ENABLED,
Expand Down Expand Up @@ -666,7 +682,7 @@ AC_DEFUN([JDKOPT_ENABLE_DISABLE_COMPATIBLE_CDS_ALIGNMENT],
UTIL_ARG_ENABLE(NAME: compatible-cds-alignment, DEFAULT: $COMPATIBLE_CDS_ALIGNMENT_DEFAULT,
RESULT: ENABLE_COMPATIBLE_CDS_ALIGNMENT,
DESC: [enable use alternative compatible cds core region alignment],
DEFAULT_DESC: [disabled],
DEFAULT_DESC: [disabled except on linux-aarch64],
CHECKING_MSG: [if compatible cds region alignment enabled],
CHECK_AVAILABLE: [
AC_MSG_CHECKING([if CDS archive is available])
Expand Down
10 changes: 2 additions & 8 deletions make/jdk/src/classes/build/tools/intpoly/FieldGen.java
Original file line number Diff line number Diff line change
Expand Up @@ -778,7 +778,7 @@ private String generate(FieldParams params) throws IOException {
result.appendLine("}");

result.appendLine("@Override");
result.appendLine("protected int mult(long[] a, long[] b, long[] r) {");
result.appendLine("protected void mult(long[] a, long[] b, long[] r) {");
result.incrIndent();
for (int i = 0; i < 2 * params.getNumLimbs() - 1; i++) {
result.appendIndent();
Expand All @@ -804,9 +804,6 @@ private String generate(FieldParams params) throws IOException {
}
}
result.append(");\n");
result.appendIndent();
result.append("return 0;");
result.appendLine();
result.decrIndent();
result.appendLine("}");

Expand Down Expand Up @@ -836,7 +833,7 @@ private String generate(FieldParams params) throws IOException {
// }
// }
result.appendLine("@Override");
result.appendLine("protected int square(long[] a, long[] r) {");
result.appendLine("protected void square(long[] a, long[] r) {");
result.incrIndent();
for (int i = 0; i < 2 * params.getNumLimbs() - 1; i++) {
result.appendIndent();
Expand Down Expand Up @@ -877,9 +874,6 @@ private String generate(FieldParams params) throws IOException {
}
}
result.append(");\n");
result.appendIndent();
result.append("return 0;");
result.appendLine();
result.decrIndent();
result.appendLine("}");

Expand Down
18 changes: 9 additions & 9 deletions make/jdk/src/classes/build/tools/taglet/SealedGraph.java
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2022, 2023, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2022, 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 @@ -107,7 +107,7 @@ public String toString(List<? extends DocTree> tags, Element element) {
throw new RuntimeException(e);
}

String simpleTypeName = element.getSimpleName().toString();
String simpleTypeName = packagelessCanonicalName(typeElement).replace('.', '/');
String imageFile = simpleTypeName + "-sealed-graph.svg";
int thumbnailHeight = 100; // also appears in the stylesheet
String hoverImage = "<span>"
Expand Down Expand Up @@ -315,14 +315,14 @@ private static Optional<String> packageName(TypeElement element) {
case MEMBER -> packageName((TypeElement) element.getEnclosingElement());
};
}
}

private static String packagelessCanonicalName(TypeElement element) {
String result = element.getSimpleName().toString();
while (element.getNestingKind() == NestingKind.MEMBER) {
element = (TypeElement) element.getEnclosingElement();
result = element.getSimpleName().toString() + '.' + result;
}
return result;
private static String packagelessCanonicalName(TypeElement element) {
String result = element.getSimpleName().toString();
while (element.getNestingKind() == NestingKind.MEMBER) {
element = (TypeElement) element.getEnclosingElement();
result = element.getSimpleName().toString() + '.' + result;
}
return result;
}
}
9 changes: 9 additions & 0 deletions make/modules/jdk.jdeps/Launcher.gmk
Original file line number Diff line number Diff line change
Expand Up @@ -51,3 +51,12 @@ $(eval $(call SetupBuildLauncher, jdeprscan, \
MAIN_CLASS := com.sun.tools.jdeprscan.Main, \
CFLAGS := -DEXPAND_CLASSPATH_WILDCARDS, \
))

################################################################################
## Build jnativescan
################################################################################

$(eval $(call SetupBuildLauncher, jnativescan, \
MAIN_CLASS := com.sun.tools.jnativescan.Main, \
CFLAGS := -DEXPAND_CLASSPATH_WILDCARDS, \
))
2 changes: 1 addition & 1 deletion make/src/classes/build/tools/jfr/GenerateJfrFiles.java
Original file line number Diff line number Diff line change
Expand Up @@ -668,7 +668,7 @@ private static void printJfrEventControlHpp(Metadata metadata, File outputFile)
out.write(" // add named struct members also.");
out.write(" struct {");
out.write(" jfrNativeEventSetting pad[NUMBER_OF_RESERVED_EVENTS];");
for (TypeElement t : metadata.getEventsAndStructs()) {
for (TypeElement t : metadata.getEvents()) {
out.write(" jfrNativeEventSetting " + t.name + ";");
}
out.write(" } ev;");
Expand Down
2 changes: 1 addition & 1 deletion src/hotspot/cpu/aarch64/aarch64.ad
Original file line number Diff line number Diff line change
Expand Up @@ -3360,7 +3360,7 @@ encode %{
}
%}

/// mov envcodings
// mov encodings

enc_class aarch64_enc_movw_imm(iRegI dst, immI src) %{
uint32_t con = (uint32_t)$src$$constant;
Expand Down
2 changes: 1 addition & 1 deletion src/hotspot/cpu/aarch64/c2_MacroAssembler_aarch64.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1154,7 +1154,7 @@ void C2_MacroAssembler::string_compare(Register str1, Register str2,

BLOCK_COMMENT("string_compare {");

// Bizzarely, the counts are passed in bytes, regardless of whether they
// Bizarrely, the counts are passed in bytes, regardless of whether they
// are L or U strings, however the result is always in characters.
if (!str1_isL) asrw(cnt1, cnt1, 1);
if (!str2_isL) asrw(cnt2, cnt2, 1);
Expand Down
4 changes: 3 additions & 1 deletion src/hotspot/cpu/aarch64/globalDefinitions_aarch64.hpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 1999, 2021, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1999, 2024, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2014, 2015, Red Hat Inc. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
Expand Down Expand Up @@ -76,4 +76,6 @@ const bool CCallingConventionRequiresIntsAsLongs = false;

#define USE_POINTERS_TO_REGISTER_IMPL_ARRAY

#define USE_TRAMPOLINE_STUB_FIX_OWNER

#endif // CPU_AARCH64_GLOBALDEFINITIONS_AARCH64_HPP
6 changes: 2 additions & 4 deletions src/hotspot/cpu/aarch64/interp_masm_aarch64.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1418,8 +1418,7 @@ void InterpreterMacroAssembler::notify_method_entry() {
bind(L);
}

{
SkipIfEqual skip(this, &DTraceMethodProbes, false);
if (DTraceMethodProbes) {
get_method(c_rarg1);
call_VM_leaf(CAST_FROM_FN_PTR(address, SharedRuntime::dtrace_method_entry),
rthread, c_rarg1);
Expand Down Expand Up @@ -1458,8 +1457,7 @@ void InterpreterMacroAssembler::notify_method_exit(
pop(state);
}

{
SkipIfEqual skip(this, &DTraceMethodProbes, false);
if (DTraceMethodProbes) {
push(state);
get_method(c_rarg1);
call_VM_leaf(CAST_FROM_FN_PTR(address, SharedRuntime::dtrace_method_exit),
Expand Down
39 changes: 18 additions & 21 deletions src/hotspot/cpu/aarch64/nativeInst_aarch64.cpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 1997, 2023, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1997, 2024, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2014, 2020, Red Hat Inc. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
Expand Down Expand Up @@ -51,13 +51,18 @@ void NativeInstruction::wrote(int offset) {
}

address NativeCall::destination() const {
address addr = (address)this;
address destination = instruction_address() + displacement();
address addr = instruction_address();
address destination = addr + displacement();

// Performance optimization: no need to call find_blob() if it is a self-call
if (destination == addr) {
return destination;
}

// Do we use a trampoline stub for this call?
CodeBlob* cb = CodeCache::find_blob(addr);
assert(cb && cb->is_nmethod(), "sanity");
nmethod *nm = (nmethod *)cb;
assert(cb != nullptr && cb->is_nmethod(), "nmethod expected");
nmethod *nm = cb->as_nmethod();
if (nm->stub_contains(destination) && is_NativeCallTrampolineStub_at(destination)) {
// Yes we do, so get the destination from the trampoline stub.
const address trampoline_stub_addr = destination;
Expand All @@ -72,12 +77,8 @@ address NativeCall::destination() const {
// call instruction at all times.
//
// Used in the runtime linkage of calls; see class CompiledIC.
//
// Add parameter assert_lock to switch off assertion
// during code generation, where no patching lock is needed.
void NativeCall::set_destination_mt_safe(address dest, bool assert_lock) {
assert(!assert_lock ||
(Patching_lock->is_locked() || SafepointSynchronize::is_at_safepoint()) ||
void NativeCall::set_destination_mt_safe(address dest) {
assert((Patching_lock->is_locked() || SafepointSynchronize::is_at_safepoint()) ||
CompiledICLocker::is_safe(addr_at(0)),
"concurrent code patching");

Expand All @@ -104,22 +105,18 @@ void NativeCall::set_destination_mt_safe(address dest, bool assert_lock) {
}

address NativeCall::get_trampoline() {
address call_addr = addr_at(0);
address call_addr = instruction_address();

CodeBlob *code = CodeCache::find_blob(call_addr);
assert(code != nullptr, "Could not find the containing code blob");
assert(code != nullptr && code->is_nmethod(), "nmethod expected");
nmethod* nm = code->as_nmethod();

address bl_destination
= MacroAssembler::pd_call_destination(call_addr);
if (code->contains(bl_destination) &&
address bl_destination = call_addr + displacement();
if (nm->stub_contains(bl_destination) &&
is_NativeCallTrampolineStub_at(bl_destination))
return bl_destination;

if (code->is_nmethod()) {
return trampoline_stub_Relocation::get_trampoline_for(call_addr, (nmethod*)code);
}

return nullptr;
return trampoline_stub_Relocation::get_trampoline_for(call_addr, nm);
}

// Inserts a native call instruction at a given pc
Expand Down
Loading

0 comments on commit e5f9646

Please sign in to comment.