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 Dec 4, 2024
2 parents ad6a59f + e45287d commit de5bfc7
Show file tree
Hide file tree
Showing 22 changed files with 938 additions and 80 deletions.
6 changes: 5 additions & 1 deletion src/hotspot/cpu/s390/c1_LIRAssembler_s390.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -233,7 +233,11 @@ int LIR_Assembler::emit_unwind_handler() {
LIR_Opr lock = FrameMap::as_opr(Z_R1_scratch);
monitor_address(0, lock);
stub = new MonitorExitStub(lock, true, 0);
__ unlock_object(Rtmp1, Rtmp2, lock->as_register(), *stub->entry());
if (LockingMode == LM_MONITOR) {
__ branch_optimized(Assembler::bcondAlways, *stub->entry());
} else {
__ unlock_object(Rtmp1, Rtmp2, lock->as_register(), *stub->entry());
}
__ bind(*stub->continuation());
}

Expand Down
4 changes: 4 additions & 0 deletions src/hotspot/cpu/s390/c1_MacroAssembler_s390.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -144,6 +144,8 @@ void C1_MacroAssembler::lock_object(Register Rmark, Register Roop, Register Rbox
branch_optimized(Assembler::bcondNotZero, slow_case);
// done
bind(done);
} else {
assert(false, "Unhandled LockingMode:%d", LockingMode);
}
}

Expand Down Expand Up @@ -180,6 +182,8 @@ void C1_MacroAssembler::unlock_object(Register Rmark, Register Roop, Register Rb
// If the object header was not pointing to the displaced header,
// we do unlocking via runtime call.
branch_optimized(Assembler::bcondNotEqual, slow_case);
} else {
assert(false, "Unhandled LockingMode:%d", LockingMode);
}
// done
bind(done);
Expand Down
13 changes: 6 additions & 7 deletions src/hotspot/os/bsd/os_bsd.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1987,13 +1987,12 @@ jint os::init_2(void) {

// On macOS according to setrlimit(2), OPEN_MAX must be used instead
// of RLIM_INFINITY, but testing on macOS >= 10.6, reveals that
// we can, in fact, use even RLIM_INFINITY, so try the max value
// that the system claims can be used first, same as other BSD OSes.
// However, some terminals (ksh) will internally use "int" type
// to store this value and since RLIM_INFINITY overflows an "int"
// we might end up with a negative value, so cap the system limit max
// at INT_MAX instead, just in case, for everyone.
nbr_files.rlim_cur = MIN(INT_MAX, nbr_files.rlim_max);
// we can, in fact, use even RLIM_INFINITY.
// However, we need to limit the value to 0x100000 (which is the max value
// allowed on Linux) so that any existing code that iterates over all allowed
// file descriptors, finishes in a reasonable time, without appearing
// to hang.
nbr_files.rlim_cur = MIN(0x100000, nbr_files.rlim_max);

status = setrlimit(RLIMIT_NOFILE, &nbr_files);
if (status != 0) {
Expand Down
63 changes: 23 additions & 40 deletions src/hotspot/os_cpu/windows_aarch64/copy_windows_aarch64.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,27 @@
#ifndef OS_CPU_WINDOWS_AARCH64_COPY_WINDOWS_AARCH64_HPP
#define OS_CPU_WINDOWS_AARCH64_COPY_WINDOWS_AARCH64_HPP

#include "runtime/atomic.hpp"

#include <string.h>

template <typename T>
static void pd_conjoint_atomic_helper(const T* from, T* to, size_t count) {
if (from > to) {
while (count-- > 0) {
// Copy forwards
Atomic::store(to++, Atomic::load(from++));
}
} else {
from += count - 1;
to += count - 1;
while (count-- > 0) {
// Copy backwards
Atomic::store(to--, Atomic::load(from--));
}
}
}

static void pd_conjoint_words(const HeapWord* from, HeapWord* to, size_t count) {
(void)memmove(to, from, count * HeapWordSize);
}
Expand Down Expand Up @@ -71,55 +90,19 @@ static void pd_conjoint_bytes_atomic(const void* from, void* to, size_t count) {
}

static void pd_conjoint_jshorts_atomic(const jshort* from, jshort* to, size_t count) {
if (from > to) {
while (count-- > 0) {
// Copy forwards
*to++ = *from++;
}
} else {
from += count - 1;
to += count - 1;
while (count-- > 0) {
// Copy backwards
*to-- = *from--;
}
}
pd_conjoint_atomic_helper(from, to, count);
}

static void pd_conjoint_jints_atomic(const jint* from, jint* to, size_t count) {
if (from > to) {
while (count-- > 0) {
// Copy forwards
*to++ = *from++;
}
} else {
from += count - 1;
to += count - 1;
while (count-- > 0) {
// Copy backwards
*to-- = *from--;
}
}
pd_conjoint_atomic_helper(from, to, count);
}

static void pd_conjoint_jlongs_atomic(const jlong* from, jlong* to, size_t count) {
pd_conjoint_oops_atomic((const oop*)from, (oop*)to, count);
pd_conjoint_atomic_helper(from, to, count);
}

static void pd_conjoint_oops_atomic(const oop* from, oop* to, size_t count) {
if (from > to) {
while (count-- > 0) {
// Copy forwards
*to++ = *from++;
}
} else {
from += count - 1;
to += count - 1;
while (count-- > 0) {
// Copy backwards
*to-- = *from--;
}
}
pd_conjoint_atomic_helper(from, to, count);
}

static void pd_arrayof_conjoint_bytes(const HeapWord* from, HeapWord* to, size_t count) {
Expand Down
5 changes: 5 additions & 0 deletions src/java.base/share/classes/java/lang/System.java
Original file line number Diff line number Diff line change
Expand Up @@ -2672,6 +2672,11 @@ public StackWalker newStackWalkerInstance(Set<StackWalker.Option> options,
public String getLoaderNameID(ClassLoader loader) {
return loader != null ? loader.nameAndId() : "null";
}

@Override
public boolean allowSecurityManager() {
return System.allowSecurityManager();
}
});
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,8 @@
import java.util.concurrent.locks.LockSupport;
import java.util.concurrent.locks.ReentrantLock;
import java.util.concurrent.locks.Condition;

import jdk.internal.access.JavaLangAccess;
import jdk.internal.access.JavaUtilConcurrentFJPAccess;
import jdk.internal.access.SharedSecrets;
import jdk.internal.misc.Unsafe;
Expand Down Expand Up @@ -979,11 +981,7 @@ static final class DefaultForkJoinWorkerThreadFactory
implements ForkJoinWorkerThreadFactory {
public final ForkJoinWorkerThread newThread(ForkJoinPool pool) {
boolean isCommon = (pool.workerNamePrefix == null);
@SuppressWarnings("removal")
SecurityManager sm = System.getSecurityManager();
if (sm == null)
return new ForkJoinWorkerThread(null, pool, true, false);
else if (isCommon)
if (isCommon && JLA.allowSecurityManager())
return newCommonWithACC(pool);
else
return newRegularWithACC(pool);
Expand All @@ -1000,6 +998,8 @@ else if (isCommon)
@SuppressWarnings("removal")
static volatile AccessControlContext regularACC, commonACC;

private static final JavaLangAccess JLA = SharedSecrets.getJavaLangAccess();

@SuppressWarnings("removal")
static ForkJoinWorkerThread newRegularWithACC(ForkJoinPool pool) {
AccessControlContext acc = regularACC;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -579,4 +579,10 @@ StackWalker newStackWalkerInstance(Set<StackWalker.Option> options,
* explicitly set otherwise <qualified-class-name> @<id>
*/
String getLoaderNameID(ClassLoader loader);

/**
* Is a security manager already set or allowed to be set
* (using -Djava.security.manager=allow)?
*/
boolean allowSecurityManager();
}
Original file line number Diff line number Diff line change
Expand Up @@ -212,6 +212,13 @@ void process(Main jartool, String opt, String arg) throws BadArgs {
}
},

// Extract options
new Option(false, OptionType.EXTRACT, "--keep-old-files", "-k") {
void process(Main jartool, String opt, String arg) {
jartool.kflag = true;
}
},

// Hidden options
new Option(false, OptionType.OTHER, "-P") {
void process(Main jartool, String opt, String arg) {
Expand Down Expand Up @@ -254,6 +261,7 @@ enum OptionType {
CREATE("create"),
CREATE_UPDATE("create.update"),
CREATE_UPDATE_INDEX("create.update.index"),
EXTRACT("extract"),
OTHER("other");

/** Resource lookup section prefix. */
Expand Down
15 changes: 14 additions & 1 deletion src/jdk.jartool/share/classes/sun/tools/jar/Main.java
Original file line number Diff line number Diff line change
Expand Up @@ -155,8 +155,9 @@ public int hashCode() {
* nflag: Perform jar normalization at the end
* pflag: preserve/don't strip leading slash and .. component from file name
* dflag: print module descriptor
* kflag: keep existing file
*/
boolean cflag, uflag, xflag, tflag, vflag, flag0, Mflag, iflag, pflag, dflag, validate;
boolean cflag, uflag, xflag, tflag, vflag, flag0, Mflag, iflag, pflag, dflag, kflag, validate;

boolean suppressDeprecateMsg = false;

Expand Down Expand Up @@ -590,6 +591,9 @@ boolean parseArgs(String args[]) {
case '0':
flag0 = true;
break;
case 'k':
kflag = true;
break;
case 'i':
if (cflag || uflag || xflag || tflag) {
usageError(getMsg("error.multiple.main.operations"));
Expand Down Expand Up @@ -620,6 +624,9 @@ boolean parseArgs(String args[]) {
usageError(getMsg("error.bad.option"));
return false;
}
if (kflag && !xflag) {
warn(formatMsg("warn.option.is.ignored", "--keep-old-files/-k/k"));
}

/* parse file arguments */
int n = args.length - count;
Expand Down Expand Up @@ -1470,6 +1477,12 @@ ZipEntry extractFile(InputStream is, ZipEntry e) throws IOException {
output(formatMsg("out.create", name));
}
} else {
if (f.exists() && kflag) {
if (vflag) {
output(formatMsg("out.kept", name));
}
return rc;
}
if (f.getParent() != null) {
File d = new File(f.getParent());
if (!d.exists() && !d.mkdirs() || !d.isDirectory()) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -143,6 +143,8 @@ warn.index.is.ignored=\
The JAR index (META-INF/INDEX.LIST) is ignored at run-time since JDK 18
warn.flag.is.deprecated=\
Warning: The {0} option is deprecated, and may be ignored or removed in a future release\n
warn.option.is.ignored=\
Warning: The {0} option is not valid with current usage, will be ignored.
out.added.manifest=\
added manifest
out.added.module-info=\
Expand All @@ -165,6 +167,8 @@ out.create=\
\ \ created: {0}
out.extracted=\
extracted: {0}
out.kept=\
\ \ skipped: {0} exists
out.inflated=\
\ inflated: {0}
out.size=\
Expand Down Expand Up @@ -245,7 +249,10 @@ main.help.opt.main.list=\
main.help.opt.main.update=\
\ -u, --update Update an existing jar archive
main.help.opt.main.extract=\
\ -x, --extract Extract named (or all) files from the archive
\ -x, --extract Extract named (or all) files from the archive.\n\
\ If a file with the same name appears more than once in\n\
\ the archive, each copy will be extracted, with later copies\n\
\ overwriting (replacing) earlier copies unless -k is specified.
main.help.opt.main.describe-module=\
\ -d, --describe-module Print the module descriptor, or automatic module name
main.help.opt.main.validate=\
Expand Down Expand Up @@ -307,6 +314,15 @@ main.help.opt.create.update.index.date=\
\ --date=TIMESTAMP The timestamp in ISO-8601 extended offset date-time with\n\
\ optional time-zone format, to use for the timestamps of\n\
\ entries, e.g. "2022-02-12T12:30:00-05:00"
main.help.opt.extract=\
\ Operation modifiers valid only in extract mode:\n
main.help.opt.extract.keep-old-files=\
\ -k, --keep-old-files Do not overwrite existing files.\n\
\ If a Jar file entry with the same name exists in the target\n\
\ directory, the existing file will not be overwritten.\n\
\ As a result, if a file appears more than once in an\n\
\ archive, later copies will not overwrite earlier copies.\n\
\ Also note that some file system can be case insensitive.
main.help.opt.other=\
\ Other options:\n
main.help.opt.other.help=\
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2015, 2023, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2015, 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 @@ -1811,6 +1811,9 @@ private String genSystemModulesMapClass(ClassDesc allSystemModules,

// write the class file to the pool as a resource
String rn = "/java.base/" + SYSTEM_MODULES_MAP_CLASSNAME + ".class";
// sort the map of module name to the class name of the generated SystemModules class
List<Map.Entry<String, String>> systemModulesMap = map.entrySet()
.stream().sorted(Map.Entry.comparingByKey()).toList();
ResourcePoolEntry e = ResourcePoolEntry.create(rn, Classfile.build(
CD_SYSTEM_MODULES_MAP,
clb -> clb.withFlags(ACC_FINAL + ACC_SUPER)
Expand Down Expand Up @@ -1861,10 +1864,10 @@ private String genSystemModulesMapClass(ClassDesc allSystemModules,
cob.anewarray(CD_String);

int index = 0;
for (String moduleName : sorted(map.keySet())) {
for (Map.Entry<String,String> entry : systemModulesMap) {
cob.dup() // arrayref
.constantInstruction(index)
.constantInstruction(moduleName)
.constantInstruction(entry.getKey())
.aastore();
index++;
}
Expand All @@ -1882,10 +1885,10 @@ private String genSystemModulesMapClass(ClassDesc allSystemModules,
.anewarray(CD_String);

int index = 0;
for (String className : sorted(map.values())) {
for (Map.Entry<String,String> entry : systemModulesMap) {
cob.dup() // arrayref
.constantInstruction(index)
.constantInstruction(className.replace('/', '.'))
.constantInstruction(entry.getValue().replace('/', '.'))
.aastore();
index++;
}
Expand Down
24 changes: 13 additions & 11 deletions test/hotspot/jtreg/ProblemList.txt
Original file line number Diff line number Diff line change
Expand Up @@ -51,17 +51,18 @@ compiler/cpuflags/TestAESIntrinsicsOnSupportedConfig.java 8190680 generic-all
compiler/runtime/Test8168712.java 8211769,8211771 generic-ppc64,generic-ppc64le,linux-s390x
compiler/loopopts/TestUnreachableInnerLoop.java 8288981 linux-s390x

compiler/rtm/locking/TestRTMAbortRatio.java 8183263 generic-x64,generic-i586
compiler/rtm/locking/TestRTMAbortThreshold.java 8183263,8313877 generic-x64,generic-i586,generic-ppc64le
compiler/rtm/locking/TestRTMAfterNonRTMDeopt.java 8183263 generic-x64,generic-i586
compiler/rtm/locking/TestRTMDeoptOnHighAbortRatio.java 8183263 generic-x64,generic-i586
compiler/rtm/locking/TestRTMDeoptOnLowAbortRatio.java 8183263,8307907 generic-x64,generic-i586,aix-ppc64
compiler/rtm/locking/TestRTMLockingCalculationDelay.java 8183263 generic-x64,generic-i586
compiler/rtm/locking/TestRTMLockingThreshold.java 8183263,8307907 generic-x64,generic-i586,aix-ppc64
compiler/rtm/locking/TestRTMSpinLoopCount.java 8183263,8313877 generic-x64,generic-i586,generic-ppc64le
compiler/rtm/locking/TestUseRTMDeopt.java 8183263 generic-x64,generic-i586
compiler/rtm/locking/TestUseRTMXendForLockBusy.java 8183263,8307907 generic-x64,generic-i586,aix-ppc64
compiler/rtm/print/TestPrintPreciseRTMLockingStatistics.java 8183263,8307907 generic-x64,generic-i586,aix-ppc64
compiler/rtm/locking/TestRTMAbortRatio.java 8183263 generic-x64,generic-i586,generic-ppc64le,generic-ppc64
compiler/rtm/locking/TestRTMAbortThreshold.java 8183263,8313877 generic-x64,generic-i586,generic-ppc64le,generic-ppc64
compiler/rtm/locking/TestRTMAfterNonRTMDeopt.java 8183263 generic-x64,generic-i586,generic-ppc64le,generic-ppc64
compiler/rtm/locking/TestRTMDeoptOnHighAbortRatio.java 8183263 generic-x64,generic-i586,generic-ppc64le,generic-ppc64
compiler/rtm/locking/TestRTMDeoptOnLowAbortRatio.java 8183263,8307907 generic-x64,generic-i586,generic-ppc64le,generic-ppc64
compiler/rtm/locking/TestRTMLockingCalculationDelay.java 8183263 generic-x64,generic-i586,generic-ppc64le,generic-ppc64
compiler/rtm/locking/TestRTMLockingThreshold.java 8183263,8307907 generic-x64,generic-i586,generic-ppc64le,generic-ppc64
compiler/rtm/locking/TestRTMSpinLoopCount.java 8183263,8313877 generic-x64,generic-i586,generic-ppc64le,generic-ppc64
compiler/rtm/locking/TestUseRTMDeopt.java 8183263 generic-x64,generic-i586,generic-ppc64le,generic-ppc64
compiler/rtm/locking/TestUseRTMXendForLockBusy.java 8183263,8307907 generic-x64,generic-i586,generic-ppc64le,generic-ppc64
compiler/rtm/print/TestPrintPreciseRTMLockingStatistics.java 8183263,8307907 generic-x64,generic-i586,generic-ppc64le,generic-ppc64
compiler/rtm/cli/TestUseRTMDeoptOptionOnSupportedConfig.java 8183263,8307907 generic-ppc64le,generic-ppc64

compiler/c2/Test8004741.java 8235801 generic-all
compiler/c2/irTests/TestDuplicateBackedge.java 8318904 generic-all
Expand Down Expand Up @@ -174,6 +175,7 @@ vmTestbase/vm/mlvm/meth/stress/jdi/breakpointInCompiledCode/Test.java 8257761 ge
vmTestbase/vm/mlvm/indy/func/jvmti/mergeCP_indy2none_a/TestDescription.java 8013267 generic-all
vmTestbase/vm/mlvm/indy/func/jvmti/mergeCP_indy2manyDiff_b/TestDescription.java 8013267 generic-all
vmTestbase/vm/mlvm/indy/func/jvmti/mergeCP_indy2manySame_b/TestDescription.java 8013267 generic-all
vmTestbase/vm/mlvm/meth/stress/compiler/deoptimize/Test.java#id1 8325905 generic-all

vmTestbase/nsk/jdwp/ThreadReference/ForceEarlyReturn/forceEarlyReturn001/forceEarlyReturn001.java 7199837 generic-all

Expand Down
Loading

0 comments on commit de5bfc7

Please sign in to comment.