Merge
authoramurillo
Fri, 20 May 2016 11:23:53 -0700
changeset 38314 0369cc2a8493
parent 38305 c2adc89c3e67 (current diff)
parent 38313 615905db3fe4 (diff)
child 38315 41885f8dbcd4
child 38645 3cffc9cf5ded
Merge
hotspot/test/testlibrary/whitebox/sun/hotspot/WhiteBox.java
--- a/hotspot/src/share/vm/ci/ciStreams.cpp	Thu May 19 19:45:52 2016 +0000
+++ b/hotspot/src/share/vm/ci/ciStreams.cpp	Fri May 20 11:23:53 2016 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1999, 2012, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1999, 2016, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -361,14 +361,14 @@
 ciMethod* ciBytecodeStream::get_method(bool& will_link, ciSignature* *declared_signature_result) {
   VM_ENTRY_MARK;
   ciEnv* env = CURRENT_ENV;
-  constantPoolHandle cpool(_method->get_Method()->constants());
+  constantPoolHandle cpool(THREAD, _method->get_Method()->constants());
   ciMethod* m = env->get_method_by_index(cpool, get_method_index(), cur_bc(), _holder);
   will_link = m->is_loaded();
 
   // Use the MethodType stored in the CP cache to create a signature
   // with correct types (in respect to class loaders).
   if (has_method_type()) {
-    ciSymbol*     sig_sym     = env->get_symbol(cpool->symbol_at(get_method_signature_index()));
+    ciSymbol*     sig_sym     = env->get_symbol(cpool->symbol_at(get_method_signature_index(cpool)));
     ciKlass*      pool_holder = env->get_klass(cpool->pool_holder());
     ciMethodType* method_type = get_method_type();
     ciSignature* declared_signature = new (env->arena()) ciSignature(pool_holder, sig_sym, method_type);
@@ -465,9 +465,8 @@
 // Get the constant pool index of the signature of the method
 // referenced by the current bytecode.  Used for generating
 // deoptimization information.
-int ciBytecodeStream::get_method_signature_index() {
+int ciBytecodeStream::get_method_signature_index(const constantPoolHandle& cpool) {
   GUARDED_VM_ENTRY(
-    ConstantPool* cpool = _holder->get_instanceKlass()->constants();
     const int method_index = get_method_index();
     const int name_and_type_index = cpool->name_and_type_ref_index_at(method_index);
     return cpool->signature_ref_index_at(name_and_type_index);
--- a/hotspot/src/share/vm/ci/ciStreams.hpp	Thu May 19 19:45:52 2016 +0000
+++ b/hotspot/src/share/vm/ci/ciStreams.hpp	Fri May 20 11:23:53 2016 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1999, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1999, 2016, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -264,7 +264,7 @@
   ciMethodType* get_method_type();
   ciKlass*      get_declared_method_holder();
   int           get_method_holder_index();
-  int           get_method_signature_index();
+  int           get_method_signature_index(const constantPoolHandle& cpool);
 
   // Get the resolved references arrays from the constant pool
   ciObjArray* get_resolved_references();
--- a/hotspot/src/share/vm/classfile/classFileParser.cpp	Thu May 19 19:45:52 2016 +0000
+++ b/hotspot/src/share/vm/classfile/classFileParser.cpp	Fri May 20 11:23:53 2016 -0700
@@ -5708,8 +5708,10 @@
 
 #if INCLUDE_CDS
     if (DumpLoadedClassList != NULL && stream->source() != NULL && classlist_file->is_open()) {
-      // Only dump the classes that can be stored into CDS archive
-      if (SystemDictionaryShared::is_sharing_possible(_loader_data)) {
+      // Only dump the classes that can be stored into CDS archive.
+      // Anonymous classes such as generated LambdaForm classes are also not included.
+      if (SystemDictionaryShared::is_sharing_possible(_loader_data) &&
+          _host_klass == NULL) {
         ResourceMark rm(THREAD);
         classlist_file->print_cr("%s", _class_name->as_C_string());
         classlist_file->flush();
--- a/hotspot/src/share/vm/gc/g1/g1HeapSizingPolicy_ext.cpp	Thu May 19 19:45:52 2016 +0000
+++ b/hotspot/src/share/vm/gc/g1/g1HeapSizingPolicy_ext.cpp	Fri May 20 11:23:53 2016 -0700
@@ -24,6 +24,7 @@
 
 #include "precompiled.hpp"
 #include "gc/g1/g1HeapSizingPolicy.hpp"
+#include "memory/allocation.inline.hpp"
 
 G1HeapSizingPolicy* G1HeapSizingPolicy::create(const G1CollectedHeap* g1, const G1Analytics* analytics) {
   return new G1HeapSizingPolicy(g1, analytics);
--- a/hotspot/src/share/vm/gc/parallel/psParallelCompact.cpp	Thu May 19 19:45:52 2016 +0000
+++ b/hotspot/src/share/vm/gc/parallel/psParallelCompact.cpp	Fri May 20 11:23:53 2016 -0700
@@ -394,13 +394,6 @@
   HeapWord* end_heap =
     (HeapWord*) heap->young_gen()->virtual_space()->high_boundary();
 
-  size_t end_index =
-    PSParallelCompact::summary_data().addr_to_region_idx(end_heap);
-  ParallelCompactData::RegionData* c = PSParallelCompact::summary_data().region(end_index);
-
-  // Initialize the end region with a bad destination.
-  c->set_destination(begin_heap - 1);
-
   print_generic_summary_data(PSParallelCompact::summary_data(),
     begin_heap, end_heap);
 }
--- a/hotspot/src/share/vm/oops/instanceKlass.hpp	Thu May 19 19:45:52 2016 +0000
+++ b/hotspot/src/share/vm/oops/instanceKlass.hpp	Fri May 20 11:23:53 2016 -0700
@@ -190,6 +190,7 @@
   // _is_marked_dependent can be set concurrently, thus cannot be part of the
   // _misc_flags.
   bool            _is_marked_dependent;  // used for marking during flushing and deoptimization
+  bool            _is_being_redefined;   // used for locking redefinition
 
   // The low two bits of _misc_flags contains the kind field.
   // This can be used to quickly discriminate among the four kinds of
@@ -694,6 +695,10 @@
   }
 
 #if INCLUDE_JVMTI
+  // Redefinition locking.  Class can only be redefined by one thread at a time.
+  bool is_being_redefined() const          { return _is_being_redefined; }
+  void set_is_being_redefined(bool value)  { _is_being_redefined = value; }
+
   // RedefineClasses() support for previous versions:
   void add_previous_version(instanceKlassHandle ikh, int emcp_method_count);
 
--- a/hotspot/src/share/vm/prims/jvmtiRedefineClasses.cpp	Thu May 19 19:45:52 2016 +0000
+++ b/hotspot/src/share/vm/prims/jvmtiRedefineClasses.cpp	Fri May 20 11:23:53 2016 -0700
@@ -69,6 +69,43 @@
   _res = JVMTI_ERROR_NONE;
 }
 
+static inline InstanceKlass* get_ik(jclass def) {
+  oop mirror = JNIHandles::resolve_non_null(def);
+  return InstanceKlass::cast(java_lang_Class::as_Klass(mirror));
+}
+
+// If any of the classes are being redefined, wait
+// Parallel constant pool merging leads to indeterminate constant pools.
+void VM_RedefineClasses::lock_classes() {
+  MutexLocker ml(RedefineClasses_lock);
+  bool has_redefined;
+  do {
+    has_redefined = false;
+    // Go through classes each time until none are being redefined.
+    for (int i = 0; i < _class_count; i++) {
+      if (get_ik(_class_defs[i].klass)->is_being_redefined()) {
+        RedefineClasses_lock->wait();
+        has_redefined = true;
+        break;  // for loop
+      }
+    }
+  } while (has_redefined);
+  for (int i = 0; i < _class_count; i++) {
+    get_ik(_class_defs[i].klass)->set_is_being_redefined(true);
+  }
+  RedefineClasses_lock->notify_all();
+}
+
+void VM_RedefineClasses::unlock_classes() {
+  MutexLocker ml(RedefineClasses_lock);
+  for (int i = 0; i < _class_count; i++) {
+    assert(get_ik(_class_defs[i].klass)->is_being_redefined(),
+           "should be being redefined to get here");
+    get_ik(_class_defs[i].klass)->set_is_being_redefined(false);
+  }
+  RedefineClasses_lock->notify_all();
+}
+
 bool VM_RedefineClasses::doit_prologue() {
   if (_class_count == 0) {
     _res = JVMTI_ERROR_NONE;
@@ -91,6 +128,14 @@
       _res = JVMTI_ERROR_NULL_POINTER;
       return false;
     }
+
+    oop mirror = JNIHandles::resolve_non_null(_class_defs[i].klass);
+    // classes for primitives and arrays cannot be redefined
+    // check here so following code can assume these classes are InstanceKlass
+    if (!is_modifiable_class(mirror)) {
+      _res = JVMTI_ERROR_UNMODIFIABLE_CLASS;
+      return false;
+    }
   }
 
   // Start timer after all the sanity checks; not quite accurate, but
@@ -99,6 +144,7 @@
     _timer_vm_op_prologue.start();
   }
 
+  lock_classes();
   // We first load new class versions in the prologue, because somewhere down the
   // call chain it is required that the current thread is a Java thread.
   _res = load_new_class_versions(Thread::current());
@@ -115,6 +161,7 @@
     // Free os::malloc allocated memory in load_new_class_version.
     os::free(_scratch_classes);
     _timer_vm_op_prologue.stop();
+    unlock_classes();
     return false;
   }
 
@@ -174,6 +221,8 @@
 }
 
 void VM_RedefineClasses::doit_epilogue() {
+  unlock_classes();
+
   // Free os::malloc allocated memory.
   os::free(_scratch_classes);
 
@@ -959,14 +1008,7 @@
     // versions are deleted. Constant pools are deallocated while merging
     // constant pools
     HandleMark hm(THREAD);
-
-    oop mirror = JNIHandles::resolve_non_null(_class_defs[i].klass);
-    // classes for primitives cannot be redefined
-    if (!is_modifiable_class(mirror)) {
-      return JVMTI_ERROR_UNMODIFIABLE_CLASS;
-    }
-    Klass* the_class_oop = java_lang_Class::as_Klass(mirror);
-    instanceKlassHandle the_class = instanceKlassHandle(THREAD, the_class_oop);
+    instanceKlassHandle the_class(THREAD, get_ik(_class_defs[i].klass));
     Symbol*  the_class_sym = the_class->name();
 
     log_debug(redefine, class, load)
@@ -3757,22 +3799,19 @@
     _timer_rsc_phase1.start();
   }
 
-  instanceKlassHandle scratch_class(scratch_class_oop);
-
-  oop the_class_mirror = JNIHandles::resolve_non_null(the_jclass);
-  Klass* the_class_oop = java_lang_Class::as_Klass(the_class_mirror);
-  instanceKlassHandle the_class = instanceKlassHandle(THREAD, the_class_oop);
+  instanceKlassHandle scratch_class(THREAD, scratch_class_oop);
+  instanceKlassHandle the_class(THREAD, get_ik(the_jclass));
 
   // Remove all breakpoints in methods of this class
   JvmtiBreakpoints& jvmti_breakpoints = JvmtiCurrentBreakpoints::get_jvmti_breakpoints();
-  jvmti_breakpoints.clearall_in_class_at_safepoint(the_class_oop);
+  jvmti_breakpoints.clearall_in_class_at_safepoint(the_class());
 
   // Deoptimize all compiled code that depends on this class
   flush_dependent_code(the_class, THREAD);
 
   _old_methods = the_class->methods();
   _new_methods = scratch_class->methods();
-  _the_class_oop = the_class_oop;
+  _the_class_oop = the_class();
   compute_added_deleted_matching_methods();
   update_jmethod_ids();
 
@@ -4002,10 +4041,10 @@
     increment_class_counter((InstanceKlass *)the_class(), THREAD);
     log_info(redefine, class, load)
       ("redefined name=%s, count=%d (avail_mem=" UINT64_FORMAT "K)",
-       the_class->external_name(), java_lang_Class::classRedefinedCount(the_class_mirror), os::available_memory() >> 10);
+       the_class->external_name(), java_lang_Class::classRedefinedCount(the_class->java_mirror()), os::available_memory() >> 10);
     Events::log_redefinition(THREAD, "redefined class name=%s, count=%d",
                              the_class->external_name(),
-                             java_lang_Class::classRedefinedCount(the_class_mirror));
+                             java_lang_Class::classRedefinedCount(the_class->java_mirror()));
 
   }
   _timer_rsc_phase2.stop();
--- a/hotspot/src/share/vm/prims/jvmtiRedefineClasses.hpp	Thu May 19 19:45:52 2016 +0000
+++ b/hotspot/src/share/vm/prims/jvmtiRedefineClasses.hpp	Fri May 20 11:23:53 2016 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2003, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 2016, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -489,6 +489,10 @@
 
   void flush_dependent_code(instanceKlassHandle k_h, TRAPS);
 
+  // lock classes to redefine since constant pool merging isn't thread safe.
+  void lock_classes();
+  void unlock_classes();
+
   static void dump_methods();
 
   // Check that there are no old or obsolete methods
--- a/hotspot/src/share/vm/runtime/mutex.cpp	Thu May 19 19:45:52 2016 +0000
+++ b/hotspot/src/share/vm/runtime/mutex.cpp	Fri May 20 11:23:53 2016 -0700
@@ -24,6 +24,7 @@
 
 #include "precompiled.hpp"
 #include "runtime/atomic.inline.hpp"
+#include "runtime/interfaceSupport.hpp"
 #include "runtime/mutex.hpp"
 #include "runtime/orderAccess.inline.hpp"
 #include "runtime/osThread.hpp"
--- a/hotspot/src/share/vm/runtime/mutexLocker.cpp	Thu May 19 19:45:52 2016 +0000
+++ b/hotspot/src/share/vm/runtime/mutexLocker.cpp	Fri May 20 11:23:53 2016 -0700
@@ -120,6 +120,7 @@
 Mutex*   Management_lock              = NULL;
 Monitor* Service_lock                 = NULL;
 Monitor* PeriodicTask_lock            = NULL;
+Monitor* RedefineClasses_lock         = NULL;
 
 #ifdef INCLUDE_TRACE
 Mutex*   JfrStacktrace_lock           = NULL;
@@ -264,6 +265,7 @@
   def(Debug3_lock                  , Mutex  , nonleaf+4,   true,  Monitor::_safepoint_check_never);
   def(CompileThread_lock           , Monitor, nonleaf+5,   false, Monitor::_safepoint_check_always);
   def(PeriodicTask_lock            , Monitor, nonleaf+5,   true,  Monitor::_safepoint_check_sometimes);
+  def(RedefineClasses_lock         , Monitor, nonleaf+5,   true,  Monitor::_safepoint_check_always);
   if (WhiteBoxAPI) {
     def(Compilation_lock           , Monitor, leaf,        false, Monitor::_safepoint_check_never);
   }
--- a/hotspot/src/share/vm/runtime/mutexLocker.hpp	Thu May 19 19:45:52 2016 +0000
+++ b/hotspot/src/share/vm/runtime/mutexLocker.hpp	Fri May 20 11:23:53 2016 -0700
@@ -121,6 +121,7 @@
 extern Mutex*   Management_lock;                 // a lock used to serialize JVM management
 extern Monitor* Service_lock;                    // a lock used for service thread operation
 extern Monitor* PeriodicTask_lock;               // protects the periodic task structure
+extern Monitor* RedefineClasses_lock;            // locks classes from parallel redefinition
 
 #ifdef INCLUDE_TRACE
 extern Mutex*   JfrStacktrace_lock;              // used to guard access to the JFR stacktrace table
--- a/hotspot/test/testlibrary/whitebox/sun/hotspot/WhiteBox.java	Thu May 19 19:45:52 2016 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,264 +0,0 @@
-/*
- * Copyright (c) 2012, 2014, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- *
- */
-
-package sun.hotspot;
-
-import java.lang.reflect.Executable;
-import java.util.Arrays;
-import java.util.List;
-import java.util.function.Function;
-import java.util.stream.Stream;
-import java.security.BasicPermission;
-
-import sun.hotspot.parser.DiagnosticCommand;
-
-public class WhiteBox {
-
-  @SuppressWarnings("serial")
-  public static class WhiteBoxPermission extends BasicPermission {
-    public WhiteBoxPermission(String s) {
-      super(s);
-    }
-  }
-
-  private WhiteBox() {}
-  private static final WhiteBox instance = new WhiteBox();
-  private static native void registerNatives();
-
-  /**
-   * Returns the singleton WhiteBox instance.
-   *
-   * The returned WhiteBox object should be carefully guarded
-   * by the caller, since it can be used to read and write data
-   * at arbitrary memory addresses. It must never be passed to
-   * untrusted code.
-   */
-  public synchronized static WhiteBox getWhiteBox() {
-    SecurityManager sm = System.getSecurityManager();
-    if (sm != null) {
-      sm.checkPermission(new WhiteBoxPermission("getInstance"));
-    }
-    return instance;
-  }
-
-  static {
-    registerNatives();
-  }
-
-  // Get the maximum heap size supporting COOPs
-  public native long getCompressedOopsMaxHeapSize();
-  // Arguments
-  public native void printHeapSizes();
-
-  // Memory
-  public native long getObjectAddress(Object o);
-  public native int  getHeapOopSize();
-  public native int  getVMPageSize();
-  public native boolean isObjectInOldGen(Object o);
-  public native long getObjectSize(Object o);
-
-  // Runtime
-  // Make sure class name is in the correct format
-  public boolean isClassAlive(String name) {
-    return isClassAlive0(name.replace('.', '/'));
-  }
-  private native boolean isClassAlive0(String name);
-
-  // JVMTI
-  public native void addToBootstrapClassLoaderSearch(String segment);
-  public native void addToSystemClassLoaderSearch(String segment);
-
-  // G1
-  public native boolean g1InConcurrentMark();
-  public native boolean g1IsHumongous(Object o);
-  public native long    g1NumFreeRegions();
-  public native int     g1RegionSize();
-  public native Object[]    parseCommandLine(String commandline, char delim, DiagnosticCommand[] args);
-
-  // NMT
-  public native long NMTMalloc(long size);
-  public native void NMTFree(long mem);
-  public native long NMTReserveMemory(long size);
-  public native void NMTCommitMemory(long addr, long size);
-  public native void NMTUncommitMemory(long addr, long size);
-  public native void NMTReleaseMemory(long addr, long size);
-  public native long NMTMallocWithPseudoStack(long size, int index);
-  public native boolean NMTIsDetailSupported();
-  public native boolean NMTChangeTrackingLevel();
-  public native int NMTGetHashSize();
-
-  // Compiler
-  public native void    deoptimizeAll();
-  public        boolean isMethodCompiled(Executable method) {
-    return isMethodCompiled(method, false /*not osr*/);
-  }
-  public native boolean isMethodCompiled(Executable method, boolean isOsr);
-  public        boolean isMethodCompilable(Executable method) {
-    return isMethodCompilable(method, -1 /*any*/);
-  }
-  public        boolean isMethodCompilable(Executable method, int compLevel) {
-    return isMethodCompilable(method, compLevel, false /*not osr*/);
-  }
-  public native boolean isMethodCompilable(Executable method, int compLevel, boolean isOsr);
-  public native boolean isMethodQueuedForCompilation(Executable method);
-  public        int     deoptimizeMethod(Executable method) {
-    return deoptimizeMethod(method, false /*not osr*/);
-  }
-  public native int     deoptimizeMethod(Executable method, boolean isOsr);
-  public        void    makeMethodNotCompilable(Executable method) {
-    makeMethodNotCompilable(method, -1 /*any*/);
-  }
-  public        void    makeMethodNotCompilable(Executable method, int compLevel) {
-    makeMethodNotCompilable(method, compLevel, false /*not osr*/);
-  }
-  public native void    makeMethodNotCompilable(Executable method, int compLevel, boolean isOsr);
-  public        int     getMethodCompilationLevel(Executable method) {
-    return getMethodCompilationLevel(method, false /*not ost*/);
-  }
-  public native int     getMethodCompilationLevel(Executable method, boolean isOsr);
-  public native boolean testSetDontInlineMethod(Executable method, boolean value);
-  public        int     getCompileQueuesSize() {
-    return getCompileQueueSize(-1 /*any*/);
-  }
-  public native int     getCompileQueueSize(int compLevel);
-  public native boolean testSetForceInlineMethod(Executable method, boolean value);
-  public        boolean enqueueMethodForCompilation(Executable method, int compLevel) {
-    return enqueueMethodForCompilation(method, compLevel, -1 /*InvocationEntryBci*/);
-  }
-  public native boolean enqueueMethodForCompilation(Executable method, int compLevel, int entry_bci);
-  public native void    clearMethodState(Executable method);
-  public native void    lockCompilation();
-  public native void    unlockCompilation();
-  public native int     getMethodEntryBci(Executable method);
-  public native Object[] getNMethod(Executable method, boolean isOsr);
-  public native long    allocateCodeBlob(int size, int type);
-  public        long    allocateCodeBlob(long size, int type) {
-      int intSize = (int) size;
-      if ((long) intSize != size || size < 0) {
-          throw new IllegalArgumentException(
-                "size argument has illegal value " + size);
-      }
-      return allocateCodeBlob( intSize, type);
-  }
-  public native void    freeCodeBlob(long addr);
-  public        void    forceNMethodSweep() {
-    try {
-        forceNMethodSweep0().join();
-    } catch (InterruptedException e) {
-        Thread.currentThread().interrupt();
-    }
-  }
-  public native Thread  forceNMethodSweep0();
-  public native Object[] getCodeHeapEntries(int type);
-  public native int     getCompilationActivityMode();
-  public native Object[] getCodeBlob(long addr);
-
-  // Intered strings
-  public native boolean isInStringTable(String str);
-
-  // Memory
-  public native void readReservedMemory();
-  public native long allocateMetaspace(ClassLoader classLoader, long size);
-  public native void freeMetaspace(ClassLoader classLoader, long addr, long size);
-  public native long incMetaspaceCapacityUntilGC(long increment);
-  public native long metaspaceCapacityUntilGC();
-
-  // Force Young GC
-  public native void youngGC();
-
-  // Force Full GC
-  public native void fullGC();
-
-  // Method tries to start concurrent mark cycle.
-  // It returns false if CM Thread is always in concurrent cycle.
-  public native boolean g1StartConcMarkCycle();
-
-  // Tests on ReservedSpace/VirtualSpace classes
-  public native int stressVirtualSpaceResize(long reservedSpaceSize, long magnitude, long iterations);
-  public native void runMemoryUnitTests();
-  public native void readFromNoaccessArea();
-  public native long getThreadStackSize();
-  public native long getThreadRemainingStackSize();
-
-  // CPU features
-  public native String getCPUFeatures();
-
-  // Native extensions
-  public native long getHeapUsageForContext(int context);
-  public native long getHeapRegionCountForContext(int context);
-  public native int getContextForObject(Object obj);
-  public native void printRegionInfo(int context);
-
-  // VM flags
-  public native boolean isConstantVMFlag(String name);
-  public native boolean isLockedVMFlag(String name);
-  public native void    setBooleanVMFlag(String name, boolean value);
-  public native void    setIntxVMFlag(String name, long value);
-  public native void    setUintxVMFlag(String name, long value);
-  public native void    setUint64VMFlag(String name, long value);
-  public native void    setSizeTVMFlag(String name, long value);
-  public native void    setStringVMFlag(String name, String value);
-  public native void    setDoubleVMFlag(String name, double value);
-  public native Boolean getBooleanVMFlag(String name);
-  public native Long    getIntxVMFlag(String name);
-  public native Long    getUintxVMFlag(String name);
-  public native Long    getUint64VMFlag(String name);
-  public native Long    getSizeTVMFlag(String name);
-  public native String  getStringVMFlag(String name);
-  public native Double  getDoubleVMFlag(String name);
-  private final List<Function<String,Object>> flagsGetters = Arrays.asList(
-    this::getBooleanVMFlag, this::getIntxVMFlag, this::getUintxVMFlag,
-    this::getUint64VMFlag, this::getSizeTVMFlag, this::getStringVMFlag,
-    this::getDoubleVMFlag);
-
-  public Object getVMFlag(String name) {
-    return flagsGetters.stream()
-                       .map(f -> f.apply(name))
-                       .filter(x -> x != null)
-                       .findAny()
-                       .orElse(null);
-  }
-
-  // Jigsaw
-  public native Object DefineModule(String name, Object loader, Object[] packages);
-  public native void AddModuleExports(Object from_module, String pkg, Object to_module);
-  public native void AddReadsModule(Object from_module, Object to_module);
-  public native boolean CanReadModule(Object asking_module, Object target_module);
-  public native boolean IsExportedToModule(Object from_module, String pkg, Object to_module);
-  public native Object GetModule(Class clazz);
-  public native void AddModulePackage(Object module, String pkg);
-
-  // Image File
-  public native boolean readImageFile(String imagefile);
-
-  public native int getOffsetForName0(String name);
-  public int getOffsetForName(String name) throws Exception {
-    int offset = getOffsetForName0(name);
-    if (offset == -1) {
-      throw new RuntimeException(name + " not found");
-    }
-    return offset;
-  }
-
-}