hotspot/agent/src/share/classes/sun/jvm/hotspot/oops/OopUtilities.java
changeset 27654 4e508c2376f7
parent 25335 2557b9b45520
child 33628 09241459a8b8
equal deleted inserted replaced
27621:854d2d4d3077 27654:4e508c2376f7
   217 
   217 
   218   private static void initThreadFields() {
   218   private static void initThreadFields() {
   219     if (threadNameField == null) {
   219     if (threadNameField == null) {
   220       SystemDictionary sysDict = VM.getVM().getSystemDictionary();
   220       SystemDictionary sysDict = VM.getVM().getSystemDictionary();
   221       InstanceKlass k = sysDict.getThreadKlass();
   221       InstanceKlass k = sysDict.getThreadKlass();
   222       threadNameField  = (OopField) k.findField("name", "[C");
   222       threadNameField  = (OopField) k.findField("name", "Ljava/lang/String;");
   223       threadGroupField = (OopField) k.findField("group", "Ljava/lang/ThreadGroup;");
   223       threadGroupField = (OopField) k.findField("group", "Ljava/lang/ThreadGroup;");
   224       threadEETopField = (LongField) k.findField("eetop", "J");
   224       threadEETopField = (LongField) k.findField("eetop", "J");
   225       threadTIDField = (LongField) k.findField("tid", "J");
   225       threadTIDField = (LongField) k.findField("tid", "J");
   226       threadStatusField = (IntField) k.findField("threadStatus", "I");
   226       threadStatusField = (IntField) k.findField("threadStatus", "I");
   227       threadParkBlockerField = (OopField) k.findField("parkBlocker",
   227       threadParkBlockerField = (OopField) k.findField("parkBlocker",
   256     return threadGroupField.getValue(threadOop);
   256     return threadGroupField.getValue(threadOop);
   257   }
   257   }
   258 
   258 
   259   public static String threadOopGetName(Oop threadOop) {
   259   public static String threadOopGetName(Oop threadOop) {
   260     initThreadFields();
   260     initThreadFields();
   261     return charArrayToString((TypeArray) threadNameField.getValue(threadOop));
   261     return stringOopToString(threadNameField.getValue(threadOop));
   262   }
   262   }
   263 
   263 
   264   /** May return null if, e.g., thread was not started */
   264   /** May return null if, e.g., thread was not started */
   265   public static JavaThread threadOopGetJavaThread(Oop threadOop) {
   265   public static JavaThread threadOopGetJavaThread(Oop threadOop) {
   266     initThreadFields();
   266     initThreadFields();