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

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

Print this page


   1 /*
   2  * Copyright (c) 2000, 2017, Oracle and/or its affiliates. All rights reserved.
   3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
   4  *
   5  * This code is free software; you can redistribute it and/or modify it
   6  * under the terms of the GNU General Public License version 2 only, as
   7  * published by the Free Software Foundation.
   8  *
   9  * This code is distributed in the hope that it will be useful, but WITHOUT
  10  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  11  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  12  * version 2 for more details (a copy is included in the LICENSE file that
  13  * accompanied this code).
  14  *
  15  * You should have received a copy of the GNU General Public License version
  16  * 2 along with this work; if not, write to the Free Software Foundation,
  17  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  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  *


 119   // System.getProperties from debuggee VM
 120   private Properties   sysProps;
 121 
 122   // VM version strings come from Abstract_VM_Version class
 123   private String       vmRelease;
 124   private String       vmInternalInfo;
 125 
 126   private Flag[] commandLineFlags;
 127   private Map flagsMap;
 128 
 129   private static Type intType;
 130   private static Type uintType;
 131   private static Type intxType;
 132   private static Type uintxType;
 133   private static Type sizetType;
 134   private static CIntegerType boolType;
 135   private Boolean sharingEnabled;
 136   private Boolean compressedOopsEnabled;
 137   private Boolean compressedKlassPointersEnabled;
 138 
 139   // command line flags supplied to VM - see struct Flag in globals.hpp
 140   public static final class Flag {
 141      private String type;
 142      private String name;
 143      private Address addr;
 144      private int flags;
 145 
 146      private Flag(String type, String name, Address addr, int flags) {
 147         this.type = type;
 148         this.name = name;
 149         this.addr = addr;
 150         this.flags = flags;
 151      }
 152 
 153      public String getType() {
 154         return type;
 155      }
 156 
 157      public String getName() {
 158         return name;
 159      }


 888        readCommandLineFlags();
 889     }
 890 
 891     return commandLineFlags;
 892   }
 893 
 894   public Flag getCommandLineFlag(String name) {
 895     if (flagsMap == null) {
 896       flagsMap = new HashMap();
 897       Flag[] flags = getCommandLineFlags();
 898       for (int i = 0; i < flags.length; i++) {
 899         flagsMap.put(flags[i].getName(), flags[i]);
 900       }
 901     }
 902     return (Flag) flagsMap.get(name);
 903   }
 904 
 905   private void readCommandLineFlags() {
 906     // get command line flags
 907     TypeDataBase db = getTypeDataBase();
 908     Type flagType = db.lookupType("Flag");
 909     int numFlags = (int) flagType.getCIntegerField("numFlags").getValue();
 910     // NOTE: last flag contains null values.
 911     commandLineFlags = new Flag[numFlags - 1];
 912 
 913     Address flagAddr = flagType.getAddressField("flags").getValue();
 914 
 915     AddressField typeFld = flagType.getAddressField("_type");
 916     AddressField nameFld = flagType.getAddressField("_name");
 917     AddressField addrFld = flagType.getAddressField("_addr");
 918     CIntField flagsFld = new CIntField(flagType.getCIntegerField("_flags"), 0);
 919 
 920     long flagSize = flagType.getSize(); // sizeof(Flag)
 921 
 922     // NOTE: last flag contains null values.
 923     for (int f = 0; f < numFlags - 1; f++) {
 924       String type = CStringUtilities.getString(typeFld.getValue(flagAddr));
 925       String name = CStringUtilities.getString(nameFld.getValue(flagAddr));
 926       Address addr = addrFld.getValue(flagAddr);
 927       int flags = (int)flagsFld.getValue(flagAddr);
 928       commandLineFlags[f] = new Flag(type, name, addr, flags);


   1 /*
   2  * Copyright (c) 2000, 2018, Oracle and/or its affiliates. All rights reserved.
   3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
   4  *
   5  * This code is free software; you can redistribute it and/or modify it
   6  * under the terms of the GNU General Public License version 2 only, as
   7  * published by the Free Software Foundation.
   8  *
   9  * This code is distributed in the hope that it will be useful, but WITHOUT
  10  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  11  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  12  * version 2 for more details (a copy is included in the LICENSE file that
  13  * accompanied this code).
  14  *
  15  * You should have received a copy of the GNU General Public License version
  16  * 2 along with this work; if not, write to the Free Software Foundation,
  17  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  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  *


 119   // System.getProperties from debuggee VM
 120   private Properties   sysProps;
 121 
 122   // VM version strings come from Abstract_VM_Version class
 123   private String       vmRelease;
 124   private String       vmInternalInfo;
 125 
 126   private Flag[] commandLineFlags;
 127   private Map flagsMap;
 128 
 129   private static Type intType;
 130   private static Type uintType;
 131   private static Type intxType;
 132   private static Type uintxType;
 133   private static Type sizetType;
 134   private static CIntegerType boolType;
 135   private Boolean sharingEnabled;
 136   private Boolean compressedOopsEnabled;
 137   private Boolean compressedKlassPointersEnabled;
 138 
 139   // command line flags supplied to VM - see struct JVMFlag in jvmFlag.hpp
 140   public static final class Flag {
 141      private String type;
 142      private String name;
 143      private Address addr;
 144      private int flags;
 145 
 146      private Flag(String type, String name, Address addr, int flags) {
 147         this.type = type;
 148         this.name = name;
 149         this.addr = addr;
 150         this.flags = flags;
 151      }
 152 
 153      public String getType() {
 154         return type;
 155      }
 156 
 157      public String getName() {
 158         return name;
 159      }


 888        readCommandLineFlags();
 889     }
 890 
 891     return commandLineFlags;
 892   }
 893 
 894   public Flag getCommandLineFlag(String name) {
 895     if (flagsMap == null) {
 896       flagsMap = new HashMap();
 897       Flag[] flags = getCommandLineFlags();
 898       for (int i = 0; i < flags.length; i++) {
 899         flagsMap.put(flags[i].getName(), flags[i]);
 900       }
 901     }
 902     return (Flag) flagsMap.get(name);
 903   }
 904 
 905   private void readCommandLineFlags() {
 906     // get command line flags
 907     TypeDataBase db = getTypeDataBase();
 908     Type flagType = db.lookupType("JVMFlag");
 909     int numFlags = (int) flagType.getCIntegerField("numFlags").getValue();
 910     // NOTE: last flag contains null values.
 911     commandLineFlags = new Flag[numFlags - 1];
 912 
 913     Address flagAddr = flagType.getAddressField("flags").getValue();
 914 
 915     AddressField typeFld = flagType.getAddressField("_type");
 916     AddressField nameFld = flagType.getAddressField("_name");
 917     AddressField addrFld = flagType.getAddressField("_addr");
 918     CIntField flagsFld = new CIntField(flagType.getCIntegerField("_flags"), 0);
 919 
 920     long flagSize = flagType.getSize(); // sizeof(Flag)
 921 
 922     // NOTE: last flag contains null values.
 923     for (int f = 0; f < numFlags - 1; f++) {
 924       String type = CStringUtilities.getString(typeFld.getValue(flagAddr));
 925       String name = CStringUtilities.getString(nameFld.getValue(flagAddr));
 926       Address addr = addrFld.getValue(flagAddr);
 927       int flags = (int)flagsFld.getValue(flagAddr);
 928       commandLineFlags[f] = new Flag(type, name, addr, flags);


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