test/lib/sun/hotspot/WhiteBox.java
author zgu
Tue, 26 Nov 2019 09:27:16 -0500
changeset 59269 ac6f7738a0ee
parent 59118 89c44961a84f
permissions -rw-r--r--
8234270: [REDO] JDK-8204128 NMT might report incorrect numbers for Compiler area Reviewed-by: stuefe, minqi
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
28154
342e86350dc8 8066433: Move Whitebox test library to top level repository
thartmann
parents:
diff changeset
     1
/*
53494
8fd43dacaef7 8216180: [AOT] compiler/intrinsics/bigInteger/TestMulAdd.java crashed with AOT enabled
iignatyev
parents: 53116
diff changeset
     2
 * Copyright (c) 2012, 2019, Oracle and/or its affiliates. All rights reserved.
28154
342e86350dc8 8066433: Move Whitebox test library to top level repository
thartmann
parents:
diff changeset
     3
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
342e86350dc8 8066433: Move Whitebox test library to top level repository
thartmann
parents:
diff changeset
     4
 *
342e86350dc8 8066433: Move Whitebox test library to top level repository
thartmann
parents:
diff changeset
     5
 * This code is free software; you can redistribute it and/or modify it
342e86350dc8 8066433: Move Whitebox test library to top level repository
thartmann
parents:
diff changeset
     6
 * under the terms of the GNU General Public License version 2 only, as
342e86350dc8 8066433: Move Whitebox test library to top level repository
thartmann
parents:
diff changeset
     7
 * published by the Free Software Foundation.
342e86350dc8 8066433: Move Whitebox test library to top level repository
thartmann
parents:
diff changeset
     8
 *
342e86350dc8 8066433: Move Whitebox test library to top level repository
thartmann
parents:
diff changeset
     9
 * This code is distributed in the hope that it will be useful, but WITHOUT
342e86350dc8 8066433: Move Whitebox test library to top level repository
thartmann
parents:
diff changeset
    10
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
342e86350dc8 8066433: Move Whitebox test library to top level repository
thartmann
parents:
diff changeset
    11
 * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
342e86350dc8 8066433: Move Whitebox test library to top level repository
thartmann
parents:
diff changeset
    12
 * version 2 for more details (a copy is included in the LICENSE file that
342e86350dc8 8066433: Move Whitebox test library to top level repository
thartmann
parents:
diff changeset
    13
 * accompanied this code).
342e86350dc8 8066433: Move Whitebox test library to top level repository
thartmann
parents:
diff changeset
    14
 *
342e86350dc8 8066433: Move Whitebox test library to top level repository
thartmann
parents:
diff changeset
    15
 * You should have received a copy of the GNU General Public License version
342e86350dc8 8066433: Move Whitebox test library to top level repository
thartmann
parents:
diff changeset
    16
 * 2 along with this work; if not, write to the Free Software Foundation,
342e86350dc8 8066433: Move Whitebox test library to top level repository
thartmann
parents:
diff changeset
    17
 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
342e86350dc8 8066433: Move Whitebox test library to top level repository
thartmann
parents:
diff changeset
    18
 *
342e86350dc8 8066433: Move Whitebox test library to top level repository
thartmann
parents:
diff changeset
    19
 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
342e86350dc8 8066433: Move Whitebox test library to top level repository
thartmann
parents:
diff changeset
    20
 * or visit www.oracle.com if you need additional information or have any
342e86350dc8 8066433: Move Whitebox test library to top level repository
thartmann
parents:
diff changeset
    21
 * questions.
342e86350dc8 8066433: Move Whitebox test library to top level repository
thartmann
parents:
diff changeset
    22
 */
342e86350dc8 8066433: Move Whitebox test library to top level repository
thartmann
parents:
diff changeset
    23
342e86350dc8 8066433: Move Whitebox test library to top level repository
thartmann
parents:
diff changeset
    24
package sun.hotspot;
342e86350dc8 8066433: Move Whitebox test library to top level repository
thartmann
parents:
diff changeset
    25
29664
54de61fbee04 8061715: gc/g1/TestShrinkAuxiliaryData15.java fails with java.lang.RuntimeException: heap decommit failed - after > before
azakharov
parents: 28351
diff changeset
    26
import java.lang.management.MemoryUsage;
28154
342e86350dc8 8066433: Move Whitebox test library to top level repository
thartmann
parents:
diff changeset
    27
import java.lang.reflect.Executable;
342e86350dc8 8066433: Move Whitebox test library to top level repository
thartmann
parents:
diff changeset
    28
import java.util.Arrays;
342e86350dc8 8066433: Move Whitebox test library to top level repository
thartmann
parents:
diff changeset
    29
import java.util.List;
29440
87390f81c75d 8074980: add WhiteBox API to get a flag value for a method
iignatyev
parents: 28351
diff changeset
    30
import java.util.function.BiFunction;
28154
342e86350dc8 8066433: Move Whitebox test library to top level repository
thartmann
parents:
diff changeset
    31
import java.util.function.Function;
342e86350dc8 8066433: Move Whitebox test library to top level repository
thartmann
parents:
diff changeset
    32
import java.security.BasicPermission;
30077
1b49d946a1c8 8043225: Make whitebox API functions more stable
iignatyev
parents: 29666
diff changeset
    33
import java.util.Objects;
28154
342e86350dc8 8066433: Move Whitebox test library to top level repository
thartmann
parents:
diff changeset
    34
342e86350dc8 8066433: Move Whitebox test library to top level repository
thartmann
parents:
diff changeset
    35
import sun.hotspot.parser.DiagnosticCommand;
342e86350dc8 8066433: Move Whitebox test library to top level repository
thartmann
parents:
diff changeset
    36
342e86350dc8 8066433: Move Whitebox test library to top level repository
thartmann
parents:
diff changeset
    37
public class WhiteBox {
342e86350dc8 8066433: Move Whitebox test library to top level repository
thartmann
parents:
diff changeset
    38
  @SuppressWarnings("serial")
342e86350dc8 8066433: Move Whitebox test library to top level repository
thartmann
parents:
diff changeset
    39
  public static class WhiteBoxPermission extends BasicPermission {
342e86350dc8 8066433: Move Whitebox test library to top level repository
thartmann
parents:
diff changeset
    40
    public WhiteBoxPermission(String s) {
342e86350dc8 8066433: Move Whitebox test library to top level repository
thartmann
parents:
diff changeset
    41
      super(s);
342e86350dc8 8066433: Move Whitebox test library to top level repository
thartmann
parents:
diff changeset
    42
    }
342e86350dc8 8066433: Move Whitebox test library to top level repository
thartmann
parents:
diff changeset
    43
  }
342e86350dc8 8066433: Move Whitebox test library to top level repository
thartmann
parents:
diff changeset
    44
342e86350dc8 8066433: Move Whitebox test library to top level repository
thartmann
parents:
diff changeset
    45
  private WhiteBox() {}
342e86350dc8 8066433: Move Whitebox test library to top level repository
thartmann
parents:
diff changeset
    46
  private static final WhiteBox instance = new WhiteBox();
342e86350dc8 8066433: Move Whitebox test library to top level repository
thartmann
parents:
diff changeset
    47
  private static native void registerNatives();
342e86350dc8 8066433: Move Whitebox test library to top level repository
thartmann
parents:
diff changeset
    48
342e86350dc8 8066433: Move Whitebox test library to top level repository
thartmann
parents:
diff changeset
    49
  /**
342e86350dc8 8066433: Move Whitebox test library to top level repository
thartmann
parents:
diff changeset
    50
   * Returns the singleton WhiteBox instance.
342e86350dc8 8066433: Move Whitebox test library to top level repository
thartmann
parents:
diff changeset
    51
   *
342e86350dc8 8066433: Move Whitebox test library to top level repository
thartmann
parents:
diff changeset
    52
   * The returned WhiteBox object should be carefully guarded
342e86350dc8 8066433: Move Whitebox test library to top level repository
thartmann
parents:
diff changeset
    53
   * by the caller, since it can be used to read and write data
342e86350dc8 8066433: Move Whitebox test library to top level repository
thartmann
parents:
diff changeset
    54
   * at arbitrary memory addresses. It must never be passed to
342e86350dc8 8066433: Move Whitebox test library to top level repository
thartmann
parents:
diff changeset
    55
   * untrusted code.
342e86350dc8 8066433: Move Whitebox test library to top level repository
thartmann
parents:
diff changeset
    56
   */
342e86350dc8 8066433: Move Whitebox test library to top level repository
thartmann
parents:
diff changeset
    57
  public synchronized static WhiteBox getWhiteBox() {
342e86350dc8 8066433: Move Whitebox test library to top level repository
thartmann
parents:
diff changeset
    58
    SecurityManager sm = System.getSecurityManager();
342e86350dc8 8066433: Move Whitebox test library to top level repository
thartmann
parents:
diff changeset
    59
    if (sm != null) {
342e86350dc8 8066433: Move Whitebox test library to top level repository
thartmann
parents:
diff changeset
    60
      sm.checkPermission(new WhiteBoxPermission("getInstance"));
342e86350dc8 8066433: Move Whitebox test library to top level repository
thartmann
parents:
diff changeset
    61
    }
342e86350dc8 8066433: Move Whitebox test library to top level repository
thartmann
parents:
diff changeset
    62
    return instance;
342e86350dc8 8066433: Move Whitebox test library to top level repository
thartmann
parents:
diff changeset
    63
  }
342e86350dc8 8066433: Move Whitebox test library to top level repository
thartmann
parents:
diff changeset
    64
342e86350dc8 8066433: Move Whitebox test library to top level repository
thartmann
parents:
diff changeset
    65
  static {
342e86350dc8 8066433: Move Whitebox test library to top level repository
thartmann
parents:
diff changeset
    66
    registerNatives();
342e86350dc8 8066433: Move Whitebox test library to top level repository
thartmann
parents:
diff changeset
    67
  }
342e86350dc8 8066433: Move Whitebox test library to top level repository
thartmann
parents:
diff changeset
    68
342e86350dc8 8066433: Move Whitebox test library to top level repository
thartmann
parents:
diff changeset
    69
  // Get the maximum heap size supporting COOPs
342e86350dc8 8066433: Move Whitebox test library to top level repository
thartmann
parents:
diff changeset
    70
  public native long getCompressedOopsMaxHeapSize();
342e86350dc8 8066433: Move Whitebox test library to top level repository
thartmann
parents:
diff changeset
    71
  // Arguments
342e86350dc8 8066433: Move Whitebox test library to top level repository
thartmann
parents:
diff changeset
    72
  public native void printHeapSizes();
342e86350dc8 8066433: Move Whitebox test library to top level repository
thartmann
parents:
diff changeset
    73
342e86350dc8 8066433: Move Whitebox test library to top level repository
thartmann
parents:
diff changeset
    74
  // Memory
30077
1b49d946a1c8 8043225: Make whitebox API functions more stable
iignatyev
parents: 29666
diff changeset
    75
  private native long getObjectAddress0(Object o);
1b49d946a1c8 8043225: Make whitebox API functions more stable
iignatyev
parents: 29666
diff changeset
    76
  public           long getObjectAddress(Object o) {
1b49d946a1c8 8043225: Make whitebox API functions more stable
iignatyev
parents: 29666
diff changeset
    77
    Objects.requireNonNull(o);
1b49d946a1c8 8043225: Make whitebox API functions more stable
iignatyev
parents: 29666
diff changeset
    78
    return getObjectAddress0(o);
1b49d946a1c8 8043225: Make whitebox API functions more stable
iignatyev
parents: 29666
diff changeset
    79
  }
1b49d946a1c8 8043225: Make whitebox API functions more stable
iignatyev
parents: 29666
diff changeset
    80
28154
342e86350dc8 8066433: Move Whitebox test library to top level repository
thartmann
parents:
diff changeset
    81
  public native int  getHeapOopSize();
342e86350dc8 8066433: Move Whitebox test library to top level repository
thartmann
parents:
diff changeset
    82
  public native int  getVMPageSize();
31320
5358f1744a3f 8079208: gc/g1/TestLargePageUseForAuxMemory.java fails due to not considering page allocation granularity for setup
tschatzl
parents: 31317
diff changeset
    83
  public native long getVMAllocationGranularity();
30078
cecb6ee4437a 8058354: SPECjvm2008-Derby -2.7% performance regression on Solaris-X64 starting with 9-b29
tschatzl
parents: 30077
diff changeset
    84
  public native long getVMLargePageSize();
32557
4a6715919601 8081317: [NEWTEST] documented GC ratio tuning and new size options should be covered by regression tests
mchernov
parents: 32556
diff changeset
    85
  public native long getHeapSpaceAlignment();
39955
c4f471ce041b 8161604: TestNewSizeFlags fails with RuntimeException: max new size != MaxNewSize value
mchernov
parents: 39196
diff changeset
    86
  public native long getHeapAlignment();
30077
1b49d946a1c8 8043225: Make whitebox API functions more stable
iignatyev
parents: 29666
diff changeset
    87
1b49d946a1c8 8043225: Make whitebox API functions more stable
iignatyev
parents: 29666
diff changeset
    88
  private native boolean isObjectInOldGen0(Object o);
1b49d946a1c8 8043225: Make whitebox API functions more stable
iignatyev
parents: 29666
diff changeset
    89
  public         boolean isObjectInOldGen(Object o) {
1b49d946a1c8 8043225: Make whitebox API functions more stable
iignatyev
parents: 29666
diff changeset
    90
    Objects.requireNonNull(o);
1b49d946a1c8 8043225: Make whitebox API functions more stable
iignatyev
parents: 29666
diff changeset
    91
    return isObjectInOldGen0(o);
1b49d946a1c8 8043225: Make whitebox API functions more stable
iignatyev
parents: 29666
diff changeset
    92
  }
1b49d946a1c8 8043225: Make whitebox API functions more stable
iignatyev
parents: 29666
diff changeset
    93
1b49d946a1c8 8043225: Make whitebox API functions more stable
iignatyev
parents: 29666
diff changeset
    94
  private native long getObjectSize0(Object o);
1b49d946a1c8 8043225: Make whitebox API functions more stable
iignatyev
parents: 29666
diff changeset
    95
  public         long getObjectSize(Object o) {
1b49d946a1c8 8043225: Make whitebox API functions more stable
iignatyev
parents: 29666
diff changeset
    96
    Objects.requireNonNull(o);
1b49d946a1c8 8043225: Make whitebox API functions more stable
iignatyev
parents: 29666
diff changeset
    97
    return getObjectSize0(o);
1b49d946a1c8 8043225: Make whitebox API functions more stable
iignatyev
parents: 29666
diff changeset
    98
  }
28154
342e86350dc8 8066433: Move Whitebox test library to top level repository
thartmann
parents:
diff changeset
    99
342e86350dc8 8066433: Move Whitebox test library to top level repository
thartmann
parents:
diff changeset
   100
  // Runtime
342e86350dc8 8066433: Move Whitebox test library to top level repository
thartmann
parents:
diff changeset
   101
  // Make sure class name is in the correct format
342e86350dc8 8066433: Move Whitebox test library to top level repository
thartmann
parents:
diff changeset
   102
  public boolean isClassAlive(String name) {
342e86350dc8 8066433: Move Whitebox test library to top level repository
thartmann
parents:
diff changeset
   103
    return isClassAlive0(name.replace('.', '/'));
342e86350dc8 8066433: Move Whitebox test library to top level repository
thartmann
parents:
diff changeset
   104
  }
342e86350dc8 8066433: Move Whitebox test library to top level repository
thartmann
parents:
diff changeset
   105
  private native boolean isClassAlive0(String name);
51747
9bf5205655ee 8210559: ClassLoaderData Symbols can leak
coleenp
parents: 51610
diff changeset
   106
  public  native int getSymbolRefcount(String name);
30077
1b49d946a1c8 8043225: Make whitebox API functions more stable
iignatyev
parents: 29666
diff changeset
   107
1b49d946a1c8 8043225: Make whitebox API functions more stable
iignatyev
parents: 29666
diff changeset
   108
  private native boolean isMonitorInflated0(Object obj);
1b49d946a1c8 8043225: Make whitebox API functions more stable
iignatyev
parents: 29666
diff changeset
   109
  public         boolean isMonitorInflated(Object obj) {
1b49d946a1c8 8043225: Make whitebox API functions more stable
iignatyev
parents: 29666
diff changeset
   110
    Objects.requireNonNull(obj);
1b49d946a1c8 8043225: Make whitebox API functions more stable
iignatyev
parents: 29666
diff changeset
   111
    return isMonitorInflated0(obj);
1b49d946a1c8 8043225: Make whitebox API functions more stable
iignatyev
parents: 29666
diff changeset
   112
  }
1b49d946a1c8 8043225: Make whitebox API functions more stable
iignatyev
parents: 29666
diff changeset
   113
28351
bbdca807711d 8068272: Extend WhiteBox API with methods that check monitor state and force safepoint
fzhinkin
parents: 28159
diff changeset
   114
  public native void forceSafepoint();
28154
342e86350dc8 8066433: Move Whitebox test library to top level repository
thartmann
parents:
diff changeset
   115
33045
00f484891bcf 8136421: JEP 243: Java-Level JVM Compiler Interface
twisti
parents: 33038
diff changeset
   116
  private native long getConstantPool0(Class<?> aClass);
00f484891bcf 8136421: JEP 243: Java-Level JVM Compiler Interface
twisti
parents: 33038
diff changeset
   117
  public         long getConstantPool(Class<?> aClass) {
00f484891bcf 8136421: JEP 243: Java-Level JVM Compiler Interface
twisti
parents: 33038
diff changeset
   118
    Objects.requireNonNull(aClass);
00f484891bcf 8136421: JEP 243: Java-Level JVM Compiler Interface
twisti
parents: 33038
diff changeset
   119
    return getConstantPool0(aClass);
00f484891bcf 8136421: JEP 243: Java-Level JVM Compiler Interface
twisti
parents: 33038
diff changeset
   120
  }
00f484891bcf 8136421: JEP 243: Java-Level JVM Compiler Interface
twisti
parents: 33038
diff changeset
   121
36285
a644a8b6388a 8141616: Add new methods to the java Whitebox API
kshefov
parents: 35022
diff changeset
   122
  private native int getConstantPoolCacheIndexTag0();
a644a8b6388a 8141616: Add new methods to the java Whitebox API
kshefov
parents: 35022
diff changeset
   123
  public         int getConstantPoolCacheIndexTag() {
a644a8b6388a 8141616: Add new methods to the java Whitebox API
kshefov
parents: 35022
diff changeset
   124
    return getConstantPoolCacheIndexTag0();
a644a8b6388a 8141616: Add new methods to the java Whitebox API
kshefov
parents: 35022
diff changeset
   125
  }
a644a8b6388a 8141616: Add new methods to the java Whitebox API
kshefov
parents: 35022
diff changeset
   126
a644a8b6388a 8141616: Add new methods to the java Whitebox API
kshefov
parents: 35022
diff changeset
   127
  private native int getConstantPoolCacheLength0(Class<?> aClass);
a644a8b6388a 8141616: Add new methods to the java Whitebox API
kshefov
parents: 35022
diff changeset
   128
  public         int getConstantPoolCacheLength(Class<?> aClass) {
a644a8b6388a 8141616: Add new methods to the java Whitebox API
kshefov
parents: 35022
diff changeset
   129
    Objects.requireNonNull(aClass);
a644a8b6388a 8141616: Add new methods to the java Whitebox API
kshefov
parents: 35022
diff changeset
   130
    return getConstantPoolCacheLength0(aClass);
a644a8b6388a 8141616: Add new methods to the java Whitebox API
kshefov
parents: 35022
diff changeset
   131
  }
a644a8b6388a 8141616: Add new methods to the java Whitebox API
kshefov
parents: 35022
diff changeset
   132
a644a8b6388a 8141616: Add new methods to the java Whitebox API
kshefov
parents: 35022
diff changeset
   133
  private native int remapInstructionOperandFromCPCache0(Class<?> aClass, int index);
a644a8b6388a 8141616: Add new methods to the java Whitebox API
kshefov
parents: 35022
diff changeset
   134
  public         int remapInstructionOperandFromCPCache(Class<?> aClass, int index) {
a644a8b6388a 8141616: Add new methods to the java Whitebox API
kshefov
parents: 35022
diff changeset
   135
    Objects.requireNonNull(aClass);
a644a8b6388a 8141616: Add new methods to the java Whitebox API
kshefov
parents: 35022
diff changeset
   136
    return remapInstructionOperandFromCPCache0(aClass, index);
a644a8b6388a 8141616: Add new methods to the java Whitebox API
kshefov
parents: 35022
diff changeset
   137
  }
a644a8b6388a 8141616: Add new methods to the java Whitebox API
kshefov
parents: 35022
diff changeset
   138
a644a8b6388a 8141616: Add new methods to the java Whitebox API
kshefov
parents: 35022
diff changeset
   139
  private native int encodeConstantPoolIndyIndex0(int index);
a644a8b6388a 8141616: Add new methods to the java Whitebox API
kshefov
parents: 35022
diff changeset
   140
  public         int encodeConstantPoolIndyIndex(int index) {
a644a8b6388a 8141616: Add new methods to the java Whitebox API
kshefov
parents: 35022
diff changeset
   141
    return encodeConstantPoolIndyIndex0(index);
a644a8b6388a 8141616: Add new methods to the java Whitebox API
kshefov
parents: 35022
diff changeset
   142
  }
a644a8b6388a 8141616: Add new methods to the java Whitebox API
kshefov
parents: 35022
diff changeset
   143
28154
342e86350dc8 8066433: Move Whitebox test library to top level repository
thartmann
parents:
diff changeset
   144
  // JVMTI
30077
1b49d946a1c8 8043225: Make whitebox API functions more stable
iignatyev
parents: 29666
diff changeset
   145
  private native void addToBootstrapClassLoaderSearch0(String segment);
1b49d946a1c8 8043225: Make whitebox API functions more stable
iignatyev
parents: 29666
diff changeset
   146
  public         void addToBootstrapClassLoaderSearch(String segment){
1b49d946a1c8 8043225: Make whitebox API functions more stable
iignatyev
parents: 29666
diff changeset
   147
    Objects.requireNonNull(segment);
1b49d946a1c8 8043225: Make whitebox API functions more stable
iignatyev
parents: 29666
diff changeset
   148
    addToBootstrapClassLoaderSearch0(segment);
1b49d946a1c8 8043225: Make whitebox API functions more stable
iignatyev
parents: 29666
diff changeset
   149
  }
1b49d946a1c8 8043225: Make whitebox API functions more stable
iignatyev
parents: 29666
diff changeset
   150
1b49d946a1c8 8043225: Make whitebox API functions more stable
iignatyev
parents: 29666
diff changeset
   151
  private native void addToSystemClassLoaderSearch0(String segment);
1b49d946a1c8 8043225: Make whitebox API functions more stable
iignatyev
parents: 29666
diff changeset
   152
  public         void addToSystemClassLoaderSearch(String segment) {
1b49d946a1c8 8043225: Make whitebox API functions more stable
iignatyev
parents: 29666
diff changeset
   153
    Objects.requireNonNull(segment);
1b49d946a1c8 8043225: Make whitebox API functions more stable
iignatyev
parents: 29666
diff changeset
   154
    addToSystemClassLoaderSearch0(segment);
1b49d946a1c8 8043225: Make whitebox API functions more stable
iignatyev
parents: 29666
diff changeset
   155
  }
28154
342e86350dc8 8066433: Move Whitebox test library to top level repository
thartmann
parents:
diff changeset
   156
342e86350dc8 8066433: Move Whitebox test library to top level repository
thartmann
parents:
diff changeset
   157
  // G1
342e86350dc8 8066433: Move Whitebox test library to top level repository
thartmann
parents:
diff changeset
   158
  public native boolean g1InConcurrentMark();
30077
1b49d946a1c8 8043225: Make whitebox API functions more stable
iignatyev
parents: 29666
diff changeset
   159
  private native boolean g1IsHumongous0(Object o);
1b49d946a1c8 8043225: Make whitebox API functions more stable
iignatyev
parents: 29666
diff changeset
   160
  public         boolean g1IsHumongous(Object o) {
1b49d946a1c8 8043225: Make whitebox API functions more stable
iignatyev
parents: 29666
diff changeset
   161
    Objects.requireNonNull(o);
1b49d946a1c8 8043225: Make whitebox API functions more stable
iignatyev
parents: 29666
diff changeset
   162
    return g1IsHumongous0(o);
1b49d946a1c8 8043225: Make whitebox API functions more stable
iignatyev
parents: 29666
diff changeset
   163
  }
1b49d946a1c8 8043225: Make whitebox API functions more stable
iignatyev
parents: 29666
diff changeset
   164
35022
a4827aa736f7 8132723: Add tests which check that soft references to humongous objects should work correctly
kzhaldyb
parents: 34488
diff changeset
   165
  private native boolean g1BelongsToHumongousRegion0(long adr);
a4827aa736f7 8132723: Add tests which check that soft references to humongous objects should work correctly
kzhaldyb
parents: 34488
diff changeset
   166
  public         boolean g1BelongsToHumongousRegion(long adr) {
a4827aa736f7 8132723: Add tests which check that soft references to humongous objects should work correctly
kzhaldyb
parents: 34488
diff changeset
   167
    if (adr == 0) {
a4827aa736f7 8132723: Add tests which check that soft references to humongous objects should work correctly
kzhaldyb
parents: 34488
diff changeset
   168
      throw new IllegalArgumentException("adr argument should not be null");
a4827aa736f7 8132723: Add tests which check that soft references to humongous objects should work correctly
kzhaldyb
parents: 34488
diff changeset
   169
    }
a4827aa736f7 8132723: Add tests which check that soft references to humongous objects should work correctly
kzhaldyb
parents: 34488
diff changeset
   170
    return g1BelongsToHumongousRegion0(adr);
a4827aa736f7 8132723: Add tests which check that soft references to humongous objects should work correctly
kzhaldyb
parents: 34488
diff changeset
   171
  }
a4827aa736f7 8132723: Add tests which check that soft references to humongous objects should work correctly
kzhaldyb
parents: 34488
diff changeset
   172
a4827aa736f7 8132723: Add tests which check that soft references to humongous objects should work correctly
kzhaldyb
parents: 34488
diff changeset
   173
a4827aa736f7 8132723: Add tests which check that soft references to humongous objects should work correctly
kzhaldyb
parents: 34488
diff changeset
   174
  private native boolean g1BelongsToFreeRegion0(long adr);
a4827aa736f7 8132723: Add tests which check that soft references to humongous objects should work correctly
kzhaldyb
parents: 34488
diff changeset
   175
  public         boolean g1BelongsToFreeRegion(long adr) {
a4827aa736f7 8132723: Add tests which check that soft references to humongous objects should work correctly
kzhaldyb
parents: 34488
diff changeset
   176
    if (adr == 0) {
a4827aa736f7 8132723: Add tests which check that soft references to humongous objects should work correctly
kzhaldyb
parents: 34488
diff changeset
   177
      throw new IllegalArgumentException("adr argument should not be null");
a4827aa736f7 8132723: Add tests which check that soft references to humongous objects should work correctly
kzhaldyb
parents: 34488
diff changeset
   178
    }
a4827aa736f7 8132723: Add tests which check that soft references to humongous objects should work correctly
kzhaldyb
parents: 34488
diff changeset
   179
    return g1BelongsToFreeRegion0(adr);
a4827aa736f7 8132723: Add tests which check that soft references to humongous objects should work correctly
kzhaldyb
parents: 34488
diff changeset
   180
  }
a4827aa736f7 8132723: Add tests which check that soft references to humongous objects should work correctly
kzhaldyb
parents: 34488
diff changeset
   181
29664
54de61fbee04 8061715: gc/g1/TestShrinkAuxiliaryData15.java fails with java.lang.RuntimeException: heap decommit failed - after > before
azakharov
parents: 28351
diff changeset
   182
  public native long    g1NumMaxRegions();
28154
342e86350dc8 8066433: Move Whitebox test library to top level repository
thartmann
parents:
diff changeset
   183
  public native long    g1NumFreeRegions();
342e86350dc8 8066433: Move Whitebox test library to top level repository
thartmann
parents:
diff changeset
   184
  public native int     g1RegionSize();
53116
bb03098c4dde 8211425: Allocation of old generation of java heap on alternate memory devices - G1 GC
sangheki
parents: 52030
diff changeset
   185
  public native long    dramReservedStart();
bb03098c4dde 8211425: Allocation of old generation of java heap on alternate memory devices - G1 GC
sangheki
parents: 52030
diff changeset
   186
  public native long    dramReservedEnd();
bb03098c4dde 8211425: Allocation of old generation of java heap on alternate memory devices - G1 GC
sangheki
parents: 52030
diff changeset
   187
  public native long    nvdimmReservedStart();
bb03098c4dde 8211425: Allocation of old generation of java heap on alternate memory devices - G1 GC
sangheki
parents: 52030
diff changeset
   188
  public native long    nvdimmReservedEnd();
29664
54de61fbee04 8061715: gc/g1/TestShrinkAuxiliaryData15.java fails with java.lang.RuntimeException: heap decommit failed - after > before
azakharov
parents: 28351
diff changeset
   189
  public native MemoryUsage g1AuxiliaryMemoryUsage();
30077
1b49d946a1c8 8043225: Make whitebox API functions more stable
iignatyev
parents: 29666
diff changeset
   190
  private  native Object[]    parseCommandLine0(String commandline, char delim, DiagnosticCommand[] args);
1b49d946a1c8 8043225: Make whitebox API functions more stable
iignatyev
parents: 29666
diff changeset
   191
  public          Object[]    parseCommandLine(String commandline, char delim, DiagnosticCommand[] args) {
1b49d946a1c8 8043225: Make whitebox API functions more stable
iignatyev
parents: 29666
diff changeset
   192
    Objects.requireNonNull(args);
1b49d946a1c8 8043225: Make whitebox API functions more stable
iignatyev
parents: 29666
diff changeset
   193
    return parseCommandLine0(commandline, delim, args);
1b49d946a1c8 8043225: Make whitebox API functions more stable
iignatyev
parents: 29666
diff changeset
   194
  }
28154
342e86350dc8 8066433: Move Whitebox test library to top level repository
thartmann
parents:
diff changeset
   195
59060
fce1fa1bdc91 8220310: Implementation: NUMA-Aware Memory Allocation for G1, Mutator (1/3)
sangheki
parents: 59053
diff changeset
   196
  public native int g1ActiveMemoryNodeCount();
fce1fa1bdc91 8220310: Implementation: NUMA-Aware Memory Allocation for G1, Mutator (1/3)
sangheki
parents: 59053
diff changeset
   197
  public native int[] g1MemoryNodeIds();
fce1fa1bdc91 8220310: Implementation: NUMA-Aware Memory Allocation for G1, Mutator (1/3)
sangheki
parents: 59053
diff changeset
   198
32557
4a6715919601 8081317: [NEWTEST] documented GC ratio tuning and new size options should be covered by regression tests
mchernov
parents: 32556
diff changeset
   199
  // Parallel GC
4a6715919601 8081317: [NEWTEST] documented GC ratio tuning and new size options should be covered by regression tests
mchernov
parents: 32556
diff changeset
   200
  public native long psVirtualSpaceAlignment();
4a6715919601 8081317: [NEWTEST] documented GC ratio tuning and new size options should be covered by regression tests
mchernov
parents: 32556
diff changeset
   201
  public native long psHeapGenerationAlignment();
4a6715919601 8081317: [NEWTEST] documented GC ratio tuning and new size options should be covered by regression tests
mchernov
parents: 32556
diff changeset
   202
37954
74d146e5be3b 8135200: Add White Box method that enumerates G1 old regions with less than specified liveness and collects statistics
kzhaldyb
parents: 37025
diff changeset
   203
  /**
74d146e5be3b 8135200: Add White Box method that enumerates G1 old regions with less than specified liveness and collects statistics
kzhaldyb
parents: 37025
diff changeset
   204
   * Enumerates old regions with liveness less than specified and produces some statistics
74d146e5be3b 8135200: Add White Box method that enumerates G1 old regions with less than specified liveness and collects statistics
kzhaldyb
parents: 37025
diff changeset
   205
   * @param liveness percent of region's liveness (live_objects / total_region_size * 100).
74d146e5be3b 8135200: Add White Box method that enumerates G1 old regions with less than specified liveness and collects statistics
kzhaldyb
parents: 37025
diff changeset
   206
   * @return long[3] array where long[0] - total count of old regions
74d146e5be3b 8135200: Add White Box method that enumerates G1 old regions with less than specified liveness and collects statistics
kzhaldyb
parents: 37025
diff changeset
   207
   *                             long[1] - total memory of old regions
74d146e5be3b 8135200: Add White Box method that enumerates G1 old regions with less than specified liveness and collects statistics
kzhaldyb
parents: 37025
diff changeset
   208
   *                             long[2] - lowest estimation of total memory of old regions to be freed (non-full
74d146e5be3b 8135200: Add White Box method that enumerates G1 old regions with less than specified liveness and collects statistics
kzhaldyb
parents: 37025
diff changeset
   209
   *                             regions are not included)
74d146e5be3b 8135200: Add White Box method that enumerates G1 old regions with less than specified liveness and collects statistics
kzhaldyb
parents: 37025
diff changeset
   210
   */
74d146e5be3b 8135200: Add White Box method that enumerates G1 old regions with less than specified liveness and collects statistics
kzhaldyb
parents: 37025
diff changeset
   211
  public native long[] g1GetMixedGCInfo(int liveness);
74d146e5be3b 8135200: Add White Box method that enumerates G1 old regions with less than specified liveness and collects statistics
kzhaldyb
parents: 37025
diff changeset
   212
28154
342e86350dc8 8066433: Move Whitebox test library to top level repository
thartmann
parents:
diff changeset
   213
  // NMT
342e86350dc8 8066433: Move Whitebox test library to top level repository
thartmann
parents:
diff changeset
   214
  public native long NMTMalloc(long size);
342e86350dc8 8066433: Move Whitebox test library to top level repository
thartmann
parents:
diff changeset
   215
  public native void NMTFree(long mem);
342e86350dc8 8066433: Move Whitebox test library to top level repository
thartmann
parents:
diff changeset
   216
  public native long NMTReserveMemory(long size);
49034
57d0c33ad636 8198225: os::attempt_reserve_memory_at records memory as committed
stefank
parents: 49008
diff changeset
   217
  public native long NMTAttemptReserveMemoryAt(long addr, long size);
28154
342e86350dc8 8066433: Move Whitebox test library to top level repository
thartmann
parents:
diff changeset
   218
  public native void NMTCommitMemory(long addr, long size);
342e86350dc8 8066433: Move Whitebox test library to top level repository
thartmann
parents:
diff changeset
   219
  public native void NMTUncommitMemory(long addr, long size);
342e86350dc8 8066433: Move Whitebox test library to top level repository
thartmann
parents:
diff changeset
   220
  public native void NMTReleaseMemory(long addr, long size);
342e86350dc8 8066433: Move Whitebox test library to top level repository
thartmann
parents:
diff changeset
   221
  public native long NMTMallocWithPseudoStack(long size, int index);
53709
2b64ebacce93 8200109: NMT: diff_malloc_site assert(early->flags() == current->flags(), "Must be the same memory type")
zgu
parents: 53647
diff changeset
   222
  public native long NMTMallocWithPseudoStackAndType(long size, int index, int type);
28154
342e86350dc8 8066433: Move Whitebox test library to top level repository
thartmann
parents:
diff changeset
   223
  public native boolean NMTChangeTrackingLevel();
342e86350dc8 8066433: Move Whitebox test library to top level repository
thartmann
parents:
diff changeset
   224
  public native int NMTGetHashSize();
59269
ac6f7738a0ee 8234270: [REDO] JDK-8204128 NMT might report incorrect numbers for Compiler area
zgu
parents: 59118
diff changeset
   225
  public native long NMTNewArena(long initSize);
ac6f7738a0ee 8234270: [REDO] JDK-8204128 NMT might report incorrect numbers for Compiler area
zgu
parents: 59118
diff changeset
   226
  public native void NMTFreeArena(long arena);
ac6f7738a0ee 8234270: [REDO] JDK-8204128 NMT might report incorrect numbers for Compiler area
zgu
parents: 59118
diff changeset
   227
  public native void NMTArenaMalloc(long arena, long size);
28154
342e86350dc8 8066433: Move Whitebox test library to top level repository
thartmann
parents:
diff changeset
   228
342e86350dc8 8066433: Move Whitebox test library to top level repository
thartmann
parents:
diff changeset
   229
  // Compiler
33038
5d648743b2d1 8135068: Extract method matchers from CompilerOracle
neliasso
parents: 32557
diff changeset
   230
  public native int     matchesMethod(Executable method, String pattern);
33432
d3cbcb934612 8137167: JEP165: Compiler Control: Implementation task
neliasso
parents: 33045
diff changeset
   231
  public native int     matchesInline(Executable method, String pattern);
36287
2f8f83777f9d 8148159: [TESTBUG] TestCompilerDirectivesCompatibility tests fails on non-tiered server VMs
neliasso
parents: 36285
diff changeset
   232
  public native boolean shouldPrintAssembly(Executable method, int comp_level);
28157
1305bf148a19 8028595: WhiteBox API for stress testing of TieredCompilation
iignatyev
parents: 28154
diff changeset
   233
  public native int     deoptimizeFrames(boolean makeNotEntrant);
28154
342e86350dc8 8066433: Move Whitebox test library to top level repository
thartmann
parents:
diff changeset
   234
  public native void    deoptimizeAll();
34487
db155554abc0 8072008: Emit direct call instead of linkTo* for recursive indy/MH.invoke* calls
vlivanov
parents: 33432
diff changeset
   235
28154
342e86350dc8 8066433: Move Whitebox test library to top level repository
thartmann
parents:
diff changeset
   236
  public        boolean isMethodCompiled(Executable method) {
342e86350dc8 8066433: Move Whitebox test library to top level repository
thartmann
parents:
diff changeset
   237
    return isMethodCompiled(method, false /*not osr*/);
342e86350dc8 8066433: Move Whitebox test library to top level repository
thartmann
parents:
diff changeset
   238
  }
30077
1b49d946a1c8 8043225: Make whitebox API functions more stable
iignatyev
parents: 29666
diff changeset
   239
  private native boolean isMethodCompiled0(Executable method, boolean isOsr);
1b49d946a1c8 8043225: Make whitebox API functions more stable
iignatyev
parents: 29666
diff changeset
   240
  public         boolean isMethodCompiled(Executable method, boolean isOsr){
1b49d946a1c8 8043225: Make whitebox API functions more stable
iignatyev
parents: 29666
diff changeset
   241
    Objects.requireNonNull(method);
1b49d946a1c8 8043225: Make whitebox API functions more stable
iignatyev
parents: 29666
diff changeset
   242
    return isMethodCompiled0(method, isOsr);
1b49d946a1c8 8043225: Make whitebox API functions more stable
iignatyev
parents: 29666
diff changeset
   243
  }
28154
342e86350dc8 8066433: Move Whitebox test library to top level repository
thartmann
parents:
diff changeset
   244
  public        boolean isMethodCompilable(Executable method) {
42532
4780f4130eb0 8171008: Integrate AOT compiler into JDK
kvn
parents: 42289
diff changeset
   245
    return isMethodCompilable(method, -2 /*any*/);
28154
342e86350dc8 8066433: Move Whitebox test library to top level repository
thartmann
parents:
diff changeset
   246
  }
342e86350dc8 8066433: Move Whitebox test library to top level repository
thartmann
parents:
diff changeset
   247
  public        boolean isMethodCompilable(Executable method, int compLevel) {
342e86350dc8 8066433: Move Whitebox test library to top level repository
thartmann
parents:
diff changeset
   248
    return isMethodCompilable(method, compLevel, false /*not osr*/);
342e86350dc8 8066433: Move Whitebox test library to top level repository
thartmann
parents:
diff changeset
   249
  }
30077
1b49d946a1c8 8043225: Make whitebox API functions more stable
iignatyev
parents: 29666
diff changeset
   250
  private native boolean isMethodCompilable0(Executable method, int compLevel, boolean isOsr);
1b49d946a1c8 8043225: Make whitebox API functions more stable
iignatyev
parents: 29666
diff changeset
   251
  public         boolean isMethodCompilable(Executable method, int compLevel, boolean isOsr) {
1b49d946a1c8 8043225: Make whitebox API functions more stable
iignatyev
parents: 29666
diff changeset
   252
    Objects.requireNonNull(method);
1b49d946a1c8 8043225: Make whitebox API functions more stable
iignatyev
parents: 29666
diff changeset
   253
    return isMethodCompilable0(method, compLevel, isOsr);
1b49d946a1c8 8043225: Make whitebox API functions more stable
iignatyev
parents: 29666
diff changeset
   254
  }
1b49d946a1c8 8043225: Make whitebox API functions more stable
iignatyev
parents: 29666
diff changeset
   255
  private native boolean isMethodQueuedForCompilation0(Executable method);
1b49d946a1c8 8043225: Make whitebox API functions more stable
iignatyev
parents: 29666
diff changeset
   256
  public         boolean isMethodQueuedForCompilation(Executable method) {
1b49d946a1c8 8043225: Make whitebox API functions more stable
iignatyev
parents: 29666
diff changeset
   257
    Objects.requireNonNull(method);
1b49d946a1c8 8043225: Make whitebox API functions more stable
iignatyev
parents: 29666
diff changeset
   258
    return isMethodQueuedForCompilation0(method);
1b49d946a1c8 8043225: Make whitebox API functions more stable
iignatyev
parents: 29666
diff changeset
   259
  }
31949
ddd0594084a7 8130832: Extend the WhiteBox API to provide information about the availability of compiler intrinsics
zmajo
parents: 31572
diff changeset
   260
  // Determine if the compiler corresponding to the compilation level 'compLevel'
ddd0594084a7 8130832: Extend the WhiteBox API to provide information about the availability of compiler intrinsics
zmajo
parents: 31572
diff changeset
   261
  // and to the compilation context 'compilation_context' provides an intrinsic
ddd0594084a7 8130832: Extend the WhiteBox API to provide information about the availability of compiler intrinsics
zmajo
parents: 31572
diff changeset
   262
  // for the method 'method'. An intrinsic is available for method 'method' if:
ddd0594084a7 8130832: Extend the WhiteBox API to provide information about the availability of compiler intrinsics
zmajo
parents: 31572
diff changeset
   263
  //  - the intrinsic is enabled (by using the appropriate command-line flag) and
ddd0594084a7 8130832: Extend the WhiteBox API to provide information about the availability of compiler intrinsics
zmajo
parents: 31572
diff changeset
   264
  //  - the platform on which the VM is running provides the instructions necessary
ddd0594084a7 8130832: Extend the WhiteBox API to provide information about the availability of compiler intrinsics
zmajo
parents: 31572
diff changeset
   265
  //    for the compiler to generate the intrinsic code.
ddd0594084a7 8130832: Extend the WhiteBox API to provide information about the availability of compiler intrinsics
zmajo
parents: 31572
diff changeset
   266
  //
ddd0594084a7 8130832: Extend the WhiteBox API to provide information about the availability of compiler intrinsics
zmajo
parents: 31572
diff changeset
   267
  // The compilation context is related to using the DisableIntrinsic flag on a
ddd0594084a7 8130832: Extend the WhiteBox API to provide information about the availability of compiler intrinsics
zmajo
parents: 31572
diff changeset
   268
  // per-method level, see hotspot/src/share/vm/compiler/abstractCompiler.hpp
ddd0594084a7 8130832: Extend the WhiteBox API to provide information about the availability of compiler intrinsics
zmajo
parents: 31572
diff changeset
   269
  // for more details.
ddd0594084a7 8130832: Extend the WhiteBox API to provide information about the availability of compiler intrinsics
zmajo
parents: 31572
diff changeset
   270
  public boolean isIntrinsicAvailable(Executable method,
ddd0594084a7 8130832: Extend the WhiteBox API to provide information about the availability of compiler intrinsics
zmajo
parents: 31572
diff changeset
   271
                                      Executable compilationContext,
ddd0594084a7 8130832: Extend the WhiteBox API to provide information about the availability of compiler intrinsics
zmajo
parents: 31572
diff changeset
   272
                                      int compLevel) {
ddd0594084a7 8130832: Extend the WhiteBox API to provide information about the availability of compiler intrinsics
zmajo
parents: 31572
diff changeset
   273
      Objects.requireNonNull(method);
ddd0594084a7 8130832: Extend the WhiteBox API to provide information about the availability of compiler intrinsics
zmajo
parents: 31572
diff changeset
   274
      return isIntrinsicAvailable0(method, compilationContext, compLevel);
ddd0594084a7 8130832: Extend the WhiteBox API to provide information about the availability of compiler intrinsics
zmajo
parents: 31572
diff changeset
   275
  }
ddd0594084a7 8130832: Extend the WhiteBox API to provide information about the availability of compiler intrinsics
zmajo
parents: 31572
diff changeset
   276
  // If usage of the DisableIntrinsic flag is not expected (or the usage can be ignored),
ddd0594084a7 8130832: Extend the WhiteBox API to provide information about the availability of compiler intrinsics
zmajo
parents: 31572
diff changeset
   277
  // use the below method that does not require the compilation context as argument.
ddd0594084a7 8130832: Extend the WhiteBox API to provide information about the availability of compiler intrinsics
zmajo
parents: 31572
diff changeset
   278
  public boolean isIntrinsicAvailable(Executable method, int compLevel) {
ddd0594084a7 8130832: Extend the WhiteBox API to provide information about the availability of compiler intrinsics
zmajo
parents: 31572
diff changeset
   279
      return isIntrinsicAvailable(method, null, compLevel);
ddd0594084a7 8130832: Extend the WhiteBox API to provide information about the availability of compiler intrinsics
zmajo
parents: 31572
diff changeset
   280
  }
ddd0594084a7 8130832: Extend the WhiteBox API to provide information about the availability of compiler intrinsics
zmajo
parents: 31572
diff changeset
   281
  private native boolean isIntrinsicAvailable0(Executable method,
ddd0594084a7 8130832: Extend the WhiteBox API to provide information about the availability of compiler intrinsics
zmajo
parents: 31572
diff changeset
   282
                                               Executable compilationContext,
ddd0594084a7 8130832: Extend the WhiteBox API to provide information about the availability of compiler intrinsics
zmajo
parents: 31572
diff changeset
   283
                                               int compLevel);
28154
342e86350dc8 8066433: Move Whitebox test library to top level repository
thartmann
parents:
diff changeset
   284
  public        int     deoptimizeMethod(Executable method) {
342e86350dc8 8066433: Move Whitebox test library to top level repository
thartmann
parents:
diff changeset
   285
    return deoptimizeMethod(method, false /*not osr*/);
342e86350dc8 8066433: Move Whitebox test library to top level repository
thartmann
parents:
diff changeset
   286
  }
30077
1b49d946a1c8 8043225: Make whitebox API functions more stable
iignatyev
parents: 29666
diff changeset
   287
  private native int     deoptimizeMethod0(Executable method, boolean isOsr);
1b49d946a1c8 8043225: Make whitebox API functions more stable
iignatyev
parents: 29666
diff changeset
   288
  public         int     deoptimizeMethod(Executable method, boolean isOsr) {
1b49d946a1c8 8043225: Make whitebox API functions more stable
iignatyev
parents: 29666
diff changeset
   289
    Objects.requireNonNull(method);
1b49d946a1c8 8043225: Make whitebox API functions more stable
iignatyev
parents: 29666
diff changeset
   290
    return deoptimizeMethod0(method, isOsr);
1b49d946a1c8 8043225: Make whitebox API functions more stable
iignatyev
parents: 29666
diff changeset
   291
  }
28154
342e86350dc8 8066433: Move Whitebox test library to top level repository
thartmann
parents:
diff changeset
   292
  public        void    makeMethodNotCompilable(Executable method) {
42532
4780f4130eb0 8171008: Integrate AOT compiler into JDK
kvn
parents: 42289
diff changeset
   293
    makeMethodNotCompilable(method, -2 /*any*/);
28154
342e86350dc8 8066433: Move Whitebox test library to top level repository
thartmann
parents:
diff changeset
   294
  }
342e86350dc8 8066433: Move Whitebox test library to top level repository
thartmann
parents:
diff changeset
   295
  public        void    makeMethodNotCompilable(Executable method, int compLevel) {
342e86350dc8 8066433: Move Whitebox test library to top level repository
thartmann
parents:
diff changeset
   296
    makeMethodNotCompilable(method, compLevel, false /*not osr*/);
342e86350dc8 8066433: Move Whitebox test library to top level repository
thartmann
parents:
diff changeset
   297
  }
30077
1b49d946a1c8 8043225: Make whitebox API functions more stable
iignatyev
parents: 29666
diff changeset
   298
  private native void    makeMethodNotCompilable0(Executable method, int compLevel, boolean isOsr);
1b49d946a1c8 8043225: Make whitebox API functions more stable
iignatyev
parents: 29666
diff changeset
   299
  public         void    makeMethodNotCompilable(Executable method, int compLevel, boolean isOsr) {
1b49d946a1c8 8043225: Make whitebox API functions more stable
iignatyev
parents: 29666
diff changeset
   300
    Objects.requireNonNull(method);
1b49d946a1c8 8043225: Make whitebox API functions more stable
iignatyev
parents: 29666
diff changeset
   301
    makeMethodNotCompilable0(method, compLevel, isOsr);
1b49d946a1c8 8043225: Make whitebox API functions more stable
iignatyev
parents: 29666
diff changeset
   302
  }
28154
342e86350dc8 8066433: Move Whitebox test library to top level repository
thartmann
parents:
diff changeset
   303
  public        int     getMethodCompilationLevel(Executable method) {
342e86350dc8 8066433: Move Whitebox test library to top level repository
thartmann
parents:
diff changeset
   304
    return getMethodCompilationLevel(method, false /*not ost*/);
342e86350dc8 8066433: Move Whitebox test library to top level repository
thartmann
parents:
diff changeset
   305
  }
30077
1b49d946a1c8 8043225: Make whitebox API functions more stable
iignatyev
parents: 29666
diff changeset
   306
  private native int     getMethodCompilationLevel0(Executable method, boolean isOsr);
1b49d946a1c8 8043225: Make whitebox API functions more stable
iignatyev
parents: 29666
diff changeset
   307
  public         int     getMethodCompilationLevel(Executable method, boolean isOsr) {
1b49d946a1c8 8043225: Make whitebox API functions more stable
iignatyev
parents: 29666
diff changeset
   308
    Objects.requireNonNull(method);
1b49d946a1c8 8043225: Make whitebox API functions more stable
iignatyev
parents: 29666
diff changeset
   309
    return getMethodCompilationLevel0(method, isOsr);
1b49d946a1c8 8043225: Make whitebox API functions more stable
iignatyev
parents: 29666
diff changeset
   310
  }
1b49d946a1c8 8043225: Make whitebox API functions more stable
iignatyev
parents: 29666
diff changeset
   311
  private native boolean testSetDontInlineMethod0(Executable method, boolean value);
1b49d946a1c8 8043225: Make whitebox API functions more stable
iignatyev
parents: 29666
diff changeset
   312
  public         boolean testSetDontInlineMethod(Executable method, boolean value) {
1b49d946a1c8 8043225: Make whitebox API functions more stable
iignatyev
parents: 29666
diff changeset
   313
    Objects.requireNonNull(method);
1b49d946a1c8 8043225: Make whitebox API functions more stable
iignatyev
parents: 29666
diff changeset
   314
    return testSetDontInlineMethod0(method, value);
1b49d946a1c8 8043225: Make whitebox API functions more stable
iignatyev
parents: 29666
diff changeset
   315
  }
28154
342e86350dc8 8066433: Move Whitebox test library to top level repository
thartmann
parents:
diff changeset
   316
  public        int     getCompileQueuesSize() {
42532
4780f4130eb0 8171008: Integrate AOT compiler into JDK
kvn
parents: 42289
diff changeset
   317
    return getCompileQueueSize(-2 /*any*/);
28154
342e86350dc8 8066433: Move Whitebox test library to top level repository
thartmann
parents:
diff changeset
   318
  }
342e86350dc8 8066433: Move Whitebox test library to top level repository
thartmann
parents:
diff changeset
   319
  public native int     getCompileQueueSize(int compLevel);
30077
1b49d946a1c8 8043225: Make whitebox API functions more stable
iignatyev
parents: 29666
diff changeset
   320
  private native boolean testSetForceInlineMethod0(Executable method, boolean value);
1b49d946a1c8 8043225: Make whitebox API functions more stable
iignatyev
parents: 29666
diff changeset
   321
  public         boolean testSetForceInlineMethod(Executable method, boolean value) {
1b49d946a1c8 8043225: Make whitebox API functions more stable
iignatyev
parents: 29666
diff changeset
   322
    Objects.requireNonNull(method);
1b49d946a1c8 8043225: Make whitebox API functions more stable
iignatyev
parents: 29666
diff changeset
   323
    return testSetForceInlineMethod0(method, value);
1b49d946a1c8 8043225: Make whitebox API functions more stable
iignatyev
parents: 29666
diff changeset
   324
  }
28154
342e86350dc8 8066433: Move Whitebox test library to top level repository
thartmann
parents:
diff changeset
   325
  public        boolean enqueueMethodForCompilation(Executable method, int compLevel) {
342e86350dc8 8066433: Move Whitebox test library to top level repository
thartmann
parents:
diff changeset
   326
    return enqueueMethodForCompilation(method, compLevel, -1 /*InvocationEntryBci*/);
342e86350dc8 8066433: Move Whitebox test library to top level repository
thartmann
parents:
diff changeset
   327
  }
30077
1b49d946a1c8 8043225: Make whitebox API functions more stable
iignatyev
parents: 29666
diff changeset
   328
  private native boolean enqueueMethodForCompilation0(Executable method, int compLevel, int entry_bci);
1b49d946a1c8 8043225: Make whitebox API functions more stable
iignatyev
parents: 29666
diff changeset
   329
  public  boolean enqueueMethodForCompilation(Executable method, int compLevel, int entry_bci) {
1b49d946a1c8 8043225: Make whitebox API functions more stable
iignatyev
parents: 29666
diff changeset
   330
    Objects.requireNonNull(method);
1b49d946a1c8 8043225: Make whitebox API functions more stable
iignatyev
parents: 29666
diff changeset
   331
    return enqueueMethodForCompilation0(method, compLevel, entry_bci);
1b49d946a1c8 8043225: Make whitebox API functions more stable
iignatyev
parents: 29666
diff changeset
   332
  }
37955
0e25f6f1d8f0 8153514: Whitebox API should allow compilation of <clinit>
thartmann
parents: 37025
diff changeset
   333
  private native boolean enqueueInitializerForCompilation0(Class<?> aClass, int compLevel);
0e25f6f1d8f0 8153514: Whitebox API should allow compilation of <clinit>
thartmann
parents: 37025
diff changeset
   334
  public  boolean enqueueInitializerForCompilation(Class<?> aClass, int compLevel) {
0e25f6f1d8f0 8153514: Whitebox API should allow compilation of <clinit>
thartmann
parents: 37025
diff changeset
   335
    Objects.requireNonNull(aClass);
0e25f6f1d8f0 8153514: Whitebox API should allow compilation of <clinit>
thartmann
parents: 37025
diff changeset
   336
    return enqueueInitializerForCompilation0(aClass, compLevel);
0e25f6f1d8f0 8153514: Whitebox API should allow compilation of <clinit>
thartmann
parents: 37025
diff changeset
   337
  }
30077
1b49d946a1c8 8043225: Make whitebox API functions more stable
iignatyev
parents: 29666
diff changeset
   338
  private native void    clearMethodState0(Executable method);
54736
1dc9bf9d016b 8222670: pathological case of JIT recompilation and code cache bloat
xliu
parents: 54511
diff changeset
   339
  public  native void    markMethodProfiled(Executable method);
30077
1b49d946a1c8 8043225: Make whitebox API functions more stable
iignatyev
parents: 29666
diff changeset
   340
  public         void    clearMethodState(Executable method) {
1b49d946a1c8 8043225: Make whitebox API functions more stable
iignatyev
parents: 29666
diff changeset
   341
    Objects.requireNonNull(method);
1b49d946a1c8 8043225: Make whitebox API functions more stable
iignatyev
parents: 29666
diff changeset
   342
    clearMethodState0(method);
1b49d946a1c8 8043225: Make whitebox API functions more stable
iignatyev
parents: 29666
diff changeset
   343
  }
28154
342e86350dc8 8066433: Move Whitebox test library to top level repository
thartmann
parents:
diff changeset
   344
  public native void    lockCompilation();
342e86350dc8 8066433: Move Whitebox test library to top level repository
thartmann
parents:
diff changeset
   345
  public native void    unlockCompilation();
30077
1b49d946a1c8 8043225: Make whitebox API functions more stable
iignatyev
parents: 29666
diff changeset
   346
  private native int     getMethodEntryBci0(Executable method);
1b49d946a1c8 8043225: Make whitebox API functions more stable
iignatyev
parents: 29666
diff changeset
   347
  public         int     getMethodEntryBci(Executable method) {
1b49d946a1c8 8043225: Make whitebox API functions more stable
iignatyev
parents: 29666
diff changeset
   348
    Objects.requireNonNull(method);
1b49d946a1c8 8043225: Make whitebox API functions more stable
iignatyev
parents: 29666
diff changeset
   349
    return getMethodEntryBci0(method);
1b49d946a1c8 8043225: Make whitebox API functions more stable
iignatyev
parents: 29666
diff changeset
   350
  }
1b49d946a1c8 8043225: Make whitebox API functions more stable
iignatyev
parents: 29666
diff changeset
   351
  private native Object[] getNMethod0(Executable method, boolean isOsr);
1b49d946a1c8 8043225: Make whitebox API functions more stable
iignatyev
parents: 29666
diff changeset
   352
  public         Object[] getNMethod(Executable method, boolean isOsr) {
1b49d946a1c8 8043225: Make whitebox API functions more stable
iignatyev
parents: 29666
diff changeset
   353
    Objects.requireNonNull(method);
1b49d946a1c8 8043225: Make whitebox API functions more stable
iignatyev
parents: 29666
diff changeset
   354
    return getNMethod0(method, isOsr);
1b49d946a1c8 8043225: Make whitebox API functions more stable
iignatyev
parents: 29666
diff changeset
   355
  }
28154
342e86350dc8 8066433: Move Whitebox test library to top level repository
thartmann
parents:
diff changeset
   356
  public native long    allocateCodeBlob(int size, int type);
342e86350dc8 8066433: Move Whitebox test library to top level repository
thartmann
parents:
diff changeset
   357
  public        long    allocateCodeBlob(long size, int type) {
342e86350dc8 8066433: Move Whitebox test library to top level repository
thartmann
parents:
diff changeset
   358
      int intSize = (int) size;
342e86350dc8 8066433: Move Whitebox test library to top level repository
thartmann
parents:
diff changeset
   359
      if ((long) intSize != size || size < 0) {
342e86350dc8 8066433: Move Whitebox test library to top level repository
thartmann
parents:
diff changeset
   360
          throw new IllegalArgumentException(
342e86350dc8 8066433: Move Whitebox test library to top level repository
thartmann
parents:
diff changeset
   361
                "size argument has illegal value " + size);
342e86350dc8 8066433: Move Whitebox test library to top level repository
thartmann
parents:
diff changeset
   362
      }
342e86350dc8 8066433: Move Whitebox test library to top level repository
thartmann
parents:
diff changeset
   363
      return allocateCodeBlob( intSize, type);
342e86350dc8 8066433: Move Whitebox test library to top level repository
thartmann
parents:
diff changeset
   364
  }
342e86350dc8 8066433: Move Whitebox test library to top level repository
thartmann
parents:
diff changeset
   365
  public native void    freeCodeBlob(long addr);
30081
2dd31ea5f49c 8075214: SIGSEGV in nmethod sweeping
thartmann
parents: 29666
diff changeset
   366
  public native void    forceNMethodSweep();
28154
342e86350dc8 8066433: Move Whitebox test library to top level repository
thartmann
parents:
diff changeset
   367
  public native Object[] getCodeHeapEntries(int type);
342e86350dc8 8066433: Move Whitebox test library to top level repository
thartmann
parents:
diff changeset
   368
  public native int     getCompilationActivityMode();
33045
00f484891bcf 8136421: JEP 243: Java-Level JVM Compiler Interface
twisti
parents: 33038
diff changeset
   369
  private native long getMethodData0(Executable method);
00f484891bcf 8136421: JEP 243: Java-Level JVM Compiler Interface
twisti
parents: 33038
diff changeset
   370
  public         long getMethodData(Executable method) {
00f484891bcf 8136421: JEP 243: Java-Level JVM Compiler Interface
twisti
parents: 33038
diff changeset
   371
    Objects.requireNonNull(method);
00f484891bcf 8136421: JEP 243: Java-Level JVM Compiler Interface
twisti
parents: 33038
diff changeset
   372
    return getMethodData0(method);
00f484891bcf 8136421: JEP 243: Java-Level JVM Compiler Interface
twisti
parents: 33038
diff changeset
   373
  }
28154
342e86350dc8 8066433: Move Whitebox test library to top level repository
thartmann
parents:
diff changeset
   374
  public native Object[] getCodeBlob(long addr);
342e86350dc8 8066433: Move Whitebox test library to top level repository
thartmann
parents:
diff changeset
   375
37025
e0533c567b27 8067247: Crash: assert(method_holder->data() == 0 ...) failed: a) MT-unsafe modification of inline cache
jcm
parents: 36542
diff changeset
   376
  private native void clearInlineCaches0(boolean preserve_static_stubs);
e0533c567b27 8067247: Crash: assert(method_holder->data() == 0 ...) failed: a) MT-unsafe modification of inline cache
jcm
parents: 36542
diff changeset
   377
  public void clearInlineCaches() {
e0533c567b27 8067247: Crash: assert(method_holder->data() == 0 ...) failed: a) MT-unsafe modification of inline cache
jcm
parents: 36542
diff changeset
   378
    clearInlineCaches0(false);
e0533c567b27 8067247: Crash: assert(method_holder->data() == 0 ...) failed: a) MT-unsafe modification of inline cache
jcm
parents: 36542
diff changeset
   379
  }
e0533c567b27 8067247: Crash: assert(method_holder->data() == 0 ...) failed: a) MT-unsafe modification of inline cache
jcm
parents: 36542
diff changeset
   380
  public void clearInlineCaches(boolean preserve_static_stubs) {
e0533c567b27 8067247: Crash: assert(method_holder->data() == 0 ...) failed: a) MT-unsafe modification of inline cache
jcm
parents: 36542
diff changeset
   381
    clearInlineCaches0(preserve_static_stubs);
e0533c567b27 8067247: Crash: assert(method_holder->data() == 0 ...) failed: a) MT-unsafe modification of inline cache
jcm
parents: 36542
diff changeset
   382
  }
34487
db155554abc0 8072008: Emit direct call instead of linkTo* for recursive indy/MH.invoke* calls
vlivanov
parents: 33432
diff changeset
   383
28154
342e86350dc8 8066433: Move Whitebox test library to top level repository
thartmann
parents:
diff changeset
   384
  // Intered strings
342e86350dc8 8066433: Move Whitebox test library to top level repository
thartmann
parents:
diff changeset
   385
  public native boolean isInStringTable(String str);
342e86350dc8 8066433: Move Whitebox test library to top level repository
thartmann
parents:
diff changeset
   386
342e86350dc8 8066433: Move Whitebox test library to top level repository
thartmann
parents:
diff changeset
   387
  // Memory
342e86350dc8 8066433: Move Whitebox test library to top level repository
thartmann
parents:
diff changeset
   388
  public native void readReservedMemory();
342e86350dc8 8066433: Move Whitebox test library to top level repository
thartmann
parents:
diff changeset
   389
  public native long allocateMetaspace(ClassLoader classLoader, long size);
342e86350dc8 8066433: Move Whitebox test library to top level repository
thartmann
parents:
diff changeset
   390
  public native void freeMetaspace(ClassLoader classLoader, long addr, long size);
342e86350dc8 8066433: Move Whitebox test library to top level repository
thartmann
parents:
diff changeset
   391
  public native long incMetaspaceCapacityUntilGC(long increment);
342e86350dc8 8066433: Move Whitebox test library to top level repository
thartmann
parents:
diff changeset
   392
  public native long metaspaceCapacityUntilGC();
46240
98d72284506a 8072061: Automatically determine optimal sizes for the CDS regions
iklam
parents: 46236
diff changeset
   393
  public native long metaspaceReserveAlignment();
28154
342e86350dc8 8066433: Move Whitebox test library to top level repository
thartmann
parents:
diff changeset
   394
38629
0602da3f94c9 8154096: Extend WhiteBox API with methods which retrieve from VM information about available GC
dfazunen
parents: 37958
diff changeset
   395
  // Don't use these methods directly
0602da3f94c9 8154096: Extend WhiteBox API with methods which retrieve from VM information about available GC
dfazunen
parents: 37958
diff changeset
   396
  // Use sun.hotspot.gc.GC class instead.
49630
2f1b308b4469 8199927: Make WhiteBox more GC agnostic
pliden
parents: 49322
diff changeset
   397
  public native boolean isGCSupported(int name);
2f1b308b4469 8199927: Make WhiteBox more GC agnostic
pliden
parents: 49322
diff changeset
   398
  public native boolean isGCSelected(int name);
2f1b308b4469 8199927: Make WhiteBox more GC agnostic
pliden
parents: 49322
diff changeset
   399
  public native boolean isGCSelectedErgonomically();
38629
0602da3f94c9 8154096: Extend WhiteBox API with methods which retrieve from VM information about available GC
dfazunen
parents: 37958
diff changeset
   400
28154
342e86350dc8 8066433: Move Whitebox test library to top level repository
thartmann
parents:
diff changeset
   401
  // Force Young GC
342e86350dc8 8066433: Move Whitebox test library to top level repository
thartmann
parents:
diff changeset
   402
  public native void youngGC();
342e86350dc8 8066433: Move Whitebox test library to top level repository
thartmann
parents:
diff changeset
   403
342e86350dc8 8066433: Move Whitebox test library to top level repository
thartmann
parents:
diff changeset
   404
  // Force Full GC
342e86350dc8 8066433: Move Whitebox test library to top level repository
thartmann
parents:
diff changeset
   405
  public native void fullGC();
342e86350dc8 8066433: Move Whitebox test library to top level repository
thartmann
parents:
diff changeset
   406
46205
177c44a71273 8169517: WhiteBox should provide concurrent GC phase control
kbarrett
parents: 46194
diff changeset
   407
  // Returns true if the current GC supports control of its concurrent
177c44a71273 8169517: WhiteBox should provide concurrent GC phase control
kbarrett
parents: 46194
diff changeset
   408
  // phase via requestConcurrentGCPhase().  If false, a request will
177c44a71273 8169517: WhiteBox should provide concurrent GC phase control
kbarrett
parents: 46194
diff changeset
   409
  // always fail.
177c44a71273 8169517: WhiteBox should provide concurrent GC phase control
kbarrett
parents: 46194
diff changeset
   410
  public native boolean supportsConcurrentGCPhaseControl();
177c44a71273 8169517: WhiteBox should provide concurrent GC phase control
kbarrett
parents: 46194
diff changeset
   411
177c44a71273 8169517: WhiteBox should provide concurrent GC phase control
kbarrett
parents: 46194
diff changeset
   412
  // Attempt to put the collector into the indicated concurrent phase,
177c44a71273 8169517: WhiteBox should provide concurrent GC phase control
kbarrett
parents: 46194
diff changeset
   413
  // and attempt to remain in that state until a new request is made.
177c44a71273 8169517: WhiteBox should provide concurrent GC phase control
kbarrett
parents: 46194
diff changeset
   414
  //
177c44a71273 8169517: WhiteBox should provide concurrent GC phase control
kbarrett
parents: 46194
diff changeset
   415
  // Returns immediately if already in the requested phase.
177c44a71273 8169517: WhiteBox should provide concurrent GC phase control
kbarrett
parents: 46194
diff changeset
   416
  // Otherwise, waits until the phase is reached.
177c44a71273 8169517: WhiteBox should provide concurrent GC phase control
kbarrett
parents: 46194
diff changeset
   417
  //
177c44a71273 8169517: WhiteBox should provide concurrent GC phase control
kbarrett
parents: 46194
diff changeset
   418
  // Throws IllegalStateException if unsupported by the current collector.
177c44a71273 8169517: WhiteBox should provide concurrent GC phase control
kbarrett
parents: 46194
diff changeset
   419
  // Throws NullPointerException if phase is null.
177c44a71273 8169517: WhiteBox should provide concurrent GC phase control
kbarrett
parents: 46194
diff changeset
   420
  // Throws IllegalArgumentException if phase is not valid for the current collector.
177c44a71273 8169517: WhiteBox should provide concurrent GC phase control
kbarrett
parents: 46194
diff changeset
   421
  public void requestConcurrentGCPhase(String phase) {
177c44a71273 8169517: WhiteBox should provide concurrent GC phase control
kbarrett
parents: 46194
diff changeset
   422
    if (!supportsConcurrentGCPhaseControl()) {
177c44a71273 8169517: WhiteBox should provide concurrent GC phase control
kbarrett
parents: 46194
diff changeset
   423
      throw new IllegalStateException("Concurrent GC phase control not supported");
177c44a71273 8169517: WhiteBox should provide concurrent GC phase control
kbarrett
parents: 46194
diff changeset
   424
    } else if (phase == null) {
177c44a71273 8169517: WhiteBox should provide concurrent GC phase control
kbarrett
parents: 46194
diff changeset
   425
      throw new NullPointerException("null phase");
177c44a71273 8169517: WhiteBox should provide concurrent GC phase control
kbarrett
parents: 46194
diff changeset
   426
    } else if (!requestConcurrentGCPhase0(phase)) {
177c44a71273 8169517: WhiteBox should provide concurrent GC phase control
kbarrett
parents: 46194
diff changeset
   427
      throw new IllegalArgumentException("Unknown concurrent GC phase: " + phase);
177c44a71273 8169517: WhiteBox should provide concurrent GC phase control
kbarrett
parents: 46194
diff changeset
   428
    }
177c44a71273 8169517: WhiteBox should provide concurrent GC phase control
kbarrett
parents: 46194
diff changeset
   429
  }
177c44a71273 8169517: WhiteBox should provide concurrent GC phase control
kbarrett
parents: 46194
diff changeset
   430
177c44a71273 8169517: WhiteBox should provide concurrent GC phase control
kbarrett
parents: 46194
diff changeset
   431
  // Helper for requestConcurrentGCPhase().  Returns true if request
177c44a71273 8169517: WhiteBox should provide concurrent GC phase control
kbarrett
parents: 46194
diff changeset
   432
  // succeeded, false if the phase is invalid.
177c44a71273 8169517: WhiteBox should provide concurrent GC phase control
kbarrett
parents: 46194
diff changeset
   433
  private native boolean requestConcurrentGCPhase0(String phase);
177c44a71273 8169517: WhiteBox should provide concurrent GC phase control
kbarrett
parents: 46194
diff changeset
   434
28154
342e86350dc8 8066433: Move Whitebox test library to top level repository
thartmann
parents:
diff changeset
   435
  // Method tries to start concurrent mark cycle.
342e86350dc8 8066433: Move Whitebox test library to top level repository
thartmann
parents:
diff changeset
   436
  // It returns false if CM Thread is always in concurrent cycle.
342e86350dc8 8066433: Move Whitebox test library to top level repository
thartmann
parents:
diff changeset
   437
  public native boolean g1StartConcMarkCycle();
342e86350dc8 8066433: Move Whitebox test library to top level repository
thartmann
parents:
diff changeset
   438
342e86350dc8 8066433: Move Whitebox test library to top level repository
thartmann
parents:
diff changeset
   439
  // Tests on ReservedSpace/VirtualSpace classes
342e86350dc8 8066433: Move Whitebox test library to top level repository
thartmann
parents:
diff changeset
   440
  public native int stressVirtualSpaceResize(long reservedSpaceSize, long magnitude, long iterations);
342e86350dc8 8066433: Move Whitebox test library to top level repository
thartmann
parents:
diff changeset
   441
  public native void runMemoryUnitTests();
342e86350dc8 8066433: Move Whitebox test library to top level repository
thartmann
parents:
diff changeset
   442
  public native void readFromNoaccessArea();
342e86350dc8 8066433: Move Whitebox test library to top level repository
thartmann
parents:
diff changeset
   443
  public native long getThreadStackSize();
342e86350dc8 8066433: Move Whitebox test library to top level repository
thartmann
parents:
diff changeset
   444
  public native long getThreadRemainingStackSize();
342e86350dc8 8066433: Move Whitebox test library to top level repository
thartmann
parents:
diff changeset
   445
342e86350dc8 8066433: Move Whitebox test library to top level repository
thartmann
parents:
diff changeset
   446
  // CPU features
342e86350dc8 8066433: Move Whitebox test library to top level repository
thartmann
parents:
diff changeset
   447
  public native String getCPUFeatures();
342e86350dc8 8066433: Move Whitebox test library to top level repository
thartmann
parents:
diff changeset
   448
342e86350dc8 8066433: Move Whitebox test library to top level repository
thartmann
parents:
diff changeset
   449
  // VM flags
342e86350dc8 8066433: Move Whitebox test library to top level repository
thartmann
parents:
diff changeset
   450
  public native boolean isConstantVMFlag(String name);
342e86350dc8 8066433: Move Whitebox test library to top level repository
thartmann
parents:
diff changeset
   451
  public native boolean isLockedVMFlag(String name);
342e86350dc8 8066433: Move Whitebox test library to top level repository
thartmann
parents:
diff changeset
   452
  public native void    setBooleanVMFlag(String name, boolean value);
31221
72b40bd3f4ee 8080947: Add uint as a valid VM flag type
david
parents: 30083
diff changeset
   453
  public native void    setIntVMFlag(String name, long value);
72b40bd3f4ee 8080947: Add uint as a valid VM flag type
david
parents: 30083
diff changeset
   454
  public native void    setUintVMFlag(String name, long value);
28154
342e86350dc8 8066433: Move Whitebox test library to top level repository
thartmann
parents:
diff changeset
   455
  public native void    setIntxVMFlag(String name, long value);
342e86350dc8 8066433: Move Whitebox test library to top level repository
thartmann
parents:
diff changeset
   456
  public native void    setUintxVMFlag(String name, long value);
342e86350dc8 8066433: Move Whitebox test library to top level repository
thartmann
parents:
diff changeset
   457
  public native void    setUint64VMFlag(String name, long value);
342e86350dc8 8066433: Move Whitebox test library to top level repository
thartmann
parents:
diff changeset
   458
  public native void    setSizeTVMFlag(String name, long value);
342e86350dc8 8066433: Move Whitebox test library to top level repository
thartmann
parents:
diff changeset
   459
  public native void    setStringVMFlag(String name, String value);
342e86350dc8 8066433: Move Whitebox test library to top level repository
thartmann
parents:
diff changeset
   460
  public native void    setDoubleVMFlag(String name, double value);
342e86350dc8 8066433: Move Whitebox test library to top level repository
thartmann
parents:
diff changeset
   461
  public native Boolean getBooleanVMFlag(String name);
31221
72b40bd3f4ee 8080947: Add uint as a valid VM flag type
david
parents: 30083
diff changeset
   462
  public native Long    getIntVMFlag(String name);
72b40bd3f4ee 8080947: Add uint as a valid VM flag type
david
parents: 30083
diff changeset
   463
  public native Long    getUintVMFlag(String name);
28154
342e86350dc8 8066433: Move Whitebox test library to top level repository
thartmann
parents:
diff changeset
   464
  public native Long    getIntxVMFlag(String name);
342e86350dc8 8066433: Move Whitebox test library to top level repository
thartmann
parents:
diff changeset
   465
  public native Long    getUintxVMFlag(String name);
342e86350dc8 8066433: Move Whitebox test library to top level repository
thartmann
parents:
diff changeset
   466
  public native Long    getUint64VMFlag(String name);
342e86350dc8 8066433: Move Whitebox test library to top level repository
thartmann
parents:
diff changeset
   467
  public native Long    getSizeTVMFlag(String name);
342e86350dc8 8066433: Move Whitebox test library to top level repository
thartmann
parents:
diff changeset
   468
  public native String  getStringVMFlag(String name);
342e86350dc8 8066433: Move Whitebox test library to top level repository
thartmann
parents:
diff changeset
   469
  public native Double  getDoubleVMFlag(String name);
342e86350dc8 8066433: Move Whitebox test library to top level repository
thartmann
parents:
diff changeset
   470
  private final List<Function<String,Object>> flagsGetters = Arrays.asList(
31221
72b40bd3f4ee 8080947: Add uint as a valid VM flag type
david
parents: 30083
diff changeset
   471
    this::getBooleanVMFlag, this::getIntVMFlag, this::getUintVMFlag,
72b40bd3f4ee 8080947: Add uint as a valid VM flag type
david
parents: 30083
diff changeset
   472
    this::getIntxVMFlag, this::getUintxVMFlag, this::getUint64VMFlag,
72b40bd3f4ee 8080947: Add uint as a valid VM flag type
david
parents: 30083
diff changeset
   473
    this::getSizeTVMFlag, this::getStringVMFlag, this::getDoubleVMFlag);
28154
342e86350dc8 8066433: Move Whitebox test library to top level repository
thartmann
parents:
diff changeset
   474
342e86350dc8 8066433: Move Whitebox test library to top level repository
thartmann
parents:
diff changeset
   475
  public Object getVMFlag(String name) {
342e86350dc8 8066433: Move Whitebox test library to top level repository
thartmann
parents:
diff changeset
   476
    return flagsGetters.stream()
342e86350dc8 8066433: Move Whitebox test library to top level repository
thartmann
parents:
diff changeset
   477
                       .map(f -> f.apply(name))
342e86350dc8 8066433: Move Whitebox test library to top level repository
thartmann
parents:
diff changeset
   478
                       .filter(x -> x != null)
342e86350dc8 8066433: Move Whitebox test library to top level repository
thartmann
parents:
diff changeset
   479
                       .findAny()
342e86350dc8 8066433: Move Whitebox test library to top level repository
thartmann
parents:
diff changeset
   480
                       .orElse(null);
342e86350dc8 8066433: Move Whitebox test library to top level repository
thartmann
parents:
diff changeset
   481
  }
36506
17612cee3530 8142968: Module System implementation
alanb
parents: 36287
diff changeset
   482
17612cee3530 8142968: Module System implementation
alanb
parents: 36287
diff changeset
   483
  // Jigsaw
46209
2ca4b9abe9b6 8165896: Use "open" flag from JVM_DefineModule to export all module packages
rprotacio
parents: 46205
diff changeset
   484
  public native void DefineModule(Object module, boolean is_open, String version,
2ca4b9abe9b6 8165896: Use "open" flag from JVM_DefineModule to export all module packages
rprotacio
parents: 46205
diff changeset
   485
                                  String location, Object[] packages);
36506
17612cee3530 8142968: Module System implementation
alanb
parents: 36287
diff changeset
   486
  public native void AddModuleExports(Object from_module, String pkg, Object to_module);
17612cee3530 8142968: Module System implementation
alanb
parents: 36287
diff changeset
   487
  public native void AddReadsModule(Object from_module, Object source_module);
17612cee3530 8142968: Module System implementation
alanb
parents: 36287
diff changeset
   488
  public native void AddModuleExportsToAllUnnamed(Object module, String pkg);
17612cee3530 8142968: Module System implementation
alanb
parents: 36287
diff changeset
   489
  public native void AddModuleExportsToAll(Object module, String pkg);
17612cee3530 8142968: Module System implementation
alanb
parents: 36287
diff changeset
   490
28154
342e86350dc8 8066433: Move Whitebox test library to top level repository
thartmann
parents:
diff changeset
   491
  public native int getOffsetForName0(String name);
342e86350dc8 8066433: Move Whitebox test library to top level repository
thartmann
parents:
diff changeset
   492
  public int getOffsetForName(String name) throws Exception {
342e86350dc8 8066433: Move Whitebox test library to top level repository
thartmann
parents:
diff changeset
   493
    int offset = getOffsetForName0(name);
342e86350dc8 8066433: Move Whitebox test library to top level repository
thartmann
parents:
diff changeset
   494
    if (offset == -1) {
342e86350dc8 8066433: Move Whitebox test library to top level repository
thartmann
parents:
diff changeset
   495
      throw new RuntimeException(name + " not found");
342e86350dc8 8066433: Move Whitebox test library to top level repository
thartmann
parents:
diff changeset
   496
    }
342e86350dc8 8066433: Move Whitebox test library to top level repository
thartmann
parents:
diff changeset
   497
    return offset;
342e86350dc8 8066433: Move Whitebox test library to top level repository
thartmann
parents:
diff changeset
   498
  }
29440
87390f81c75d 8074980: add WhiteBox API to get a flag value for a method
iignatyev
parents: 28351
diff changeset
   499
  public native Boolean getMethodBooleanOption(Executable method, String name);
87390f81c75d 8074980: add WhiteBox API to get a flag value for a method
iignatyev
parents: 28351
diff changeset
   500
  public native Long    getMethodIntxOption(Executable method, String name);
87390f81c75d 8074980: add WhiteBox API to get a flag value for a method
iignatyev
parents: 28351
diff changeset
   501
  public native Long    getMethodUintxOption(Executable method, String name);
87390f81c75d 8074980: add WhiteBox API to get a flag value for a method
iignatyev
parents: 28351
diff changeset
   502
  public native Double  getMethodDoubleOption(Executable method, String name);
87390f81c75d 8074980: add WhiteBox API to get a flag value for a method
iignatyev
parents: 28351
diff changeset
   503
  public native String  getMethodStringOption(Executable method, String name);
87390f81c75d 8074980: add WhiteBox API to get a flag value for a method
iignatyev
parents: 28351
diff changeset
   504
  private final List<BiFunction<Executable,String,Object>> methodOptionGetters
87390f81c75d 8074980: add WhiteBox API to get a flag value for a method
iignatyev
parents: 28351
diff changeset
   505
      = Arrays.asList(this::getMethodBooleanOption, this::getMethodIntxOption,
87390f81c75d 8074980: add WhiteBox API to get a flag value for a method
iignatyev
parents: 28351
diff changeset
   506
          this::getMethodUintxOption, this::getMethodDoubleOption,
87390f81c75d 8074980: add WhiteBox API to get a flag value for a method
iignatyev
parents: 28351
diff changeset
   507
          this::getMethodStringOption);
87390f81c75d 8074980: add WhiteBox API to get a flag value for a method
iignatyev
parents: 28351
diff changeset
   508
87390f81c75d 8074980: add WhiteBox API to get a flag value for a method
iignatyev
parents: 28351
diff changeset
   509
  public Object getMethodOption(Executable method, String name) {
87390f81c75d 8074980: add WhiteBox API to get a flag value for a method
iignatyev
parents: 28351
diff changeset
   510
    return methodOptionGetters.stream()
87390f81c75d 8074980: add WhiteBox API to get a flag value for a method
iignatyev
parents: 28351
diff changeset
   511
                              .map(f -> f.apply(method, name))
87390f81c75d 8074980: add WhiteBox API to get a flag value for a method
iignatyev
parents: 28351
diff changeset
   512
                              .filter(x -> x != null)
87390f81c75d 8074980: add WhiteBox API to get a flag value for a method
iignatyev
parents: 28351
diff changeset
   513
                              .findAny()
87390f81c75d 8074980: add WhiteBox API to get a flag value for a method
iignatyev
parents: 28351
diff changeset
   514
                              .orElse(null);
87390f81c75d 8074980: add WhiteBox API to get a flag value for a method
iignatyev
parents: 28351
diff changeset
   515
  }
28154
342e86350dc8 8066433: Move Whitebox test library to top level repository
thartmann
parents:
diff changeset
   516
28159
d5940675c190 8067972: Bring changes made to WhiteBox.java in 8047290 to that file new location in the top repo
kvn
parents: 28157
diff changeset
   517
  // Safepoint Checking
d5940675c190 8067972: Bring changes made to WhiteBox.java in 8047290 to that file new location in the top repo
kvn
parents: 28157
diff changeset
   518
  public native void assertMatchingSafepointCalls(boolean mutexSafepointValue, boolean attemptedNoSafepointValue);
58409
a595e67d6683 8184732: Deadlock detection improvements for 'special' locks
coleenp
parents: 54927
diff changeset
   519
  public native void assertSpecialLock(boolean allowVMBlock, boolean safepointCheck);
31314
f273a8edea25 8015086: add interned strings to the shared archive.
jiangli
parents: 31221
diff changeset
   520
46247
c703884b0459 8179302: Pre-resolve constant pool string entries and cache resolved_reference arrays in CDS archive.
jiangli
parents: 46242
diff changeset
   521
  // Sharing & archiving
52030
57862a02bf4b 8202951: Implementation of JEP 341: Default CDS Archives
jiangli
parents: 51747
diff changeset
   522
  public native String  getDefaultArchivePath();
54927
1512d88b24c6 8207812: Implement Dynamic CDS Archive
ccheung
parents: 54736
diff changeset
   523
  public native boolean cdsMemoryMappingFailed();
52030
57862a02bf4b 8202951: Implementation of JEP 341: Default CDS Archives
jiangli
parents: 51747
diff changeset
   524
  public native boolean isSharingEnabled();
36506
17612cee3530 8142968: Module System implementation
alanb
parents: 36287
diff changeset
   525
  public native boolean isShared(Object o);
34113
210cb6523c6e 8140802: Clean up and refactor of class loading code for CDS
iklam
parents: 33432
diff changeset
   526
  public native boolean isSharedClass(Class<?> c);
31317
9029b3303113 8098821: Crash in system dictionary initialization with shared strings
mseledtsov
parents: 31314
diff changeset
   527
  public native boolean areSharedStringsIgnored();
46242
9465c23e4e0d 8185436: jtreg: introduce @requires property to disable cds tests
goetz
parents: 46240
diff changeset
   528
  public native boolean isCDSIncludedInVmBuild();
51214
67736b4846a0 8207830: [aix] disable jfr in build and tests
goetz
parents: 49630
diff changeset
   529
  public native boolean isJFRIncludedInVmBuild();
49008
d777541fceba 8191375: Add high-level jtreg VMProps to filter out CDS tests
iklam
parents: 48975
diff changeset
   530
  public native boolean isJavaHeapArchiveSupported();
46247
c703884b0459 8179302: Pre-resolve constant pool string entries and cache resolved_reference arrays in CDS archive.
jiangli
parents: 46242
diff changeset
   531
  public native Object  getResolvedReferences(Class<?> c);
54927
1512d88b24c6 8207812: Implement Dynamic CDS Archive
ccheung
parents: 54736
diff changeset
   532
  public native void    linkClass(Class<?> c);
47805
506775a4f446 8189840: CheckCachedResolvedReferencesApp has no cached resolved references
jiangli
parents: 47264
diff changeset
   533
  public native boolean areOpenArchiveHeapObjectsMapped();
36536
1ecb1c7ada71 8150646: Add support for blocking compiles though whitebox API
simonis
parents: 36287
diff changeset
   534
1ecb1c7ada71 8150646: Add support for blocking compiles though whitebox API
simonis
parents: 36287
diff changeset
   535
  // Compiler Directive
1ecb1c7ada71 8150646: Add support for blocking compiles though whitebox API
simonis
parents: 36287
diff changeset
   536
  public native int addCompilerDirective(String compDirect);
1ecb1c7ada71 8150646: Add support for blocking compiles though whitebox API
simonis
parents: 36287
diff changeset
   537
  public native void removeCompilerDirective(int count);
47264
8b5ed0358b3a 8187045: [linux] Not all libraries in the VM are linked with -z,noexecstack
goetz
parents: 46247
diff changeset
   538
47881
0ce0ac68ace7 8189941: Implementation JEP 312: Thread-local handshake
rehn
parents: 47805
diff changeset
   539
  // Handshakes
0ce0ac68ace7 8189941: Implementation JEP 312: Thread-local handshake
rehn
parents: 47805
diff changeset
   540
  public native int handshakeWalkStack(Thread t, boolean all_threads);
0ce0ac68ace7 8189941: Implementation JEP 312: Thread-local handshake
rehn
parents: 47805
diff changeset
   541
47264
8b5ed0358b3a 8187045: [linux] Not all libraries in the VM are linked with -z,noexecstack
goetz
parents: 46247
diff changeset
   542
  // Returns true on linux if library has the noexecstack flag set.
8b5ed0358b3a 8187045: [linux] Not all libraries in the VM are linked with -z,noexecstack
goetz
parents: 46247
diff changeset
   543
  public native boolean checkLibSpecifiesNoexecstack(String libfilename);
47908
d6d00f785f39 8189762: [TESTBUG] Create tests for JDK-8146115 container awareness and resource configuration
mseledtsov
parents: 47881
diff changeset
   544
d6d00f785f39 8189762: [TESTBUG] Create tests for JDK-8146115 container awareness and resource configuration
mseledtsov
parents: 47881
diff changeset
   545
  // Container testing
d6d00f785f39 8189762: [TESTBUG] Create tests for JDK-8146115 container awareness and resource configuration
mseledtsov
parents: 47881
diff changeset
   546
  public native boolean isContainerized();
d6d00f785f39 8189762: [TESTBUG] Create tests for JDK-8146115 container awareness and resource configuration
mseledtsov
parents: 47881
diff changeset
   547
  public native void printOsInfo();
d6d00f785f39 8189762: [TESTBUG] Create tests for JDK-8146115 container awareness and resource configuration
mseledtsov
parents: 47881
diff changeset
   548
48975
2c35fd3c5789 8193373: Cleanup ElfFile and family
zgu
parents: 47908
diff changeset
   549
  // Decoder
2c35fd3c5789 8193373: Cleanup ElfFile and family
zgu
parents: 47908
diff changeset
   550
  public native void disableElfSectionCache();
51567
0c4f2b26849e 8209844: MemberNameLeak.java fails when ResolvedMethod entry is not removed
pchilanomate
parents: 51214
diff changeset
   551
0c4f2b26849e 8209844: MemberNameLeak.java fails when ResolvedMethod entry is not removed
pchilanomate
parents: 51214
diff changeset
   552
  // Resolved Method Table
54511
fbfcebad8e66 8221393: ResolvedMethodTable too small for StackWalking applications
stefank
parents: 53709
diff changeset
   553
  public native long resolvedMethodItemsCount();
51610
cdef4df6b0e7 8206424: Use locking for cleaning ProtectionDomainTable
pchilanomate
parents: 51567
diff changeset
   554
cdef4df6b0e7 8206424: Use locking for cleaning ProtectionDomainTable
pchilanomate
parents: 51567
diff changeset
   555
  // Protection Domain Table
cdef4df6b0e7 8206424: Use locking for cleaning ProtectionDomainTable
pchilanomate
parents: 51567
diff changeset
   556
  public native int protectionDomainRemovedCount();
53494
8fd43dacaef7 8216180: [AOT] compiler/intrinsics/bigInteger/TestMulAdd.java crashed with AOT enabled
iignatyev
parents: 53116
diff changeset
   557
8fd43dacaef7 8216180: [AOT] compiler/intrinsics/bigInteger/TestMulAdd.java crashed with AOT enabled
iignatyev
parents: 53116
diff changeset
   558
  // Number of loaded AOT libraries
8fd43dacaef7 8216180: [AOT] compiler/intrinsics/bigInteger/TestMulAdd.java crashed with AOT enabled
iignatyev
parents: 53116
diff changeset
   559
  public native int aotLibrariesCount();
28154
342e86350dc8 8066433: Move Whitebox test library to top level repository
thartmann
parents:
diff changeset
   560
}