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 Jan 7, 2025
2 parents 657cec7 + 08debd3 commit 9536315
Show file tree
Hide file tree
Showing 61 changed files with 635 additions and 1,176 deletions.
4 changes: 1 addition & 3 deletions make/test/BuildMicrobenchmark.gmk
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#
# Copyright (c) 2018, 2024, Oracle and/or its affiliates. All rights reserved.
# Copyright (c) 2018, 2025, 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 @@ -96,8 +96,6 @@ $(eval $(call SetupJavaCompilation, BUILD_JDK_MICROBENCHMARK, \
--add-exports java.base/jdk.internal.foreign=ALL-UNNAMED \
--add-exports java.base/jdk.internal.misc=ALL-UNNAMED \
--add-exports java.base/jdk.internal.util=ALL-UNNAMED \
--add-exports java.base/jdk.internal.org.objectweb.asm.tree=ALL-UNNAMED \
--add-exports java.base/jdk.internal.org.objectweb.asm=ALL-UNNAMED \
--add-exports java.base/jdk.internal.vm=ALL-UNNAMED \
--add-exports java.base/sun.invoke.util=ALL-UNNAMED \
--add-exports java.base/sun.security.util=ALL-UNNAMED \
Expand Down
7 changes: 1 addition & 6 deletions src/hotspot/cpu/riscv/compressedKlass_riscv.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ char* CompressedKlassPointers::reserve_address_space_for_compressed_classes(size

char* result = nullptr;

// RiscV loads a 64-bit immediate in up to four separate steps, splitting it into four different sections
// RISC-V loads a 64-bit immediate in up to four separate steps, splitting it into four different sections
// (two 32-bit sections, each split into two subsections of 20/12 bits).
//
// 63 ....... 44 43 ... 32 31 ....... 12 11 ... 0
Expand All @@ -51,11 +51,6 @@ char* CompressedKlassPointers::reserve_address_space_for_compressed_classes(size
// with one instruction (2)
result = reserve_address_space_for_unscaled_encoding(size, aslr);

// Failing that, attempt to reserve for base=zero shift>0
if (result == nullptr && optimize_for_zero_base) {
result = reserve_address_space_for_zerobased_encoding(size, aslr);
}

// Failing that, optimize for case (3) - a base with only bits set between [32-44)
if (result == nullptr) {
const uintptr_t from = nth_bit(32);
Expand Down
4 changes: 3 additions & 1 deletion src/hotspot/share/cds/metaspaceShared.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -987,8 +987,10 @@ bool MetaspaceShared::try_link_class(JavaThread* current, InstanceKlass* ik) {
ik->external_name());
CLEAR_PENDING_EXCEPTION;
SystemDictionaryShared::set_class_has_failed_verification(ik);
} else {
assert(!SystemDictionaryShared::has_class_failed_verification(ik), "sanity");
ik->compute_has_loops_flag_for_methods();
}
ik->compute_has_loops_flag_for_methods();
BytecodeVerificationLocal = saved;
return true;
} else {
Expand Down
11 changes: 5 additions & 6 deletions src/hotspot/share/compiler/compileBroker.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2532,6 +2532,11 @@ void CompileBroker::collect_statistics(CompilerThread* thread, elapsedTimer time
// C1 and C2 counters are counting both successful and unsuccessful compiles
_t_total_compilation.add(time);

// Update compilation times. Used by the implementation of JFR CompilerStatistics
// and java.lang.management.CompilationMXBean.
_perf_total_compilation->inc(time.ticks());
_peak_compilation_time = MAX2(time.milliseconds(), _peak_compilation_time);

if (!success) {
_total_bailout_count++;
if (UsePerfData) {
Expand All @@ -2550,12 +2555,6 @@ void CompileBroker::collect_statistics(CompilerThread* thread, elapsedTimer time
_t_invalidated_compilation.add(time);
} else {
// Compilation succeeded

// update compilation ticks - used by the implementation of
// java.lang.management.CompilationMXBean
_perf_total_compilation->inc(time.ticks());
_peak_compilation_time = time.milliseconds() > _peak_compilation_time ? time.milliseconds() : _peak_compilation_time;

if (CITime) {
int bytes_compiled = method->code_size() + task->num_inlined_bytecodes();
if (is_osr) {
Expand Down
2 changes: 1 addition & 1 deletion src/hotspot/share/gc/shenandoah/shenandoahWorkGroup.cpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
/*
* Copyright (c) 2017, 2021, Red Hat, Inc. All rights reserved.
* Copyright (c) 2014, 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 @@ -73,7 +74,6 @@ ShenandoahPushWorkerScope::~ShenandoahPushWorkerScope() {
}

void ShenandoahWorkerThreads::on_create_worker(WorkerThread* worker) {
ShenandoahThreadLocalData::create(worker);
if (_initialize_gclab) {
ShenandoahThreadLocalData::initialize_gclab(worker);
}
Expand Down
53 changes: 29 additions & 24 deletions src/hotspot/share/opto/vectornode.cpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2007, 2024, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2007, 2025, 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 @@ -666,7 +666,7 @@ VectorNode* VectorNode::make_mask_node(int vopc, Node* n1, Node* n2, uint vlen,
}
}

// Make a vector node for binary operation
// Make a vector node for unary or binary operation
VectorNode* VectorNode::make(int vopc, Node* n1, Node* n2, const TypeVect* vt, bool is_mask, bool is_var_shift, bool is_unsigned) {
// This method should not be called for unimplemented vectors.
guarantee(vopc > 0, "vopc must be > 0");
Expand Down Expand Up @@ -747,6 +747,9 @@ VectorNode* VectorNode::make(int vopc, Node* n1, Node* n2, const TypeVect* vt, b
case Op_URShiftVI: return new URShiftVINode(n1, n2, vt, is_var_shift);
case Op_URShiftVL: return new URShiftVLNode(n1, n2, vt, is_var_shift);

case Op_LShiftCntV: return new LShiftCntVNode(n1, vt);
case Op_RShiftCntV: return new RShiftCntVNode(n1, vt);

case Op_AndV: return new AndVNode(n1, n2, vt);
case Op_OrV: return new OrVNode (n1, n2, vt);
case Op_XorV: return new XorVNode(n1, n2, vt);
Expand All @@ -766,6 +769,18 @@ VectorNode* VectorNode::make(int vopc, Node* n1, Node* n2, const TypeVect* vt, b
case Op_SaturatingAddV: return new SaturatingAddVNode(n1, n2, vt, is_unsigned);
case Op_SaturatingSubV: return new SaturatingSubVNode(n1, n2, vt, is_unsigned);

case Op_VectorCastB2X: return new VectorCastB2XNode(n1, vt);
case Op_VectorCastS2X: return new VectorCastS2XNode(n1, vt);
case Op_VectorCastI2X: return new VectorCastI2XNode(n1, vt);
case Op_VectorCastL2X: return new VectorCastL2XNode(n1, vt);
case Op_VectorCastF2X: return new VectorCastF2XNode(n1, vt);
case Op_VectorCastD2X: return new VectorCastD2XNode(n1, vt);
case Op_VectorUCastB2X: return new VectorUCastB2XNode(n1, vt);
case Op_VectorUCastS2X: return new VectorUCastS2XNode(n1, vt);
case Op_VectorUCastI2X: return new VectorUCastI2XNode(n1, vt);
case Op_VectorCastHF2F: return new VectorCastHF2FNode(n1, vt);
case Op_VectorCastF2HF: return new VectorCastF2HFNode(n1, vt);

default:
fatal("Missed vector creation for '%s'", NodeClassNames[vopc]);
return nullptr;
Expand All @@ -791,6 +806,7 @@ VectorNode* VectorNode::make(int vopc, Node* n1, Node* n2, Node* n3, const TypeV
case Op_SelectFromTwoVector: return new SelectFromTwoVectorNode(n1, n2, n3, vt);
case Op_SignumVD: return new SignumVDNode(n1, n2, n3, vt);
case Op_SignumVF: return new SignumVFNode(n1, n2, n3, vt);
case Op_VectorBlend: return new VectorBlendNode(n1, n2, n3);
default:
fatal("Missed vector creation for '%s'", NodeClassNames[vopc]);
return nullptr;
Expand Down Expand Up @@ -818,22 +834,26 @@ VectorNode* VectorNode::scalar2vector(Node* s, uint vlen, BasicType bt, bool is_
}

VectorNode* VectorNode::shift_count(int opc, Node* cnt, uint vlen, BasicType bt) {
// Match shift count type with shift vector type.
int vopc = VectorNode::shift_count_opcode(opc);
const TypeVect* vt = TypeVect::make(bt, vlen);
return VectorNode::make(vopc, cnt, nullptr, vt);
}

int VectorNode::shift_count_opcode(int opc) {
switch (opc) {
case Op_LShiftI:
case Op_LShiftL:
return new LShiftCntVNode(cnt, vt);
return Op_LShiftCntV;
case Op_RShiftI:
case Op_RShiftL:
case Op_URShiftB:
case Op_URShiftS:
case Op_URShiftI:
case Op_URShiftL:
return new RShiftCntVNode(cnt, vt);
return Op_RShiftCntV;
default:
fatal("Missed vector creation for '%s'", NodeClassNames[opc]);
return nullptr;
fatal("Node class '%s' is not supported for shift count", NodeClassNames[opc]);
return -1;
}
}

Expand Down Expand Up @@ -1412,24 +1432,9 @@ VectorStoreMaskNode* VectorStoreMaskNode::make(PhaseGVN& gvn, Node* in, BasicTyp
return new VectorStoreMaskNode(in, gvn.intcon(elem_size), vt);
}

VectorCastNode* VectorCastNode::make(int vopc, Node* n1, BasicType bt, uint vlen) {
VectorNode* VectorCastNode::make(int vopc, Node* n1, BasicType bt, uint vlen) {
const TypeVect* vt = TypeVect::make(bt, vlen);
switch (vopc) {
case Op_VectorCastB2X: return new VectorCastB2XNode(n1, vt);
case Op_VectorCastS2X: return new VectorCastS2XNode(n1, vt);
case Op_VectorCastI2X: return new VectorCastI2XNode(n1, vt);
case Op_VectorCastL2X: return new VectorCastL2XNode(n1, vt);
case Op_VectorCastF2X: return new VectorCastF2XNode(n1, vt);
case Op_VectorCastD2X: return new VectorCastD2XNode(n1, vt);
case Op_VectorUCastB2X: return new VectorUCastB2XNode(n1, vt);
case Op_VectorUCastS2X: return new VectorUCastS2XNode(n1, vt);
case Op_VectorUCastI2X: return new VectorUCastI2XNode(n1, vt);
case Op_VectorCastHF2F: return new VectorCastHF2FNode(n1, vt);
case Op_VectorCastF2HF: return new VectorCastF2HFNode(n1, vt);
default:
assert(false, "unknown node: %s", NodeClassNames[vopc]);
return nullptr;
}
return VectorNode::make(vopc, n1, nullptr, vt);
}

int VectorCastNode::opcode(int sopc, BasicType bt, bool is_signed) {
Expand Down
6 changes: 4 additions & 2 deletions src/hotspot/share/opto/vectornode.hpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2007, 2024, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2007, 2025, 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 @@ -95,6 +95,8 @@ class VectorNode : public TypeNode {
static int opcode(int sopc, BasicType bt); // scalar_opc -> vector_opc
static int scalar_opcode(int vopc, BasicType bt); // vector_opc -> scalar_opc

static int shift_count_opcode(int opc);

// Limits on vector size (number of elements) for auto-vectorization.
static bool vector_size_supported_auto_vectorization(const BasicType bt, int size);
static bool implemented(int opc, uint vlen, BasicType bt);
Expand Down Expand Up @@ -1764,7 +1766,7 @@ class VectorCastNode : public VectorNode {
VectorCastNode(Node* in, const TypeVect* vt) : VectorNode(in, vt) {}
virtual int Opcode() const;

static VectorCastNode* make(int vopc, Node* n1, BasicType bt, uint vlen);
static VectorNode* make(int vopc, Node* n1, BasicType bt, uint vlen);
static int opcode(int opc, BasicType bt, bool is_signed = true);
static bool implemented(int opc, uint vlen, BasicType src_type, BasicType dst_type);

Expand Down
16 changes: 11 additions & 5 deletions src/java.base/share/classes/java/time/ZoneOffset.java
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2012, 2023, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2012, 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 @@ -424,11 +424,17 @@ public static ZoneOffset ofTotalSeconds(int totalSeconds) {
throw new DateTimeException("Zone offset not in valid range: -18:00 to +18:00");
}
if (totalSeconds % (15 * SECONDS_PER_MINUTE) == 0) {
return SECONDS_CACHE.computeIfAbsent(totalSeconds, totalSecs -> {
ZoneOffset result = new ZoneOffset(totalSecs);
Integer totalSecs = totalSeconds;
ZoneOffset result = SECONDS_CACHE.get(totalSecs);
if (result == null) {
result = new ZoneOffset(totalSeconds);
var existing = SECONDS_CACHE.putIfAbsent(totalSecs, result);
if (existing != null) {
result = existing;
}
ID_CACHE.putIfAbsent(result.getId(), result);
return result;
});
}
return result;
} else {
return new ZoneOffset(totalSeconds);
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2012, 2022, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2012, 2025, 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 @@ -309,7 +309,15 @@ public Iterator<Entry<String, Long>> getTextIterator(Chronology chrono, Temporal

private Object findStore(TemporalField field, Locale locale) {
Entry<TemporalField, Locale> key = createEntry(field, locale);
return CACHE.computeIfAbsent(key, e -> createStore(e.getKey(), e.getValue()));
Object store = CACHE.get(key);
if (store == null) {
store = createStore(field, locale);
var existing = CACHE.putIfAbsent(key, store);
if (existing != null) {
store = existing;
}
}
return store;
}

private static int toWeekDay(int calWeekDay) {
Expand Down
12 changes: 10 additions & 2 deletions src/java.base/share/classes/java/time/format/DecimalStyle.java
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2012, 2022, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2012, 2025, 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 @@ -160,7 +160,15 @@ public static DecimalStyle ofDefaultLocale() {
*/
public static DecimalStyle of(Locale locale) {
Objects.requireNonNull(locale, "locale");
return CACHE.computeIfAbsent(locale, DecimalStyle::create);
DecimalStyle info = CACHE.get(locale);
if (info == null) {
info = create(locale);
var existing = CACHE.putIfAbsent(locale, info);
if (existing != null) {
info = existing;
}
}
return info;
}

private static DecimalStyle create(Locale locale) {
Expand Down
10 changes: 1 addition & 9 deletions src/java.base/share/classes/module-info.java
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2014, 2024, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2014, 2025, 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 @@ -197,14 +197,6 @@
jdk.jlink;
exports jdk.internal.logger to
java.logging;
exports jdk.internal.org.objectweb.asm to
jdk.jfr;
exports jdk.internal.org.objectweb.asm.tree to
jdk.jfr;
exports jdk.internal.org.objectweb.asm.util to
jdk.jfr;
exports jdk.internal.org.objectweb.asm.commons to
jdk.jfr;
exports jdk.internal.org.xml.sax to
jdk.jfr;
exports jdk.internal.org.xml.sax.helpers to
Expand Down
2 changes: 1 addition & 1 deletion src/java.base/share/classes/sun/nio/ch/ThreadPool.java
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ int poolSize() {

static ThreadFactory defaultThreadFactory() {
return (Runnable r) -> {
Thread t = new Thread(r);
Thread t = InnocuousThread.newThread(r);
t.setDaemon(true);
return t;
};
Expand Down
9 changes: 3 additions & 6 deletions src/java.base/share/classes/sun/nio/fs/AbstractPoller.java
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,10 @@

package sun.nio.fs;

import java.nio.file.*;
import java.io.IOException;
import java.nio.file.*;
import java.util.*;
import jdk.internal.misc.InnocuousThread;

/**
* Base implementation of background poller thread used in watch service
Expand All @@ -53,11 +54,7 @@ protected AbstractPoller() {
* Starts the poller thread
*/
public void start() {
Thread thr = new Thread(null,
this,
"FileSystemWatchService",
0,
false);
Thread thr = InnocuousThread.newThread("FileSystemWatchService", this);
thr.setDaemon(true);
thr.start();
}
Expand Down
11 changes: 6 additions & 5 deletions src/java.base/share/classes/sun/nio/fs/Cancellable.java
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2008, 2009, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2008, 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 All @@ -25,14 +25,15 @@

package sun.nio.fs;

import jdk.internal.misc.Unsafe;
import java.util.concurrent.ExecutionException;
import jdk.internal.misc.InnocuousThread;
import jdk.internal.misc.Unsafe;

/**
* Base implementation of a task (typically native) that polls a memory location
* during execution so that it may be aborted/cancelled before completion. The
* task is executed by invoking the {@link runInterruptibly} method defined
* here and cancelled by invoking Thread.interrupt.
* task is executed by invoking the {@linkplain #runInterruptibly} method
* defined here and cancelled by invoking Thread.interrupt.
*/

abstract class Cancellable implements Runnable {
Expand Down Expand Up @@ -117,7 +118,7 @@ public final void run() {
* thread by writing into the memory location that it polls cooperatively.
*/
static void runInterruptibly(Cancellable task) throws ExecutionException {
Thread t = new Thread(null, task, "NIO-Task", 0, false);
Thread t = InnocuousThread.newThread("CancellableOp", task);
t.start();
boolean cancelledByInterrupt = false;
while (t.isAlive()) {
Expand Down
Loading

0 comments on commit 9536315

Please sign in to comment.