Skip to content

Commit b6443f6

Browse files
committed
8348347: Cleanup JavaThread subclass support in SA
Reviewed-by: kevinw, sspitsyn
1 parent ba6c965 commit b6443f6

15 files changed

+65
-337
lines changed

src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/runtime/AttachListenerThread.java

Lines changed: 0 additions & 41 deletions
This file was deleted.

src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/runtime/CompilerThread.java

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (c) 2000, 2020, Oracle and/or its affiliates. All rights reserved.
2+
* Copyright (c) 2000, 2025, Oracle and/or its affiliates. All rights reserved.
33
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
44
*
55
* This code is free software; you can redistribute it and/or modify it
@@ -65,8 +65,17 @@ public CompilerThread(Address addr) {
6565
super(addr);
6666
}
6767

68-
public boolean isJavaThread() { return false; }
69-
public boolean isHiddenFromExternalView() { return true; }
70-
public boolean isCompilerThread() { return true; }
68+
@Override
69+
public boolean isHiddenFromExternalView() {
70+
/*
71+
* See JDK-8348317. CompilerThreads are sometimes hidden and sometimes not. They
72+
* are not when JVMCI is enabled and a compiler implemented in java is running
73+
* on the CompilerThread. This is hard for SA to determine, and not something a customer
74+
* is likely to ever run across or care about, so by default all CompilerThreads
75+
* are considered to be hidden. However, we allow this behaviour to be overridden
76+
* in case the user has a need to make the CompilerThreads visible.
77+
*/
78+
return !Boolean.getBoolean("sun.jvm.hotspot.runtime.CompilerThread.visible");
79+
}
7180

7281
}

src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/runtime/DeoptimizeObjectsALotThread.java

Lines changed: 0 additions & 42 deletions
This file was deleted.

src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/runtime/StringDedupThread.java renamed to src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/runtime/HiddenJavaThread.java

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (c) 2023, Oracle and/or its affiliates. All rights reserved.
2+
* Copyright (c) 2025, Oracle and/or its affiliates. All rights reserved.
33
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
44
*
55
* This code is free software; you can redistribute it and/or modify it
@@ -26,11 +26,13 @@
2626

2727
import sun.jvm.hotspot.debugger.Address;
2828

29-
public class StringDedupThread extends JavaThread {
30-
public StringDedupThread(Address addr) {
29+
public class HiddenJavaThread extends JavaThread {
30+
31+
public HiddenJavaThread(Address addr) {
3132
super(addr);
3233
}
3334

34-
public boolean isJavaThread() { return false; }
35+
@Override
3536
public boolean isHiddenFromExternalView() { return true; }
37+
3638
}

src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/runtime/JavaThread.java

Lines changed: 2 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (c) 2000, 2024, Oracle and/or its affiliates. All rights reserved.
2+
* Copyright (c) 2000, 2025, Oracle and/or its affiliates. All rights reserved.
33
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
44
*
55
* This code is free software; you can redistribute it and/or modify it
@@ -33,13 +33,6 @@
3333
import sun.jvm.hotspot.utilities.Observable;
3434
import sun.jvm.hotspot.utilities.Observer;
3535

36-
/** This is an abstract class because there are certain OS- and
37-
CPU-specific operations (like the setting and getting of the last
38-
Java frame pointer) which need to be factored out. These
39-
operations are implemented by, for example,
40-
SolarisSPARCJavaThread, and the concrete subclasses are
41-
instantiated by the JavaThreadFactory in the Threads class. */
42-
4336
public class JavaThread extends Thread {
4437
private static final boolean DEBUG = System.getProperty("sun.jvm.hotspot.runtime.JavaThread.DEBUG") != null;
4538

@@ -58,6 +51,7 @@ public class JavaThread extends Thread {
5851
private static CIntegerField monitorOwnerIDField;
5952
private static long oopPtrSize;
6053

54+
// For accessing platform dependent functionality
6155
private static JavaThreadPDAccess access;
6256

6357
// JavaThreadStates read from underlying process
@@ -133,16 +127,6 @@ void setThreadPDAccess(JavaThreadPDAccess access) {
133127
this.access = access;
134128
}
135129

136-
/** NOTE: for convenience, this differs in definition from the underlying VM.
137-
Only "pure" JavaThreads return true; CompilerThreads,
138-
JVMDIDebuggerThreads return false.
139-
FIXME:
140-
consider encapsulating platform-specific functionality in an
141-
object instead of using inheritance (which is the primary reason
142-
we can't traverse CompilerThreads, etc; didn't want to have, for
143-
example, "SolarisSPARCCompilerThread".) */
144-
public boolean isJavaThread() { return true; }
145-
146130
public boolean isExiting () {
147131
return (getTerminated() == EXITING) || isTerminated();
148132
}

src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/runtime/JvmtiAgentThread.java

Lines changed: 0 additions & 44 deletions
This file was deleted.

src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/runtime/MonitorDeflationThread.java

Lines changed: 0 additions & 41 deletions
This file was deleted.

src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/runtime/NotificationThread.java

Lines changed: 0 additions & 37 deletions
This file was deleted.

src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/runtime/ServiceThread.java

Lines changed: 0 additions & 41 deletions
This file was deleted.

src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/runtime/Thread.java

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -80,16 +80,7 @@ public long allocatedBytes() {
8080
}
8181

8282
public boolean isVMThread() { return false; }
83-
public boolean isJavaThread() { return false; }
84-
public boolean isCompilerThread() { return false; }
85-
public boolean isCodeCacheSweeperThread() { return false; }
8683
public boolean isHiddenFromExternalView() { return false; }
87-
public boolean isJvmtiAgentThread() { return false; }
88-
public boolean isWatcherThread() { return false; }
89-
public boolean isServiceThread() { return false; }
90-
public boolean isMonitorDeflationThread() { return false; }
91-
public boolean isAttachListenerThread() { return false; }
92-
public boolean isDeoptimizeObjectsALotThread() { return false; }
9384

9485
/** Memory operations */
9586
public void oopsDo(AddressVisitor oopVisitor) {

0 commit comments

Comments
 (0)