PING: RFR: 8u backport of JDK-8237499 JFR: Include stack trace in the ThreadStart event

Andrew Hughes gnu.andrew at redhat.com
Tue Feb 2 06:10:14 UTC 2021


On 10:36 Mon 01 Feb     , Yang Yi wrote:
> Can anyone help review this patch :-O
> 
> Thanks,
> Yang Yi
> 
>  ------------------Original Mail ------------------
> Sender:Yang Yi <qingfeng.yy at alibaba-inc.com>
> Send Date:Fri Jan 22 14:39:20 2021
> Recipients:jdk8u-dev at openjdk.java.net <jdk8u-dev at openjdk.java.net>
> Subject:RFR: 8u backport of JDK-8237499 JFR: Include stack trace in the ThreadStart event
> 
> Hi,
> 
> May I have a request backport of JDK-8237499?
> 
> JBS: https://bugs.openjdk.java.net/browse/JDK-8237499
> Webrev: http://cr.openjdk.java.net/~ddong/yiyang/8237499/
> testing: jdk/test/jdk/jfr/
> 
> It's useful for users to know where their threads start. This patch doesn't apply 
> cleanly but is fairly trivial. The latest jdk8u-dev has no `Thread::current_or_null` 
> function, just adding this function solves the problem.
> 
> This patch will cause another problem, e.g., the minimized VM fails to build, this 
> problem has been solved by JDK-8239886, so a follow-up backport of 
> JDK-8239886(one-line change) will be sent later.
> 
> Cheers,
> Yang Yi

While we don't want the whole of JDK-8132510 for Thread::current_or_null,
I would bring in the changes to thread.hpp so that the three methods -
JavaThread::current, Thread::current and the new Thread::current_or_null -
are interdependent, rather than duplicating each other.  See attached
patch.

Thanks,
-- 
Andrew :)

Senior Free Java Software Engineer
OpenJDK Package Owner
Red Hat, Inc. (http://www.redhat.com)

PGP Key: ed25519/0xCFDA0F9B35964222 (hkp://keys.gnupg.net)
Fingerprint = 5132 579D D154 0ED2 3E04  C5A0 CFDA 0F9B 3596 4222
-------------- next part --------------
diff --git a/src/share/vm/runtime/thread.hpp b/src/share/vm/runtime/thread.hpp
--- a/src/share/vm/runtime/thread.hpp
+++ b/src/share/vm/runtime/thread.hpp
@@ -678,9 +678,9 @@
          "Don't use Thread::current() inside signal handler");
 #endif
 #endif
-  Thread* thread = ThreadLocalStorage::thread();
-  assert(thread != NULL, "just checking");
-  return thread;
+  Thread* current = current_or_null();
+  assert(current != NULL, "Thread::current() called on detached thread");
+  return current;
 }
 
 // Name support for threads.  non-JavaThread subclasses with multiple
@@ -1777,8 +1777,8 @@
 
 // Inline implementation of JavaThread::current
 inline JavaThread* JavaThread::current() {
-  Thread* thread = ThreadLocalStorage::thread();
-  assert(thread != NULL && thread->is_Java_thread(), "just checking");
+  Thread* thread = Thread::current();
+  assert(thread->is_Java_thread(), "just checking");
   return (JavaThread*)thread;
 }
 


More information about the jdk8u-dev mailing list