Mercurial > hg > truffle
comparison agent/src/share/classes/sun/jvm/hotspot/runtime/VM.java @ 3945:8ed53447f690
Merge
author | iveresov |
---|---|
date | Thu, 15 Sep 2011 12:44:09 -0700 |
parents | 35c656d0b685 |
children | 1d7922586cf6 |
comparison
equal
deleted
inserted
replaced
3929:f94227b6117b | 3945:8ed53447f690 |
---|---|
133 public static final class Flag { | 133 public static final class Flag { |
134 private String type; | 134 private String type; |
135 private String name; | 135 private String name; |
136 private Address addr; | 136 private Address addr; |
137 private String kind; | 137 private String kind; |
138 | 138 private int origin; |
139 private Flag(String type, String name, Address addr, String kind) { | 139 |
140 private Flag(String type, String name, Address addr, String kind, int origin) { | |
140 this.type = type; | 141 this.type = type; |
141 this.name = name; | 142 this.name = name; |
142 this.addr = addr; | 143 this.addr = addr; |
143 this.kind = kind; | 144 this.kind = kind; |
145 this.origin = origin; | |
144 } | 146 } |
145 | 147 |
146 public String getType() { | 148 public String getType() { |
147 return type; | 149 return type; |
148 } | 150 } |
155 return addr; | 157 return addr; |
156 } | 158 } |
157 | 159 |
158 public String getKind() { | 160 public String getKind() { |
159 return kind; | 161 return kind; |
162 } | |
163 | |
164 public int getOrigin() { | |
165 return origin; | |
160 } | 166 } |
161 | 167 |
162 public boolean isBool() { | 168 public boolean isBool() { |
163 return type.equals("bool"); | 169 return type.equals("bool"); |
164 } | 170 } |
302 // Neither C1 nor C2 is present | 308 // Neither C1 nor C2 is present |
303 usingClientCompiler = false; | 309 usingClientCompiler = false; |
304 usingServerCompiler = false; | 310 usingServerCompiler = false; |
305 } else { | 311 } else { |
306 // Determine whether C2 is present | 312 // Determine whether C2 is present |
307 if (type.getField("_interpreter_invocation_count", false, false) != null) { | 313 if (db.lookupType("Matcher", false) != null) { |
308 usingServerCompiler = true; | 314 usingServerCompiler = true; |
309 } else { | 315 } else { |
310 usingClientCompiler = true; | 316 usingClientCompiler = true; |
311 } | 317 } |
312 } | 318 } |
802 } | 808 } |
803 | 809 |
804 private void readCommandLineFlags() { | 810 private void readCommandLineFlags() { |
805 // get command line flags | 811 // get command line flags |
806 TypeDataBase db = getTypeDataBase(); | 812 TypeDataBase db = getTypeDataBase(); |
807 try { | 813 Type flagType = db.lookupType("Flag"); |
808 Type flagType = db.lookupType("Flag"); | 814 int numFlags = (int) flagType.getCIntegerField("numFlags").getValue(); |
809 int numFlags = (int) flagType.getCIntegerField("numFlags").getValue(); | 815 // NOTE: last flag contains null values. |
810 // NOTE: last flag contains null values. | 816 commandLineFlags = new Flag[numFlags - 1]; |
811 commandLineFlags = new Flag[numFlags - 1]; | 817 |
812 | 818 Address flagAddr = flagType.getAddressField("flags").getValue(); |
813 Address flagAddr = flagType.getAddressField("flags").getValue(); | 819 |
814 | 820 AddressField typeFld = flagType.getAddressField("type"); |
815 AddressField typeFld = flagType.getAddressField("type"); | 821 AddressField nameFld = flagType.getAddressField("name"); |
816 AddressField nameFld = flagType.getAddressField("name"); | 822 AddressField addrFld = flagType.getAddressField("addr"); |
817 AddressField addrFld = flagType.getAddressField("addr"); | 823 AddressField kindFld = flagType.getAddressField("kind"); |
818 AddressField kindFld = flagType.getAddressField("kind"); | 824 CIntField originFld = new CIntField(flagType.getCIntegerField("origin"), 0); |
819 | 825 |
820 long flagSize = flagType.getSize(); // sizeof(Flag) | 826 long flagSize = flagType.getSize(); // sizeof(Flag) |
821 | 827 |
822 // NOTE: last flag contains null values. | 828 // NOTE: last flag contains null values. |
823 for (int f = 0; f < numFlags - 1; f++) { | 829 for (int f = 0; f < numFlags - 1; f++) { |
824 String type = CStringUtilities.getString(typeFld.getValue(flagAddr)); | 830 String type = CStringUtilities.getString(typeFld.getValue(flagAddr)); |
825 String name = CStringUtilities.getString(nameFld.getValue(flagAddr)); | 831 String name = CStringUtilities.getString(nameFld.getValue(flagAddr)); |
826 Address addr = addrFld.getValue(flagAddr); | 832 Address addr = addrFld.getValue(flagAddr); |
827 String kind = CStringUtilities.getString(kindFld.getValue(flagAddr)); | 833 String kind = CStringUtilities.getString(kindFld.getValue(flagAddr)); |
828 commandLineFlags[f] = new Flag(type, name, addr, kind); | 834 int origin = (int)originFld.getValue(flagAddr); |
829 flagAddr = flagAddr.addOffsetTo(flagSize); | 835 commandLineFlags[f] = new Flag(type, name, addr, kind, origin); |
830 } | 836 flagAddr = flagAddr.addOffsetTo(flagSize); |
831 | 837 } |
832 // sort flags by name | 838 |
833 Arrays.sort(commandLineFlags, new Comparator() { | 839 // sort flags by name |
834 public int compare(Object o1, Object o2) { | 840 Arrays.sort(commandLineFlags, new Comparator() { |
835 Flag f1 = (Flag) o1; | 841 public int compare(Object o1, Object o2) { |
836 Flag f2 = (Flag) o2; | 842 Flag f1 = (Flag) o1; |
837 return f1.getName().compareTo(f2.getName()); | 843 Flag f2 = (Flag) o2; |
838 } | 844 return f1.getName().compareTo(f2.getName()); |
839 }); | 845 } |
840 } catch (Exception exp) { | 846 }); |
841 // ignore. may be older version. command line flags not available. | |
842 } | |
843 } | 847 } |
844 | 848 |
845 public String getSystemProperty(String key) { | 849 public String getSystemProperty(String key) { |
846 Properties props = getSystemProperties(); | 850 Properties props = getSystemProperties(); |
847 return (props != null)? props.getProperty(key) : null; | 851 return (props != null)? props.getProperty(key) : null; |