< prev index next >

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

Print this page
rev 8910 : full patch for jfr
   1 /*
   2  * Copyright (c) 2012, 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  *


  61     if (sm != null) {
  62       sm.checkPermission(new WhiteBoxPermission("getInstance"));
  63     }
  64     return instance;
  65   }
  66 
  67   static {
  68     registerNatives();
  69   }
  70 
  71   // Get the maximum heap size supporting COOPs
  72   public native long getCompressedOopsMaxHeapSize();
  73   // Arguments
  74   public native void printHeapSizes();
  75 
  76   // Memory
  77   public native long getObjectAddress(Object o);
  78   public native int  getHeapOopSize();
  79   public native int  getVMPageSize();
  80   public native long getVMLargePageSize();

  81 
  82   public native boolean isObjectInOldGen(Object o);
  83   public native long getObjectSize(Object o);
  84 
  85   // Runtime
  86   // Make sure class name is in the correct format
  87   public boolean isClassAlive(String name) {
  88     return isClassAlive0(name.replace('.', '/'));
  89   }
  90   private native boolean isClassAlive0(String name);
  91   public native boolean isMonitorInflated(Object obj);
  92   public native void forceSafepoint();
  93 
  94   // Resource/Class Lookup Cache
  95   public native boolean classKnownToNotExist(ClassLoader loader, String name);
  96   public native URL[] getLookupCacheURLs(ClassLoader loader);
  97   public native int[] getLookupCacheMatches(ClassLoader loader, String name);
  98 
  99   // JVMTI
 100   public native void addToBootstrapClassLoaderSearch(String segment);


 143     makeMethodNotCompilable(method, -1 /*any*/);
 144   }
 145   public        void    makeMethodNotCompilable(Executable method, int compLevel) {
 146     makeMethodNotCompilable(method, compLevel, false /*not osr*/);
 147   }
 148   public native void    makeMethodNotCompilable(Executable method, int compLevel, boolean isOsr);
 149   public        int     getMethodCompilationLevel(Executable method) {
 150     return getMethodCompilationLevel(method, false /*not ost*/);
 151   }
 152   public native int     getMethodCompilationLevel(Executable method, boolean isOsr);
 153   public native boolean testSetDontInlineMethod(Executable method, boolean value);
 154   public        int     getCompileQueuesSize() {
 155     return getCompileQueueSize(-1 /*any*/);
 156   }
 157   public native int     getCompileQueueSize(int compLevel);
 158   public native boolean testSetForceInlineMethod(Executable method, boolean value);
 159   public        boolean enqueueMethodForCompilation(Executable method, int compLevel) {
 160     return enqueueMethodForCompilation(method, compLevel, -1 /*InvocationEntryBci*/);
 161   }
 162   public native boolean enqueueMethodForCompilation(Executable method, int compLevel, int entry_bci);

 163   public native void    clearMethodState(Executable method);
 164   public native int     getMethodEntryBci(Executable method);
 165   public native Object[] getNMethod(Executable method, boolean isOsr);









 166 
 167   // Intered strings
 168   public native boolean isInStringTable(String str);
 169 
 170   // Memory
 171   public native void readReservedMemory();
 172   public native long allocateMetaspace(ClassLoader classLoader, long size);
 173   public native void freeMetaspace(ClassLoader classLoader, long addr, long size);
 174   public native long incMetaspaceCapacityUntilGC(long increment);
 175   public native long metaspaceCapacityUntilGC();
 176 
 177   // Force Young GC
 178   public native void youngGC();
 179 
 180   // Force Full GC
 181   public native void fullGC();
 182 
 183   // Method tries to start concurrent mark cycle.
 184   // It returns false if CM Thread is always in concurrent cycle.
 185   public native boolean g1StartConcMarkCycle();


   1 /*
   2  * Copyright (c) 2012, 2019, 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  *


  61     if (sm != null) {
  62       sm.checkPermission(new WhiteBoxPermission("getInstance"));
  63     }
  64     return instance;
  65   }
  66 
  67   static {
  68     registerNatives();
  69   }
  70 
  71   // Get the maximum heap size supporting COOPs
  72   public native long getCompressedOopsMaxHeapSize();
  73   // Arguments
  74   public native void printHeapSizes();
  75 
  76   // Memory
  77   public native long getObjectAddress(Object o);
  78   public native int  getHeapOopSize();
  79   public native int  getVMPageSize();
  80   public native long getVMLargePageSize();
  81   public native long getHeapAlignment();
  82 
  83   public native boolean isObjectInOldGen(Object o);
  84   public native long getObjectSize(Object o);
  85 
  86   // Runtime
  87   // Make sure class name is in the correct format
  88   public boolean isClassAlive(String name) {
  89     return isClassAlive0(name.replace('.', '/'));
  90   }
  91   private native boolean isClassAlive0(String name);
  92   public native boolean isMonitorInflated(Object obj);
  93   public native void forceSafepoint();
  94 
  95   // Resource/Class Lookup Cache
  96   public native boolean classKnownToNotExist(ClassLoader loader, String name);
  97   public native URL[] getLookupCacheURLs(ClassLoader loader);
  98   public native int[] getLookupCacheMatches(ClassLoader loader, String name);
  99 
 100   // JVMTI
 101   public native void addToBootstrapClassLoaderSearch(String segment);


 144     makeMethodNotCompilable(method, -1 /*any*/);
 145   }
 146   public        void    makeMethodNotCompilable(Executable method, int compLevel) {
 147     makeMethodNotCompilable(method, compLevel, false /*not osr*/);
 148   }
 149   public native void    makeMethodNotCompilable(Executable method, int compLevel, boolean isOsr);
 150   public        int     getMethodCompilationLevel(Executable method) {
 151     return getMethodCompilationLevel(method, false /*not ost*/);
 152   }
 153   public native int     getMethodCompilationLevel(Executable method, boolean isOsr);
 154   public native boolean testSetDontInlineMethod(Executable method, boolean value);
 155   public        int     getCompileQueuesSize() {
 156     return getCompileQueueSize(-1 /*any*/);
 157   }
 158   public native int     getCompileQueueSize(int compLevel);
 159   public native boolean testSetForceInlineMethod(Executable method, boolean value);
 160   public        boolean enqueueMethodForCompilation(Executable method, int compLevel) {
 161     return enqueueMethodForCompilation(method, compLevel, -1 /*InvocationEntryBci*/);
 162   }
 163   public native boolean enqueueMethodForCompilation(Executable method, int compLevel, int entry_bci);
 164   public native boolean enqueueInitializerForCompilation(Class<?> aClass, int compLevel);
 165   public native void    clearMethodState(Executable method);
 166   public native int     getMethodEntryBci(Executable method);
 167   public native Object[] getNMethod(Executable method, boolean isOsr);
 168   public native long    allocateCodeBlob(int size, int type);
 169   public        long    allocateCodeBlob(long size, int type) {
 170       int intSize = (int) size;
 171       if ((long) intSize != size || size < 0) {
 172           throw new IllegalArgumentException(
 173                 "size argument has illegal value " + size);
 174       }
 175       return allocateCodeBlob( intSize, type);
 176   }
 177 
 178   // Intered strings
 179   public native boolean isInStringTable(String str);
 180 
 181   // Memory
 182   public native void readReservedMemory();
 183   public native long allocateMetaspace(ClassLoader classLoader, long size);
 184   public native void freeMetaspace(ClassLoader classLoader, long addr, long size);
 185   public native long incMetaspaceCapacityUntilGC(long increment);
 186   public native long metaspaceCapacityUntilGC();
 187 
 188   // Force Young GC
 189   public native void youngGC();
 190 
 191   // Force Full GC
 192   public native void fullGC();
 193 
 194   // Method tries to start concurrent mark cycle.
 195   // It returns false if CM Thread is always in concurrent cycle.
 196   public native boolean g1StartConcMarkCycle();


< prev index next >