< prev index next >

test/lib/sun/hotspot/WhiteBox.java

Print this page




  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  *
  23  */
  24 
  25 package sun.hotspot;
  26 
  27 import java.lang.management.MemoryUsage;
  28 import java.lang.reflect.Executable;
  29 import java.util.Arrays;

  30 import java.util.List;
  31 import java.util.function.BiFunction;
  32 import java.util.function.Function;
  33 import java.security.BasicPermission;
  34 import java.util.Objects;
  35 
  36 import sun.hotspot.parser.DiagnosticCommand;
  37 
  38 public class WhiteBox {
  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 


 136   }
 137 
 138   private native int encodeConstantPoolIndyIndex0(int index);
 139   public         int encodeConstantPoolIndyIndex(int index) {
 140     return encodeConstantPoolIndyIndex0(index);
 141   }
 142 
 143   // JVMTI
 144   private native void addToBootstrapClassLoaderSearch0(String segment);
 145   public         void addToBootstrapClassLoaderSearch(String segment){
 146     Objects.requireNonNull(segment);
 147     addToBootstrapClassLoaderSearch0(segment);
 148   }
 149 
 150   private native void addToSystemClassLoaderSearch0(String segment);
 151   public         void addToSystemClassLoaderSearch(String segment) {
 152     Objects.requireNonNull(segment);
 153     addToSystemClassLoaderSearch0(segment);
 154   }
 155 










































 156   // G1
 157   public native boolean g1InConcurrentMark();
 158   private native boolean g1IsHumongous0(Object o);
 159   public         boolean g1IsHumongous(Object o) {
 160     Objects.requireNonNull(o);
 161     return g1IsHumongous0(o);
 162   }
 163 
 164   private native boolean g1BelongsToHumongousRegion0(long adr);
 165   public         boolean g1BelongsToHumongousRegion(long adr) {
 166     if (adr == 0) {
 167       throw new IllegalArgumentException("adr argument should not be null");
 168     }
 169     return g1BelongsToHumongousRegion0(adr);
 170   }
 171 
 172 
 173   private native boolean g1BelongsToFreeRegion0(long adr);
 174   public         boolean g1BelongsToFreeRegion(long adr) {
 175     if (adr == 0) {




  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  *
  23  */
  24 
  25 package sun.hotspot;
  26 
  27 import java.lang.management.MemoryUsage;
  28 import java.lang.reflect.Executable;
  29 import java.util.Arrays;
  30 import java.util.ArrayList;
  31 import java.util.List;
  32 import java.util.function.BiFunction;
  33 import java.util.function.Function;
  34 import java.security.BasicPermission;
  35 import java.util.Objects;
  36 
  37 import sun.hotspot.parser.DiagnosticCommand;
  38 
  39 public class WhiteBox {
  40   @SuppressWarnings("serial")
  41   public static class WhiteBoxPermission extends BasicPermission {
  42     public WhiteBoxPermission(String s) {
  43       super(s);
  44     }
  45   }
  46 
  47   private WhiteBox() {}
  48   private static final WhiteBox instance = new WhiteBox();
  49   private static native void registerNatives();
  50 


 137   }
 138 
 139   private native int encodeConstantPoolIndyIndex0(int index);
 140   public         int encodeConstantPoolIndyIndex(int index) {
 141     return encodeConstantPoolIndyIndex0(index);
 142   }
 143 
 144   // JVMTI
 145   private native void addToBootstrapClassLoaderSearch0(String segment);
 146   public         void addToBootstrapClassLoaderSearch(String segment){
 147     Objects.requireNonNull(segment);
 148     addToBootstrapClassLoaderSearch0(segment);
 149   }
 150 
 151   private native void addToSystemClassLoaderSearch0(String segment);
 152   public         void addToSystemClassLoaderSearch(String segment) {
 153     Objects.requireNonNull(segment);
 154     addToSystemClassLoaderSearch0(segment);
 155   }
 156 
 157   // GC
 158   /**
 159    * @returns true if GC was selected by ergonomic
 160    */
 161   public boolean gcSelectedByErgo() {
 162     if (getSupportedGC().size() < 2) {      
 163       return false; // nothing to choose from
 164     } else {
 165       return gcSelectedByErgo0();
 166     }
 167   }
 168   private native boolean gcSelectedByErgo0();
 169 
 170   /**
 171    * @return name of the selected GC
 172    */
 173   public native String getGC();
 174   private native boolean supportsSerialGC();
 175   private native boolean supportsParallelGC();
 176   private native boolean supportsConcMarkSweepGC();
 177   private native boolean supportsG1GC();
 178 
 179   /**
 180    * @return names of GC supported by the VM
 181    */
 182   public List<String> getSupportedGC() {
 183     List<String> list = new ArrayList<>();
 184     if (supportsSerialGC()) {
 185         list.add("Serial");
 186     }
 187     if (supportsParallelGC()) {
 188         list.add("Parallel");
 189     }
 190     if (supportsConcMarkSweepGC()) {
 191         list.add("ConcMarkSweep");
 192     }
 193     if (supportsG1GC()) {
 194         list.add("G1");
 195     }
 196     return list;
 197   }
 198 
 199   // G1
 200   public native boolean g1InConcurrentMark();
 201   private native boolean g1IsHumongous0(Object o);
 202   public         boolean g1IsHumongous(Object o) {
 203     Objects.requireNonNull(o);
 204     return g1IsHumongous0(o);
 205   }
 206 
 207   private native boolean g1BelongsToHumongousRegion0(long adr);
 208   public         boolean g1BelongsToHumongousRegion(long adr) {
 209     if (adr == 0) {
 210       throw new IllegalArgumentException("adr argument should not be null");
 211     }
 212     return g1BelongsToHumongousRegion0(adr);
 213   }
 214 
 215 
 216   private native boolean g1BelongsToFreeRegion0(long adr);
 217   public         boolean g1BelongsToFreeRegion(long adr) {
 218     if (adr == 0) {


< prev index next >