< prev index next >

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

Print this page
rev 6864 : 8061651: Interface to the Lookup Index Cache to improve URLClassPath search time
Summary: Implemented the interface in sun.misc.URLClassPath and corresponding JVM_XXX APIs
Reviewed-by: mchung, acorn, jiangli, dholmes


  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  *
  23  */
  24 
  25 package sun.hotspot;
  26 
  27 import java.lang.reflect.Executable;
  28 import java.util.Arrays;
  29 import java.util.List;
  30 import java.util.function.Function;
  31 import java.util.stream.Stream;
  32 import java.security.BasicPermission;

  33 
  34 import sun.hotspot.parser.DiagnosticCommand;
  35 
  36 public class WhiteBox {
  37 
  38   @SuppressWarnings("serial")
  39   public static class WhiteBoxPermission extends BasicPermission {
  40     public WhiteBoxPermission(String s) {
  41       super(s);
  42     }
  43   }
  44 
  45   private WhiteBox() {}
  46   private static final WhiteBox instance = new WhiteBox();
  47   private static native void registerNatives();
  48 
  49   /**
  50    * Returns the singleton WhiteBox instance.
  51    *
  52    * The returned WhiteBox object should be carefully guarded


  67   }
  68 
  69   // Get the maximum heap size supporting COOPs
  70   public native long getCompressedOopsMaxHeapSize();
  71   // Arguments
  72   public native void printHeapSizes();
  73 
  74   // Memory
  75   public native long getObjectAddress(Object o);
  76   public native int  getHeapOopSize();
  77   public native boolean isObjectInOldGen(Object o);
  78   public native long getObjectSize(Object o);
  79 
  80   // Runtime
  81   // Make sure class name is in the correct format
  82   public boolean isClassAlive(String name) {
  83     return isClassAlive0(name.replace('.', '/'));
  84   }
  85   private native boolean isClassAlive0(String name);
  86 





  87   // G1
  88   public native boolean g1InConcurrentMark();
  89   public native boolean g1IsHumongous(Object o);
  90   public native long    g1NumFreeRegions();
  91   public native int     g1RegionSize();
  92   public native Object[]    parseCommandLine(String commandline, DiagnosticCommand[] args);
  93 
  94   // NMT
  95   public native long NMTMalloc(long size);
  96   public native void NMTFree(long mem);
  97   public native long NMTReserveMemory(long size);
  98   public native void NMTCommitMemory(long addr, long size);
  99   public native void NMTUncommitMemory(long addr, long size);
 100   public native void NMTReleaseMemory(long addr, long size);
 101   public native void NMTOverflowHashBucket(long num);
 102   public native long NMTMallocWithPseudoStack(long size, int index);
 103   public native boolean NMTIsDetailSupported();
 104   public native boolean NMTChangeTrackingLevel();
 105 
 106   // Compiler




  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  *
  23  */
  24 
  25 package sun.hotspot;
  26 
  27 import java.lang.reflect.Executable;
  28 import java.util.Arrays;
  29 import java.util.List;
  30 import java.util.function.Function;
  31 import java.util.stream.Stream;
  32 import java.security.BasicPermission;
  33 import java.net.URL;
  34 
  35 import sun.hotspot.parser.DiagnosticCommand;
  36 
  37 public class WhiteBox {
  38 
  39   @SuppressWarnings("serial")
  40   public static class WhiteBoxPermission extends BasicPermission {
  41     public WhiteBoxPermission(String s) {
  42       super(s);
  43     }
  44   }
  45 
  46   private WhiteBox() {}
  47   private static final WhiteBox instance = new WhiteBox();
  48   private static native void registerNatives();
  49 
  50   /**
  51    * Returns the singleton WhiteBox instance.
  52    *
  53    * The returned WhiteBox object should be carefully guarded


  68   }
  69 
  70   // Get the maximum heap size supporting COOPs
  71   public native long getCompressedOopsMaxHeapSize();
  72   // Arguments
  73   public native void printHeapSizes();
  74 
  75   // Memory
  76   public native long getObjectAddress(Object o);
  77   public native int  getHeapOopSize();
  78   public native boolean isObjectInOldGen(Object o);
  79   public native long getObjectSize(Object o);
  80 
  81   // Runtime
  82   // Make sure class name is in the correct format
  83   public boolean isClassAlive(String name) {
  84     return isClassAlive0(name.replace('.', '/'));
  85   }
  86   private native boolean isClassAlive0(String name);
  87 
  88   // Resource/Class Lookup Cache
  89   public native boolean classKnownToNotExist(ClassLoader loader, String name);
  90   public native URL[] getLookupCacheURLs(ClassLoader loader);
  91   public native int[] getLookupCacheMatches(ClassLoader loader, String name);
  92 
  93   // G1
  94   public native boolean g1InConcurrentMark();
  95   public native boolean g1IsHumongous(Object o);
  96   public native long    g1NumFreeRegions();
  97   public native int     g1RegionSize();
  98   public native Object[]    parseCommandLine(String commandline, DiagnosticCommand[] args);
  99 
 100   // NMT
 101   public native long NMTMalloc(long size);
 102   public native void NMTFree(long mem);
 103   public native long NMTReserveMemory(long size);
 104   public native void NMTCommitMemory(long addr, long size);
 105   public native void NMTUncommitMemory(long addr, long size);
 106   public native void NMTReleaseMemory(long addr, long size);
 107   public native void NMTOverflowHashBucket(long num);
 108   public native long NMTMallocWithPseudoStack(long size, int index);
 109   public native boolean NMTIsDetailSupported();
 110   public native boolean NMTChangeTrackingLevel();
 111 
 112   // Compiler


< prev index next >