Print this page
rev 6891 : 8062247: [TESTBUG] Allow WhiteBox test to access JVM offsets
Reviewed-by: coleenp, iklam, mseledtsov
Contributed-by: yumin.qi@oracle.com

Split Split Close
Expand all
Collapse all
          --- old/hotspot/test/testlibrary/whitebox/sun/hotspot/WhiteBox.java
          +++ new/hotspot/test/testlibrary/whitebox/sun/hotspot/WhiteBox.java
↓ open down ↓ 96 lines elided ↑ open up ↑
  97   97    public native int     g1RegionSize();
  98   98    public native Object[]    parseCommandLine(String commandline, DiagnosticCommand[] args);
  99   99  
 100  100    // NMT
 101  101    public native long NMTMalloc(long size);
 102  102    public native void NMTFree(long mem);
 103  103    public native long NMTReserveMemory(long size);
 104  104    public native void NMTCommitMemory(long addr, long size);
 105  105    public native void NMTUncommitMemory(long addr, long size);
 106  106    public native void NMTReleaseMemory(long addr, long size);
 107      -  public native void NMTOverflowHashBucket(long num);
 108  107    public native long NMTMallocWithPseudoStack(long size, int index);
 109  108    public native boolean NMTIsDetailSupported();
 110  109    public native boolean NMTChangeTrackingLevel();
      110 +  public native int NMTGetHashSize();
 111  111  
 112  112    // Compiler
 113  113    public native void    deoptimizeAll();
 114  114    public        boolean isMethodCompiled(Executable method) {
 115  115      return isMethodCompiled(method, false /*not osr*/);
 116  116    }
 117  117    public native boolean isMethodCompiled(Executable method, boolean isOsr);
 118  118    public        boolean isMethodCompilable(Executable method) {
 119  119      return isMethodCompilable(method, -1 /*any*/);
 120  120    }
↓ open down ↓ 80 lines elided ↑ open up ↑
 201  201      this::getBooleanVMFlag, this::getIntxVMFlag, this::getUintxVMFlag,
 202  202      this::getUint64VMFlag, this::getStringVMFlag, this::getDoubleVMFlag);
 203  203  
 204  204    public Object getVMFlag(String name) {
 205  205      return flagsGetters.stream()
 206  206                         .map(f -> f.apply(name))
 207  207                         .filter(x -> x != null)
 208  208                         .findAny()
 209  209                         .orElse(null);
 210  210    }
      211 +  public native int getOffsetForName0(String name);
      212 +  public int getOffsetForName(String name) throws Exception {
      213 +    int offset = getOffsetForName0(name);
      214 +    if (offset == -1) {
      215 +      throw new RuntimeException(name + " not found");
      216 +    }
      217 +    return offset;
      218 +  }
      219 +
 211  220  }
    
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX