test/testlibrary/whitebox/sun/hotspot/WhiteBox.java

Print this page
rev 4560 : 8006088: Incompatible heap size flags accepted by VM
Summary: Make processing of minimum, initial and maximum heap size more intiutive by removing previous limitations on allowed values, and make error reporting consistent. Further, fix errors in ergonomic heap sizing.
Reviewed-by: johnc, jwilhelm, tamao


  44   /**
  45    * Returns the singleton WhiteBox instance.
  46    *
  47    * The returned WhiteBox object should be carefully guarded
  48    * by the caller, since it can be used to read and write data
  49    * at arbitrary memory addresses. It must never be passed to
  50    * untrusted code.
  51    */
  52   public synchronized static WhiteBox getWhiteBox() {
  53     SecurityManager sm = System.getSecurityManager();
  54     if (sm != null) {
  55       sm.checkPermission(new WhiteBoxPermission("getInstance"));
  56     }
  57     return instance;
  58   }
  59 
  60   static {
  61     registerNatives();
  62   }
  63 



  64   // Memory
  65   public native long getObjectAddress(Object o);
  66   public native int  getHeapOopSize();
  67 
  68   // Runtime
  69   // Make sure class name is in the correct format
  70   public boolean isClassAlive(String name) {
  71     return isClassAlive0(name.replace('.', '/'));
  72   }
  73   private native boolean isClassAlive0(String name);
  74 
  75   // G1
  76   public native boolean g1InConcurrentMark();
  77   public native boolean g1IsHumongous(Object o);
  78   public native long    g1NumFreeRegions();
  79   public native int     g1RegionSize();
  80   public native Object[]    parseCommandLine(String commandline, DiagnosticCommand[] args);
  81 
  82   // NMT
  83   public native long NMTMalloc(long size);




  44   /**
  45    * Returns the singleton WhiteBox instance.
  46    *
  47    * The returned WhiteBox object should be carefully guarded
  48    * by the caller, since it can be used to read and write data
  49    * at arbitrary memory addresses. It must never be passed to
  50    * untrusted code.
  51    */
  52   public synchronized static WhiteBox getWhiteBox() {
  53     SecurityManager sm = System.getSecurityManager();
  54     if (sm != null) {
  55       sm.checkPermission(new WhiteBoxPermission("getInstance"));
  56     }
  57     return instance;
  58   }
  59 
  60   static {
  61     registerNatives();
  62   }
  63 
  64   // Arguments
  65   public native void printHeapSizes();
  66 
  67   // Memory
  68   public native long getObjectAddress(Object o);
  69   public native int  getHeapOopSize();
  70 
  71   // Runtime
  72   // Make sure class name is in the correct format
  73   public boolean isClassAlive(String name) {
  74     return isClassAlive0(name.replace('.', '/'));
  75   }
  76   private native boolean isClassAlive0(String name);
  77 
  78   // G1
  79   public native boolean g1InConcurrentMark();
  80   public native boolean g1IsHumongous(Object o);
  81   public native long    g1NumFreeRegions();
  82   public native int     g1RegionSize();
  83   public native Object[]    parseCommandLine(String commandline, DiagnosticCommand[] args);
  84 
  85   // NMT
  86   public native long NMTMalloc(long size);