Mercurial > hg > truffle
diff 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 |
line wrap: on
line diff
--- a/agent/src/share/classes/sun/jvm/hotspot/runtime/VM.java Tue Sep 13 20:28:00 2011 -0700 +++ b/agent/src/share/classes/sun/jvm/hotspot/runtime/VM.java Thu Sep 15 12:44:09 2011 -0700 @@ -135,12 +135,14 @@ private String name; private Address addr; private String kind; + private int origin; - private Flag(String type, String name, Address addr, String kind) { + private Flag(String type, String name, Address addr, String kind, int origin) { this.type = type; this.name = name; this.addr = addr; this.kind = kind; + this.origin = origin; } public String getType() { @@ -159,6 +161,10 @@ return kind; } + public int getOrigin() { + return origin; + } + public boolean isBool() { return type.equals("bool"); } @@ -304,7 +310,7 @@ usingServerCompiler = false; } else { // Determine whether C2 is present - if (type.getField("_interpreter_invocation_count", false, false) != null) { + if (db.lookupType("Matcher", false) != null) { usingServerCompiler = true; } else { usingClientCompiler = true; @@ -804,42 +810,40 @@ private void readCommandLineFlags() { // get command line flags TypeDataBase db = getTypeDataBase(); - try { - Type flagType = db.lookupType("Flag"); - int numFlags = (int) flagType.getCIntegerField("numFlags").getValue(); - // NOTE: last flag contains null values. - commandLineFlags = new Flag[numFlags - 1]; + Type flagType = db.lookupType("Flag"); + int numFlags = (int) flagType.getCIntegerField("numFlags").getValue(); + // NOTE: last flag contains null values. + commandLineFlags = new Flag[numFlags - 1]; + + Address flagAddr = flagType.getAddressField("flags").getValue(); - Address flagAddr = flagType.getAddressField("flags").getValue(); + AddressField typeFld = flagType.getAddressField("type"); + AddressField nameFld = flagType.getAddressField("name"); + AddressField addrFld = flagType.getAddressField("addr"); + AddressField kindFld = flagType.getAddressField("kind"); + CIntField originFld = new CIntField(flagType.getCIntegerField("origin"), 0); - AddressField typeFld = flagType.getAddressField("type"); - AddressField nameFld = flagType.getAddressField("name"); - AddressField addrFld = flagType.getAddressField("addr"); - AddressField kindFld = flagType.getAddressField("kind"); - - long flagSize = flagType.getSize(); // sizeof(Flag) + long flagSize = flagType.getSize(); // sizeof(Flag) - // NOTE: last flag contains null values. - for (int f = 0; f < numFlags - 1; f++) { - String type = CStringUtilities.getString(typeFld.getValue(flagAddr)); - String name = CStringUtilities.getString(nameFld.getValue(flagAddr)); - Address addr = addrFld.getValue(flagAddr); - String kind = CStringUtilities.getString(kindFld.getValue(flagAddr)); - commandLineFlags[f] = new Flag(type, name, addr, kind); - flagAddr = flagAddr.addOffsetTo(flagSize); - } + // NOTE: last flag contains null values. + for (int f = 0; f < numFlags - 1; f++) { + String type = CStringUtilities.getString(typeFld.getValue(flagAddr)); + String name = CStringUtilities.getString(nameFld.getValue(flagAddr)); + Address addr = addrFld.getValue(flagAddr); + String kind = CStringUtilities.getString(kindFld.getValue(flagAddr)); + int origin = (int)originFld.getValue(flagAddr); + commandLineFlags[f] = new Flag(type, name, addr, kind, origin); + flagAddr = flagAddr.addOffsetTo(flagSize); + } - // sort flags by name - Arrays.sort(commandLineFlags, new Comparator() { - public int compare(Object o1, Object o2) { - Flag f1 = (Flag) o1; - Flag f2 = (Flag) o2; - return f1.getName().compareTo(f2.getName()); - } - }); - } catch (Exception exp) { - // ignore. may be older version. command line flags not available. - } + // sort flags by name + Arrays.sort(commandLineFlags, new Comparator() { + public int compare(Object o1, Object o2) { + Flag f1 = (Flag) o1; + Flag f2 = (Flag) o2; + return f1.getName().compareTo(f2.getName()); + } + }); } public String getSystemProperty(String key) {