< prev index next >

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

Print this page

 17  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
 18  *
 19  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
 20  * or visit www.oracle.com if you need additional information or have any
 21  * questions.
 22  *
 23  */
 24 
 25 package sun.jvm.hotspot.runtime;
 26 
 27 import java.util.*;
 28 
 29 import sun.jvm.hotspot.debugger.*;
 30 import sun.jvm.hotspot.types.*;
 31 import sun.jvm.hotspot.runtime.win32_x86.Win32X86JavaThreadPDAccess;
 32 import sun.jvm.hotspot.runtime.win32_amd64.Win32AMD64JavaThreadPDAccess;
 33 import sun.jvm.hotspot.runtime.win32_aarch64.Win32AARCH64JavaThreadPDAccess;
 34 import sun.jvm.hotspot.runtime.linux_x86.LinuxX86JavaThreadPDAccess;
 35 import sun.jvm.hotspot.runtime.linux_amd64.LinuxAMD64JavaThreadPDAccess;
 36 import sun.jvm.hotspot.runtime.linux_aarch64.LinuxAARCH64JavaThreadPDAccess;

 37 import sun.jvm.hotspot.runtime.linux_ppc64.LinuxPPC64JavaThreadPDAccess;
 38 import sun.jvm.hotspot.runtime.bsd_x86.BsdX86JavaThreadPDAccess;
 39 import sun.jvm.hotspot.runtime.bsd_amd64.BsdAMD64JavaThreadPDAccess;
 40 import sun.jvm.hotspot.runtime.bsd_aarch64.BsdAARCH64JavaThreadPDAccess;
 41 import sun.jvm.hotspot.utilities.*;
 42 import sun.jvm.hotspot.utilities.Observable;
 43 import sun.jvm.hotspot.utilities.Observer;
 44 
 45 class ThreadsList extends VMObject {
 46     private static AddressField  threadsField;
 47     private static CIntegerField lengthField;
 48 
 49     static {
 50         VM.registerVMInitializedObserver((o, d) -> initialize(VM.getVM().getTypeDataBase()));
 51     }
 52 
 53     private static synchronized void initialize(TypeDataBase db) {
 54         Type type = db.lookupType("ThreadsList");
 55         lengthField = type.getCIntegerField("_length");
 56         threadsField = type.getAddressField("_threads");

 96 
 97         access = null;
 98         // FIXME: find the platform specific PD class by reflection?
 99         if (os.equals("win32")) {
100             if (cpu.equals("x86")) {
101                 access =  new Win32X86JavaThreadPDAccess();
102             } else if (cpu.equals("amd64")) {
103                 access =  new Win32AMD64JavaThreadPDAccess();
104             } else if (cpu.equals("aarch64")) {
105                 access =  new Win32AARCH64JavaThreadPDAccess();
106             }
107         } else if (os.equals("linux")) {
108             if (cpu.equals("x86")) {
109                 access = new LinuxX86JavaThreadPDAccess();
110             } else if (cpu.equals("amd64")) {
111                 access = new LinuxAMD64JavaThreadPDAccess();
112             } else if (cpu.equals("ppc64")) {
113                 access = new LinuxPPC64JavaThreadPDAccess();
114             } else if (cpu.equals("aarch64")) {
115                 access = new LinuxAARCH64JavaThreadPDAccess();


116             } else {
117               try {
118                 access = (JavaThreadPDAccess)
119                   Class.forName("sun.jvm.hotspot.runtime.linux_" +
120                      cpu.toLowerCase() + ".Linux" + cpu.toUpperCase() +
121                      "JavaThreadPDAccess").getDeclaredConstructor().newInstance();
122               } catch (Exception e) {
123                 throw new RuntimeException("OS/CPU combination " + os + "/" + cpu +
124                                            " not yet supported");
125               }
126             }
127         } else if (os.equals("bsd")) {
128             if (cpu.equals("x86")) {
129                 access = new BsdX86JavaThreadPDAccess();
130             } else if (cpu.equals("amd64") || cpu.equals("x86_64")) {
131                 access = new BsdAMD64JavaThreadPDAccess();
132             }
133         } else if (os.equals("darwin")) {
134             if (cpu.equals("amd64") || cpu.equals("x86_64")) {
135                 access = new BsdAMD64JavaThreadPDAccess();

 17  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
 18  *
 19  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
 20  * or visit www.oracle.com if you need additional information or have any
 21  * questions.
 22  *
 23  */
 24 
 25 package sun.jvm.hotspot.runtime;
 26 
 27 import java.util.*;
 28 
 29 import sun.jvm.hotspot.debugger.*;
 30 import sun.jvm.hotspot.types.*;
 31 import sun.jvm.hotspot.runtime.win32_x86.Win32X86JavaThreadPDAccess;
 32 import sun.jvm.hotspot.runtime.win32_amd64.Win32AMD64JavaThreadPDAccess;
 33 import sun.jvm.hotspot.runtime.win32_aarch64.Win32AARCH64JavaThreadPDAccess;
 34 import sun.jvm.hotspot.runtime.linux_x86.LinuxX86JavaThreadPDAccess;
 35 import sun.jvm.hotspot.runtime.linux_amd64.LinuxAMD64JavaThreadPDAccess;
 36 import sun.jvm.hotspot.runtime.linux_aarch64.LinuxAARCH64JavaThreadPDAccess;
 37 import sun.jvm.hotspot.runtime.linux_riscv64.LinuxRISCV64JavaThreadPDAccess;
 38 import sun.jvm.hotspot.runtime.linux_ppc64.LinuxPPC64JavaThreadPDAccess;
 39 import sun.jvm.hotspot.runtime.bsd_x86.BsdX86JavaThreadPDAccess;
 40 import sun.jvm.hotspot.runtime.bsd_amd64.BsdAMD64JavaThreadPDAccess;
 41 import sun.jvm.hotspot.runtime.bsd_aarch64.BsdAARCH64JavaThreadPDAccess;
 42 import sun.jvm.hotspot.utilities.*;
 43 import sun.jvm.hotspot.utilities.Observable;
 44 import sun.jvm.hotspot.utilities.Observer;
 45 
 46 class ThreadsList extends VMObject {
 47     private static AddressField  threadsField;
 48     private static CIntegerField lengthField;
 49 
 50     static {
 51         VM.registerVMInitializedObserver((o, d) -> initialize(VM.getVM().getTypeDataBase()));
 52     }
 53 
 54     private static synchronized void initialize(TypeDataBase db) {
 55         Type type = db.lookupType("ThreadsList");
 56         lengthField = type.getCIntegerField("_length");
 57         threadsField = type.getAddressField("_threads");

 97 
 98         access = null;
 99         // FIXME: find the platform specific PD class by reflection?
100         if (os.equals("win32")) {
101             if (cpu.equals("x86")) {
102                 access =  new Win32X86JavaThreadPDAccess();
103             } else if (cpu.equals("amd64")) {
104                 access =  new Win32AMD64JavaThreadPDAccess();
105             } else if (cpu.equals("aarch64")) {
106                 access =  new Win32AARCH64JavaThreadPDAccess();
107             }
108         } else if (os.equals("linux")) {
109             if (cpu.equals("x86")) {
110                 access = new LinuxX86JavaThreadPDAccess();
111             } else if (cpu.equals("amd64")) {
112                 access = new LinuxAMD64JavaThreadPDAccess();
113             } else if (cpu.equals("ppc64")) {
114                 access = new LinuxPPC64JavaThreadPDAccess();
115             } else if (cpu.equals("aarch64")) {
116                 access = new LinuxAARCH64JavaThreadPDAccess();
117             } else if (cpu.equals("riscv64")) {
118                 access = new LinuxRISCV64JavaThreadPDAccess();
119             } else {
120               try {
121                 access = (JavaThreadPDAccess)
122                   Class.forName("sun.jvm.hotspot.runtime.linux_" +
123                      cpu.toLowerCase() + ".Linux" + cpu.toUpperCase() +
124                      "JavaThreadPDAccess").getDeclaredConstructor().newInstance();
125               } catch (Exception e) {
126                 throw new RuntimeException("OS/CPU combination " + os + "/" + cpu +
127                                            " not yet supported");
128               }
129             }
130         } else if (os.equals("bsd")) {
131             if (cpu.equals("x86")) {
132                 access = new BsdX86JavaThreadPDAccess();
133             } else if (cpu.equals("amd64") || cpu.equals("x86_64")) {
134                 access = new BsdAMD64JavaThreadPDAccess();
135             }
136         } else if (os.equals("darwin")) {
137             if (cpu.equals("amd64") || cpu.equals("x86_64")) {
138                 access = new BsdAMD64JavaThreadPDAccess();
< prev index next >