hotspot/agent/src/share/classes/sun/jvm/hotspot/runtime/VM.java
changeset 13969 d2a189b83b87
parent 13873 7b72e3873785
child 15486 61b414c85d2f
equal deleted inserted replaced
13968:8c9029c01470 13969:d2a189b83b87
   101   private int          objectAlignmentInBytes;
   101   private int          objectAlignmentInBytes;
   102   private int          minObjAlignmentInBytes;
   102   private int          minObjAlignmentInBytes;
   103   private int          logMinObjAlignmentInBytes;
   103   private int          logMinObjAlignmentInBytes;
   104   private int          heapWordSize;
   104   private int          heapWordSize;
   105   private int          heapOopSize;
   105   private int          heapOopSize;
       
   106   private int          klassPtrSize;
   106   private int          oopSize;
   107   private int          oopSize;
   107   /** This is only present in a non-core build */
   108   /** This is only present in a non-core build */
   108   private CodeCache    codeCache;
   109   private CodeCache    codeCache;
   109   /** This is only present in a C1 build */
   110   /** This is only present in a C1 build */
   110   private Runtime1     runtime1;
   111   private Runtime1     runtime1;
   127   private static Type intxType;
   128   private static Type intxType;
   128   private static Type uintxType;
   129   private static Type uintxType;
   129   private static CIntegerType boolType;
   130   private static CIntegerType boolType;
   130   private Boolean sharingEnabled;
   131   private Boolean sharingEnabled;
   131   private Boolean compressedOopsEnabled;
   132   private Boolean compressedOopsEnabled;
   132   private Boolean compressedHeadersEnabled;
   133   private Boolean compressedKlassPointersEnabled;
   133 
   134 
   134   // command line flags supplied to VM - see struct Flag in globals.hpp
   135   // command line flags supplied to VM - see struct Flag in globals.hpp
   135   public static final class Flag {
   136   public static final class Flag {
   136      private String type;
   137      private String type;
   137      private String name;
   138      private String name;
   348       // Size info for oops within java objects is fixed
   349       // Size info for oops within java objects is fixed
   349       heapOopSize = (int)getIntSize();
   350       heapOopSize = (int)getIntSize();
   350     } else {
   351     } else {
   351       heapOopSize = (int)getOopSize();
   352       heapOopSize = (int)getOopSize();
   352     }
   353     }
       
   354 
       
   355     if (isCompressedKlassPointersEnabled()) {
       
   356       klassPtrSize = (int)getIntSize();
       
   357     } else {
       
   358       klassPtrSize = (int)getOopSize(); // same as an oop
       
   359     }
   353   }
   360   }
   354 
   361 
   355   /** This could be used by a reflective runtime system */
   362   /** This could be used by a reflective runtime system */
   356   public static void initialize(TypeDataBase db, boolean isBigEndian) {
   363   public static void initialize(TypeDataBase db, boolean isBigEndian) {
   357     if (soleInstance != null) {
   364     if (soleInstance != null) {
   372 
   379 
   373     for (Iterator iter = vmInitializedObservers.iterator(); iter.hasNext(); ) {
   380     for (Iterator iter = vmInitializedObservers.iterator(); iter.hasNext(); ) {
   374       ((Observer) iter.next()).update(null, null);
   381       ((Observer) iter.next()).update(null, null);
   375     }
   382     }
   376 
   383 
   377     debugger.putHeapConst(soleInstance.getHeapOopSize(), Universe.getNarrowOopBase(),
   384     debugger.putHeapConst(soleInstance.getHeapOopSize(), soleInstance.getKlassPtrSize(),
   378                           Universe.getNarrowOopShift());
   385                           Universe.getNarrowOopBase(), Universe.getNarrowOopShift(),
       
   386                           Universe.getNarrowKlassBase(), Universe.getNarrowKlassShift());
   379   }
   387   }
   380 
   388 
   381   /** This is used by the debugging system */
   389   /** This is used by the debugging system */
   382   public static void shutdown() {
   390   public static void shutdown() {
   383     soleInstance = null;
   391     soleInstance = null;
   534   }
   542   }
   535 
   543 
   536   public int getHeapOopSize() {
   544   public int getHeapOopSize() {
   537     return heapOopSize;
   545     return heapOopSize;
   538   }
   546   }
       
   547 
       
   548   public int getKlassPtrSize() {
       
   549     return klassPtrSize;
       
   550   }
   539   /** Utility routine for getting data structure alignment correct */
   551   /** Utility routine for getting data structure alignment correct */
   540   public long alignUp(long size, long alignment) {
   552   public long alignUp(long size, long alignment) {
   541     return (size + alignment - 1) & ~(alignment - 1);
   553     return (size + alignment - 1) & ~(alignment - 1);
   542   }
   554   }
   543 
   555 
   782              (flag.getBool()? Boolean.TRUE: Boolean.FALSE);
   794              (flag.getBool()? Boolean.TRUE: Boolean.FALSE);
   783     }
   795     }
   784     return compressedOopsEnabled.booleanValue();
   796     return compressedOopsEnabled.booleanValue();
   785   }
   797   }
   786 
   798 
   787   public boolean isCompressedHeadersEnabled() {
   799   public boolean isCompressedKlassPointersEnabled() {
   788     if (compressedHeadersEnabled == null) {
   800     if (compressedKlassPointersEnabled == null) {
   789         Flag flag = getCommandLineFlag("UseCompressedHeaders");
   801         Flag flag = getCommandLineFlag("UseCompressedKlassPointers");
   790         compressedHeadersEnabled = (flag == null) ? Boolean.FALSE:
   802         compressedKlassPointersEnabled = (flag == null) ? Boolean.FALSE:
   791              (flag.getBool()? Boolean.TRUE: Boolean.FALSE);
   803              (flag.getBool()? Boolean.TRUE: Boolean.FALSE);
   792     }
   804     }
   793     return compressedHeadersEnabled.booleanValue();
   805     return compressedKlassPointersEnabled.booleanValue();
   794   }
   806   }
   795 
   807 
   796   public int getObjectAlignmentInBytes() {
   808   public int getObjectAlignmentInBytes() {
   797     if (objectAlignmentInBytes == 0) {
   809     if (objectAlignmentInBytes == 0) {
   798         Flag flag = getCommandLineFlag("ObjectAlignmentInBytes");
   810         Flag flag = getCommandLineFlag("ObjectAlignmentInBytes");