< prev index next >

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

Print this page




  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 import sun.jvm.hotspot.debugger.*;
  29 import sun.jvm.hotspot.types.*;
  30 import sun.jvm.hotspot.runtime.solaris_sparc.SolarisSPARCJavaThreadPDAccess;
  31 import sun.jvm.hotspot.runtime.solaris_x86.SolarisX86JavaThreadPDAccess;
  32 import sun.jvm.hotspot.runtime.solaris_amd64.SolarisAMD64JavaThreadPDAccess;
  33 import sun.jvm.hotspot.runtime.win32_amd64.Win32AMD64JavaThreadPDAccess;
  34 import sun.jvm.hotspot.runtime.win32_x86.Win32X86JavaThreadPDAccess;
  35 import sun.jvm.hotspot.runtime.linux_x86.LinuxX86JavaThreadPDAccess;
  36 import sun.jvm.hotspot.runtime.linux_amd64.LinuxAMD64JavaThreadPDAccess;
  37 import sun.jvm.hotspot.runtime.linux_sparc.LinuxSPARCJavaThreadPDAccess;

  38 import sun.jvm.hotspot.runtime.bsd_x86.BsdX86JavaThreadPDAccess;
  39 import sun.jvm.hotspot.runtime.bsd_amd64.BsdAMD64JavaThreadPDAccess;
  40 import sun.jvm.hotspot.utilities.*;
  41 
  42 public class Threads {
  43     private static JavaThreadFactory threadFactory;
  44     private static AddressField      threadListField;
  45     private static CIntegerField     numOfThreadsField;
  46     private static VirtualConstructor virtualConstructor;
  47     private static JavaThreadPDAccess access;
  48 
  49     static {
  50         VM.registerVMInitializedObserver(new Observer() {
  51             public void update(Observable o, Object data) {
  52                 initialize(VM.getVM().getTypeDataBase());
  53             }
  54         });
  55     }
  56 
  57     private static synchronized void initialize(TypeDataBase db) {


  70             if (cpu.equals("sparc")) {
  71                 access = new SolarisSPARCJavaThreadPDAccess();
  72             } else if (cpu.equals("x86")) {
  73                 access = new SolarisX86JavaThreadPDAccess();
  74             } else if (cpu.equals("amd64")) {
  75                 access = new SolarisAMD64JavaThreadPDAccess();
  76             }
  77         } else if (os.equals("win32")) {
  78             if (cpu.equals("x86")) {
  79                 access =  new Win32X86JavaThreadPDAccess();
  80             } else if (cpu.equals("amd64")) {
  81                 access =  new Win32AMD64JavaThreadPDAccess();
  82             }
  83         } else if (os.equals("linux")) {
  84             if (cpu.equals("x86")) {
  85                 access = new LinuxX86JavaThreadPDAccess();
  86             } else if (cpu.equals("amd64")) {
  87                 access = new LinuxAMD64JavaThreadPDAccess();
  88             } else if (cpu.equals("sparc")) {
  89                 access = new LinuxSPARCJavaThreadPDAccess();


  90             } else {
  91               try {
  92                 access = (JavaThreadPDAccess)
  93                   Class.forName("sun.jvm.hotspot.runtime.linux_" +
  94                      cpu.toLowerCase() + ".Linux" + cpu.toUpperCase() +
  95                      "JavaThreadPDAccess").newInstance();
  96               } catch (Exception e) {
  97                 throw new RuntimeException("OS/CPU combination " + os + "/" + cpu +
  98                                            " not yet supported");
  99               }
 100             }
 101         } else if (os.equals("bsd")) {
 102             if (cpu.equals("x86")) {
 103                 access = new BsdX86JavaThreadPDAccess();
 104             } else if (cpu.equals("amd64") || cpu.equals("x86_64")) {
 105                 access = new BsdAMD64JavaThreadPDAccess();
 106             }
 107         } else if (os.equals("darwin")) {
 108             if (cpu.equals("amd64") || cpu.equals("x86_64")) {
 109                 access = new BsdAMD64JavaThreadPDAccess();




  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 import sun.jvm.hotspot.debugger.*;
  29 import sun.jvm.hotspot.types.*;
  30 import sun.jvm.hotspot.runtime.solaris_sparc.SolarisSPARCJavaThreadPDAccess;
  31 import sun.jvm.hotspot.runtime.solaris_x86.SolarisX86JavaThreadPDAccess;
  32 import sun.jvm.hotspot.runtime.solaris_amd64.SolarisAMD64JavaThreadPDAccess;
  33 import sun.jvm.hotspot.runtime.win32_amd64.Win32AMD64JavaThreadPDAccess;
  34 import sun.jvm.hotspot.runtime.win32_x86.Win32X86JavaThreadPDAccess;
  35 import sun.jvm.hotspot.runtime.linux_x86.LinuxX86JavaThreadPDAccess;
  36 import sun.jvm.hotspot.runtime.linux_amd64.LinuxAMD64JavaThreadPDAccess;
  37 import sun.jvm.hotspot.runtime.linux_sparc.LinuxSPARCJavaThreadPDAccess;
  38 import sun.jvm.hotspot.runtime.linux_aarch64.LinuxAARCH64JavaThreadPDAccess;
  39 import sun.jvm.hotspot.runtime.bsd_x86.BsdX86JavaThreadPDAccess;
  40 import sun.jvm.hotspot.runtime.bsd_amd64.BsdAMD64JavaThreadPDAccess;
  41 import sun.jvm.hotspot.utilities.*;
  42 
  43 public class Threads {
  44     private static JavaThreadFactory threadFactory;
  45     private static AddressField      threadListField;
  46     private static CIntegerField     numOfThreadsField;
  47     private static VirtualConstructor virtualConstructor;
  48     private static JavaThreadPDAccess access;
  49 
  50     static {
  51         VM.registerVMInitializedObserver(new Observer() {
  52             public void update(Observable o, Object data) {
  53                 initialize(VM.getVM().getTypeDataBase());
  54             }
  55         });
  56     }
  57 
  58     private static synchronized void initialize(TypeDataBase db) {


  71             if (cpu.equals("sparc")) {
  72                 access = new SolarisSPARCJavaThreadPDAccess();
  73             } else if (cpu.equals("x86")) {
  74                 access = new SolarisX86JavaThreadPDAccess();
  75             } else if (cpu.equals("amd64")) {
  76                 access = new SolarisAMD64JavaThreadPDAccess();
  77             }
  78         } else if (os.equals("win32")) {
  79             if (cpu.equals("x86")) {
  80                 access =  new Win32X86JavaThreadPDAccess();
  81             } else if (cpu.equals("amd64")) {
  82                 access =  new Win32AMD64JavaThreadPDAccess();
  83             }
  84         } else if (os.equals("linux")) {
  85             if (cpu.equals("x86")) {
  86                 access = new LinuxX86JavaThreadPDAccess();
  87             } else if (cpu.equals("amd64")) {
  88                 access = new LinuxAMD64JavaThreadPDAccess();
  89             } else if (cpu.equals("sparc")) {
  90                 access = new LinuxSPARCJavaThreadPDAccess();
  91             } else if (cpu.equals("aarch64")) {
  92                 access = new LinuxAARCH64JavaThreadPDAccess();
  93             } else {
  94               try {
  95                 access = (JavaThreadPDAccess)
  96                   Class.forName("sun.jvm.hotspot.runtime.linux_" +
  97                      cpu.toLowerCase() + ".Linux" + cpu.toUpperCase() +
  98                      "JavaThreadPDAccess").newInstance();
  99               } catch (Exception e) {
 100                 throw new RuntimeException("OS/CPU combination " + os + "/" + cpu +
 101                                            " not yet supported");
 102               }
 103             }
 104         } else if (os.equals("bsd")) {
 105             if (cpu.equals("x86")) {
 106                 access = new BsdX86JavaThreadPDAccess();
 107             } else if (cpu.equals("amd64") || cpu.equals("x86_64")) {
 108                 access = new BsdAMD64JavaThreadPDAccess();
 109             }
 110         } else if (os.equals("darwin")) {
 111             if (cpu.equals("amd64") || cpu.equals("x86_64")) {
 112                 access = new BsdAMD64JavaThreadPDAccess();


< prev index next >