[crac] RFR: Merge jdk:jdk-25+18

Dmitry Cherepanov dcherepanov at openjdk.org
Mon Jun 16 07:37:14 UTC 2025


This MR includes merges for tags between jdk-25+15 and jdk-25+18.

Attaching output of --diff-merges=remerge

<details>

<summary>jdk-25+15</summary>


commit b0b66cb5999e89dd44456682c6bc932fa559e242
Merge: eea5480cdda 74df384a987
Author: Dmitry Cherepanov <dcherepanov at azul.com>
Date:   Mon Jun 9 18:31:26 2025 +0400

    Merge with jdk-25+15

diff --git a/src/hotspot/os/posix/attachListener_posix.cpp b/src/hotspot/os/posix/attachListener_posix.cpp
remerge CONFLICT (content): Merge conflict in src/hotspot/os/posix/attachListener_posix.cpp
index ca3666be119..4fcb7a24e08 100644
--- a/src/hotspot/os/posix/attachListener_posix.cpp
+++ b/src/hotspot/os/posix/attachListener_posix.cpp
@@ -60,105 +60,6 @@
 //    obtain the credentials of client. We check that the effective uid
 //    of the client matches this process.
 
-<<<<<<< eea5480cdda (8358956: [CRaC] Fix NULL usage in hotspot)
-=======
-// forward reference
-class PosixAttachOperation;
-
-class PosixAttachListener: AllStatic {
- private:
-  // the path to which we bind the UNIX domain socket
-  static char _path[UNIX_PATH_MAX];
-  static bool _has_path;
-
-  // the file descriptor for the listening socket
-  static volatile int _listener;
-
-  static bool _atexit_registered;
-
- public:
-  static void set_path(char* path) {
-    if (path == nullptr) {
-      _path[0] = '\0';
-      _has_path = false;
-    } else {
-      strncpy(_path, path, UNIX_PATH_MAX);
-      _path[UNIX_PATH_MAX-1] = '\0';
-      _has_path = true;
-    }
-  }
-
-  static void set_listener(int s)               { _listener = s; }
-
-  // initialize the listener, returns 0 if okay
-  static int init();
-
-  static char* path()                   { return _path; }
-  static bool has_path()                { return _has_path; }
-  static int listener()                 { return _listener; }
-
-  static PosixAttachOperation* dequeue();
-};
-
-class SocketChannel : public AttachOperation::RequestReader, public AttachOperation::ReplyWriter {
-private:
-  int _socket;
-public:
-  SocketChannel(int socket) : _socket(socket) {}
-  ~SocketChannel() {
-    close();
-  }
-
-  bool opened() const {
-    return _socket != -1;
-  }
-
-  void close() {
-    if (opened()) {
-      ::shutdown(_socket, SHUT_RDWR);
-      ::close(_socket);
-      _socket = -1;
-    }
-  }
-
-  // RequestReader
-  int read(void* buffer, int size) override {
-    ssize_t n;
-    RESTARTABLE(::read(_socket, buffer, (size_t)size), n);
-    return checked_cast<int>(n);
-  }
-
-  // ReplyWriter
-  int write(const void* buffer, int size) override {
-    ssize_t n;
-    RESTARTABLE(::write(_socket, buffer, size), n);
-    return checked_cast<int>(n);
-  }
-
-  void flush() override {
-  }
-};
-
-class PosixAttachOperation: public AttachOperation {
- private:
-  // the connection to the client
-  SocketChannel _socket_channel;
-
- public:
-  PosixAttachOperation(int socket) : AttachOperation(), _socket_channel(socket) {}
-
-  void complete(jint res, bufferedStream* st) override;
-
-  ReplyWriter* get_reply_writer() override {
-    return &_socket_channel;
-  }
-
-  bool read_request() {
-    return _socket_channel.read_request(this, &_socket_channel);
-  }
-};
-
->>>>>>> 74df384a987 (8352428: GenShen: Old-gen cycles are still looping)
 // statics
 char PosixAttachListener::_path[UNIX_PATH_MAX];
 bool PosixAttachListener::_has_path;
@@ -322,7 +223,8 @@ PosixAttachOperation* PosixAttachListener::dequeue() {
 // The complete() gets called after restore for proper deletion the leftover object.
 
 void PosixAttachOperation::complete(jint result, bufferedStream* st) {
-  PosixAttachOperation::effectively_complete_raw(result, st);
+  // the operation is completed by attachStream::complete
+  _effectively_completed = true;
   // reset the current op as late as possible, this happens on attach listener thread.
   PosixAttachListener::reset_current_op();
   delete this;
@@ -336,7 +238,6 @@ void PosixAttachOperation::complete(jint result, bufferedStream* st) {
 // if there are operations that involves a very big reply then it the
 // socket could be made non-blocking and a timeout could be used.
 
-<<<<<<< eea5480cdda (8358956: [CRaC] Fix NULL usage in hotspot)
 void PosixAttachOperation::effectively_complete_raw(jint result, bufferedStream* st) {
 
   if (_effectively_completed) {
@@ -353,14 +254,10 @@ void PosixAttachOperation::effectively_complete_raw(jint result, bufferedStream*
     write_operation_result(result, st);
   }
   _effectively_completed = true;
-=======
-void PosixAttachOperation::complete(jint result, bufferedStream* st) {
-  delete this;
->>>>>>> 74df384a987 (8352428: GenShen: Old-gen cycles are still looping)
 }
 
 void PosixAttachOperation::write_operation_result(jint result, bufferedStream* st) {
-  write_reply(&_socket_channel, result, st);
+  _socket_channel.write_reply(result, st);
 
   _socket_channel.close();
   st->reset();
diff --git a/src/hotspot/os/posix/posixAttachOperation.hpp b/src/hotspot/os/posix/posixAttachOperation.hpp
index 92d1b145b18..eb439a8ab8c 100644
--- a/src/hotspot/os/posix/posixAttachOperation.hpp
+++ b/src/hotspot/os/posix/posixAttachOperation.hpp
@@ -51,6 +51,7 @@ class SocketChannel : public AttachOperation::RequestReader, public AttachOperat
 
   void close() {
     if (opened()) {
+      ::shutdown(_socket, SHUT_RDWR);
       ::close(_socket);
       _socket = -1;
     }
@@ -69,9 +70,8 @@ class SocketChannel : public AttachOperation::RequestReader, public AttachOperat
     RESTARTABLE(::write(_socket, buffer, size), n);
     return checked_cast<int>(n);
   }
-  // called after writing all data
+
   void flush() override {
-    ::shutdown(_socket, SHUT_RDWR);
   }
 };
 
@@ -83,6 +83,10 @@ class PosixAttachOperation: public AttachOperation {
   void write_operation_result(jint result, bufferedStream* st);
 
  public:
+  PosixAttachOperation(int socket) : AttachOperation(), _socket_channel(socket) {
+    _effectively_completed = false;
+  }
+
   void complete(jint res, bufferedStream* st) override;
   void effectively_complete_raw(jint res, bufferedStream* st);
   bool is_effectively_completed()                      { return _effectively_completed; }
@@ -91,12 +95,12 @@ class PosixAttachOperation: public AttachOperation {
     return _socket_channel.socket();;
   }
 
-  PosixAttachOperation(int socket) : AttachOperation(), _socket_channel(socket) {
-    _effectively_completed = false;
+  ReplyWriter* get_reply_writer() override {
+    return &_socket_channel;
   }
 
   bool read_request() {
-    return AttachOperation::read_request(&_socket_channel, &_socket_channel);
+    return _socket_channel.read_request(this, &_socket_channel);
   }
 };
 
diff --git a/src/java.base/share/classes/jdk/internal/ref/CleanerImpl.java b/src/java.base/share/classes/jdk/internal/ref/CleanerImpl.java
remerge CONFLICT (content): Merge conflict in src/java.base/share/classes/jdk/internal/ref/CleanerImpl.java
index 4bc33a552d7..a5f0066a22a 100644
--- a/src/java.base/share/classes/jdk/internal/ref/CleanerImpl.java
+++ b/src/java.base/share/classes/jdk/internal/ref/CleanerImpl.java
@@ -167,11 +167,6 @@ public void run() {
                 }
             }
             try {
-<<<<<<< eea5480cdda (8358956: [CRaC] Fix NULL usage in hotspot)
-                // Wait for a Ref, with a timeout to avoid getting hung
-                // due to a race with clear/clean
-                Cleanable ref = (Cleanable) javaLangRefAccess.pollReferenceQueue(queue, 60 * 1000L);
-=======
                 // Wait for a Ref, with a timeout to avoid a potential hang.
                 // The Cleaner may become unreachable and its cleanable run,
                 // while there are registered cleanables for other objects.
@@ -180,8 +175,7 @@ <<<<<<< eea5480cdda (8358956: [CRaC] Fix NULL usage in hotspot)
                 // this.  Using a timeout is simpler than unblocking this by
                 // having cleaning of the last registered cleanable enqueue a
                 // dummy reference.
-                Cleanable ref = (Cleanable) queue.remove(60 * 1000L);
->>>>>>> 74df384a987 (8352428: GenShen: Old-gen cycles are still looping)
+                Cleanable ref = (Cleanable) javaLangRefAccess.pollReferenceQueue(queue, 60 * 1000L);
                 if (ref != null) {
                     ref.clean();
                 }
diff --git a/src/jdk.attach/share/classes/sun/tools/attach/HotSpotVirtualMachine.java b/src/jdk.attach/share/classes/sun/tools/attach/HotSpotVirtualMachine.java
remerge CONFLICT (content): Merge conflict in src/jdk.attach/share/classes/sun/tools/attach/HotSpotVirtualMachine.java
index 55ad14370b6..d3f503beeab 100644
--- a/src/jdk.attach/share/classes/sun/tools/attach/HotSpotVirtualMachine.java
+++ b/src/jdk.attach/share/classes/sun/tools/attach/HotSpotVirtualMachine.java
@@ -80,14 +80,10 @@ private static long pid() {
             throw new AttachNotSupportedException("Invalid process identifier: " + id);
         }
 
-        selfAttach = pid == 0 || pid == CURRENT_PID;
+        selfAttach = pid == 0 || pid == pid();
         // The tool should be a different VM to the target. This check will
         // eventually be enforced by the target VM.
-<<<<<<< eea5480cdda (8358956: [CRaC] Fix NULL usage in hotspot)
-        if (!ALLOW_ATTACH_SELF && (pid == 0 || pid == pid())) {
-=======
         if (!ALLOW_ATTACH_SELF && selfAttach) {
->>>>>>> 74df384a987 (8352428: GenShen: Old-gen cycles are still looping)
             throw new IOException("Can not attach to current VM");
         }
     }


</details>

Resolved conflicts after [JDK-8319055](https://bugs.openjdk.org/browse/JDK-8319055) and [JDK-8351374](https://bugs.openjdk.org/browse/JDK-8351374)

<details>

<summary>jdk-25+16</summary>


commit 3da9702f290fc5106a1e1d9a3d9f8ddb04ee4c72
Merge: b0b66cb5999 24833403b6b
Author: Dmitry Cherepanov <dcherepanov at azul.com>
Date:   Sun Jun 15 23:09:48 2025 +0400

    Merge with jdk-25+16

diff --git a/src/hotspot/share/jfr/jni/jfrJniMethod.cpp b/src/hotspot/share/jfr/jni/jfrJniMethod.cpp
remerge CONFLICT (content): Merge conflict in src/hotspot/share/jfr/jni/jfrJniMethod.cpp
index 3872e834986..d592f92f3ec 100644
--- a/src/hotspot/share/jfr/jni/jfrJniMethod.cpp
+++ b/src/hotspot/share/jfr/jni/jfrJniMethod.cpp
@@ -430,11 +430,10 @@ NO_TRANSITION(jlong, jfr_nanos_now(JNIEnv* env, jclass jvm))
   return JfrChunk::nanos_now();
 NO_TRANSITION_END
 
-<<<<<<< b0b66cb5999 (Merge with jdk-25+15)
 JVM_ENTRY_NO_ENV(void, jfr_start_after_restore(JNIEnv* env, jclass jvm))
   return JfrRecorder::start_after_restore();
 JVM_END
-=======
+
 NO_TRANSITION(jboolean, jfr_is_product(JNIEnv* env, jclass jvm))
 #ifdef PRODUCT
   return true;
@@ -442,4 +441,3 @@ NO_TRANSITION(jboolean, jfr_is_product(JNIEnv* env, jclass jvm))
   return false;
 #endif
 NO_TRANSITION_END
->>>>>>> 24833403b6b (8352579: Refactor CDS legacy optimization for lambda proxy classes)
diff --git a/src/hotspot/share/jfr/jni/jfrJniMethod.hpp b/src/hotspot/share/jfr/jni/jfrJniMethod.hpp
remerge CONFLICT (content): Merge conflict in src/hotspot/share/jfr/jni/jfrJniMethod.hpp
index aabff5d407b..85023ee974b 100644
--- a/src/hotspot/share/jfr/jni/jfrJniMethod.hpp
+++ b/src/hotspot/share/jfr/jni/jfrJniMethod.hpp
@@ -167,11 +167,9 @@ void JNICALL jfr_unregister_stack_filter(JNIEnv* env, jclass jvm, jlong id);
 
 jlong JNICALL jfr_nanos_now(JNIEnv* env, jclass jvm);
 
-<<<<<<< b0b66cb5999 (Merge with jdk-25+15)
 void JNICALL jfr_start_after_restore(JNIEnv* env, jclass jvm);
-=======
+
 jboolean JNICALL jfr_is_product(JNIEnv* env, jclass jvm);
->>>>>>> 24833403b6b (8352579: Refactor CDS legacy optimization for lambda proxy classes)
 
 #ifdef __cplusplus
 }
diff --git a/src/hotspot/share/jfr/jni/jfrJniMethodRegistration.cpp b/src/hotspot/share/jfr/jni/jfrJniMethodRegistration.cpp
remerge CONFLICT (content): Merge conflict in src/hotspot/share/jfr/jni/jfrJniMethodRegistration.cpp
index 59e765d8242..b9596106808 100644
--- a/src/hotspot/share/jfr/jni/jfrJniMethodRegistration.cpp
+++ b/src/hotspot/share/jfr/jni/jfrJniMethodRegistration.cpp
@@ -101,11 +101,8 @@ JfrJniMethodRegistration::JfrJniMethodRegistration(JNIEnv* env) {
       (char*)"registerStackFilter", (char*)"([Ljava/lang/String;[Ljava/lang/String;)J", (void*)jfr_register_stack_filter,
       (char*)"unregisterStackFilter", (char*)"(J)V", (void*)jfr_unregister_stack_filter,
       (char*)"nanosNow", (char*)"()J", (void*)jfr_nanos_now,
-<<<<<<< b0b66cb5999 (Merge with jdk-25+15)
       (char*)"startFlightRecorderAfterRestore", (char*)"()V", (void*)jfr_start_after_restore,
-=======
       (char*)"isProduct", (char*)"()Z", (void*)jfr_is_product
->>>>>>> 24833403b6b (8352579: Refactor CDS legacy optimization for lambda proxy classes)
     };
 
     const size_t method_array_length = sizeof(method) / sizeof(JNINativeMethod);
diff --git a/src/jdk.jfr/share/classes/jdk/jfr/internal/JVM.java b/src/jdk.jfr/share/classes/jdk/jfr/internal/JVM.java
remerge CONFLICT (content): Merge conflict in src/jdk.jfr/share/classes/jdk/jfr/internal/JVM.java
index e839945fa40..0411dda3ebc 100644
--- a/src/jdk.jfr/share/classes/jdk/jfr/internal/JVM.java
+++ b/src/jdk.jfr/share/classes/jdk/jfr/internal/JVM.java
@@ -677,15 +677,14 @@ public final class JVM {
     public static native void setMiscellaneous(long eventTypeId, long value);
 
     /**
-<<<<<<< b0b66cb5999 (Merge with jdk-25+15)
      * Starts recording based on -XX:StartFlightRecorder passed on restore.
      */
     public static native void startFlightRecorderAfterRestore();
-=======
+
+    /**
      * Returns whether the current build is a product build.
      *
      * @return {@code true} if this is a product build, {@code false} otherwise.
      */
     public static native boolean isProduct();
->>>>>>> 24833403b6b (8352579: Refactor CDS legacy optimization for lambda proxy classes)
 }


</details>

Resolved conflicts after [JDK-8352648](https://bugs.openjdk.org/browse/JDK-8352648)

<details>

<summary>jdk-25+17</summary>


commit d5d30c340fbe56e6256f811d86fdffdfcd4e81bc
Merge: 3da9702f290 bd749221572
Author: Dmitry Cherepanov <dcherepanov at azul.com>
Date:   Sun Jun 15 23:09:53 2025 +0400

    Merge with jdk-25+17


</details>

Clean merge

<details>

<summary>jdk-25+18</summary>


commit 60274aa576a7c15fc580766f267195625c0e1823 (HEAD -> merge-jdk, dmitry-crac/merge-jdk)
Merge: d5d30c340fb bcac42aabce
Author: Dmitry Cherepanov <dcherepanov at azul.com>
Date:   Sun Jun 15 23:10:04 2025 +0400

    Merge with jdk-25+18


</details>

Clean merge

-------------

Commit messages:
 - Merge with jdk-25+18
 - 8349479: C2: when a Type node becomes dead, make CFG path that uses it unreachable
 - 8341641: Make %APPDATA% and %LOCALAPPDATA% env variables available in *.cfg files
 - 8352748: Remove com.sun.tools.classfile from the JDK
 - 8351034: Add AVX-512 intrinsics for ML-DSA
 - 8351319: AOT cache support for custom class loaders broken since JDK-8348426
 - 8350563: C2 compilation fails because PhaseCCP does not reach a fixpoint
 - 8354213: Restore pointless unicode characters to ASCII
 - 8353041: NeverBranchNode causes incorrect block frequency calculation
 - 8353549: Open source events tests batch2
 - ... and 427 more: https://git.openjdk.org/crac/compare/eea5480c...60274aa5

The webrevs contain the adjustments done while merging with regards to each parent branch:
 - crac: https://webrevs.openjdk.org/?repo=crac&pr=238&range=00.0
 - jdk:jdk-25+18: https://webrevs.openjdk.org/?repo=crac&pr=238&range=00.1

Changes: https://git.openjdk.org/crac/pull/238/files
  Stats: 125728 lines in 3070 files changed: 52031 ins; 60874 del; 12823 mod
  Patch: https://git.openjdk.org/crac/pull/238.diff
  Fetch: git fetch https://git.openjdk.org/crac.git pull/238/head:pull/238

PR: https://git.openjdk.org/crac/pull/238


More information about the crac-dev mailing list