agent/src/share/classes/sun/jvm/hotspot/runtime/VM.java
Index Unified diffs Context diffs Sdiffs Patch New Old Previous File Next File 8024545 Sdiff agent/src/share/classes/sun/jvm/hotspot/runtime

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

Print this page




 117 
 118   // VM version strings come from Abstract_VM_Version class
 119   private String       vmRelease;
 120   private String       vmInternalInfo;
 121 
 122   private Flag[] commandLineFlags;
 123   private Map flagsMap;
 124 
 125   private static Type intxType;
 126   private static Type uintxType;
 127   private static CIntegerType boolType;
 128   private Boolean sharingEnabled;
 129   private Boolean compressedOopsEnabled;
 130   private Boolean compressedKlassPointersEnabled;
 131 
 132   // command line flags supplied to VM - see struct Flag in globals.hpp
 133   public static final class Flag {
 134      private String type;
 135      private String name;
 136      private Address addr;
 137      private String kind;
 138      private int origin;
 139 
 140      private Flag(String type, String name, Address addr, String kind, int origin) {
 141         this.type = type;
 142         this.name = name;
 143         this.addr = addr;
 144         this.kind = kind;
 145         this.origin = origin;
 146      }
 147 
 148      public String getType() {
 149         return type;
 150      }
 151 
 152      public String getName() {
 153         return name;
 154      }
 155 
 156      public Address getAddress() {
 157         return addr;
 158      }
 159 
 160      public String getKind() {
 161         return kind;
 162      }
 163 
 164      public int getOrigin() {
 165         return origin;
 166      }
 167 
 168      public boolean isBool() {
 169         return type.equals("bool");
 170      }
 171 
 172      public boolean getBool() {
 173         if (Assert.ASSERTS_ENABLED) {
 174            Assert.that(isBool(), "not a bool flag!");
 175         }
 176         return addr.getCIntegerAt(0, boolType.getSize(), boolType.isUnsigned())
 177                != 0;
 178      }
 179 
 180      public boolean isIntx() {
 181         return type.equals("intx");
 182      }
 183 
 184      public long getIntx() {
 185         if (Assert.ASSERTS_ENABLED) {
 186            Assert.that(isIntx(), "not a intx flag!");
 187         }
 188         return addr.getCIntegerAt(0, intxType.getSize(), false);
 189      }
 190 
 191      public boolean isUIntx() {
 192         return type.equals("uintx");
 193      }
 194 
 195      public long getUIntx() {
 196         if (Assert.ASSERTS_ENABLED) {
 197            Assert.that(isUIntx(), "not a uintx flag!");


 826     if (flagsMap == null) {
 827       flagsMap = new HashMap();
 828       Flag[] flags = getCommandLineFlags();
 829       for (int i = 0; i < flags.length; i++) {
 830         flagsMap.put(flags[i].getName(), flags[i]);
 831       }
 832     }
 833     return (Flag) flagsMap.get(name);
 834   }
 835 
 836   private void readCommandLineFlags() {
 837     // get command line flags
 838     TypeDataBase db = getTypeDataBase();
 839     Type flagType = db.lookupType("Flag");
 840     int numFlags = (int) flagType.getCIntegerField("numFlags").getValue();
 841     // NOTE: last flag contains null values.
 842     commandLineFlags = new Flag[numFlags - 1];
 843 
 844     Address flagAddr = flagType.getAddressField("flags").getValue();
 845 
 846     AddressField typeFld = flagType.getAddressField("type");
 847     AddressField nameFld = flagType.getAddressField("name");
 848     AddressField addrFld = flagType.getAddressField("addr");
 849     AddressField kindFld = flagType.getAddressField("kind");
 850     CIntField originFld = new CIntField(flagType.getCIntegerField("origin"), 0);
 851 
 852     long flagSize = flagType.getSize(); // sizeof(Flag)
 853 
 854     // NOTE: last flag contains null values.
 855     for (int f = 0; f < numFlags - 1; f++) {
 856       String type = CStringUtilities.getString(typeFld.getValue(flagAddr));
 857       String name = CStringUtilities.getString(nameFld.getValue(flagAddr));
 858       Address addr = addrFld.getValue(flagAddr);
 859       String kind = CStringUtilities.getString(kindFld.getValue(flagAddr));
 860       int origin = (int)originFld.getValue(flagAddr);
 861       commandLineFlags[f] = new Flag(type, name, addr, kind, origin);
 862       flagAddr = flagAddr.addOffsetTo(flagSize);
 863     }
 864 
 865     // sort flags by name
 866     Arrays.sort(commandLineFlags, new Comparator() {
 867         public int compare(Object o1, Object o2) {
 868           Flag f1 = (Flag) o1;
 869           Flag f2 = (Flag) o2;
 870           return f1.getName().compareTo(f2.getName());
 871         }
 872       });
 873   }
 874 
 875   public String getSystemProperty(String key) {
 876     Properties props = getSystemProperties();
 877     return (props != null)? props.getProperty(key) : null;
 878   }
 879 
 880   public Properties getSystemProperties() {
 881     if (sysProps == null) {




 117 
 118   // VM version strings come from Abstract_VM_Version class
 119   private String       vmRelease;
 120   private String       vmInternalInfo;
 121 
 122   private Flag[] commandLineFlags;
 123   private Map flagsMap;
 124 
 125   private static Type intxType;
 126   private static Type uintxType;
 127   private static CIntegerType boolType;
 128   private Boolean sharingEnabled;
 129   private Boolean compressedOopsEnabled;
 130   private Boolean compressedKlassPointersEnabled;
 131 
 132   // command line flags supplied to VM - see struct Flag in globals.hpp
 133   public static final class Flag {
 134      private String type;
 135      private String name;
 136      private Address addr;
 137      private int flags;

 138 
 139      private Flag(String type, String name, Address addr, int flags) {
 140         this.type = type;
 141         this.name = name;
 142         this.addr = addr;
 143         this.flags = flags;

 144      }
 145 
 146      public String getType() {
 147         return type;
 148      }
 149 
 150      public String getName() {
 151         return name;
 152      }
 153 
 154      public Address getAddress() {
 155         return addr;
 156      }
 157 




 158      public int getOrigin() {
 159         return flags & 0xF;  // XXX can we get the mask bits from somewhere?
 160      }
 161 
 162      public boolean isBool() {
 163         return type.equals("bool");
 164      }
 165 
 166      public boolean getBool() {
 167         if (Assert.ASSERTS_ENABLED) {
 168            Assert.that(isBool(), "not a bool flag!");
 169         }
 170         return addr.getCIntegerAt(0, boolType.getSize(), boolType.isUnsigned()) != 0;

 171      }
 172 
 173      public boolean isIntx() {
 174         return type.equals("intx");
 175      }
 176 
 177      public long getIntx() {
 178         if (Assert.ASSERTS_ENABLED) {
 179            Assert.that(isIntx(), "not a intx flag!");
 180         }
 181         return addr.getCIntegerAt(0, intxType.getSize(), false);
 182      }
 183 
 184      public boolean isUIntx() {
 185         return type.equals("uintx");
 186      }
 187 
 188      public long getUIntx() {
 189         if (Assert.ASSERTS_ENABLED) {
 190            Assert.that(isUIntx(), "not a uintx flag!");


 819     if (flagsMap == null) {
 820       flagsMap = new HashMap();
 821       Flag[] flags = getCommandLineFlags();
 822       for (int i = 0; i < flags.length; i++) {
 823         flagsMap.put(flags[i].getName(), flags[i]);
 824       }
 825     }
 826     return (Flag) flagsMap.get(name);
 827   }
 828 
 829   private void readCommandLineFlags() {
 830     // get command line flags
 831     TypeDataBase db = getTypeDataBase();
 832     Type flagType = db.lookupType("Flag");
 833     int numFlags = (int) flagType.getCIntegerField("numFlags").getValue();
 834     // NOTE: last flag contains null values.
 835     commandLineFlags = new Flag[numFlags - 1];
 836 
 837     Address flagAddr = flagType.getAddressField("flags").getValue();
 838 
 839     AddressField typeFld = flagType.getAddressField("_type");
 840     AddressField nameFld = flagType.getAddressField("_name");
 841     AddressField addrFld = flagType.getAddressField("_addr");
 842     CIntField flagsFld = new CIntField(flagType.getCIntegerField("_flags"), 0);

 843 
 844     long flagSize = flagType.getSize(); // sizeof(Flag)
 845 
 846     // NOTE: last flag contains null values.
 847     for (int f = 0; f < numFlags - 1; f++) {
 848       String type = CStringUtilities.getString(typeFld.getValue(flagAddr));
 849       String name = CStringUtilities.getString(nameFld.getValue(flagAddr));
 850       Address addr = addrFld.getValue(flagAddr);
 851       int flags = (int)flagsFld.getValue(flagAddr);
 852       commandLineFlags[f] = new Flag(type, name, addr, flags);

 853       flagAddr = flagAddr.addOffsetTo(flagSize);
 854     }
 855 
 856     // sort flags by name
 857     Arrays.sort(commandLineFlags, new Comparator() {
 858         public int compare(Object o1, Object o2) {
 859           Flag f1 = (Flag) o1;
 860           Flag f2 = (Flag) o2;
 861           return f1.getName().compareTo(f2.getName());
 862         }
 863       });
 864   }
 865 
 866   public String getSystemProperty(String key) {
 867     Properties props = getSystemProperties();
 868     return (props != null)? props.getProperty(key) : null;
 869   }
 870 
 871   public Properties getSystemProperties() {
 872     if (sysProps == null) {


agent/src/share/classes/sun/jvm/hotspot/runtime/VM.java
Index Unified diffs Context diffs Sdiffs Patch New Old Previous File Next File