merge JEP-230-microbenchmarks-branch
authorredestad
Tue, 09 Oct 2018 14:37:59 +0200
branchJEP-230-microbenchmarks-branch
changeset 56944 96ecae6d8049
parent 56936 923f1356c5ea (current diff)
parent 52052 e25291a90cba (diff)
child 56953 2ea07b19b446
merge
make/autoconf/configure.ac
make/autoconf/spec.gmk.in
test/hotspot/jtreg/ProblemList-cds-mode.txt
--- a/make/Images.gmk	Fri Oct 05 17:01:07 2018 -0400
+++ b/make/Images.gmk	Tue Oct 09 14:37:59 2018 +0200
@@ -90,24 +90,32 @@
 
 $(JDK_IMAGE_DIR)/$(JIMAGE_TARGET_FILE): $(JMODS) \
     $(call DependOnVariable, JDK_MODULES_LIST) $(BASE_RELEASE_FILE)
-	$(ECHO) Creating jdk image
+	$(call LogWarn, Creating jdk image)
 	$(RM) -r $(JDK_IMAGE_DIR)
 	$(call ExecuteWithLog, $(SUPPORT_OUTPUTDIR)/images/jdk, \
 	    $(JLINK_TOOL) --add-modules $(JDK_MODULES_LIST) \
 	        $(JLINK_JDK_EXTRA_OPTS) \
 	        --output $(JDK_IMAGE_DIR) \
 	)
+        ifeq ($(BUILD_CDS_ARCHIVE), true)
+	  $(call LogWarn, Creating CDS archive for jdk image)
+	  $(JDK_IMAGE_DIR)/bin/java -Xshare:dump -Xmx128M -Xms128M $(LOG_INFO)
+        endif
 	$(TOUCH) $@
 
 $(JRE_IMAGE_DIR)/$(JIMAGE_TARGET_FILE): $(JMODS) \
     $(call DependOnVariable, JRE_MODULES_LIST) $(BASE_RELEASE_FILE)
-	$(ECHO) Creating legacy jre image
+	$(call LogWarn, Creating legacy jre image)
 	$(RM) -r $(JRE_IMAGE_DIR)
 	$(call ExecuteWithLog, $(SUPPORT_OUTPUTDIR)/images/jre, \
 	    $(JLINK_TOOL) --add-modules $(JRE_MODULES_LIST) \
 	        $(JLINK_JRE_EXTRA_OPTS) \
 	        --output $(JRE_IMAGE_DIR) \
 	)
+        ifeq ($(BUILD_CDS_ARCHIVE), true)
+	  $(call LogWarn, Creating CDS archive for jre image)
+	  $(JRE_IMAGE_DIR)/bin/java -Xshare:dump -Xmx128M -Xms128M $(LOG_INFO)
+        endif
 	$(TOUCH) $@
 
 TOOL_JRE_TARGETS := $(JRE_IMAGE_DIR)/$(JIMAGE_TARGET_FILE)
--- a/make/autoconf/configure.ac	Fri Oct 05 17:01:07 2018 -0400
+++ b/make/autoconf/configure.ac	Tue Oct 09 14:37:59 2018 +0200
@@ -236,6 +236,7 @@
 JDKOPT_ENABLE_DISABLE_GENERATE_CLASSLIST
 JDKOPT_EXCLUDE_TRANSLATIONS
 JDKOPT_ENABLE_DISABLE_MANPAGES
+JDKOPT_ENABLE_DISABLE_CDS_ARCHIVE
 
 ###############################################################################
 #
--- a/make/autoconf/hotspot.m4	Fri Oct 05 17:01:07 2018 -0400
+++ b/make/autoconf/hotspot.m4	Tue Oct 09 14:37:59 2018 +0200
@@ -252,14 +252,6 @@
     AC_MSG_ERROR([Invalid value for --enable-cds: $enable_cds])
   fi
 
-  # Disable CDS on AIX.
-  if test "x$OPENJDK_TARGET_OS" = "xaix"; then
-    ENABLE_CDS="false"
-    if test "x$enable_cds" = "xyes"; then
-      AC_MSG_ERROR([CDS is currently not supported on AIX. Remove --enable-cds.])
-    fi
-  fi
-
   AC_SUBST(ENABLE_CDS)
 ])
 
@@ -489,6 +481,34 @@
   # All variants but minimal (and custom) get these features
   NON_MINIMAL_FEATURES="$NON_MINIMAL_FEATURES cmsgc g1gc parallelgc serialgc epsilongc jni-check jvmti management nmt services vm-structs"
 
+  # Disable CDS on AIX.
+  if test "x$OPENJDK_TARGET_OS" = "xaix"; then
+    ENABLE_CDS="false"
+    if test "x$enable_cds" = "xyes"; then
+      AC_MSG_ERROR([CDS is currently not supported on AIX. Remove --enable-cds.])
+    fi
+  fi
+
+  # Disable CDS if user requested it with --with-jvm-features=-cds.
+  DISABLE_CDS=`$ECHO $DISABLED_JVM_FEATURES | $GREP cds`
+  if test "x$DISABLE_CDS" = "xcds"; then
+    ENABLE_CDS="false"
+    if test "x$enable_cds" = "xyes"; then
+      AC_MSG_ERROR([CDS was disabled by --with-jvm-features=-cds. Remove --enable-cds.])
+    fi
+  fi
+
+  # Disable CDS for zero, minimal, core..
+  if HOTSPOT_CHECK_JVM_VARIANT(zero) || HOTSPOT_CHECK_JVM_VARIANT(minimal) || HOTSPOT_CHECK_JVM_VARIANT(core); then
+    # ..except when the user explicitely requested it with --enable-jvm-features
+    if ! HOTSPOT_CHECK_JVM_FEATURE(cds); then
+      ENABLE_CDS="false"
+      if test "x$enable_cds" = "xyes"; then
+        AC_MSG_ERROR([CDS not implemented for variants zero, minimal, core. Remove --enable-cds.])
+      fi
+    fi
+  fi
+
   AC_MSG_CHECKING([if cds should be enabled])
   if test "x$ENABLE_CDS" = "xtrue"; then
     if test "x$enable_cds" = "xyes"; then
--- a/make/autoconf/jdk-options.m4	Fri Oct 05 17:01:07 2018 -0400
+++ b/make/autoconf/jdk-options.m4	Tue Oct 09 14:37:59 2018 +0200
@@ -527,7 +527,7 @@
 
   # Check if it's likely that it's possible to generate the classlist. Depending
   # on exact jvm configuration it could be possible anyway.
-  if test "x$ENABLE_CDS" = "xtrue" && (HOTSPOT_CHECK_JVM_VARIANT(server) || HOTSPOT_CHECK_JVM_VARIANT(client)); then
+  if test "x$ENABLE_CDS" = "xtrue" && (HOTSPOT_CHECK_JVM_VARIANT(server) || HOTSPOT_CHECK_JVM_VARIANT(client) || HOTSPOT_CHECK_JVM_FEATURE(cds)); then
     ENABLE_GENERATE_CLASSLIST_POSSIBLE="true"
   else
     ENABLE_GENERATE_CLASSLIST_POSSIBLE="false"
@@ -605,3 +605,37 @@
 
   AC_SUBST(BUILD_MANPAGES)
 ])
+
+################################################################################
+#
+# Disable the default CDS archive generation
+#   cross compilation - disabled
+#
+AC_DEFUN([JDKOPT_ENABLE_DISABLE_CDS_ARCHIVE],
+[
+  AC_ARG_ENABLE([cds-archive], [AS_HELP_STRING([--disable-cds-archive],
+      [Set to disable generation of a default CDS archive in the product image @<:@enabled@:>@])])
+
+  AC_MSG_CHECKING([if a default CDS archive should be generated])
+  if test "x$ENABLE_CDS" = "xfalse"; then
+    AC_MSG_RESULT([no, because CDS is disabled])
+    BUILD_CDS_ARCHIVE="false"
+  elif test "x$COMPILE_TYPE" = "xcross"; then
+    AC_MSG_RESULT([no, not possible with cross compilation])
+    BUILD_CDS_ARCHIVE="false"
+  elif test "x$enable_cds_archive" = "xyes"; then
+    AC_MSG_RESULT([yes, forced])
+    BUILD_CDS_ARCHIVE="true"
+  elif test "x$enable_cds_archive" = "x"; then
+    AC_MSG_RESULT([yes])
+    BUILD_CDS_ARCHIVE="true"
+  elif test "x$enable_cds_archive" = "xno"; then
+    AC_MSG_RESULT([no, forced])
+    BUILD_CDS_ARCHIVE="false"
+  else
+    AC_MSG_RESULT([no])
+    AC_MSG_ERROR([--enable-cds_archive can only be yes/no or empty])
+  fi
+
+  AC_SUBST(BUILD_CDS_ARCHIVE)
+])
--- a/make/autoconf/spec.gmk.in	Fri Oct 05 17:01:07 2018 -0400
+++ b/make/autoconf/spec.gmk.in	Tue Oct 09 14:37:59 2018 +0200
@@ -309,6 +309,8 @@
 
 BUILD_MANPAGES := @BUILD_MANPAGES@
 
+BUILD_CDS_ARCHIVE := @BUILD_CDS_ARCHIVE@
+
 # The boot jdk to use. This is overridden in bootcycle-spec.gmk. Make sure to keep
 # it in sync.
 BOOT_JDK:=@BOOT_JDK@
--- a/make/hotspot/lib/CompileJvm.gmk	Fri Oct 05 17:01:07 2018 -0400
+++ b/make/hotspot/lib/CompileJvm.gmk	Tue Oct 09 14:37:59 2018 +0200
@@ -92,7 +92,7 @@
   DISABLED_WARNINGS_gcc += return-type switch
 endif
 
-DISABLED_WARNINGS_clang := tautological-compare deprecated-declarations \
+DISABLED_WARNINGS_clang := tautological-compare \
     undefined-var-template sometimes-uninitialized unknown-pragmas \
     delete-non-virtual-dtor missing-braces char-subscripts \
     ignored-qualifiers missing-field-initializers mismatched-tags
--- a/make/scripts/compare.sh	Fri Oct 05 17:01:07 2018 -0400
+++ b/make/scripts/compare.sh	Tue Oct 09 14:37:59 2018 +0200
@@ -385,6 +385,7 @@
         ! -name "JavaUpdater" ! -name "JavaWSApplicationStub" \
         ! -name "jspawnhelper" ! -name "JavawsLauncher" ! -name "*.a" \
         ! -name "finish_installation" ! -name "Sparkle" ! -name "*.tar.gz" \
+        ! -name "classes.jsa" \
         | $GREP -v "./bin/"  | $SORT | $FILTER)
 
     echo Other files with binary differences...
--- a/src/hotspot/cpu/x86/c1_LIRGenerator_x86.cpp	Fri Oct 05 17:01:07 2018 -0400
+++ b/src/hotspot/cpu/x86/c1_LIRGenerator_x86.cpp	Tue Oct 09 14:37:59 2018 +0200
@@ -688,7 +688,7 @@
   }
   LIR_Opr result = new_register(T_INT);
   __ cmove(lir_cond_equal, LIR_OprFact::intConst(1), LIR_OprFact::intConst(0),
-           result, type);
+           result, T_INT);
   return result;
 }
 
--- a/src/hotspot/os/bsd/os_bsd.cpp	Fri Oct 05 17:01:07 2018 -0400
+++ b/src/hotspot/os/bsd/os_bsd.cpp	Tue Oct 09 14:37:59 2018 +0200
@@ -3238,16 +3238,6 @@
   Bsd::clock_init();
   initial_time_count = javaTimeNanos();
 
-#ifdef __APPLE__
-  // XXXDARWIN
-  // Work around the unaligned VM callbacks in hotspot's
-  // sharedRuntime. The callbacks don't use SSE2 instructions, and work on
-  // Linux, Solaris, and FreeBSD. On Mac OS X, dyld (rightly so) enforces
-  // alignment when doing symbol lookup. To work around this, we force early
-  // binding of all symbols now, thus binding when alignment is known-good.
-  _dyld_bind_fully_image_containing_address((const void *) &os::init);
-#endif
-
   os::Posix::init();
 }
 
--- a/src/hotspot/os_cpu/linux_zero/os_linux_zero.hpp	Fri Oct 05 17:01:07 2018 -0400
+++ b/src/hotspot/os_cpu/linux_zero/os_linux_zero.hpp	Tue Oct 09 14:37:59 2018 +0200
@@ -54,6 +54,16 @@
                   "std %0, %1\n"
                   : "=&f"(tmp), "=Q"(*(volatile double*)dst)
                   : "Q"(*(volatile double*)src));
+#elif defined(__ARM_ARCH_7A__)
+    // Note that a ldrexd + clrex combination is only needed for
+    // correctness on the OS level (context-switches). In this
+    // case, clrex *may* be beneficial for performance. For now
+    // don't bother with clrex as this is Zero.
+    jlong tmp;
+    asm volatile ("ldrexd  %0, [%1]\n"
+                  : "=r"(tmp)
+                  : "r"(src), "m"(src));
+    *(jlong *) dst = tmp;
 #else
     *(jlong *) dst = *(const jlong *) src;
 #endif
--- a/src/hotspot/share/aot/aotCodeHeap.cpp	Fri Oct 05 17:01:07 2018 -0400
+++ b/src/hotspot/share/aot/aotCodeHeap.cpp	Tue Oct 09 14:37:59 2018 +0200
@@ -436,14 +436,19 @@
     SET_AOT_GLOBAL_SYMBOL_VALUE("_aot_jvmci_runtime_new_instance", address, JVMCIRuntime::new_instance);
     SET_AOT_GLOBAL_SYMBOL_VALUE("_aot_jvmci_runtime_new_array", address, JVMCIRuntime::new_array);
     SET_AOT_GLOBAL_SYMBOL_VALUE("_aot_jvmci_runtime_new_multi_array", address, JVMCIRuntime::new_multi_array);
+    SET_AOT_GLOBAL_SYMBOL_VALUE("_aot_jvmci_runtime_dynamic_new_instance", address, JVMCIRuntime::dynamic_new_instance);
     SET_AOT_GLOBAL_SYMBOL_VALUE("_aot_jvmci_runtime_dynamic_new_array", address, JVMCIRuntime::dynamic_new_array);
+    SET_AOT_GLOBAL_SYMBOL_VALUE("_aot_jvmci_runtime_new_instance_or_null", address, JVMCIRuntime::new_instance_or_null);
+    SET_AOT_GLOBAL_SYMBOL_VALUE("_aot_jvmci_runtime_new_array_or_null", address, JVMCIRuntime::new_array_or_null);
+    SET_AOT_GLOBAL_SYMBOL_VALUE("_aot_jvmci_runtime_new_multi_array_or_null", address, JVMCIRuntime::new_multi_array_or_null);
+    SET_AOT_GLOBAL_SYMBOL_VALUE("_aot_jvmci_runtime_dynamic_new_instance_or_null", address, JVMCIRuntime::dynamic_new_instance_or_null);
+    SET_AOT_GLOBAL_SYMBOL_VALUE("_aot_jvmci_runtime_dynamic_new_array_or_null", address, JVMCIRuntime::dynamic_new_array_or_null);
     SET_AOT_GLOBAL_SYMBOL_VALUE("_aot_jvmci_runtime_validate_object", address, JVMCIRuntime::validate_object);
 #if INCLUDE_G1GC
     SET_AOT_GLOBAL_SYMBOL_VALUE("_aot_jvmci_runtime_write_barrier_pre", address, JVMCIRuntime::write_barrier_pre);
     SET_AOT_GLOBAL_SYMBOL_VALUE("_aot_jvmci_runtime_write_barrier_post", address, JVMCIRuntime::write_barrier_post);
 #endif
     SET_AOT_GLOBAL_SYMBOL_VALUE("_aot_jvmci_runtime_identity_hash_code", address, JVMCIRuntime::identity_hash_code);
-    SET_AOT_GLOBAL_SYMBOL_VALUE("_aot_jvmci_runtime_dynamic_new_instance", address, JVMCIRuntime::dynamic_new_instance);
     SET_AOT_GLOBAL_SYMBOL_VALUE("_aot_jvmci_runtime_thread_is_interrupted", address, JVMCIRuntime::thread_is_interrupted);
     SET_AOT_GLOBAL_SYMBOL_VALUE("_aot_jvmci_runtime_exception_handler_for_pc", address, JVMCIRuntime::exception_handler_for_pc);
     SET_AOT_GLOBAL_SYMBOL_VALUE("_aot_jvmci_runtime_test_deoptimize_call_int", address, JVMCIRuntime::test_deoptimize_call_int);
@@ -735,6 +740,14 @@
 
   NOT_PRODUCT( klasses_seen++; )
 
+  // AOT does not support custom class loaders.
+  ClassLoaderData* cld = ik->class_loader_data();
+  if (!cld->is_builtin_class_loader_data()) {
+    log_trace(aot, class, load)("skip class  %s  for custom classloader %s (%p) tid=" INTPTR_FORMAT,
+                                ik->internal_name(), cld->loader_name(), cld, p2i(thread));
+    return false;
+  }
+
   AOTKlassData* klass_data = find_klass(ik);
   if (klass_data == NULL) {
     return false;
@@ -759,9 +772,10 @@
 
   assert(klass_data->_class_id < _class_count, "invalid class id");
   AOTClass* aot_class = &_classes[klass_data->_class_id];
-  if (aot_class->_classloader != NULL && aot_class->_classloader != ik->class_loader_data()) {
-    log_trace(aot, class, load)("class  %s  in  %s already loaded for classloader %p vs %p tid=" INTPTR_FORMAT,
-                                ik->internal_name(), _lib->name(), aot_class->_classloader, ik->class_loader_data(), p2i(thread));
+  ClassLoaderData* aot_cld = aot_class->_classloader;
+  if (aot_cld != NULL && aot_cld != cld) {
+    log_trace(aot, class, load)("class  %s  in  %s already loaded for classloader %s (%p) vs %s (%p) tid=" INTPTR_FORMAT,
+                                ik->internal_name(), _lib->name(), aot_cld->loader_name(), aot_cld, cld->loader_name(), cld, p2i(thread));
     NOT_PRODUCT( aot_klasses_cl_miss++; )
     return false;
   }
@@ -774,9 +788,9 @@
 
   NOT_PRODUCT( aot_klasses_found++; )
 
-  log_trace(aot, class, load)("found  %s  in  %s for classloader %p tid=" INTPTR_FORMAT, ik->internal_name(), _lib->name(), ik->class_loader_data(), p2i(thread));
+  log_trace(aot, class, load)("found  %s  in  %s for classloader %s (%p) tid=" INTPTR_FORMAT, ik->internal_name(), _lib->name(), cld->loader_name(), cld, p2i(thread));
 
-  aot_class->_classloader = ik->class_loader_data();
+  aot_class->_classloader = cld;
   // Set klass's Resolve (second) got cell.
   _klasses_got[klass_data->_got_index] = ik;
   if (ik->is_initialized()) {
--- a/src/hotspot/share/classfile/compactHashtable.cpp	Fri Oct 05 17:01:07 2018 -0400
+++ b/src/hotspot/share/classfile/compactHashtable.cpp	Tue Oct 09 14:37:59 2018 +0200
@@ -174,7 +174,7 @@
 // The CompactHashtable implementation
 //
 
-void SimpleCompactHashtable::serialize(SerializeClosure* soc) {
+void SimpleCompactHashtable::serialize_header(SerializeClosure* soc) {
   soc->do_ptr((void**)&_base_address);
   soc->do_u4(&_entry_count);
   soc->do_u4(&_bucket_count);
--- a/src/hotspot/share/classfile/compactHashtable.hpp	Fri Oct 05 17:01:07 2018 -0400
+++ b/src/hotspot/share/classfile/compactHashtable.hpp	Tue Oct 09 14:37:59 2018 +0200
@@ -123,6 +123,15 @@
 
 public:
   void dump(SimpleCompactHashtable *cht, const char* table_name);
+
+  static int default_num_buckets(size_t num_entries) {
+    return default_num_buckets((int)num_entries);
+  }
+  static int default_num_buckets(int num_entries) {
+    int num_buckets = num_entries / SharedSymbolTableBucketSize;
+    // calculation of num_buckets can result in zero buckets, we need at least one
+    return (num_buckets < 1) ? 1 : num_buckets;
+  }
 };
 #endif // INCLUDE_CDS
 
@@ -213,8 +222,8 @@
     _entries = entries;
   }
 
-  // For reading from/writing to the CDS archive
-  void serialize(SerializeClosure* soc) NOT_CDS_RETURN;
+  // Read/Write the table's header from/to the CDS archive
+  void serialize_header(SerializeClosure* soc) NOT_CDS_RETURN;
 
   inline bool empty() {
     return (_entry_count == 0);
--- a/src/hotspot/share/classfile/stringTable.cpp	Fri Oct 05 17:01:07 2018 -0400
+++ b/src/hotspot/share/classfile/stringTable.cpp	Tue Oct 09 14:37:59 2018 +0200
@@ -819,18 +819,9 @@
   return new_s;
 }
 
-class CompactStringTableWriter: public CompactHashtableWriter {
-public:
-  CompactStringTableWriter(int num_entries, CompactHashtableStats* stats) :
-    CompactHashtableWriter(num_entries, stats) {}
-  void add(unsigned int hash, oop string) {
-    CompactHashtableWriter::add(hash, CompressedOops::encode(string));
-  }
-};
-
 struct CopyToArchive : StackObj {
-  CompactStringTableWriter* _writer;
-  CopyToArchive(CompactStringTableWriter* writer) : _writer(writer) {}
+  CompactHashtableWriter* _writer;
+  CopyToArchive(CompactHashtableWriter* writer) : _writer(writer) {}
   bool operator()(WeakHandle<vm_string_table_data>* val) {
     oop s = val->peek();
     if (s == NULL) {
@@ -838,6 +829,7 @@
     }
     unsigned int hash = java_lang_String::hash_code(s);
     if (hash == 0) {
+      // We do not archive Strings with a 0 hashcode because ......
       return true;
     }
 
@@ -849,12 +841,12 @@
 
     val->replace(new_s);
     // add to the compact table
-    _writer->add(hash, new_s);
+    _writer->add(hash, CompressedOops::encode(new_s));
     return true;
   }
 };
 
-void StringTable::copy_shared_string_table(CompactStringTableWriter* writer) {
+void StringTable::copy_shared_string_table(CompactHashtableWriter* writer) {
   assert(MetaspaceShared::is_heap_object_archiving_allowed(), "must be");
 
   CopyToArchive copy(writer);
@@ -865,18 +857,18 @@
   assert(MetaspaceShared::is_heap_object_archiving_allowed(), "must be");
 
   _shared_table.reset();
-  int num_buckets = the_table()->_items_count / SharedSymbolTableBucketSize;
-  // calculation of num_buckets can result in zero buckets, we need at least one
-  CompactStringTableWriter writer(num_buckets > 1 ? num_buckets : 1,
-                                  &MetaspaceShared::stats()->string);
+  int num_buckets = CompactHashtableWriter::default_num_buckets(
+      StringTable::the_table()->_items_count);
+  CompactHashtableWriter writer(num_buckets,
+                                &MetaspaceShared::stats()->string);
 
   // Copy the interned strings into the "string space" within the java heap
   copy_shared_string_table(&writer);
   writer.dump(&_shared_table, "string");
 }
 
-void StringTable::serialize(SerializeClosure* soc) {
-  _shared_table.serialize(soc);
+void StringTable::serialize_shared_table_header(SerializeClosure* soc) {
+  _shared_table.serialize_header(soc);
 
   if (soc->writing()) {
     // Sanity. Make sure we don't use the shared table at dump time
--- a/src/hotspot/share/classfile/stringTable.hpp	Fri Oct 05 17:01:07 2018 -0400
+++ b/src/hotspot/share/classfile/stringTable.hpp	Tue Oct 09 14:37:59 2018 +0200
@@ -33,7 +33,7 @@
 #include "oops/weakHandle.hpp"
 #include "utilities/concurrentHashTable.hpp"
 
-class CompactStringTableWriter;
+class CompactHashtableWriter;
 class SerializeClosure;
 
 class StringTable;
@@ -163,14 +163,14 @@
   // Sharing
  private:
   oop lookup_shared(const jchar* name, int len, unsigned int hash) NOT_CDS_JAVA_HEAP_RETURN_(NULL);
-  static void copy_shared_string_table(CompactStringTableWriter* ch_table) NOT_CDS_JAVA_HEAP_RETURN;
+  static void copy_shared_string_table(CompactHashtableWriter* ch_table) NOT_CDS_JAVA_HEAP_RETURN;
  public:
   static oop create_archived_string(oop s, Thread* THREAD) NOT_CDS_JAVA_HEAP_RETURN_(NULL);
   static void set_shared_string_mapped() { _shared_string_mapped = true; }
   static bool shared_string_mapped()     { return _shared_string_mapped; }
   static void shared_oops_do(OopClosure* f) NOT_CDS_JAVA_HEAP_RETURN;
   static void write_to_archive() NOT_CDS_JAVA_HEAP_RETURN;
-  static void serialize(SerializeClosure* soc) NOT_CDS_JAVA_HEAP_RETURN;
+  static void serialize_shared_table_header(SerializeClosure* soc) NOT_CDS_JAVA_HEAP_RETURN;
 
   // Jcmd
   static void dump(outputStream* st, bool verbose=false);
--- a/src/hotspot/share/classfile/symbolTable.cpp	Fri Oct 05 17:01:07 2018 -0400
+++ b/src/hotspot/share/classfile/symbolTable.cpp	Tue Oct 09 14:37:59 2018 +0200
@@ -627,43 +627,31 @@
 }
 
 #if INCLUDE_CDS
-class CompactSymbolTableWriter: public CompactHashtableWriter {
-public:
-  CompactSymbolTableWriter(int num_buckets, CompactHashtableStats* stats) :
-    CompactHashtableWriter(num_buckets, stats) {}
-  void add(unsigned int hash, Symbol *symbol) {
-    uintx deltax = MetaspaceShared::object_delta(symbol);
+struct CopyToArchive : StackObj {
+  CompactHashtableWriter* _writer;
+  CopyToArchive(CompactHashtableWriter* writer) : _writer(writer) {}
+  bool operator()(Symbol** value) {
+    assert(value != NULL, "expected valid value");
+    assert(*value != NULL, "value should point to a symbol");
+    Symbol* sym = *value;
+    unsigned int fixed_hash = hash_shared_symbol((const char*)sym->bytes(), sym->utf8_length());
+    assert(fixed_hash == hash_symbol((const char*)sym->bytes(), sym->utf8_length(), false),
+           "must not rehash during dumping");
+
+    uintx deltax = MetaspaceShared::object_delta(sym);
     // When the symbols are stored into the archive, we already check that
     // they won't be more than MAX_SHARED_DELTA from the base address, or
     // else the dumping would have been aborted.
     assert(deltax <= MAX_SHARED_DELTA, "must not be");
     u4 delta = u4(deltax);
 
-    CompactHashtableWriter::add(hash, delta);
-  }
-};
-
-struct CopyToArchive : StackObj {
-  CompactSymbolTableWriter* _writer;
-  CopyToArchive(CompactSymbolTableWriter* writer) : _writer(writer) {}
-  bool operator()(Symbol** value) {
-    assert(value != NULL, "expected valid value");
-    assert(*value != NULL, "value should point to a symbol");
-    Symbol* sym = *value;
-    unsigned int fixed_hash = hash_shared_symbol((const char*)sym->bytes(), sym->utf8_length());
-    if (fixed_hash == 0) {
-      return true;
-    }
-    assert(fixed_hash == hash_symbol((const char*)sym->bytes(), sym->utf8_length(), false),
-           "must not rehash during dumping");
-
     // add to the compact table
-    _writer->add(fixed_hash, sym);
+    _writer->add(fixed_hash, delta);
     return true;
   }
 };
 
-void SymbolTable::copy_shared_symbol_table(CompactSymbolTableWriter* writer) {
+void SymbolTable::copy_shared_symbol_table(CompactHashtableWriter* writer) {
   CopyToArchive copy(writer);
   SymbolTable::the_table()->_local_table->do_scan(Thread::current(), copy);
 }
@@ -671,10 +659,10 @@
 void SymbolTable::write_to_archive() {
   _shared_table.reset();
 
-  int num_buckets = (int)(SymbolTable::the_table()->_items_count / SharedSymbolTableBucketSize);
-  // calculation of num_buckets can result in zero buckets, we need at least one
-  CompactSymbolTableWriter writer(num_buckets > 1 ? num_buckets : 1,
-                                  &MetaspaceShared::stats()->symbol);
+  int num_buckets = CompactHashtableWriter::default_num_buckets(
+      SymbolTable::the_table()->_items_count);
+  CompactHashtableWriter writer(num_buckets,
+                                &MetaspaceShared::stats()->symbol);
   copy_shared_symbol_table(&writer);
   writer.dump(&_shared_table, "symbol");
 
@@ -686,8 +674,8 @@
   assert(sym == _shared_table.lookup(name, hash, len), "sanity");
 }
 
-void SymbolTable::serialize(SerializeClosure* soc) {
-  _shared_table.serialize(soc);
+void SymbolTable::serialize_shared_table_header(SerializeClosure* soc) {
+  _shared_table.serialize_header(soc);
 
   if (soc->writing()) {
     // Sanity. Make sure we don't use the shared table at dump time
--- a/src/hotspot/share/classfile/symbolTable.hpp	Fri Oct 05 17:01:07 2018 -0400
+++ b/src/hotspot/share/classfile/symbolTable.hpp	Tue Oct 09 14:37:59 2018 +0200
@@ -84,7 +84,7 @@
   operator Symbol*()                             { return _temp; }
 };
 
-class CompactSymbolTableWriter;
+class CompactHashtableWriter;
 class SerializeClosure;
 
 class SymbolTableConfig;
@@ -240,10 +240,10 @@
 
   // Sharing
 private:
-  static void copy_shared_symbol_table(CompactSymbolTableWriter* ch_table);
+  static void copy_shared_symbol_table(CompactHashtableWriter* ch_table);
 public:
   static void write_to_archive() NOT_CDS_RETURN;
-  static void serialize(SerializeClosure* soc) NOT_CDS_RETURN;
+  static void serialize_shared_table_header(SerializeClosure* soc) NOT_CDS_RETURN;
   static void metaspace_pointers_do(MetaspaceClosure* it);
 
   // Jcmd
--- a/src/hotspot/share/compiler/compileBroker.cpp	Fri Oct 05 17:01:07 2018 -0400
+++ b/src/hotspot/share/compiler/compileBroker.cpp	Tue Oct 09 14:37:59 2018 +0200
@@ -1781,30 +1781,31 @@
           return; // Stop this thread.
         }
       }
-      continue;
-    }
-
-    if (UseDynamicNumberOfCompilerThreads) {
-      possibly_add_compiler_threads();
-    }
+    } else {
+      // Assign the task to the current thread.  Mark this compilation
+      // thread as active for the profiler.
+      // CompileTaskWrapper also keeps the Method* from being deallocated if redefinition
+      // occurs after fetching the compile task off the queue.
+      CompileTaskWrapper ctw(task);
+      nmethodLocker result_handle;  // (handle for the nmethod produced by this task)
+      task->set_code_handle(&result_handle);
+      methodHandle method(thread, task->method());
 
-    // Assign the task to the current thread.  Mark this compilation
-    // thread as active for the profiler.
-    CompileTaskWrapper ctw(task);
-    nmethodLocker result_handle;  // (handle for the nmethod produced by this task)
-    task->set_code_handle(&result_handle);
-    methodHandle method(thread, task->method());
+      // Never compile a method if breakpoints are present in it
+      if (method()->number_of_breakpoints() == 0) {
+        // Compile the method.
+        if ((UseCompiler || AlwaysCompileLoopMethods) && CompileBroker::should_compile_new_jobs()) {
+          invoke_compiler_on_method(task);
+          thread->start_idle_timer();
+        } else {
+          // After compilation is disabled, remove remaining methods from queue
+          method->clear_queued_for_compilation();
+          task->set_failure_reason("compilation is disabled");
+        }
+      }
 
-    // Never compile a method if breakpoints are present in it
-    if (method()->number_of_breakpoints() == 0) {
-      // Compile the method.
-      if ((UseCompiler || AlwaysCompileLoopMethods) && CompileBroker::should_compile_new_jobs()) {
-        invoke_compiler_on_method(task);
-        thread->start_idle_timer();
-      } else {
-        // After compilation is disabled, remove remaining methods from queue
-        method->clear_queued_for_compilation();
-        task->set_failure_reason("compilation is disabled");
+      if (UseDynamicNumberOfCompilerThreads) {
+        possibly_add_compiler_threads();
       }
     }
   }
--- a/src/hotspot/share/gc/shared/genCollectedHeap.cpp	Fri Oct 05 17:01:07 2018 -0400
+++ b/src/hotspot/share/gc/shared/genCollectedHeap.cpp	Tue Oct 09 14:37:59 2018 +0200
@@ -649,9 +649,6 @@
     // a whole heap collection.
     complete = complete || collected_old;
 
-    print_heap_change(young_prev_used, old_prev_used);
-    MetaspaceUtils::print_metaspace_change(metadata_prev_used);
-
     // Adjust generation sizes.
     if (collected_old) {
       _old_gen->compute_new_size();
@@ -667,6 +664,9 @@
       update_full_collections_completed();
     }
 
+    print_heap_change(young_prev_used, old_prev_used);
+    MetaspaceUtils::print_metaspace_change(metadata_prev_used);
+
     // Track memory usage and detect low memory after GC finishes
     MemoryService::track_memory_usage();
 
--- a/src/hotspot/share/gc/shared/memAllocator.cpp	Fri Oct 05 17:01:07 2018 -0400
+++ b/src/hotspot/share/gc/shared/memAllocator.cpp	Tue Oct 09 14:37:59 2018 +0200
@@ -120,27 +120,22 @@
     return false;
   }
 
-  if (!_overhead_limit_exceeded) {
+  const char* message = _overhead_limit_exceeded ? "GC overhead limit exceeded" : "Java heap space";
+  if (!THREAD->in_retryable_allocation()) {
     // -XX:+HeapDumpOnOutOfMemoryError and -XX:OnOutOfMemoryError support
-    report_java_out_of_memory("Java heap space");
+    report_java_out_of_memory(message);
 
     if (JvmtiExport::should_post_resource_exhausted()) {
       JvmtiExport::post_resource_exhausted(
         JVMTI_RESOURCE_EXHAUSTED_OOM_ERROR | JVMTI_RESOURCE_EXHAUSTED_JAVA_HEAP,
-        "Java heap space");
+        message);
     }
-    THROW_OOP_(Universe::out_of_memory_error_java_heap(), true);
+    oop exception = _overhead_limit_exceeded ?
+        Universe::out_of_memory_error_gc_overhead_limit() :
+        Universe::out_of_memory_error_java_heap();
+    THROW_OOP_(exception, true);
   } else {
-    // -XX:+HeapDumpOnOutOfMemoryError and -XX:OnOutOfMemoryError support
-    report_java_out_of_memory("GC overhead limit exceeded");
-
-    if (JvmtiExport::should_post_resource_exhausted()) {
-      JvmtiExport::post_resource_exhausted(
-        JVMTI_RESOURCE_EXHAUSTED_OOM_ERROR | JVMTI_RESOURCE_EXHAUSTED_JAVA_HEAP,
-        "GC overhead limit exceeded");
-    }
-
-    THROW_OOP_(Universe::out_of_memory_error_gc_overhead_limit(), true);
+    THROW_OOP_(Universe::out_of_memory_error_retry(), true);
   }
 }
 
--- a/src/hotspot/share/gc/shared/oopStorage.cpp	Fri Oct 05 17:01:07 2018 -0400
+++ b/src/hotspot/share/gc/shared/oopStorage.cpp	Tue Oct 09 14:37:59 2018 +0200
@@ -727,7 +727,7 @@
   _allocation_mutex(allocation_mutex),
   _active_mutex(active_mutex),
   _allocation_count(0),
-  _concurrent_iteration_active(false)
+  _concurrent_iteration_count(0)
 {
   _active_array->increment_refcount();
   assert(_active_mutex->rank() < _allocation_mutex->rank(),
@@ -769,7 +769,7 @@
   // blocks available for deletion.
   while (reduce_deferred_updates()) {}
   // Don't interfere with a concurrent iteration.
-  if (_concurrent_iteration_active) return;
+  if (_concurrent_iteration_count > 0) return;
   // Delete empty (and otherwise deletable) blocks from end of _allocation_list.
   for (Block* block = _allocation_list.tail();
        (block != NULL) && block->is_deletable();
@@ -804,7 +804,7 @@
     {
       MutexLockerEx aml(_active_mutex, Mutex::_no_safepoint_check_flag);
       // Don't interfere with a concurrent iteration.
-      if (_concurrent_iteration_active) return;
+      if (_concurrent_iteration_count > 0) return;
       _active_array->remove(block);
     }
     // Remove block from _allocation_list and delete it.
@@ -875,7 +875,7 @@
   _concurrent(concurrent)
 {
   assert(estimated_thread_count > 0, "estimated thread count must be positive");
-  update_iteration_state(true);
+  update_concurrent_iteration_count(1);
   // Get the block count *after* iteration state updated, so concurrent
   // empty block deletion is suppressed and can't reduce the count.  But
   // ensure the count we use was written after the block with that count
@@ -885,14 +885,14 @@
 
 OopStorage::BasicParState::~BasicParState() {
   _storage->relinquish_block_array(_active_array);
-  update_iteration_state(false);
+  update_concurrent_iteration_count(-1);
 }
 
-void OopStorage::BasicParState::update_iteration_state(bool value) {
+void OopStorage::BasicParState::update_concurrent_iteration_count(int value) {
   if (_concurrent) {
     MutexLockerEx ml(_storage->_active_mutex, Mutex::_no_safepoint_check_flag);
-    assert(_storage->_concurrent_iteration_active != value, "precondition");
-    _storage->_concurrent_iteration_active = value;
+    _storage->_concurrent_iteration_count += value;
+    assert(_storage->_concurrent_iteration_count >= 0, "invariant");
   }
 }
 
@@ -954,7 +954,7 @@
 
   st->print("%s: " SIZE_FORMAT " entries in " SIZE_FORMAT " blocks (%.F%%), " SIZE_FORMAT " bytes",
             name(), allocations, blocks, alloc_percentage, total_memory_usage());
-  if (_concurrent_iteration_active) {
+  if (_concurrent_iteration_count > 0) {
     st->print(", concurrent iteration active");
   }
 }
--- a/src/hotspot/share/gc/shared/oopStorage.hpp	Fri Oct 05 17:01:07 2018 -0400
+++ b/src/hotspot/share/gc/shared/oopStorage.hpp	Tue Oct 09 14:37:59 2018 +0200
@@ -220,7 +220,7 @@
   mutable SingleWriterSynchronizer _protect_active;
 
   // mutable because this gets set even for const iteration.
-  mutable bool _concurrent_iteration_active;
+  mutable int _concurrent_iteration_count;
 
   Block* find_block_or_null(const oop* ptr) const;
   void delete_empty_block(const Block& block);
--- a/src/hotspot/share/gc/shared/oopStorageParState.hpp	Fri Oct 05 17:01:07 2018 -0400
+++ b/src/hotspot/share/gc/shared/oopStorageParState.hpp	Tue Oct 09 14:37:59 2018 +0200
@@ -31,22 +31,16 @@
 //////////////////////////////////////////////////////////////////////////////
 // Support for parallel and optionally concurrent state iteration.
 //
-// Parallel iteration is for the exclusive use of the GC.  Other iteration
-// clients must use serial iteration.
-//
 // Concurrent Iteration
 //
 // Iteration involves the _active_array (an ActiveArray), which contains all
 // of the blocks owned by a storage object.
 //
-// At most one concurrent ParState can exist at a time for a given storage
-// object.
-//
-// A concurrent ParState sets the associated storage's
-// _concurrent_iteration_active flag true when the state is constructed, and
-// sets it false when the state is destroyed.  These assignments are made with
+// A concurrent ParState increments the associated storage's
+// _concurrent_iteration_count when the state is constructed, and
+// decrements it when the state is destroyed.  These assignments are made with
 // _active_mutex locked.  Meanwhile, empty block deletion is not done while
-// _concurrent_iteration_active is true.  The flag check and the dependent
+// _concurrent_iteration_count is non-zero.  The counter check and the dependent
 // removal of a block from the _active_array is performed with _active_mutex
 // locked.  This prevents concurrent iteration and empty block deletion from
 // interfering with with each other.
@@ -83,8 +77,8 @@
 // scheduling both operations to run at the same time.
 //
 // ParState<concurrent, is_const>
-//   concurrent must be true if iteration is concurrent with the
-//   mutator, false if iteration is at a safepoint.
+//   concurrent must be true if iteration may be concurrent with the
+//   mutators.
 //
 //   is_const must be true if the iteration is over a constant storage
 //   object, false if the iteration may modify the storage object.
@@ -92,8 +86,7 @@
 // ParState([const] OopStorage* storage)
 //   Construct an object for managing an iteration over storage.  For a
 //   concurrent ParState, empty block deletion for the associated storage
-//   is inhibited for the life of the ParState.  There can be no more
-//   than one live concurrent ParState at a time for a given storage object.
+//   is inhibited for the life of the ParState.
 //
 // template<typename F> void iterate(F f)
 //   Repeatedly claims a block from the associated storage that has
@@ -152,7 +145,7 @@
 
   struct IterationData;
 
-  void update_iteration_state(bool value);
+  void update_concurrent_iteration_count(int value);
   bool claim_next_segment(IterationData* data);
   bool finish_iteration(const IterationData* data) const;
 
--- a/src/hotspot/share/gc/z/c2/zBarrierSetC2.cpp	Fri Oct 05 17:01:07 2018 -0400
+++ b/src/hotspot/share/gc/z/c2/zBarrierSetC2.cpp	Tue Oct 09 14:37:59 2018 +0200
@@ -1427,6 +1427,10 @@
   return c;
 }
 
+bool ZBarrierSetC2::array_copy_requires_gc_barriers(bool tightly_coupled_alloc, BasicType type, bool is_clone, ArrayCopyPhase phase) const {
+  return type == T_OBJECT || type == T_ARRAY;
+}
+
 // == Verification ==
 
 #ifdef ASSERT
--- a/src/hotspot/share/gc/z/c2/zBarrierSetC2.hpp	Fri Oct 05 17:01:07 2018 -0400
+++ b/src/hotspot/share/gc/z/c2/zBarrierSetC2.hpp	Tue Oct 09 14:37:59 2018 +0200
@@ -194,7 +194,7 @@
   virtual void enqueue_useful_gc_barrier(Unique_Node_List &worklist, Node* node) const;
   virtual void register_potential_barrier_node(Node* node) const;
   virtual void unregister_potential_barrier_node(Node* node) const;
-  virtual bool array_copy_requires_gc_barriers(bool tightly_coupled_alloc, BasicType type, bool is_clone, ArrayCopyPhase phase) const { return true; }
+  virtual bool array_copy_requires_gc_barriers(bool tightly_coupled_alloc, BasicType type, bool is_clone, ArrayCopyPhase phase) const;
   virtual Node* step_over_gc_barrier(Node* c) const;
   // If the BarrierSetC2 state has kept macro nodes in its compilation unit state to be
   // expanded later, then now is the time to do so.
--- a/src/hotspot/share/jvmci/jvmciRuntime.cpp	Fri Oct 05 17:01:07 2018 -0400
+++ b/src/hotspot/share/jvmci/jvmciRuntime.cpp	Tue Oct 09 14:37:59 2018 +0200
@@ -109,22 +109,72 @@
   }
 }
 
-JRT_BLOCK_ENTRY(void, JVMCIRuntime::new_instance(JavaThread* thread, Klass* klass))
+// Manages a scope for a JVMCI runtime call that attempts a heap allocation.
+// If there is a pending exception upon closing the scope and the runtime
+// call is of the variety where allocation failure returns NULL without an
+// exception, the following action is taken:
+//   1. The pending exception is cleared
+//   2. NULL is written to JavaThread::_vm_result
+//   3. Checks that an OutOfMemoryError is Universe::out_of_memory_error_retry().
+class RetryableAllocationMark: public StackObj {
+ private:
+  JavaThread* _thread;
+ public:
+  RetryableAllocationMark(JavaThread* thread, bool activate) {
+    if (activate) {
+      assert(!thread->in_retryable_allocation(), "retryable allocation scope is non-reentrant");
+      _thread = thread;
+      _thread->set_in_retryable_allocation(true);
+    } else {
+      _thread = NULL;
+    }
+  }
+  ~RetryableAllocationMark() {
+    if (_thread != NULL) {
+      _thread->set_in_retryable_allocation(false);
+      JavaThread* THREAD = _thread;
+      if (HAS_PENDING_EXCEPTION) {
+        oop ex = PENDING_EXCEPTION;
+        CLEAR_PENDING_EXCEPTION;
+        oop retry_oome = Universe::out_of_memory_error_retry();
+        if (ex->is_a(retry_oome->klass()) && retry_oome != ex) {
+          ResourceMark rm;
+          fatal("Unexpected exception in scope of retryable allocation: " INTPTR_FORMAT " of type %s", p2i(ex), ex->klass()->external_name());
+        }
+        _thread->set_vm_result(NULL);
+      }
+    }
+  }
+};
+
+JRT_BLOCK_ENTRY(void, JVMCIRuntime::new_instance_common(JavaThread* thread, Klass* klass, bool null_on_fail))
   JRT_BLOCK;
   assert(klass->is_klass(), "not a class");
   Handle holder(THREAD, klass->klass_holder()); // keep the klass alive
   InstanceKlass* ik = InstanceKlass::cast(klass);
-  ik->check_valid_for_instantiation(true, CHECK);
-  // make sure klass is initialized
-  ik->initialize(CHECK);
-  // allocate instance and return via TLS
-  oop obj = ik->allocate_instance(CHECK);
-  thread->set_vm_result(obj);
+  {
+    RetryableAllocationMark ram(thread, null_on_fail);
+    ik->check_valid_for_instantiation(true, CHECK);
+    oop obj;
+    if (null_on_fail) {
+      if (!ik->is_initialized()) {
+        // Cannot re-execute class initialization without side effects
+        // so return without attempting the initialization
+        return;
+      }
+    } else {
+      // make sure klass is initialized
+      ik->initialize(CHECK);
+    }
+    // allocate instance and return via TLS
+    obj = ik->allocate_instance(CHECK);
+    thread->set_vm_result(obj);
+  }
   JRT_BLOCK_END;
   SharedRuntime::on_slowpath_allocation_exit(thread);
 JRT_END
 
-JRT_BLOCK_ENTRY(void, JVMCIRuntime::new_array(JavaThread* thread, Klass* array_klass, jint length))
+JRT_BLOCK_ENTRY(void, JVMCIRuntime::new_array_common(JavaThread* thread, Klass* array_klass, jint length, bool null_on_fail))
   JRT_BLOCK;
   // Note: no handle for klass needed since they are not used
   //       anymore after new_objArray() and no GC can happen before.
@@ -133,10 +183,12 @@
   oop obj;
   if (array_klass->is_typeArray_klass()) {
     BasicType elt_type = TypeArrayKlass::cast(array_klass)->element_type();
+    RetryableAllocationMark ram(thread, null_on_fail);
     obj = oopFactory::new_typeArray(elt_type, length, CHECK);
   } else {
     Handle holder(THREAD, array_klass->klass_holder()); // keep the klass alive
     Klass* elem_klass = ObjArrayKlass::cast(array_klass)->element_klass();
+    RetryableAllocationMark ram(thread, null_on_fail);
     obj = oopFactory::new_objArray(elem_klass, length, CHECK);
   }
   thread->set_vm_result(obj);
@@ -146,8 +198,12 @@
     static int deopts = 0;
     // Alternate between deoptimizing and raising an error (which will also cause a deopt)
     if (deopts++ % 2 == 0) {
-      ResourceMark rm(THREAD);
-      THROW(vmSymbols::java_lang_OutOfMemoryError());
+      if (null_on_fail) {
+        return;
+      } else {
+        ResourceMark rm(THREAD);
+        THROW(vmSymbols::java_lang_OutOfMemoryError());
+      }
     } else {
       deopt_caller();
     }
@@ -156,32 +212,43 @@
   SharedRuntime::on_slowpath_allocation_exit(thread);
 JRT_END
 
-JRT_ENTRY(void, JVMCIRuntime::new_multi_array(JavaThread* thread, Klass* klass, int rank, jint* dims))
+JRT_ENTRY(void, JVMCIRuntime::new_multi_array_common(JavaThread* thread, Klass* klass, int rank, jint* dims, bool null_on_fail))
   assert(klass->is_klass(), "not a class");
   assert(rank >= 1, "rank must be nonzero");
   Handle holder(THREAD, klass->klass_holder()); // keep the klass alive
+  RetryableAllocationMark ram(thread, null_on_fail);
   oop obj = ArrayKlass::cast(klass)->multi_allocate(rank, dims, CHECK);
   thread->set_vm_result(obj);
 JRT_END
 
-JRT_ENTRY(void, JVMCIRuntime::dynamic_new_array(JavaThread* thread, oopDesc* element_mirror, jint length))
+JRT_ENTRY(void, JVMCIRuntime::dynamic_new_array_common(JavaThread* thread, oopDesc* element_mirror, jint length, bool null_on_fail))
+  RetryableAllocationMark ram(thread, null_on_fail);
   oop obj = Reflection::reflect_new_array(element_mirror, length, CHECK);
   thread->set_vm_result(obj);
 JRT_END
 
-JRT_ENTRY(void, JVMCIRuntime::dynamic_new_instance(JavaThread* thread, oopDesc* type_mirror))
+JRT_ENTRY(void, JVMCIRuntime::dynamic_new_instance_common(JavaThread* thread, oopDesc* type_mirror, bool null_on_fail))
   InstanceKlass* klass = InstanceKlass::cast(java_lang_Class::as_Klass(type_mirror));
 
   if (klass == NULL) {
     ResourceMark rm(THREAD);
     THROW(vmSymbols::java_lang_InstantiationException());
   }
+  RetryableAllocationMark ram(thread, null_on_fail);
 
   // Create new instance (the receiver)
   klass->check_valid_for_instantiation(false, CHECK);
 
-  // Make sure klass gets initialized
-  klass->initialize(CHECK);
+  if (null_on_fail) {
+    if (!klass->is_initialized()) {
+      // Cannot re-execute class initialization without side effects
+      // so return without attempting the initialization
+      return;
+    }
+  } else {
+    // Make sure klass gets initialized
+    klass->initialize(CHECK);
+  }
 
   oop obj = klass->allocate_instance(CHECK);
   thread->set_vm_result(obj);
--- a/src/hotspot/share/jvmci/jvmciRuntime.hpp	Fri Oct 05 17:01:07 2018 -0400
+++ b/src/hotspot/share/jvmci/jvmciRuntime.hpp	Tue Oct 09 14:37:59 2018 +0200
@@ -121,13 +121,35 @@
 
   static BasicType kindToBasicType(Handle kind, TRAPS);
 
-  // The following routines are all called from compiled JVMCI code
+  static void new_instance_common(JavaThread* thread, Klass* klass, bool null_on_fail);
+  static void new_array_common(JavaThread* thread, Klass* klass, jint length, bool null_on_fail);
+  static void new_multi_array_common(JavaThread* thread, Klass* klass, int rank, jint* dims, bool null_on_fail);
+  static void dynamic_new_array_common(JavaThread* thread, oopDesc* element_mirror, jint length, bool null_on_fail);
+  static void dynamic_new_instance_common(JavaThread* thread, oopDesc* type_mirror, bool null_on_fail);
+
+  // The following routines are called from compiled JVMCI code
 
-  static void new_instance(JavaThread* thread, Klass* klass);
-  static void new_array(JavaThread* thread, Klass* klass, jint length);
-  static void new_multi_array(JavaThread* thread, Klass* klass, int rank, jint* dims);
-  static void dynamic_new_array(JavaThread* thread, oopDesc* element_mirror, jint length);
-  static void dynamic_new_instance(JavaThread* thread, oopDesc* type_mirror);
+  // When allocation fails, these stubs:
+  // 1. Exercise -XX:+HeapDumpOnOutOfMemoryError and -XX:OnOutOfMemoryError handling and also
+  //    post a JVMTI_EVENT_RESOURCE_EXHAUSTED event if the failure is an OutOfMemroyError
+  // 2. Return NULL with a pending exception.
+  // Compiled code must ensure these stubs are not called twice for the same allocation
+  // site due to the non-repeatable side effects in the case of OOME.
+  static void new_instance(JavaThread* thread, Klass* klass) { new_instance_common(thread, klass, false); }
+  static void new_array(JavaThread* thread, Klass* klass, jint length) { new_array_common(thread, klass, length, false); }
+  static void new_multi_array(JavaThread* thread, Klass* klass, int rank, jint* dims) { new_multi_array_common(thread, klass, rank, dims, false); }
+  static void dynamic_new_array(JavaThread* thread, oopDesc* element_mirror, jint length) { dynamic_new_array_common(thread, element_mirror, length, false); }
+  static void dynamic_new_instance(JavaThread* thread, oopDesc* type_mirror) { dynamic_new_instance_common(thread, type_mirror, false); }
+
+  // When allocation fails, these stubs return NULL and have no pending exception. Compiled code
+  // can use these stubs if a failed allocation will be retried (e.g., by deoptimizing and
+  // re-executing in the interpreter).
+  static void new_instance_or_null(JavaThread* thread, Klass* klass) { new_instance_common(thread, klass, true); }
+  static void new_array_or_null(JavaThread* thread, Klass* klass, jint length) { new_array_common(thread, klass, length, true); }
+  static void new_multi_array_or_null(JavaThread* thread, Klass* klass, int rank, jint* dims) { new_multi_array_common(thread, klass, rank, dims, true); }
+  static void dynamic_new_array_or_null(JavaThread* thread, oopDesc* element_mirror, jint length) { dynamic_new_array_common(thread, element_mirror, length, true); }
+  static void dynamic_new_instance_or_null(JavaThread* thread, oopDesc* type_mirror) { dynamic_new_instance_common(thread, type_mirror, true); }
+
   static jboolean thread_is_interrupted(JavaThread* thread, oopDesc* obj, jboolean clear_interrupted);
   static void vm_message(jboolean vmError, jlong format, jlong v1, jlong v2, jlong v3);
   static jint identity_hash_code(JavaThread* thread, oopDesc* obj);
--- a/src/hotspot/share/jvmci/vmStructs_jvmci.cpp	Fri Oct 05 17:01:07 2018 -0400
+++ b/src/hotspot/share/jvmci/vmStructs_jvmci.cpp	Tue Oct 09 14:37:59 2018 +0200
@@ -622,6 +622,12 @@
   declare_function(JVMCIRuntime::dynamic_new_array) \
   declare_function(JVMCIRuntime::dynamic_new_instance) \
   \
+  declare_function(JVMCIRuntime::new_instance_or_null) \
+  declare_function(JVMCIRuntime::new_array_or_null) \
+  declare_function(JVMCIRuntime::new_multi_array_or_null) \
+  declare_function(JVMCIRuntime::dynamic_new_array_or_null) \
+  declare_function(JVMCIRuntime::dynamic_new_instance_or_null) \
+  \
   declare_function(JVMCIRuntime::thread_is_interrupted) \
   declare_function(JVMCIRuntime::vm_message) \
   declare_function(JVMCIRuntime::identity_hash_code) \
--- a/src/hotspot/share/memory/heapShared.cpp	Fri Oct 05 17:01:07 2018 -0400
+++ b/src/hotspot/share/memory/heapShared.cpp	Tue Oct 09 14:37:59 2018 +0200
@@ -41,49 +41,26 @@
 #include "utilities/bitMap.inline.hpp"
 
 #if INCLUDE_CDS_JAVA_HEAP
-KlassSubGraphInfo* HeapShared::_subgraph_info_list = NULL;
-int HeapShared::_num_archived_subgraph_info_records = 0;
-Array<ArchivedKlassSubGraphInfoRecord>* HeapShared::_archived_subgraph_info_records = NULL;
-
-KlassSubGraphInfo* HeapShared::find_subgraph_info(Klass* k) {
-  KlassSubGraphInfo* info = _subgraph_info_list;
-  while (info != NULL) {
-    if (info->klass() == k) {
-      return info;
-    }
-    info = info->next();
-  }
-  return NULL;
-}
+address   HeapShared::_narrow_oop_base;
+int       HeapShared::_narrow_oop_shift;
+HeapShared::DumpTimeKlassSubGraphInfoTable* HeapShared::_dump_time_subgraph_info_table = NULL;
+HeapShared::RunTimeKlassSubGraphInfoTable   HeapShared::_run_time_subgraph_info_table;
 
 // Get the subgraph_info for Klass k. A new subgraph_info is created if
 // there is no existing one for k. The subgraph_info records the relocated
 // Klass* of the original k.
 KlassSubGraphInfo* HeapShared::get_subgraph_info(Klass* k) {
+  assert(DumpSharedSpaces, "dump time only");
   Klass* relocated_k = MetaspaceShared::get_relocated_klass(k);
-  KlassSubGraphInfo* info = find_subgraph_info(relocated_k);
-  if (info != NULL) {
-    return info;
+  KlassSubGraphInfo* info = _dump_time_subgraph_info_table->get(relocated_k);
+  if (info == NULL) {
+    _dump_time_subgraph_info_table->put(relocated_k, KlassSubGraphInfo(relocated_k));
+    info = _dump_time_subgraph_info_table->get(relocated_k);
+    ++ _dump_time_subgraph_info_table->_count;
   }
-
-  info = new KlassSubGraphInfo(relocated_k, _subgraph_info_list);
-  _subgraph_info_list = info;
   return info;
 }
 
-address   HeapShared::_narrow_oop_base;
-int       HeapShared::_narrow_oop_shift;
-
-int HeapShared::num_of_subgraph_infos() {
-  int num = 0;
-  KlassSubGraphInfo* info = _subgraph_info_list;
-  while (info != NULL) {
-    num ++;
-    info = info->next();
-  }
-  return num;
-}
-
 // Add an entry field to the current KlassSubGraphInfo.
 void KlassSubGraphInfo::add_subgraph_entry_field(int static_field_offset, oop v) {
   assert(DumpSharedSpaces, "dump time only");
@@ -156,7 +133,6 @@
 // Initialize an archived subgraph_info_record from the given KlassSubGraphInfo.
 void ArchivedKlassSubGraphInfoRecord::init(KlassSubGraphInfo* info) {
   _k = info->klass();
-  _next = NULL;
   _entry_field_records = NULL;
   _subgraph_object_klasses = NULL;
 
@@ -191,6 +167,26 @@
   }
 }
 
+struct CopyKlassSubGraphInfoToArchive : StackObj {
+  CompactHashtableWriter* _writer;
+  CopyKlassSubGraphInfoToArchive(CompactHashtableWriter* writer) : _writer(writer) {}
+
+  bool do_entry(Klass* klass, KlassSubGraphInfo& info) {
+    if (info.subgraph_object_klasses() != NULL || info.subgraph_entry_fields() != NULL) {
+      ArchivedKlassSubGraphInfoRecord* record =
+        (ArchivedKlassSubGraphInfoRecord*)MetaspaceShared::read_only_space_alloc(sizeof(ArchivedKlassSubGraphInfoRecord));
+      record->init(&info);
+
+      unsigned int hash = primitive_hash<Klass*>(klass);
+      uintx deltax = MetaspaceShared::object_delta(record);
+      guarantee(deltax <= MAX_SHARED_DELTA, "must not be");
+      u4 delta = u4(deltax);
+      _writer->add(hash, delta);
+    }
+    return true; // keep on iterating
+  }
+};
+
 // Build the records of archived subgraph infos, which include:
 // - Entry points to all subgraphs from the containing class mirror. The entry
 //   points are static fields in the mirror. For each entry point, the field
@@ -198,144 +194,96 @@
 //   back to the corresponding field at runtime.
 // - A list of klasses that need to be loaded/initialized before archived
 //   java object sub-graph can be accessed at runtime.
-//
-// The records are saved in the archive file and reloaded at runtime.
-//
-// Layout of the archived subgraph info records:
-//
-// records_size | num_records | records*
-// ArchivedKlassSubGraphInfoRecord | entry_fields | subgraph_object_klasses
-size_t HeapShared::build_archived_subgraph_info_records(int num_records) {
-  // remember the start address
-  char* start_p = MetaspaceShared::read_only_space_top();
+void HeapShared::write_subgraph_info_table() {
+  // Allocate the contents of the hashtable(s) inside the RO region of the CDS archive.
+  DumpTimeKlassSubGraphInfoTable* d_table = _dump_time_subgraph_info_table;
+  CompactHashtableStats stats;
+
+  _run_time_subgraph_info_table.reset();
 
-  // now populate the archived subgraph infos, which will be saved in the
-  // archive file
-  _archived_subgraph_info_records =
-    MetaspaceShared::new_ro_array<ArchivedKlassSubGraphInfoRecord>(num_records);
-  KlassSubGraphInfo* info = _subgraph_info_list;
-  int i = 0;
-  while (info != NULL) {
-    assert(i < _archived_subgraph_info_records->length(), "sanity");
-    ArchivedKlassSubGraphInfoRecord* record =
-      _archived_subgraph_info_records->adr_at(i);
-    record->init(info);
-    info = info->next();
-    i ++;
-  }
+  int num_buckets = CompactHashtableWriter::default_num_buckets(d_table->_count);
+  CompactHashtableWriter writer(num_buckets, &stats);
+  CopyKlassSubGraphInfoToArchive copy(&writer);
+  _dump_time_subgraph_info_table->iterate(&copy);
 
-  // _subgraph_info_list is no longer needed
-  delete _subgraph_info_list;
-  _subgraph_info_list = NULL;
-
-  char* end_p = MetaspaceShared::read_only_space_top();
-  size_t records_size = end_p - start_p;
-  return records_size;
+  writer.dump(&_run_time_subgraph_info_table, "subgraphs");
 }
 
-// Write the subgraph info records in the shared _ro region
-void HeapShared::write_archived_subgraph_infos() {
-  assert(DumpSharedSpaces, "dump time only");
-
-  Array<intptr_t>* records_header = MetaspaceShared::new_ro_array<intptr_t>(3);
-
-  _num_archived_subgraph_info_records = num_of_subgraph_infos();
-  size_t records_size = build_archived_subgraph_info_records(
-                             _num_archived_subgraph_info_records);
-
-  // Now write the header information:
-  // records_size, num_records, _archived_subgraph_info_records
-  assert(records_header != NULL, "sanity");
-  intptr_t* p = (intptr_t*)(records_header->data());
-  *p = (intptr_t)records_size;
-  p ++;
-  *p = (intptr_t)_num_archived_subgraph_info_records;
-  p ++;
-  *p = (intptr_t)_archived_subgraph_info_records;
-}
-
-char* HeapShared::read_archived_subgraph_infos(char* buffer) {
-  Array<intptr_t>* records_header = (Array<intptr_t>*)buffer;
-  intptr_t* p = (intptr_t*)(records_header->data());
-  size_t records_size = (size_t)(*p);
-  p ++;
-  _num_archived_subgraph_info_records = *p;
-  p ++;
-  _archived_subgraph_info_records =
-    (Array<ArchivedKlassSubGraphInfoRecord>*)(*p);
-
-  buffer = (char*)_archived_subgraph_info_records + records_size;
-  return buffer;
+void HeapShared::serialize_subgraph_info_table_header(SerializeClosure* soc) {
+  _run_time_subgraph_info_table.serialize_header(soc);
 }
 
 void HeapShared::initialize_from_archived_subgraph(Klass* k) {
   if (!MetaspaceShared::open_archive_heap_region_mapped()) {
     return; // nothing to do
   }
+  assert(!DumpSharedSpaces, "Should not be called with DumpSharedSpaces");
 
-  if (_num_archived_subgraph_info_records == 0) {
-    return; // no subgraph info records
-  }
+  unsigned int hash = primitive_hash<Klass*>(k);
+  ArchivedKlassSubGraphInfoRecord* record = _run_time_subgraph_info_table.lookup(k, hash, 0);
 
   // Initialize from archived data. Currently this is done only
   // during VM initialization time. No lock is needed.
-  Thread* THREAD = Thread::current();
-  for (int i = 0; i < _archived_subgraph_info_records->length(); i++) {
-    ArchivedKlassSubGraphInfoRecord* record = _archived_subgraph_info_records->adr_at(i);
-    if (record->klass() == k) {
-      int i;
-      // Found the archived subgraph info record for the requesting klass.
-      // Load/link/initialize the klasses of the objects in the subgraph.
-      // NULL class loader is used.
-      Array<Klass*>* klasses = record->subgraph_object_klasses();
-      if (klasses != NULL) {
-        for (i = 0; i < klasses->length(); i++) {
-          Klass* obj_k = klasses->at(i);
-          Klass* resolved_k = SystemDictionary::resolve_or_null(
-                                                (obj_k)->name(), THREAD);
-          if (resolved_k != obj_k) {
-            return;
-          }
-          if ((obj_k)->is_instance_klass()) {
-            InstanceKlass* ik = InstanceKlass::cast(obj_k);
-            ik->initialize(THREAD);
-          } else if ((obj_k)->is_objArray_klass()) {
-            ObjArrayKlass* oak = ObjArrayKlass::cast(obj_k);
-            oak->initialize(THREAD);
-          }
+  if (record != NULL) {
+    Thread* THREAD = Thread::current();
+    if (log_is_enabled(Info, cds, heap)) {
+      ResourceMark rm;
+      log_info(cds, heap)("initialize_from_archived_subgraph " PTR_FORMAT " %s", p2i(k),
+                          k->external_name());
+    }
+
+    int i;
+    // Load/link/initialize the klasses of the objects in the subgraph.
+    // NULL class loader is used.
+    Array<Klass*>* klasses = record->subgraph_object_klasses();
+    if (klasses != NULL) {
+      for (i = 0; i < klasses->length(); i++) {
+        Klass* obj_k = klasses->at(i);
+        Klass* resolved_k = SystemDictionary::resolve_or_null(
+                                              (obj_k)->name(), THREAD);
+        if (resolved_k != obj_k) {
+          return;
+        }
+        if ((obj_k)->is_instance_klass()) {
+          InstanceKlass* ik = InstanceKlass::cast(obj_k);
+          ik->initialize(THREAD);
+        } else if ((obj_k)->is_objArray_klass()) {
+          ObjArrayKlass* oak = ObjArrayKlass::cast(obj_k);
+          oak->initialize(THREAD);
         }
       }
+    }
+
+    if (HAS_PENDING_EXCEPTION) {
+      CLEAR_PENDING_EXCEPTION;
+      // None of the field value will be set if there was an exception.
+      // The java code will not see any of the archived objects in the
+      // subgraphs referenced from k in this case.
+      return;
+    }
+
+    // Load the subgraph entry fields from the record and store them back to
+    // the corresponding fields within the mirror.
+    oop m = k->java_mirror();
+    Array<juint>* entry_field_records = record->entry_field_records();
+    if (entry_field_records != NULL) {
+      int efr_len = entry_field_records->length();
+      assert(efr_len % 2 == 0, "sanity");
+      for (i = 0; i < efr_len;) {
+        int field_offset = entry_field_records->at(i);
+        // The object refereced by the field becomes 'known' by GC from this
+        // point. All objects in the subgraph reachable from the object are
+        // also 'known' by GC.
+        oop v = MetaspaceShared::materialize_archived_object(
+            entry_field_records->at(i+1));
+        m->obj_field_put(field_offset, v);
+        i += 2;
+
+        log_debug(cds, heap)("  " PTR_FORMAT " init field @ %2d = " PTR_FORMAT, p2i(k), field_offset, p2i(v));
+      }
 
-      if (HAS_PENDING_EXCEPTION) {
-        CLEAR_PENDING_EXCEPTION;
-        // None of the field value will be set if there was an exception.
-        // The java code will not see any of the archived objects in the
-        // subgraphs referenced from k in this case.
-        return;
-      }
-
-      // Load the subgraph entry fields from the record and store them back to
-      // the corresponding fields within the mirror.
-      oop m = k->java_mirror();
-      Array<juint>* entry_field_records = record->entry_field_records();
-      if (entry_field_records != NULL) {
-        int efr_len = entry_field_records->length();
-        assert(efr_len % 2 == 0, "sanity");
-        for (i = 0; i < efr_len;) {
-          int field_offset = entry_field_records->at(i);
-          // The object refereced by the field becomes 'known' by GC from this
-          // point. All objects in the subgraph reachable from the object are
-          // also 'known' by GC.
-          oop v = MetaspaceShared::materialize_archived_object(
-            entry_field_records->at(i+1));
-          m->obj_field_put(field_offset, v);
-          i += 2;
-        }
-      }
-
-      // Done. Java code can see the archived sub-graphs referenced from k's
-      // mirror after this point.
-      return;
+    // Done. Java code can see the archived sub-graphs referenced from k's
+    // mirror after this point.
     }
   }
 }
@@ -702,6 +650,8 @@
 };
 
 void HeapShared::init_archivable_static_fields(Thread* THREAD) {
+  _dump_time_subgraph_info_table = new (ResourceObj::C_HEAP, mtClass)DumpTimeKlassSubGraphInfoTable();
+
   for (int i = 0; i < num_archivable_static_fields; i++) {
     ArchivableStaticFieldInfo* info = &archivable_static_fields[i];
     TempNewSymbol klass_name =  SymbolTable::new_symbol(info->klass_name, THREAD);
--- a/src/hotspot/share/memory/heapShared.hpp	Fri Oct 05 17:01:07 2018 -0400
+++ b/src/hotspot/share/memory/heapShared.hpp	Tue Oct 09 14:37:59 2018 +0200
@@ -25,6 +25,7 @@
 #ifndef SHARE_VM_MEMORY_HEAPSHARED_HPP
 #define SHARE_VM_MEMORY_HEAPSHARED_HPP
 
+#include "classfile/compactHashtable.hpp"
 #include "classfile/systemDictionary.hpp"
 #include "memory/allocation.hpp"
 #include "memory/universe.hpp"
@@ -42,7 +43,6 @@
 // within the sub-graphs.
 class KlassSubGraphInfo: public CHeapObj<mtClass> {
  private:
-  KlassSubGraphInfo* _next;
   // The class that contains the static field(s) as the entry point(s)
   // of archived object sub-graph(s).
   Klass* _k;
@@ -54,8 +54,8 @@
   GrowableArray<juint>*  _subgraph_entry_fields;
 
  public:
-  KlassSubGraphInfo(Klass* k, KlassSubGraphInfo* next) :
-    _next(next), _k(k),  _subgraph_object_klasses(NULL),
+  KlassSubGraphInfo(Klass* k) :
+    _k(k),  _subgraph_object_klasses(NULL),
     _subgraph_entry_fields(NULL) {}
   ~KlassSubGraphInfo() {
     if (_subgraph_object_klasses != NULL) {
@@ -66,7 +66,6 @@
     }
   };
 
-  KlassSubGraphInfo* next() { return _next; }
   Klass* klass()            { return _k; }
   GrowableArray<Klass*>* subgraph_object_klasses() {
     return _subgraph_object_klasses;
@@ -87,7 +86,6 @@
 // at runtime.
 class ArchivedKlassSubGraphInfoRecord {
  private:
-  ArchivedKlassSubGraphInfoRecord* _next;
   Klass* _k;
 
   // contains pairs of field offset and value for each subgraph entry field
@@ -98,11 +96,9 @@
   Array<Klass*>* _subgraph_object_klasses;
  public:
   ArchivedKlassSubGraphInfoRecord() :
-    _next(NULL), _k(NULL), _entry_field_records(NULL), _subgraph_object_klasses(NULL) {}
+    _k(NULL), _entry_field_records(NULL), _subgraph_object_klasses(NULL) {}
   void init(KlassSubGraphInfo* info);
   Klass* klass() { return _k; }
-  ArchivedKlassSubGraphInfoRecord* next() { return _next; }
-  void set_next(ArchivedKlassSubGraphInfoRecord* next) { _next = next; }
   Array<juint>*  entry_field_records() { return _entry_field_records; }
   Array<Klass*>* subgraph_object_klasses() { return _subgraph_object_klasses; }
 };
@@ -112,14 +108,42 @@
   friend class VerifySharedOopClosure;
  private:
 #if INCLUDE_CDS_JAVA_HEAP
-  // This is a list of subgraph infos built at dump time while
-  // archiving object subgraphs.
-  static KlassSubGraphInfo* _subgraph_info_list;
+
+  static bool klass_equals(Klass* const& p1, Klass* const& p2) {
+    return primitive_equals<Klass*>(p1, p2);
+  }
+
+  static unsigned klass_hash(Klass* const& klass) {
+    return primitive_hash<address>((address)klass);
+  }
 
-  // Contains a list of ArchivedKlassSubGraphInfoRecords that is stored
-  // in the archive file and reloaded at runtime.
-  static int _num_archived_subgraph_info_records;
-  static Array<ArchivedKlassSubGraphInfoRecord>* _archived_subgraph_info_records;
+  class DumpTimeKlassSubGraphInfoTable
+    : public ResourceHashtable<Klass*, KlassSubGraphInfo,
+                               HeapShared::klass_hash,
+                               HeapShared::klass_equals,
+                               137, // prime number
+                               ResourceObj::C_HEAP> {
+  public:
+    int _count;
+  };
+
+  inline static ArchivedKlassSubGraphInfoRecord* read_record_from_compact_hashtable(address base_address, u4 offset) {
+    return (ArchivedKlassSubGraphInfoRecord*)(base_address + offset);
+  }
+
+  inline static bool record_equals_compact_hashtable_entry(ArchivedKlassSubGraphInfoRecord* value, const Klass* key, int len_unused) {
+    return (value->klass() == key);
+  }
+
+  typedef CompactHashtable<
+    const Klass*,
+    ArchivedKlassSubGraphInfoRecord*,
+    read_record_from_compact_hashtable,
+    record_equals_compact_hashtable_entry
+    > RunTimeKlassSubGraphInfoTable;
+
+  static DumpTimeKlassSubGraphInfoTable* _dump_time_subgraph_info_table;
+  static RunTimeKlassSubGraphInfoTable _run_time_subgraph_info_table;
 
   // Archive object sub-graph starting from the given static field
   // in Klass k's mirror.
@@ -131,11 +155,10 @@
 
   static void verify_reachable_objects_from(oop obj, bool is_archived) PRODUCT_RETURN;
 
-  static KlassSubGraphInfo* find_subgraph_info(Klass *k);
   static KlassSubGraphInfo* get_subgraph_info(Klass *k);
   static int num_of_subgraph_infos();
 
-  static size_t build_archived_subgraph_info_records(int num_records);
+  static void build_archived_subgraph_info_records(int num_records);
 
   // Used by decode_from_archive
   static address _narrow_oop_base;
@@ -203,6 +226,8 @@
 
   static void init_archivable_static_fields(Thread* THREAD) NOT_CDS_JAVA_HEAP_RETURN;
   static void archive_static_fields(Thread* THREAD) NOT_CDS_JAVA_HEAP_RETURN;
+  static void write_subgraph_info_table() NOT_CDS_JAVA_HEAP_RETURN;
+  static void serialize_subgraph_info_table_header(SerializeClosure* soc) NOT_CDS_JAVA_HEAP_RETURN;
 
 #if INCLUDE_CDS_JAVA_HEAP
   static ResourceBitMap calculate_oopmap(MemRegion region);
--- a/src/hotspot/share/memory/metaspaceShared.cpp	Fri Oct 05 17:01:07 2018 -0400
+++ b/src/hotspot/share/memory/metaspaceShared.cpp	Tue Oct 09 14:37:59 2018 +0200
@@ -420,10 +420,10 @@
   vmSymbols::serialize(soc);
   soc->do_tag(--tag);
 
-  // Dump/restore the symbol and string tables
-  SymbolTable::serialize(soc);
-  StringTable::serialize(soc);
-  soc->do_tag(--tag);
+  // Dump/restore the symbol/string/subgraph_info tables
+  SymbolTable::serialize_shared_table_header(soc);
+  StringTable::serialize_shared_table_header(soc);
+  HeapShared::serialize_subgraph_info_table_header(soc);
 
   JavaClasses::serialize_offsets(soc);
   InstanceMirrorKlass::serialize_offsets(soc);
@@ -1098,6 +1098,21 @@
     return _alloc_stats;
   }
 
+  // Use this when you allocate space with MetaspaceShare::read_only_space_alloc()
+  // outside of ArchiveCompactor::allocate(). These are usually for misc tables
+  // that are allocated in the RO space.
+  class OtherROAllocMark {
+    char* _oldtop;
+  public:
+    OtherROAllocMark() {
+      _oldtop = _ro_region.top();
+    }
+    ~OtherROAllocMark() {
+      char* newtop = _ro_region.top();
+      ArchiveCompactor::alloc_stats()->record_other_type(int(newtop - _oldtop), true);
+    }
+  };
+
   static void allocate(MetaspaceClosure::Ref* ref, bool read_only) {
     address obj = ref->obj();
     int bytes = ref->size() * BytesPerWord;
@@ -1308,7 +1323,7 @@
 }
 
 char* VM_PopulateDumpSharedSpace::dump_read_only_tables() {
-  char* oldtop = _ro_region.top();
+  ArchiveCompactor::OtherROAllocMark mark;
   // Reorder the system dictionary. Moving the symbols affects
   // how the hash table indices are calculated.
   SystemDictionary::reorder_dictionary_for_sharing();
@@ -1329,11 +1344,6 @@
   char* table_top = _ro_region.allocate(table_bytes, sizeof(intptr_t));
   SystemDictionary::copy_table(table_top, _ro_region.top());
 
-  // Write the archived object sub-graph infos. For each klass with sub-graphs,
-  // the info includes the static fields (sub-graph entry points) and Klasses
-  // of objects included in the sub-graph.
-  HeapShared::write_archived_subgraph_infos();
-
   // Write the other data to the output array.
   WriteClosure wc(&_ro_region);
   MetaspaceShared::serialize(&wc);
@@ -1341,8 +1351,6 @@
   // Write the bitmaps for patching the archive heap regions
   dump_archive_heap_oopmaps();
 
-  char* newtop = _ro_region.top();
-  ArchiveCompactor::alloc_stats()->record_other_type(int(newtop - oldtop), true);
   return buckets_top;
 }
 
@@ -1822,6 +1830,11 @@
   }
 
   G1HeapVerifier::verify_archive_regions();
+
+  {
+    ArchiveCompactor::OtherROAllocMark mark;
+    HeapShared::write_subgraph_info_table();
+  }
 }
 
 void VM_PopulateDumpSharedSpace::dump_archive_heap_oopmaps() {
@@ -1889,7 +1902,7 @@
 
 unsigned MetaspaceShared::obj_hash(oop const& p) {
   assert(!p->mark()->has_bias_pattern(),
-         "this object should never have been locked");  // so identity_hash won't safepoin
+         "this object should never have been locked");  // so identity_hash won't safepoint
   unsigned hash = (unsigned)p->identity_hash();
   return hash;
 }
@@ -2145,9 +2158,6 @@
   buffer += sizeof(intptr_t);
   buffer += len;
 
-  // The table of archived java heap object sub-graph infos
-  buffer = HeapShared::read_archived_subgraph_infos(buffer);
-
   // Verify various attributes of the archive, plus initialize the
   // shared string/symbol tables
   intptr_t* array = (intptr_t*)buffer;
--- a/src/hotspot/share/memory/universe.cpp	Fri Oct 05 17:01:07 2018 -0400
+++ b/src/hotspot/share/memory/universe.cpp	Tue Oct 09 14:37:59 2018 +0200
@@ -113,6 +113,7 @@
 oop Universe::_out_of_memory_error_array_size         = NULL;
 oop Universe::_out_of_memory_error_gc_overhead_limit  = NULL;
 oop Universe::_out_of_memory_error_realloc_objects    = NULL;
+oop Universe::_out_of_memory_error_retry              = NULL;
 oop Universe::_delayed_stack_overflow_error_message   = NULL;
 objArrayOop Universe::_preallocated_out_of_memory_error_array = NULL;
 volatile jint Universe::_preallocated_out_of_memory_error_avail_count = 0;
@@ -195,6 +196,7 @@
   f->do_oop((oop*)&_out_of_memory_error_array_size);
   f->do_oop((oop*)&_out_of_memory_error_gc_overhead_limit);
   f->do_oop((oop*)&_out_of_memory_error_realloc_objects);
+  f->do_oop((oop*)&_out_of_memory_error_retry);
   f->do_oop((oop*)&_delayed_stack_overflow_error_message);
   f->do_oop((oop*)&_preallocated_out_of_memory_error_array);
   f->do_oop((oop*)&_null_ptr_exception_instance);
@@ -565,7 +567,8 @@
           (!oopDesc::equals(throwable(), Universe::_out_of_memory_error_class_metaspace))  &&
           (!oopDesc::equals(throwable(), Universe::_out_of_memory_error_array_size)) &&
           (!oopDesc::equals(throwable(), Universe::_out_of_memory_error_gc_overhead_limit)) &&
-          (!oopDesc::equals(throwable(), Universe::_out_of_memory_error_realloc_objects)));
+          (!oopDesc::equals(throwable(), Universe::_out_of_memory_error_realloc_objects)) &&
+          (!oopDesc::equals(throwable(), Universe::_out_of_memory_error_retry)));
 }
 
 
@@ -974,6 +977,7 @@
   Universe::_out_of_memory_error_gc_overhead_limit =
     ik->allocate_instance(CHECK_false);
   Universe::_out_of_memory_error_realloc_objects = ik->allocate_instance(CHECK_false);
+  Universe::_out_of_memory_error_retry = ik->allocate_instance(CHECK_false);
 
   // Setup preallocated cause message for delayed StackOverflowError
   if (StackReservedPages > 0) {
@@ -1019,6 +1023,9 @@
   msg = java_lang_String::create_from_str("Java heap space: failed reallocation of scalar replaced objects", CHECK_false);
   java_lang_Throwable::set_message(Universe::_out_of_memory_error_realloc_objects, msg());
 
+  msg = java_lang_String::create_from_str("Java heap space: failed retryable allocation", CHECK_false);
+  java_lang_Throwable::set_message(Universe::_out_of_memory_error_retry, msg());
+
   msg = java_lang_String::create_from_str("/ by zero", CHECK_false);
   java_lang_Throwable::set_message(Universe::_arithmetic_exception_instance, msg());
 
--- a/src/hotspot/share/memory/universe.hpp	Fri Oct 05 17:01:07 2018 -0400
+++ b/src/hotspot/share/memory/universe.hpp	Tue Oct 09 14:37:59 2018 +0200
@@ -148,6 +148,7 @@
   static oop          _out_of_memory_error_array_size;
   static oop          _out_of_memory_error_gc_overhead_limit;
   static oop          _out_of_memory_error_realloc_objects;
+  static oop          _out_of_memory_error_retry;
 
   // preallocated cause message for delayed StackOverflowError
   static oop          _delayed_stack_overflow_error_message;
@@ -363,6 +364,8 @@
   static oop out_of_memory_error_array_size()         { return gen_out_of_memory_error(_out_of_memory_error_array_size); }
   static oop out_of_memory_error_gc_overhead_limit()  { return gen_out_of_memory_error(_out_of_memory_error_gc_overhead_limit);  }
   static oop out_of_memory_error_realloc_objects()    { return gen_out_of_memory_error(_out_of_memory_error_realloc_objects);  }
+  // Throw default _out_of_memory_error_retry object as it will never propagate out of the VM
+  static oop out_of_memory_error_retry()              { return _out_of_memory_error_retry;  }
   static oop delayed_stack_overflow_error_message()   { return _delayed_stack_overflow_error_message; }
 
   // The particular choice of collected heap.
--- a/src/hotspot/share/oops/arrayKlass.cpp	Fri Oct 05 17:01:07 2018 -0400
+++ b/src/hotspot/share/oops/arrayKlass.cpp	Tue Oct 09 14:37:59 2018 +0200
@@ -130,14 +130,7 @@
 }
 
 objArrayOop ArrayKlass::allocate_arrayArray(int n, int length, TRAPS) {
-  if (length < 0) {
-    THROW_MSG_0(vmSymbols::java_lang_NegativeArraySizeException(), err_msg("%d", length));
-  }
-  if (length > arrayOopDesc::max_array_length(T_ARRAY)) {
-    report_java_out_of_memory("Requested array size exceeds VM limit");
-    JvmtiExport::post_array_size_exhausted();
-    THROW_OOP_0(Universe::out_of_memory_error_array_size());
-  }
+  check_array_allocation_length(length, arrayOopDesc::max_array_length(T_ARRAY), CHECK_0);
   int size = objArrayOopDesc::object_size(length);
   Klass* k = array_klass(n+dimension(), CHECK_0);
   ArrayKlass* ak = ArrayKlass::cast(k);
--- a/src/hotspot/share/oops/instanceKlass.cpp	Fri Oct 05 17:01:07 2018 -0400
+++ b/src/hotspot/share/oops/instanceKlass.cpp	Tue Oct 09 14:37:59 2018 +0200
@@ -1201,14 +1201,7 @@
 }
 
 objArrayOop InstanceKlass::allocate_objArray(int n, int length, TRAPS) {
-  if (length < 0)  {
-    THROW_MSG_0(vmSymbols::java_lang_NegativeArraySizeException(), err_msg("%d", length));
-  }
-  if (length > arrayOopDesc::max_array_length(T_OBJECT)) {
-    report_java_out_of_memory("Requested array size exceeds VM limit");
-    JvmtiExport::post_array_size_exhausted();
-    THROW_OOP_0(Universe::out_of_memory_error_array_size());
-  }
+  check_array_allocation_length(length, arrayOopDesc::max_array_length(T_OBJECT), CHECK_NULL);
   int size = objArrayOopDesc::object_size(length);
   Klass* ak = array_klass(n, CHECK_NULL);
   objArrayOop o = (objArrayOop)Universe::heap()->array_allocate(ak, size, length,
--- a/src/hotspot/share/oops/klass.cpp	Fri Oct 05 17:01:07 2018 -0400
+++ b/src/hotspot/share/oops/klass.cpp	Tue Oct 09 14:37:59 2018 +0200
@@ -611,6 +611,20 @@
   return NULL;
 }
 
+void Klass::check_array_allocation_length(int length, int max_length, TRAPS) {
+  if (length > max_length) {
+    if (!THREAD->in_retryable_allocation()) {
+      report_java_out_of_memory("Requested array size exceeds VM limit");
+      JvmtiExport::post_array_size_exhausted();
+      THROW_OOP(Universe::out_of_memory_error_array_size());
+    } else {
+      THROW_OOP(Universe::out_of_memory_error_retry());
+    }
+  } else if (length < 0) {
+    THROW_MSG(vmSymbols::java_lang_NegativeArraySizeException(), err_msg("%d", length));
+  }
+}
+
 oop Klass::class_loader() const { return class_loader_data()->class_loader(); }
 
 // In product mode, this function doesn't have virtual function calls so
--- a/src/hotspot/share/oops/klass.hpp	Fri Oct 05 17:01:07 2018 -0400
+++ b/src/hotspot/share/oops/klass.hpp	Tue Oct 09 14:37:59 2018 +0200
@@ -514,6 +514,9 @@
   virtual Klass* array_klass_impl(bool or_null, int rank, TRAPS);
   virtual Klass* array_klass_impl(bool or_null, TRAPS);
 
+  // Error handling when length > max_length or length < 0
+  static void check_array_allocation_length(int length, int max_length, TRAPS);
+
   void set_vtable_length(int len) { _vtable_len= len; }
 
   vtableEntry* start_of_vtable() const;
--- a/src/hotspot/share/oops/objArrayKlass.cpp	Fri Oct 05 17:01:07 2018 -0400
+++ b/src/hotspot/share/oops/objArrayKlass.cpp	Tue Oct 09 14:37:59 2018 +0200
@@ -170,19 +170,10 @@
 }
 
 objArrayOop ObjArrayKlass::allocate(int length, TRAPS) {
-  if (length >= 0) {
-    if (length <= arrayOopDesc::max_array_length(T_OBJECT)) {
-      int size = objArrayOopDesc::object_size(length);
-      return (objArrayOop)Universe::heap()->array_allocate(this, size, length,
-                                                           /* do_zero */ true, THREAD);
-    } else {
-      report_java_out_of_memory("Requested array size exceeds VM limit");
-      JvmtiExport::post_array_size_exhausted();
-      THROW_OOP_0(Universe::out_of_memory_error_array_size());
-    }
-  } else {
-    THROW_MSG_0(vmSymbols::java_lang_NegativeArraySizeException(), err_msg("%d", length));
-  }
+  check_array_allocation_length(length, arrayOopDesc::max_array_length(T_OBJECT), CHECK_0);
+  int size = objArrayOopDesc::object_size(length);
+  return (objArrayOop)Universe::heap()->array_allocate(this, size, length,
+                                                       /* do_zero */ true, THREAD);
 }
 
 static int multi_alloc_counter = 0;
--- a/src/hotspot/share/oops/typeArrayKlass.cpp	Fri Oct 05 17:01:07 2018 -0400
+++ b/src/hotspot/share/oops/typeArrayKlass.cpp	Tue Oct 09 14:37:59 2018 +0200
@@ -99,19 +99,10 @@
 
 typeArrayOop TypeArrayKlass::allocate_common(int length, bool do_zero, TRAPS) {
   assert(log2_element_size() >= 0, "bad scale");
-  if (length >= 0) {
-    if (length <= max_length()) {
-      size_t size = typeArrayOopDesc::object_size(layout_helper(), length);
-      return (typeArrayOop)Universe::heap()->array_allocate(this, (int)size, length,
-                                                            do_zero, CHECK_NULL);
-    } else {
-      report_java_out_of_memory("Requested array size exceeds VM limit");
-      JvmtiExport::post_array_size_exhausted();
-      THROW_OOP_0(Universe::out_of_memory_error_array_size());
-    }
-  } else {
-    THROW_MSG_0(vmSymbols::java_lang_NegativeArraySizeException(), err_msg("%d", length));
-  }
+  check_array_allocation_length(length, max_length(), CHECK_NULL);
+  size_t size = typeArrayOopDesc::object_size(layout_helper(), length);
+  return (typeArrayOop)Universe::heap()->array_allocate(this, (int)size, length,
+                                                        do_zero, CHECK_NULL);
 }
 
 oop TypeArrayKlass::multi_allocate(int rank, jint* last_size, TRAPS) {
--- a/src/hotspot/share/prims/whitebox.cpp	Fri Oct 05 17:01:07 2018 -0400
+++ b/src/hotspot/share/prims/whitebox.cpp	Tue Oct 09 14:37:59 2018 +0200
@@ -1749,6 +1749,20 @@
   return NULL;
 WB_END
 
+WB_ENTRY(jobject, WB_GetDefaultArchivePath(JNIEnv* env, jobject wb))
+  const char* p = Arguments::get_default_shared_archive_path();
+  ThreadToNativeFromVM ttn(thread);
+  jstring path_string = env->NewStringUTF(p);
+
+  CHECK_JNI_EXCEPTION_(env, NULL);
+
+  return path_string;
+WB_END
+
+WB_ENTRY(jboolean, WB_IsSharingEnabled(JNIEnv* env, jobject wb))
+  return UseSharedSpaces;
+WB_END
+
 WB_ENTRY(jboolean, WB_IsShared(JNIEnv* env, jobject wb, jobject obj))
   oop obj_oop = JNIHandles::resolve(obj);
   return MetaspaceShared::is_archive_object(obj_oop);
@@ -2185,6 +2199,9 @@
   {CC"getMethodStringOption",
       CC"(Ljava/lang/reflect/Executable;Ljava/lang/String;)Ljava/lang/String;",
                                                       (void*)&WB_GetMethodStringOption},
+  {CC"getDefaultArchivePath",             CC"()Ljava/lang/String;",
+                                                      (void*)&WB_GetDefaultArchivePath},
+  {CC"isSharingEnabled",   CC"()Z",                   (void*)&WB_IsSharingEnabled},
   {CC"isShared",           CC"(Ljava/lang/Object;)Z", (void*)&WB_IsShared },
   {CC"isSharedClass",      CC"(Ljava/lang/Class;)Z",  (void*)&WB_IsSharedClass },
   {CC"areSharedStringsIgnored",           CC"()Z",    (void*)&WB_AreSharedStringsIgnored },
--- a/src/hotspot/share/runtime/arguments.cpp	Fri Oct 05 17:01:07 2018 -0400
+++ b/src/hotspot/share/runtime/arguments.cpp	Tue Oct 09 14:37:59 2018 +0200
@@ -3450,21 +3450,27 @@
 
 // Sharing support
 // Construct the path to the archive
+char* Arguments::get_default_shared_archive_path() {
+  char *default_archive_path;
+  char jvm_path[JVM_MAXPATHLEN];
+  os::jvm_path(jvm_path, sizeof(jvm_path));
+  char *end = strrchr(jvm_path, *os::file_separator());
+  if (end != NULL) *end = '\0';
+  size_t jvm_path_len = strlen(jvm_path);
+  size_t file_sep_len = strlen(os::file_separator());
+  const size_t len = jvm_path_len + file_sep_len + 20;
+  default_archive_path = NEW_C_HEAP_ARRAY(char, len, mtArguments);
+  if (default_archive_path != NULL) {
+    jio_snprintf(default_archive_path, len, "%s%sclasses.jsa",
+      jvm_path, os::file_separator());
+  }
+  return default_archive_path;
+}
+
 static char* get_shared_archive_path() {
   char *shared_archive_path;
   if (SharedArchiveFile == NULL) {
-    char jvm_path[JVM_MAXPATHLEN];
-    os::jvm_path(jvm_path, sizeof(jvm_path));
-    char *end = strrchr(jvm_path, *os::file_separator());
-    if (end != NULL) *end = '\0';
-    size_t jvm_path_len = strlen(jvm_path);
-    size_t file_sep_len = strlen(os::file_separator());
-    const size_t len = jvm_path_len + file_sep_len + 20;
-    shared_archive_path = NEW_C_HEAP_ARRAY(char, len, mtArguments);
-    if (shared_archive_path != NULL) {
-      jio_snprintf(shared_archive_path, len, "%s%sclasses.jsa",
-        jvm_path, os::file_separator());
-    }
+    shared_archive_path = Arguments::get_default_shared_archive_path();
   } else {
     shared_archive_path = os::strdup_check_oom(SharedArchiveFile, mtArguments);
   }
--- a/src/hotspot/share/runtime/arguments.hpp	Fri Oct 05 17:01:07 2018 -0400
+++ b/src/hotspot/share/runtime/arguments.hpp	Tue Oct 09 14:37:59 2018 +0200
@@ -633,6 +633,7 @@
   static char* get_appclasspath() { return _java_class_path->value(); }
   static void  fix_appclasspath();
 
+  static char* get_default_shared_archive_path();
 
   // Operation modi
   static Mode mode()                        { return _mode; }
--- a/src/hotspot/share/runtime/thread.cpp	Fri Oct 05 17:01:07 2018 -0400
+++ b/src/hotspot/share/runtime/thread.cpp	Tue Oct 09 14:37:59 2018 +0200
@@ -1547,6 +1547,7 @@
   _pending_failed_speculation = 0;
   _pending_transfer_to_interpreter = false;
   _adjusting_comp_level = false;
+  _in_retryable_allocation = false;
   _jvmci._alternate_call_target = NULL;
   assert(_jvmci._implicit_exception_pc == NULL, "must be");
   if (JVMCICounterSize > 0) {
--- a/src/hotspot/share/runtime/thread.hpp	Fri Oct 05 17:01:07 2018 -0400
+++ b/src/hotspot/share/runtime/thread.hpp	Tue Oct 09 14:37:59 2018 +0200
@@ -281,6 +281,14 @@
   void leave_signal_handler() { _num_nested_signal--; }
   bool is_inside_signal_handler() const { return _num_nested_signal > 0; }
 
+  // Determines if a heap allocation failure will be retried
+  // (e.g., by deoptimizing and re-executing in the interpreter).
+  // In this case, the failed allocation must raise
+  // Universe::out_of_memory_error_retry() and omit side effects
+  // such as JVMTI events and handling -XX:+HeapDumpOnOutOfMemoryError
+  // and -XX:OnOutOfMemoryError.
+  virtual bool in_retryable_allocation() const { return false; }
+
 #ifdef ASSERT
   void set_suspendible_thread() {
     _suspendible_thread = true;
@@ -1048,6 +1056,10 @@
   // Guard for re-entrant call to JVMCIRuntime::adjust_comp_level
   bool      _adjusting_comp_level;
 
+  // True if in a runtime call from compiled code that will deoptimize
+  // and re-execute a failed heap allocation in the interpreter.
+  bool      _in_retryable_allocation;
+
   // An id of a speculation that JVMCI compiled code can use to further describe and
   // uniquely identify the  speculative optimization guarded by the uncommon trap
   long       _pending_failed_speculation;
@@ -1458,7 +1470,7 @@
 
 #if INCLUDE_JVMCI
   int  pending_deoptimization() const             { return _pending_deoptimization; }
-  long  pending_failed_speculation() const         { return _pending_failed_speculation; }
+  long pending_failed_speculation() const         { return _pending_failed_speculation; }
   bool adjusting_comp_level() const               { return _adjusting_comp_level; }
   void set_adjusting_comp_level(bool b)           { _adjusting_comp_level = b; }
   bool has_pending_monitorenter() const           { return _pending_monitorenter; }
@@ -1468,6 +1480,9 @@
   void set_pending_transfer_to_interpreter(bool b) { _pending_transfer_to_interpreter = b; }
   void set_jvmci_alternate_call_target(address a) { assert(_jvmci._alternate_call_target == NULL, "must be"); _jvmci._alternate_call_target = a; }
   void set_jvmci_implicit_exception_pc(address a) { assert(_jvmci._implicit_exception_pc == NULL, "must be"); _jvmci._implicit_exception_pc = a; }
+
+  virtual bool in_retryable_allocation() const    { return _in_retryable_allocation; }
+  void set_in_retryable_allocation(bool b)        { _in_retryable_allocation = b; }
 #endif // INCLUDE_JVMCI
 
   // Exception handling for compiled methods
--- a/src/hotspot/share/utilities/globalDefinitions_gcc.hpp	Fri Oct 05 17:01:07 2018 -0400
+++ b/src/hotspot/share/utilities/globalDefinitions_gcc.hpp	Tue Oct 09 14:37:59 2018 +0200
@@ -218,8 +218,8 @@
 
 // Checking for finiteness
 
-inline int g_isfinite(jfloat  f)                 { return finite(f); }
-inline int g_isfinite(jdouble f)                 { return finite(f); }
+inline int g_isfinite(jfloat  f)                 { return isfinite(f); }
+inline int g_isfinite(jdouble f)                 { return isfinite(f); }
 
 
 // Wide characters
--- a/src/java.base/share/classes/java/lang/Module.java	Fri Oct 05 17:01:07 2018 -0400
+++ b/src/java.base/share/classes/java/lang/Module.java	Tue Oct 09 14:37:59 2018 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2014, 2017, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2014, 2018, 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
@@ -477,7 +477,7 @@
      *
      * @see ModuleDescriptor#opens()
      * @see #addOpens(String,Module)
-     * @see AccessibleObject#setAccessible(boolean)
+     * @see java.lang.reflect.AccessibleObject#setAccessible(boolean)
      * @see java.lang.invoke.MethodHandles#privateLookupIn
      */
     public boolean isOpen(String pn, Module other) {
@@ -747,7 +747,7 @@
      *         package to at least the caller's module
      *
      * @see #isOpen(String,Module)
-     * @see AccessibleObject#setAccessible(boolean)
+     * @see java.lang.reflect.AccessibleObject#setAccessible(boolean)
      * @see java.lang.invoke.MethodHandles#privateLookupIn
      */
     @CallerSensitive
@@ -1061,7 +1061,10 @@
      * @return a map of module name to runtime {@code Module}
      *
      * @throws IllegalArgumentException
-     *         If defining any of the modules to the VM fails
+     *         If the function maps a module to the null or platform class loader
+     * @throws IllegalStateException
+     *         If the module cannot be defined to the VM or its packages overlap
+     *         with another module mapped to the same class loader
      */
     static Map<String, Module> defineModules(Configuration cf,
                                              Function<String, ClassLoader> clf,
--- a/src/java.base/share/classes/java/util/jar/JarFile.java	Fri Oct 05 17:01:07 2018 -0400
+++ b/src/java.base/share/classes/java/util/jar/JarFile.java	Tue Oct 09 14:37:59 2018 +0200
@@ -556,7 +556,8 @@
             return JUZFA.entryNameStream(this).map(this::getBasename)
                                               .filter(Objects::nonNull)
                                               .distinct()
-                                              .map(this::getJarEntry);
+                                              .map(this::getJarEntry)
+                                              .filter(Objects::nonNull);
         }
         return stream();
     }
--- a/src/java.base/share/classes/java/util/jar/Manifest.java	Fri Oct 05 17:01:07 2018 -0400
+++ b/src/java.base/share/classes/java/util/jar/Manifest.java	Tue Oct 09 14:37:59 2018 +0200
@@ -49,9 +49,6 @@
  */
 public class Manifest implements Cloneable {
 
-    private static final boolean jarInfoInExceptionText =
-        SecurityProperties.includedInExceptions("jar");
-
     // manifest main attributes
     private Attributes attr = new Attributes();
 
@@ -203,10 +200,10 @@
     }
 
     static String getErrorPosition(String filename, final int lineNumber) {
-        if (filename == null || !jarInfoInExceptionText) {
+        if (filename == null ||
+                !SecurityProperties.INCLUDE_JAR_NAME_IN_EXCEPTIONS) {
             return "line " + lineNumber;
         }
-
         return "manifest of " + filename + ":" + lineNumber;
     }
 
--- a/src/java.base/share/classes/java/util/zip/ZipFile.java	Fri Oct 05 17:01:07 2018 -0400
+++ b/src/java.base/share/classes/java/util/zip/ZipFile.java	Tue Oct 09 14:37:59 2018 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1995, 2017, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1995, 2018, 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
@@ -35,6 +35,7 @@
 import java.lang.ref.Cleaner.Cleanable;
 import java.nio.charset.Charset;
 import java.nio.charset.StandardCharsets;
+import java.nio.file.InvalidPathException;
 import java.nio.file.attribute.BasicFileAttributes;
 import java.nio.file.Files;
 import java.util.ArrayDeque;
@@ -1218,8 +1219,13 @@
 
 
         static Source get(File file, boolean toDelete) throws IOException {
-            Key key = new Key(file,
-                              Files.readAttributes(file.toPath(), BasicFileAttributes.class));
+            final Key key;
+            try {
+                key = new Key(file,
+                        Files.readAttributes(file.toPath(), BasicFileAttributes.class));
+            } catch (InvalidPathException ipe) {
+                throw new IOException(ipe);
+            }
             Source src;
             synchronized (files) {
                 src = files.get(key);
--- a/src/java.base/share/classes/jdk/internal/loader/Loader.java	Fri Oct 05 17:01:07 2018 -0400
+++ b/src/java.base/share/classes/jdk/internal/loader/Loader.java	Tue Oct 09 14:37:59 2018 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2015, 2017, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2015, 2018, 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
@@ -198,7 +198,6 @@
         this.acc = AccessController.getContext();
     }
 
-
     /**
      * Completes initialization of this Loader. This method populates
      * remotePackageToLoader with the packages of the remote modules, where
@@ -253,25 +252,25 @@
                 }
 
                 // find the packages that are exported to the target module
-                String target = resolvedModule.name();
                 ModuleDescriptor descriptor = other.reference().descriptor();
-                for (ModuleDescriptor.Exports e : descriptor.exports()) {
-                    boolean delegate;
-                    if (e.isQualified()) {
-                        // qualified export in same configuration
-                        delegate = (other.configuration() == cf)
-                                && e.targets().contains(target);
-                    } else {
-                        // unqualified
-                        delegate = true;
-                    }
+                if (descriptor.isAutomatic()) {
+                    ClassLoader l = loader;
+                    descriptor.packages().forEach(pn -> remotePackage(pn, l));
+                } else {
+                    String target = resolvedModule.name();
+                    for (ModuleDescriptor.Exports e : descriptor.exports()) {
+                        boolean delegate;
+                        if (e.isQualified()) {
+                            // qualified export in same configuration
+                            delegate = (other.configuration() == cf)
+                                    && e.targets().contains(target);
+                        } else {
+                            // unqualified
+                            delegate = true;
+                        }
 
-                    if (delegate) {
-                        String pn = e.source();
-                        ClassLoader l = remotePackageToLoader.putIfAbsent(pn, loader);
-                        if (l != null && l != loader) {
-                            throw new IllegalArgumentException("Package "
-                                + pn + " cannot be imported from multiple loaders");
+                        if (delegate) {
+                            remotePackage(e.source(), loader);
                         }
                     }
                 }
@@ -283,6 +282,22 @@
     }
 
     /**
+     * Adds to remotePackageToLoader so that an attempt to load a class in
+     * the package delegates to the given class loader.
+     *
+     * @throws IllegalStateException
+     *         if the package is already mapped to a different class loader
+     */
+    private void remotePackage(String pn, ClassLoader loader) {
+        ClassLoader l = remotePackageToLoader.putIfAbsent(pn, loader);
+        if (l != null && l != loader) {
+            throw new IllegalStateException("Package "
+                + pn + " cannot be imported from multiple loaders");
+        }
+    }
+
+
+    /**
      * Find the layer corresponding to the given configuration in the tree
      * of layers rooted at the given parent.
      */
--- a/src/java.base/share/classes/jdk/internal/loader/LoaderPool.java	Fri Oct 05 17:01:07 2018 -0400
+++ b/src/java.base/share/classes/jdk/internal/loader/LoaderPool.java	Tue Oct 09 14:37:59 2018 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2015, 2018, 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
@@ -46,7 +46,7 @@
 
     /**
      * Creates a pool of class loaders. Each module in the given configuration
-     * will be loaded its own class loader in the pool. The class loader is
+     * is mapped to its own class loader in the pool. The class loader is
      * created with the given parent class loader as its parent.
      */
     public LoaderPool(Configuration cf,
--- a/src/java.base/share/classes/sun/security/util/SecurityProperties.java	Fri Oct 05 17:01:07 2018 -0400
+++ b/src/java.base/share/classes/sun/security/util/SecurityProperties.java	Tue Oct 09 14:37:59 2018 +0200
@@ -32,6 +32,9 @@
 
 public class SecurityProperties {
 
+    public static final boolean INCLUDE_JAR_NAME_IN_EXCEPTIONS
+        = includedInExceptions("jar");
+
     /**
      * Returns the value of the security property propName, which can be overridden
      * by a system property of the same name
--- a/src/java.base/unix/native/libjsig/jsig.c	Fri Oct 05 17:01:07 2018 -0400
+++ b/src/java.base/unix/native/libjsig/jsig.c	Tue Oct 09 14:37:59 2018 +0200
@@ -312,7 +312,7 @@
 }
 
 /* The three functions for the jvm to call into. */
-void JVM_begin_signal_setting() {
+JNIEXPORT void JVM_begin_signal_setting() {
   signal_lock();
   sigemptyset(&jvmsigs);
   jvm_signal_installing = true;
@@ -320,7 +320,7 @@
   signal_unlock();
 }
 
-void JVM_end_signal_setting() {
+JNIEXPORT void JVM_end_signal_setting() {
   signal_lock();
   jvm_signal_installed = true;
   jvm_signal_installing = false;
@@ -328,7 +328,7 @@
   signal_unlock();
 }
 
-struct sigaction *JVM_get_signal_action(int sig) {
+JNIEXPORT struct sigaction *JVM_get_signal_action(int sig) {
   allocate_sact();
   /* Does race condition make sense here? */
   if (sigismember(&jvmsigs, sig)) {
--- a/src/jdk.aot/share/classes/jdk.tools.jaotc.binformat/src/jdk/tools/jaotc/binformat/BinaryContainer.java	Fri Oct 05 17:01:07 2018 -0400
+++ b/src/jdk.aot/share/classes/jdk.tools.jaotc.binformat/src/jdk/tools/jaotc/binformat/BinaryContainer.java	Tue Oct 09 14:37:59 2018 +0200
@@ -240,14 +240,20 @@
         {"JVMCIRuntime::log_printf", "_aot_jvmci_runtime_log_printf"},
         {"JVMCIRuntime::vm_message", "_aot_jvmci_runtime_vm_message"},
         {"JVMCIRuntime::new_instance", "_aot_jvmci_runtime_new_instance"},
-        {"JVMCIRuntime::log_primitive", "_aot_jvmci_runtime_log_primitive"},
+        {"JVMCIRuntime::new_array", "_aot_jvmci_runtime_new_array"},
         {"JVMCIRuntime::new_multi_array", "_aot_jvmci_runtime_new_multi_array"},
+        {"JVMCIRuntime::dynamic_new_instance", "_aot_jvmci_runtime_dynamic_new_instance"},
+        {"JVMCIRuntime::dynamic_new_array", "_aot_jvmci_runtime_dynamic_new_array"},
+        {"JVMCIRuntime::new_instance_or_null", "_aot_jvmci_runtime_new_instance_or_null"},
+        {"JVMCIRuntime::new_array_or_null", "_aot_jvmci_runtime_new_array_or_null"},
+        {"JVMCIRuntime::new_multi_array_or_null", "_aot_jvmci_runtime_new_multi_array_or_null"},
+        {"JVMCIRuntime::dynamic_new_instance_or_null", "_aot_jvmci_runtime_dynamic_new_instance_or_null"},
+        {"JVMCIRuntime::dynamic_new_array_or_null", "_aot_jvmci_runtime_dynamic_new_array_or_null"},
+        {"JVMCIRuntime::log_primitive", "_aot_jvmci_runtime_log_primitive"},
         {"JVMCIRuntime::validate_object", "_aot_jvmci_runtime_validate_object"},
-        {"JVMCIRuntime::dynamic_new_array", "_aot_jvmci_runtime_dynamic_new_array"},
         {"JVMCIRuntime::write_barrier_pre", "_aot_jvmci_runtime_write_barrier_pre"},
         {"JVMCIRuntime::identity_hash_code", "_aot_jvmci_runtime_identity_hash_code"},
         {"JVMCIRuntime::write_barrier_post", "_aot_jvmci_runtime_write_barrier_post"},
-        {"JVMCIRuntime::dynamic_new_instance", "_aot_jvmci_runtime_dynamic_new_instance"},
         {"JVMCIRuntime::thread_is_interrupted", "_aot_jvmci_runtime_thread_is_interrupted"},
         {"JVMCIRuntime::exception_handler_for_pc", "_aot_jvmci_runtime_exception_handler_for_pc"},
         {"JVMCIRuntime::test_deoptimize_call_int", "_aot_jvmci_runtime_test_deoptimize_call_int"},
@@ -256,8 +262,7 @@
         {"JVMCIRuntime::throw_klass_external_name_exception", "_aot_jvmci_runtime_throw_klass_external_name_exception"},
         {"JVMCIRuntime::throw_class_cast_exception",          "_aot_jvmci_runtime_throw_class_cast_exception"},
 
-        {"JVMCIRuntime::vm_error", "_aot_jvmci_runtime_vm_error"},
-        {"JVMCIRuntime::new_array", "_aot_jvmci_runtime_new_array"}
+        {"JVMCIRuntime::vm_error", "_aot_jvmci_runtime_vm_error"}
     };
     //@formatter:on
 
--- a/src/jdk.compiler/share/classes/com/sun/tools/javac/comp/Lower.java	Fri Oct 05 17:01:07 2018 -0400
+++ b/src/jdk.compiler/share/classes/com/sun/tools/javac/comp/Lower.java	Tue Oct 09 14:37:59 2018 +0200
@@ -1130,10 +1130,14 @@
                 make.at(tree.pos);
                 return makeLit(sym.type, cv);
             }
-            // Otherwise replace the variable by its proxy.
-            sym = proxies.get(sym);
-            Assert.check(sym != null && (sym.flags_field & FINAL) != 0);
-            tree = make.at(tree.pos).Ident(sym);
+            if (lambdaTranslationMap != null && lambdaTranslationMap.get(sym) != null) {
+                return make.at(tree.pos).Ident(lambdaTranslationMap.get(sym));
+            } else {
+                // Otherwise replace the variable by its proxy.
+                sym = proxies.get(sym);
+                Assert.check(sym != null && (sym.flags_field & FINAL) != 0);
+                tree = make.at(tree.pos).Ident(sym);
+            }
         }
         JCExpression base = (tree.hasTag(SELECT)) ? ((JCFieldAccess) tree).selected : null;
         switch (sym.kind) {
--- a/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.hotspot/src/org/graalvm/compiler/hotspot/GraalHotSpotVMConfig.java	Fri Oct 05 17:01:07 2018 -0400
+++ b/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.hotspot/src/org/graalvm/compiler/hotspot/GraalHotSpotVMConfig.java	Tue Oct 09 14:37:59 2018 +0200
@@ -648,11 +648,33 @@
     public final long unsafeArraycopy = getFieldValue("StubRoutines::_unsafe_arraycopy", Long.class, "address");
     public final long genericArraycopy = getFieldValue("StubRoutines::_generic_arraycopy", Long.class, "address");
 
+    // Allocation stubs that throw an exception when allocation fails
     public final long newInstanceAddress = getAddress("JVMCIRuntime::new_instance");
     public final long newArrayAddress = getAddress("JVMCIRuntime::new_array");
     public final long newMultiArrayAddress = getAddress("JVMCIRuntime::new_multi_array");
-    public final long dynamicNewArrayAddress = getAddress("JVMCIRuntime::dynamic_new_array");
-    public final long dynamicNewInstanceAddress = getAddress("JVMCIRuntime::dynamic_new_instance");
+
+    // Allocation stubs that return null when allocation fails
+    public final long newInstanceOrNullAddress = getAddress("JVMCIRuntime::new_instance_or_null", 0L);
+    public final long newArrayOrNullAddress = getAddress("JVMCIRuntime::new_array_or_null", 0L);
+    public final long newMultiArrayOrNullAddress = getAddress("JVMCIRuntime::new_multi_array_or_null", 0L);
+
+    public boolean areNullAllocationStubsAvailable() {
+        return newInstanceOrNullAddress != 0L;
+    }
+
+    /**
+     * Checks that HotSpot implements all or none of the allocate-or-null stubs.
+     */
+    private boolean checkNullAllocationStubs() {
+        if (newInstanceOrNullAddress == 0L) {
+            assert newArrayOrNullAddress == 0L;
+            assert newMultiArrayOrNullAddress == 0L;
+        } else {
+            assert newArrayOrNullAddress != 0L;
+            assert newMultiArrayOrNullAddress != 0L;
+        }
+        return true;
+    }
 
     public final long threadIsInterruptedAddress = getAddress("JVMCIRuntime::thread_is_interrupted");
     public final long vmMessageAddress = getAddress("JVMCIRuntime::vm_message");
@@ -757,6 +779,7 @@
         }
 
         assert codeEntryAlignment > 0 : codeEntryAlignment;
+        assert checkNullAllocationStubs();
         return true;
     }
 }
--- a/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.hotspot/src/org/graalvm/compiler/hotspot/HotSpotBackend.java	Fri Oct 05 17:01:07 2018 -0400
+++ b/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.hotspot/src/org/graalvm/compiler/hotspot/HotSpotBackend.java	Tue Oct 09 14:37:59 2018 +0200
@@ -279,21 +279,36 @@
     public static final ForeignCallDescriptor VM_ERROR = new ForeignCallDescriptor("vm_error", void.class, Object.class, Object.class, long.class);
 
     /**
-     * New multi array stub call.
+     * New multi array stub that throws an {@link OutOfMemoryError} on allocation failure.
      */
     public static final ForeignCallDescriptor NEW_MULTI_ARRAY = new ForeignCallDescriptor("new_multi_array", Object.class, KlassPointer.class, int.class, Word.class);
 
     /**
-     * New array stub.
+     * New multi array stub that will return null on allocation failure.
+     */
+    public static final ForeignCallDescriptor NEW_MULTI_ARRAY_OR_NULL = new ForeignCallDescriptor("new_multi_array_or_null", Object.class, KlassPointer.class, int.class, Word.class);
+
+    /**
+     * New array stub that throws an {@link OutOfMemoryError} on allocation failure.
      */
     public static final ForeignCallDescriptor NEW_ARRAY = new ForeignCallDescriptor("new_array", Object.class, KlassPointer.class, int.class);
 
     /**
-     * New instance stub.
+     * New array stub that will return null on allocation failure.
+     */
+    public static final ForeignCallDescriptor NEW_ARRAY_OR_NULL = new ForeignCallDescriptor("new_array_or_null", Object.class, KlassPointer.class, int.class);
+
+    /**
+     * New instance stub that throws an {@link OutOfMemoryError} on allocation failure.
      */
     public static final ForeignCallDescriptor NEW_INSTANCE = new ForeignCallDescriptor("new_instance", Object.class, KlassPointer.class);
 
     /**
+     * New instance stub that will return null on allocation failure.
+     */
+    public static final ForeignCallDescriptor NEW_INSTANCE_OR_NULL = new ForeignCallDescriptor("new_instance_or_null", Object.class, KlassPointer.class);
+
+    /**
      * @see ResolveConstantStubCall
      */
     public static final ForeignCallDescriptor RESOLVE_STRING_BY_SYMBOL = new ForeignCallDescriptor("resolve_string_by_symbol", Object.class, Word.class, Word.class);
--- a/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.hotspot/src/org/graalvm/compiler/hotspot/meta/HotSpotHostForeignCallsProvider.java	Fri Oct 05 17:01:07 2018 -0400
+++ b/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.hotspot/src/org/graalvm/compiler/hotspot/meta/HotSpotHostForeignCallsProvider.java	Tue Oct 09 14:37:59 2018 +0200
@@ -45,8 +45,11 @@
 import static org.graalvm.compiler.hotspot.HotSpotBackend.MULTIPLY_TO_LEN;
 import static org.graalvm.compiler.hotspot.HotSpotBackend.MUL_ADD;
 import static org.graalvm.compiler.hotspot.HotSpotBackend.NEW_ARRAY;
+import static org.graalvm.compiler.hotspot.HotSpotBackend.NEW_ARRAY_OR_NULL;
 import static org.graalvm.compiler.hotspot.HotSpotBackend.NEW_INSTANCE;
+import static org.graalvm.compiler.hotspot.HotSpotBackend.NEW_INSTANCE_OR_NULL;
 import static org.graalvm.compiler.hotspot.HotSpotBackend.NEW_MULTI_ARRAY;
+import static org.graalvm.compiler.hotspot.HotSpotBackend.NEW_MULTI_ARRAY_OR_NULL;
 import static org.graalvm.compiler.hotspot.HotSpotBackend.RESOLVE_DYNAMIC_INVOKE;
 import static org.graalvm.compiler.hotspot.HotSpotBackend.RESOLVE_KLASS_BY_SYMBOL;
 import static org.graalvm.compiler.hotspot.HotSpotBackend.RESOLVE_METHOD_BY_SYMBOL_AND_LOAD_COUNTERS;
@@ -78,8 +81,6 @@
 import static org.graalvm.compiler.hotspot.replacements.HotSpotReplacementsUtil.TLAB_TOP_LOCATION;
 import static org.graalvm.compiler.hotspot.replacements.MonitorSnippets.MONITORENTER;
 import static org.graalvm.compiler.hotspot.replacements.MonitorSnippets.MONITOREXIT;
-import static org.graalvm.compiler.hotspot.replacements.NewObjectSnippets.DYNAMIC_NEW_ARRAY;
-import static org.graalvm.compiler.hotspot.replacements.NewObjectSnippets.DYNAMIC_NEW_INSTANCE;
 import static org.graalvm.compiler.hotspot.replacements.ThreadSubstitutions.THREAD_IS_INTERRUPTED;
 import static org.graalvm.compiler.hotspot.replacements.WriteBarrierSnippets.G1WBPOSTCALL;
 import static org.graalvm.compiler.hotspot.replacements.WriteBarrierSnippets.G1WBPRECALL;
@@ -288,6 +289,14 @@
 
         linkForeignCall(options, providers, NEW_INSTANCE, c.newInstanceAddress, PREPEND_THREAD, SAFEPOINT, REEXECUTABLE, TLAB_TOP_LOCATION, TLAB_END_LOCATION);
         linkForeignCall(options, providers, NEW_ARRAY, c.newArrayAddress, PREPEND_THREAD, SAFEPOINT, REEXECUTABLE, TLAB_TOP_LOCATION, TLAB_END_LOCATION);
+        linkForeignCall(options, providers, NEW_MULTI_ARRAY, c.newMultiArrayAddress, PREPEND_THREAD, SAFEPOINT, REEXECUTABLE, TLAB_TOP_LOCATION, TLAB_END_LOCATION);
+
+        if (c.areNullAllocationStubsAvailable()) {
+            linkForeignCall(options, providers, NEW_INSTANCE_OR_NULL, c.newInstanceOrNullAddress, PREPEND_THREAD, SAFEPOINT, REEXECUTABLE, TLAB_TOP_LOCATION, TLAB_END_LOCATION);
+            linkForeignCall(options, providers, NEW_ARRAY_OR_NULL, c.newArrayOrNullAddress, PREPEND_THREAD, SAFEPOINT, REEXECUTABLE, TLAB_TOP_LOCATION, TLAB_END_LOCATION);
+            linkForeignCall(options, providers, NEW_MULTI_ARRAY_OR_NULL, c.newMultiArrayOrNullAddress, PREPEND_THREAD, SAFEPOINT, REEXECUTABLE, TLAB_TOP_LOCATION, TLAB_END_LOCATION);
+        }
+
         link(new ExceptionHandlerStub(options, providers, foreignCalls.get(EXCEPTION_HANDLER)));
         link(new UnwindExceptionToCallerStub(options, providers, registerStubCall(UNWIND_EXCEPTION_TO_CALLER, SAFEPOINT, REEXECUTABLE_ONLY_AFTER_EXCEPTION, any())));
         link(new VerifyOopStub(options, providers, registerStubCall(VERIFY_OOP, LEAF_NOFP, REEXECUTABLE, NO_LOCATIONS)));
@@ -305,11 +314,8 @@
         linkForeignCall(options, providers, REGISTER_FINALIZER, c.registerFinalizerAddress, PREPEND_THREAD, SAFEPOINT, REEXECUTABLE_ONLY_AFTER_EXCEPTION, any());
         linkForeignCall(options, providers, MONITORENTER, c.monitorenterAddress, PREPEND_THREAD, SAFEPOINT, REEXECUTABLE_ONLY_AFTER_EXCEPTION, any());
         linkForeignCall(options, providers, MONITOREXIT, c.monitorexitAddress, PREPEND_THREAD, STACK_INSPECTABLE_LEAF, REEXECUTABLE_ONLY_AFTER_EXCEPTION, any());
-        linkForeignCall(options, providers, NEW_MULTI_ARRAY, c.newMultiArrayAddress, PREPEND_THREAD, SAFEPOINT, REEXECUTABLE, TLAB_TOP_LOCATION, TLAB_END_LOCATION);
         linkForeignCall(options, providers, NOTIFY, c.notifyAddress, PREPEND_THREAD, SAFEPOINT, REEXECUTABLE_ONLY_AFTER_EXCEPTION, any());
         linkForeignCall(options, providers, NOTIFY_ALL, c.notifyAllAddress, PREPEND_THREAD, SAFEPOINT, REEXECUTABLE_ONLY_AFTER_EXCEPTION, any());
-        linkForeignCall(options, providers, DYNAMIC_NEW_ARRAY, c.dynamicNewArrayAddress, PREPEND_THREAD, SAFEPOINT, REEXECUTABLE);
-        linkForeignCall(options, providers, DYNAMIC_NEW_INSTANCE, c.dynamicNewInstanceAddress, PREPEND_THREAD, SAFEPOINT, REEXECUTABLE);
         linkForeignCall(options, providers, LOG_PRINTF, c.logPrintfAddress, PREPEND_THREAD, LEAF, REEXECUTABLE, NO_LOCATIONS);
         linkForeignCall(options, providers, LOG_OBJECT, c.logObjectAddress, PREPEND_THREAD, LEAF, REEXECUTABLE, NO_LOCATIONS);
         linkForeignCall(options, providers, LOG_PRIMITIVE, c.logPrimitiveAddress, PREPEND_THREAD, LEAF, REEXECUTABLE, NO_LOCATIONS);
--- a/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.hotspot/src/org/graalvm/compiler/hotspot/replacements/NewObjectSnippets.java	Fri Oct 05 17:01:07 2018 -0400
+++ b/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.hotspot/src/org/graalvm/compiler/hotspot/replacements/NewObjectSnippets.java	Tue Oct 09 14:37:59 2018 +0200
@@ -24,9 +24,17 @@
 
 package org.graalvm.compiler.hotspot.replacements;
 
+import static jdk.vm.ci.meta.DeoptimizationAction.None;
+import static jdk.vm.ci.meta.DeoptimizationReason.RuntimeConstraint;
 import static org.graalvm.compiler.core.common.GraalOptions.GeneratePIC;
 import static org.graalvm.compiler.core.common.calc.UnsignedMath.belowThan;
-import static org.graalvm.compiler.hotspot.GraalHotSpotVMConfig.INJECTED_VMCONFIG;
+import static org.graalvm.compiler.hotspot.GraalHotSpotVMConfigBase.INJECTED_VMCONFIG;
+import static org.graalvm.compiler.hotspot.HotSpotBackend.NEW_ARRAY;
+import static org.graalvm.compiler.hotspot.HotSpotBackend.NEW_ARRAY_OR_NULL;
+import static org.graalvm.compiler.hotspot.HotSpotBackend.NEW_INSTANCE;
+import static org.graalvm.compiler.hotspot.HotSpotBackend.NEW_INSTANCE_OR_NULL;
+import static org.graalvm.compiler.hotspot.HotSpotBackend.NEW_MULTI_ARRAY;
+import static org.graalvm.compiler.hotspot.HotSpotBackend.NEW_MULTI_ARRAY_OR_NULL;
 import static org.graalvm.compiler.hotspot.replacements.HotSpotReplacementsUtil.CLASS_ARRAY_KLASS_LOCATION;
 import static org.graalvm.compiler.hotspot.replacements.HotSpotReplacementsUtil.HUB_WRITE_LOCATION;
 import static org.graalvm.compiler.hotspot.replacements.HotSpotReplacementsUtil.MARK_WORD_LOCATION;
@@ -70,6 +78,7 @@
 import static org.graalvm.compiler.replacements.nodes.ExplodeLoopNode.explodeLoop;
 
 import org.graalvm.compiler.api.replacements.Fold;
+import org.graalvm.compiler.api.replacements.Fold.InjectedParameter;
 import org.graalvm.compiler.api.replacements.Snippet;
 import org.graalvm.compiler.api.replacements.Snippet.ConstantParameter;
 import org.graalvm.compiler.api.replacements.Snippet.VarargsParameter;
@@ -80,7 +89,6 @@
 import org.graalvm.compiler.graph.Node.ConstantNodeParameter;
 import org.graalvm.compiler.graph.Node.NodeIntrinsic;
 import org.graalvm.compiler.hotspot.GraalHotSpotVMConfig;
-import org.graalvm.compiler.hotspot.HotSpotBackend;
 import org.graalvm.compiler.hotspot.meta.HotSpotProviders;
 import org.graalvm.compiler.hotspot.meta.HotSpotRegistersProvider;
 import org.graalvm.compiler.hotspot.nodes.DimensionsNode;
@@ -126,8 +134,6 @@
 import jdk.vm.ci.code.Register;
 import jdk.vm.ci.code.TargetDescription;
 import jdk.vm.ci.hotspot.HotSpotResolvedObjectType;
-import jdk.vm.ci.meta.DeoptimizationAction;
-import jdk.vm.ci.meta.DeoptimizationReason;
 import jdk.vm.ci.meta.JavaKind;
 import jdk.vm.ci.meta.ResolvedJavaType;
 
@@ -220,14 +226,25 @@
             if (counters != null && counters.stub != null) {
                 counters.stub.inc();
             }
-            result = newInstance(HotSpotBackend.NEW_INSTANCE, hub);
+            result = newInstanceStub(hub);
         }
         profileAllocation("instance", size, typeContext, options);
         return verifyOop(result);
     }
 
+    public static Object newInstanceStub(KlassPointer hub) {
+        if (useNullAllocationStubs(INJECTED_VMCONFIG)) {
+            return nonNullOrDeopt(newInstanceOrNull(NEW_INSTANCE_OR_NULL, hub));
+        } else {
+            return newInstance(NEW_INSTANCE, hub);
+        }
+    }
+
     @NodeIntrinsic(value = ForeignCallNode.class, injectedStampIsNonNull = true)
-    public static native Object newInstance(@ConstantNodeParameter ForeignCallDescriptor descriptor, KlassPointer hub);
+    private static native Object newInstance(@ConstantNodeParameter ForeignCallDescriptor descriptor, KlassPointer hub);
+
+    @NodeIntrinsic(value = ForeignCallNode.class, injectedStampIsNonNull = false)
+    private static native Object newInstanceOrNull(@ConstantNodeParameter ForeignCallDescriptor descriptor, KlassPointer hub);
 
     @Snippet
     public static Object allocateInstancePIC(@ConstantParameter int size, KlassPointer hub, Word prototypeMarkWord, @ConstantParameter boolean fillContents,
@@ -244,18 +261,18 @@
     public static Object allocateInstanceDynamic(Class<?> type, Class<?> classClass, @ConstantParameter boolean fillContents, @ConstantParameter Register threadRegister,
                     @ConstantParameter OptionValues options, @ConstantParameter Counters counters) {
         if (probability(SLOW_PATH_PROBABILITY, type == null)) {
-            DeoptimizeNode.deopt(DeoptimizationAction.None, DeoptimizationReason.RuntimeConstraint);
+            DeoptimizeNode.deopt(None, RuntimeConstraint);
         }
         Class<?> nonNullType = PiNode.piCastNonNullClass(type, SnippetAnchorNode.anchor());
 
         if (probability(SLOW_PATH_PROBABILITY, DynamicNewInstanceNode.throwsInstantiationException(type, classClass))) {
-            DeoptimizeNode.deopt(DeoptimizationAction.None, DeoptimizationReason.RuntimeConstraint);
+            DeoptimizeNode.deopt(None, RuntimeConstraint);
         }
 
-        return PiNode.piCastToSnippetReplaceeStamp(allocateInstanceDynamicHelper(type, fillContents, threadRegister, options, counters, nonNullType));
+        return PiNode.piCastToSnippetReplaceeStamp(allocateInstanceDynamicHelper(fillContents, threadRegister, options, counters, nonNullType));
     }
 
-    private static Object allocateInstanceDynamicHelper(Class<?> type, boolean fillContents, Register threadRegister, OptionValues options, Counters counters, Class<?> nonNullType) {
+    private static Object allocateInstanceDynamicHelper(boolean fillContents, Register threadRegister, OptionValues options, Counters counters, Class<?> nonNullType) {
         KlassPointer hub = ClassGetHubNode.readClass(nonNullType);
         if (probability(FAST_PATH_PROBABILITY, !hub.isNull())) {
             KlassPointer nonNullHub = ClassGetHubNode.piCastNonNull(hub, SnippetAnchorNode.anchor());
@@ -277,10 +294,11 @@
                     return allocateInstanceHelper(layoutHelper, nonNullHub, prototypeMarkWord, fillContents, threadRegister, false, "", options, counters);
                 }
             } else {
-                DeoptimizeNode.deopt(DeoptimizationAction.None, DeoptimizationReason.RuntimeConstraint);
+                DeoptimizeNode.deopt(None, RuntimeConstraint);
             }
         }
-        return dynamicNewInstanceStub(type);
+        DeoptimizeNode.deopt(None, RuntimeConstraint);
+        return null;
     }
 
     /**
@@ -307,13 +325,30 @@
     }
 
     @Snippet
-    public static Object allocateArray(KlassPointer hub, int length, Word prototypeMarkWord, @ConstantParameter int headerSize, @ConstantParameter int log2ElementSize,
-                    @ConstantParameter boolean fillContents, @ConstantParameter Register threadRegister, @ConstantParameter boolean maybeUnroll, @ConstantParameter String typeContext,
-                    @ConstantParameter OptionValues options, @ConstantParameter Counters counters) {
+    public static Object allocateArray(KlassPointer hub,
+                    int length,
+                    Word prototypeMarkWord,
+                    @ConstantParameter int headerSize,
+                    @ConstantParameter int log2ElementSize,
+                    @ConstantParameter boolean fillContents,
+                    @ConstantParameter Register threadRegister,
+                    @ConstantParameter boolean maybeUnroll,
+                    @ConstantParameter String typeContext,
+                    @ConstantParameter OptionValues options,
+                    @ConstantParameter Counters counters) {
         Object result = allocateArrayImpl(hub, length, prototypeMarkWord, headerSize, log2ElementSize, fillContents, threadRegister, maybeUnroll, typeContext, false, options, counters);
         return piArrayCastToSnippetReplaceeStamp(verifyOop(result), length);
     }
 
+    /**
+     * When allocating on the slow path, determines whether to use a version of the runtime call
+     * that returns {@code null} on a failed allocation instead of raising an OutOfMemoryError.
+     */
+    @Fold
+    static boolean useNullAllocationStubs(@InjectedParameter GraalHotSpotVMConfig config) {
+        return config.areNullAllocationStubsAvailable();
+    }
+
     private static Object allocateArrayImpl(KlassPointer hub, int length, Word prototypeMarkWord, int headerSize, int log2ElementSize, boolean fillContents, Register threadRegister,
                     boolean maybeUnroll, String typeContext, boolean skipNegativeCheck, OptionValues options, Counters counters) {
         Object result;
@@ -331,27 +366,41 @@
             }
             result = formatArray(hub, allocationSize, length, headerSize, top, prototypeMarkWord, fillContents, maybeUnroll, counters);
         } else {
-            result = newArray(HotSpotBackend.NEW_ARRAY, hub, length);
+            result = newArrayStub(hub, length);
         }
         profileAllocation("array", allocationSize, typeContext, options);
         return result;
     }
 
-    @NodeIntrinsic(value = ForeignCallNode.class, injectedStampIsNonNull = true)
-    public static native Object newArray(@ConstantNodeParameter ForeignCallDescriptor descriptor, KlassPointer hub, int length);
-
-    public static final ForeignCallDescriptor DYNAMIC_NEW_ARRAY = new ForeignCallDescriptor("dynamic_new_array", Object.class, Class.class, int.class);
-    public static final ForeignCallDescriptor DYNAMIC_NEW_INSTANCE = new ForeignCallDescriptor("dynamic_new_instance", Object.class, Class.class);
-
-    @NodeIntrinsic(value = ForeignCallNode.class, injectedStampIsNonNull = true)
-    public static native Object dynamicNewArrayStub(@ConstantNodeParameter ForeignCallDescriptor descriptor, Class<?> elementType, int length);
-
-    public static Object dynamicNewInstanceStub(Class<?> elementType) {
-        return dynamicNewInstanceStubCall(DYNAMIC_NEW_INSTANCE, elementType);
+    public static Object newArrayStub(KlassPointer hub, int length) {
+        if (useNullAllocationStubs(INJECTED_VMCONFIG)) {
+            return nonNullOrDeopt(newArrayOrNull(NEW_ARRAY_OR_NULL, hub, length));
+        } else {
+            return newArray(NEW_ARRAY, hub, length);
+        }
     }
 
     @NodeIntrinsic(value = ForeignCallNode.class, injectedStampIsNonNull = true)
-    public static native Object dynamicNewInstanceStubCall(@ConstantNodeParameter ForeignCallDescriptor descriptor, Class<?> elementType);
+    private static native Object newArray(@ConstantNodeParameter ForeignCallDescriptor descriptor, KlassPointer hub, int length);
+
+    @NodeIntrinsic(value = ForeignCallNode.class, injectedStampIsNonNull = false)
+    private static native Object newArrayOrNull(@ConstantNodeParameter ForeignCallDescriptor descriptor, KlassPointer hub, int length);
+
+    /**
+     * Deoptimizes if {@code obj == null} otherwise returns {@code obj}.
+     */
+    private static Object nonNullOrDeopt(Object obj) {
+        if (obj == null) {
+            DeoptimizeNode.deopt(None, RuntimeConstraint);
+        }
+        return obj;
+    }
+
+    @NodeIntrinsic(value = ForeignCallNode.class, injectedStampIsNonNull = true)
+    public static native Object dynamicNewInstance(@ConstantNodeParameter ForeignCallDescriptor descriptor, Class<?> elementType);
+
+    @NodeIntrinsic(value = ForeignCallNode.class, injectedStampIsNonNull = false)
+    public static native Object dynamicNewInstanceOrNull(@ConstantNodeParameter ForeignCallDescriptor descriptor, Class<?> elementType);
 
     @Snippet
     public static Object allocateArrayDynamic(Class<?> elementType, Class<?> voidClass, int length, @ConstantParameter boolean fillContents, @ConstantParameter Register threadRegister,
@@ -369,17 +418,17 @@
          */
         staticAssert(knownElementKind != JavaKind.Void, "unsupported knownElementKind");
         if (knownElementKind == JavaKind.Illegal && probability(SLOW_PATH_PROBABILITY, elementType == null || DynamicNewArrayNode.throwsIllegalArgumentException(elementType, voidClass))) {
-            DeoptimizeNode.deopt(DeoptimizationAction.None, DeoptimizationReason.RuntimeConstraint);
+            DeoptimizeNode.deopt(None, RuntimeConstraint);
         }
 
         KlassPointer klass = loadKlassFromObject(elementType, arrayKlassOffset(INJECTED_VMCONFIG), CLASS_ARRAY_KLASS_LOCATION);
         if (klass.isNull()) {
-            DeoptimizeNode.deopt(DeoptimizationAction.None, DeoptimizationReason.RuntimeConstraint);
+            DeoptimizeNode.deopt(None, RuntimeConstraint);
         }
         KlassPointer nonNullKlass = ClassGetHubNode.piCastNonNull(klass, SnippetAnchorNode.anchor());
 
         if (length < 0) {
-            DeoptimizeNode.deopt(DeoptimizationAction.None, DeoptimizationReason.RuntimeConstraint);
+            DeoptimizeNode.deopt(None, RuntimeConstraint);
         }
         int layoutHelper;
         if (knownElementKind == JavaKind.Illegal) {
@@ -412,24 +461,35 @@
      * Calls the runtime stub for implementing MULTIANEWARRAY.
      */
     @Snippet
-    public static Object newmultiarray(KlassPointer hub, @ConstantParameter int rank, @VarargsParameter int[] dimensions) {
+    private static Object newmultiarray(KlassPointer hub, @ConstantParameter int rank, @VarargsParameter int[] dimensions) {
         Word dims = DimensionsNode.allocaDimsArray(rank);
         ExplodeLoopNode.explodeLoop();
         for (int i = 0; i < rank; i++) {
             dims.writeInt(i * 4, dimensions[i], LocationIdentity.init());
         }
-        return newArrayCall(HotSpotBackend.NEW_MULTI_ARRAY, hub, rank, dims);
+        return newMultiArrayStub(hub, rank, dims);
+    }
+
+    private static Object newMultiArrayStub(KlassPointer hub, int rank, Word dims) {
+        if (useNullAllocationStubs(INJECTED_VMCONFIG)) {
+            return nonNullOrDeopt(newMultiArrayOrNull(NEW_MULTI_ARRAY_OR_NULL, hub, rank, dims));
+        } else {
+            return newMultiArray(NEW_MULTI_ARRAY, hub, rank, dims);
+        }
     }
 
     @Snippet
-    public static Object newmultiarrayPIC(KlassPointer hub, @ConstantParameter int rank, @VarargsParameter int[] dimensions) {
+    private static Object newmultiarrayPIC(KlassPointer hub, @ConstantParameter int rank, @VarargsParameter int[] dimensions) {
         // Array type would be resolved by dominating resolution.
         KlassPointer picHub = LoadConstantIndirectlyFixedNode.loadKlass(hub);
         return newmultiarray(picHub, rank, dimensions);
     }
 
     @NodeIntrinsic(value = ForeignCallNode.class, injectedStampIsNonNull = true)
-    public static native Object newArrayCall(@ConstantNodeParameter ForeignCallDescriptor descriptor, KlassPointer hub, int rank, Word dims);
+    private static native Object newMultiArray(@ConstantNodeParameter ForeignCallDescriptor descriptor, KlassPointer hub, int rank, Word dims);
+
+    @NodeIntrinsic(value = ForeignCallNode.class, injectedStampIsNonNull = false)
+    private static native Object newMultiArrayOrNull(@ConstantNodeParameter ForeignCallDescriptor descriptor, KlassPointer hub, int rank, Word dims);
 
     /**
      * Maximum number of long stores to emit when zeroing an object with a constant size. Larger
@@ -509,17 +569,9 @@
     }
 
     /**
-     * Formats some allocated memory with an object header and zeroes out the rest. Disables asserts
-     * since they can't be compiled in stubs.
-     */
-    public static Object formatObjectForStub(KlassPointer hub, int size, Word memory, Word compileTimePrototypeMarkWord) {
-        return formatObject(hub, size, memory, compileTimePrototypeMarkWord, true, false, null);
-    }
-
-    /**
      * Formats some allocated memory with an object header and zeroes out the rest.
      */
-    protected static Object formatObject(KlassPointer hub, int size, Word memory, Word compileTimePrototypeMarkWord, boolean fillContents, boolean constantSize, Counters counters) {
+    private static Object formatObject(KlassPointer hub, int size, Word memory, Word compileTimePrototypeMarkWord, boolean fillContents, boolean constantSize, Counters counters) {
         Word prototypeMarkWord = useBiasedLocking(INJECTED_VMCONFIG) ? hub.readWord(prototypeMarkWordOffset(INJECTED_VMCONFIG), PROTOTYPE_MARK_WORD_LOCATION) : compileTimePrototypeMarkWord;
         initializeObjectHeader(memory, prototypeMarkWord, hub);
         if (fillContents) {
@@ -532,7 +584,7 @@
     }
 
     @Snippet
-    protected static void verifyHeap(@ConstantParameter Register threadRegister) {
+    private static void verifyHeap(@ConstantParameter Register threadRegister) {
         Word thread = registerAsWord(threadRegister);
         Word topValue = readTlabTop(thread);
         if (!topValue.equal(WordFactory.zero())) {
@@ -546,7 +598,7 @@
     /**
      * Formats some allocated memory with an object header and zeroes out the rest.
      */
-    public static Object formatArray(KlassPointer hub, int allocationSize, int length, int headerSize, Word memory, Word prototypeMarkWord, boolean fillContents, boolean maybeUnroll,
+    private static Object formatArray(KlassPointer hub, int allocationSize, int length, int headerSize, Word memory, Word prototypeMarkWord, boolean fillContents, boolean maybeUnroll,
                     Counters counters) {
         memory.writeInt(arrayLengthOffset(INJECTED_VMCONFIG), length, LocationIdentity.init());
         /*
--- a/src/jdk.javadoc/share/classes/jdk/javadoc/internal/tool/JavadocTool.java	Fri Oct 05 17:01:07 2018 -0400
+++ b/src/jdk.javadoc/share/classes/jdk/javadoc/internal/tool/JavadocTool.java	Tue Oct 09 14:37:59 2018 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2001, 2017, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2001, 2018, 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
@@ -34,6 +34,8 @@
 import java.util.Map;
 import java.util.Set;
 
+import javax.lang.model.element.Element;
+import javax.lang.model.element.ElementKind;
 import javax.tools.JavaFileObject;
 import javax.tools.StandardJavaFileManager;
 
@@ -41,6 +43,7 @@
 import com.sun.tools.javac.code.DeferredCompletionFailureHandler;
 import com.sun.tools.javac.code.Symbol.Completer;
 import com.sun.tools.javac.code.Symbol.CompletionFailure;
+import com.sun.tools.javac.code.Symbol.PackageSymbol;
 import com.sun.tools.javac.comp.Enter;
 import com.sun.tools.javac.tree.JCTree;
 import com.sun.tools.javac.tree.JCTree.JCClassDecl;
@@ -213,6 +216,17 @@
 
             dcfh.setHandler(dcfh.userCodeHandler);
             etable.analyze();
+
+            // Ensure that package-info is read for all included packages
+            for (Element e : etable.getIncludedElements()) {
+                if (e.getKind() == ElementKind.PACKAGE) {
+                    PackageSymbol packge = (PackageSymbol) e;
+                    if (packge.package_info != null) {
+                        packge.package_info.complete();
+                    }
+                }
+            }
+
         } catch (CompletionFailure cf) {
             throw new ToolException(ABNORMAL, cf.getMessage(), cf);
         } catch (Abort abort) {
--- a/src/jdk.pack/share/native/common-unpack/constants.h	Fri Oct 05 17:01:07 2018 -0400
+++ b/src/jdk.pack/share/native/common-unpack/constants.h	Tue Oct 09 14:37:59 2018 +0200
@@ -203,7 +203,7 @@
     AO_HAVE_FIELD_FLAGS_HI    = 1<<10,
     AO_HAVE_METHOD_FLAGS_HI   = 1<<11,
     AO_HAVE_CODE_FLAGS_HI     = 1<<12,
-    AO_UNUSED_MBZ             = (-1)<<13, // options bits reserved for future use.
+    AO_UNUSED_MBZ             = (int)((~0U)<<13), // options bits reserved for future use.
 
 #define ARCHIVE_BIT_DO(F) \
          F(AO_HAVE_SPECIAL_FORMATS) \
--- a/test/TestCommon.gmk	Fri Oct 05 17:01:07 2018 -0400
+++ b/test/TestCommon.gmk	Tue Oct 09 14:37:59 2018 +0200
@@ -178,20 +178,6 @@
   endif
 endif
 
-
-# Optionally create a CDS archive before running tests
-ifeq ($(GENERATE_CDS_ARCHIVE), true)
-  CDS_ARCHIVE_FILE := $(ABS_TEST_OUTPUT_DIR)/cds_archive.jsa
-
-  $(CDS_ARCHIVE_FILE): $(PRODUCT_HOME)
-	$(PRODUCT_HOME)/bin/java -XX:+UnlockDiagnosticVMOptions \
-	    -XX:SharedArchiveFile=$(shell $(GETMIXEDPATH) "$(CDS_ARCHIVE_FILE)") -Xshare:dump
-
-  CDS_VM_ARGS := -XX:+UnlockDiagnosticVMOptions -XX:SharedArchiveFile=$(shell $(GETMIXEDPATH) "$(CDS_ARCHIVE_FILE)")
-  JTREG_TEST_OPTIONS += $(addprefix -vmoption:, $(CDS_VM_ARGS))
-  TEST_PREREQS += $(CDS_ARCHIVE_FILE)
-endif
-
 # How to create the test bundle (pass or fail, we want to create this)
 #   Follow command with ";$(BUNDLE_UP_AND_EXIT)", so it always gets executed.
 ifneq ($(ARCHIVE_BUNDLE), )
--- a/test/hotspot/jtreg/ProblemList-cds-mode.txt	Fri Oct 05 17:01:07 2018 -0400
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,29 +0,0 @@
-#
-# Copyright (c) 2018, 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.
-#
-
-#############################################################################
-#
-# Additional list of quarantined tests when CDS mode enabled.
-#
-#############################################################################
-
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/hotspot/jtreg/ProblemList-non-cds-mode.txt	Tue Oct 09 14:37:59 2018 +0200
@@ -0,0 +1,29 @@
+#
+# Copyright (c) 2018, 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.
+#
+
+#############################################################################
+#
+# Additional list of quarantined tests when non-CDS mode enabled.
+#
+#############################################################################
+
--- a/test/hotspot/jtreg/ProblemList.txt	Fri Oct 05 17:01:07 2018 -0400
+++ b/test/hotspot/jtreg/ProblemList.txt	Tue Oct 09 14:37:59 2018 +0200
@@ -84,7 +84,6 @@
 runtime/CompressedOops/UseCompressedOops.java 8079353 generic-all
 runtime/RedefineTests/RedefineRunningMethods.java 8208778 macosx-x64
 runtime/SharedArchiveFile/SASymbolTableTest.java 8193639 solaris-all
-runtime/XCheckJniJsig/XCheckJSig.java 8211084 macosx-x64
 
 #############################################################################
 
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/hotspot/jtreg/gc/logging/TestMetaSpaceLog.java	Tue Oct 09 14:37:59 2018 +0200
@@ -0,0 +1,143 @@
+/*
+ * Copyright (c) 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2018, Google 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.
+ */
+
+import java.io.File;
+import java.net.URL;
+import java.net.URLClassLoader;
+import java.util.List;
+import java.util.function.Predicate;
+import java.util.regex.Pattern;
+import java.util.regex.Matcher;
+
+import jdk.test.lib.Asserts;
+import jdk.test.lib.process.OutputAnalyzer;
+import jdk.test.lib.process.ProcessTools;
+import sun.hotspot.WhiteBox;
+
+/*
+ * @test TestMetaSpaceLog
+ * @bug 8211123
+ * @summary Ensure that the Metaspace is updated in the log
+ * @requires vm.gc=="null"
+ * @key gc
+ * @library /test/lib
+ * @modules java.base/jdk.internal.misc
+ *          java.management
+ *
+ * @compile TestMetaSpaceLog.java
+ * @run driver ClassFileInstaller sun.hotspot.WhiteBox
+ * @run main TestMetaSpaceLog
+ */
+
+public class TestMetaSpaceLog {
+  private static Pattern metaSpaceRegexp;
+
+  static {
+    // Do this once here.
+    metaSpaceRegexp = Pattern.compile(".*Metaspace: ([0-9]+).*->([0-9]+).*");
+  }
+
+  public static void main(String[] args) throws Exception {
+    testMetaSpaceUpdate("UseParallelGC");
+    testMetaSpaceUpdate("UseG1GC");
+    testMetaSpaceUpdate("UseConcMarkSweepGC");
+    testMetaSpaceUpdate("UseSerialGC");
+  }
+
+  private static void verifyContainsMetaSpaceUpdate(OutputAnalyzer output) {
+    Predicate<String> collectedMetaSpace = line -> check(line);
+
+    // At least one metaspace line from GC should show GC being collected.
+    boolean foundCollectedMetaSpace = output.asLines().stream()
+        .filter(s -> s.contains("[gc,metaspace"))
+        .anyMatch(TestMetaSpaceLog::check);
+    Asserts.assertTrue(foundCollectedMetaSpace);
+  }
+
+  private static boolean check(String line) {
+    Matcher m = metaSpaceRegexp.matcher(line);
+    Asserts.assertTrue(m.matches(), "Unexpected line for metaspace logging: " + line);
+    long before = Long.parseLong(m.group(1));
+    long after  = Long.parseLong(m.group(2));
+    return before > after;
+  }
+
+  private static void testMetaSpaceUpdate(String gcFlag) throws Exception {
+    // Propagate test.src for the jar file.
+    String testSrc= "-Dtest.src=" + System.getProperty("test.src", ".");
+
+    System.err.println("Testing with GC Flag: " + gcFlag);
+    ProcessBuilder pb =
+      ProcessTools.createJavaProcessBuilder(
+          "-XX:+" + gcFlag,
+          "-Xlog:gc*",
+          "-Xbootclasspath/a:.",
+          "-XX:+UnlockDiagnosticVMOptions",
+          "-XX:+WhiteBoxAPI",
+          "-Xmx1000M",
+          "-Xms1000M",
+          testSrc, StressMetaSpace.class.getName());
+
+    OutputAnalyzer output = null;
+    try {
+      output = new OutputAnalyzer(pb.start());
+      verifyContainsMetaSpaceUpdate(output);
+    } catch (Exception e) {
+      // For error diagnosis: print and throw.
+      e.printStackTrace();
+      output.reportDiagnosticSummary();
+      throw e;
+    }
+  }
+
+  static class StressMetaSpace {
+    private static URL[] urls = new URL[1];
+
+    static {
+      try {
+        File jarFile = new File(System.getProperty("test.src") + "/testcases.jar");
+        urls[0] = jarFile.toURI().toURL();
+      } catch (Exception e) {
+        e.printStackTrace();
+      }
+    }
+
+    public static void main(String args[]) {
+      WhiteBox wb = WhiteBox.getWhiteBox();
+      for(int i = 0; i < 10000; i++) {
+        loadClass(wb);
+      }
+      wb.fullGC();
+    }
+
+    public static void loadClass(WhiteBox wb) {
+      try {
+        URLClassLoader ucl = new URLClassLoader(urls);
+        Class.forName("case00", false, ucl);
+      } catch (Exception e) {
+        e.printStackTrace();
+      }
+    }
+  }
+}
Binary file test/hotspot/jtreg/gc/logging/testcases.jar has changed
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/hotspot/jtreg/runtime/SharedArchiveFile/CheckDefaultArchiveFile.java	Tue Oct 09 14:37:59 2018 +0200
@@ -0,0 +1,63 @@
+/*
+ * Copyright (c) 2018, 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.
+ */
+
+/**
+ * @test Default CDS archive file
+ * @summary JDK platforms/binaries do not support default CDS archive should
+ *          not contain classes.jsa in the default location.
+ * @library /test/lib
+ * @modules java.base/jdk.internal.misc
+ *          java.management
+ * @build sun.hotspot.WhiteBox
+ * @run driver ClassFileInstaller sun.hotspot.WhiteBox
+ * @run main/othervm -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions
+ *      -XX:+WhiteBoxAPI CheckDefaultArchiveFile
+ */
+import java.nio.file.Files;
+import java.nio.file.Path;
+import java.nio.file.Paths;
+import jdk.test.lib.Platform;
+import jdk.test.lib.cds.CDSTestUtils;
+import jtreg.SkippedException;
+import sun.hotspot.WhiteBox;
+
+public class CheckDefaultArchiveFile {
+    public static void main(String[] args) throws Exception {
+        WhiteBox wb = WhiteBox.getWhiteBox();
+        String osArch = Platform.getOsArch();
+        String vmName = System.getProperty("java.vm.name");
+        String vmString = vmName + "(" + osArch + ")";
+        String jsaString = wb.getDefaultArchivePath();
+        Path jsa = Paths.get(jsaString);
+        if (Platform.isDefaultCDSArchiveSupported()) {
+            if (Files.exists(jsa)) {
+                System.out.println("Passed. " + vmString +
+                                   ": has default classes.jsa file");
+            } else {
+                throw new RuntimeException(vmString + "has no " + jsaString);
+            }
+        } else {
+            throw new SkippedException("Default CDS archive is not supported");
+        }
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/hotspot/jtreg/runtime/SharedArchiveFile/CheckSharingWithDefaultArchive.java	Tue Oct 09 14:37:59 2018 +0200
@@ -0,0 +1,66 @@
+/*
+ * Copyright (c) 2018, 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.
+ */
+
+/**
+ * @test Default CDS archive
+ * @summary Sharing should be enabled by default on supported platform/binaries.
+ *          No -Xshare:dump is needed. No -Xshare:auto or -Xshare:on in needed.
+ *          Verify a set of well-known shared classes.
+ * @requires vm.cds
+ * @library /test/lib
+ * @modules java.base/jdk.internal.misc
+ *          java.management
+ * @build sun.hotspot.WhiteBox
+ * @run driver ClassFileInstaller sun.hotspot.WhiteBox
+ * @run main/othervm -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions
+ *      -XX:+WhiteBoxAPI CheckSharingWithDefaultArchive -showversion
+ */
+import jdk.test.lib.Platform;
+import jtreg.SkippedException;
+import sun.hotspot.WhiteBox;
+
+public class CheckSharingWithDefaultArchive {
+    public static void main(String[] args) throws Exception {
+        if (!Platform.isDefaultCDSArchiveSupported()) {
+            throw new SkippedException("Supported platform");
+        }
+
+        WhiteBox wb = WhiteBox.getWhiteBox();
+        String classes[] = {"java.lang.Object",
+                            "java.lang.String",
+                            "java.lang.Class"};
+        // If maping fails, sharing is disabled
+        if (wb.isSharingEnabled()) {
+            for (int i = 0; i < classes.length; i++) {
+                Class c = Class.forName(classes[i]);
+                if (wb.isSharedClass(c)) {
+                    System.out.println(classes[i] + " is shared.");
+                } else {
+                    throw new RuntimeException(classes[i] + " is not shared");
+                }
+            }
+        } else {
+           throw new SkippedException("Sharing is not enabled.");
+        }
+    }
+}
--- a/test/hotspot/jtreg/runtime/XCheckJniJsig/XCheckJSig.java	Fri Oct 05 17:01:07 2018 -0400
+++ b/test/hotspot/jtreg/runtime/XCheckJniJsig/XCheckJSig.java	Tue Oct 09 14:37:59 2018 +0200
@@ -44,29 +44,21 @@
         System.out.println("Regression test for bugs 7051189 and 8023393");
 
         String jdk_path = System.getProperty("test.jdk");
-        String os_arch = Platform.getOsArch();
         String libjsig;
         String env_var;
         if (Platform.isOSX()) {
             env_var = "DYLD_INSERT_LIBRARIES";
-            libjsig = jdk_path + "/jre/lib/libjsig.dylib"; // jdk location
-            if (!(new File(libjsig).exists())) {
-                libjsig = jdk_path + "/lib/libjsig.dylib"; // jre location
-            }
+            libjsig = jdk_path + "/lib/libjsig.dylib"; // jre location
         } else {
             env_var = "LD_PRELOAD";
-            libjsig = jdk_path + "/jre/lib/" + os_arch + "/libjsig.so"; // jdk location
-            if (!(new File(libjsig).exists())) {
-                libjsig = jdk_path + "/lib/" + os_arch + "/libjsig.so"; // jre location
-            }
+            libjsig = jdk_path + "/lib/libjsig.so"; // jre location
         }
         // If this test fails, these might be useful to know.
         System.out.println("libjsig: " + libjsig);
-        System.out.println("osArch: " + os_arch);
 
         // Make sure the libjsig file exists.
         if (!(new File(libjsig).exists())) {
-            throw new jtreg.SkippedException("File " + libjsig + " not found");
+            throw new RuntimeException("File libjsig not found, path: " + libjsig);
         }
 
         ProcessBuilder pb = ProcessTools.createJavaProcessBuilder("-Xcheck:jni", "-version");
--- a/test/hotspot/jtreg/runtime/appcds/CommandLineFlagCombo.java	Fri Oct 05 17:01:07 2018 -0400
+++ b/test/hotspot/jtreg/runtime/appcds/CommandLineFlagCombo.java	Tue Oct 09 14:37:59 2018 +0200
@@ -24,7 +24,10 @@
 
 /*
  * @test CommandLineFlagCombo
- * @requires vm.cds
+ * @requires vm.cds.archived.java.heap
+ * @comment This test explicitly chooses the type of GC to be used by sub-processes. It may conflict with the GC type set
+ * via the -vmoptions command line option of JTREG. vm.gc==null will help the test case to discard the explicitly passed
+ * vm options.
  * @requires (vm.gc=="null")
  * @summary Test command line flag combinations that
  *          could likely affect the behaviour of AppCDS
--- a/test/hotspot/jtreg/runtime/appcds/cacheObject/DifferentHeapSizes.java	Fri Oct 05 17:01:07 2018 -0400
+++ b/test/hotspot/jtreg/runtime/appcds/cacheObject/DifferentHeapSizes.java	Tue Oct 09 14:37:59 2018 +0200
@@ -26,7 +26,6 @@
  * @test
  * @summary Test automatic relocation of archive heap regions dur to heap size changes.
  * @requires vm.cds.archived.java.heap
- * @requires (vm.gc=="null")
  * @library /test/lib /test/hotspot/jtreg/runtime/appcds
  * @modules jdk.jartool/sun.tools.jar
  * @compile ../test-classes/Hello.java
--- a/test/hotspot/jtreg/runtime/appcds/cacheObject/OpenArchiveRegion.java	Fri Oct 05 17:01:07 2018 -0400
+++ b/test/hotspot/jtreg/runtime/appcds/cacheObject/OpenArchiveRegion.java	Tue Oct 09 14:37:59 2018 +0200
@@ -26,6 +26,9 @@
  * @test
  * @summary Test open archive heap regions
  * @requires vm.cds.archived.java.heap
+ * @comment This test explicitly chooses the type of GC to be used by sub-processes. It may conflict with the GC type set
+ * via the -vmoptions command line option of JTREG. vm.gc==null will help the test case to discard the explicitly passed
+ * vm options.
  * @requires (vm.gc=="null")
  * @library /test/lib /test/hotspot/jtreg/runtime/appcds
  * @modules java.base/jdk.internal.misc
--- a/test/hotspot/jtreg/runtime/appcds/sharedStrings/IncompatibleOptions.java	Fri Oct 05 17:01:07 2018 -0400
+++ b/test/hotspot/jtreg/runtime/appcds/sharedStrings/IncompatibleOptions.java	Tue Oct 09 14:37:59 2018 +0200
@@ -27,6 +27,9 @@
  * @summary Test options that are incompatible with use of shared strings
  *          Also test mismatch in oops encoding between dump time and run time
  * @requires vm.cds.archived.java.heap
+ * @comment This test explicitly chooses the type of GC to be used by sub-processes. It may conflict with the GC type set
+ * via the -vmoptions command line option of JTREG. vm.gc==null will help the test case to discard the explicitly passed
+ * vm options.
  * @requires (vm.gc=="null")
  * @library /test/lib /test/hotspot/jtreg/runtime/appcds
  * @modules jdk.jartool/sun.tools.jar
--- a/test/hotspot/jtreg/runtime/appcds/sharedStrings/IncompatibleOptions_noCompactStrings.java	Fri Oct 05 17:01:07 2018 -0400
+++ b/test/hotspot/jtreg/runtime/appcds/sharedStrings/IncompatibleOptions_noCompactStrings.java	Tue Oct 09 14:37:59 2018 +0200
@@ -27,6 +27,9 @@
  * @summary Test options that are incompatible with use of shared strings
  *          Also test mismatch in oops encoding between dump time and run time
  * @requires vm.cds.archived.java.heap
+ * @comment This test explicitly chooses the type of GC to be used by sub-processes. It may conflict with the GC type set
+ * via the -vmoptions command line option of JTREG. vm.gc==null will help the test case to discard the explicitly passed
+ * vm options.
  * @requires (vm.gc=="null")
  * @library /test/lib /test/hotspot/jtreg/runtime/appcds
  * @modules jdk.jartool/sun.tools.jar
--- a/test/hotspot/jtreg/runtime/appcds/sharedStrings/IncompatibleOptions_stringDedup.java	Fri Oct 05 17:01:07 2018 -0400
+++ b/test/hotspot/jtreg/runtime/appcds/sharedStrings/IncompatibleOptions_stringDedup.java	Tue Oct 09 14:37:59 2018 +0200
@@ -27,6 +27,9 @@
  * @summary Test options that are incompatible with use of shared strings
  *          Also test mismatch in oops encoding between dump time and run time
  * @requires vm.cds.archived.java.heap
+ * @comment This test explicitly chooses the type of GC to be used by sub-processes. It may conflict with the GC type set
+ * via the -vmoptions command line option of JTREG. vm.gc==null will help the test case to discard the explicitly passed
+ * vm options.
  * @requires (vm.gc=="null")
  * @library /test/lib /test/hotspot/jtreg/runtime/appcds
  * @modules jdk.jartool/sun.tools.jar
--- a/test/hotspot/jtreg/runtime/appcds/sharedStrings/SysDictCrash.java	Fri Oct 05 17:01:07 2018 -0400
+++ b/test/hotspot/jtreg/runtime/appcds/sharedStrings/SysDictCrash.java	Tue Oct 09 14:37:59 2018 +0200
@@ -26,8 +26,7 @@
  * @test
  * @summary Regression test for JDK-8098821
  * @bug 8098821
- * @requires vm.cds
- * @requires vm.gc.G1
+ * @requires vm.cds.archived.java.heap
  * @library /test/lib /test/hotspot/jtreg/runtime/appcds
  * @modules java.base/jdk.internal.misc
  * @modules java.management
--- a/test/hotspot/jtreg/testlibrary_tests/TestMutuallyExclusivePlatformPredicates.java	Fri Oct 05 17:01:07 2018 -0400
+++ b/test/hotspot/jtreg/testlibrary_tests/TestMutuallyExclusivePlatformPredicates.java	Tue Oct 09 14:37:59 2018 +0200
@@ -50,8 +50,9 @@
         OS("isAix", "isLinux", "isOSX", "isSolaris", "isWindows"),
         VM_TYPE("isClient", "isServer", "isGraal", "isMinimal", "isZero", "isEmbedded"),
         MODE("isInt", "isMixed", "isComp"),
-        IGNORED("isEmulatedClient", "isDebugBuild", "isFastDebugBuild", "isSlowDebugBuild",
-                "hasSA", "shouldSAAttach", "isTieredSupported", "areCustomLoadersSupportedForCDS");
+        IGNORED("isEmulatedClient", "isDebugBuild", "isFastDebugBuild",
+                "isSlowDebugBuild", "hasSA", "shouldSAAttach", "isTieredSupported",
+                "areCustomLoadersSupportedForCDS", "isDefaultCDSArchiveSupported");
 
         public final List<String> methodNames;
 
--- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/AddCapabilities/addcaps001/addcaps001.cpp	Fri Oct 05 17:01:07 2018 -0400
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/AddCapabilities/addcaps001/addcaps001.cpp	Tue Oct 09 14:37:59 2018 +0200
@@ -192,8 +192,7 @@
     memset(&caps, 0, sizeof(jvmtiCapabilities));
 
     NSK_DISPLAY0("GetCapabilities() for current JVMTI env\n");
-    if (!NSK_JVMTI_VERIFY(
-            NSK_CPP_STUB2(GetCapabilities, jvmti, &caps))) {
+    if (!NSK_JVMTI_VERIFY(jvmti->GetCapabilities(&caps))) {
         return NSK_FALSE;
     }
 
@@ -216,8 +215,7 @@
  */
 static int addCapabilities(jvmtiEnv* jvmti, jvmtiCapabilities* caps, const char where[]) {
     NSK_DISPLAY0("AddCapabilities() for current JVMTI env\n");
-    if (!NSK_JVMTI_VERIFY(
-            NSK_CPP_STUB2(AddCapabilities, jvmti, caps))) {
+    if (!NSK_JVMTI_VERIFY(jvmti->AddCapabilities(caps))) {
         return NSK_FALSE;
     }
     NSK_DISPLAY0("  ... set\n");
@@ -314,9 +312,7 @@
         memset(&eventCallbacks, 0, sizeof(eventCallbacks));
         eventCallbacks.VMInit = callbackVMInit;
         eventCallbacks.VMDeath = callbackVMDeath;
-        if (!NSK_JVMTI_VERIFY(
-                NSK_CPP_STUB3(SetEventCallbacks, jvmti,
-                                    &eventCallbacks, sizeof(eventCallbacks)))) {
+        if (!NSK_JVMTI_VERIFY(jvmti->SetEventCallbacks(&eventCallbacks, sizeof(eventCallbacks)))) {
             return JNI_ERR;
         }
 
--- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/AddCapabilities/addcaps002/addcaps002.cpp	Fri Oct 05 17:01:07 2018 -0400
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/AddCapabilities/addcaps002/addcaps002.cpp	Tue Oct 09 14:37:59 2018 +0200
@@ -192,8 +192,7 @@
     memset(&caps, 0, sizeof(jvmtiCapabilities));
 
     NSK_DISPLAY0("GetCapabilities() for current JVMTI env\n");
-    if (!NSK_JVMTI_VERIFY(
-            NSK_CPP_STUB2(GetCapabilities, jvmti, &caps))) {
+    if (!NSK_JVMTI_VERIFY(jvmti->GetCapabilities(&caps))) {
         return NSK_FALSE;
     }
 
@@ -216,8 +215,7 @@
  */
 static int addCapabilities(jvmtiEnv* jvmti, jvmtiCapabilities* caps, const char where[]) {
     NSK_DISPLAY0("AddCapabilities() for current JVMTI env\n");
-    if (!NSK_JVMTI_VERIFY(
-            NSK_CPP_STUB2(AddCapabilities, jvmti, caps))) {
+    if (!NSK_JVMTI_VERIFY(jvmti->AddCapabilities(caps))) {
         return NSK_FALSE;
     }
     NSK_DISPLAY0("  ... set\n");
@@ -231,8 +229,7 @@
  */
 static int getPotentialCapabilities(jvmtiEnv* jvmti, jvmtiCapabilities* caps) {
     NSK_DISPLAY0("GetPotentialCapabilities() for current JVMTI env\n");
-    if (!NSK_JVMTI_VERIFY(
-            NSK_CPP_STUB2(GetPotentialCapabilities, jvmti, caps))) {
+    if (!NSK_JVMTI_VERIFY(jvmti->GetPotentialCapabilities(caps))) {
         return NSK_FALSE;
     }
 
@@ -334,9 +331,7 @@
         memset(&eventCallbacks, 0, sizeof(eventCallbacks));
         eventCallbacks.VMInit = callbackVMInit;
         eventCallbacks.VMDeath = callbackVMDeath;
-        if (!NSK_JVMTI_VERIFY(
-                NSK_CPP_STUB3(SetEventCallbacks, jvmti,
-                                    &eventCallbacks, sizeof(eventCallbacks)))) {
+        if (!NSK_JVMTI_VERIFY(jvmti->SetEventCallbacks(&eventCallbacks, sizeof(eventCallbacks)))) {
             return JNI_ERR;
         }
 
--- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/AddCapabilities/addcaps003/addcaps003.cpp	Fri Oct 05 17:01:07 2018 -0400
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/AddCapabilities/addcaps003/addcaps003.cpp	Tue Oct 09 14:37:59 2018 +0200
@@ -57,8 +57,7 @@
     memset(&caps, 0, sizeof(jvmtiCapabilities));
 
     NSK_DISPLAY0("GetCapabilities() for current JVMTI env\n");
-    if (!NSK_JVMTI_VERIFY(
-            NSK_CPP_STUB2(GetCapabilities, jvmti, &caps))) {
+    if (!NSK_JVMTI_VERIFY(jvmti->GetCapabilities(&caps))) {
         return NSK_FALSE;
     }
 
@@ -71,8 +70,7 @@
  */
 static int addCapabilities(jvmtiEnv* jvmti, jvmtiCapabilities* caps, const char where[]) {
     NSK_DISPLAY0("AddCapabilities() for current JVMTI env\n");
-    if (!NSK_JVMTI_VERIFY(
-            NSK_CPP_STUB2(AddCapabilities, jvmti, caps))) {
+    if (!NSK_JVMTI_VERIFY(jvmti->AddCapabilities(caps))) {
         return NSK_FALSE;
     }
     NSK_DISPLAY0("  ... set\n");
@@ -86,8 +84,7 @@
  */
 static int getPotentialCapabilities(jvmtiEnv* jvmti, jvmtiCapabilities* caps) {
     NSK_DISPLAY0("GetPotentialCapabilities() for current JVMTI env\n");
-    if (!NSK_JVMTI_VERIFY(
-            NSK_CPP_STUB2(GetPotentialCapabilities, jvmti, caps))) {
+    if (!NSK_JVMTI_VERIFY(jvmti->GetPotentialCapabilities(caps))) {
         return NSK_FALSE;
     }
 
@@ -183,9 +180,7 @@
         memset(&eventCallbacks, 0, sizeof(eventCallbacks));
         eventCallbacks.VMInit = callbackVMInit;
         eventCallbacks.VMDeath = callbackVMDeath;
-        if (!NSK_JVMTI_VERIFY(
-                NSK_CPP_STUB3(SetEventCallbacks, jvmti,
-                                    &eventCallbacks, sizeof(eventCallbacks)))) {
+        if (!NSK_JVMTI_VERIFY(jvmti->SetEventCallbacks(&eventCallbacks, sizeof(eventCallbacks)))) {
             return JNI_ERR;
         }
 
--- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/AttachOnDemand/attach002/attach002Agent00.cpp	Fri Oct 05 17:01:07 2018 -0400
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/AttachOnDemand/attach002/attach002Agent00.cpp	Tue Oct 09 14:37:59 2018 +0200
@@ -74,12 +74,12 @@
     jint nativeMethodsNumber = 1;
 
     if (!NSK_JNI_VERIFY(jni, (appClass =
-        NSK_CPP_STUB2(FindClass, jni, ATTACH002_TARGET_APP_CLASS_NAME)) != NULL)) {
+        jni->FindClass(ATTACH002_TARGET_APP_CLASS_NAME)) != NULL)) {
         return NSK_FALSE;
     }
 
     if (!NSK_JNI_VERIFY(jni,
-            (NSK_CPP_STUB4(RegisterNatives, jni, appClass, nativeMethods, nativeMethodsNumber) == 0))) {
+            (jni->RegisterNatives(appClass, nativeMethods, nativeMethodsNumber) == 0))) {
         return NSK_FALSE;
     }
 
@@ -205,7 +205,7 @@
     memset(&caps, 0, sizeof(caps));
     caps.can_generate_all_class_hook_events = 1;
     caps.can_redefine_classes = 1;
-    if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB2(AddCapabilities, jvmti, &caps)) ) {
+    if (!NSK_JVMTI_VERIFY(jvmti->AddCapabilities(&caps)) ) {
         /*
          * If VM is run with -Xshare:on agent can't get required capabilities (see 6718407)
          */
@@ -222,7 +222,7 @@
         eventCallbacks.ClassLoad = classLoadHandler;
         eventCallbacks.ClassPrepare = classPrepareHandler;
         eventCallbacks.ClassFileLoadHook = classFileLoadHoockHandler;
-        if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB3(SetEventCallbacks, jvmti, &eventCallbacks, sizeof(eventCallbacks))) ) {
+        if (!NSK_JVMTI_VERIFY(jvmti->SetEventCallbacks(&eventCallbacks, sizeof(eventCallbacks))) ) {
             return JNI_ERR;
         }
 
--- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/AttachOnDemand/attach002a/attach002aAgent00.cpp	Fri Oct 05 17:01:07 2018 -0400
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/AttachOnDemand/attach002a/attach002aAgent00.cpp	Tue Oct 09 14:37:59 2018 +0200
@@ -106,13 +106,13 @@
     memset(&caps, 0, sizeof(caps));
     caps.can_redefine_classes = 1;
     caps.can_generate_vm_object_alloc_events = 1;
-    if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB2(AddCapabilities, jvmti, &caps)) ) {
+    if (!NSK_JVMTI_VERIFY(jvmti->AddCapabilities(&caps)) ) {
         return JNI_ERR;
     }
 
     memset(&eventCallbacks,0, sizeof(eventCallbacks));
     eventCallbacks.VMObjectAlloc = vmObjectAllocHandler;
-    if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB3(SetEventCallbacks, jvmti, &eventCallbacks, sizeof(eventCallbacks))) ) {
+    if (!NSK_JVMTI_VERIFY(jvmti->SetEventCallbacks(&eventCallbacks, sizeof(eventCallbacks))) ) {
         return JNI_ERR;
     }
 
--- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/AttachOnDemand/attach008/attach008Agent00.cpp	Fri Oct 05 17:01:07 2018 -0400
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/AttachOnDemand/attach008/attach008Agent00.cpp	Tue Oct 09 14:37:59 2018 +0200
@@ -123,14 +123,14 @@
 
     memset(&caps, 0, sizeof(caps));
     caps.can_generate_monitor_events = 1;
-    if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB2(AddCapabilities, jvmti, &caps)) ) {
+    if (!NSK_JVMTI_VERIFY(jvmti->AddCapabilities(&caps)) ) {
         return JNI_ERR;
     }
 
     memset(&eventCallbacks,0, sizeof(eventCallbacks));
     eventCallbacks.MonitorContendedEntered = monitorContentedEnteredHandler;
     eventCallbacks.MonitorContendedEnter = monitorContentedEnterHandler;
-    if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB3(SetEventCallbacks, jvmti, &eventCallbacks, sizeof(eventCallbacks))) ) {
+    if (!NSK_JVMTI_VERIFY(jvmti->SetEventCallbacks(&eventCallbacks, sizeof(eventCallbacks))) ) {
         return JNI_ERR;
     }
 
--- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/AttachOnDemand/attach009/attach009Agent00.cpp	Fri Oct 05 17:01:07 2018 -0400
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/AttachOnDemand/attach009/attach009Agent00.cpp	Tue Oct 09 14:37:59 2018 +0200
@@ -82,8 +82,7 @@
             return;
         }
 
-        if (!NSK_JVMTI_VERIFY( NSK_CPP_STUB4(
-                SetEventNotificationMode, jvmti, JVMTI_ENABLE, JVMTI_EVENT_CLASS_LOAD, thread) ) ) {
+        if (!NSK_JVMTI_VERIFY(jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_CLASS_LOAD, thread) ) ) {
             NSK_COMPLAIN1("Failed to enable events for thread '%s'\n", mainThreadName);
             nsk_aod_agentFinished(jni, agentName, 0);
             return;
@@ -142,7 +141,7 @@
 
     memset(&eventCallbacks,0, sizeof(eventCallbacks));
     eventCallbacks.ClassLoad = classLoadHandler;
-    if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB3(SetEventCallbacks, jvmti, &eventCallbacks, sizeof(eventCallbacks))) ) {
+    if (!NSK_JVMTI_VERIFY(jvmti->SetEventCallbacks(&eventCallbacks, sizeof(eventCallbacks))) ) {
         return JNI_ERR;
     }
 
--- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/AttachOnDemand/attach012/attach012Agent00.cpp	Fri Oct 05 17:01:07 2018 -0400
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/AttachOnDemand/attach012/attach012Agent00.cpp	Tue Oct 09 14:37:59 2018 +0200
@@ -65,7 +65,7 @@
     if (!NSK_VERIFY((jvmti = nsk_jvmti_createJVMTIEnv(vm, reserved)) != NULL))
         return JNI_ERR;
 
-    if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB2(GetPotentialCapabilities, jvmti, &caps)) ) {
+    if (!NSK_JVMTI_VERIFY(jvmti->GetPotentialCapabilities(&caps)) ) {
         return JNI_ERR;
     }
 
@@ -75,7 +75,7 @@
 
     NSK_DISPLAY1("%s: trying to get all potential capabilities:\n", agentName);
 
-    if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB2(AddCapabilities, jvmti, &caps)) ) {
+    if (!NSK_JVMTI_VERIFY(jvmti->AddCapabilities(&caps)) ) {
         return JNI_ERR;
     }
 
--- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/AttachOnDemand/attach014/attach014Agent00.cpp	Fri Oct 05 17:01:07 2018 -0400
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/AttachOnDemand/attach014/attach014Agent00.cpp	Tue Oct 09 14:37:59 2018 +0200
@@ -62,7 +62,7 @@
         if (!nsk_jvmti_aod_disableEvent(jvmti, JVMTI_EVENT_CLASS_LOAD))
             success = 0;
 
-        if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB1(DisposeEnvironment, jvmti))) {
+        if (!NSK_JVMTI_VERIFY(jvmti->DisposeEnvironment())) {
             success = 0;
             NSK_COMPLAIN1("%s: failed to dispose environment\n", agentName);
         } else {
@@ -104,7 +104,7 @@
 
     memset(&eventCallbacks,0, sizeof(eventCallbacks));
     eventCallbacks.ClassLoad = classLoadHandler;
-    if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB3(SetEventCallbacks, jvmti, &eventCallbacks, sizeof(eventCallbacks))) ) {
+    if (!NSK_JVMTI_VERIFY(jvmti->SetEventCallbacks(&eventCallbacks, sizeof(eventCallbacks))) ) {
         return JNI_ERR;
     }
 
--- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/AttachOnDemand/attach015/attach015Agent00.cpp	Fri Oct 05 17:01:07 2018 -0400
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/AttachOnDemand/attach015/attach015Agent00.cpp	Tue Oct 09 14:37:59 2018 +0200
@@ -97,7 +97,7 @@
 
     memset(&eventCallbacks,0, sizeof(eventCallbacks));
     eventCallbacks.ClassPrepare = classPrepareHandler;
-    if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB3(SetEventCallbacks, jvmti, &eventCallbacks, sizeof(eventCallbacks))) ) {
+    if (!NSK_JVMTI_VERIFY(jvmti->SetEventCallbacks(&eventCallbacks, sizeof(eventCallbacks))) ) {
         return JNI_ERR;
     }
 
--- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/AttachOnDemand/attach015/attach015Agent01.cpp	Fri Oct 05 17:01:07 2018 -0400
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/AttachOnDemand/attach015/attach015Agent01.cpp	Tue Oct 09 14:37:59 2018 +0200
@@ -97,7 +97,7 @@
 
     memset(&eventCallbacks,0, sizeof(eventCallbacks));
     eventCallbacks.ClassLoad = classLoadHandler;
-    if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB3(SetEventCallbacks, jvmti, &eventCallbacks, sizeof(eventCallbacks))) ) {
+    if (!NSK_JVMTI_VERIFY(jvmti->SetEventCallbacks(&eventCallbacks, sizeof(eventCallbacks))) ) {
         return JNI_ERR;
     }
 
--- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/AttachOnDemand/attach015/attach015Target.cpp	Fri Oct 05 17:01:07 2018 -0400
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/AttachOnDemand/attach015/attach015Target.cpp	Tue Oct 09 14:37:59 2018 +0200
@@ -37,7 +37,7 @@
  */
 JNIEXPORT jboolean JNICALL
 Java_nsk_jvmti_AttachOnDemand_attach015_attach015Target_loadClassFromNative(JNIEnv * jni, jclass klass) {
-    return NSK_CPP_STUB2(FindClass, jni, LOADED_CLASS_NAME) ? JNI_TRUE : JNI_FALSE;
+    return jni->FindClass(LOADED_CLASS_NAME) ? JNI_TRUE : JNI_FALSE;
 }
 
 }
--- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/AttachOnDemand/attach020/attach020Agent00.cpp	Fri Oct 05 17:01:07 2018 -0400
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/AttachOnDemand/attach020/attach020Agent00.cpp	Tue Oct 09 14:37:59 2018 +0200
@@ -71,17 +71,15 @@
         success = 0;
     }
 
-    if (NSK_JVMTI_VERIFY(NSK_CPP_STUB2(
-            RawMonitorEnter, jvmti, gcFinishMonitor))) {
+    if (NSK_JVMTI_VERIFY(jvmti->RawMonitorEnter(gcFinishMonitor))) {
 
         gcFinishEventReceived = 1;
 
-        if (NSK_JVMTI_VERIFY(NSK_CPP_STUB2(
-                RawMonitorNotify, jvmti, gcFinishMonitor))) {
+        if (NSK_JVMTI_VERIFY(jvmti->RawMonitorNotify(gcFinishMonitor))) {
             auxiliaryThreadNotified = 1;
         }
 
-        if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB2(RawMonitorExit, jvmti, gcFinishMonitor))) {
+        if (!NSK_JVMTI_VERIFY(jvmti->RawMonitorExit(gcFinishMonitor))) {
             success = 0;
         }
     } else {
@@ -96,17 +94,15 @@
 void JNICALL auxiliaryThreadFunction(jvmtiEnv* jvmti, JNIEnv* jni, void* arg) {
     NSK_DISPLAY1("%s: auxiliary thread is running\n", agentName);
 
-    if (NSK_JVMTI_VERIFY(NSK_CPP_STUB2(
-            RawMonitorEnter, jvmti, gcFinishMonitor))) {
+    if (NSK_JVMTI_VERIFY(jvmti->RawMonitorEnter(gcFinishMonitor))) {
 
         if (!gcFinishEventReceived) {
-            if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB3(
-                    RawMonitorWait, jvmti, gcFinishMonitor, 0))) {
+            if (!NSK_JVMTI_VERIFY(jvmti->RawMonitorWait(gcFinishMonitor, 0))) {
                 success = 0;
             }
         }
 
-        if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB2(RawMonitorExit, jvmti, gcFinishMonitor))) {
+        if (!NSK_JVMTI_VERIFY(jvmti->RawMonitorExit(gcFinishMonitor))) {
             success = 0;
         }
     } else {
@@ -122,8 +118,7 @@
     if (!NSK_VERIFY((thread = nsk_jvmti_aod_createThread(jni)) != NULL))
         return NSK_FALSE;
 
-    if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB5(
-            RunAgentThread, jvmti, thread, auxiliaryThreadFunction, NULL, JVMTI_THREAD_NORM_PRIORITY ))) {
+    if (!NSK_JVMTI_VERIFY(jvmti->RunAgentThread(thread, auxiliaryThreadFunction, NULL, JVMTI_THREAD_NORM_PRIORITY ))) {
         return NSK_FALSE;
     }
 
@@ -161,7 +156,7 @@
     if (!NSK_VERIFY((jvmti = nsk_jvmti_createJVMTIEnv(vm, reserved)) != NULL))
         return JNI_ERR;
 
-    if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB3(CreateRawMonitor, jvmti, "GCFinishMonitor", &gcFinishMonitor))) {
+    if (!NSK_JVMTI_VERIFY(jvmti->CreateRawMonitor("GCFinishMonitor", &gcFinishMonitor))) {
         return JNI_ERR;
     }
 
@@ -170,14 +165,14 @@
 
     memset(&caps, 0, sizeof(caps));
     caps.can_generate_garbage_collection_events = 1;
-    if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB2(AddCapabilities, jvmti, &caps)) ) {
+    if (!NSK_JVMTI_VERIFY(jvmti->AddCapabilities(&caps)) ) {
         return JNI_ERR;
     }
 
     memset(&eventCallbacks,0, sizeof(eventCallbacks));
     eventCallbacks.GarbageCollectionStart  = garbageCollectionStartHandler;
     eventCallbacks.GarbageCollectionFinish = garbageCollectionFinishHandler;
-    if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB3(SetEventCallbacks, jvmti, &eventCallbacks, sizeof(eventCallbacks))) ) {
+    if (!NSK_JVMTI_VERIFY(jvmti->SetEventCallbacks(&eventCallbacks, sizeof(eventCallbacks))) ) {
         return JNI_ERR;
     }
 
--- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/AttachOnDemand/attach021/attach021Agent00.cpp	Fri Oct 05 17:01:07 2018 -0400
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/AttachOnDemand/attach021/attach021Agent00.cpp	Tue Oct 09 14:37:59 2018 +0200
@@ -56,7 +56,7 @@
 JNIEXPORT jboolean JNICALL
 Java_nsk_jvmti_AttachOnDemand_attach021_attach021Target_setTagFor(JNIEnv * jni,
         jclass klass, jobject obj) {
-    if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB3(SetTag, jvmti, obj, TAG_VALUE))) {
+    if (!NSK_JVMTI_VERIFY(jvmti->SetTag(obj, TAG_VALUE))) {
         return JNI_FALSE;
     }
 
@@ -95,12 +95,12 @@
     jint nativeMethodsNumber = 2;
 
     if (!NSK_JNI_VERIFY(jni, (appClass =
-        NSK_CPP_STUB2(FindClass, jni, ATTACH021_TARGET_APP_CLASS_NAME)) != NULL)) {
+        jni->FindClass(ATTACH021_TARGET_APP_CLASS_NAME)) != NULL)) {
         return NSK_FALSE;
     }
 
     if (!NSK_JNI_VERIFY(jni,
-            (NSK_CPP_STUB4(RegisterNatives, jni, appClass, nativeMethods, nativeMethodsNumber) == 0))) {
+            (jni->RegisterNatives(appClass, nativeMethods, nativeMethodsNumber) == 0))) {
         return NSK_FALSE;
     }
 
@@ -142,13 +142,13 @@
     memset(&caps, 0, sizeof(caps));
     caps.can_tag_objects = 1;
     caps.can_generate_object_free_events = 1;
-    if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB2(AddCapabilities, jvmti, &caps)) ) {
+    if (!NSK_JVMTI_VERIFY(jvmti->AddCapabilities(&caps)) ) {
         return JNI_ERR;
     }
 
     memset(&eventCallbacks,0, sizeof(eventCallbacks));
     eventCallbacks.ObjectFree = objectFreeHandler;
-    if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB3(SetEventCallbacks, jvmti, &eventCallbacks, sizeof(eventCallbacks))) ) {
+    if (!NSK_JVMTI_VERIFY(jvmti->SetEventCallbacks(&eventCallbacks, sizeof(eventCallbacks))) ) {
         return JNI_ERR;
     }
 
--- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/AttachOnDemand/attach022/attach022Agent00.cpp	Fri Oct 05 17:01:07 2018 -0400
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/AttachOnDemand/attach022/attach022Agent00.cpp	Tue Oct 09 14:37:59 2018 +0200
@@ -84,12 +84,10 @@
 void JNICALL objectFreeHandler(jvmtiEnv *jvmti, jlong tag) {
     NSK_DISPLAY2("%s: ObjectFree event received (object tag: %ld)\n", agentName, tag);
 
-    if (NSK_JVMTI_VERIFY(NSK_CPP_STUB2(
-            RawMonitorEnter, jvmti, objectFreeMonitor))) {
-
+    if (NSK_JVMTI_VERIFY(jvmti->RawMonitorEnter(objectFreeMonitor))) {
         freedObjectsCounter++;
 
-        if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB2(RawMonitorExit, jvmti, objectFreeMonitor))) {
+        if (!NSK_JVMTI_VERIFY(jvmti->RawMonitorExit(objectFreeMonitor))) {
             success = 0;
         }
     } else {
@@ -107,12 +105,12 @@
     jint nativeMethodsNumber = 1;
 
     if (!NSK_JNI_VERIFY(jni, (appClass =
-        NSK_CPP_STUB2(FindClass, jni, ATTACH022_TARGET_APP_CLASS_NAME)) != NULL)) {
+        jni->FindClass(ATTACH022_TARGET_APP_CLASS_NAME)) != NULL)) {
         return NSK_FALSE;
     }
 
     if (!NSK_JNI_VERIFY(jni,
-            (NSK_CPP_STUB4(RegisterNatives, jni, appClass, nativeMethods, nativeMethodsNumber) == 0))) {
+            (jni->RegisterNatives(appClass, nativeMethods, nativeMethodsNumber) == 0))) {
         return NSK_FALSE;
     }
 
@@ -136,12 +134,10 @@
     NSK_DISPLAY2("%s: ObjectAlloc event received (object class: %s)\n", agentName, className);
 
     if (!strcmp(className, OBJECTS_FOR_ALLOCATION_TEST_CLASS_NAME)) {
-        if (NSK_JVMTI_VERIFY(NSK_CPP_STUB2(
-                RawMonitorEnter, jvmti, objectTagMonitor))) {
+        if (NSK_JVMTI_VERIFY(jvmti->RawMonitorEnter(objectTagMonitor))) {
             jlong tagValue = taggedObjectsCounter + 1;
 
-
-            if (!NSK_JVMTI_VERIFY( NSK_CPP_STUB3(SetTag, jvmti, object, tagValue))) {
+            if (!NSK_JVMTI_VERIFY(jvmti->SetTag(object, tagValue))) {
                 NSK_COMPLAIN1("%s: failed to set tag\n", agentName);
                 success = 0;
             } else {
@@ -149,7 +145,7 @@
                 taggedObjectsCounter++;
             }
 
-            if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB2(RawMonitorExit, jvmti, objectTagMonitor))) {
+            if (!NSK_JVMTI_VERIFY(jvmti->RawMonitorExit(objectTagMonitor))) {
                 success = 0;
             }
         } else {
@@ -195,11 +191,11 @@
         return JNI_ERR;
     }
 
-    if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB3(CreateRawMonitor, jvmti, "ObjectTagMonitor", &objectTagMonitor))) {
+    if (!NSK_JVMTI_VERIFY(jvmti->CreateRawMonitor("ObjectTagMonitor", &objectTagMonitor))) {
         return JNI_ERR;
     }
 
-    if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB3(CreateRawMonitor, jvmti, "ObjectFreeMonitor", &objectFreeMonitor))) {
+    if (!NSK_JVMTI_VERIFY(jvmti->CreateRawMonitor("ObjectFreeMonitor", &objectFreeMonitor))) {
         return JNI_ERR;
     }
 
@@ -207,14 +203,14 @@
     caps.can_tag_objects = 1;
     caps.can_generate_object_free_events = 1;
     caps.can_generate_vm_object_alloc_events = 1;
-    if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB2(AddCapabilities, jvmti, &caps)) ) {
+    if (!NSK_JVMTI_VERIFY(jvmti->AddCapabilities(&caps)) ) {
         return JNI_ERR;
     }
 
     memset(&eventCallbacks,0, sizeof(eventCallbacks));
     eventCallbacks.ObjectFree = objectFreeHandler;
     eventCallbacks.VMObjectAlloc = vmObjectAllocHandler;
-    if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB3(SetEventCallbacks, jvmti, &eventCallbacks, sizeof(eventCallbacks))) ) {
+    if (!NSK_JVMTI_VERIFY(jvmti->SetEventCallbacks(&eventCallbacks, sizeof(eventCallbacks))) ) {
         return JNI_ERR;
     }
 
--- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/AttachOnDemand/attach037/attach037Agent00.cpp	Fri Oct 05 17:01:07 2018 -0400
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/AttachOnDemand/attach037/attach037Agent00.cpp	Tue Oct 09 14:37:59 2018 +0200
@@ -122,14 +122,14 @@
 
     memset(&caps, 0, sizeof(caps));
     caps.can_generate_monitor_events = 1;
-    if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB2(AddCapabilities, jvmti, &caps)) ) {
+    if (!NSK_JVMTI_VERIFY(jvmti->AddCapabilities(&caps)) ) {
         return JNI_ERR;
     }
 
     memset(&eventCallbacks,0, sizeof(eventCallbacks));
     eventCallbacks.MonitorWaited = monitorWaitedHandler;
     eventCallbacks.MonitorWait = monitorWaitHandler;
-    if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB3(SetEventCallbacks, jvmti, &eventCallbacks, sizeof(eventCallbacks))) ) {
+    if (!NSK_JVMTI_VERIFY(jvmti->SetEventCallbacks(&eventCallbacks, sizeof(eventCallbacks))) ) {
         return JNI_ERR;
     }
 
--- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/AttachOnDemand/attach038/attach038Agent00.cpp	Fri Oct 05 17:01:07 2018 -0400
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/AttachOnDemand/attach038/attach038Agent00.cpp	Tue Oct 09 14:37:59 2018 +0200
@@ -119,7 +119,7 @@
     memset(&eventCallbacks,0, sizeof(eventCallbacks));
     eventCallbacks.ThreadEnd = threadEndHandler;
     eventCallbacks.ThreadStart = threadStartHandler;
-    if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB3(SetEventCallbacks, jvmti, &eventCallbacks, sizeof(eventCallbacks))) ) {
+    if (!NSK_JVMTI_VERIFY(jvmti->SetEventCallbacks(&eventCallbacks, sizeof(eventCallbacks))) ) {
         return JNI_ERR;
     }
 
--- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/AttachOnDemand/attach039/attach039Agent00.cpp	Fri Oct 05 17:01:07 2018 -0400
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/AttachOnDemand/attach039/attach039Agent00.cpp	Tue Oct 09 14:37:59 2018 +0200
@@ -68,8 +68,7 @@
     if (!NSK_VERIFY((thread = nsk_jvmti_aod_createThreadWithName(jni, STARTED_THREAD_NAME)) != NULL))
         return NSK_FALSE;
 
-    if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB5(
-            RunAgentThread, jvmti, thread, startedThreadFunction, NULL, JVMTI_THREAD_NORM_PRIORITY ))) {
+    if (!NSK_JVMTI_VERIFY(jvmti->RunAgentThread(thread, startedThreadFunction, NULL, JVMTI_THREAD_NORM_PRIORITY ))) {
         return NSK_FALSE;
     }
 
@@ -155,7 +154,7 @@
     memset(&eventCallbacks,0, sizeof(eventCallbacks));
     eventCallbacks.ThreadEnd = threadEndHandler;
     eventCallbacks.ThreadStart = threadStartHandler;
-    if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB3(SetEventCallbacks, jvmti, &eventCallbacks, sizeof(eventCallbacks))) ) {
+    if (!NSK_JVMTI_VERIFY(jvmti->SetEventCallbacks(&eventCallbacks, sizeof(eventCallbacks))) ) {
         return JNI_ERR;
     }
 
--- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/AttachOnDemand/attach040/attach040Agent00.cpp	Fri Oct 05 17:01:07 2018 -0400
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/AttachOnDemand/attach040/attach040Agent00.cpp	Tue Oct 09 14:37:59 2018 +0200
@@ -66,7 +66,7 @@
 
     NSK_DISPLAY2("%s: ThreadStart event was received for thread '%s'\n", agentName, startedThreadName);
 
-    if (NSK_JVMTI_VERIFY(NSK_CPP_STUB3(GetAllThreads, jvmti, &threadsCount, &threads))) {
+    if (NSK_JVMTI_VERIFY(jvmti->GetAllThreads(&threadsCount, &threads))) {
         int startedThreadWasFound = 0;
 
         for (i = 0; i < threadsCount; i++) {
@@ -94,8 +94,7 @@
     }
 
     if (strstr(startedThreadName, TEST_THREAD_NAME_PREFIX)) {
-        if (NSK_JVMTI_VERIFY(NSK_CPP_STUB2(
-                RawMonitorEnter, jvmti, threadsCounterMonitor))) {
+        if (NSK_JVMTI_VERIFY(jvmti->RawMonitorEnter(threadsCounterMonitor))) {
 
             testThreadsCounter++;
 
@@ -103,7 +102,7 @@
                 nsk_jvmti_aod_disableEventAndFinish(agentName, JVMTI_EVENT_THREAD_START, success, jvmti, jni);
             }
 
-            if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB2(RawMonitorExit, jvmti, threadsCounterMonitor))) {
+            if (!NSK_JVMTI_VERIFY(jvmti->RawMonitorExit(threadsCounterMonitor))) {
                 success = 0;
             }
         } else {
@@ -145,13 +144,13 @@
     if (!NSK_VERIFY((jvmti = nsk_jvmti_createJVMTIEnv(vm, reserved)) != NULL))
         return JNI_ERR;
 
-    if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB3(CreateRawMonitor, jvmti, "threadsCounterMonitor", &threadsCounterMonitor))) {
+    if (!NSK_JVMTI_VERIFY(jvmti->CreateRawMonitor("threadsCounterMonitor", &threadsCounterMonitor))) {
         return JNI_ERR;
     }
 
     memset(&eventCallbacks,0, sizeof(eventCallbacks));
     eventCallbacks.ThreadStart = threadStartHandler;
-    if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB3(SetEventCallbacks, jvmti, &eventCallbacks, sizeof(eventCallbacks))) ) {
+    if (!NSK_JVMTI_VERIFY(jvmti->SetEventCallbacks(&eventCallbacks, sizeof(eventCallbacks))) ) {
         return JNI_ERR;
     }
 
--- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/AttachOnDemand/attach041/attach041Agent00.cpp	Fri Oct 05 17:01:07 2018 -0400
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/AttachOnDemand/attach041/attach041Agent00.cpp	Tue Oct 09 14:37:59 2018 +0200
@@ -52,7 +52,7 @@
     int i;
     char threadGroupName[MAX_STRING_LENGTH];
 
-    if(!NSK_JVMTI_VERIFY(NSK_CPP_STUB3(GetThreadGroupInfo, jvmti, group, &groupInfo))) {
+    if(!NSK_JVMTI_VERIFY(jvmti->GetThreadGroupInfo(group, &groupInfo))) {
         return 0;
     }
 
@@ -61,7 +61,7 @@
 
     NSK_DISPLAY3("%s: trying to find thread '%s' in group '%s'\n", agentName, threadNameToFind, threadGroupName);
 
-    if(!NSK_JVMTI_VERIFY(NSK_CPP_STUB6(GetThreadGroupChildren, jvmti, group, &threadsCount, &threads, &groupsCount, &groups))) {
+    if(!NSK_JVMTI_VERIFY(jvmti->GetThreadGroupChildren(group, &threadsCount, &threads, &groupsCount, &groups))) {
         return 0;
     }
 
@@ -118,7 +118,7 @@
         jthreadGroup *topGroups;
         int i;
 
-        if(!NSK_JVMTI_VERIFY(NSK_CPP_STUB3(GetTopThreadGroups, jvmti, &groupsCount, &topGroups))) {
+        if(!NSK_JVMTI_VERIFY(jvmti->GetTopThreadGroups(&groupsCount, &topGroups))) {
             NSK_COMPLAIN1("%s: failed to get top thread groups\n", agentName);
             nsk_jvmti_aod_disableEventAndFinish(agentName, JVMTI_EVENT_THREAD_START, 0, jvmti, jni);
             return;
@@ -172,7 +172,7 @@
 
     memset(&eventCallbacks,0, sizeof(eventCallbacks));
     eventCallbacks.ThreadStart = threadStartHandler;
-    if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB3(SetEventCallbacks, jvmti, &eventCallbacks, sizeof(eventCallbacks))) ) {
+    if (!NSK_JVMTI_VERIFY(jvmti->SetEventCallbacks(&eventCallbacks, sizeof(eventCallbacks))) ) {
         return JNI_ERR;
     }
 
--- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/AttachOnDemand/attach042/attach042Agent00.cpp	Fri Oct 05 17:01:07 2018 -0400
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/AttachOnDemand/attach042/attach042Agent00.cpp	Tue Oct 09 14:37:59 2018 +0200
@@ -62,7 +62,7 @@
         int i;
         int startedThreadWasFound = 0;
 
-        if(!NSK_JVMTI_VERIFY(NSK_CPP_STUB3(GetAllThreads, jvmti, &threadsCount, &threads))) {
+        if(!NSK_JVMTI_VERIFY(jvmti->GetAllThreads(&threadsCount, &threads))) {
             NSK_COMPLAIN1("%s: failed to get all threads\n", agentName);
             nsk_jvmti_aod_disableEventAndFinish(agentName, JVMTI_EVENT_THREAD_START, 0, jvmti, jni);
             return;
@@ -85,7 +85,7 @@
                 startedThreadWasFound = 1;
             }
 
-            if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB3(GetThreadState, jvmti, threads[i], &threadState))) {
+            if (!NSK_JVMTI_VERIFY(jvmti->GetThreadState(threads[i], &threadState))) {
                 NSK_COMPLAIN2("%s: failed to get status of thread '%s'\n", agentName, threadName);
                 nsk_jvmti_aod_deallocate(jvmti, (unsigned char*)threads);
                 nsk_jvmti_aod_disableEventAndFinish(agentName, JVMTI_EVENT_THREAD_START, 0, jvmti, jni);
@@ -136,7 +136,7 @@
 
     memset(&eventCallbacks,0, sizeof(eventCallbacks));
     eventCallbacks.ThreadStart = threadStartHandler;
-    if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB3(SetEventCallbacks, jvmti, &eventCallbacks, sizeof(eventCallbacks))) ) {
+    if (!NSK_JVMTI_VERIFY(jvmti->SetEventCallbacks(&eventCallbacks, sizeof(eventCallbacks))) ) {
         return JNI_ERR;
     }
 
--- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/AttachOnDemand/attach045/attach045Agent00.cpp	Fri Oct 05 17:01:07 2018 -0400
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/AttachOnDemand/attach045/attach045Agent00.cpp	Tue Oct 09 14:37:59 2018 +0200
@@ -57,8 +57,7 @@
         return;
     }
 
-    if (NSK_JVMTI_VERIFY(NSK_CPP_STUB2(
-            RawMonitorEnter, jvmti, eventsCounterMonitor))) {
+    if (NSK_JVMTI_VERIFY(jvmti->RawMonitorEnter(eventsCounterMonitor))) {
 
         eventsCounter++;
 
@@ -69,7 +68,7 @@
             nsk_jvmti_aod_disableEventAndFinish(agentName, JVMTI_EVENT_CLASS_LOAD, success, jvmti, jni);
         }
 
-        if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB2(RawMonitorExit, jvmti, eventsCounterMonitor))) {
+        if (!NSK_JVMTI_VERIFY(jvmti->RawMonitorExit(eventsCounterMonitor))) {
             success = 0;
         }
     } else {
@@ -109,13 +108,13 @@
     if (!NSK_VERIFY((jvmti = nsk_jvmti_createJVMTIEnv(vm, reserved)) != NULL))
         return JNI_ERR;
 
-    if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB3(CreateRawMonitor, jvmti, "attach045-agent00-eventsCounterMonitor", &eventsCounterMonitor))) {
+    if (!NSK_JVMTI_VERIFY(jvmti->CreateRawMonitor("attach045-agent00-eventsCounterMonitor", &eventsCounterMonitor))) {
         return JNI_ERR;
     }
 
     memset(&eventCallbacks,0, sizeof(eventCallbacks));
     eventCallbacks.ClassLoad = classLoadHandler;
-    if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB3(SetEventCallbacks, jvmti, &eventCallbacks, sizeof(eventCallbacks))) ) {
+    if (!NSK_JVMTI_VERIFY(jvmti->SetEventCallbacks(&eventCallbacks, sizeof(eventCallbacks))) ) {
         return JNI_ERR;
     }
 
--- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/AttachOnDemand/attach045/attach045Agent01.cpp	Fri Oct 05 17:01:07 2018 -0400
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/AttachOnDemand/attach045/attach045Agent01.cpp	Tue Oct 09 14:37:59 2018 +0200
@@ -59,7 +59,7 @@
         return;
     }
 
-    if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB3(GetLoadedClasses, jvmti, &loadedClassesCount, &loadedClasses))) {
+    if (!NSK_JVMTI_VERIFY(jvmti->GetLoadedClasses(&loadedClassesCount, &loadedClasses))) {
         NSK_COMPLAIN1("%s: failed to get loaded classes\n", agentName);
         nsk_jvmti_aod_disableEventAndFinish(agentName, JVMTI_EVENT_CLASS_PREPARE, 0, jvmti, jni);
         return;
@@ -67,8 +67,7 @@
 
     nsk_jvmti_aod_deallocate(jvmti, (unsigned char*)loadedClasses);
 
-    if (NSK_JVMTI_VERIFY(NSK_CPP_STUB2(
-            RawMonitorEnter, jvmti, eventsCounterMonitor))) {
+    if (NSK_JVMTI_VERIFY(jvmti->RawMonitorEnter(eventsCounterMonitor))) {
 
         eventsCounter++;
 
@@ -80,7 +79,7 @@
             nsk_jvmti_aod_disableEventAndFinish(agentName, JVMTI_EVENT_CLASS_PREPARE, success, jvmti, jni);
         }
 
-        if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB2(RawMonitorExit, jvmti, eventsCounterMonitor))) {
+        if (!NSK_JVMTI_VERIFY(jvmti->RawMonitorExit(eventsCounterMonitor))) {
             success = 0;
         }
     } else {
@@ -120,13 +119,13 @@
     if (!NSK_VERIFY((jvmti = nsk_jvmti_createJVMTIEnv(vm, reserved)) != NULL))
         return JNI_ERR;
 
-    if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB3(CreateRawMonitor, jvmti, "attach045-agent01-eventsCounterMonitor", &eventsCounterMonitor))) {
+    if (!NSK_JVMTI_VERIFY(jvmti->CreateRawMonitor("attach045-agent01-eventsCounterMonitor", &eventsCounterMonitor))) {
         return JNI_ERR;
     }
 
     memset(&eventCallbacks,0, sizeof(eventCallbacks));
     eventCallbacks.ClassPrepare = classPrepareHandler;
-    if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB3(SetEventCallbacks, jvmti, &eventCallbacks, sizeof(eventCallbacks))) ) {
+    if (!NSK_JVMTI_VERIFY(jvmti->SetEventCallbacks(&eventCallbacks, sizeof(eventCallbacks))) ) {
         return JNI_ERR;
     }
 
--- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/AttachOnDemand/attach045/attach045Agent02.cpp	Fri Oct 05 17:01:07 2018 -0400
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/AttachOnDemand/attach045/attach045Agent02.cpp	Tue Oct 09 14:37:59 2018 +0200
@@ -62,7 +62,7 @@
         return;
     }
 
-    if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB3(GetAllThreads, jvmti, &threadsCount, &threads))) {
+    if (!NSK_JVMTI_VERIFY(jvmti->GetAllThreads(&threadsCount, &threads))) {
         NSK_COMPLAIN1("%s: failed to get all threads\n", agentName);
         nsk_jvmti_aod_disableEventsAndFinish(agentName, testEvents, testEventsNumber, 0, jvmti, jni);
         return;
@@ -70,8 +70,7 @@
 
     nsk_jvmti_aod_deallocate(jvmti, (unsigned char*)threads);
 
-    if (NSK_JVMTI_VERIFY(NSK_CPP_STUB2(
-            RawMonitorEnter, jvmti, eventsCounterMonitor))) {
+    if (NSK_JVMTI_VERIFY(jvmti->RawMonitorEnter(eventsCounterMonitor))) {
 
         eventsCounter++;
 
@@ -86,7 +85,7 @@
             nsk_jvmti_aod_disableEventsAndFinish(agentName, testEvents, testEventsNumber, success, jvmti, jni);
         }
 
-        if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB2(RawMonitorExit, jvmti, eventsCounterMonitor))) {
+        if (!NSK_JVMTI_VERIFY(jvmti->RawMonitorExit(eventsCounterMonitor))) {
             success = 0;
         }
     } else {
@@ -140,14 +139,14 @@
     if (!NSK_VERIFY((jvmti = nsk_jvmti_createJVMTIEnv(vm, reserved)) != NULL))
         return JNI_ERR;
 
-    if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB3(CreateRawMonitor, jvmti, "attach045-agent02-eventsCounterMonitor", &eventsCounterMonitor))) {
+    if (!NSK_JVMTI_VERIFY(jvmti->CreateRawMonitor("attach045-agent02-eventsCounterMonitor", &eventsCounterMonitor))) {
         return JNI_ERR;
     }
 
     memset(&eventCallbacks,0, sizeof(eventCallbacks));
     eventCallbacks.ThreadStart = threadStartHandler;
     eventCallbacks.ThreadEnd = threadEndHandler;
-    if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB3(SetEventCallbacks, jvmti, &eventCallbacks, sizeof(eventCallbacks))) ) {
+    if (!NSK_JVMTI_VERIFY(jvmti->SetEventCallbacks(&eventCallbacks, sizeof(eventCallbacks))) ) {
         return JNI_ERR;
     }
 
--- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/AttachOnDemand/attach045/attach045Agent03.cpp	Fri Oct 05 17:01:07 2018 -0400
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/AttachOnDemand/attach045/attach045Agent03.cpp	Tue Oct 09 14:37:59 2018 +0200
@@ -68,8 +68,7 @@
         return;
     }
 
-    if (NSK_JVMTI_VERIFY(NSK_CPP_STUB2(
-            RawMonitorEnter, jvmti, eventsCounterMonitor))) {
+    if (NSK_JVMTI_VERIFY(jvmti->RawMonitorEnter(eventsCounterMonitor))) {
 
         eventsCounter++;
 
@@ -79,7 +78,7 @@
         if ((eventsCounter % 10) == 0) {
             NSK_DISPLAY1("%s: force garbage collection\n", agentName);
 
-            if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB1(ForceGarbageCollection, jvmti)))
+            if (!NSK_JVMTI_VERIFY(jvmti->ForceGarbageCollection()))
                 success = 0;
         }
 
@@ -89,7 +88,7 @@
             nsk_jvmti_aod_disableEventsAndFinish(agentName, testEvents, testEventsNumber, success, jvmti, jni);
         }
 
-        if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB2(RawMonitorExit, jvmti, eventsCounterMonitor))) {
+        if (!NSK_JVMTI_VERIFY(jvmti->RawMonitorExit(eventsCounterMonitor))) {
             success = 0;
         }
     } else {
@@ -130,19 +129,19 @@
     if (!NSK_VERIFY((jvmti = nsk_jvmti_createJVMTIEnv(vm, reserved)) != NULL))
         return JNI_ERR;
 
-    if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB3(CreateRawMonitor, jvmti, "attach045-agent03-eventsCounterMonitor", &eventsCounterMonitor))) {
+    if (!NSK_JVMTI_VERIFY(jvmti->CreateRawMonitor("attach045-agent03-eventsCounterMonitor", &eventsCounterMonitor))) {
         return JNI_ERR;
     }
 
     memset(&caps, 0, sizeof(caps));
     caps.can_generate_vm_object_alloc_events = 1;
-    if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB2(AddCapabilities, jvmti, &caps)) ) {
+    if (!NSK_JVMTI_VERIFY(jvmti->AddCapabilities(&caps)) ) {
         return JNI_ERR;
     }
 
     memset(&eventCallbacks,0, sizeof(eventCallbacks));
     eventCallbacks.VMObjectAlloc = VMObjectAllocHandler;
-    if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB3(SetEventCallbacks, jvmti, &eventCallbacks, sizeof(eventCallbacks))) ) {
+    if (!NSK_JVMTI_VERIFY(jvmti->SetEventCallbacks(&eventCallbacks, sizeof(eventCallbacks))) ) {
         return JNI_ERR;
     }
 
--- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/AttachOnDemand/attach046/attach046Agent00.cpp	Fri Oct 05 17:01:07 2018 -0400
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/AttachOnDemand/attach046/attach046Agent00.cpp	Tue Oct 09 14:37:59 2018 +0200
@@ -113,13 +113,13 @@
 
     memset(&caps, 0, sizeof(caps));
     caps.can_redefine_classes = 1;
-    if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB2(AddCapabilities, jvmti, &caps)) ) {
+    if (!NSK_JVMTI_VERIFY(jvmti->AddCapabilities(&caps)) ) {
         return JNI_ERR;
     }
 
     memset(&eventCallbacks,0, sizeof(eventCallbacks));
     eventCallbacks.ClassLoad = classLoadHandler;
-    if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB3(SetEventCallbacks, jvmti, &eventCallbacks, sizeof(eventCallbacks))) ) {
+    if (!NSK_JVMTI_VERIFY(jvmti->SetEventCallbacks(&eventCallbacks, sizeof(eventCallbacks))) ) {
         return JNI_ERR;
     }
 
--- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/Breakpoint/breakpoint001/breakpoint001.cpp	Fri Oct 05 17:01:07 2018 -0400
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/Breakpoint/breakpoint001/breakpoint001.cpp	Tue Oct 09 14:37:59 2018 +0200
@@ -67,15 +67,11 @@
     int i;
 
     for (i=0; i<METH_NUM; i++) {
-        if (!NSK_JNI_VERIFY(env, (mid = NSK_CPP_STUB4(GetMethodID,
-                env, klass, METHODS[i][0], METHODS[i][1])) != NULL))
-            NSK_CPP_STUB2(FatalError, env,
-                "failed to get ID for the java method\n");
+        if (!NSK_JNI_VERIFY(env, (mid = env->GetMethodID(klass, METHODS[i][0], METHODS[i][1])) != NULL))
+            env->FatalError("failed to get ID for the java method\n");
 
-        if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB3(SetBreakpoint,
-                jvmti_env, mid, 0)))
-            NSK_CPP_STUB2(FatalError, env,
-                "failed to set breakpoint\n");
+        if (!NSK_JVMTI_VERIFY(jvmti_env->SetBreakpoint(mid, 0)))
+            env->FatalError("failed to set breakpoint\n");
     }
 }
 
@@ -88,10 +84,8 @@
 
     if (vm_started) {
         // GetClassSignature may be called only during the start or the live phase
-        if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB4(GetClassSignature,
-                                            jvmti_env, klass, &sig, &generic)))
-            NSK_CPP_STUB2(FatalError, env,
-                          "failed to obtain a class signature\n");
+        if (!NSK_JVMTI_VERIFY(jvmti_env->GetClassSignature(klass, &sig, &generic)))
+            env->FatalError("failed to obtain a class signature\n");
 
         if (sig != NULL && (strcmp(sig, CLASS_SIG) == 0)) {
             NSK_DISPLAY1(
@@ -117,8 +111,7 @@
     NSK_DISPLAY0(">>>> Breakpoint event received\n");
 
     /* checking thread info */
-    if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB3(GetThreadInfo,
-            jvmti_env, thread, &thr_info))) {
+    if (!NSK_JVMTI_VERIFY(jvmti_env->GetThreadInfo(thread, &thr_info))) {
         result = STATUS_FAILED;
         NSK_COMPLAIN0("TEST FAILED: unable to get thread info during Breakpoint callback\n\n");
         return;
@@ -148,14 +141,12 @@
             (long) location);
 
     /* checking method info */
-    if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB3(GetMethodDeclaringClass,
-            jvmti_env, method, &klass))) {
+    if (!NSK_JVMTI_VERIFY(jvmti_env->GetMethodDeclaringClass(method, &klass))) {
         result = checkStatus = STATUS_FAILED;
         NSK_COMPLAIN0("TEST FAILED: unable to get method declaring class during Breakpoint callback\n\n");
         return;
     }
-    if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB4(GetClassSignature,
-            jvmti_env, klass, &clsSig, &generic))) {
+    if (!NSK_JVMTI_VERIFY(jvmti_env->GetClassSignature(klass, &clsSig, &generic))) {
         result = checkStatus = STATUS_FAILED;
         NSK_COMPLAIN0("TEST FAILED: unable to obtain a class signature during Breakpoint callback\n\n");
         return;
@@ -172,8 +163,7 @@
         NSK_DISPLAY1("CHECK PASSED: class signature: \"%s\"\n",
             clsSig);
 
-    if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB5(GetMethodName,
-            jvmti_env, method, &methNam, &methSig, NULL))) {
+    if (!NSK_JVMTI_VERIFY(jvmti_env->GetMethodName(method, &methNam, &methSig, NULL))) {
         result = checkStatus = STATUS_FAILED;
         NSK_COMPLAIN0("TEST FAILED: unable to get method name during Breakpoint callback\n\n");
         return;
@@ -189,13 +179,11 @@
             break;
         }
 
-    if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB2(Deallocate,
-            jvmti_env, (unsigned char*) methNam))) {
+    if (!NSK_JVMTI_VERIFY(jvmti_env->Deallocate((unsigned char*) methNam))) {
         result = STATUS_FAILED;
         NSK_COMPLAIN0("TEST FAILED: unable to deallocate memory pointed to method name\n\n");
     }
-    if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB2(Deallocate,
-            jvmti_env, (unsigned char*) methSig))) {
+    if (!NSK_JVMTI_VERIFY(jvmti_env->Deallocate((unsigned char*) methSig))) {
         result = STATUS_FAILED;
         NSK_COMPLAIN0("TEST FAILED: unable to deallocate memory pointed to method signature\n\n");
     }
@@ -265,12 +253,10 @@
     /* add capability to generate compiled method events */
     memset(&caps, 0, sizeof(jvmtiCapabilities));
     caps.can_generate_breakpoint_events = 1;
-    if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB2(AddCapabilities,
-            jvmti, &caps)))
+    if (!NSK_JVMTI_VERIFY(jvmti->AddCapabilities(&caps)))
         return JNI_ERR;
 
-    if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB2(GetCapabilities,
-            jvmti, &caps)))
+    if (!NSK_JVMTI_VERIFY(jvmti->GetCapabilities(&caps)))
         return JNI_ERR;
 
     if (!caps.can_generate_single_step_events)
@@ -282,20 +268,16 @@
     callbacks.ClassLoad = &ClassLoad;
     callbacks.Breakpoint = &Breakpoint;
     callbacks.VMStart = &VMStart;
-    if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB3(SetEventCallbacks,
-            jvmti, &callbacks, sizeof(callbacks))))
+    if (!NSK_JVMTI_VERIFY(jvmti->SetEventCallbacks(&callbacks, sizeof(callbacks))))
         return JNI_ERR;
 
     NSK_DISPLAY0("setting event callbacks done\nenabling JVMTI events ...\n");
 
-    if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB4(SetEventNotificationMode,
-            jvmti, JVMTI_ENABLE, JVMTI_EVENT_VM_START, NULL)))
+    if (!NSK_JVMTI_VERIFY(jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_VM_START, NULL)))
         return JNI_ERR;
-    if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB4(SetEventNotificationMode,
-            jvmti, JVMTI_ENABLE, JVMTI_EVENT_CLASS_LOAD, NULL)))
+    if (!NSK_JVMTI_VERIFY(jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_CLASS_LOAD, NULL)))
         return JNI_ERR;
-    if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB4(SetEventNotificationMode,
-            jvmti, JVMTI_ENABLE, JVMTI_EVENT_BREAKPOINT, NULL)))
+    if (!NSK_JVMTI_VERIFY(jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_BREAKPOINT, NULL)))
         return JNI_ERR;
     NSK_DISPLAY0("enabling the events done\n\n");
 
--- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/ClassFileLoadHook/classfloadhk001/classfloadhk001.cpp	Fri Oct 05 17:01:07 2018 -0400
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/ClassFileLoadHook/classfloadhk001/classfloadhk001.cpp	Tue Oct 09 14:37:59 2018 +0200
@@ -93,13 +93,11 @@
     NSK_DISPLAY0("setting event callbacks ...\n");
     (void) memset(&callbacks, 0, sizeof(callbacks));
     callbacks.ClassFileLoadHook = &ClassFileLoadHook;
-    if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB3(SetEventCallbacks,
-            jvmti, &callbacks, sizeof(callbacks))))
+    if (!NSK_JVMTI_VERIFY(jvmti->SetEventCallbacks(&callbacks, sizeof(callbacks))))
         return JNI_ERR;
 
     NSK_DISPLAY0("setting event callbacks done\nenabling ClassFileLoadHook event ...\n");
-    if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB4(SetEventNotificationMode,
-            jvmti, JVMTI_ENABLE, JVMTI_EVENT_CLASS_FILE_LOAD_HOOK, NULL)))
+    if (!NSK_JVMTI_VERIFY(jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_CLASS_FILE_LOAD_HOOK, NULL)))
         return JNI_ERR;
     NSK_DISPLAY0("enabling ClassFileLoadHook event done\n");
 
--- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/ClassFileLoadHook/classfloadhk002/classfloadhk002.cpp	Fri Oct 05 17:01:07 2018 -0400
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/ClassFileLoadHook/classfloadhk002/classfloadhk002.cpp	Tue Oct 09 14:37:59 2018 +0200
@@ -122,7 +122,7 @@
 
     NSK_DISPLAY1("Find static field: %s\n", fieldName);
     if (!NSK_JNI_VERIFY(jni, (fieldID =
-            NSK_CPP_STUB4(GetStaticFieldID, jni, cls, fieldName, fieldSig)) != NULL)) {
+            jni->GetStaticFieldID(cls, fieldName, fieldSig)) != NULL)) {
         nsk_jvmti_setFailStatus();
         return NSK_FALSE;
     }
@@ -130,14 +130,13 @@
 
     NSK_DISPLAY1("Get classfile bytes array from static field: %s\n", fieldName);
     if (!NSK_JNI_VERIFY(jni, (array = (jbyteArray)
-            NSK_CPP_STUB3(GetStaticObjectField, jni, cls, fieldID)) != NULL)) {
+            jni->GetStaticObjectField(cls, fieldID)) != NULL)) {
         nsk_jvmti_setFailStatus();
         return NSK_FALSE;
     }
     NSK_DISPLAY1("  ... got array object: 0x%p\n", (void*)array);
 
-    if (!NSK_JNI_VERIFY(jni, (*size =
-            NSK_CPP_STUB2(GetArrayLength, jni, array)) > 0)) {
+    if (!NSK_JNI_VERIFY(jni, (*size = jni->GetArrayLength(array)) > 0)) {
         nsk_jvmti_setFailStatus();
         return NSK_FALSE;
     }
@@ -145,17 +144,14 @@
 
     {
         jboolean isCopy;
-        if (!NSK_JNI_VERIFY(jni, (elements =
-                NSK_CPP_STUB3(GetByteArrayElements, jni, array,
-                                                            &isCopy)) != NULL)) {
+        if (!NSK_JNI_VERIFY(jni, (elements = jni->GetByteArrayElements(array, &isCopy)) != NULL)) {
             nsk_jvmti_setFailStatus();
         return NSK_FALSE;
         }
     }
     NSK_DISPLAY1("  ... got elements list: 0x%p\n", (void*)elements);
 
-    if (!NSK_JVMTI_VERIFY(
-            NSK_CPP_STUB3(Allocate, jvmti, *size, bytes))) {
+    if (!NSK_JVMTI_VERIFY(jvmti->Allocate(*size, bytes))) {
         nsk_jvmti_setFailStatus();
         return NSK_FALSE;
     }
@@ -167,7 +163,7 @@
     NSK_DISPLAY1("  ... copied bytecode: %d bytes\n", (int)*size);
 
     NSK_DISPLAY1("Release elements list: 0x%p\n", (void*)elements);
-    NSK_TRACE(NSK_CPP_STUB4(ReleaseByteArrayElements, jni, array, elements, JNI_ABORT));
+    NSK_TRACE(jni->ReleaseByteArrayElements(array, elements, JNI_ABORT));
     NSK_DISPLAY0("  ... released\n");
 
     return NSK_TRUE;
@@ -190,7 +186,7 @@
 
             NSK_DISPLAY1("Find debugee class: %s\n", DEBUGEE_CLASS_NAME);
             if (!NSK_JNI_VERIFY(jni, (debugeeClass =
-                    NSK_CPP_STUB2(FindClass, jni, DEBUGEE_CLASS_NAME)) != NULL)) {
+                    jni->FindClass(DEBUGEE_CLASS_NAME)) != NULL)) {
                 nsk_jvmti_setFailStatus();
                 return;
             }
@@ -240,8 +236,7 @@
         NSK_DISPLAY0(">>> Clean used data\n");
         {
             NSK_DISPLAY1("Deallocate bytecode array: 0x%p\n", (void*)origClassBytes);
-            if (!NSK_JVMTI_VERIFY(
-                        NSK_CPP_STUB2(Deallocate, jvmti, origClassBytes))) {
+            if (!NSK_JVMTI_VERIFY(jvmti->Deallocate(origClassBytes))) {
                 nsk_jvmti_setFailStatus();
             }
         }
@@ -318,8 +313,7 @@
 
         memset(&caps, 0, sizeof(caps));
         caps.can_generate_all_class_hook_events = 1;
-        if (!NSK_JVMTI_VERIFY(
-                NSK_CPP_STUB2(AddCapabilities, jvmti, &caps))) {
+        if (!NSK_JVMTI_VERIFY(jvmti->AddCapabilities(&caps))) {
             return JNI_ERR;
         }
     }
@@ -332,8 +326,7 @@
 
         memset(&callbacks, 0, sizeof(callbacks));
         callbacks.ClassFileLoadHook = callbackClassFileLoadHook;
-        if (!NSK_JVMTI_VERIFY(
-                NSK_CPP_STUB3(SetEventCallbacks, jvmti, &callbacks, size))) {
+        if (!NSK_JVMTI_VERIFY(jvmti->SetEventCallbacks(&callbacks, size))) {
             return JNI_ERR;
         }
     }
--- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/ClassFileLoadHook/classfloadhk003/classfloadhk003.cpp	Fri Oct 05 17:01:07 2018 -0400
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/ClassFileLoadHook/classfloadhk003/classfloadhk003.cpp	Tue Oct 09 14:37:59 2018 +0200
@@ -127,7 +127,7 @@
 
     NSK_DISPLAY1("Find static field: %s\n", fieldName);
     if (!NSK_JNI_VERIFY(jni, (fieldID =
-            NSK_CPP_STUB4(GetStaticFieldID, jni, cls, fieldName, fieldSig)) != NULL)) {
+            jni->GetStaticFieldID(cls, fieldName, fieldSig)) != NULL)) {
         nsk_jvmti_setFailStatus();
         return NSK_FALSE;
     }
@@ -135,14 +135,13 @@
 
     NSK_DISPLAY1("Get classfile bytes array from static field: %s\n", fieldName);
     if (!NSK_JNI_VERIFY(jni, (array = (jbyteArray)
-            NSK_CPP_STUB3(GetStaticObjectField, jni, cls, fieldID)) != NULL)) {
+            jni->GetStaticObjectField(cls, fieldID)) != NULL)) {
         nsk_jvmti_setFailStatus();
         return NSK_FALSE;
     }
     NSK_DISPLAY1("  ... got array object: 0x%p\n", (void*)array);
 
-    if (!NSK_JNI_VERIFY(jni, (*size =
-            NSK_CPP_STUB2(GetArrayLength, jni, array)) > 0)) {
+    if (!NSK_JNI_VERIFY(jni, (*size = jni->GetArrayLength(array)) > 0)) {
         nsk_jvmti_setFailStatus();
         return NSK_FALSE;
     }
@@ -150,17 +149,14 @@
 
     {
         jboolean isCopy;
-        if (!NSK_JNI_VERIFY(jni, (elements =
-                NSK_CPP_STUB3(GetByteArrayElements, jni, array,
-                                                            &isCopy)) != NULL)) {
+        if (!NSK_JNI_VERIFY(jni, (elements = jni->GetByteArrayElements(array, &isCopy)) != NULL)) {
             nsk_jvmti_setFailStatus();
         return NSK_FALSE;
         }
     }
     NSK_DISPLAY1("  ... got elements list: 0x%p\n", (void*)elements);
 
-    if (!NSK_JVMTI_VERIFY(
-            NSK_CPP_STUB3(Allocate, jvmti, *size, bytes))) {
+    if (!NSK_JVMTI_VERIFY(jvmti->Allocate(*size, bytes))) {
         nsk_jvmti_setFailStatus();
         return NSK_FALSE;
     }
@@ -172,7 +168,7 @@
     NSK_DISPLAY1("  ... copied bytecode: %d bytes\n", (int)*size);
 
     NSK_DISPLAY1("Release elements list: 0x%p\n", (void*)elements);
-    NSK_TRACE(NSK_CPP_STUB4(ReleaseByteArrayElements, jni, array, elements, JNI_ABORT));
+    NSK_TRACE(jni->ReleaseByteArrayElements(array, elements, JNI_ABORT));
     NSK_DISPLAY0("  ... released\n");
 
     return NSK_TRUE;
@@ -187,23 +183,21 @@
 
     NSK_DISPLAY1("Find static field: %s\n", fieldName);
     if (!NSK_JNI_VERIFY(jni, (fieldID =
-            NSK_CPP_STUB4(GetStaticFieldID, jni, cls, fieldName, fieldSig)) != NULL)) {
+            jni->GetStaticFieldID(cls, fieldName, fieldSig)) != NULL)) {
         nsk_jvmti_setFailStatus();
         return NULL;
     }
     NSK_DISPLAY1("  ... got fieldID: 0x%p\n", (void*)fieldID);
 
     NSK_DISPLAY1("Get object from static field: %s\n", fieldName);
-    if (!NSK_JNI_VERIFY(jni, (obj =
-            NSK_CPP_STUB3(GetStaticObjectField, jni, cls, fieldID)) != NULL)) {
+    if (!NSK_JNI_VERIFY(jni, (obj = jni->GetStaticObjectField(cls, fieldID)) != NULL)) {
         nsk_jvmti_setFailStatus();
         return NULL;
     }
     NSK_DISPLAY1("  ... got object: 0x%p\n", (void*)obj);
 
     NSK_DISPLAY1("Make global reference to object: 0x%p\n", obj);
-    if (!NSK_JNI_VERIFY(jni, (obj =
-            NSK_CPP_STUB2(NewGlobalRef, jni, obj)) != NULL)) {
+    if (!NSK_JNI_VERIFY(jni, (obj = jni->NewGlobalRef(obj)) != NULL)) {
         nsk_jvmti_setFailStatus();
         return NULL;
     }
@@ -229,7 +223,7 @@
             NSK_DISPLAY0(">>> Obtain debuggee class\n");
             NSK_DISPLAY1("Find debugee class: %s\n", DEBUGEE_CLASS_NAME);
             if (!NSK_JNI_VERIFY(jni, (debugeeClass =
-                    NSK_CPP_STUB2(FindClass, jni, DEBUGEE_CLASS_NAME)) != NULL)) {
+                    jni->FindClass(DEBUGEE_CLASS_NAME)) != NULL)) {
                 nsk_jvmti_setFailStatus();
                 return;
             }
@@ -286,11 +280,10 @@
         NSK_DISPLAY0(">>> Clean used data\n");
         {
             NSK_DISPLAY1("Delete global reference to classloader object: 0x%p\n", (void*)classLoader);
-            NSK_CPP_STUB2(DeleteGlobalRef, jni, classLoader);
+            jni->DeleteGlobalRef(classLoader);
 
             NSK_DISPLAY1("Deallocate classfile bytes array: 0x%p\n", (void*)origClassBytes);
-            if (!NSK_JVMTI_VERIFY(
-                        NSK_CPP_STUB2(Deallocate, jvmti, origClassBytes))) {
+            if (!NSK_JVMTI_VERIFY(jvmti->Deallocate(origClassBytes))) {
                 nsk_jvmti_setFailStatus();
             }
         }
@@ -331,7 +324,7 @@
             NSK_COMPLAIN1("Unexpected NULL classloader in CLASS_FILE_LOAD_HOOK: 0x%p\n",
                                                     (void*)loader);
             nsk_jvmti_setFailStatus();
-        } else if (!NSK_CPP_STUB3(IsSameObject, jni, loader, classLoader)) {
+        } else if (!jni->IsSameObject(loader, classLoader)) {
             NSK_COMPLAIN2("Unexpected classloader in CLASS_FILE_LOAD_HOOK for tested class:\n"
                           "#   got classloder:   0x%p\n"
                           "#   expected same as: 0x%p\n",
@@ -380,8 +373,7 @@
 
         memset(&caps, 0, sizeof(caps));
         caps.can_generate_all_class_hook_events = 1;
-        if (!NSK_JVMTI_VERIFY(
-                NSK_CPP_STUB2(AddCapabilities, jvmti, &caps))) {
+        if (!NSK_JVMTI_VERIFY(jvmti->AddCapabilities(&caps))) {
             return JNI_ERR;
         }
     }
@@ -394,8 +386,7 @@
 
         memset(&callbacks, 0, sizeof(callbacks));
         callbacks.ClassFileLoadHook = callbackClassFileLoadHook;
-        if (!NSK_JVMTI_VERIFY(
-                NSK_CPP_STUB3(SetEventCallbacks, jvmti, &callbacks, size))) {
+        if (!NSK_JVMTI_VERIFY(jvmti->SetEventCallbacks(&callbacks, size))) {
             return JNI_ERR;
         }
     }
--- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/ClassFileLoadHook/classfloadhk004/classfloadhk004.cpp	Fri Oct 05 17:01:07 2018 -0400
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/ClassFileLoadHook/classfloadhk004/classfloadhk004.cpp	Tue Oct 09 14:37:59 2018 +0200
@@ -61,7 +61,7 @@
 
     NSK_DISPLAY1("Find static field: %s\n", fieldName);
     if (!NSK_JNI_VERIFY(jni, (fieldID =
-            NSK_CPP_STUB4(GetStaticFieldID, jni, cls, fieldName, fieldSig)) != NULL)) {
+            jni->GetStaticFieldID(cls, fieldName, fieldSig)) != NULL)) {
         nsk_jvmti_setFailStatus();
         return NSK_FALSE;
     }
@@ -69,14 +69,13 @@
 
     NSK_DISPLAY1("Get classfile bytes array from static field: %s\n", fieldName);
     if (!NSK_JNI_VERIFY(jni, (array = (jbyteArray)
-            NSK_CPP_STUB3(GetStaticObjectField, jni, cls, fieldID)) != NULL)) {
+            jni->GetStaticObjectField(cls, fieldID)) != NULL)) {
         nsk_jvmti_setFailStatus();
         return NSK_FALSE;
     }
     NSK_DISPLAY1("  ... got array object: 0x%p\n", (void*)array);
 
-    if (!NSK_JNI_VERIFY(jni, (*size =
-            NSK_CPP_STUB2(GetArrayLength, jni, array)) > 0)) {
+    if (!NSK_JNI_VERIFY(jni, (*size = jni->GetArrayLength(array)) > 0)) {
         nsk_jvmti_setFailStatus();
         return NSK_FALSE;
     }
@@ -84,17 +83,14 @@
 
     {
         jboolean isCopy;
-        if (!NSK_JNI_VERIFY(jni, (elements =
-                NSK_CPP_STUB3(GetByteArrayElements, jni, array,
-                                                            &isCopy)) != NULL)) {
+        if (!NSK_JNI_VERIFY(jni, (elements = jni->GetByteArrayElements(array, &isCopy)) != NULL)) {
             nsk_jvmti_setFailStatus();
         return NSK_FALSE;
         }
     }
     NSK_DISPLAY1("  ... got elements list: 0x%p\n", (void*)elements);
 
-    if (!NSK_JVMTI_VERIFY(
-            NSK_CPP_STUB3(Allocate, jvmti, *size, bytes))) {
+    if (!NSK_JVMTI_VERIFY(jvmti->Allocate(*size, bytes))) {
         nsk_jvmti_setFailStatus();
         return NSK_FALSE;
     }
@@ -106,7 +102,7 @@
     NSK_DISPLAY1("  ... copied bytecode: %d bytes\n", (int)*size);
 
     NSK_DISPLAY1("Release elements list: 0x%p\n", (void*)elements);
-    NSK_TRACE(NSK_CPP_STUB4(ReleaseByteArrayElements, jni, array, elements, JNI_ABORT));
+    NSK_TRACE(jni->ReleaseByteArrayElements(array, elements, JNI_ABORT));
     NSK_DISPLAY0("  ... released\n");
 
     return NSK_TRUE;
@@ -129,7 +125,7 @@
 
             NSK_DISPLAY1("Find debugee class: %s\n", DEBUGEE_CLASS_NAME);
             if (!NSK_JNI_VERIFY(jni, (debugeeClass =
-                    NSK_CPP_STUB2(FindClass, jni, DEBUGEE_CLASS_NAME)) != NULL)) {
+                    jni->FindClass(DEBUGEE_CLASS_NAME)) != NULL)) {
                 nsk_jvmti_setFailStatus();
                 return;
             }
@@ -271,8 +267,7 @@
 
         memset(&caps, 0, sizeof(caps));
         caps.can_generate_all_class_hook_events = 1;
-        if (!NSK_JVMTI_VERIFY(
-                NSK_CPP_STUB2(AddCapabilities, jvmti, &caps))) {
+        if (!NSK_JVMTI_VERIFY(jvmti->AddCapabilities(&caps))) {
             return JNI_ERR;
         }
     }
@@ -285,8 +280,7 @@
 
         memset(&callbacks, 0, sizeof(callbacks));
         callbacks.ClassFileLoadHook = callbackClassFileLoadHook;
-        if (!NSK_JVMTI_VERIFY(
-                NSK_CPP_STUB3(SetEventCallbacks, jvmti, &callbacks, size))) {
+        if (!NSK_JVMTI_VERIFY(jvmti->SetEventCallbacks(&callbacks, size))) {
             return JNI_ERR;
         }
     }
--- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/ClassFileLoadHook/classfloadhk005/classfloadhk005.cpp	Fri Oct 05 17:01:07 2018 -0400
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/ClassFileLoadHook/classfloadhk005/classfloadhk005.cpp	Tue Oct 09 14:37:59 2018 +0200
@@ -123,7 +123,7 @@
 
     NSK_DISPLAY1("Find static field: %s\n", fieldName);
     if (!NSK_JNI_VERIFY(jni, (fieldID =
-            NSK_CPP_STUB4(GetStaticFieldID, jni, cls, fieldName, fieldSig)) != NULL)) {
+            jni->GetStaticFieldID(cls, fieldName, fieldSig)) != NULL)) {
         nsk_jvmti_setFailStatus();
         return NSK_FALSE;
     }
@@ -131,14 +131,13 @@
 
     NSK_DISPLAY1("Get classfile bytes array from static field: %s\n", fieldName);
     if (!NSK_JNI_VERIFY(jni, (array = (jbyteArray)
-            NSK_CPP_STUB3(GetStaticObjectField, jni, cls, fieldID)) != NULL)) {
+            jni->GetStaticObjectField(cls, fieldID)) != NULL)) {
         nsk_jvmti_setFailStatus();
         return NSK_FALSE;
     }
     NSK_DISPLAY1("  ... got array object: 0x%p\n", (void*)array);
 
-    if (!NSK_JNI_VERIFY(jni, (*size =
-            NSK_CPP_STUB2(GetArrayLength, jni, array)) > 0)) {
+    if (!NSK_JNI_VERIFY(jni, (*size = jni->GetArrayLength(array)) > 0)) {
         nsk_jvmti_setFailStatus();
         return NSK_FALSE;
     }
@@ -146,17 +145,14 @@
 
     {
         jboolean isCopy;
-        if (!NSK_JNI_VERIFY(jni, (elements =
-                NSK_CPP_STUB3(GetByteArrayElements, jni, array,
-                                                            &isCopy)) != NULL)) {
+        if (!NSK_JNI_VERIFY(jni, (elements = jni->GetByteArrayElements(array, &isCopy)) != NULL)) {
             nsk_jvmti_setFailStatus();
         return NSK_FALSE;
         }
     }
     NSK_DISPLAY1("  ... got elements list: 0x%p\n", (void*)elements);
 
-    if (!NSK_JVMTI_VERIFY(
-            NSK_CPP_STUB3(Allocate, jvmti, *size, bytes))) {
+    if (!NSK_JVMTI_VERIFY(jvmti->Allocate(*size, bytes))) {
         nsk_jvmti_setFailStatus();
         return NSK_FALSE;
     }
@@ -168,7 +164,7 @@
     NSK_DISPLAY1("  ... copied bytecode: %d bytes\n", (int)*size);
 
     NSK_DISPLAY1("Release elements list: 0x%p\n", (void*)elements);
-    NSK_TRACE(NSK_CPP_STUB4(ReleaseByteArrayElements, jni, array, elements, JNI_ABORT));
+    NSK_TRACE(jni->ReleaseByteArrayElements(array, elements, JNI_ABORT));
     NSK_DISPLAY0("  ... released\n");
 
     return NSK_TRUE;
@@ -191,7 +187,7 @@
 
             NSK_DISPLAY1("Find debugee class: %s\n", DEBUGEE_CLASS_NAME);
             if (!NSK_JNI_VERIFY(jni, (debugeeClass =
-                    NSK_CPP_STUB2(FindClass, jni, DEBUGEE_CLASS_NAME)) != NULL)) {
+                    jni->FindClass(DEBUGEE_CLASS_NAME)) != NULL)) {
                 nsk_jvmti_setFailStatus();
                 return;
             }
@@ -333,8 +329,7 @@
 
         memset(&caps, 0, sizeof(caps));
         caps.can_generate_all_class_hook_events = 1;
-        if (!NSK_JVMTI_VERIFY(
-                NSK_CPP_STUB2(AddCapabilities, jvmti, &caps))) {
+        if (!NSK_JVMTI_VERIFY(jvmti->AddCapabilities(&caps))) {
             return JNI_ERR;
         }
     }
@@ -347,8 +342,7 @@
 
         memset(&callbacks, 0, sizeof(callbacks));
         callbacks.ClassFileLoadHook = callbackClassFileLoadHook;
-        if (!NSK_JVMTI_VERIFY(
-                NSK_CPP_STUB3(SetEventCallbacks, jvmti, &callbacks, size))) {
+        if (!NSK_JVMTI_VERIFY(jvmti->SetEventCallbacks(&callbacks, size))) {
             return JNI_ERR;
         }
     }
--- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/ClassFileLoadHook/classfloadhk006/classfloadhk006.cpp	Fri Oct 05 17:01:07 2018 -0400
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/ClassFileLoadHook/classfloadhk006/classfloadhk006.cpp	Tue Oct 09 14:37:59 2018 +0200
@@ -128,7 +128,7 @@
 
     NSK_DISPLAY1("Find static field: %s\n", fieldName);
     if (!NSK_JNI_VERIFY(jni, (fieldID =
-            NSK_CPP_STUB4(GetStaticFieldID, jni, cls, fieldName, fieldSig)) != NULL)) {
+            jni->GetStaticFieldID(cls, fieldName, fieldSig)) != NULL)) {
         nsk_jvmti_setFailStatus();
         return NSK_FALSE;
     }
@@ -136,14 +136,13 @@
 
     NSK_DISPLAY1("Get classfile bytes array from static field: %s\n", fieldName);
     if (!NSK_JNI_VERIFY(jni, (array = (jbyteArray)
-            NSK_CPP_STUB3(GetStaticObjectField, jni, cls, fieldID)) != NULL)) {
+            jni->GetStaticObjectField(cls, fieldID)) != NULL)) {
         nsk_jvmti_setFailStatus();
         return NSK_FALSE;
     }
     NSK_DISPLAY1("  ... got array object: 0x%p\n", (void*)array);
 
-    if (!NSK_JNI_VERIFY(jni, (*size =
-            NSK_CPP_STUB2(GetArrayLength, jni, array)) > 0)) {
+    if (!NSK_JNI_VERIFY(jni, (*size = jni->GetArrayLength(array)) > 0)) {
         nsk_jvmti_setFailStatus();
         return NSK_FALSE;
     }
@@ -151,17 +150,14 @@
 
     {
         jboolean isCopy;
-        if (!NSK_JNI_VERIFY(jni, (elements =
-                NSK_CPP_STUB3(GetByteArrayElements, jni, array,
-                                                            &isCopy)) != NULL)) {
+        if (!NSK_JNI_VERIFY(jni, (elements = jni->GetByteArrayElements(array, &isCopy)) != NULL)) {
             nsk_jvmti_setFailStatus();
         return NSK_FALSE;
         }
     }
     NSK_DISPLAY1("  ... got elements list: 0x%p\n", (void*)elements);
 
-    if (!NSK_JVMTI_VERIFY(
-            NSK_CPP_STUB3(Allocate, jvmti, *size, bytes))) {
+    if (!NSK_JVMTI_VERIFY(jvmti->Allocate(*size, bytes))) {
         nsk_jvmti_setFailStatus();
         return NSK_FALSE;
     }
@@ -173,7 +169,7 @@
     NSK_DISPLAY1("  ... copied bytecode: %d bytes\n", (int)*size);
 
     NSK_DISPLAY1("Release elements list: 0x%p\n", (void*)elements);
-    NSK_TRACE(NSK_CPP_STUB4(ReleaseByteArrayElements, jni, array, elements, JNI_ABORT));
+    NSK_TRACE(jni->ReleaseByteArrayElements(array, elements, JNI_ABORT));
     NSK_DISPLAY0("  ... released\n");
 
     return NSK_TRUE;
@@ -188,23 +184,21 @@
 
     NSK_DISPLAY1("Find static field: %s\n", fieldName);
     if (!NSK_JNI_VERIFY(jni, (fieldID =
-            NSK_CPP_STUB4(GetStaticFieldID, jni, cls, fieldName, fieldSig)) != NULL)) {
+            jni->GetStaticFieldID(cls, fieldName, fieldSig)) != NULL)) {
         nsk_jvmti_setFailStatus();
         return NULL;
     }
     NSK_DISPLAY1("  ... got fieldID: 0x%p\n", (void*)fieldID);
 
     NSK_DISPLAY1("Get object from static field: %s\n", fieldName);
-    if (!NSK_JNI_VERIFY(jni, (obj =
-            NSK_CPP_STUB3(GetStaticObjectField, jni, cls, fieldID)) != NULL)) {
+    if (!NSK_JNI_VERIFY(jni, (obj = jni->GetStaticObjectField(cls, fieldID)) != NULL)) {
         nsk_jvmti_setFailStatus();
         return NULL;
     }
     NSK_DISPLAY1("  ... got object: 0x%p\n", (void*)obj);
 
     NSK_DISPLAY1("Make global reference to object: 0x%p\n", obj);
-    if (!NSK_JNI_VERIFY(jni, (obj =
-            NSK_CPP_STUB2(NewGlobalRef, jni, obj)) != NULL)) {
+    if (!NSK_JNI_VERIFY(jni, (obj = jni->NewGlobalRef(obj)) != NULL)) {
         nsk_jvmti_setFailStatus();
         return NULL;
     }
@@ -223,8 +217,7 @@
     classDef.class_bytes = bytes;
 
     NSK_DISPLAY1("Redefine class: %s\n", className);
-    if (!NSK_JVMTI_VERIFY(
-            NSK_CPP_STUB3(RedefineClasses, jvmti, 1, &classDef))) {
+    if (!NSK_JVMTI_VERIFY(jvmti->RedefineClasses(1, &classDef))) {
         nsk_jvmti_setFailStatus();
         return NSK_FALSE;
     }
@@ -250,7 +243,7 @@
             NSK_DISPLAY0(">>> Obtain debuggee class\n");
             NSK_DISPLAY1("Find debugee class: %s\n", DEBUGEE_CLASS_NAME);
             if (!NSK_JNI_VERIFY(jni, (debugeeClass =
-                    NSK_CPP_STUB2(FindClass, jni, DEBUGEE_CLASS_NAME)) != NULL)) {
+                    jni->FindClass(DEBUGEE_CLASS_NAME)) != NULL)) {
                 nsk_jvmti_setFailStatus();
                 return;
             }
@@ -309,11 +302,10 @@
         NSK_DISPLAY0(">>> Clean used data\n");
         {
             NSK_DISPLAY1("Delete global reference to tested class object: 0x%p\n", (void*)testedClass);
-            NSK_CPP_STUB2(DeleteGlobalRef, jni, testedClass);
+            jni->DeleteGlobalRef(testedClass);
 
             NSK_DISPLAY1("Deallocate redefined bytecode array: 0x%p\n", (void*)redefClassBytes);
-            if (!NSK_JVMTI_VERIFY(
-                        NSK_CPP_STUB2(Deallocate, jvmti, redefClassBytes))) {
+            if (!NSK_JVMTI_VERIFY(jvmti->Deallocate(redefClassBytes))) {
                 nsk_jvmti_setFailStatus();
             }
         }
@@ -347,7 +339,7 @@
             NSK_COMPLAIN1("Unexpected NULL class_being_redefined in CLASS_FILE_LOAD_HOOK: 0x%p\n",
                                                     (void*)class_being_redefined);
             nsk_jvmti_setFailStatus();
-        } else if (!NSK_CPP_STUB3(IsSameObject, jni, class_being_redefined, testedClass)) {
+        } else if (!jni->IsSameObject(class_being_redefined, testedClass)) {
             NSK_COMPLAIN2("Unexpected class_being_redefined in CLASS_FILE_LOAD_HOOK:\n"
                           "#   got class:        0x%p\n"
                           "#   expected same as: 0x%p\n",
@@ -397,8 +389,7 @@
         memset(&caps, 0, sizeof(caps));
         caps.can_generate_all_class_hook_events = 1;
         caps.can_redefine_classes = 1;
-        if (!NSK_JVMTI_VERIFY(
-                NSK_CPP_STUB2(AddCapabilities, jvmti, &caps))) {
+        if (!NSK_JVMTI_VERIFY(jvmti->AddCapabilities(&caps))) {
             return JNI_ERR;
         }
     }
@@ -411,8 +402,7 @@
 
         memset(&callbacks, 0, sizeof(callbacks));
         callbacks.ClassFileLoadHook = callbackClassFileLoadHook;
-        if (!NSK_JVMTI_VERIFY(
-                NSK_CPP_STUB3(SetEventCallbacks, jvmti, &callbacks, size))) {
+        if (!NSK_JVMTI_VERIFY(jvmti->SetEventCallbacks(&callbacks, size))) {
             return JNI_ERR;
         }
     }
--- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/ClassFileLoadHook/classfloadhk007/classfloadhk007.cpp	Fri Oct 05 17:01:07 2018 -0400
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/ClassFileLoadHook/classfloadhk007/classfloadhk007.cpp	Tue Oct 09 14:37:59 2018 +0200
@@ -132,7 +132,7 @@
 
     NSK_DISPLAY1("Find static field: %s\n", fieldName);
     if (!NSK_JNI_VERIFY(jni, (fieldID =
-            NSK_CPP_STUB4(GetStaticFieldID, jni, cls, fieldName, fieldSig)) != NULL)) {
+            jni->GetStaticFieldID(cls, fieldName, fieldSig)) != NULL)) {
         nsk_jvmti_setFailStatus();
         return NSK_FALSE;
     }
@@ -140,14 +140,13 @@
 
     NSK_DISPLAY1("Get classfile bytes array from static field: %s\n", fieldName);
     if (!NSK_JNI_VERIFY(jni, (array = (jbyteArray)
-            NSK_CPP_STUB3(GetStaticObjectField, jni, cls, fieldID)) != NULL)) {
+            jni->GetStaticObjectField(cls, fieldID)) != NULL)) {
         nsk_jvmti_setFailStatus();
         return NSK_FALSE;
     }
     NSK_DISPLAY1("  ... got array object: 0x%p\n", (void*)array);
 
-    if (!NSK_JNI_VERIFY(jni, (*size =
-            NSK_CPP_STUB2(GetArrayLength, jni, array)) > 0)) {
+    if (!NSK_JNI_VERIFY(jni, (*size = jni->GetArrayLength(array)) > 0)) {
         nsk_jvmti_setFailStatus();
         return NSK_FALSE;
     }
@@ -155,17 +154,14 @@
 
     {
         jboolean isCopy;
-        if (!NSK_JNI_VERIFY(jni, (elements =
-                NSK_CPP_STUB3(GetByteArrayElements, jni, array,
-                                                            &isCopy)) != NULL)) {
+        if (!NSK_JNI_VERIFY(jni, (elements = jni->GetByteArrayElements(array, &isCopy)) != NULL)) {
             nsk_jvmti_setFailStatus();
         return NSK_FALSE;
         }
     }
     NSK_DISPLAY1("  ... got elements list: 0x%p\n", (void*)elements);
 
-    if (!NSK_JVMTI_VERIFY(
-            NSK_CPP_STUB3(Allocate, jvmti, *size, bytes))) {
+    if (!NSK_JVMTI_VERIFY(jvmti->Allocate(*size, bytes))) {
         nsk_jvmti_setFailStatus();
         return NSK_FALSE;
     }
@@ -177,7 +173,7 @@
     NSK_DISPLAY1("  ... copied bytecode: %d bytes\n", (int)*size);
 
     NSK_DISPLAY1("Release elements list: 0x%p\n", (void*)elements);
-    NSK_TRACE(NSK_CPP_STUB4(ReleaseByteArrayElements, jni, array, elements, JNI_ABORT));
+    NSK_TRACE(jni->ReleaseByteArrayElements(array, elements, JNI_ABORT));
     NSK_DISPLAY0("  ... released\n");
 
     return NSK_TRUE;
@@ -192,23 +188,21 @@
 
     NSK_DISPLAY1("Find static field: %s\n", fieldName);
     if (!NSK_JNI_VERIFY(jni, (fieldID =
-            NSK_CPP_STUB4(GetStaticFieldID, jni, cls, fieldName, fieldSig)) != NULL)) {
+            jni->GetStaticFieldID(cls, fieldName, fieldSig)) != NULL)) {
         nsk_jvmti_setFailStatus();
         return NULL;
     }
     NSK_DISPLAY1("  ... got fieldID: 0x%p\n", (void*)fieldID);
 
     NSK_DISPLAY1("Get object from static field: %s\n", fieldName);
-    if (!NSK_JNI_VERIFY(jni, (obj =
-            NSK_CPP_STUB3(GetStaticObjectField, jni, cls, fieldID)) != NULL)) {
+    if (!NSK_JNI_VERIFY(jni, (obj = jni->GetStaticObjectField(cls, fieldID)) != NULL)) {
         nsk_jvmti_setFailStatus();
         return NULL;
     }
     NSK_DISPLAY1("  ... got object: 0x%p\n", (void*)obj);
 
     NSK_DISPLAY1("Make global reference to object: 0x%p\n", obj);
-    if (!NSK_JNI_VERIFY(jni, (obj =
-            NSK_CPP_STUB2(NewGlobalRef, jni, obj)) != NULL)) {
+    if (!NSK_JNI_VERIFY(jni, (obj = jni->NewGlobalRef(obj)) != NULL)) {
         nsk_jvmti_setFailStatus();
         return NULL;
     }
@@ -227,8 +221,7 @@
     classDef.class_bytes = bytes;
 
     NSK_DISPLAY1("Redefine class: %s\n", className);
-    if (!NSK_JVMTI_VERIFY(
-            NSK_CPP_STUB3(RedefineClasses, jvmti, 1, &classDef))) {
+    if (!NSK_JVMTI_VERIFY(jvmti->RedefineClasses(1, &classDef))) {
         nsk_jvmti_setFailStatus();
         return NSK_FALSE;
     }
@@ -254,7 +247,7 @@
             NSK_DISPLAY0(">>> Obtain debuggee class\n");
             NSK_DISPLAY1("Find debugee class: %s\n", DEBUGEE_CLASS_NAME);
             if (!NSK_JNI_VERIFY(jni, (debugeeClass =
-                    NSK_CPP_STUB2(FindClass, jni, DEBUGEE_CLASS_NAME)) != NULL)) {
+                    jni->FindClass(DEBUGEE_CLASS_NAME)) != NULL)) {
                 nsk_jvmti_setFailStatus();
                 return;
             }
@@ -319,14 +312,13 @@
         NSK_DISPLAY0(">>> Clean used data\n");
         {
             NSK_DISPLAY1("Delete global reference to classloader object: 0x%p\n", (void*)classLoader);
-            NSK_CPP_STUB2(DeleteGlobalRef, jni, classLoader);
+            jni->DeleteGlobalRef(classLoader);
 
             NSK_DISPLAY1("Delete global reference to tested class object: 0x%p\n", (void*)testedClass);
-            NSK_CPP_STUB2(DeleteGlobalRef, jni, testedClass);
+            jni->DeleteGlobalRef(testedClass);
 
             NSK_DISPLAY1("Deallocate redefined bytecode array: 0x%p\n", (void*)redefClassBytes);
-            if (!NSK_JVMTI_VERIFY(
-                        NSK_CPP_STUB2(Deallocate, jvmti, redefClassBytes))) {
+            if (!NSK_JVMTI_VERIFY(jvmti->Deallocate(redefClassBytes))) {
                 nsk_jvmti_setFailStatus();
             }
         }
@@ -360,7 +352,7 @@
             NSK_COMPLAIN1("Unexpected NULL classloader in CLASS_FILE_LOAD_HOOK: 0x%p\n",
                                                     (void*)loader);
             nsk_jvmti_setFailStatus();
-        } else if (!NSK_CPP_STUB3(IsSameObject, jni, loader, classLoader)) {
+        } else if (!jni->IsSameObject(loader, classLoader)) {
             NSK_COMPLAIN2("Unexpected classloader in CLASS_FILE_LOAD_HOOK:\n"
                           "#   got classloder:   0x%p\n"
                           "#   expected same as: 0x%p\n",
@@ -373,7 +365,7 @@
             NSK_COMPLAIN1("Unexpected NULL class_being_redefined in CLASS_FILE_LOAD_HOOK: 0x%p\n",
                                                     (void*)class_being_redefined);
             nsk_jvmti_setFailStatus();
-        } else if (!NSK_CPP_STUB3(IsSameObject, jni, class_being_redefined, testedClass)) {
+        } else if (!jni->IsSameObject(class_being_redefined, testedClass)) {
             NSK_COMPLAIN2("Unexpected class_being_redefined in CLASS_FILE_LOAD_HOOK:\n"
                           "#   got class:        0x%p\n"
                           "#   expected same as: 0x%p\n",
@@ -423,8 +415,7 @@
         memset(&caps, 0, sizeof(caps));
         caps.can_generate_all_class_hook_events = 1;
         caps.can_redefine_classes = 1;
-        if (!NSK_JVMTI_VERIFY(
-                NSK_CPP_STUB2(AddCapabilities, jvmti, &caps))) {
+        if (!NSK_JVMTI_VERIFY(jvmti->AddCapabilities(&caps))) {
             return JNI_ERR;
         }
     }
@@ -437,8 +428,7 @@
 
         memset(&callbacks, 0, sizeof(callbacks));
         callbacks.ClassFileLoadHook = callbackClassFileLoadHook;
-        if (!NSK_JVMTI_VERIFY(
-                NSK_CPP_STUB3(SetEventCallbacks, jvmti, &callbacks, size))) {
+        if (!NSK_JVMTI_VERIFY(jvmti->SetEventCallbacks(&callbacks, size))) {
             return JNI_ERR;
         }
     }
--- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/ClassFileLoadHook/classfloadhk008/classfloadhk008.cpp	Fri Oct 05 17:01:07 2018 -0400
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/ClassFileLoadHook/classfloadhk008/classfloadhk008.cpp	Tue Oct 09 14:37:59 2018 +0200
@@ -70,7 +70,7 @@
 
     NSK_DISPLAY1("Find static field: %s\n", fieldName);
     if (!NSK_JNI_VERIFY(jni, (fieldID =
-            NSK_CPP_STUB4(GetStaticFieldID, jni, cls, fieldName, fieldSig)) != NULL)) {
+            jni->GetStaticFieldID(cls, fieldName, fieldSig)) != NULL)) {
         nsk_jvmti_setFailStatus();
         return NSK_FALSE;
     }
@@ -78,14 +78,13 @@
 
     NSK_DISPLAY1("Get classfile bytes array from static field: %s\n", fieldName);
     if (!NSK_JNI_VERIFY(jni, (array = (jbyteArray)
-            NSK_CPP_STUB3(GetStaticObjectField, jni, cls, fieldID)) != NULL)) {
+            jni->GetStaticObjectField(cls, fieldID)) != NULL)) {
         nsk_jvmti_setFailStatus();
         return NSK_FALSE;
     }
     NSK_DISPLAY1("  ... got array object: 0x%p\n", (void*)array);
 
-    if (!NSK_JNI_VERIFY(jni, (*size =
-            NSK_CPP_STUB2(GetArrayLength, jni, array)) > 0)) {
+    if (!NSK_JNI_VERIFY(jni, (*size = jni->GetArrayLength(array)) > 0)) {
         nsk_jvmti_setFailStatus();
         return NSK_FALSE;
     }
@@ -93,17 +92,14 @@
 
     {
         jboolean isCopy;
-        if (!NSK_JNI_VERIFY(jni, (elements =
-                NSK_CPP_STUB3(GetByteArrayElements, jni, array,
-                                                            &isCopy)) != NULL)) {
+        if (!NSK_JNI_VERIFY(jni, (elements = jni->GetByteArrayElements(array, &isCopy)) != NULL)) {
             nsk_jvmti_setFailStatus();
         return NSK_FALSE;
         }
     }
     NSK_DISPLAY1("  ... got elements list: 0x%p\n", (void*)elements);
 
-    if (!NSK_JVMTI_VERIFY(
-            NSK_CPP_STUB3(Allocate, jvmti, *size, bytes))) {
+    if (!NSK_JVMTI_VERIFY(jvmti->Allocate(*size, bytes))) {
         nsk_jvmti_setFailStatus();
         return NSK_FALSE;
     }
@@ -115,7 +111,7 @@
     NSK_DISPLAY1("  ... copied bytecode: %d bytes\n", (int)*size);
 
     NSK_DISPLAY1("Release elements list: 0x%p\n", (void*)elements);
-    NSK_TRACE(NSK_CPP_STUB4(ReleaseByteArrayElements, jni, array, elements, JNI_ABORT));
+    NSK_TRACE(jni->ReleaseByteArrayElements(array, elements, JNI_ABORT));
     NSK_DISPLAY0("  ... released\n");
 
     return NSK_TRUE;
@@ -130,23 +126,21 @@
 
     NSK_DISPLAY1("Find static field: %s\n", fieldName);
     if (!NSK_JNI_VERIFY(jni, (fieldID =
-            NSK_CPP_STUB4(GetStaticFieldID, jni, cls, fieldName, fieldSig)) != NULL)) {
+            jni->GetStaticFieldID(cls, fieldName, fieldSig)) != NULL)) {
         nsk_jvmti_setFailStatus();
         return NULL;
     }
     NSK_DISPLAY1("  ... got fieldID: 0x%p\n", (void*)fieldID);
 
     NSK_DISPLAY1("Get object from static field: %s\n", fieldName);
-    if (!NSK_JNI_VERIFY(jni, (obj =
-            NSK_CPP_STUB3(GetStaticObjectField, jni, cls, fieldID)) != NULL)) {
+    if (!NSK_JNI_VERIFY(jni, (obj = jni->GetStaticObjectField(cls, fieldID)) != NULL)) {
         nsk_jvmti_setFailStatus();
         return NULL;
     }
     NSK_DISPLAY1("  ... got object: 0x%p\n", (void*)obj);
 
     NSK_DISPLAY1("Make global reference to object: 0x%p\n", obj);
-    if (!NSK_JNI_VERIFY(jni, (obj =
-            NSK_CPP_STUB2(NewGlobalRef, jni, obj)) != NULL)) {
+    if (!NSK_JNI_VERIFY(jni, (obj = jni->NewGlobalRef(obj)) != NULL)) {
         nsk_jvmti_setFailStatus();
         return NULL;
     }
@@ -165,8 +159,7 @@
     classDef.class_bytes = bytes;
 
     NSK_DISPLAY1("Redefine class: %s\n", className);
-    if (!NSK_JVMTI_VERIFY(
-            NSK_CPP_STUB3(RedefineClasses, jvmti, 1, &classDef))) {
+    if (!NSK_JVMTI_VERIFY(jvmti->RedefineClasses(1, &classDef))) {
         nsk_jvmti_setFailStatus();
         return NSK_FALSE;
     }
@@ -192,7 +185,7 @@
             NSK_DISPLAY0(">>> Obtain debuggee class\n");
             NSK_DISPLAY1("Find debugee class: %s\n", DEBUGEE_CLASS_NAME);
             if (!NSK_JNI_VERIFY(jni, (debugeeClass =
-                    NSK_CPP_STUB2(FindClass, jni, DEBUGEE_CLASS_NAME)) != NULL)) {
+                    jni->FindClass(DEBUGEE_CLASS_NAME)) != NULL)) {
                 nsk_jvmti_setFailStatus();
                 return;
             }
@@ -258,11 +251,10 @@
         NSK_DISPLAY0(">>> Clean used data\n");
         {
             NSK_DISPLAY1("Delete global reference to tested class object: 0x%p\n", (void*)testedClass);
-            NSK_CPP_STUB2(DeleteGlobalRef, jni, testedClass);
+            jni->DeleteGlobalRef(testedClass);
 
             NSK_DISPLAY1("Deallocate redefined bytecode array: 0x%p\n", (void*)redefClassBytes);
-            if (!NSK_JVMTI_VERIFY(
-                        NSK_CPP_STUB2(Deallocate, jvmti, redefClassBytes))) {
+            if (!NSK_JVMTI_VERIFY(jvmti->Deallocate(redefClassBytes))) {
                 nsk_jvmti_setFailStatus();
             }
         }
@@ -359,8 +351,7 @@
         memset(&caps, 0, sizeof(caps));
         caps.can_generate_all_class_hook_events = 1;
         caps.can_redefine_classes = 1;
-        if (!NSK_JVMTI_VERIFY(
-                NSK_CPP_STUB2(AddCapabilities, jvmti, &caps))) {
+        if (!NSK_JVMTI_VERIFY(jvmti->AddCapabilities(&caps))) {
             return JNI_ERR;
         }
     }
@@ -373,8 +364,7 @@
 
         memset(&callbacks, 0, sizeof(callbacks));
         callbacks.ClassFileLoadHook = callbackClassFileLoadHook;
-        if (!NSK_JVMTI_VERIFY(
-                NSK_CPP_STUB3(SetEventCallbacks, jvmti, &callbacks, size))) {
+        if (!NSK_JVMTI_VERIFY(jvmti->SetEventCallbacks(&callbacks, size))) {
             return JNI_ERR;
         }
     }
--- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/ClassFileLoadHook/classfloadhk009/classfloadhk009.cpp	Fri Oct 05 17:01:07 2018 -0400
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/ClassFileLoadHook/classfloadhk009/classfloadhk009.cpp	Tue Oct 09 14:37:59 2018 +0200
@@ -70,7 +70,7 @@
 
     NSK_DISPLAY1("Find static field: %s\n", fieldName);
     if (!NSK_JNI_VERIFY(jni, (fieldID =
-            NSK_CPP_STUB4(GetStaticFieldID, jni, cls, fieldName, fieldSig)) != NULL)) {
+            jni->GetStaticFieldID(cls, fieldName, fieldSig)) != NULL)) {
         nsk_jvmti_setFailStatus();
         return NSK_FALSE;
     }
@@ -78,14 +78,13 @@
 
     NSK_DISPLAY1("Get classfile bytes array from static field: %s\n", fieldName);
     if (!NSK_JNI_VERIFY(jni, (array = (jbyteArray)
-            NSK_CPP_STUB3(GetStaticObjectField, jni, cls, fieldID)) != NULL)) {
+            jni->GetStaticObjectField(cls, fieldID)) != NULL)) {
         nsk_jvmti_setFailStatus();
         return NSK_FALSE;
     }
     NSK_DISPLAY1("  ... got array object: 0x%p\n", (void*)array);
 
-    if (!NSK_JNI_VERIFY(jni, (*size =
-            NSK_CPP_STUB2(GetArrayLength, jni, array)) > 0)) {
+    if (!NSK_JNI_VERIFY(jni, (*size = jni->GetArrayLength(array)) > 0)) {
         nsk_jvmti_setFailStatus();
         return NSK_FALSE;
     }
@@ -93,17 +92,14 @@
 
     {
         jboolean isCopy;
-        if (!NSK_JNI_VERIFY(jni, (elements =
-                NSK_CPP_STUB3(GetByteArrayElements, jni, array,
-                                                            &isCopy)) != NULL)) {
+        if (!NSK_JNI_VERIFY(jni, (elements = jni->GetByteArrayElements(array, &isCopy)) != NULL)) {
             nsk_jvmti_setFailStatus();
         return NSK_FALSE;
         }
     }
     NSK_DISPLAY1("  ... got elements list: 0x%p\n", (void*)elements);
 
-    if (!NSK_JVMTI_VERIFY(
-            NSK_CPP_STUB3(Allocate, jvmti, *size, bytes))) {
+    if (!NSK_JVMTI_VERIFY(jvmti->Allocate(*size, bytes))) {
         nsk_jvmti_setFailStatus();
         return NSK_FALSE;
     }
@@ -115,7 +111,7 @@
     NSK_DISPLAY1("  ... copied bytecode: %d bytes\n", (int)*size);
 
     NSK_DISPLAY1("Release elements list: 0x%p\n", (void*)elements);
-    NSK_TRACE(NSK_CPP_STUB4(ReleaseByteArrayElements, jni, array, elements, JNI_ABORT));
+    NSK_TRACE(jni->ReleaseByteArrayElements(array, elements, JNI_ABORT));
     NSK_DISPLAY0("  ... released\n");
 
     return NSK_TRUE;
@@ -130,23 +126,21 @@
 
     NSK_DISPLAY1("Find static field: %s\n", fieldName);
     if (!NSK_JNI_VERIFY(jni, (fieldID =
-            NSK_CPP_STUB4(GetStaticFieldID, jni, cls, fieldName, fieldSig)) != NULL)) {
+            jni->GetStaticFieldID(cls, fieldName, fieldSig)) != NULL)) {
         nsk_jvmti_setFailStatus();
         return NULL;
     }
     NSK_DISPLAY1("  ... got fieldID: 0x%p\n", (void*)fieldID);
 
     NSK_DISPLAY1("Get object from static field: %s\n", fieldName);
-    if (!NSK_JNI_VERIFY(jni, (obj =
-            NSK_CPP_STUB3(GetStaticObjectField, jni, cls, fieldID)) != NULL)) {
+    if (!NSK_JNI_VERIFY(jni, (obj = jni->GetStaticObjectField(cls, fieldID)) != NULL)) {
         nsk_jvmti_setFailStatus();
         return NULL;
     }
     NSK_DISPLAY1("  ... got object: 0x%p\n", (void*)obj);
 
     NSK_DISPLAY1("Make global reference to object: 0x%p\n", obj);
-    if (!NSK_JNI_VERIFY(jni, (obj =
-            NSK_CPP_STUB2(NewGlobalRef, jni, obj)) != NULL)) {
+    if (!NSK_JNI_VERIFY(jni, (obj = jni->NewGlobalRef(obj)) != NULL)) {
         nsk_jvmti_setFailStatus();
         return NULL;
     }
@@ -165,8 +159,7 @@
     classDef.class_bytes = bytes;
 
     NSK_DISPLAY1("Redefine class: %s\n", className);
-    if (!NSK_JVMTI_VERIFY(
-            NSK_CPP_STUB3(RedefineClasses, jvmti, 1, &classDef))) {
+    if (!NSK_JVMTI_VERIFY(jvmti->RedefineClasses(1, &classDef))) {
         nsk_jvmti_setFailStatus();
         return NSK_FALSE;
     }
@@ -192,7 +185,7 @@
             NSK_DISPLAY0(">>> Obtain debuggee class\n");
             NSK_DISPLAY1("Find debugee class: %s\n", DEBUGEE_CLASS_NAME);
             if (!NSK_JNI_VERIFY(jni, (debugeeClass =
-                    NSK_CPP_STUB2(FindClass, jni, DEBUGEE_CLASS_NAME)) != NULL)) {
+                    jni->FindClass(DEBUGEE_CLASS_NAME)) != NULL)) {
                 nsk_jvmti_setFailStatus();
                 return;
             }
@@ -258,11 +251,10 @@
         NSK_DISPLAY0(">>> Clean used data\n");
         {
             NSK_DISPLAY1("Delete global reference to tested class object: 0x%p\n", (void*)testedClass);
-            NSK_CPP_STUB2(DeleteGlobalRef, jni, testedClass);
+            jni->DeleteGlobalRef(testedClass);
 
             NSK_DISPLAY1("Deallocate redefined bytecode array: 0x%p\n", (void*)redefClassBytes);
-            if (!NSK_JVMTI_VERIFY(
-                        NSK_CPP_STUB2(Deallocate, jvmti, redefClassBytes))) {
+            if (!NSK_JVMTI_VERIFY(jvmti->Deallocate(redefClassBytes))) {
                 nsk_jvmti_setFailStatus();
             }
         }
@@ -359,8 +351,7 @@
         memset(&caps, 0, sizeof(caps));
         caps.can_generate_all_class_hook_events = 1;
         caps.can_redefine_classes = 1;
-        if (!NSK_JVMTI_VERIFY(
-                NSK_CPP_STUB2(AddCapabilities, jvmti, &caps))) {
+        if (!NSK_JVMTI_VERIFY(jvmti->AddCapabilities(&caps))) {
             return JNI_ERR;
         }
     }
@@ -373,8 +364,7 @@
 
         memset(&callbacks, 0, sizeof(callbacks));
         callbacks.ClassFileLoadHook = callbackClassFileLoadHook;
-        if (!NSK_JVMTI_VERIFY(
-                NSK_CPP_STUB3(SetEventCallbacks, jvmti, &callbacks, size))) {
+        if (!NSK_JVMTI_VERIFY(jvmti->SetEventCallbacks(&callbacks, size))) {
             return JNI_ERR;
         }
     }
--- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/ClassLoad/classload001/classload001.cpp	Fri Oct 05 17:01:07 2018 -0400
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/ClassLoad/classload001/classload001.cpp	Tue Oct 09 14:37:59 2018 +0200
@@ -98,17 +98,13 @@
 }
 
 static void lock(jvmtiEnv *jvmti_env, JNIEnv *jni_env) {
-    if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB2(RawMonitorEnter,
-            jvmti_env, countLock)))
-        NSK_CPP_STUB2(FatalError, jni_env,
-                "failed to enter a raw monitor\n");
+    if (!NSK_JVMTI_VERIFY(jvmti_env->RawMonitorEnter(countLock)))
+        jni_env->FatalError("failed to enter a raw monitor\n");
 }
 
 static void unlock(jvmtiEnv *jvmti_env, JNIEnv *jni_env) {
-    if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB2(RawMonitorExit,
-        jvmti_env, countLock)))
-        NSK_CPP_STUB2(FatalError, jni_env,
-                "failed to exit a raw monitor\n");
+    if (!NSK_JVMTI_VERIFY(jvmti_env->RawMonitorExit(countLock)))
+        jni_env->FatalError("failed to exit a raw monitor\n");
 }
 
 /** callback functions **/
@@ -119,8 +115,7 @@
 
     lock(jvmti_env, env);
 
-    if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB4(GetClassSignature,
-            jvmti_env, klass, &sig, &generic))) {
+    if (!NSK_JVMTI_VERIFY(jvmti_env->GetClassSignature(klass, &sig, &generic))) {
         result = STATUS_FAILED;
         NSK_COMPLAIN0("TEST FAILURE: unable to obtain a class signature\n");
     }
@@ -185,20 +180,17 @@
 
     initCounters();
 
-    if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB3(CreateRawMonitor,
-            jvmti, "_counter_lock", &countLock)))
+    if (!NSK_JVMTI_VERIFY(jvmti->CreateRawMonitor("_counter_lock", &countLock)))
         return JNI_ERR;
 
     NSK_DISPLAY0("setting event callbacks ...\n");
     (void) memset(&callbacks, 0, sizeof(callbacks));
     callbacks.ClassLoad = &ClassLoad;
-    if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB3(SetEventCallbacks,
-            jvmti, &callbacks, sizeof(callbacks))))
+    if (!NSK_JVMTI_VERIFY(jvmti->SetEventCallbacks(&callbacks, sizeof(callbacks))))
         return JNI_ERR;
 
     NSK_DISPLAY0("setting event callbacks done\nenabling ClassLoad event ...\n");
-    if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB4(SetEventNotificationMode,
-            jvmti, JVMTI_ENABLE, JVMTI_EVENT_CLASS_LOAD, NULL)))
+    if (!NSK_JVMTI_VERIFY(jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_CLASS_LOAD, NULL)))
         return JNI_ERR;
     NSK_DISPLAY0("the event enabled\n");
 
--- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/CompiledMethodLoad/compmethload001/compmethload001.cpp	Fri Oct 05 17:01:07 2018 -0400
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/CompiledMethodLoad/compmethload001/compmethload001.cpp	Tue Oct 09 14:37:59 2018 +0200
@@ -45,8 +45,7 @@
 VMInit(jvmtiEnv *jvmti_env, JNIEnv *env, jthread thr) {
     NSK_DISPLAY0("VMInit event received\n\n");
 
-    if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB2(GenerateEvents,
-            jvmti_env, JVMTI_EVENT_COMPILED_METHOD_LOAD))) {
+    if (!NSK_JVMTI_VERIFY(jvmti_env->GenerateEvents(JVMTI_EVENT_COMPILED_METHOD_LOAD))) {
         NSK_COMPLAIN0("TEST FAILED: unable to generate events to represent the current state of the VM\n");
         result = STATUS_FAILED;
     }
@@ -63,8 +62,7 @@
 
     NSK_DISPLAY0("CompiledMethodLoad event received for:\n");
 
-    if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB5(GetMethodName,
-            jvmti_env, method, &name, &sig, &generic))) {
+    if (!NSK_JVMTI_VERIFY(jvmti_env->GetMethodName(method, &name, &sig, &generic))) {
         result = STATUS_FAILED;
         NSK_COMPLAIN0("TEST FAILURE: unable to obtain method info\n");
         return;
@@ -72,8 +70,7 @@
     NSK_DISPLAY4("\tmethod: name=\"%s\" signature=\"%s\"\n\tcompiled code size=%d\n\tnumber of address location map entries=%d\n",
         name, sig, code_size, map_length);
 
-    if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB2(GetPhase,
-            jvmti_env, &phase))) {
+    if (!NSK_JVMTI_VERIFY(jvmti_env->GetPhase(&phase))) {
         result = STATUS_FAILED;
         NSK_COMPLAIN0("TEST FAILURE: unable to obtain phase of the VM execution\n");
         return;
@@ -122,12 +119,10 @@
     /* add capability to generate compiled method events */
     memset(&caps, 0, sizeof(jvmtiCapabilities));
     caps.can_generate_compiled_method_load_events = 1;
-    if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB2(AddCapabilities,
-            jvmti, &caps)))
+    if (!NSK_JVMTI_VERIFY(jvmti->AddCapabilities(&caps)))
         return JNI_ERR;
 
-    if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB2(GetCapabilities,
-            jvmti, &caps)))
+    if (!NSK_JVMTI_VERIFY(jvmti->GetCapabilities(&caps)))
         return JNI_ERR;
 
     if (!caps.can_generate_compiled_method_load_events)
@@ -138,16 +133,13 @@
     (void) memset(&callbacks, 0, sizeof(callbacks));
     callbacks.VMInit = &VMInit;
     callbacks.CompiledMethodLoad = &CompiledMethodLoad;
-    if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB3(SetEventCallbacks,
-            jvmti, &callbacks, sizeof(callbacks))))
+    if (!NSK_JVMTI_VERIFY(jvmti->SetEventCallbacks(&callbacks, sizeof(callbacks))))
         return JNI_ERR;
 
     NSK_DISPLAY0("setting event callbacks done\nenabling VMInit, CompiledMethodLoad event ...\n");
-    if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB4(SetEventNotificationMode,
-            jvmti, JVMTI_ENABLE, JVMTI_EVENT_VM_INIT, NULL)))
+    if (!NSK_JVMTI_VERIFY(jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_VM_INIT, NULL)))
         return JNI_ERR;
-    if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB4(SetEventNotificationMode,
-            jvmti, JVMTI_ENABLE, JVMTI_EVENT_COMPILED_METHOD_LOAD, NULL)))
+    if (!NSK_JVMTI_VERIFY(jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_COMPILED_METHOD_LOAD, NULL)))
         return JNI_ERR;
     NSK_DISPLAY0("enabling the events done\n\n");
 
--- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/CompiledMethodUnload/compmethunload001/compmethunload001.cpp	Fri Oct 05 17:01:07 2018 -0400
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/CompiledMethodUnload/compmethunload001/compmethunload001.cpp	Tue Oct 09 14:37:59 2018 +0200
@@ -47,8 +47,7 @@
 VMInit(jvmtiEnv *jvmti_env, JNIEnv *env, jthread thr) {
     NSK_DISPLAY0("VMInit event received\n\n");
 
-    if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB2(GenerateEvents,
-            jvmti_env, JVMTI_EVENT_COMPILED_METHOD_LOAD))) {
+    if (!NSK_JVMTI_VERIFY(jvmti_env->GenerateEvents(JVMTI_EVENT_COMPILED_METHOD_LOAD))) {
         NSK_COMPLAIN0("TEST FAILED: unable to generate events to represent the current state of the VM\n");
         result = STATUS_FAILED;
     }
@@ -64,8 +63,7 @@
 
     NSK_DISPLAY0("CompiledMethodLoad event received for:\n");
 
-    if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB5(GetMethodName,
-            jvmti_env, method, &name, &sig, &generic))) {
+    if (!NSK_JVMTI_VERIFY(jvmti_env->GetMethodName(method, &name, &sig, &generic))) {
         result = STATUS_FAILED;
         NSK_COMPLAIN0("TEST FAILURE: unable to obtain method info\n\n");
         return;
@@ -94,8 +92,8 @@
     if (err == JVMTI_ERROR_NONE) {
         NSK_DISPLAY3("for: \tmethod: name=\"%s\" signature=\"%s\"\n\tnative address=0x%p\n",
           name, sig, code_addr);
-        NSK_CPP_STUB2(Deallocate, jvmti_env, (unsigned char*)name);
-        NSK_CPP_STUB2(Deallocate, jvmti_env, (unsigned char*)sig);
+        jvmti_env->Deallocate((unsigned char*)name);
+        jvmti_env->Deallocate((unsigned char*)sig);
     } else {
         // The class metadata has been completely unloaded so the name is not available.
         NSK_DISPLAY0("for: \tmethod: name=<not available>\n");
@@ -104,8 +102,7 @@
     // Count unloaded events
     class_unloaded++;
 
-    if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB2(GetPhase,
-            jvmti_env, &phase))) {
+    if (!NSK_JVMTI_VERIFY(jvmti_env->GetPhase(&phase))) {
         result = STATUS_FAILED;
         NSK_COMPLAIN0("TEST FAILURE: unable to obtain phase of the VM execution\n");
         return;
@@ -166,12 +163,10 @@
     /* add capability to generate compiled method events */
     memset(&caps, 0, sizeof(jvmtiCapabilities));
     caps.can_generate_compiled_method_load_events = 1;
-    if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB2(AddCapabilities,
-            jvmti, &caps)))
+    if (!NSK_JVMTI_VERIFY(jvmti->AddCapabilities(&caps)))
         return JNI_ERR;
 
-    if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB2(GetCapabilities,
-            jvmti, &caps)))
+    if (!NSK_JVMTI_VERIFY(jvmti->GetCapabilities(&caps)))
         return JNI_ERR;
 
     if (!caps.can_generate_compiled_method_load_events)
@@ -183,19 +178,15 @@
     callbacks.VMInit = &VMInit;
     callbacks.CompiledMethodLoad = &CompiledMethodLoad;
     callbacks.CompiledMethodUnload = &CompiledMethodUnload;
-    if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB3(SetEventCallbacks,
-            jvmti, &callbacks, sizeof(callbacks))))
+    if (!NSK_JVMTI_VERIFY(jvmti->SetEventCallbacks(&callbacks, sizeof(callbacks))))
         return JNI_ERR;
 
     NSK_DISPLAY0("setting event callbacks done\nenabling JVMTI events ...\n");
-    if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB4(SetEventNotificationMode,
-            jvmti, JVMTI_ENABLE, JVMTI_EVENT_VM_INIT, NULL)))
+    if (!NSK_JVMTI_VERIFY(jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_VM_INIT, NULL)))
         return JNI_ERR;
-    if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB4(SetEventNotificationMode,
-            jvmti, JVMTI_ENABLE, JVMTI_EVENT_COMPILED_METHOD_LOAD, NULL)))
+    if (!NSK_JVMTI_VERIFY(jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_COMPILED_METHOD_LOAD, NULL)))
         return JNI_ERR;
-    if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB4(SetEventNotificationMode,
-            jvmti, JVMTI_ENABLE, JVMTI_EVENT_COMPILED_METHOD_UNLOAD, NULL)))
+    if (!NSK_JVMTI_VERIFY(jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_COMPILED_METHOD_UNLOAD, NULL)))
         return JNI_ERR;
     NSK_DISPLAY0("enabling the events done\n\n");
 
--- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/DataDumpRequest/datadumpreq001/datadumpreq001.cpp	Fri Oct 05 17:01:07 2018 -0400
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/DataDumpRequest/datadumpreq001/datadumpreq001.cpp	Tue Oct 09 14:37:59 2018 +0200
@@ -118,13 +118,11 @@
     NSK_DISPLAY0("setting event callbacks ...\n");
     (void) memset(&callbacks, 0, sizeof(callbacks));
     callbacks.DataDumpRequest = &DataDumpRequest;
-    if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB3(SetEventCallbacks,
-            jvmti, &callbacks, sizeof(callbacks))))
+    if (!NSK_JVMTI_VERIFY(jvmti->SetEventCallbacks(&callbacks, sizeof(callbacks))))
         return JNI_ERR;
 
     NSK_DISPLAY0("setting event callbacks done\nenabling JVMTI events ...\n");
-    if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB4(SetEventNotificationMode,
-            jvmti, JVMTI_ENABLE, JVMTI_EVENT_DATA_DUMP_REQUEST, NULL)))
+    if (!NSK_JVMTI_VERIFY(jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_DATA_DUMP_REQUEST, NULL)))
         return JNI_ERR;
     NSK_DISPLAY0("enabling the events done\n\n");
 
--- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/DisposeEnvironment/disposeenv001/disposeenv001.cpp	Fri Oct 05 17:01:07 2018 -0400
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/DisposeEnvironment/disposeenv001/disposeenv001.cpp	Tue Oct 09 14:37:59 2018 +0200
@@ -54,8 +54,7 @@
         return JNI_ERR;
 
     NSK_DISPLAY0(">>> Testcase #1: Dispose JVMTI environment in Agent_OnLoad()\n");
-    if (!NSK_JVMTI_VERIFY(
-            NSK_CPP_STUB1(DisposeEnvironment, jvmti))) {
+    if (!NSK_JVMTI_VERIFY(jvmti->DisposeEnvironment())) {
         return JNI_ERR;
     }
     NSK_DISPLAY0("  ... disposed\n");
--- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/DisposeEnvironment/disposeenv002/disposeenv002.cpp	Fri Oct 05 17:01:07 2018 -0400
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/DisposeEnvironment/disposeenv002/disposeenv002.cpp	Tue Oct 09 14:37:59 2018 +0200
@@ -45,16 +45,14 @@
 
     NSK_DISPLAY0("Disable VM_DEATH event in VM_DEATH callback\n");
     if (!NSK_JVMTI_VERIFY(
-            NSK_CPP_STUB4(SetEventNotificationMode, jvmti, JVMTI_DISABLE,
-                                JVMTI_EVENT_VM_DEATH, NULL))) {
+            jvmti->SetEventNotificationMode(JVMTI_DISABLE, JVMTI_EVENT_VM_DEATH, NULL))) {
         success = NSK_FALSE;
     } else {
         NSK_DISPLAY0("  ... disabled\n");
     }
 
     NSK_DISPLAY0(">>> Testcase #1: Dispose JVMTI environment in VM_DEATH callback\n");
-    if (!NSK_JVMTI_VERIFY(
-            NSK_CPP_STUB1(DisposeEnvironment, jvmti))) {
+    if (!NSK_JVMTI_VERIFY(jvmti->DisposeEnvironment())) {
         success = NSK_FALSE;
     } else {
         NSK_DISPLAY0("  ... disposed\n");
@@ -95,16 +93,13 @@
 
         memset(&eventCallbacks, 0, sizeof(eventCallbacks));
         eventCallbacks.VMDeath = callbackVMDeath;
-        if (!NSK_JVMTI_VERIFY(
-                NSK_CPP_STUB3(SetEventCallbacks, jvmti,
-                                    &eventCallbacks, sizeof(eventCallbacks)))) {
+        if (!NSK_JVMTI_VERIFY(jvmti->SetEventCallbacks(&eventCallbacks, sizeof(eventCallbacks)))) {
             return JNI_ERR;
         }
 
         NSK_DISPLAY0("Enable VM_DEATH event in JVM_OnLoad()\n");
         if (!NSK_JVMTI_VERIFY(
-                NSK_CPP_STUB4(SetEventNotificationMode, jvmti, JVMTI_ENABLE,
-                                    JVMTI_EVENT_VM_DEATH, NULL))) {
+                jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_VM_DEATH, NULL))) {
             return JNI_ERR;
         }
         NSK_DISPLAY0("  ... enabled\n");
--- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/DynamicCodeGenerated/dyncodgen001/dyncodgen001.cpp	Fri Oct 05 17:01:07 2018 -0400
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/DynamicCodeGenerated/dyncodgen001/dyncodgen001.cpp	Tue Oct 09 14:37:59 2018 +0200
@@ -116,15 +116,12 @@
 
     memset(&callbacks, 0, sizeof(callbacks));
     callbacks.DynamicCodeGenerated = &DynamicCodeGenerated;
-    if (!NSK_JVMTI_VERIFY(
-            NSK_CPP_STUB3(SetEventCallbacks, jvmti,
-                &callbacks, sizeof(callbacks))))
+    if (!NSK_JVMTI_VERIFY(jvmti->SetEventCallbacks(&callbacks, sizeof(callbacks))))
         return JNI_ERR;
 
     /* enable DynamicCodeGenerated event */
     if (!NSK_JVMTI_VERIFY(
-            NSK_CPP_STUB4(SetEventNotificationMode, jvmti, JVMTI_ENABLE,
-                JVMTI_EVENT_DYNAMIC_CODE_GENERATED, NULL)))
+            jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_DYNAMIC_CODE_GENERATED, NULL)))
         return JNI_ERR;
 
     /* register agent proc and arg */
--- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/ForceEarlyReturn/ForceEarlyReturn001/ForceEarlyReturn001.cpp	Fri Oct 05 17:01:07 2018 -0400
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/ForceEarlyReturn/ForceEarlyReturn001/ForceEarlyReturn001.cpp	Tue Oct 09 14:37:59 2018 +0200
@@ -45,11 +45,7 @@
         )
 {
     if (!NSK_JVMTI_VERIFY(
-                NSK_CPP_STUB2(
-                    SuspendThread
-                    , jvmti
-                    , earlyReturnThread
-                )
+                jvmti                    ->SuspendThread                    (earlyReturnThread                )
             )
         )
          return JNI_FALSE;
@@ -67,11 +63,7 @@
         )
 {
     if (!NSK_JVMTI_VERIFY(
-                NSK_CPP_STUB2(
-                    ResumeThread
-                    , jvmti
-                    , earlyReturnThread
-                )
+                jvmti                    ->ResumeThread                    (earlyReturnThread                )
             )
         )
          return JNI_FALSE;
@@ -90,12 +82,7 @@
         )
 {
     if (!NSK_JVMTI_VERIFY(
-                NSK_CPP_STUB3(
-                    ForceEarlyReturnObject
-                    , jvmti
-                    , earlyReturnThread
-                    , valueToReturn
-                    )
+                jvmti                    ->ForceEarlyReturnObject                    (earlyReturnThread                    , valueToReturn                    )
                 )
        )
         return JNI_FALSE;
@@ -114,12 +101,7 @@
         )
 {
     if (!NSK_JVMTI_VERIFY(
-                NSK_CPP_STUB3(
-                    ForceEarlyReturnInt
-                    , jvmti
-                    , earlyReturnThread
-                    , valueToReturn
-                    )
+                jvmti                    ->ForceEarlyReturnInt                    (earlyReturnThread                    , valueToReturn                    )
                 )
        )
         return JNI_FALSE;
@@ -138,12 +120,7 @@
         )
 {
     if (!NSK_JVMTI_VERIFY(
-                NSK_CPP_STUB3(
-                    ForceEarlyReturnLong
-                    , jvmti
-                    , earlyReturnThread
-                    , valueToReturn
-                    )
+                jvmti                    ->ForceEarlyReturnLong                    (earlyReturnThread                    , valueToReturn                    )
                 )
        )
         return JNI_FALSE;
@@ -162,12 +139,7 @@
         )
 {
     if (!NSK_JVMTI_VERIFY(
-                NSK_CPP_STUB3(
-                    ForceEarlyReturnFloat
-                    , jvmti
-                    , earlyReturnThread
-                    , valueToReturn
-                    )
+                jvmti                    ->ForceEarlyReturnFloat                    (earlyReturnThread                    , valueToReturn                    )
                 )
        )
         return JNI_FALSE;
@@ -186,12 +158,7 @@
         )
 {
     if (!NSK_JVMTI_VERIFY(
-                NSK_CPP_STUB3(
-                    ForceEarlyReturnDouble
-                    , jvmti
-                    , earlyReturnThread
-                    , valueToReturn
-                    )
+                jvmti                    ->ForceEarlyReturnDouble                    (earlyReturnThread                    , valueToReturn                    )
                 )
        )
         return JNI_FALSE;
@@ -209,11 +176,7 @@
         )
 {
     if (!NSK_JVMTI_VERIFY(
-                NSK_CPP_STUB2(
-                    ForceEarlyReturnVoid
-                    , jvmti
-                    , earlyReturnThread
-                    )
+                jvmti                    ->ForceEarlyReturnVoid                    (earlyReturnThread                    )
                 )
        )
         return JNI_FALSE;
@@ -245,11 +208,7 @@
        )
         return JNI_ERR;
 
-    if (!NSK_JVMTI_VERIFY(
-                NSK_CPP_STUB2(
-                    GetCapabilities
-                    , jvmti
-                    , &caps)
+    if (!NSK_JVMTI_VERIFY(jvmti                    ->GetCapabilities                    (&caps)
                 )
        )
         return JNI_ERR;
@@ -258,11 +217,7 @@
     caps.can_force_early_return = 1;
     caps.can_suspend = 1;
 
-    if (!NSK_JVMTI_VERIFY(
-                NSK_CPP_STUB2(
-                    AddCapabilities
-                    , jvmti
-                    , &caps)
+    if (!NSK_JVMTI_VERIFY(jvmti                    ->AddCapabilities                    (&caps)
                 )
        )
         return JNI_ERR;
--- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/ForceGarbageCollection/forcegc001/forcegc001.cpp	Fri Oct 05 17:01:07 2018 -0400
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/ForceGarbageCollection/forcegc001/forcegc001.cpp	Tue Oct 09 14:37:59 2018 +0200
@@ -45,8 +45,7 @@
     NSK_DISPLAY0(">>> Testcase #1: force GC to collect sofly reachable objects\n");
     {
         NSK_DISPLAY0("Call ForceGarbageCollection()\n");
-        if (!NSK_JVMTI_VERIFY(
-                NSK_CPP_STUB1(ForceGarbageCollection, jvmti))) {
+        if (!NSK_JVMTI_VERIFY(jvmti->ForceGarbageCollection())) {
             nsk_jvmti_setFailStatus();
             return;
         }
--- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/ForceGarbageCollection/forcegc002/forcegc002.cpp	Fri Oct 05 17:01:07 2018 -0400
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/ForceGarbageCollection/forcegc002/forcegc002.cpp	Tue Oct 09 14:37:59 2018 +0200
@@ -54,8 +54,7 @@
             return;
 
         NSK_DISPLAY0("Call ForceGarbageCollection()\n");
-        if (!NSK_JVMTI_VERIFY(
-                NSK_CPP_STUB1(ForceGarbageCollection, jvmti))) {
+        if (!NSK_JVMTI_VERIFY(jvmti->ForceGarbageCollection())) {
             nsk_jvmti_setFailStatus();
             return;
         }
@@ -114,7 +113,7 @@
         jvmtiCapabilities caps;
         memset(&caps, 0, sizeof(caps));
         caps.can_generate_garbage_collection_events = 1;
-        if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB2(AddCapabilities, jvmti, &caps)))
+        if (!NSK_JVMTI_VERIFY(jvmti->AddCapabilities(&caps)))
             return JNI_ERR;
     }
 
@@ -122,9 +121,7 @@
         jvmtiEventCallbacks eventCallbacks;
         memset(&eventCallbacks, 0, sizeof(eventCallbacks));
         eventCallbacks.GarbageCollectionStart = callbackGarbageCollectionStart;
-        if (!NSK_JVMTI_VERIFY(
-                NSK_CPP_STUB3(SetEventCallbacks, jvmti,
-                                    &eventCallbacks, sizeof(eventCallbacks))))
+        if (!NSK_JVMTI_VERIFY(jvmti->SetEventCallbacks(&eventCallbacks, sizeof(eventCallbacks))))
             return JNI_ERR;
     }
 
--- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GarbageCollectionFinish/gcfinish001/gcfinish001.cpp	Fri Oct 05 17:01:07 2018 -0400
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GarbageCollectionFinish/gcfinish001/gcfinish001.cpp	Tue Oct 09 14:37:59 2018 +0200
@@ -51,8 +51,7 @@
 
     NSK_DISPLAY1("%s: creating a raw monitor ...\n",
         msg);
-    if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB3(CreateRawMonitor,
-            jvmti_env, "_lock", &_lock))) {
+    if (!NSK_JVMTI_VERIFY(jvmti_env->CreateRawMonitor("_lock", &_lock))) {
         result = STATUS_FAILED;
         NSK_COMPLAIN1("TEST FAILED: %s: unable to create a raw monitor\n\n",
             msg);
@@ -63,8 +62,7 @@
 
     NSK_DISPLAY1("%s: entering the raw monitor ...\n",
         msg);
-    if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB2(RawMonitorEnter,
-            jvmti_env, _lock))) {
+    if (!NSK_JVMTI_VERIFY(jvmti_env->RawMonitorEnter(_lock))) {
         result = STATUS_FAILED;
         NSK_COMPLAIN1("TEST FAILED: %s: unable to enter the raw monitor\n\n",
             msg);
@@ -75,8 +73,7 @@
 
         NSK_DISPLAY1("%s: waiting the raw monitor ...\n",
             msg);
-        if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB3(RawMonitorWait,
-                jvmti_env, _lock, (jlong)10))) {
+        if (!NSK_JVMTI_VERIFY(jvmti_env->RawMonitorWait(_lock, (jlong)10))) {
             result = STATUS_FAILED;
             NSK_COMPLAIN1("TEST FAILED: %s: unable to wait the raw monitor\n\n",
                 msg);
@@ -87,8 +84,7 @@
 
         NSK_DISPLAY1("%s: notifying a single thread waiting on the raw monitor ...\n",
             msg);
-        if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB2(RawMonitorNotify,
-                jvmti_env, _lock))) {
+        if (!NSK_JVMTI_VERIFY(jvmti_env->RawMonitorNotify(_lock))) {
             result = STATUS_FAILED;
             NSK_COMPLAIN1("TEST FAILED: %s: unable to notify single thread\n\n",
                 msg);
@@ -99,8 +95,7 @@
 
         NSK_DISPLAY1("%s: notifying all threads waiting on the raw monitor ...\n",
             msg);
-        if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB2(RawMonitorNotifyAll,
-                jvmti_env, _lock))) {
+        if (!NSK_JVMTI_VERIFY(jvmti_env->RawMonitorNotifyAll(_lock))) {
             result = STATUS_FAILED;
             NSK_COMPLAIN1("TEST FAILED: %s: unable to notify all threads\n\n",
                 msg);
@@ -111,8 +106,7 @@
 
         NSK_DISPLAY1("%s: exiting the raw monitor ...\n",
             msg);
-        if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB2(RawMonitorExit,
-                jvmti_env, _lock))) {
+        if (!NSK_JVMTI_VERIFY(jvmti_env->RawMonitorExit(_lock))) {
             result = STATUS_FAILED;
             NSK_COMPLAIN1("TEST FAILED: %s: unable to exit the raw monitor\n\n",
                 msg);
@@ -123,8 +117,7 @@
 
     NSK_DISPLAY1("%s: destroying the raw monitor ...\n",
         msg);
-    if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB2(DestroyRawMonitor,
-            jvmti_env, _lock))) {
+    if (!NSK_JVMTI_VERIFY(jvmti_env->DestroyRawMonitor(_lock))) {
         result = STATUS_FAILED;
         NSK_COMPLAIN1("TEST FAILED: %s: unable to destroy a raw monitor\n",
             msg);
@@ -137,8 +130,7 @@
 static void memoryFunc(jvmtiEnv *jvmti_env, const char *msg) {
     NSK_DISPLAY1("%s: allocating memory ...\n",
         msg);
-    if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB3(Allocate,
-            jvmti_env, MEM_SIZE, &mem))) {
+    if (!NSK_JVMTI_VERIFY(jvmti_env->Allocate(MEM_SIZE, &mem))) {
         result = STATUS_FAILED;
         NSK_COMPLAIN1("TEST FAILED: %s: unable to allocate memory\n\n",
             msg);
@@ -150,8 +142,7 @@
 
     NSK_DISPLAY1("%s: deallocating memory ...\n",
         msg);
-    if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB2(Deallocate,
-            jvmti_env, mem))) {
+    if (!NSK_JVMTI_VERIFY(jvmti_env->Deallocate(mem))) {
         result = STATUS_FAILED;
         NSK_COMPLAIN1("TEST FAILED: %s: unable to deallocate memory\n\n",
             msg);
@@ -209,12 +200,10 @@
     /* add capability to generate compiled method events */
     memset(&caps, 0, sizeof(jvmtiCapabilities));
     caps.can_generate_garbage_collection_events = 1;
-    if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB2(AddCapabilities,
-            jvmti, &caps)))
+    if (!NSK_JVMTI_VERIFY(jvmti->AddCapabilities(&caps)))
         return JNI_ERR;
 
-    if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB2(GetCapabilities,
-            jvmti, &caps)))
+    if (!NSK_JVMTI_VERIFY(jvmti->GetCapabilities(&caps)))
         return JNI_ERR;
 
     if (!caps.can_generate_garbage_collection_events)
@@ -225,16 +214,13 @@
     (void) memset(&callbacks, 0, sizeof(callbacks));
     callbacks.VMDeath = &VMDeath;
     callbacks.GarbageCollectionFinish = &GarbageCollectionFinish;
-    if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB3(SetEventCallbacks,
-            jvmti, &callbacks, sizeof(callbacks))))
+    if (!NSK_JVMTI_VERIFY(jvmti->SetEventCallbacks(&callbacks, sizeof(callbacks))))
         return JNI_ERR;
 
     NSK_DISPLAY0("setting event callbacks done\nenabling JVMTI events ...\n");
-    if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB4(SetEventNotificationMode,
-            jvmti, JVMTI_ENABLE, JVMTI_EVENT_VM_DEATH, NULL)))
+    if (!NSK_JVMTI_VERIFY(jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_VM_DEATH, NULL)))
         return JNI_ERR;
-    if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB4(SetEventNotificationMode,
-            jvmti, JVMTI_ENABLE, JVMTI_EVENT_GARBAGE_COLLECTION_FINISH, NULL)))
+    if (!NSK_JVMTI_VERIFY(jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_GARBAGE_COLLECTION_FINISH, NULL)))
         return JNI_ERR;
     NSK_DISPLAY0("enabling the events done\n\n");
 
--- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GarbageCollectionStart/gcstart001/gcstart001.cpp	Fri Oct 05 17:01:07 2018 -0400
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GarbageCollectionStart/gcstart001/gcstart001.cpp	Tue Oct 09 14:37:59 2018 +0200
@@ -120,12 +120,10 @@
     /* add capability to generate compiled method events */
     memset(&caps, 0, sizeof(jvmtiCapabilities));
     caps.can_generate_garbage_collection_events = 1;
-    if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB2(AddCapabilities,
-            jvmti, &caps)))
+    if (!NSK_JVMTI_VERIFY(jvmti->AddCapabilities(&caps)))
         return JNI_ERR;
 
-    if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB2(GetCapabilities,
-            jvmti, &caps)))
+    if (!NSK_JVMTI_VERIFY(jvmti->GetCapabilities(&caps)))
         return JNI_ERR;
 
     if (!caps.can_generate_garbage_collection_events)
@@ -137,19 +135,15 @@
     callbacks.VMDeath = &VMDeath;
     callbacks.GarbageCollectionStart = &GarbageCollectionStart;
     callbacks.GarbageCollectionFinish = &GarbageCollectionFinish;
-    if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB3(SetEventCallbacks,
-            jvmti, &callbacks, sizeof(callbacks))))
+    if (!NSK_JVMTI_VERIFY(jvmti->SetEventCallbacks(&callbacks, sizeof(callbacks))))
         return JNI_ERR;
 
     NSK_DISPLAY0("setting event callbacks done\nenabling JVMTI events ...\n");
-    if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB4(SetEventNotificationMode,
-            jvmti, JVMTI_ENABLE, JVMTI_EVENT_VM_DEATH, NULL)))
+    if (!NSK_JVMTI_VERIFY(jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_VM_DEATH, NULL)))
         return JNI_ERR;
-    if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB4(SetEventNotificationMode,
-            jvmti, JVMTI_ENABLE, JVMTI_EVENT_GARBAGE_COLLECTION_START, NULL)))
+    if (!NSK_JVMTI_VERIFY(jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_GARBAGE_COLLECTION_START, NULL)))
         return JNI_ERR;
-    if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB4(SetEventNotificationMode,
-            jvmti, JVMTI_ENABLE, JVMTI_EVENT_GARBAGE_COLLECTION_FINISH, NULL)))
+    if (!NSK_JVMTI_VERIFY(jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_GARBAGE_COLLECTION_FINISH, NULL)))
         return JNI_ERR;
     NSK_DISPLAY0("enabling the events done\n\n");
 
--- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GarbageCollectionStart/gcstart002/gcstart002.cpp	Fri Oct 05 17:01:07 2018 -0400
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GarbageCollectionStart/gcstart002/gcstart002.cpp	Tue Oct 09 14:37:59 2018 +0200
@@ -51,8 +51,7 @@
 
     NSK_DISPLAY1("%s: creating a raw monitor ...\n",
         msg);
-    if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB3(CreateRawMonitor,
-            jvmti_env, "_lock", &_lock))) {
+    if (!NSK_JVMTI_VERIFY(jvmti_env->CreateRawMonitor("_lock", &_lock))) {
         result = STATUS_FAILED;
         NSK_COMPLAIN1("TEST FAILED: %s: unable to create a raw monitor\n\n",
             msg);
@@ -63,8 +62,7 @@
 
     NSK_DISPLAY1("%s: entering the raw monitor ...\n",
         msg);
-    if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB2(RawMonitorEnter,
-            jvmti_env, _lock))) {
+    if (!NSK_JVMTI_VERIFY(jvmti_env->RawMonitorEnter(_lock))) {
         result = STATUS_FAILED;
         NSK_COMPLAIN1("TEST FAILED: %s: unable to enter the raw monitor\n\n",
             msg);
@@ -76,8 +74,7 @@
 
         NSK_DISPLAY1("%s: waiting the raw monitor ...\n",
             msg);
-        if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB3(RawMonitorWait,
-                jvmti_env, _lock, (jlong)10))) {
+        if (!NSK_JVMTI_VERIFY(jvmti_env->RawMonitorWait(_lock, (jlong)10))) {
             result = STATUS_FAILED;
             NSK_COMPLAIN1("TEST FAILED: %s: unable to wait the raw monitor\n\n",
                 msg);
@@ -88,8 +85,7 @@
 
         NSK_DISPLAY1("%s: notifying a single thread waiting on the raw monitor ...\n",
             msg);
-        if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB2(RawMonitorNotify,
-                jvmti_env, _lock))) {
+        if (!NSK_JVMTI_VERIFY(jvmti_env->RawMonitorNotify(_lock))) {
             result = STATUS_FAILED;
             NSK_COMPLAIN1("TEST FAILED: %s: unable to notify single thread\n\n",
                 msg);
@@ -100,8 +96,7 @@
 
         NSK_DISPLAY1("%s: notifying all threads waiting on the raw monitor ...\n",
             msg);
-        if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB2(RawMonitorNotifyAll,
-                jvmti_env, _lock))) {
+        if (!NSK_JVMTI_VERIFY(jvmti_env->RawMonitorNotifyAll(_lock))) {
             result = STATUS_FAILED;
             NSK_COMPLAIN1("TEST FAILED: %s: unable to notify all threads\n\n",
                 msg);
@@ -112,8 +107,7 @@
 
         NSK_DISPLAY1("%s: exiting the raw monitor ...\n",
             msg);
-        if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB2(RawMonitorExit,
-                jvmti_env, _lock))) {
+        if (!NSK_JVMTI_VERIFY(jvmti_env->RawMonitorExit(_lock))) {
             result = STATUS_FAILED;
             NSK_COMPLAIN1("TEST FAILED: %s: unable to exit the raw monitor\n\n",
                 msg);
@@ -124,8 +118,7 @@
 
     NSK_DISPLAY1("%s: destroying the raw monitor ...\n",
         msg);
-    if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB2(DestroyRawMonitor,
-            jvmti_env, _lock))) {
+    if (!NSK_JVMTI_VERIFY(jvmti_env->DestroyRawMonitor(_lock))) {
         result = STATUS_FAILED;
         NSK_COMPLAIN1("TEST FAILED: %s: unable to destroy a raw monitor\n",
             msg);
@@ -138,8 +131,7 @@
 static void memoryFunc(jvmtiEnv *jvmti_env, const char *msg) {
     NSK_DISPLAY1("%s: allocating memory ...\n",
         msg);
-    if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB3(Allocate,
-            jvmti_env, MEM_SIZE, &mem))) {
+    if (!NSK_JVMTI_VERIFY(jvmti_env->Allocate(MEM_SIZE, &mem))) {
         result = STATUS_FAILED;
         NSK_COMPLAIN1("TEST FAILED: %s: unable to allocate memory\n\n",
             msg);
@@ -151,8 +143,7 @@
 
     NSK_DISPLAY1("%s: deallocating memory ...\n",
         msg);
-    if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB2(Deallocate,
-            jvmti_env, mem))) {
+    if (!NSK_JVMTI_VERIFY(jvmti_env->Deallocate(mem))) {
         result = STATUS_FAILED;
         NSK_COMPLAIN1("TEST FAILED: %s: unable to deallocate memory\n\n",
             msg);
@@ -210,12 +201,10 @@
     /* add capability to generate compiled method events */
     memset(&caps, 0, sizeof(jvmtiCapabilities));
     caps.can_generate_garbage_collection_events = 1;
-    if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB2(AddCapabilities,
-            jvmti, &caps)))
+    if (!NSK_JVMTI_VERIFY(jvmti->AddCapabilities(&caps)))
         return JNI_ERR;
 
-    if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB2(GetCapabilities,
-            jvmti, &caps)))
+    if (!NSK_JVMTI_VERIFY(jvmti->GetCapabilities(&caps)))
         return JNI_ERR;
 
     if (!caps.can_generate_garbage_collection_events)
@@ -226,16 +215,13 @@
     (void) memset(&callbacks, 0, sizeof(callbacks));
     callbacks.VMDeath = &VMDeath;
     callbacks.GarbageCollectionStart = &GarbageCollectionStart;
-    if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB3(SetEventCallbacks,
-            jvmti, &callbacks, sizeof(callbacks))))
+    if (!NSK_JVMTI_VERIFY(jvmti->SetEventCallbacks(&callbacks, sizeof(callbacks))))
         return JNI_ERR;
 
     NSK_DISPLAY0("setting event callbacks done\nenabling JVMTI events ...\n");
-    if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB4(SetEventNotificationMode,
-            jvmti, JVMTI_ENABLE, JVMTI_EVENT_VM_DEATH, NULL)))
+    if (!NSK_JVMTI_VERIFY(jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_VM_DEATH, NULL)))
         return JNI_ERR;
-    if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB4(SetEventNotificationMode,
-            jvmti, JVMTI_ENABLE, JVMTI_EVENT_GARBAGE_COLLECTION_START, NULL)))
+    if (!NSK_JVMTI_VERIFY(jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_GARBAGE_COLLECTION_START, NULL)))
         return JNI_ERR;
     NSK_DISPLAY0("enabling the events done\n\n");
 
--- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GenerateEvents/genevents001/genevents001.cpp	Fri Oct 05 17:01:07 2018 -0400
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GenerateEvents/genevents001/genevents001.cpp	Tue Oct 09 14:37:59 2018 +0200
@@ -99,13 +99,11 @@
         }
 
         NSK_DISPLAY0("Call GenerateEvents() to send missed events\n");
-        if (!NSK_JVMTI_VERIFY(
-                NSK_CPP_STUB2(GenerateEvents, jvmti, JVMTI_EVENT_COMPILED_METHOD_LOAD))) {
+        if (!NSK_JVMTI_VERIFY(jvmti->GenerateEvents(JVMTI_EVENT_COMPILED_METHOD_LOAD))) {
             nsk_jvmti_setFailStatus();
         }
 
-        if (!NSK_JVMTI_VERIFY(
-                NSK_CPP_STUB2(GenerateEvents, jvmti, JVMTI_EVENT_DYNAMIC_CODE_GENERATED))) {
+        if (!NSK_JVMTI_VERIFY(jvmti->GenerateEvents(JVMTI_EVENT_DYNAMIC_CODE_GENERATED))) {
             nsk_jvmti_setFailStatus();
         }
 
@@ -195,8 +193,7 @@
         jvmtiCapabilities caps;
         memset(&caps, 0, sizeof(caps));
         caps.can_generate_compiled_method_load_events = 1;
-        if (!NSK_JVMTI_VERIFY(
-                NSK_CPP_STUB2(AddCapabilities, jvmti, &caps)))
+        if (!NSK_JVMTI_VERIFY(jvmti->AddCapabilities(&caps)))
             return JNI_ERR;
     }
 
@@ -207,9 +204,7 @@
         eventCallbacks.CompiledMethodLoad = callbackCompiledMethodLoad;
         eventCallbacks.CompiledMethodUnload = callbackCompiledMethodUnload;
         eventCallbacks.DynamicCodeGenerated = callbackDynamicCodeGenerated;
-        if (!NSK_JVMTI_VERIFY(
-                NSK_CPP_STUB3(SetEventCallbacks, jvmti,
-                                    &eventCallbacks, sizeof(eventCallbacks))))
+        if (!NSK_JVMTI_VERIFY(jvmti->SetEventCallbacks(&eventCallbacks, sizeof(eventCallbacks))))
             return JNI_ERR;
     }
 
--- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetAvailableProcessors/getavailproc001/getavailproc001.cpp	Fri Oct 05 17:01:07 2018 -0400
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetAvailableProcessors/getavailproc001/getavailproc001.cpp	Tue Oct 09 14:37:59 2018 +0200
@@ -53,8 +53,7 @@
     jint processors = 0;
 
     NSK_DISPLAY0("GetAvailableProcessors() for current JVMTI env\n");
-    if (!NSK_JVMTI_VERIFY(
-            NSK_CPP_STUB2(GetAvailableProcessors, jvmti, &processors))) {
+    if (!NSK_JVMTI_VERIFY(jvmti->GetAvailableProcessors(&processors))) {
         return NSK_FALSE;
     }
     NSK_DISPLAY1("  ... got processors: %d\n", (int)processors);
@@ -157,9 +156,7 @@
         memset(&eventCallbacks, 0, sizeof(eventCallbacks));
         eventCallbacks.VMInit = callbackVMInit;
         eventCallbacks.VMDeath = callbackVMDeath;
-        if (!NSK_JVMTI_VERIFY(
-                NSK_CPP_STUB3(SetEventCallbacks, jvmti,
-                                    &eventCallbacks, sizeof(eventCallbacks)))) {
+        if (!NSK_JVMTI_VERIFY(jvmti->SetEventCallbacks(&eventCallbacks, sizeof(eventCallbacks)))) {
             return JNI_ERR;
         }
 
--- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetCapabilities/getcaps002/getcaps002.cpp	Fri Oct 05 17:01:07 2018 -0400
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetCapabilities/getcaps002/getcaps002.cpp	Tue Oct 09 14:37:59 2018 +0200
@@ -190,8 +190,7 @@
     memset(&caps, 0, sizeof(jvmtiCapabilities));
 
     NSK_DISPLAY0("GetCapabilities() for current JVMTI env\n");
-    if (!NSK_JVMTI_VERIFY(
-            NSK_CPP_STUB2(GetCapabilities, jvmti, &caps))) {
+    if (!NSK_JVMTI_VERIFY(jvmti->GetCapabilities(&caps))) {
         return NSK_FALSE;
     }
 
@@ -297,9 +296,7 @@
         memset(&eventCallbacks, 0, sizeof(eventCallbacks));
         eventCallbacks.VMInit = callbackVMInit;
         eventCallbacks.VMDeath = callbackVMDeath;
-        if (!NSK_JVMTI_VERIFY(
-                NSK_CPP_STUB3(SetEventCallbacks, jvmti,
-                                    &eventCallbacks, sizeof(eventCallbacks)))) {
+        if (!NSK_JVMTI_VERIFY(jvmti->SetEventCallbacks(&eventCallbacks, sizeof(eventCallbacks)))) {
             return JNI_ERR;
         }
 
--- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetClassLoaderClasses/clsldrclss002/clsldrclss002.cpp	Fri Oct 05 17:01:07 2018 -0400
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetClassLoaderClasses/clsldrclss002/clsldrclss002.cpp	Tue Oct 09 14:37:59 2018 +0200
@@ -58,18 +58,15 @@
     NSK_DISPLAY0("Obtain tested object from a static field of debugee class\n");
 
     NSK_DISPLAY1("Find class: %s\n", CLASS_NAME);
-    if (!NSK_JNI_VERIFY(jni, (testedClass =
-            NSK_CPP_STUB2(FindClass, jni, CLASS_NAME)) != NULL))
+    if (!NSK_JNI_VERIFY(jni, (testedClass = jni->FindClass(CLASS_NAME)) != NULL))
         return NSK_FALSE;
 
-    if (!NSK_JNI_VERIFY(jni, (testedClass = (jclass)
-            NSK_CPP_STUB2(NewGlobalRef, jni, testedClass)) != NULL))
+    if (!NSK_JNI_VERIFY(jni, (testedClass = (jclass) jni->NewGlobalRef(testedClass)) != NULL))
         return NSK_FALSE;
 
     NSK_DISPLAY2("Find field: %s:%s\n", FIELD_NAME, FIELD_SIGNATURE);
     if (!NSK_JNI_VERIFY(jni, (testedFieldID =
-            NSK_CPP_STUB4(GetStaticFieldID, jni, testedClass,
-                FIELD_NAME, FIELD_SIGNATURE)) != NULL))
+            jni->GetStaticFieldID(testedClass, FIELD_NAME, FIELD_SIGNATURE)) != NULL))
         return NSK_FALSE;
 
     return NSK_TRUE;
@@ -82,8 +79,7 @@
     jint i;
 
     for (i = 0; i < classCount && !found; i++) {
-        if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB4(GetClassSignature, jvmti,
-                classes[i], &signature, &generic)))
+        if (!NSK_JVMTI_VERIFY(jvmti->GetClassSignature(classes[i], &signature, &generic)))
             break;
 
         if (signature != NULL && strcmp(signature, exp_sig) == 0) {
@@ -92,10 +88,10 @@
         }
 
         if (signature != NULL)
-            NSK_CPP_STUB2(Deallocate, jvmti, (unsigned char*)signature);
+            jvmti->Deallocate((unsigned char*)signature);
 
         if (generic != NULL)
-            NSK_CPP_STUB2(Deallocate, jvmti, (unsigned char*)generic);
+            jvmti->Deallocate((unsigned char*)generic);
     }
 
     return found;
@@ -119,13 +115,11 @@
 
     NSK_DISPLAY0("Testcase #1: check on default classloader\n");
     if (!NSK_JNI_VERIFY(jni, (testedClassLoader =
-            NSK_CPP_STUB3(GetStaticObjectField, jni,
-                testedClass, testedFieldID)) != NULL)) {
+            jni->GetStaticObjectField(testedClass, testedFieldID)) != NULL)) {
         nsk_jvmti_setFailStatus();
         return;
     }
-    if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB4(GetClassLoaderClasses, jvmti,
-            testedClassLoader, &classCount, &classes))) {
+    if (!NSK_JVMTI_VERIFY(jvmti->GetClassLoaderClasses(testedClassLoader, &classCount, &classes))) {
         nsk_jvmti_setFailStatus();
         return;
     }
@@ -143,7 +137,7 @@
         return;
     }
     if (classes != NULL)
-        NSK_CPP_STUB2(Deallocate, jvmti, (unsigned char*)classes);
+        jvmti->Deallocate((unsigned char*)classes);
 
     if (!nsk_jvmti_resumeSync())
         return;
@@ -152,13 +146,11 @@
 
     NSK_DISPLAY0("Testcase #2: check on custom classloader\n");
     if (!NSK_JNI_VERIFY(jni, (testedClassLoader =
-            NSK_CPP_STUB3(GetStaticObjectField, jni,
-                testedClass, testedFieldID)) != NULL)) {
+            jni->GetStaticObjectField(testedClass, testedFieldID)) != NULL)) {
         nsk_jvmti_setFailStatus();
         return;
     }
-    if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB4(GetClassLoaderClasses, jvmti,
-            testedClassLoader, &classCount, &classes))) {
+    if (!NSK_JVMTI_VERIFY(jvmti->GetClassLoaderClasses(testedClassLoader, &classCount, &classes))) {
         nsk_jvmti_setFailStatus();
         return;
     }
@@ -183,9 +175,9 @@
         nsk_jvmti_setFailStatus();
     }
     if (classes != NULL)
-        NSK_CPP_STUB2(Deallocate, jvmti, (unsigned char*)classes);
+        jvmti->Deallocate((unsigned char*)classes);
 
-    NSK_TRACE(NSK_CPP_STUB2(DeleteGlobalRef, jni, testedClass));
+    NSK_TRACE(jni->DeleteGlobalRef(testedClass));
 
     if (!nsk_jvmti_resumeSync())
         return;
--- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetClassSignature/getclsig006/getclsig006.cpp	Fri Oct 05 17:01:07 2018 -0400
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetClassSignature/getclsig006/getclsig006.cpp	Tue Oct 09 14:37:59 2018 +0200
@@ -58,8 +58,7 @@
     char *sign;
     char *gen_sign;
 
-    if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB4(GetClassSignature,
-            jvmti, testedCls, &sign, &gen_sign))) {
+    if (!NSK_JVMTI_VERIFY(jvmti->GetClassSignature(testedCls, &sign, &gen_sign))) {
         NSK_COMPLAIN1("TEST FAILED: unable to get class signature for \"%s\"\n\n",
             class_sig[idx][0]);
         return STATUS_FAILED;
@@ -85,13 +84,11 @@
                 sign, (gen_sign==NULL)?"NULL":gen_sign);
 
         NSK_DISPLAY0("Deallocating the signature array\n");
-        if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB2(Deallocate,
-                jvmti, (unsigned char*) sign))) {
+        if (!NSK_JVMTI_VERIFY(jvmti->Deallocate((unsigned char*) sign))) {
             totRes = STATUS_FAILED;
         }
         if (gen_sign!=NULL)
-            if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB2(Deallocate,
-                    jvmti, (unsigned char*) gen_sign))) {
+            if (!NSK_JVMTI_VERIFY(jvmti->Deallocate((unsigned char*) gen_sign))) {
                 totRes = STATUS_FAILED;
             }
 
@@ -108,8 +105,7 @@
     jclass testedCls;
 
     for (i=0; i<CLS_NUM; i++) {
-        if (!NSK_JNI_VERIFY(jni, (testedCls = NSK_CPP_STUB2(
-                FindClass, jni, class_sig[i][1])) != NULL)) {
+        if (!NSK_JNI_VERIFY(jni, (testedCls = jni->FindClass(class_sig[i][1])) != NULL)) {
             NSK_COMPLAIN1("TEST FAILURE: unable to find class \"%s\"\n\n",
                 class_sig[i][0]);
             res = STATUS_FAILED;
--- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetCurrentThreadCpuTime/curthrcputime001/curthrcputime001.cpp	Fri Oct 05 17:01:07 2018 -0400
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetCurrentThreadCpuTime/curthrcputime001/curthrcputime001.cpp	Tue Oct 09 14:37:59 2018 +0200
@@ -70,8 +70,7 @@
     int success = NSK_TRUE;
 
     NSK_DISPLAY1("GetCurrentThreadCpuTime() for current thread: 0x%p\n", (void*)thread);
-    if (!NSK_JVMTI_VERIFY(
-            NSK_CPP_STUB2(GetCurrentThreadCpuTime, jvmti, (jlong *)time))) {
+    if (!NSK_JVMTI_VERIFY(jvmti->GetCurrentThreadCpuTime((jlong *)time))) {
         return NSK_FALSE;
     }
     NSK_DISPLAY1("  ... got cpu time: %s\n", julong_to_string(*time, buf));
@@ -260,8 +259,7 @@
 
     jvmtiThreadInfo threadInfo;
     {
-        if (!NSK_JVMTI_VERIFY(
-                NSK_CPP_STUB3(GetThreadInfo, jvmti, thread, &threadInfo))) {
+        if (!NSK_JVMTI_VERIFY(jvmti->GetThreadInfo(thread, &threadInfo))) {
             nsk_jvmti_setFailStatus();
             return;
         }
@@ -284,8 +282,7 @@
 
     jvmtiThreadInfo threadInfo;
     {
-        if (!NSK_JVMTI_VERIFY(
-                NSK_CPP_STUB3(GetThreadInfo, jvmti, thread, &threadInfo))) {
+        if (!NSK_JVMTI_VERIFY(jvmti->GetThreadInfo(thread, &threadInfo))) {
             nsk_jvmti_setFailStatus();
             return;
         }
@@ -337,8 +334,7 @@
 
         memset(&caps, 0, sizeof(caps));
         caps.can_get_current_thread_cpu_time = 1;
-        if (!NSK_JVMTI_VERIFY(
-                NSK_CPP_STUB2(AddCapabilities, jvmti, &caps))) {
+        if (!NSK_JVMTI_VERIFY(jvmti->AddCapabilities(&caps))) {
             return JNI_ERR;
         }
     }
@@ -353,9 +349,7 @@
         eventCallbacks.VMDeath = callbackVMDeath;
         eventCallbacks.ThreadStart = callbackThreadStart;
         eventCallbacks.ThreadEnd = callbackThreadEnd;
-        if (!NSK_JVMTI_VERIFY(
-                NSK_CPP_STUB3(SetEventCallbacks, jvmti,
-                                    &eventCallbacks, sizeof(eventCallbacks)))) {
+        if (!NSK_JVMTI_VERIFY(jvmti->SetEventCallbacks(&eventCallbacks, sizeof(eventCallbacks)))) {
             return JNI_ERR;
         }
     }
--- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetCurrentThreadCpuTimerInfo/curthrtimerinfo001/curthrtimerinfo001.cpp	Fri Oct 05 17:01:07 2018 -0400
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetCurrentThreadCpuTimerInfo/curthrtimerinfo001/curthrtimerinfo001.cpp	Tue Oct 09 14:37:59 2018 +0200
@@ -66,7 +66,7 @@
 
     NSK_DISPLAY0("GetCurrentThreadCpuTimerInfo() for current JVMTI env\n");
     if (!NSK_JVMTI_VERIFY(
-            NSK_CPP_STUB2(GetCurrentThreadCpuTimerInfo, jvmti, info))) {
+            jvmti->GetCurrentThreadCpuTimerInfo(info))) {
         return NSK_FALSE;
     }
     NSK_DISPLAY0("Got timer info:\n");
@@ -260,7 +260,7 @@
         memset(&caps, 0, sizeof(caps));
         caps.can_get_current_thread_cpu_time = 1;
         if (!NSK_JVMTI_VERIFY(
-                NSK_CPP_STUB2(AddCapabilities, jvmti, &caps))) {
+                jvmti->AddCapabilities(&caps))) {
             return JNI_ERR;
         }
     }
@@ -276,8 +276,7 @@
         eventCallbacks.ThreadStart = callbackThreadStart;
         eventCallbacks.ThreadEnd = callbackThreadEnd;
         if (!NSK_JVMTI_VERIFY(
-                NSK_CPP_STUB3(SetEventCallbacks, jvmti,
-                                    &eventCallbacks, sizeof(eventCallbacks)))) {
+                jvmti->SetEventCallbacks(&eventCallbacks, sizeof(eventCallbacks)))) {
             return JNI_ERR;
         }
     }
--- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetEnv/GetEnv001/GetEnv001.cpp	Fri Oct 05 17:01:07 2018 -0400
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetEnv/GetEnv001/GetEnv001.cpp	Tue Oct 09 14:37:59 2018 +0200
@@ -87,64 +87,29 @@
         return JNI_ERR;
     }
 
-    if (NSK_CPP_STUB3(
-            GetEnv
-            , vm
-            , (void **) &jvmti
-            , JVMTI_VERSION_1_1
-            ) != JNI_OK || jvmti == NULL)
-    {
+    if (vm->GetEnv((void **) &jvmti, JVMTI_VERSION_1_1) != JNI_OK || jvmti == NULL) {
         NSK_COMPLAIN0("JVMTI_VERSION_1_1 isn't supported.");
         return JNI_OK;
     }
 
-    if (!NSK_JVMTI_VERIFY(
-                NSK_CPP_STUB2(
-                    GetCapabilities
-                    , jvmti
-                    , &caps)
-                )
-       )
+    if (!NSK_JVMTI_VERIFY(jvmti->GetCapabilities(&caps)))
         return JNI_ERR;
 
     caps.can_retransform_classes = 1;
 
     // Register all necessary JVM capabilities
-    if (!NSK_JVMTI_VERIFY(
-                NSK_CPP_STUB2(
-                    AddCapabilities
-                    , jvmti
-                    , &caps)
-                )
-       )
+    if (!NSK_JVMTI_VERIFY(jvmti->AddCapabilities(&caps)))
         return JNI_ERR;
 
     // Register all necessary event callbacks
     memset(&callbacks, 0, sizeof(callbacks));
     callbacks.ClassFileLoadHook = &ClassFileLoadHook;
 
-    if (!NSK_JVMTI_VERIFY(
-                NSK_CPP_STUB3(
-                    SetEventCallbacks
-                    , jvmti
-                    , &callbacks
-                    , sizeof(callbacks)
-                    )
-                )
-       )
+    if (!NSK_JVMTI_VERIFY(jvmti->SetEventCallbacks(&callbacks, sizeof(callbacks))))
         return JNI_ERR;
 
     // Enable class retransformation
-    if (!NSK_JVMTI_VERIFY(
-                NSK_CPP_STUB4(
-                    SetEventNotificationMode
-                    , jvmti
-                    , JVMTI_ENABLE
-                    , JVMTI_EVENT_CLASS_FILE_LOAD_HOOK
-                    , NULL
-                    )
-                )
-       )
+    if (!NSK_JVMTI_VERIFY(jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_CLASS_FILE_LOAD_HOOK, NULL)))
         return JNI_ERR;
 
     return JNI_OK;
--- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetEnvironmentLocalStorage/getenvstor001/getenvstor001.cpp	Fri Oct 05 17:01:07 2018 -0400
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetEnvironmentLocalStorage/getenvstor001/getenvstor001.cpp	Tue Oct 09 14:37:59 2018 +0200
@@ -53,8 +53,7 @@
     void* storage = NULL;
 
     NSK_DISPLAY0("GetEnvironmentLocalStorage() for current JVMTI env\n");
-    if (!NSK_JVMTI_VERIFY(
-            NSK_CPP_STUB2(GetEnvironmentLocalStorage, jvmti, &storage))) {
+    if (!NSK_JVMTI_VERIFY(jvmti->GetEnvironmentLocalStorage(&storage))) {
         return NSK_FALSE;
     }
     NSK_DISPLAY1("  ... got storage: 0x%p\n", (void*)storage);
@@ -158,9 +157,7 @@
         memset(&eventCallbacks, 0, sizeof(eventCallbacks));
         eventCallbacks.VMInit = callbackVMInit;
         eventCallbacks.VMDeath = callbackVMDeath;
-        if (!NSK_JVMTI_VERIFY(
-                NSK_CPP_STUB3(SetEventCallbacks, jvmti,
-                                    &eventCallbacks, sizeof(eventCallbacks)))) {
+        if (!NSK_JVMTI_VERIFY(jvmti->SetEventCallbacks(&eventCallbacks, sizeof(eventCallbacks)))) {
             return JNI_ERR;
         }
 
--- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetErrorName/geterrname001/geterrname001.cpp	Fri Oct 05 17:01:07 2018 -0400
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetErrorName/geterrname001/geterrname001.cpp	Tue Oct 09 14:37:59 2018 +0200
@@ -152,15 +152,14 @@
 
     for (i = 0; i < sizeof(errors)/sizeof(error_info); i++) {
         if (!NSK_JVMTI_VERIFY(
-                NSK_CPP_STUB3(GetErrorName, jvmti, errors[i].err, &name)))
+                jvmti->GetErrorName(errors[i].err, &name)))
             return NSK_FALSE;
         if (strcmp(name, errors[i].name) != 0) {
             NSK_COMPLAIN2("Error: function returns \"%s\", expected \"%s\"\n",
                 name, errors[i].name);
             return_value = NSK_FALSE;
         }
-        if (!NSK_JVMTI_VERIFY(
-                NSK_CPP_STUB2(Deallocate, jvmti, (unsigned char*)name)))
+        if (!NSK_JVMTI_VERIFY(jvmti->Deallocate((unsigned char*)name)))
             return NSK_FALSE;
     }
 
@@ -172,7 +171,7 @@
 void JNICALL
 VMInit(jvmtiEnv *jvmti, JNIEnv* jni, jthread thread) {
 
-    if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB2(GetPhase, jvmti, &phase)))
+    if (!NSK_JVMTI_VERIFY(jvmti->GetPhase(&phase)))
         nsk_jvmti_setFailStatus();
 
     NSK_DISPLAY1("Phase: %s\n", TranslatePhase(phase));
@@ -194,10 +193,10 @@
                   unsigned char** new_class_data) {
     jvmtiPhase curr_phase;
 
-    if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB2(RawMonitorEnter, jvmti, access_lock)))
+    if (!NSK_JVMTI_VERIFY(jvmti->RawMonitorEnter(access_lock)))
         nsk_jvmti_setFailStatus();
 
-    if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB2(GetPhase, jvmti, &curr_phase)))
+    if (!NSK_JVMTI_VERIFY(jvmti->GetPhase(&curr_phase)))
         nsk_jvmti_setFailStatus();
 
     if (phase != curr_phase) {
@@ -210,7 +209,7 @@
             nsk_jvmti_setFailStatus();
     }
 
-    if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB2(RawMonitorExit, jvmti, access_lock)))
+    if (!NSK_JVMTI_VERIFY(jvmti->RawMonitorExit(access_lock)))
         nsk_jvmti_setFailStatus();
 }
 
@@ -224,7 +223,7 @@
     if (!nsk_jvmti_waitForSync(timeout))
         return;
 
-    if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB2(GetPhase, jvmti, &phase)))
+    if (!NSK_JVMTI_VERIFY(jvmti->GetPhase(&phase)))
         nsk_jvmti_setFailStatus();
 
     NSK_DISPLAY1("Phase: %s\n", TranslatePhase(phase));
@@ -270,12 +269,10 @@
         return JNI_ERR;
 
     /* Create data access lock */
-    if (!NSK_JVMTI_VERIFY(
-            NSK_CPP_STUB3(CreateRawMonitor, jvmti,
-                "_access_lock", &access_lock)))
+    if (!NSK_JVMTI_VERIFY(jvmti->CreateRawMonitor("_access_lock", &access_lock)))
         return JNI_ERR;
 
-    if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB2(GetPhase, jvmti, &phase)))
+    if (!NSK_JVMTI_VERIFY(jvmti->GetPhase(&phase)))
         return JNI_ERR;
 
     NSK_DISPLAY1("Phase: %s\n", TranslatePhase(phase));
@@ -288,21 +285,17 @@
     memset(&callbacks, 0, sizeof(callbacks));
     callbacks.VMInit = &VMInit;
     callbacks.ClassFileLoadHook = &ClassFileLoadHook;
-    if (!NSK_JVMTI_VERIFY(
-            NSK_CPP_STUB3(SetEventCallbacks, jvmti,
-                &callbacks, sizeof(callbacks))))
+    if (!NSK_JVMTI_VERIFY(jvmti->SetEventCallbacks(&callbacks, sizeof(callbacks))))
         return JNI_ERR;
 
     /* enable VMInit event */
     if (!NSK_JVMTI_VERIFY(
-            NSK_CPP_STUB4(SetEventNotificationMode, jvmti, JVMTI_ENABLE,
-                JVMTI_EVENT_VM_INIT, NULL)))
+            jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_VM_INIT, NULL)))
         return JNI_ERR;
 
     /* enable ClassFileLoadHook event */
     if (!NSK_JVMTI_VERIFY(
-            NSK_CPP_STUB4(SetEventNotificationMode, jvmti, JVMTI_ENABLE,
-                JVMTI_EVENT_CLASS_FILE_LOAD_HOOK, NULL)))
+            jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_CLASS_FILE_LOAD_HOOK, NULL)))
         return JNI_ERR;
 
     /* register agent proc and arg */
--- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetErrorName/geterrname002/geterrname002.cpp	Fri Oct 05 17:01:07 2018 -0400
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetErrorName/geterrname002/geterrname002.cpp	Tue Oct 09 14:37:59 2018 +0200
@@ -48,12 +48,12 @@
 
     NSK_DISPLAY0("Testcase #1: check on JVMTI_ERROR_ILLEGAL_ARGUMENT\n");
     if (!NSK_JVMTI_VERIFY_CODE(JVMTI_ERROR_ILLEGAL_ARGUMENT,
-            NSK_CPP_STUB3(GetErrorName, jvmti, (jvmtiError)(-1), &name)))
+                               jvmti->GetErrorName((jvmtiError)(-1), &name)))
         nsk_jvmti_setFailStatus();
 
     NSK_DISPLAY0("Testcase #2: check on JVMTI_ERROR_NULL_POINTER\n");
     if (!NSK_JVMTI_VERIFY_CODE(JVMTI_ERROR_NULL_POINTER,
-            NSK_CPP_STUB3(GetErrorName, jvmti, JVMTI_ERROR_NONE, NULL)))
+                               jvmti->GetErrorName(JVMTI_ERROR_NONE, NULL)))
         nsk_jvmti_setFailStatus();
 
     /* resume debugee after last sync */
--- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetExtensionEvents/extevents001/extevents001.cpp	Fri Oct 05 17:01:07 2018 -0400
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetExtensionEvents/extevents001/extevents001.cpp	Tue Oct 09 14:37:59 2018 +0200
@@ -54,8 +54,7 @@
     int i;
 
     NSK_DISPLAY0("Get extension events list\n");
-    if (!NSK_JVMTI_VERIFY(
-            NSK_CPP_STUB3(GetExtensionEvents, jvmti, &extCount, &extList))) {
+    if (!NSK_JVMTI_VERIFY(jvmti->GetExtensionEvents(&extCount, &extList))) {
         return NSK_FALSE;
     }
     NSK_DISPLAY1("  ... got count: %d\n", (int)extCount);
@@ -219,8 +218,7 @@
     }
 
     NSK_DISPLAY1("Deallocate extension events list: 0x%p\n", (void*)extList);
-    if (!NSK_JVMTI_VERIFY(
-            NSK_CPP_STUB2(Deallocate, jvmti, (unsigned char*)extList))) {
+    if (!NSK_JVMTI_VERIFY(jvmti->Deallocate((unsigned char*)extList))) {
         return NSK_FALSE;
     }
     NSK_DISPLAY0("  ... deallocated\n");
--- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetExtensionFunctions/extfuncs001/extfuncs001.cpp	Fri Oct 05 17:01:07 2018 -0400
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetExtensionFunctions/extfuncs001/extfuncs001.cpp	Tue Oct 09 14:37:59 2018 +0200
@@ -53,8 +53,7 @@
     int i;
 
     NSK_DISPLAY0("Get extension functions list\n");
-    if (!NSK_JVMTI_VERIFY(
-            NSK_CPP_STUB3(GetExtensionFunctions, jvmti, &extCount, &extList))) {
+    if (!NSK_JVMTI_VERIFY(jvmti->GetExtensionFunctions(&extCount, &extList))) {
         return NSK_FALSE;
     }
     NSK_DISPLAY1("  ... got count: %d\n", (int)extCount);
@@ -230,8 +229,7 @@
     }
 
     NSK_DISPLAY1("Deallocate extension functions list: 0x%p\n", (void*)extList);
-    if (!NSK_JVMTI_VERIFY(
-            NSK_CPP_STUB2(Deallocate, jvmti, (unsigned char*)extList))) {
+    if (!NSK_JVMTI_VERIFY(jvmti->Deallocate((unsigned char*)extList))) {
         return NSK_FALSE;
     }
     NSK_DISPLAY0("  ... deallocated\n");
--- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetFieldName/getfldnm005/getfldnm005.cpp	Fri Oct 05 17:01:07 2018 -0400
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetFieldName/getfldnm005/getfldnm005.cpp	Tue Oct 09 14:37:59 2018 +0200
@@ -92,8 +92,7 @@
     char *sign;
     char *gen_sign;
 
-    if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB6(GetFieldName,
-            jvmti, testedCls, testedFld, &name, &sign, &gen_sign))) {
+    if (!NSK_JVMTI_VERIFY(jvmti->GetFieldName(testedCls, testedFld, &name, &sign, &gen_sign))) {
         NSK_COMPLAIN1("TEST FAILED: unable to get field name & signature for \"%s\"\n\n",
             fld_sig[idx][0]);
         return STATUS_FAILED;
@@ -120,15 +119,12 @@
                 sign, (gen_sign==NULL)?"NULL":gen_sign);
 
         NSK_DISPLAY0("Deallocating name & signature arrays\n");
-        if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB2(Deallocate,
-                jvmti, (unsigned char*) name)))
+        if (!NSK_JVMTI_VERIFY(jvmti->Deallocate((unsigned char*) name)))
             totRes = STATUS_FAILED;
-        if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB2(Deallocate,
-                jvmti, (unsigned char*) sign)))
+        if (!NSK_JVMTI_VERIFY(jvmti->Deallocate((unsigned char*) sign)))
             totRes = STATUS_FAILED;
         if (gen_sign!=NULL)
-            if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB2(Deallocate,
-                    jvmti, (unsigned char*) gen_sign)))
+            if (!NSK_JVMTI_VERIFY(jvmti->Deallocate((unsigned char*) gen_sign)))
                 totRes = STATUS_FAILED;
     }
 
@@ -140,8 +136,7 @@
         JNIEnv *jni, jobject obj) {
     int res = PASSED, i, instance;
     jfieldID testedFld = NULL;
-    jclass objCls = NSK_CPP_STUB2(GetObjectClass,
-        jni, obj);
+    jclass objCls = jni->GetObjectClass(obj);
 
     for (i=0; i<FLDS_NUM; i++) {
         instance = strcmp(fld_sig[i][1], "instance");
@@ -150,9 +145,7 @@
             (instance==0)?"instance":"static",
              fld_sig[i][0]);
         if (instance==0) {
-            if (!NSK_JNI_VERIFY(jni, (testedFld = NSK_CPP_STUB4(
-                    GetFieldID, jni, objCls,
-                    fld_sig[i][0], fld_sig[i][2])) != NULL)) {
+            if (!NSK_JNI_VERIFY(jni, (testedFld = jni->GetFieldID(objCls, fld_sig[i][0], fld_sig[i][2])) != NULL)) {
                 NSK_COMPLAIN1("TEST FAILERE: unable to get field ID for \"%s\"\n\n",
                     fld_sig[i][0]);
                 res = STATUS_FAILED;
@@ -160,9 +153,7 @@
             }
         }
         else
-            if (!NSK_JNI_VERIFY(jni, (testedFld = NSK_CPP_STUB4(
-                    GetStaticFieldID, jni, objCls,
-                    fld_sig[i][0], fld_sig[i][2])) != NULL)) {
+            if (!NSK_JNI_VERIFY(jni, (testedFld = jni->GetStaticFieldID(objCls, fld_sig[i][0], fld_sig[i][2])) != NULL)) {
                 NSK_COMPLAIN1("TEST FAILERE: unable to get field ID for \"%s\"\n\n",
                     fld_sig[i][0]);
                 res = STATUS_FAILED;
--- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetJLocationFormat/getjlocfmt001/getjlocfmt001.cpp	Fri Oct 05 17:01:07 2018 -0400
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetJLocationFormat/getjlocfmt001/getjlocfmt001.cpp	Tue Oct 09 14:37:59 2018 +0200
@@ -57,14 +57,14 @@
 VMInit(jvmtiEnv *jvmti, JNIEnv* jni, jthread thread) {
     jvmtiJlocationFormat format;
 
-    if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB2(GetPhase, jvmti, &phase)))
+    if (!NSK_JVMTI_VERIFY(jvmti->GetPhase(&phase)))
         nsk_jvmti_setFailStatus();
 
     NSK_DISPLAY1("Phase: %s\n", TranslatePhase(phase));
 
     /* testcase #3: check GetJLocationFormat in VMInit */
     NSK_DISPLAY0("Testcase #3: check GetJLocationFormat in VMInit\n");
-    if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB2(GetJLocationFormat, jvmti, &format)))
+    if (!NSK_JVMTI_VERIFY(jvmti->GetJLocationFormat(&format)))
         nsk_jvmti_setFailStatus();
     if (!NSK_VERIFY((format == JVMTI_JLOCATION_JVMBCI)
                  || (format == JVMTI_JLOCATION_MACHINEPC)
@@ -85,10 +85,10 @@
     jvmtiJlocationFormat format;
     jvmtiPhase curr_phase;
 
-    if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB2(RawMonitorEnter, jvmti, access_lock)))
+    if (!NSK_JVMTI_VERIFY(jvmti->RawMonitorEnter(access_lock)))
         nsk_jvmti_setFailStatus();
 
-    if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB2(GetPhase, jvmti, &curr_phase)))
+    if (!NSK_JVMTI_VERIFY(jvmti->GetPhase(&curr_phase)))
         nsk_jvmti_setFailStatus();
 
     if (phase != curr_phase) {
@@ -97,7 +97,7 @@
 
         /* testcase #2: check GetJLocationFormat in ClassFileLoadHook */
         NSK_DISPLAY0("Testcase #2: check GetJLocationFormat in ClassFileLoadHook\n");
-        if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB2(GetJLocationFormat, jvmti, &format)))
+        if (!NSK_JVMTI_VERIFY(jvmti->GetJLocationFormat(&format)))
             nsk_jvmti_setFailStatus();
         if (!NSK_VERIFY((format == JVMTI_JLOCATION_JVMBCI)
                      || (format == JVMTI_JLOCATION_MACHINEPC)
@@ -106,7 +106,7 @@
         NSK_DISPLAY1("JlocationFormat: %s\n", TranslateJlocationFormat(format));
     }
 
-    if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB2(RawMonitorExit, jvmti, access_lock)))
+    if (!NSK_JVMTI_VERIFY(jvmti->RawMonitorExit(access_lock)))
         nsk_jvmti_setFailStatus();
 }
 
@@ -121,14 +121,14 @@
     if (!nsk_jvmti_waitForSync(timeout))
         return;
 
-    if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB2(GetPhase, jvmti, &phase)))
+    if (!NSK_JVMTI_VERIFY(jvmti->GetPhase(&phase)))
         nsk_jvmti_setFailStatus();
 
     NSK_DISPLAY1("Phase: %s\n", TranslatePhase(phase));
 
     /* testcase #4: check GetJLocationFormat in agentProc */
     NSK_DISPLAY0("Testcase #4: check GetJLocationFormat in agentProc\n");
-    if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB2(GetJLocationFormat, jvmti, &format)))
+    if (!NSK_JVMTI_VERIFY(jvmti->GetJLocationFormat(&format)))
         nsk_jvmti_setFailStatus();
     if (!NSK_VERIFY((format == JVMTI_JLOCATION_JVMBCI)
                  || (format == JVMTI_JLOCATION_MACHINEPC)
@@ -173,19 +173,17 @@
         return JNI_ERR;
 
     /* Create data access lock */
-    if (!NSK_JVMTI_VERIFY(
-            NSK_CPP_STUB3(CreateRawMonitor, jvmti,
-                "_access_lock", &access_lock)))
+    if (!NSK_JVMTI_VERIFY(jvmti->CreateRawMonitor("_access_lock", &access_lock)))
         return JNI_ERR;
 
-    if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB2(GetPhase, jvmti, &phase)))
+    if (!NSK_JVMTI_VERIFY(jvmti->GetPhase(&phase)))
         return JNI_ERR;
 
     NSK_DISPLAY1("Phase: %s\n", TranslatePhase(phase));
 
     /* testcase #1: check GetJLocationFormat in Agent_OnLoad */
     NSK_DISPLAY0("Testcase #1: check GetJLocationFormat in Agent_OnLoad\n");
-    if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB2(GetJLocationFormat, jvmti, &format)))
+    if (!NSK_JVMTI_VERIFY(jvmti->GetJLocationFormat(&format)))
         nsk_jvmti_setFailStatus();
     if (!NSK_VERIFY((format == JVMTI_JLOCATION_JVMBCI)
                  || (format == JVMTI_JLOCATION_MACHINEPC)
@@ -196,21 +194,17 @@
     memset(&callbacks, 0, sizeof(callbacks));
     callbacks.VMInit = &VMInit;
     callbacks.ClassFileLoadHook = &ClassFileLoadHook;
-    if (!NSK_JVMTI_VERIFY(
-            NSK_CPP_STUB3(SetEventCallbacks, jvmti,
-                &callbacks, sizeof(callbacks))))
+    if (!NSK_JVMTI_VERIFY(jvmti->SetEventCallbacks(&callbacks, sizeof(callbacks))))
         return JNI_ERR;
 
     /* enable VMInit event */
     if (!NSK_JVMTI_VERIFY(
-            NSK_CPP_STUB4(SetEventNotificationMode, jvmti, JVMTI_ENABLE,
-                JVMTI_EVENT_VM_INIT, NULL)))
+            jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_VM_INIT, NULL)))
         return JNI_ERR;
 
     /* enable ClassFileLoadHook event */
     if (!NSK_JVMTI_VERIFY(
-            NSK_CPP_STUB4(SetEventNotificationMode, jvmti, JVMTI_ENABLE,
-                JVMTI_EVENT_CLASS_FILE_LOAD_HOOK, NULL)))
+            jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_CLASS_FILE_LOAD_HOOK, NULL)))
         return JNI_ERR;
 
     /* register agent proc and arg */
--- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetJLocationFormat/getjlocfmt002/getjlocfmt002.cpp	Fri Oct 05 17:01:07 2018 -0400
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetJLocationFormat/getjlocfmt002/getjlocfmt002.cpp	Tue Oct 09 14:37:59 2018 +0200
@@ -46,8 +46,7 @@
         return;
 
     NSK_DISPLAY0("Check if GetJLocationFormat(NULL) returns JVMTI_ERROR_NULL_POINTER\n");
-    if (!NSK_JVMTI_VERIFY_CODE(JVMTI_ERROR_NULL_POINTER,
-            NSK_CPP_STUB2(GetJLocationFormat, jvmti, NULL)))
+    if (!NSK_JVMTI_VERIFY_CODE(JVMTI_ERROR_NULL_POINTER, jvmti->GetJLocationFormat(NULL)))
         nsk_jvmti_setFailStatus();
 
     /* resume debugee after last sync */
--- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetLoadedClasses/loadedclss002/loadedclss002.cpp	Fri Oct 05 17:01:07 2018 -0400
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetLoadedClasses/loadedclss002/loadedclss002.cpp	Tue Oct 09 14:37:59 2018 +0200
@@ -60,8 +60,7 @@
     jint i;
 
     for (i = 0; i < classCount && !found; i++) {
-        if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB4(GetClassSignature, jvmti,
-                classes[i], &signature, &generic)))
+        if (!NSK_JVMTI_VERIFY(jvmti->GetClassSignature(classes[i], &signature, &generic)))
             break;
 
         if (signature != NULL && strcmp(signature, exp_sig) == 0) {
@@ -70,10 +69,10 @@
         }
 
         if (signature != NULL)
-            NSK_CPP_STUB2(Deallocate, jvmti, (unsigned char*)signature);
+            jvmti->Deallocate((unsigned char*)signature);
 
         if (generic != NULL)
-            NSK_CPP_STUB2(Deallocate, jvmti, (unsigned char*)generic);
+            jvmti->Deallocate((unsigned char*)generic);
     }
 
     return found;
@@ -91,8 +90,7 @@
     if (!nsk_jvmti_waitForSync(timeout))
         return;
 
-    if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB3(GetLoadedClasses, jvmti,
-            &classCount, &classes))) {
+    if (!NSK_JVMTI_VERIFY(jvmti->GetLoadedClasses(&classCount, &classes))) {
         nsk_jvmti_setFailStatus();
         return;
     }
@@ -124,7 +122,7 @@
     }
 
     if (classes != NULL)
-        NSK_CPP_STUB2(Deallocate, jvmti, (unsigned char*)classes);
+        jvmti->Deallocate((unsigned char*)classes);
 
     if (!nsk_jvmti_resumeSync())
         return;
--- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetLocalVariableTable/localtab004/localtab004.cpp	Fri Oct 05 17:01:07 2018 -0400
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetLocalVariableTable/localtab004/localtab004.cpp	Tue Oct 09 14:37:59 2018 +0200
@@ -99,13 +99,9 @@
 /* get the JNI method ID for a method with name m_name and
    signature m_sign */
         if (methInfo[i].inst) /* an instance method */
-            methInfo[i].mid = NSK_CPP_STUB4(GetMethodID,
-                jni_env, testedCls,
-                methInfo[i].m_name, methInfo[i].m_sign);
+            methInfo[i].mid = jni_env->GetMethodID(testedCls, methInfo[i].m_name, methInfo[i].m_sign);
         else                   /* a static method */
-            methInfo[i].mid = NSK_CPP_STUB4(GetStaticMethodID,
-                jni_env, testedCls,
-                methInfo[i].m_name, methInfo[i].m_sign);
+            methInfo[i].mid = jni_env->GetStaticMethodID(testedCls, methInfo[i].m_name, methInfo[i].m_sign);
         if (methInfo[i].mid == NULL) {
             NSK_COMPLAIN3("TEST FAILURE: unable to get the method ID for the %s method \"%s\", signature \"%s\"\n\n",
                 methInfo[i].inst?"instance":"static",
@@ -114,8 +110,7 @@
         }
 
 /* get the LocalVariableTable attribute */
-        if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB4(GetLocalVariableTable,
-                jvmti, methInfo[i].mid, &count, &lv_table))) {
+        if (!NSK_JVMTI_VERIFY(jvmti->GetLocalVariableTable(methInfo[i].mid, &count, &lv_table))) {
             NSK_COMPLAIN3("TEST FAILED: unable to get local variable table\n\tfor the %s method \"%s\", signature \"%s\"\n\n",
                 methInfo[i].inst?"instance":"static",
                 methInfo[i].m_name, methInfo[i].m_sign);
@@ -175,8 +170,7 @@
 JNIEXPORT jint JNICALL
 Java_nsk_jvmti_GetLocalVariableTable_localtab004_check(
         JNIEnv *env, jobject obj, jobject testedObj) {
-    jclass testedCls = NSK_CPP_STUB2(GetObjectClass,
-        env, testedObj);
+    jclass testedCls = env->GetObjectClass(testedObj);
 
     if (!caps.can_access_local_variables)
         return PASSED;
@@ -208,12 +202,10 @@
     /* add capability to access local variables */
     memset(&caps, 0, sizeof(jvmtiCapabilities));
     caps.can_access_local_variables = 1;
-    if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB2(AddCapabilities,
-            jvmti, &caps)))
+    if (!NSK_JVMTI_VERIFY(jvmti->AddCapabilities(&caps)))
         return JNI_ERR;
 
-    if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB2(GetCapabilities,
-            jvmti, &caps)))
+    if (!NSK_JVMTI_VERIFY(jvmti->GetCapabilities(&caps)))
         return JNI_ERR;
 
     if (!caps.can_access_local_variables)
--- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetLocalVariableTable/localtab005/localtab005.cpp	Fri Oct 05 17:01:07 2018 -0400
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetLocalVariableTable/localtab005/localtab005.cpp	Tue Oct 09 14:37:59 2018 +0200
@@ -107,13 +107,9 @@
 /* get the JNI method ID for a method with name m_name and
    signature m_sign */
         if (methInfo[i].inst) /* an instance method */
-            methInfo[i].mid = NSK_CPP_STUB4(GetMethodID,
-                jni_env, testedCls,
-                methInfo[i].m_name, methInfo[i].m_sign);
+            methInfo[i].mid = jni_env->GetMethodID(testedCls, methInfo[i].m_name, methInfo[i].m_sign);
         else                   /* a static method */
-            methInfo[i].mid = NSK_CPP_STUB4(GetStaticMethodID,
-                jni_env, testedCls,
-                methInfo[i].m_name, methInfo[i].m_sign);
+            methInfo[i].mid = jni_env->GetStaticMethodID(testedCls, methInfo[i].m_name, methInfo[i].m_sign);
         if (methInfo[i].mid == NULL) {
             NSK_COMPLAIN3("TEST FAILURE: unable to get the method ID for the %s method \"%s\", signature \"%s\"\n\n",
                 methInfo[i].inst?"instance":"static",
@@ -122,8 +118,7 @@
         }
 
 /* get the LocalVariableTable attribute */
-        if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB4(GetLocalVariableTable,
-                jvmti, methInfo[i].mid, &count, &lv_table))) {
+        if (!NSK_JVMTI_VERIFY(jvmti->GetLocalVariableTable(methInfo[i].mid, &count, &lv_table))) {
             NSK_COMPLAIN3("TEST FAILED: unable to get local variable table\n\tfor the %s method \"%s\", signature \"%s\"\n\n",
                 methInfo[i].inst?"instance":"static",
                 methInfo[i].m_name, methInfo[i].m_sign);
@@ -185,8 +180,7 @@
                 }
             }
             NSK_DISPLAY0("Deallocating the local variable table entries\n");
-            if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB2(Deallocate,
-                    jvmti, (unsigned char*) lv_table))) {
+            if (!NSK_JVMTI_VERIFY(jvmti->Deallocate((unsigned char*) lv_table))) {
                 totRes = STATUS_FAILED;
             }
 
@@ -200,8 +194,7 @@
 JNIEXPORT jint JNICALL
 Java_nsk_jvmti_GetLocalVariableTable_localtab005_check(
         JNIEnv *env, jobject obj, jobject testedObj) {
-    jclass testedCls = NSK_CPP_STUB2(GetObjectClass,
-        env, testedObj);
+    jclass testedCls = env->GetObjectClass(testedObj);
 
     if (!caps.can_access_local_variables)
         return PASSED;
@@ -233,12 +226,10 @@
     /* add capability to access local variables */
     memset(&caps, 0, sizeof(jvmtiCapabilities));
     caps.can_access_local_variables = 1;
-    if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB2(AddCapabilities,
-            jvmti, &caps)))
+    if (!NSK_JVMTI_VERIFY(jvmti->AddCapabilities(&caps)))
         return JNI_ERR;
 
-    if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB2(GetCapabilities,
-            jvmti, &caps)))
+    if (!NSK_JVMTI_VERIFY(jvmti->GetCapabilities(&caps)))
         return JNI_ERR;
 
     if (!caps.can_access_local_variables)
--- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetMethodName/methname003/methname003.cpp	Fri Oct 05 17:01:07 2018 -0400
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetMethodName/methname003/methname003.cpp	Tue Oct 09 14:37:59 2018 +0200
@@ -89,8 +89,7 @@
     char *sign;
     char *gen_sign;
 
-    if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB5(GetMethodName,
-            jvmti, testedMeth, &name, &sign, &gen_sign))) {
+    if (!NSK_JVMTI_VERIFY(jvmti->GetMethodName(testedMeth, &name, &sign, &gen_sign))) {
         NSK_COMPLAIN1("TEST FAILED: unable to get class signature for \"%s\"\n\n",
             meth_sig[clsIdx][methIdx][0]);
         return STATUS_FAILED;
@@ -112,17 +111,14 @@
                 sign, (gen_sign==NULL)?"NULL":gen_sign);
 
         NSK_DISPLAY0("Deallocating name & signature arrays\n");
-        if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB2(Deallocate,
-                jvmti, (unsigned char*) name))) {
+        if (!NSK_JVMTI_VERIFY(jvmti->Deallocate((unsigned char*) name))) {
             totRes = STATUS_FAILED;
         }
-        if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB2(Deallocate,
-                jvmti, (unsigned char*) sign))) {
+        if (!NSK_JVMTI_VERIFY(jvmti->Deallocate((unsigned char*) sign))) {
             totRes = STATUS_FAILED;
         }
         if (gen_sign!=NULL)
-            if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB2(Deallocate,
-                    jvmti, (unsigned char*) gen_sign))) {
+            if (!NSK_JVMTI_VERIFY(jvmti->Deallocate((unsigned char*) gen_sign))) {
                 totRes = STATUS_FAILED;
             }
     }
@@ -135,8 +131,7 @@
         JNIEnv *jni, jobject obj, jobject testedObj, jint clsIdx) {
     int res = PASSED, i, instance;
     jmethodID testedMeth = NULL;
-    jclass objCls = NSK_CPP_STUB2(GetObjectClass,
-        jni, testedObj);
+    jclass objCls = jni->GetObjectClass(testedObj);
 
     for (i=0; i<METH_NUM; i++) {
         instance = strcmp(meth_sig[clsIdx][i][1], "instance");
@@ -145,9 +140,7 @@
             (instance==0)?"instance":"static",
              meth_sig[clsIdx][i][0]);
         if (instance==0) {
-            if (!NSK_JNI_VERIFY(jni, (testedMeth = NSK_CPP_STUB4(GetMethodID,
-                    jni, objCls, meth_sig[clsIdx][i][0],
-                    meth_sig[clsIdx][i][2])) != NULL)) {
+            if (!NSK_JNI_VERIFY(jni, (testedMeth = jni->GetMethodID(objCls, meth_sig[clsIdx][i][0], meth_sig[clsIdx][i][2])) != NULL)) {
                 NSK_COMPLAIN2("TEST FAILERE: unable to get method ID for \"%s\" \"%s\"\n\n",
                     meth_sig[clsIdx][i][0], meth_sig[clsIdx][i][2]);
                 res = STATUS_FAILED;
@@ -155,9 +148,7 @@
             }
         }
         else
-            if (!NSK_JNI_VERIFY(jni, (testedMeth = NSK_CPP_STUB4(GetStaticMethodID,
-                    jni, objCls, meth_sig[clsIdx][i][0],
-                    meth_sig[clsIdx][i][2])) != NULL)) {
+            if (!NSK_JNI_VERIFY(jni, (testedMeth = jni->GetStaticMethodID(objCls, meth_sig[clsIdx][i][0], meth_sig[clsIdx][i][2])) != NULL)) {
                 NSK_COMPLAIN2("TEST FAILERE: unable to get method ID for \"%s\" \"%s\"\n\n",
                     meth_sig[clsIdx][i][0], meth_sig[clsIdx][i][2]);
                 res = STATUS_FAILED;
--- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetObjectHashCode/objhashcode001/objhashcode001.cpp	Fri Oct 05 17:01:07 2018 -0400
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetObjectHashCode/objhashcode001/objhashcode001.cpp	Tue Oct 09 14:37:59 2018 +0200
@@ -60,8 +60,7 @@
             jfieldID objectField = NULL;
 
             NSK_DISPLAY1("Find debugee class: %s\n", DEBUGEE_CLASS_NAME);
-            if (!NSK_JNI_VERIFY(jni, (debugeeClass =
-                    NSK_CPP_STUB2(FindClass, jni, DEBUGEE_CLASS_NAME)) != NULL)) {
+            if (!NSK_JNI_VERIFY(jni, (debugeeClass = jni->FindClass(DEBUGEE_CLASS_NAME)) != NULL)) {
                 nsk_jvmti_setFailStatus();
                 return;
             }
@@ -69,8 +68,7 @@
 
             NSK_DISPLAY1("Find static field: %s\n", OBJECT_FIELD_NAME);
             if (!NSK_JNI_VERIFY(jni, (objectField =
-                    NSK_CPP_STUB4(GetStaticFieldID, jni, debugeeClass,
-                                    OBJECT_FIELD_NAME, OBJECT_CLASS_SIG)) != NULL)) {
+                    jni->GetStaticFieldID(debugeeClass, OBJECT_FIELD_NAME, OBJECT_CLASS_SIG)) != NULL)) {
                 nsk_jvmti_setFailStatus();
                 return;
             }
@@ -78,16 +76,14 @@
 
             NSK_DISPLAY1("Get object from static field: %s\n", OBJECT_FIELD_NAME);
             if (!NSK_JNI_VERIFY(jni, (testedObject =
-                    NSK_CPP_STUB3(GetStaticObjectField, jni, debugeeClass,
-                                                            objectField)) != NULL)) {
+                    jni->GetStaticObjectField(debugeeClass, objectField)) != NULL)) {
                 nsk_jvmti_setFailStatus();
                 return;
             }
             NSK_DISPLAY1("  ... got object: %p\n", (void*)testedObject);
 
             NSK_DISPLAY1("Create global reference for object: %p\n", (void*)testedObject);
-            if (!NSK_JNI_VERIFY(jni, (testedObject =
-                    NSK_CPP_STUB2(NewGlobalRef, jni, testedObject)) != NULL)) {
+            if (!NSK_JNI_VERIFY(jni, (testedObject = jni->NewGlobalRef(testedObject)) != NULL)) {
                 nsk_jvmti_setFailStatus();
                 return;
             }
@@ -97,8 +93,7 @@
         NSK_DISPLAY0(">>> Testcase #1: get initial hash code of the object\n");
         {
             NSK_DISPLAY1("Get hashcode for object: %p\n", (void*)testedObject);
-            if (!NSK_JVMTI_VERIFY(
-                    NSK_CPP_STUB3(GetObjectHashCode, jvmti, testedObject, &objectHashCode))) {
+            if (!NSK_JVMTI_VERIFY(jvmti->GetObjectHashCode(testedObject, &objectHashCode))) {
                 nsk_jvmti_setFailStatus();
                 return;
             }
@@ -110,8 +105,7 @@
             jint hashCode = 0;
 
             NSK_DISPLAY1("Get hashcode for object: %p\n", (void*)testedObject);
-            if (!NSK_JVMTI_VERIFY(
-                    NSK_CPP_STUB3(GetObjectHashCode, jvmti, testedObject, &hashCode))) {
+            if (!NSK_JVMTI_VERIFY(jvmti->GetObjectHashCode(testedObject, &hashCode))) {
                 nsk_jvmti_setFailStatus();
                 return;
             }
@@ -141,7 +135,7 @@
 
             NSK_DISPLAY1("Get hashcode for object: %p\n", (void*)testedObject);
             if (!NSK_JVMTI_VERIFY(
-                    NSK_CPP_STUB3(GetObjectHashCode, jvmti, testedObject, &hashCode))) {
+                    jvmti->GetObjectHashCode(testedObject, &hashCode))) {
                 nsk_jvmti_setFailStatus();
                 return;
             }
@@ -162,7 +156,7 @@
         NSK_DISPLAY0(">>> Clean used data\n");
         {
             NSK_DISPLAY1("Delete object reference: %p\n", (void*)testedObject);
-            NSK_TRACE(NSK_CPP_STUB2(DeleteGlobalRef, jni, testedObject));
+            NSK_TRACE(jni->DeleteGlobalRef(testedObject));
         }
     }
 
--- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetObjectSize/objsize001/objsize001.cpp	Fri Oct 05 17:01:07 2018 -0400
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetObjectSize/objsize001/objsize001.cpp	Tue Oct 09 14:37:59 2018 +0200
@@ -57,8 +57,7 @@
             jfieldID objectField = NULL;
 
             NSK_DISPLAY1("Find debugee class: %s\n", DEBUGEE_CLASS_NAME);
-            if (!NSK_JNI_VERIFY(jni, (debugeeClass =
-                    NSK_CPP_STUB2(FindClass, jni, DEBUGEE_CLASS_NAME)) != NULL)) {
+            if (!NSK_JNI_VERIFY(jni, (debugeeClass = jni->FindClass(DEBUGEE_CLASS_NAME)) != NULL)) {
                 nsk_jvmti_setFailStatus();
                 return;
             }
@@ -66,8 +65,7 @@
 
             NSK_DISPLAY1("Find static field: %s\n", OBJECT_FIELD_NAME);
             if (!NSK_JNI_VERIFY(jni, (objectField =
-                    NSK_CPP_STUB4(GetStaticFieldID, jni, debugeeClass,
-                                    OBJECT_FIELD_NAME, OBJECT_CLASS_SIG)) != NULL)) {
+                    jni->GetStaticFieldID(debugeeClass, OBJECT_FIELD_NAME, OBJECT_CLASS_SIG)) != NULL)) {
                 nsk_jvmti_setFailStatus();
                 return;
             }
@@ -75,16 +73,14 @@
 
             NSK_DISPLAY1("Get object from static field: %s\n", OBJECT_FIELD_NAME);
             if (!NSK_JNI_VERIFY(jni, (testedObject =
-                    NSK_CPP_STUB3(GetStaticObjectField, jni, debugeeClass,
-                                                            objectField)) != NULL)) {
+                    jni->GetStaticObjectField(debugeeClass, objectField)) != NULL)) {
                 nsk_jvmti_setFailStatus();
                 return;
             }
             NSK_DISPLAY1("  ... got object: 0x%p\n", (void*)testedObject);
 
             NSK_DISPLAY1("Create global reference for object: 0x%p\n", (void*)testedObject);
-            if (!NSK_JNI_VERIFY(jni, (testedObject =
-                    NSK_CPP_STUB2(NewGlobalRef, jni, testedObject)) != NULL)) {
+            if (!NSK_JNI_VERIFY(jni, (testedObject = jni->NewGlobalRef(testedObject)) != NULL)) {
                 nsk_jvmti_setFailStatus();
                 return;
             }
@@ -94,8 +90,7 @@
         NSK_DISPLAY0(">>> Testcase #1: get initial size of the object\n");
         {
             NSK_DISPLAY1("Get size for object: 0x%p\n", (void*)testedObject);
-            if (!NSK_JVMTI_VERIFY(
-                    NSK_CPP_STUB3(GetObjectSize, jvmti, testedObject, &objectSize))) {
+            if (!NSK_JVMTI_VERIFY(jvmti->GetObjectSize(testedObject, &objectSize))) {
                 nsk_jvmti_setFailStatus();
                 return;
             }
@@ -113,8 +108,7 @@
             jlong size = 0;
 
             NSK_DISPLAY1("Get size for object: 0x%p\n", (void*)testedObject);
-            if (!NSK_JVMTI_VERIFY(
-                    NSK_CPP_STUB3(GetObjectSize, jvmti, testedObject, &size))) {
+            if (!NSK_JVMTI_VERIFY(jvmti->GetObjectSize(testedObject, &size))) {
                 nsk_jvmti_setFailStatus();
                 return;
             }
@@ -142,8 +136,7 @@
                 return;
 
             NSK_DISPLAY1("Get size for object: 0x%p\n", (void*)testedObject);
-            if (!NSK_JVMTI_VERIFY(
-                    NSK_CPP_STUB3(GetObjectSize, jvmti, testedObject, &size))) {
+            if (!NSK_JVMTI_VERIFY(jvmti->GetObjectSize(testedObject, &size))) {
                 nsk_jvmti_setFailStatus();
                 return;
             }
@@ -163,7 +156,7 @@
         NSK_DISPLAY0(">>> Clean used data\n");
         {
             NSK_DISPLAY1("Delete object reference: 0x%p\n", (void*)testedObject);
-            NSK_TRACE(NSK_CPP_STUB2(DeleteGlobalRef, jni, testedObject));
+            NSK_TRACE(jni->DeleteGlobalRef(testedObject));
         }
     }
 
--- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetObjectsWithTags/objwithtags001/objwithtags001.cpp	Fri Oct 05 17:01:07 2018 -0400
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetObjectsWithTags/objwithtags001/objwithtags001.cpp	Tue Oct 09 14:37:59 2018 +0200
@@ -63,17 +63,13 @@
 
     NSK_DISPLAY2("Allocate memory for lists: %d objects for %d tags\n",
                                                             objectsCount, tagsCount);
-    if (!NSK_JVMTI_VERIFY(
-            NSK_CPP_STUB3(Allocate, jvmti, (size * sizeof(jobject)),
-                                                    (unsigned char**)objects))) {
+    if (!NSK_JVMTI_VERIFY(jvmti->Allocate((size * sizeof(jobject)), (unsigned char**)objects))) {
         nsk_jvmti_setFailStatus();
         return NSK_FALSE;
     }
     NSK_DISPLAY1("  ... allocated objects list: 0x%p\n", (void*)objects);
 
-    if (!NSK_JVMTI_VERIFY(
-            NSK_CPP_STUB3(Allocate, jvmti, (tagsCount * sizeof(jlong)),
-                                                    (unsigned char**)tags))) {
+    if (!NSK_JVMTI_VERIFY(jvmti->Allocate((tagsCount * sizeof(jlong)), (unsigned char**)tags))) {
         nsk_jvmti_setFailStatus();
         return NSK_FALSE;
     }
@@ -91,8 +87,7 @@
     }
 
     NSK_DISPLAY1("Find debugee class: %s\n", DEBUGEE_CLASS_NAME);
-    if (!NSK_JNI_VERIFY(jni, (debugeeClass =
-            NSK_CPP_STUB2(FindClass, jni, DEBUGEE_CLASS_NAME)) != NULL)) {
+    if (!NSK_JNI_VERIFY(jni, (debugeeClass = jni->FindClass(DEBUGEE_CLASS_NAME)) != NULL)) {
         nsk_jvmti_setFailStatus();
         return NSK_FALSE;
     }
@@ -100,8 +95,7 @@
 
     NSK_DISPLAY1("Find static field: %s\n", OBJECTS_FIELD_NAME);
     if (!NSK_JNI_VERIFY(jni, (objectField =
-            NSK_CPP_STUB4(GetStaticFieldID, jni, debugeeClass,
-                            OBJECTS_FIELD_NAME, OBJECTS_FIELD_SIG)) != NULL)) {
+            jni->GetStaticFieldID(debugeeClass, OBJECTS_FIELD_NAME, OBJECTS_FIELD_SIG)) != NULL)) {
         nsk_jvmti_setFailStatus();
         return NSK_FALSE;
     }
@@ -109,8 +103,7 @@
 
     NSK_DISPLAY1("Get objects array from static field: %s\n", OBJECTS_FIELD_NAME);
     if (!NSK_JNI_VERIFY(jni, (arrayObject = (jobjectArray)
-            NSK_CPP_STUB3(GetStaticObjectField, jni, debugeeClass,
-                                                    objectField)) != NULL)) {
+            jni->GetStaticObjectField(debugeeClass, objectField)) != NULL)) {
         nsk_jvmti_setFailStatus();
         return NSK_FALSE;
     }
@@ -120,8 +113,7 @@
         jsize arrayLen = 0;
         jsize k;
 
-        if (!NSK_JNI_VERIFY(jni, (arrayLen =
-                NSK_CPP_STUB2(GetArrayLength, jni, arrayObject)) == size)) {
+        if (!NSK_JNI_VERIFY(jni, (arrayLen = jni->GetArrayLength(arrayObject)) == size)) {
             NSK_DISPLAY1("  ... got array length: %d\n", (int)size);
             nsk_jvmti_setFailStatus();
             return NSK_FALSE;
@@ -131,13 +123,11 @@
         for (k = 0; k < size; k++) {
             jobject object = NULL;
 
-            if (!NSK_JNI_VERIFY(jni, (object =
-                NSK_CPP_STUB3(GetObjectArrayElement, jni, arrayObject, k)) != NULL)) {
+            if (!NSK_JNI_VERIFY(jni, (object = jni->GetObjectArrayElement(arrayObject, k)) != NULL)) {
                 nsk_jvmti_setFailStatus();
                 return NSK_FALSE;
             }
-            if (!NSK_JNI_VERIFY(jni, (object =
-                NSK_CPP_STUB2(NewGlobalRef, jni, object)) != NULL)) {
+            if (!NSK_JNI_VERIFY(jni, (object = jni->NewGlobalRef(object)) != NULL)) {
                 nsk_jvmti_setFailStatus();
                 return NSK_FALSE;
             }
@@ -162,14 +152,14 @@
     NSK_DISPLAY1("Release objects references: %d objects\n", size);
     for (k = 0; k < size; k++) {
         if (objects[k] != NULL) {
-            NSK_TRACE(NSK_CPP_STUB2(DeleteGlobalRef, jni, objects[k]));
+            NSK_TRACE(jni->DeleteGlobalRef(objects[k]));
         }
     }
     NSK_DISPLAY1("  ... object references released: %d objects\n", size);
 
     NSK_DISPLAY1("Deallocate objects list: 0x%p\n", (void*)objects);
     if (!NSK_JVMTI_VERIFY(
-            NSK_CPP_STUB2(Deallocate, jvmti, (unsigned char*)objects))) {
+            jvmti->Deallocate((unsigned char*)objects))) {
         nsk_jvmti_setFailStatus();
     }
 
@@ -178,7 +168,7 @@
 
     NSK_DISPLAY1("Deallocate tags list: 0x%p\n", (void*)tags);
     if (!NSK_JVMTI_VERIFY(
-            NSK_CPP_STUB2(Deallocate, jvmti, (unsigned char*)tags))) {
+            jvmti->Deallocate((unsigned char*)tags))) {
         nsk_jvmti_setFailStatus();
     }
 
@@ -197,8 +187,7 @@
 
     NSK_DISPLAY1("Get tagged objects: %d tags\n", tagsCount);
     if (!NSK_JVMTI_VERIFY(
-            NSK_CPP_STUB6(GetObjectsWithTags, jvmti, tagsCount, tags,
-                &taggedObjectsCount, &taggedObjectsList, &taggedObjectsTags))) {
+            jvmti->GetObjectsWithTags(tagsCount, tags, &taggedObjectsCount, &taggedObjectsList, &taggedObjectsTags))) {
         nsk_jvmti_setFailStatus();
         return NSK_TRUE;
     }
@@ -258,7 +247,7 @@
             for (j = 0; j < objectsCount; j++) {
                 jobject foundObject = ITEM(objects, i, j);
 
-                if (NSK_CPP_STUB3(IsSameObject, jni, object, foundObject)) {
+                if (jni->IsSameObject(object, foundObject)) {
                     objectsFound++;
 
                     if (expectedCount > 0)
@@ -295,12 +284,12 @@
 
     NSK_DISPLAY1("Deallocate got objects list: 0x%p\n", (void*)taggedObjectsList);
     if (!NSK_JVMTI_VERIFY(
-            NSK_CPP_STUB2(Deallocate, jvmti, (unsigned char*)taggedObjectsList))) {
+            jvmti->Deallocate((unsigned char*)taggedObjectsList))) {
         nsk_jvmti_setFailStatus();
     }
     NSK_DISPLAY1("Deallocate got tags list: 0x%p\n", (void*)taggedObjectsTags);
     if (!NSK_JVMTI_VERIFY(
-            NSK_CPP_STUB2(Deallocate, jvmti, (unsigned char*)taggedObjectsTags))) {
+            jvmti->Deallocate((unsigned char*)taggedObjectsTags))) {
         nsk_jvmti_setFailStatus();
     }
 
@@ -338,8 +327,7 @@
 
                     NSK_DISPLAY3("    #%d: object: 0x%p, tag: %ld\n",
                                             j, (void*)object, (long)tags[i]);
-                    if (!NSK_JVMTI_VERIFY(
-                            NSK_CPP_STUB3(SetTag, jvmti, object, tags[i]))) {
+                    if (!NSK_JVMTI_VERIFY(jvmti->SetTag(object, tags[i]))) {
                         nsk_jvmti_setFailStatus();
                         return;
                     }
@@ -384,8 +372,7 @@
 
                     NSK_DISPLAY3("    #%d: object: 0x%p, tag: %ld\n",
                                             j, (void*)object, (long)tag);
-                    if (!NSK_JVMTI_VERIFY(
-                            NSK_CPP_STUB3(SetTag, jvmti, object, tag))) {
+                    if (!NSK_JVMTI_VERIFY(jvmti->SetTag(object, tag))) {
                         nsk_jvmti_setFailStatus();
                         return;
                     }
@@ -455,8 +442,7 @@
 
         memset(&caps, 0, sizeof(caps));
         caps.can_tag_objects = 1;
-        if (!NSK_JVMTI_VERIFY(
-                NSK_CPP_STUB2(AddCapabilities, jvmti, &caps))) {
+        if (!NSK_JVMTI_VERIFY(jvmti->AddCapabilities(&caps))) {
             return JNI_ERR;
         }
     }
--- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetPhase/getphase001/getphase001.cpp	Fri Oct 05 17:01:07 2018 -0400
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetPhase/getphase001/getphase001.cpp	Tue Oct 09 14:37:59 2018 +0200
@@ -45,14 +45,14 @@
 VMStart(jvmtiEnv *jvmti, JNIEnv* jni) {
     jvmtiPhase phase;
 
-    if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB2(RawMonitorEnter, jvmti, access_lock)))
+    if (!NSK_JVMTI_VERIFY(jvmti->RawMonitorEnter(access_lock)))
         nsk_jvmti_setFailStatus();
 
     NSK_DISPLAY0("VMStart\n");
 
     /* testcase #2: check JVMTI_PHASE_START */
     NSK_DISPLAY0("Testcase #2: check if GetPhase returns JVMTI_PHASE_START\n");
-    if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB2(GetPhase, jvmti, &phase)))
+    if (!NSK_JVMTI_VERIFY(jvmti->GetPhase(&phase)))
         nsk_jvmti_setFailStatus();
 
     if (!NSK_VERIFY(phase == JVMTI_PHASE_START))
@@ -60,7 +60,7 @@
 
     was_VMStart = JNI_TRUE;
 
-    if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB2(RawMonitorExit, jvmti, access_lock)))
+    if (!NSK_JVMTI_VERIFY(jvmti->RawMonitorExit(access_lock)))
         nsk_jvmti_setFailStatus();
 }
 
@@ -68,14 +68,14 @@
 VMInit(jvmtiEnv *jvmti, JNIEnv* jni, jthread thread) {
     jvmtiPhase phase;
 
-    if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB2(RawMonitorEnter, jvmti, access_lock)))
+    if (!NSK_JVMTI_VERIFY(jvmti->RawMonitorEnter(access_lock)))
         nsk_jvmti_setFailStatus();
 
     NSK_DISPLAY0("VMInit\n");
 
     /* testcase #3: check JVMTI_PHASE_LIVE */
     NSK_DISPLAY0("Testcase #3: check if GetPhase returns JVMTI_PHASE_LIVE\n");
-    if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB2(GetPhase, jvmti, &phase)))
+    if (!NSK_JVMTI_VERIFY(jvmti->GetPhase(&phase)))
         nsk_jvmti_setFailStatus();
 
     if (!NSK_VERIFY(phase == JVMTI_PHASE_LIVE))
@@ -83,7 +83,7 @@
 
     was_VMInit = JNI_TRUE;
 
-    if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB2(RawMonitorExit, jvmti, access_lock)))
+    if (!NSK_JVMTI_VERIFY(jvmti->RawMonitorExit(access_lock)))
         nsk_jvmti_setFailStatus();
 }
 
@@ -93,7 +93,7 @@
                  void* address, void** new_address_ptr) {
     jvmtiPhase phase;
 
-    if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB2(RawMonitorEnter, jvmti, access_lock)))
+    if (!NSK_JVMTI_VERIFY(jvmti->RawMonitorEnter(access_lock)))
         nsk_jvmti_setFailStatus();
 
     NSK_DISPLAY0("NativeMethodBind\n");
@@ -102,7 +102,7 @@
 
         /* testcase #5: check JVMTI_PHASE_PRIMORDIAL */
         NSK_DISPLAY0("Testcase #2: check if GetPhase returns JVMTI_PHASE_PRIMORDIAL\n");
-        if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB2(GetPhase, jvmti, &phase)))
+        if (!NSK_JVMTI_VERIFY(jvmti->GetPhase(&phase)))
             nsk_jvmti_setFailStatus();
 
         if (!NSK_VERIFY(phase == JVMTI_PHASE_PRIMORDIAL))
@@ -112,7 +112,7 @@
 
         /* testcase #2: check JVMTI_PHASE_START */
         NSK_DISPLAY0("Testcase #2: check if GetPhase returns JVMTI_PHASE_START\n");
-        if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB2(GetPhase, jvmti, &phase)))
+        if (!NSK_JVMTI_VERIFY(jvmti->GetPhase(&phase)))
             nsk_jvmti_setFailStatus();
 
         if (!NSK_VERIFY(phase == JVMTI_PHASE_START))
@@ -122,7 +122,7 @@
 
         /* testcase #3: check JVMTI_PHASE_LIVE */
         NSK_DISPLAY0("Testcase #3: check if GetPhase returns JVMTI_PHASE_LIVE\n");
-        if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB2(GetPhase, jvmti, &phase)))
+        if (!NSK_JVMTI_VERIFY(jvmti->GetPhase(&phase)))
             nsk_jvmti_setFailStatus();
 
         if (!NSK_VERIFY(phase == JVMTI_PHASE_LIVE))
@@ -132,14 +132,14 @@
 
         /* testcase #4: check JVMTI_PHASE_DEAD */
         NSK_DISPLAY0("Testcase #4: check if GetPhase returns JVMTI_PHASE_DEAD\n");
-        if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB2(GetPhase, jvmti, &phase)))
+        if (!NSK_JVMTI_VERIFY(jvmti->GetPhase(&phase)))
             nsk_jvmti_setFailStatus();
 
         if (!NSK_VERIFY(phase == JVMTI_PHASE_DEAD))
             nsk_jvmti_setFailStatus();
     }
 
-    if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB2(RawMonitorExit, jvmti, access_lock)))
+    if (!NSK_JVMTI_VERIFY(jvmti->RawMonitorExit(access_lock)))
         nsk_jvmti_setFailStatus();
 }
 
@@ -154,7 +154,7 @@
                   unsigned char** new_class_data) {
     jvmtiPhase phase;
 
-    if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB2(RawMonitorEnter, jvmti, access_lock)))
+    if (!NSK_JVMTI_VERIFY(jvmti->RawMonitorEnter(access_lock)))
         nsk_jvmti_setFailStatus();
 
     NSK_DISPLAY1("ClassFileLoadHook: %s\n", name);
@@ -163,7 +163,7 @@
 
         /* testcase #5: check JVMTI_PHASE_PRIMORDIAL */
         NSK_DISPLAY0("Testcase #2: check if GetPhase returns JVMTI_PHASE_PRIMORDIAL\n");
-        if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB2(GetPhase, jvmti, &phase)))
+        if (!NSK_JVMTI_VERIFY(jvmti->GetPhase(&phase)))
             nsk_jvmti_setFailStatus();
 
         if (!NSK_VERIFY(phase == JVMTI_PHASE_PRIMORDIAL))
@@ -173,7 +173,7 @@
 
         /* testcase #2: check JVMTI_PHASE_START */
         NSK_DISPLAY0("Testcase #2: check if GetPhase returns JVMTI_PHASE_START\n");
-        if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB2(GetPhase, jvmti, &phase)))
+        if (!NSK_JVMTI_VERIFY(jvmti->GetPhase(&phase)))
             nsk_jvmti_setFailStatus();
 
         if (!NSK_VERIFY(phase == JVMTI_PHASE_START))
@@ -183,7 +183,7 @@
 
         /* testcase #3: check JVMTI_PHASE_LIVE */
         NSK_DISPLAY0("Testcase #3: check if GetPhase returns JVMTI_PHASE_LIVE\n");
-        if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB2(GetPhase, jvmti, &phase)))
+        if (!NSK_JVMTI_VERIFY(jvmti->GetPhase(&phase)))
             nsk_jvmti_setFailStatus();
 
         if (!NSK_VERIFY(phase == JVMTI_PHASE_LIVE))
@@ -193,14 +193,14 @@
 
         /* testcase #4: check JVMTI_PHASE_DEAD */
         NSK_DISPLAY0("Testcase #4: check if GetPhase returns JVMTI_PHASE_DEAD\n");
-        if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB2(GetPhase, jvmti, &phase)))
+        if (!NSK_JVMTI_VERIFY(jvmti->GetPhase(&phase)))
             nsk_jvmti_setFailStatus();
 
         if (!NSK_VERIFY(phase == JVMTI_PHASE_DEAD))
             nsk_jvmti_setFailStatus();
     }
 
-    if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB2(RawMonitorExit, jvmti, access_lock)))
+    if (!NSK_JVMTI_VERIFY(jvmti->RawMonitorExit(access_lock)))
         nsk_jvmti_setFailStatus();
 }
 
@@ -208,14 +208,14 @@
 VMDeath(jvmtiEnv *jvmti, JNIEnv* jni) {
     jvmtiPhase phase;
 
-    if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB2(RawMonitorEnter, jvmti, access_lock)))
+    if (!NSK_JVMTI_VERIFY(jvmti->RawMonitorEnter(access_lock)))
         nsk_jvmti_setFailStatus();
 
     NSK_DISPLAY0("VMDeath\n");
 
     /* testcase #3: check JVMTI_PHASE_LIVE */
     NSK_DISPLAY0("Testcase #3: check if GetPhase returns JVMTI_PHASE_LIVE\n");
-    if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB2(GetPhase, jvmti, &phase)))
+    if (!NSK_JVMTI_VERIFY(jvmti->GetPhase(&phase)))
         nsk_jvmti_setFailStatus();
 
     if (!NSK_VERIFY(phase == JVMTI_PHASE_LIVE))
@@ -223,7 +223,7 @@
 
     was_VMDeath = JNI_TRUE;
 
-    if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB2(RawMonitorExit, jvmti, access_lock)))
+    if (!NSK_JVMTI_VERIFY(jvmti->RawMonitorExit(access_lock)))
         nsk_jvmti_setFailStatus();
 }
 
@@ -242,7 +242,7 @@
 
     /* testcase #3: check JVMTI_PHASE_LIVE */
     NSK_DISPLAY0("Testcase #3: check if GetPhase returns JVMTI_PHASE_LIVE\n");
-    if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB2(GetPhase, jvmti, &phase)))
+    if (!NSK_JVMTI_VERIFY(jvmti->GetPhase(&phase)))
         nsk_jvmti_setFailStatus();
 
     if (!NSK_VERIFY(phase == JVMTI_PHASE_LIVE))
@@ -289,13 +289,12 @@
 
     /* Create data access lock */
     if (!NSK_JVMTI_VERIFY(
-            NSK_CPP_STUB3(CreateRawMonitor, jvmti,
-                "_access_lock", &access_lock)))
+            jvmti->CreateRawMonitor("_access_lock", &access_lock)))
         return JNI_ERR;
 
     /* testcase #1: check JVMTI_PHASE_ONLOAD */
     NSK_DISPLAY0("Testcase #1: check if GetPhase returns JVMTI_PHASE_ONLOAD\n");
-    if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB2(GetPhase, jvmti, &phase)))
+    if (!NSK_JVMTI_VERIFY(jvmti->GetPhase(&phase)))
         nsk_jvmti_setFailStatus();
 
     if (!NSK_VERIFY(phase == JVMTI_PHASE_ONLOAD))
@@ -305,7 +304,7 @@
     memset(&caps, 0, sizeof(caps));
     caps.can_generate_all_class_hook_events = 1;
     caps.can_generate_native_method_bind_events = 1;
-    if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB2(AddCapabilities, jvmti, &caps)))
+    if (!NSK_JVMTI_VERIFY(jvmti->AddCapabilities(&caps)))
         return JNI_ERR;
 
     memset(&callbacks, 0, sizeof(callbacks));
@@ -315,38 +314,32 @@
     callbacks.NativeMethodBind = &NativeMethodBind;
     callbacks.ClassFileLoadHook = &ClassFileLoadHook;
     if (!NSK_JVMTI_VERIFY(
-            NSK_CPP_STUB3(SetEventCallbacks, jvmti,
-                &callbacks, sizeof(callbacks))))
+            jvmti->SetEventCallbacks(&callbacks, sizeof(callbacks))))
         return JNI_ERR;
 
     /* enable VMStart event */
     if (!NSK_JVMTI_VERIFY(
-            NSK_CPP_STUB4(SetEventNotificationMode, jvmti, JVMTI_ENABLE,
-                JVMTI_EVENT_VM_START, NULL)))
+            jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_VM_START, NULL)))
         return JNI_ERR;
 
     /* enable VMInit event */
     if (!NSK_JVMTI_VERIFY(
-            NSK_CPP_STUB4(SetEventNotificationMode, jvmti, JVMTI_ENABLE,
-                JVMTI_EVENT_VM_INIT, NULL)))
+            jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_VM_INIT, NULL)))
         return JNI_ERR;
 
     /* enable NativeMethodBind event */
     if (!NSK_JVMTI_VERIFY(
-            NSK_CPP_STUB4(SetEventNotificationMode, jvmti, JVMTI_ENABLE,
-                JVMTI_EVENT_NATIVE_METHOD_BIND, NULL)))
+            jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_NATIVE_METHOD_BIND, NULL)))
         return JNI_ERR;
 
     /* enable ClassFileLoadHook event */
     if (!NSK_JVMTI_VERIFY(
-            NSK_CPP_STUB4(SetEventNotificationMode, jvmti, JVMTI_ENABLE,
-                JVMTI_EVENT_CLASS_FILE_LOAD_HOOK, NULL)))
+            jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_CLASS_FILE_LOAD_HOOK, NULL)))
         return JNI_ERR;
 
     /* enable VMDeath event */
     if (!NSK_JVMTI_VERIFY(
-            NSK_CPP_STUB4(SetEventNotificationMode, jvmti, JVMTI_ENABLE,
-                JVMTI_EVENT_VM_DEATH, NULL)))
+            jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_VM_DEATH, NULL)))
         return JNI_ERR;
 
     /* register agent proc and arg */
@@ -373,7 +366,7 @@
 
     /* testcase #4: check JVMTI_PHASE_DEAD */
     NSK_DISPLAY0("Testcase #4: check if GetPhase returns JVMTI_PHASE_DEAD\n");
-    if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB2(GetPhase, jvmti, &phase)))
+    if (!NSK_JVMTI_VERIFY(jvmti->GetPhase(&phase)))
         exit(97);
 
     if (!NSK_VERIFY(phase == JVMTI_PHASE_DEAD))
--- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetPhase/getphase002/getphase002.cpp	Fri Oct 05 17:01:07 2018 -0400
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetPhase/getphase002/getphase002.cpp	Tue Oct 09 14:37:59 2018 +0200
@@ -47,7 +47,7 @@
 
     NSK_DISPLAY0("Check if GetPhase(NULL) returns JVMTI_ERROR_NULL_POINTER\n");
     if (!NSK_JVMTI_VERIFY_CODE(JVMTI_ERROR_NULL_POINTER,
-            NSK_CPP_STUB2(GetPhase, jvmti, NULL)))
+            jvmti->GetPhase(NULL)))
         nsk_jvmti_setFailStatus();
 
     /* resume debugee after last sync */
--- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetPotentialCapabilities/getpotcaps001/getpotcaps001.cpp	Fri Oct 05 17:01:07 2018 -0400
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetPotentialCapabilities/getpotcaps001/getpotcaps001.cpp	Tue Oct 09 14:37:59 2018 +0200
@@ -130,7 +130,7 @@
 
     NSK_DISPLAY0("GetPotentialCapabilities() for current JVMTI env\n");
     if (!NSK_JVMTI_VERIFY(
-            NSK_CPP_STUB2(GetPotentialCapabilities, jvmti, &caps))) {
+            jvmti->GetPotentialCapabilities(&caps))) {
         return NSK_FALSE;
     }
 
@@ -233,8 +233,7 @@
         eventCallbacks.VMInit = callbackVMInit;
         eventCallbacks.VMDeath = callbackVMDeath;
         if (!NSK_JVMTI_VERIFY(
-                NSK_CPP_STUB3(SetEventCallbacks, jvmti,
-                                    &eventCallbacks, sizeof(eventCallbacks)))) {
+                jvmti->SetEventCallbacks(&eventCallbacks, sizeof(eventCallbacks)))) {
             return JNI_ERR;
         }
 
--- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetSystemProperties/getsysprops001/getsysprops001.cpp	Fri Oct 05 17:01:07 2018 -0400
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetSystemProperties/getsysprops001/getsysprops001.cpp	Tue Oct 09 14:37:59 2018 +0200
@@ -42,7 +42,7 @@
 
     NSK_DISPLAY0("Invoke GetSystemProperties()\n");
     if (!NSK_JVMTI_VERIFY(
-            NSK_CPP_STUB3(GetSystemProperties, jvmti, &count, &properties))) {
+            jvmti->GetSystemProperties(&count, &properties))) {
         nsk_jvmti_setFailStatus();
         return NSK_FALSE;
     }
@@ -75,7 +75,7 @@
     }
     NSK_DISPLAY0("Deallocate properties list\n");
     if (!NSK_JVMTI_VERIFY(
-            NSK_CPP_STUB2(Deallocate, jvmti, (unsigned char*)properties))) {
+            jvmti->Deallocate((unsigned char*)properties))) {
         return NSK_FALSE;
     }
     NSK_DISPLAY0("  ... deallocated\n");
--- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetSystemProperties/getsysprops002/getsysprops002.cpp	Fri Oct 05 17:01:07 2018 -0400
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetSystemProperties/getsysprops002/getsysprops002.cpp	Tue Oct 09 14:37:59 2018 +0200
@@ -56,7 +56,7 @@
 
     NSK_DISPLAY0("Get system properties list\n");
     if (!NSK_JVMTI_VERIFY(
-            NSK_CPP_STUB3(GetSystemProperties, jvmti, &count, &properties))) {
+            jvmti->GetSystemProperties(&count, &properties))) {
         return NSK_FALSE;
     }
     NSK_DISPLAY1("  ... got properties: %d\n", (int)count);
@@ -108,7 +108,7 @@
 
     NSK_DISPLAY0("Deallocate properties list\n");
     if (!NSK_JVMTI_VERIFY(
-            NSK_CPP_STUB2(Deallocate, jvmti, (unsigned char*)properties))) {
+            jvmti->Deallocate((unsigned char*)properties))) {
         return NSK_FALSE;
     }
     NSK_DISPLAY0("  ... deallocated\n");
--- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetSystemProperty/getsysprop001/getsysprop001.cpp	Fri Oct 05 17:01:07 2018 -0400
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetSystemProperty/getsysprop001/getsysprop001.cpp	Tue Oct 09 14:37:59 2018 +0200
@@ -42,7 +42,7 @@
 
     NSK_DISPLAY0("Get system properties names\n");
     if (!NSK_JVMTI_VERIFY(
-            NSK_CPP_STUB3(GetSystemProperties, jvmti, &count, &properties))) {
+            jvmti->GetSystemProperties(&count, &properties))) {
         return NSK_FALSE;
     }
     NSK_DISPLAY1("  ... got properties: %d\n", (int)count);
@@ -65,7 +65,7 @@
             }
 
             if (!NSK_JVMTI_VERIFY(
-                    NSK_CPP_STUB3(GetSystemProperty, jvmti, properties[i], &value))) {
+                    jvmti->GetSystemProperty(properties[i], &value))) {
                 success = NSK_FALSE;
                 continue;
             }
@@ -81,7 +81,7 @@
             }
 
             if (!NSK_JVMTI_VERIFY(
-                    NSK_CPP_STUB2(Deallocate, jvmti, (unsigned char*)value))) {
+                    jvmti->Deallocate((unsigned char*)value))) {
                 success = NSK_FALSE;
             }
         }
@@ -90,7 +90,7 @@
 
     NSK_DISPLAY0("Deallocate properties list\n");
     if (!NSK_JVMTI_VERIFY(
-            NSK_CPP_STUB2(Deallocate, jvmti, (unsigned char*)properties))) {
+            jvmti->Deallocate((unsigned char*)properties))) {
         success = NSK_FALSE;
     }
 
--- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetSystemProperty/getsysprop002/getsysprop002.cpp	Fri Oct 05 17:01:07 2018 -0400
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetSystemProperty/getsysprop002/getsysprop002.cpp	Tue Oct 09 14:37:59 2018 +0200
@@ -53,7 +53,7 @@
 
     NSK_DISPLAY1("Get value of tested property: %s\n", desc->name);
     if (!NSK_JVMTI_VERIFY(
-            NSK_CPP_STUB3(GetSystemProperty, jvmti, desc->name, &value))) {
+            jvmti->GetSystemProperty(desc->name, &value))) {
         return NSK_FALSE;
     }
     NSK_DISPLAY1("  ... got value: \"%s\"\n", nsk_null_string(value));
@@ -73,7 +73,7 @@
     }
 
     if (!NSK_JVMTI_VERIFY(
-            NSK_CPP_STUB2(Deallocate, jvmti, (unsigned char*)value))) {
+            jvmti->Deallocate((unsigned char*)value))) {
         success = NSK_FALSE;
     }
 
--- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetTag/gettag001/gettag001.cpp	Fri Oct 05 17:01:07 2018 -0400
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetTag/gettag001/gettag001.cpp	Tue Oct 09 14:37:59 2018 +0200
@@ -61,7 +61,7 @@
 
             NSK_DISPLAY1("Find debugee class: %s\n", DEBUGEE_CLASS_NAME);
             if (!NSK_JNI_VERIFY(jni, (debugeeClass =
-                    NSK_CPP_STUB2(FindClass, jni, DEBUGEE_CLASS_NAME)) != NULL)) {
+                    jni->FindClass(DEBUGEE_CLASS_NAME)) != NULL)) {
                 nsk_jvmti_setFailStatus();
                 return;
             }
@@ -69,8 +69,7 @@
 
             NSK_DISPLAY1("Find static field: %s\n", OBJECT_FIELD_NAME);
             if (!NSK_JNI_VERIFY(jni, (objectField =
-                    NSK_CPP_STUB4(GetStaticFieldID, jni, debugeeClass,
-                                    OBJECT_FIELD_NAME, OBJECT_CLASS_SIG)) != NULL)) {
+                    jni->GetStaticFieldID(debugeeClass, OBJECT_FIELD_NAME, OBJECT_CLASS_SIG)) != NULL)) {
                 nsk_jvmti_setFailStatus();
                 return;
             }
@@ -78,8 +77,7 @@
 
             NSK_DISPLAY1("Get object from static field: %s\n", OBJECT_FIELD_NAME);
             if (!NSK_JNI_VERIFY(jni, (testedObject =
-                    NSK_CPP_STUB3(GetStaticObjectField, jni, debugeeClass,
-                                                            objectField)) != NULL)) {
+                    jni->GetStaticObjectField(debugeeClass, objectField)) != NULL)) {
                 nsk_jvmti_setFailStatus();
                 return;
             }
@@ -87,7 +85,7 @@
 
             NSK_DISPLAY1("Create global reference for object: 0x%p\n", (void*)testedObject);
             if (!NSK_JNI_VERIFY(jni, (testedObject =
-                    NSK_CPP_STUB2(NewGlobalRef, jni, testedObject)) != NULL)) {
+                    jni->NewGlobalRef(testedObject)) != NULL)) {
                 nsk_jvmti_setFailStatus();
                 return;
             }
@@ -100,7 +98,7 @@
 
             NSK_DISPLAY1("Get tag for object: 0x%p\n", (void*)testedObject);
             if (!NSK_JVMTI_VERIFY(
-                    NSK_CPP_STUB3(GetTag, jvmti, testedObject, &objectTag))) {
+                    jvmti->GetTag(testedObject, &objectTag))) {
                 nsk_jvmti_setFailStatus();
                 return;
             }
@@ -120,7 +118,7 @@
         NSK_DISPLAY0(">>> Clean used data\n");
         {
             NSK_DISPLAY1("Delete object reference: 0x%p\n", (void*)testedObject);
-            NSK_TRACE(NSK_CPP_STUB2(DeleteGlobalRef, jni, testedObject));
+            NSK_TRACE(jni->DeleteGlobalRef(testedObject));
         }
     }
 
@@ -164,7 +162,7 @@
         memset(&caps, 0, sizeof(caps));
         caps.can_tag_objects = 1;
         if (!NSK_JVMTI_VERIFY(
-                NSK_CPP_STUB2(AddCapabilities, jvmti, &caps))) {
+                jvmti->AddCapabilities(&caps))) {
             return JNI_ERR;
         }
     }
--- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetThreadCpuTime/thrcputime001/thrcputime001.cpp	Fri Oct 05 17:01:07 2018 -0400
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetThreadCpuTime/thrcputime001/thrcputime001.cpp	Tue Oct 09 14:37:59 2018 +0200
@@ -71,7 +71,7 @@
 
     NSK_DISPLAY1("GetThreadCpuTime() for current thread (passing NULL): 0x%p\n", (void*)thread);
     if (!NSK_JVMTI_VERIFY(
-            NSK_CPP_STUB3(GetThreadCpuTime, jvmti, NULL, (jlong *)time))) {
+            jvmti->GetThreadCpuTime(NULL, (jlong *)time))) {
         return NSK_FALSE;
     }
     NSK_DISPLAY1("  ... got cpu time: %s\n", julong_to_string(*time, buf));
@@ -261,7 +261,7 @@
     jvmtiThreadInfo threadInfo;
     {
         if (!NSK_JVMTI_VERIFY(
-                NSK_CPP_STUB3(GetThreadInfo, jvmti, thread, &threadInfo))) {
+                jvmti->GetThreadInfo(thread, &threadInfo))) {
             nsk_jvmti_setFailStatus();
             return;
         }
@@ -285,7 +285,7 @@
     jvmtiThreadInfo threadInfo;
     {
         if (!NSK_JVMTI_VERIFY(
-                NSK_CPP_STUB3(GetThreadInfo, jvmti, thread, &threadInfo))) {
+                jvmti->GetThreadInfo(thread, &threadInfo))) {
             nsk_jvmti_setFailStatus();
             return;
         }
@@ -338,7 +338,7 @@
         memset(&caps, 0, sizeof(caps));
         caps.can_get_thread_cpu_time = 1;
         if (!NSK_JVMTI_VERIFY(
-                NSK_CPP_STUB2(AddCapabilities, jvmti, &caps))) {
+                jvmti->AddCapabilities(&caps))) {
             return JNI_ERR;
         }
     }
@@ -354,8 +354,7 @@
         eventCallbacks.ThreadStart = callbackThreadStart;
         eventCallbacks.ThreadEnd = callbackThreadEnd;
         if (!NSK_JVMTI_VERIFY(
-                NSK_CPP_STUB3(SetEventCallbacks, jvmti,
-                                    &eventCallbacks, sizeof(eventCallbacks)))) {
+                jvmti->SetEventCallbacks(&eventCallbacks, sizeof(eventCallbacks)))) {
             return JNI_ERR;
         }
     }
--- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetThreadCpuTime/thrcputime002/thrcputime002.cpp	Fri Oct 05 17:01:07 2018 -0400
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetThreadCpuTime/thrcputime002/thrcputime002.cpp	Tue Oct 09 14:37:59 2018 +0200
@@ -73,8 +73,7 @@
     int success = NSK_TRUE;
 
     NSK_DISPLAY1("GetThreadCpuTime() for thread: 0x%p\n", (void*)thread);
-    if (!NSK_JVMTI_VERIFY(
-            NSK_CPP_STUB3(GetThreadCpuTime, jvmti, thread, (jlong *)time))) {
+    if (!NSK_JVMTI_VERIFY(jvmti->GetThreadCpuTime(thread, (jlong *)time))) {
         return NSK_FALSE;
     }
     NSK_DISPLAY1("  ... got cpu time: %s\n", julong_to_string(*time, buf));
@@ -265,8 +264,7 @@
 
     jvmtiThreadInfo threadInfo;
     {
-        if (!NSK_JVMTI_VERIFY(
-                NSK_CPP_STUB3(GetThreadInfo, jvmti, thread, &threadInfo))) {
+        if (!NSK_JVMTI_VERIFY(jvmti->GetThreadInfo(thread, &threadInfo))) {
             nsk_jvmti_setFailStatus();
             return;
         }
@@ -282,8 +280,7 @@
     }
 
     if (threadInfo.name != NULL && strcmp(threadInfo.name, TESTED_THREAD_NAME) == 0) {
-        if (!NSK_JNI_VERIFY(jni, (testedThread =
-                NSK_CPP_STUB2(NewGlobalRef, jni, thread)) != NULL)) {
+        if (!NSK_JNI_VERIFY(jni, (testedThread = jni->NewGlobalRef(thread)) != NULL)) {
             nsk_jvmti_setFailStatus();
         }
 
@@ -302,8 +299,7 @@
 
     jvmtiThreadInfo threadInfo;
     {
-        if (!NSK_JVMTI_VERIFY(
-                NSK_CPP_STUB3(GetThreadInfo, jvmti, thread, &threadInfo))) {
+        if (!NSK_JVMTI_VERIFY(jvmti->GetThreadInfo(thread, &threadInfo))) {
             nsk_jvmti_setFailStatus();
             return;
         }
@@ -324,7 +320,7 @@
         if (!checkCpuTime(jvmti, thread, &time, &prevTestedThreadTime, "THREAD_END callback")) {
             nsk_jvmti_setFailStatus();
         }
-        NSK_TRACE(NSK_CPP_STUB2(DeleteGlobalRef, jni, testedThread));
+        NSK_TRACE(jni->DeleteGlobalRef(testedThread));
         testedThread = NULL;
     }
 }
@@ -365,8 +361,7 @@
 
         memset(&caps, 0, sizeof(caps));
         caps.can_get_thread_cpu_time = 1;
-        if (!NSK_JVMTI_VERIFY(
-                NSK_CPP_STUB2(AddCapabilities, jvmti, &caps))) {
+        if (!NSK_JVMTI_VERIFY(jvmti->AddCapabilities(&caps))) {
             return JNI_ERR;
         }
     }
@@ -381,9 +376,7 @@
         eventCallbacks.VMDeath = callbackVMDeath;
         eventCallbacks.ThreadStart = callbackThreadStart;
         eventCallbacks.ThreadEnd = callbackThreadEnd;
-        if (!NSK_JVMTI_VERIFY(
-                NSK_CPP_STUB3(SetEventCallbacks, jvmti,
-                                    &eventCallbacks, sizeof(eventCallbacks)))) {
+        if (!NSK_JVMTI_VERIFY(jvmti->SetEventCallbacks(&eventCallbacks, sizeof(eventCallbacks)))) {
             return JNI_ERR;
         }
     }
--- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetThreadCpuTimerInfo/thrtimerinfo001/thrtimerinfo001.cpp	Fri Oct 05 17:01:07 2018 -0400
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetThreadCpuTimerInfo/thrtimerinfo001/thrtimerinfo001.cpp	Tue Oct 09 14:37:59 2018 +0200
@@ -66,7 +66,7 @@
 
     NSK_DISPLAY0("GetThreadCpuTimerInfo() for current JVMTI env\n");
     if (!NSK_JVMTI_VERIFY(
-            NSK_CPP_STUB2(GetThreadCpuTimerInfo, jvmti, info))) {
+            jvmti->GetThreadCpuTimerInfo(info))) {
         return NSK_FALSE;
     }
     NSK_DISPLAY0("Got timer info:\n");
@@ -260,7 +260,7 @@
         memset(&caps, 0, sizeof(caps));
         caps.can_get_thread_cpu_time = 1;
         if (!NSK_JVMTI_VERIFY(
-                NSK_CPP_STUB2(AddCapabilities, jvmti, &caps))) {
+                jvmti->AddCapabilities(&caps))) {
             return JNI_ERR;
         }
     }
@@ -276,8 +276,7 @@
         eventCallbacks.ThreadStart = callbackThreadStart;
         eventCallbacks.ThreadEnd = callbackThreadEnd;
         if (!NSK_JVMTI_VERIFY(
-                NSK_CPP_STUB3(SetEventCallbacks, jvmti,
-                                    &eventCallbacks, sizeof(eventCallbacks)))) {
+                jvmti->SetEventCallbacks(&eventCallbacks, sizeof(eventCallbacks)))) {
             return JNI_ERR;
         }
     }
--- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetThreadGroupChildren/getthrdgrpchld001/getthrdgrpchld001.cpp	Fri Oct 05 17:01:07 2018 -0400
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetThreadGroupChildren/getthrdgrpchld001/getthrdgrpchld001.cpp	Tue Oct 09 14:37:59 2018 +0200
@@ -81,7 +81,7 @@
 
             NSK_DISPLAY0("Get top level thread groups\n");
             if (!NSK_JVMTI_VERIFY(
-                    NSK_CPP_STUB3(GetTopThreadGroups, jvmti, &topGroupsCount, &topGroups))) {
+                    jvmti->GetTopThreadGroups(&topGroupsCount, &topGroups))) {
                 nsk_jvmti_setFailStatus();
                 return;
             }
@@ -110,8 +110,7 @@
 
             NSK_DISPLAY1("Get children of root thread group: %p\n", (void*)rootGroup);
             if (!NSK_JVMTI_VERIFY(
-                    NSK_CPP_STUB6(GetThreadGroupChildren, jvmti, rootGroup,
-                                    &threadsCount, &threads, &groupsCount, &groups))) {
+                    jvmti->GetThreadGroupChildren(rootGroup, &threadsCount, &threads, &groupsCount, &groups))) {
                 nsk_jvmti_setFailStatus();
                 return;
             }
@@ -142,7 +141,7 @@
                     jvmtiThreadGroupInfo info;
 
                     if (!NSK_JVMTI_VERIFY(
-                            NSK_CPP_STUB3(GetThreadGroupInfo, jvmti, groups[i], &info))) {
+                            jvmti->GetThreadGroupInfo(groups[i], &info))) {
                         nsk_jvmti_setFailStatus();
                         continue;
                     }
@@ -221,11 +220,11 @@
 
             /* deallocate arrays */
             if (!NSK_JVMTI_VERIFY(
-                    NSK_CPP_STUB2(Deallocate, jvmti, (unsigned char*)groups))) {
+                    jvmti->Deallocate((unsigned char*)groups))) {
                 nsk_jvmti_setFailStatus();
             }
             if (!NSK_JVMTI_VERIFY(
-                    NSK_CPP_STUB2(Deallocate, jvmti, (unsigned char*)threads))) {
+                    jvmti->Deallocate((unsigned char*)threads))) {
                 nsk_jvmti_setFailStatus();
             }
         }
@@ -258,8 +257,7 @@
         jthreadGroup* groups = NULL;
 
         if (!NSK_JVMTI_VERIFY(
-                NSK_CPP_STUB6(GetThreadGroupChildren, jvmti, group,
-                                &threadsCount, &threads, &groupsCount, &groups))) {
+                jvmti->GetThreadGroupChildren(group, &threadsCount, &threads, &groupsCount, &groups))) {
             nsk_jvmti_setFailStatus();
             return NSK_FALSE;
         }
@@ -290,7 +288,7 @@
                 jvmtiThreadInfo info;
 
                 if (!NSK_JVMTI_VERIFY(
-                        NSK_CPP_STUB3(GetThreadInfo, jvmti, threads[i], &info))) {
+                        jvmti->GetThreadInfo(threads[i], &info))) {
                     nsk_jvmti_setFailStatus();
                     continue;
                 }
@@ -314,11 +312,11 @@
 
         /* deallocate arrays */
         if (!NSK_JVMTI_VERIFY(
-                NSK_CPP_STUB2(Deallocate, jvmti, (unsigned char*)groups))) {
+                jvmti->Deallocate((unsigned char*)groups))) {
             nsk_jvmti_setFailStatus();
         }
         if (!NSK_JVMTI_VERIFY(
-                NSK_CPP_STUB2(Deallocate, jvmti, (unsigned char*)threads))) {
+                jvmti->Deallocate((unsigned char*)threads))) {
             nsk_jvmti_setFailStatus();
         }
     }
@@ -339,8 +337,7 @@
         jthreadGroup * groups = NULL;
 
         if (!NSK_JVMTI_VERIFY(
-                NSK_CPP_STUB6(GetThreadGroupChildren, jvmti, groupsList[i],
-                                &threadsCount, &threads, &groupsCount, &groups))) {
+                jvmti->GetThreadGroupChildren(groupsList[i], &threadsCount, &threads, &groupsCount, &groups))) {
             nsk_jvmti_setFailStatus();
             return NULL;
         }
@@ -357,7 +354,7 @@
                 if (groups[i] != NULL) {
 
                     if (!NSK_JVMTI_VERIFY(
-                            NSK_CPP_STUB3(GetThreadGroupInfo, jvmti, groups[i], &info))) {
+                            jvmti->GetThreadGroupInfo(groups[i], &info))) {
                         nsk_jvmti_setFailStatus();
                         continue;
                     }
@@ -376,11 +373,11 @@
 
         /* deallocate arrays */
         if (!NSK_JVMTI_VERIFY(
-                NSK_CPP_STUB2(Deallocate, jvmti, (unsigned char*)groups))) {
+                jvmti->Deallocate((unsigned char*)groups))) {
             nsk_jvmti_setFailStatus();
         }
         if (!NSK_JVMTI_VERIFY(
-                NSK_CPP_STUB2(Deallocate, jvmti, (unsigned char*)threads))) {
+                jvmti->Deallocate((unsigned char*)threads))) {
             nsk_jvmti_setFailStatus();
         }
     }
--- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetThreadLocalStorage/getthrdstor001/getthrdstor001.cpp	Fri Oct 05 17:01:07 2018 -0400
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetThreadLocalStorage/getthrdstor001/getthrdstor001.cpp	Tue Oct 09 14:37:59 2018 +0200
@@ -59,7 +59,7 @@
 
         NSK_DISPLAY1("GetThreadLocalStorage() for tested thread: %p\n", (void*)testedThread);
         if (!NSK_JVMTI_VERIFY(
-                NSK_CPP_STUB3(GetThreadLocalStorage, jvmti, testedThread, &storage))) {
+                jvmti->GetThreadLocalStorage(testedThread, &storage))) {
             nsk_jvmti_setFailStatus();
             return;
         }
@@ -76,7 +76,7 @@
 
         NSK_DISPLAY0("GetThreadLocalStorage() for current agent thread\n");
         if (!NSK_JVMTI_VERIFY(
-                NSK_CPP_STUB3(GetThreadLocalStorage, jvmti, NULL, &storage))) {
+                jvmti->GetThreadLocalStorage(NULL, &storage))) {
             nsk_jvmti_setFailStatus();
             return;
         }
@@ -91,7 +91,7 @@
         }
 
         NSK_DISPLAY0("Delete thread reference\n");
-        NSK_TRACE(NSK_CPP_STUB2(DeleteGlobalRef, jni, testedThread));
+        NSK_TRACE(jni->DeleteGlobalRef(testedThread));
     }
 
     NSK_DISPLAY0("Let debugee to finish\n");
--- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetTime/gettime001/gettime001.cpp	Fri Oct 05 17:01:07 2018 -0400
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetTime/gettime001/gettime001.cpp	Tue Oct 09 14:37:59 2018 +0200
@@ -59,7 +59,7 @@
 
     NSK_DISPLAY0("GetTime() for current JVMTI env\n");
     if (!NSK_JVMTI_VERIFY(
-            NSK_CPP_STUB2(GetTime, jvmti, (jlong *)time))) {
+            jvmti->GetTime((jlong *)time))) {
         return NSK_FALSE;
     }
     NSK_DISPLAY1("  ... got time: %s\n", julong_to_string(*time, buf));
@@ -186,8 +186,7 @@
         eventCallbacks.VMInit = callbackVMInit;
         eventCallbacks.VMDeath = callbackVMDeath;
         if (!NSK_JVMTI_VERIFY(
-                NSK_CPP_STUB3(SetEventCallbacks, jvmti,
-                                    &eventCallbacks, sizeof(eventCallbacks)))) {
+                jvmti->SetEventCallbacks(&eventCallbacks, sizeof(eventCallbacks)))) {
             return JNI_ERR;
         }
 
--- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetTimerInfo/timerinfo001/timerinfo001.cpp	Fri Oct 05 17:01:07 2018 -0400
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetTimerInfo/timerinfo001/timerinfo001.cpp	Tue Oct 09 14:37:59 2018 +0200
@@ -59,7 +59,7 @@
 
     NSK_DISPLAY0("GetTimerInfo() for current JVMTI env\n");
     if (!NSK_JVMTI_VERIFY(
-            NSK_CPP_STUB2(GetTimerInfo, jvmti, info))) {
+            jvmti->GetTimerInfo(info))) {
         return NSK_FALSE;
     }
     NSK_DISPLAY0("Got timer info:\n");
@@ -203,8 +203,7 @@
         eventCallbacks.VMInit = callbackVMInit;
         eventCallbacks.VMDeath = callbackVMDeath;
         if (!NSK_JVMTI_VERIFY(
-                NSK_CPP_STUB3(SetEventCallbacks, jvmti,
-                                    &eventCallbacks, sizeof(eventCallbacks)))) {
+                jvmti->SetEventCallbacks(&eventCallbacks, sizeof(eventCallbacks)))) {
             return JNI_ERR;
         }
 
--- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/InterruptThread/intrpthrd001/intrpthrd001.cpp	Fri Oct 05 17:01:07 2018 -0400
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/InterruptThread/intrpthrd001/intrpthrd001.cpp	Tue Oct 09 14:37:59 2018 +0200
@@ -57,7 +57,7 @@
 
     /* get all live threads */
     if (!NSK_JVMTI_VERIFY(
-           NSK_CPP_STUB3(GetAllThreads, jvmti, &threads_count, &threads)))
+           jvmti->GetAllThreads(&threads_count, &threads)))
         return NSK_FALSE;
 
     if (!NSK_VERIFY(threads_count > 0 && threads != NULL))
@@ -70,7 +70,7 @@
 
         /* get thread information */
         if (!NSK_JVMTI_VERIFY(
-                NSK_CPP_STUB3(GetThreadInfo, jvmti, threads[i], &info)))
+                jvmti->GetThreadInfo(threads[i], &info)))
             return NSK_FALSE;
 
         NSK_DISPLAY3("    thread #%d (%s): %p\n", i, info.name, threads[i]);
@@ -89,7 +89,7 @@
 
     /* deallocate threads list */
     if (!NSK_JVMTI_VERIFY(
-            NSK_CPP_STUB2(Deallocate, jvmti, (unsigned char*)threads)))
+            jvmti->Deallocate((unsigned char*)threads)))
         return NSK_FALSE;
 
     return NSK_TRUE;
@@ -112,8 +112,7 @@
     if (!NSK_VERIFY(runningThread != NULL)) {
         nsk_jvmti_setFailStatus();
     } else {
-        if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB2(InterruptThread,
-                jvmti, runningThread)))
+        if (!NSK_JVMTI_VERIFY(jvmti->InterruptThread(runningThread)))
             nsk_jvmti_setFailStatus();
     }
 
@@ -121,8 +120,7 @@
     if (!NSK_VERIFY(waitingThread != NULL)) {
         nsk_jvmti_setFailStatus();
     } else {
-        if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB2(InterruptThread,
-                jvmti, waitingThread)))
+        if (!NSK_JVMTI_VERIFY(jvmti->InterruptThread(waitingThread)))
             nsk_jvmti_setFailStatus();
     }
 
@@ -130,8 +128,7 @@
     if (!NSK_VERIFY(sleepingThread != NULL)) {
         nsk_jvmti_setFailStatus();
     } else {
-        if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB2(InterruptThread,
-                jvmti, sleepingThread)))
+        if (!NSK_JVMTI_VERIFY(jvmti->InterruptThread(sleepingThread)))
             nsk_jvmti_setFailStatus();
     }
 
@@ -173,7 +170,7 @@
 
     memset(&caps, 0, sizeof(caps));
     caps.can_signal_thread = 1;
-    if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB2(AddCapabilities, jvmti, &caps))) {
+    if (!NSK_JVMTI_VERIFY(jvmti->AddCapabilities(&caps))) {
         return JNI_ERR;
     }
 
--- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/IsMethodObsolete/isobsolete001/isobsolete001.cpp	Fri Oct 05 17:01:07 2018 -0400
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/IsMethodObsolete/isobsolete001/isobsolete001.cpp	Tue Oct 09 14:37:59 2018 +0200
@@ -60,7 +60,7 @@
 
     NSK_DISPLAY3("Call IsObsolete() for %s method: %p (%s)\n", kind, (void*)method, name);
     if (!NSK_JVMTI_VERIFY(
-            NSK_CPP_STUB3(IsMethodObsolete, jvmti, method, &obsolete))) {
+            jvmti->IsMethodObsolete(method, &obsolete))) {
         nsk_jvmti_setFailStatus();
     }
     NSK_DISPLAY1("  ... got obsolete: %d\n", (int)obsolete);
@@ -83,8 +83,7 @@
 
     NSK_DISPLAY1("Get stack frames for thread: %p\n", (void*)thread);
     if (!NSK_JVMTI_VERIFY(
-            NSK_CPP_STUB6(GetStackTrace, jvmti, thread, 0, MAX_STACK_DEPTH,
-                                                    frameStack, &frameCount))) {
+            jvmti->GetStackTrace(thread, 0, MAX_STACK_DEPTH, frameStack, &frameCount))) {
         nsk_jvmti_setFailStatus();
         return;
     }
@@ -104,8 +103,7 @@
             NSK_DISPLAY1("  frame #%i:\n", i);
             NSK_DISPLAY1("     methodID:  %p\n", (void*)frameStack[i].method);
             if (!NSK_JVMTI_VERIFY(
-                    NSK_CPP_STUB5(GetMethodName, jvmti, frameStack[i].method,
-                                                        &name, &signature, &generic))) {
+                    jvmti->GetMethodName(frameStack[i].method, &name, &signature, &generic))) {
                 nsk_jvmti_setFailStatus();
                 continue;
             }
@@ -122,15 +120,15 @@
             }
 
             if (!NSK_JVMTI_VERIFY(
-                    NSK_CPP_STUB2(Deallocate, jvmti, (unsigned char*)name))) {
+                    jvmti->Deallocate((unsigned char*)name))) {
                 nsk_jvmti_setFailStatus();
             }
             if (!NSK_JVMTI_VERIFY(
-                    NSK_CPP_STUB2(Deallocate, jvmti, (unsigned char*)signature))) {
+                    jvmti->Deallocate((unsigned char*)signature))) {
                 nsk_jvmti_setFailStatus();
             }
             if (!NSK_JVMTI_VERIFY(
-                    NSK_CPP_STUB2(Deallocate, jvmti, (unsigned char*)generic))) {
+                    jvmti->Deallocate((unsigned char*)generic))) {
                 nsk_jvmti_setFailStatus();
             }
         }
@@ -156,7 +154,7 @@
 
     NSK_DISPLAY1("Redefine class: %s\n", className);
     if (!NSK_JVMTI_VERIFY(
-            NSK_CPP_STUB3(RedefineClasses, jvmti, 1, &classDef))) {
+            jvmti->RedefineClasses(1, &classDef))) {
         nsk_jvmti_setFailStatus();
         return NSK_FALSE;
     }
@@ -176,7 +174,7 @@
 
     NSK_DISPLAY1("Find debugee class: %s\n", DEBUGEE_CLASS_NAME);
     if (!NSK_JNI_VERIFY(jni, (debugeeClass =
-            NSK_CPP_STUB2(FindClass, jni, DEBUGEE_CLASS_NAME)) != NULL)) {
+            jni->FindClass(DEBUGEE_CLASS_NAME)) != NULL)) {
         nsk_jvmti_setFailStatus();
         return NSK_FALSE;
     }
@@ -184,8 +182,7 @@
 
     NSK_DISPLAY1("Find static field: %s\n", CLASSFILE_FIELD_NAME);
     if (!NSK_JNI_VERIFY(jni, (fieldID =
-            NSK_CPP_STUB4(GetStaticFieldID, jni, debugeeClass,
-                            CLASSFILE_FIELD_NAME, CLASSFILE_FIELD_SIG)) != NULL)) {
+            jni->GetStaticFieldID(debugeeClass, CLASSFILE_FIELD_NAME, CLASSFILE_FIELD_SIG)) != NULL)) {
         nsk_jvmti_setFailStatus();
         return NSK_FALSE;
     }
@@ -193,15 +190,14 @@
 
     NSK_DISPLAY1("Get classfile bytes array from static field: %s\n", CLASSFILE_FIELD_NAME);
     if (!NSK_JNI_VERIFY(jni, (array = (jbyteArray)
-            NSK_CPP_STUB3(GetStaticObjectField, jni, debugeeClass,
-                                                    fieldID)) != NULL)) {
+            jni->GetStaticObjectField(debugeeClass, fieldID)) != NULL)) {
         nsk_jvmti_setFailStatus();
         return NSK_FALSE;
     }
     NSK_DISPLAY1("  ... got array object: %p\n", (void*)array);
 
     if (!NSK_JNI_VERIFY(jni, (*size =
-            NSK_CPP_STUB2(GetArrayLength, jni, array)) > 0)) {
+            jni->GetArrayLength(array)) > 0)) {
         nsk_jvmti_setFailStatus();
         return NSK_FALSE;
     }
@@ -210,8 +206,7 @@
     {
         jboolean isCopy;
         if (!NSK_JNI_VERIFY(jni, (elements =
-                NSK_CPP_STUB3(GetByteArrayElements, jni, array,
-                                                            &isCopy)) != NULL)) {
+                jni->GetByteArrayElements(array, &isCopy)) != NULL)) {
             nsk_jvmti_setFailStatus();
         return NSK_FALSE;
         }
@@ -219,7 +214,7 @@
     NSK_DISPLAY1("  ... got elements list: %p\n", (void*)elements);
 
     if (!NSK_JVMTI_VERIFY(
-            NSK_CPP_STUB3(Allocate, jvmti, *size, bytes))) {
+            jvmti->Allocate(*size, bytes))) {
         nsk_jvmti_setFailStatus();
         return NSK_FALSE;
     }
@@ -231,7 +226,7 @@
     NSK_DISPLAY1("  ... copied bytecode: %d bytes\n", (int)*size);
 
     NSK_DISPLAY1("Release elements list: %p\n", (void*)elements);
-    NSK_TRACE(NSK_CPP_STUB4(ReleaseByteArrayElements, jni, array, elements, JNI_ABORT));
+    NSK_TRACE(jni->ReleaseByteArrayElements(array, elements, JNI_ABORT));
     NSK_DISPLAY0("  ... released\n");
 
     return NSK_TRUE;
@@ -264,7 +259,7 @@
         {
             NSK_DISPLAY1("Find tested class: %s\n", TESTED_CLASS_NAME);
             if (!NSK_JNI_VERIFY(jni, (testedClass =
-                    NSK_CPP_STUB2(FindClass, jni, TESTED_CLASS_NAME)) != NULL)) {
+                    jni->FindClass(TESTED_CLASS_NAME)) != NULL)) {
                 nsk_jvmti_setFailStatus();
                 return;
             }
@@ -272,7 +267,7 @@
 
             NSK_DISPLAY1("Make global reference for class object: %p\n", (void*)testedClass);
             if (!NSK_JNI_VERIFY(jni, (testedClass = (jclass)
-                    NSK_CPP_STUB2(NewGlobalRef, jni, testedClass)) != NULL)) {
+                    jni->NewGlobalRef(testedClass)) != NULL)) {
                 nsk_jvmti_setFailStatus();
                 return;
             }
@@ -280,8 +275,7 @@
 
             NSK_DISPLAY1("Get static methodID: %s\n", STATIC_METHOD_NAME);
             if (!NSK_JNI_VERIFY(jni, (staticMethodID =
-                    NSK_CPP_STUB4(GetStaticMethodID, jni, testedClass,
-                                    STATIC_METHOD_NAME, STATIC_METHOD_SIG)) != NULL)) {
+                    jni->GetStaticMethodID(testedClass, STATIC_METHOD_NAME, STATIC_METHOD_SIG)) != NULL)) {
                 nsk_jvmti_setFailStatus();
                 return;
             }
@@ -289,8 +283,7 @@
 
             NSK_DISPLAY1("Get instance methodID: %s\n", INSTANCE_METHOD_NAME);
             if (!NSK_JNI_VERIFY(jni, (instanceMethodID =
-                    NSK_CPP_STUB4(GetMethodID, jni, testedClass,
-                                    INSTANCE_METHOD_NAME, INSTANCE_METHOD_SIG)) != NULL)) {
+                    jni->GetMethodID(testedClass, INSTANCE_METHOD_NAME, INSTANCE_METHOD_SIG)) != NULL)) {
                 nsk_jvmti_setFailStatus();
                 return;
             }
@@ -342,15 +335,15 @@
         {
             NSK_DISPLAY1("Deallocate classfile bytes array: %p\n", (void*)classfileBytes);
             if (!NSK_JVMTI_VERIFY(
-                        NSK_CPP_STUB2(Deallocate, jvmti, classfileBytes))) {
+                        jvmti->Deallocate(classfileBytes))) {
                 nsk_jvmti_setFailStatus();
             }
 
             NSK_DISPLAY1("Delete global eference to thread: %p\n", (void*)testedThread);
-            NSK_TRACE(NSK_CPP_STUB2(DeleteGlobalRef, jni, testedThread));
+            NSK_TRACE(jni->DeleteGlobalRef(testedThread));
 
             NSK_DISPLAY1("Delete global reference to class: %p\n", (void*)testedClass);
-            NSK_TRACE(NSK_CPP_STUB2(DeleteGlobalRef, jni, testedClass));
+            NSK_TRACE(jni->DeleteGlobalRef(testedClass));
         }
     }
 
@@ -394,7 +387,7 @@
         memset(&caps, 0, sizeof(caps));
         caps.can_redefine_classes = 1;
         if (!NSK_JVMTI_VERIFY(
-                NSK_CPP_STUB2(AddCapabilities, jvmti, &caps))) {
+                jvmti->AddCapabilities(&caps))) {
             return JNI_ERR;
         }
     }
--- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/IterateOverHeap/iterheap001/iterheap001.cpp	Fri Oct 05 17:01:07 2018 -0400
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/IterateOverHeap/iterheap001/iterheap001.cpp	Tue Oct 09 14:37:59 2018 +0200
@@ -92,14 +92,14 @@
     tag++;
 
     if (!NSK_JNI_VERIFY(jni, (obj =
-            NSK_CPP_STUB3(GetObjectField, jni, firstObject, firstField)) != NULL)) {
+            jni->GetObjectField(firstObject, firstField)) != NULL)) {
         nsk_jvmti_setFailStatus();
         return NSK_FALSE;
     }
 
     objectDescList[count].tag = objTag;
     if (!NSK_JVMTI_VERIFY(
-            NSK_CPP_STUB3(SetTag, jvmti, obj, objTag))) {
+            jvmti->SetTag(obj, objTag))) {
         nsk_jvmti_setFailStatus();
         return NSK_FALSE;
     }
@@ -111,7 +111,7 @@
         return NSK_FALSE;
     }
 
-    NSK_TRACE(NSK_CPP_STUB2(DeleteLocalRef, jni, obj));
+    NSK_TRACE(jni->DeleteLocalRef(obj));
     return success;
 }
 
@@ -134,9 +134,7 @@
     *objectsCount = 2 * chainLength;
 
     NSK_DISPLAY1("Allocate memory for objects list: %d objects\n", *objectsCount);
-    if (!NSK_JVMTI_VERIFY(
-            NSK_CPP_STUB3(Allocate, jvmti, (*objectsCount * sizeof(ObjectDesc)),
-                                                    (unsigned char**)objectDescList))) {
+    if (!NSK_JVMTI_VERIFY(jvmti->Allocate((*objectsCount * sizeof(ObjectDesc)), (unsigned char**)objectDescList))) {
         nsk_jvmti_setFailStatus();
         return NSK_FALSE;
     }
@@ -153,7 +151,7 @@
 
     NSK_DISPLAY1("Find debugee class: %s\n", DEBUGEE_CLASS_NAME);
     if (!NSK_JNI_VERIFY(jni, (debugeeClass =
-            NSK_CPP_STUB2(FindClass, jni, DEBUGEE_CLASS_NAME)) != NULL)) {
+            jni->FindClass(DEBUGEE_CLASS_NAME)) != NULL)) {
         nsk_jvmti_setFailStatus();
         return NSK_FALSE;
     }
@@ -161,7 +159,7 @@
 
     NSK_DISPLAY1("Find root object class: %s\n", ROOT_OBJECT_CLASS_NAME);
     if (!NSK_JNI_VERIFY(jni, (rootObjectClass =
-            NSK_CPP_STUB2(FindClass, jni, ROOT_OBJECT_CLASS_NAME)) != NULL)) {
+            jni->FindClass(ROOT_OBJECT_CLASS_NAME)) != NULL)) {
         nsk_jvmti_setFailStatus();
         return NSK_FALSE;
     }
@@ -169,7 +167,7 @@
 
     NSK_DISPLAY1("Find chain object class: %s\n", CHAIN_OBJECT_CLASS_NAME);
     if (!NSK_JNI_VERIFY(jni, (chainObjectClass =
-            NSK_CPP_STUB2(FindClass, jni, CHAIN_OBJECT_CLASS_NAME)) != NULL)) {
+            jni->FindClass(CHAIN_OBJECT_CLASS_NAME)) != NULL)) {
         nsk_jvmti_setFailStatus();
         return NSK_FALSE;
     }
@@ -177,8 +175,7 @@
 
     NSK_DISPLAY1("Find static field in debugee class: %s\n", OBJECT_FIELD_NAME);
     if (!NSK_JNI_VERIFY(jni, (objectField =
-            NSK_CPP_STUB4(GetStaticFieldID, jni, debugeeClass,
-                            OBJECT_FIELD_NAME, ROOT_OBJECT_CLASS_SIG)) != NULL)) {
+            jni->GetStaticFieldID(debugeeClass, OBJECT_FIELD_NAME, ROOT_OBJECT_CLASS_SIG)) != NULL)) {
         nsk_jvmti_setFailStatus();
         return NSK_FALSE;
     }
@@ -186,8 +183,7 @@
 
     NSK_DISPLAY1("Find instance field in root object class: %s\n", REACHABLE_CHAIN_FIELD_NAME);
     if (!NSK_JNI_VERIFY(jni, (reachableChainField =
-            NSK_CPP_STUB4(GetFieldID, jni, rootObjectClass,
-                        REACHABLE_CHAIN_FIELD_NAME, CHAIN_OBJECT_CLASS_SIG)) != NULL)) {
+            jni->GetFieldID(rootObjectClass, REACHABLE_CHAIN_FIELD_NAME, CHAIN_OBJECT_CLASS_SIG)) != NULL)) {
         nsk_jvmti_setFailStatus();
         return NSK_FALSE;
     }
@@ -195,8 +191,7 @@
 
     NSK_DISPLAY1("Find instance field in root object class: %s\n", UNREACHABLE_CHAIN_FIELD_NAME);
     if (!NSK_JNI_VERIFY(jni, (unreachableChainField =
-            NSK_CPP_STUB4(GetFieldID, jni, rootObjectClass,
-                        UNREACHABLE_CHAIN_FIELD_NAME, CHAIN_OBJECT_CLASS_SIG)) != NULL)) {
+            jni->GetFieldID(rootObjectClass, UNREACHABLE_CHAIN_FIELD_NAME, CHAIN_OBJECT_CLASS_SIG)) != NULL)) {
         nsk_jvmti_setFailStatus();
         return NSK_FALSE;
     }
@@ -204,8 +199,7 @@
 
     NSK_DISPLAY1("Find instance field in chain object class: %s\n", TAIL_FIELD_NAME);
     if (!NSK_JNI_VERIFY(jni, (tailField =
-            NSK_CPP_STUB4(GetFieldID, jni, chainObjectClass,
-                            TAIL_FIELD_NAME, CHAIN_OBJECT_CLASS_SIG)) != NULL)) {
+            jni->GetFieldID(chainObjectClass, TAIL_FIELD_NAME, CHAIN_OBJECT_CLASS_SIG)) != NULL)) {
         nsk_jvmti_setFailStatus();
         return NSK_FALSE;
     }
@@ -213,8 +207,7 @@
 
     NSK_DISPLAY1("Get root object from static field: %s\n", OBJECT_FIELD_NAME);
     if (!NSK_JNI_VERIFY(jni, (rootObject =
-            NSK_CPP_STUB3(GetStaticObjectField, jni, debugeeClass,
-                                                    objectField)) != NULL)) {
+            jni->GetStaticObjectField(debugeeClass, objectField)) != NULL)) {
         nsk_jvmti_setFailStatus();
         return NSK_FALSE;
     }
@@ -312,7 +305,7 @@
     if (objectDescList != NULL) {
         NSK_DISPLAY1("Deallocate objects list: 0x%p\n", (void*)objectDescList);
         if (!NSK_JVMTI_VERIFY(
-            NSK_CPP_STUB2(Deallocate, jvmti, (unsigned char*)objectDescList))) {
+            jvmti->Deallocate((unsigned char*)objectDescList))) {
             nsk_jvmti_setFailStatus();
         }
     }
@@ -430,9 +423,7 @@
         NSK_DISPLAY0(">>> Iterate over all object in heap with filter JVMTI_HEAP_OBJECT_EITHER\n");
         {
             if (!NSK_JVMTI_VERIFY(
-                    NSK_CPP_STUB4(IterateOverHeap, jvmti,
-                        JVMTI_HEAP_OBJECT_EITHER, heapObjectCallback,
-                        &fakeUserData))) {
+                    jvmti->IterateOverHeap(JVMTI_HEAP_OBJECT_EITHER, heapObjectCallback, &fakeUserData))) {
                 nsk_jvmti_setFailStatus();
                 return;
             }
@@ -542,7 +533,7 @@
         caps.can_tag_objects = 1;
         caps.can_generate_object_free_events = 1;
         if (!NSK_JVMTI_VERIFY(
-                NSK_CPP_STUB2(AddCapabilities, jvmti, &caps))) {
+                jvmti->AddCapabilities(&caps))) {
             return JNI_ERR;
         }
     }
@@ -552,8 +543,7 @@
         memset(&eventCallbacks, 0, sizeof(eventCallbacks));
         eventCallbacks.ObjectFree = callbackObjectFree;
         if (!NSK_JVMTI_VERIFY(
-                NSK_CPP_STUB3(SetEventCallbacks, jvmti,
-                                    &eventCallbacks, sizeof(eventCallbacks))))
+                jvmti->SetEventCallbacks(&eventCallbacks, sizeof(eventCallbacks))))
             return JNI_ERR;
     }
 
--- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/IterateOverHeap/iterheap002/iterheap002.cpp	Fri Oct 05 17:01:07 2018 -0400
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/IterateOverHeap/iterheap002/iterheap002.cpp	Tue Oct 09 14:37:59 2018 +0200
@@ -92,14 +92,14 @@
     tag++;
 
     if (!NSK_JNI_VERIFY(jni, (obj =
-            NSK_CPP_STUB3(GetObjectField, jni, firstObject, firstField)) != NULL)) {
+            jni->GetObjectField(firstObject, firstField)) != NULL)) {
         nsk_jvmti_setFailStatus();
         return NSK_FALSE;
     }
 
     objectDescList[count].tag = objTag;
     if (!NSK_JVMTI_VERIFY(
-            NSK_CPP_STUB3(SetTag, jvmti, obj, objTag))) {
+            jvmti->SetTag(obj, objTag))) {
         nsk_jvmti_setFailStatus();
         return NSK_FALSE;
     }
@@ -111,7 +111,7 @@
         return NSK_FALSE;
     }
 
-    NSK_TRACE(NSK_CPP_STUB2(DeleteLocalRef, jni, obj));
+    NSK_TRACE(jni->DeleteLocalRef(obj));
     return success;
 }
 
@@ -134,9 +134,7 @@
     *objectsCount = 2 * chainLength;
 
     NSK_DISPLAY1("Allocate memory for objects list: %d objects\n", *objectsCount);
-    if (!NSK_JVMTI_VERIFY(
-            NSK_CPP_STUB3(Allocate, jvmti, (*objectsCount * sizeof(ObjectDesc)),
-                                                    (unsigned char**)objectDescList))) {
+    if (!NSK_JVMTI_VERIFY(jvmti->Allocate((*objectsCount * sizeof(ObjectDesc)), (unsigned char**)objectDescList))) {
         nsk_jvmti_setFailStatus();
         return NSK_FALSE;
     }
@@ -153,7 +151,7 @@
 
     NSK_DISPLAY1("Find debugee class: %s\n", DEBUGEE_CLASS_NAME);
     if (!NSK_JNI_VERIFY(jni, (debugeeClass =
-            NSK_CPP_STUB2(FindClass, jni, DEBUGEE_CLASS_NAME)) != NULL)) {
+            jni->FindClass(DEBUGEE_CLASS_NAME)) != NULL)) {
         nsk_jvmti_setFailStatus();
         return NSK_FALSE;
     }
@@ -161,7 +159,7 @@
 
     NSK_DISPLAY1("Find root object class: %s\n", ROOT_OBJECT_CLASS_NAME);
     if (!NSK_JNI_VERIFY(jni, (rootObjectClass =
-            NSK_CPP_STUB2(FindClass, jni, ROOT_OBJECT_CLASS_NAME)) != NULL)) {
+            jni->FindClass(ROOT_OBJECT_CLASS_NAME)) != NULL)) {
         nsk_jvmti_setFailStatus();
         return NSK_FALSE;
     }
@@ -169,7 +167,7 @@
 
     NSK_DISPLAY1("Find chain object class: %s\n", CHAIN_OBJECT_CLASS_NAME);
     if (!NSK_JNI_VERIFY(jni, (chainObjectClass =
-            NSK_CPP_STUB2(FindClass, jni, CHAIN_OBJECT_CLASS_NAME)) != NULL)) {
+            jni->FindClass(CHAIN_OBJECT_CLASS_NAME)) != NULL)) {
         nsk_jvmti_setFailStatus();
         return NSK_FALSE;
     }
@@ -177,8 +175,7 @@
 
     NSK_DISPLAY1("Find static field in debugee class: %s\n", OBJECT_FIELD_NAME);
     if (!NSK_JNI_VERIFY(jni, (objectField =
-            NSK_CPP_STUB4(GetStaticFieldID, jni, debugeeClass,
-                            OBJECT_FIELD_NAME, ROOT_OBJECT_CLASS_SIG)) != NULL)) {
+            jni->GetStaticFieldID(debugeeClass, OBJECT_FIELD_NAME, ROOT_OBJECT_CLASS_SIG)) != NULL)) {
         nsk_jvmti_setFailStatus();
         return NSK_FALSE;
     }
@@ -186,8 +183,7 @@
 
     NSK_DISPLAY1("Find instance field in root object class: %s\n", REACHABLE_CHAIN_FIELD_NAME);
     if (!NSK_JNI_VERIFY(jni, (reachableChainField =
-            NSK_CPP_STUB4(GetFieldID, jni, rootObjectClass,
-                        REACHABLE_CHAIN_FIELD_NAME, CHAIN_OBJECT_CLASS_SIG)) != NULL)) {
+            jni->GetFieldID(rootObjectClass, REACHABLE_CHAIN_FIELD_NAME, CHAIN_OBJECT_CLASS_SIG)) != NULL)) {
         nsk_jvmti_setFailStatus();
         return NSK_FALSE;
     }
@@ -195,8 +191,7 @@
 
     NSK_DISPLAY1("Find instance field in root object class: %s\n", UNREACHABLE_CHAIN_FIELD_NAME);
     if (!NSK_JNI_VERIFY(jni, (unreachableChainField =
-            NSK_CPP_STUB4(GetFieldID, jni, rootObjectClass,
-                        UNREACHABLE_CHAIN_FIELD_NAME, CHAIN_OBJECT_CLASS_SIG)) != NULL)) {
+            jni->GetFieldID(rootObjectClass, UNREACHABLE_CHAIN_FIELD_NAME, CHAIN_OBJECT_CLASS_SIG)) != NULL)) {
         nsk_jvmti_setFailStatus();
         return NSK_FALSE;
     }
@@ -204,8 +199,7 @@
 
     NSK_DISPLAY1("Find instance field in chain object class: %s\n", TAIL_FIELD_NAME);
     if (!NSK_JNI_VERIFY(jni, (tailField =
-            NSK_CPP_STUB4(GetFieldID, jni, chainObjectClass,
-                            TAIL_FIELD_NAME, CHAIN_OBJECT_CLASS_SIG)) != NULL)) {
+            jni->GetFieldID(chainObjectClass, TAIL_FIELD_NAME, CHAIN_OBJECT_CLASS_SIG)) != NULL)) {
         nsk_jvmti_setFailStatus();
         return NSK_FALSE;
     }
@@ -213,8 +207,7 @@
 
     NSK_DISPLAY1("Get root object from static field: %s\n", OBJECT_FIELD_NAME);
     if (!NSK_JNI_VERIFY(jni, (rootObject =
-            NSK_CPP_STUB3(GetStaticObjectField, jni, debugeeClass,
-                                                    objectField)) != NULL)) {
+            jni->GetStaticObjectField(debugeeClass, objectField)) != NULL)) {
         nsk_jvmti_setFailStatus();
         return NSK_FALSE;
     }
@@ -312,7 +305,7 @@
     if (objectDescList != NULL) {
         NSK_DISPLAY1("Deallocate objects list: 0x%p\n", (void*)objectDescList);
         if (!NSK_JVMTI_VERIFY(
-            NSK_CPP_STUB2(Deallocate, jvmti, (unsigned char*)objectDescList))) {
+            jvmti->Deallocate((unsigned char*)objectDescList))) {
             nsk_jvmti_setFailStatus();
         }
     }
@@ -438,9 +431,7 @@
         NSK_DISPLAY0(">>> Iterate over all object in heap with filter JVMTI_HEAP_OBJECT_TAGGED\n");
         {
             if (!NSK_JVMTI_VERIFY(
-                    NSK_CPP_STUB4(IterateOverHeap, jvmti,
-                        JVMTI_HEAP_OBJECT_TAGGED, heapObjectCallback,
-                        &fakeUserData))) {
+                    jvmti->IterateOverHeap(JVMTI_HEAP_OBJECT_TAGGED, heapObjectCallback, &fakeUserData))) {
                 nsk_jvmti_setFailStatus();
                 return;
             }
@@ -550,7 +541,7 @@
         caps.can_tag_objects = 1;
         caps.can_generate_object_free_events = 1;
         if (!NSK_JVMTI_VERIFY(
-                NSK_CPP_STUB2(AddCapabilities, jvmti, &caps))) {
+                jvmti->AddCapabilities(&caps))) {
             return JNI_ERR;
         }
     }
@@ -560,8 +551,7 @@
         memset(&eventCallbacks, 0, sizeof(eventCallbacks));
         eventCallbacks.ObjectFree = callbackObjectFree;
         if (!NSK_JVMTI_VERIFY(
-                NSK_CPP_STUB3(SetEventCallbacks, jvmti,
-                                    &eventCallbacks, sizeof(eventCallbacks))))
+                jvmti->SetEventCallbacks(&eventCallbacks, sizeof(eventCallbacks))))
             return JNI_ERR;
     }
 
--- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/IterateOverHeap/iterheap003/iterheap003.cpp	Fri Oct 05 17:01:07 2018 -0400
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/IterateOverHeap/iterheap003/iterheap003.cpp	Tue Oct 09 14:37:59 2018 +0200
@@ -92,14 +92,14 @@
     tag++;
 
     if (!NSK_JNI_VERIFY(jni, (obj =
-            NSK_CPP_STUB3(GetObjectField, jni, firstObject, firstField)) != NULL)) {
+            jni->GetObjectField(firstObject, firstField)) != NULL)) {
         nsk_jvmti_setFailStatus();
         return NSK_FALSE;
     }
 
     objectDescList[count].tag = objTag;
     if (!NSK_JVMTI_VERIFY(
-            NSK_CPP_STUB3(SetTag, jvmti, obj, objTag))) {
+            jvmti->SetTag(obj, objTag))) {
         nsk_jvmti_setFailStatus();
         return NSK_FALSE;
     }
@@ -111,7 +111,7 @@
         return NSK_FALSE;
     }
 
-    NSK_TRACE(NSK_CPP_STUB2(DeleteLocalRef, jni, obj));
+    NSK_TRACE(jni->DeleteLocalRef(obj));
     return success;
 }
 
@@ -134,9 +134,7 @@
     *objectsCount = 2 * chainLength;
 
     NSK_DISPLAY1("Allocate memory for objects list: %d objects\n", *objectsCount);
-    if (!NSK_JVMTI_VERIFY(
-            NSK_CPP_STUB3(Allocate, jvmti, (*objectsCount * sizeof(ObjectDesc)),
-                                                    (unsigned char**)objectDescList))) {
+    if (!NSK_JVMTI_VERIFY(jvmti->Allocate((*objectsCount * sizeof(ObjectDesc)), (unsigned char**)objectDescList))) {
         nsk_jvmti_setFailStatus();
         return NSK_FALSE;
     }
@@ -153,7 +151,7 @@
 
     NSK_DISPLAY1("Find debugee class: %s\n", DEBUGEE_CLASS_NAME);
     if (!NSK_JNI_VERIFY(jni, (debugeeClass =
-            NSK_CPP_STUB2(FindClass, jni, DEBUGEE_CLASS_NAME)) != NULL)) {
+            jni->FindClass(DEBUGEE_CLASS_NAME)) != NULL)) {
         nsk_jvmti_setFailStatus();
         return NSK_FALSE;
     }
@@ -161,7 +159,7 @@
 
     NSK_DISPLAY1("Find root object class: %s\n", ROOT_OBJECT_CLASS_NAME);
     if (!NSK_JNI_VERIFY(jni, (rootObjectClass =
-            NSK_CPP_STUB2(FindClass, jni, ROOT_OBJECT_CLASS_NAME)) != NULL)) {
+            jni->FindClass(ROOT_OBJECT_CLASS_NAME)) != NULL)) {
         nsk_jvmti_setFailStatus();
         return NSK_FALSE;
     }
@@ -169,7 +167,7 @@
 
     NSK_DISPLAY1("Find chain object class: %s\n", CHAIN_OBJECT_CLASS_NAME);
     if (!NSK_JNI_VERIFY(jni, (chainObjectClass =
-            NSK_CPP_STUB2(FindClass, jni, CHAIN_OBJECT_CLASS_NAME)) != NULL)) {
+            jni->FindClass(CHAIN_OBJECT_CLASS_NAME)) != NULL)) {
         nsk_jvmti_setFailStatus();
         return NSK_FALSE;
     }
@@ -177,8 +175,7 @@
 
     NSK_DISPLAY1("Find static field in debugee class: %s\n", OBJECT_FIELD_NAME);
     if (!NSK_JNI_VERIFY(jni, (objectField =
-            NSK_CPP_STUB4(GetStaticFieldID, jni, debugeeClass,
-                            OBJECT_FIELD_NAME, ROOT_OBJECT_CLASS_SIG)) != NULL)) {
+            jni->GetStaticFieldID(debugeeClass, OBJECT_FIELD_NAME, ROOT_OBJECT_CLASS_SIG)) != NULL)) {
         nsk_jvmti_setFailStatus();
         return NSK_FALSE;
     }
@@ -186,8 +183,7 @@
 
     NSK_DISPLAY1("Find instance field in root object class: %s\n", REACHABLE_CHAIN_FIELD_NAME);
     if (!NSK_JNI_VERIFY(jni, (reachableChainField =
-            NSK_CPP_STUB4(GetFieldID, jni, rootObjectClass,
-                        REACHABLE_CHAIN_FIELD_NAME, CHAIN_OBJECT_CLASS_SIG)) != NULL)) {
+            jni->GetFieldID(rootObjectClass, REACHABLE_CHAIN_FIELD_NAME, CHAIN_OBJECT_CLASS_SIG)) != NULL)) {
         nsk_jvmti_setFailStatus();
         return NSK_FALSE;
     }
@@ -195,8 +191,7 @@
 
     NSK_DISPLAY1("Find instance field in root object class: %s\n", UNREACHABLE_CHAIN_FIELD_NAME);
     if (!NSK_JNI_VERIFY(jni, (unreachableChainField =
-            NSK_CPP_STUB4(GetFieldID, jni, rootObjectClass,
-                        UNREACHABLE_CHAIN_FIELD_NAME, CHAIN_OBJECT_CLASS_SIG)) != NULL)) {
+            jni->GetFieldID(rootObjectClass, UNREACHABLE_CHAIN_FIELD_NAME, CHAIN_OBJECT_CLASS_SIG)) != NULL)) {
         nsk_jvmti_setFailStatus();
         return NSK_FALSE;
     }
@@ -204,8 +199,7 @@
 
     NSK_DISPLAY1("Find instance field in chain object class: %s\n", TAIL_FIELD_NAME);
     if (!NSK_JNI_VERIFY(jni, (tailField =
-            NSK_CPP_STUB4(GetFieldID, jni, chainObjectClass,
-                            TAIL_FIELD_NAME, CHAIN_OBJECT_CLASS_SIG)) != NULL)) {
+            jni->GetFieldID(chainObjectClass, TAIL_FIELD_NAME, CHAIN_OBJECT_CLASS_SIG)) != NULL)) {
         nsk_jvmti_setFailStatus();
         return NSK_FALSE;
     }
@@ -213,8 +207,7 @@
 
     NSK_DISPLAY1("Get root object from static field: %s\n", OBJECT_FIELD_NAME);
     if (!NSK_JNI_VERIFY(jni, (rootObject =
-            NSK_CPP_STUB3(GetStaticObjectField, jni, debugeeClass,
-                                                    objectField)) != NULL)) {
+            jni->GetStaticObjectField(debugeeClass, objectField)) != NULL)) {
         nsk_jvmti_setFailStatus();
         return NSK_FALSE;
     }
@@ -312,7 +305,7 @@
     if (objectDescList != NULL) {
         NSK_DISPLAY1("Deallocate objects list: 0x%p\n", (void*)objectDescList);
         if (!NSK_JVMTI_VERIFY(
-            NSK_CPP_STUB2(Deallocate, jvmti, (unsigned char*)objectDescList))) {
+            jvmti->Deallocate((unsigned char*)objectDescList))) {
             nsk_jvmti_setFailStatus();
         }
     }
@@ -439,9 +432,7 @@
         NSK_DISPLAY0(">>> Iterate over all object in heap with filter JVMTI_HEAP_OBJECT_UNTAGGED\n");
         {
             if (!NSK_JVMTI_VERIFY(
-                    NSK_CPP_STUB4(IterateOverHeap, jvmti,
-                        JVMTI_HEAP_OBJECT_UNTAGGED, heapObjectCallback,
-                        &fakeUserData))) {
+                    jvmti->IterateOverHeap(JVMTI_HEAP_OBJECT_UNTAGGED, heapObjectCallback, &fakeUserData))) {
                 nsk_jvmti_setFailStatus();
                 return;
             }
@@ -551,7 +542,7 @@
         caps.can_tag_objects = 1;
         caps.can_generate_object_free_events = 1;
         if (!NSK_JVMTI_VERIFY(
-                NSK_CPP_STUB2(AddCapabilities, jvmti, &caps))) {
+                jvmti->AddCapabilities(&caps))) {
             return JNI_ERR;
         }
     }
@@ -561,8 +552,7 @@
         memset(&eventCallbacks, 0, sizeof(eventCallbacks));
         eventCallbacks.ObjectFree = callbackObjectFree;
         if (!NSK_JVMTI_VERIFY(
-                NSK_CPP_STUB3(SetEventCallbacks, jvmti,
-                                    &eventCallbacks, sizeof(eventCallbacks))))
+                jvmti->SetEventCallbacks(&eventCallbacks, sizeof(eventCallbacks))))
             return JNI_ERR;
     }
 
--- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/IterateOverHeap/iterheap004/iterheap004.cpp	Fri Oct 05 17:01:07 2018 -0400
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/IterateOverHeap/iterheap004/iterheap004.cpp	Tue Oct 09 14:37:59 2018 +0200
@@ -65,9 +65,7 @@
     *tag_ptr = (jlong)++objectDescCount;
 
     /* Allocate memory for next list element*/
-    if (!NSK_JVMTI_VERIFY(
-            NSK_CPP_STUB3(Allocate, jvmti, (sizeof(ObjectDesc)),
-                                               (unsigned char**)&objectDescBuf))) {
+    if (!NSK_JVMTI_VERIFY(jvmti->Allocate((sizeof(ObjectDesc)), (unsigned char**)&objectDescBuf))) {
         nsk_jvmti_setFailStatus();
         callbackAborted = 1;
         NSK_COMPLAIN0("heapObjectCallbackForFirstIteration: Allocation failed. Iteration aborted.\n");
@@ -97,7 +95,7 @@
 
     /* Deallocate memory of list element*/
     if (!NSK_JVMTI_VERIFY(
-            NSK_CPP_STUB2(Deallocate, jvmti, (unsigned char*)objectDescArr[ind]))) {
+            jvmti->Deallocate((unsigned char*)objectDescArr[ind]))) {
         nsk_jvmti_setFailStatus();
         callbackAborted = 1;
         NSK_COMPLAIN0("heapObjectCallbackForSecondIteration: Deallocation failed. Iteration aborted.\n");
@@ -133,9 +131,7 @@
             NSK_DISPLAY0("Calling IterateOverHeap with filter JVMTI_HEAP_OBJECT_UNTAGGED\n");
             {
                 if (!NSK_JVMTI_VERIFY(
-                        NSK_CPP_STUB4(IterateOverHeap, jvmti,
-                            JVMTI_HEAP_OBJECT_UNTAGGED, heapObjectCallbackForFirstIteration,
-                            &fakeUserData))) {
+                        jvmti->IterateOverHeap(JVMTI_HEAP_OBJECT_UNTAGGED, heapObjectCallbackForFirstIteration, &fakeUserData))) {
                     nsk_jvmti_setFailStatus();
                     break;
                 }
@@ -151,17 +147,13 @@
             }
 
             /* Allocate memory for array to save pointers to ObjectDescList elements */
-            if (!NSK_JVMTI_VERIFY(
-                    NSK_CPP_STUB3(Allocate, jvmti, (objectDescCount * sizeof(ObjectDesc*)),
-                                      (unsigned char**)&objectDescArr))) {
+            if (!NSK_JVMTI_VERIFY(jvmti->Allocate((objectDescCount * sizeof(ObjectDesc*)), (unsigned char**)&objectDescArr))) {
                 nsk_jvmti_setFailStatus();
                 break;
             }
 
             /* Allocate memory for flags array and fill with false values */
-            if (!NSK_JVMTI_VERIFY(
-                    NSK_CPP_STUB3(Allocate, jvmti, (objectDescCount * sizeof(unsigned char)),
-                                      &deallocatedFlagsArr))) {
+            if (!NSK_JVMTI_VERIFY(jvmti->Allocate((objectDescCount * sizeof(unsigned char)), &deallocatedFlagsArr))) {
                 nsk_jvmti_setFailStatus();
                 break;
             }
@@ -186,9 +178,7 @@
             NSK_DISPLAY0("Calling IterateOverHeap with filter JVMTI_HEAP_OBJECT_TAGGED\n");
             {
                 if (!NSK_JVMTI_VERIFY(
-                        NSK_CPP_STUB4(IterateOverHeap, jvmti,
-                            JVMTI_HEAP_OBJECT_TAGGED, heapObjectCallbackForSecondIteration,
-                            &fakeUserData))) {
+                        jvmti->IterateOverHeap(JVMTI_HEAP_OBJECT_TAGGED, heapObjectCallbackForSecondIteration, &fakeUserData))) {
                     nsk_jvmti_setFailStatus();
                 }
             }
@@ -202,7 +192,7 @@
             for (ind = 0; ind < objectDescCount; ind++) {
                 if (!deallocatedFlagsArr[ind]) {
                     if (!NSK_JVMTI_VERIFY(
-                           NSK_CPP_STUB2(Deallocate, jvmti, (unsigned char*)objectDescArr[ind]))) {
+                           jvmti->Deallocate((unsigned char*)objectDescArr[ind]))) {
                         NSK_COMPLAIN1("Unable to deallocate descriptor. Index = %d \n", ind);
                         nsk_jvmti_setFailStatus();
                         return;
@@ -211,12 +201,12 @@
             }
 
             if (!NSK_JVMTI_VERIFY(
-                    NSK_CPP_STUB2(Deallocate, jvmti, (unsigned char*)objectDescArr))) {
+                    jvmti->Deallocate((unsigned char*)objectDescArr))) {
                 nsk_jvmti_setFailStatus();
             }
 
          if (!NSK_JVMTI_VERIFY(
-                    NSK_CPP_STUB2(Deallocate, jvmti, (unsigned char*)deallocatedFlagsArr))) {
+                    jvmti->Deallocate((unsigned char*)deallocatedFlagsArr))) {
                 nsk_jvmti_setFailStatus();
          }
 
@@ -258,12 +248,11 @@
     memset(&caps, 0, sizeof(caps));
     caps.can_tag_objects = 1;
     if (!NSK_JVMTI_VERIFY(
-            NSK_CPP_STUB2(AddCapabilities, jvmti, &caps))) {
+            jvmti->AddCapabilities(&caps))) {
         return JNI_ERR;
     }
 
-    if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB2(GetCapabilities,
-            jvmti, &caps)))
+    if (!NSK_JVMTI_VERIFY(jvmti->GetCapabilities(&caps)))
         return JNI_ERR;
 
     if (!caps.can_tag_objects)
--- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/IterateOverHeap/iterheap005/iterheap005.cpp	Fri Oct 05 17:01:07 2018 -0400
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/IterateOverHeap/iterheap005/iterheap005.cpp	Tue Oct 09 14:37:59 2018 +0200
@@ -51,54 +51,54 @@
     objCounter++;
 
     if (!NSK_JVMTI_VERIFY(
-            NSK_CPP_STUB3(CreateRawMonitor, st_jvmti, name, &monitor_ptr))) {
+            st_jvmti->CreateRawMonitor(name, &monitor_ptr))) {
         nsk_jvmti_setFailStatus();
         return JVMTI_ITERATION_ABORT;
     }
 
     if (!NSK_JVMTI_VERIFY(
-            NSK_CPP_STUB2(RawMonitorEnter, st_jvmti, monitor_ptr))) {
+            st_jvmti->RawMonitorEnter(monitor_ptr))) {
         nsk_jvmti_setFailStatus();
         return JVMTI_ITERATION_ABORT;
     }
 
     /* Enter second time */
     if (!NSK_JVMTI_VERIFY(
-            NSK_CPP_STUB2(RawMonitorEnter, st_jvmti, monitor_ptr))) {
+            st_jvmti->RawMonitorEnter(monitor_ptr))) {
         nsk_jvmti_setFailStatus();
         return JVMTI_ITERATION_ABORT;
     }
 
     if (!NSK_JVMTI_VERIFY(
-            NSK_CPP_STUB3(RawMonitorWait, st_jvmti, monitor_ptr, (jlong)100))) {
+            st_jvmti->RawMonitorWait(monitor_ptr, (jlong)100))) {
         nsk_jvmti_setFailStatus();
     }
 
     if (!NSK_JVMTI_VERIFY(
-            NSK_CPP_STUB2(RawMonitorNotify, st_jvmti, monitor_ptr))) {
+            st_jvmti->RawMonitorNotify(monitor_ptr))) {
         nsk_jvmti_setFailStatus();
     }
 
     if (!NSK_JVMTI_VERIFY(
-            NSK_CPP_STUB2(RawMonitorNotifyAll, st_jvmti, monitor_ptr))) {
+            st_jvmti->RawMonitorNotifyAll(monitor_ptr))) {
         nsk_jvmti_setFailStatus();
     }
 
     if (!NSK_JVMTI_VERIFY(
-            NSK_CPP_STUB2(RawMonitorExit, st_jvmti, monitor_ptr))) {
+            st_jvmti->RawMonitorExit(monitor_ptr))) {
         nsk_jvmti_setFailStatus();
         return JVMTI_ITERATION_ABORT;
     }
 
     /* Exit second time */
     if (!NSK_JVMTI_VERIFY(
-            NSK_CPP_STUB2(RawMonitorExit, st_jvmti, monitor_ptr))) {
+            st_jvmti->RawMonitorExit(monitor_ptr))) {
         nsk_jvmti_setFailStatus();
         return JVMTI_ITERATION_ABORT;
     }
 
     if (!NSK_JVMTI_VERIFY(
-            NSK_CPP_STUB2(DestroyRawMonitor, st_jvmti, monitor_ptr))) {
+            st_jvmti->DestroyRawMonitor(monitor_ptr))) {
         nsk_jvmti_setFailStatus();
     }
 
@@ -119,11 +119,7 @@
         NSK_DISPLAY0("Calling IterateOverHeap with filter JVMTI_HEAP_OBJECT_EITHER\n");
         {
             if (!NSK_JVMTI_VERIFY(
-                    NSK_CPP_STUB4(IterateOverHeap,
-                        jvmti,
-                        JVMTI_HEAP_OBJECT_EITHER,
-                        heapObjectCallback,
-                        &fakeUserData))) {
+                    jvmti->IterateOverHeap(JVMTI_HEAP_OBJECT_EITHER, heapObjectCallback, &fakeUserData))) {
                 nsk_jvmti_setFailStatus();
             }
         }
@@ -174,7 +170,7 @@
         memset(&caps, 0, sizeof(caps));
         caps.can_tag_objects = 1;
         if (!NSK_JVMTI_VERIFY(
-                NSK_CPP_STUB2(AddCapabilities, jvmti, &caps))) {
+                jvmti->AddCapabilities(&caps))) {
             return JNI_ERR;
         }
     }
--- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/IterateOverHeap/iterheap006/iterheap006.cpp	Fri Oct 05 17:01:07 2018 -0400
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/IterateOverHeap/iterheap006/iterheap006.cpp	Tue Oct 09 14:37:59 2018 +0200
@@ -46,12 +46,12 @@
                    void* storage_data) {
 
     if (!NSK_JVMTI_VERIFY(
-            NSK_CPP_STUB2(SetEnvironmentLocalStorage, st_jvmti, storage_data ))) {
+            st_jvmti->SetEnvironmentLocalStorage(storage_data ))) {
         nsk_jvmti_setFailStatus();
     }
 
     if (!NSK_JVMTI_VERIFY(
-            NSK_CPP_STUB2(GetEnvironmentLocalStorage, st_jvmti, &storage_ptr))) {
+            st_jvmti->GetEnvironmentLocalStorage(&storage_ptr))) {
         nsk_jvmti_setFailStatus();
     }
 
@@ -73,11 +73,7 @@
         NSK_DISPLAY0("Calling IterateOverHeap with filter JVMTI_HEAP_OBJECT_EITHER\n");
         {
             if (!NSK_JVMTI_VERIFY(
-                    NSK_CPP_STUB4(IterateOverHeap,
-                        jvmti,
-                        JVMTI_HEAP_OBJECT_EITHER,
-                        heapObjectCallback,
-                        (void *)storage_data))) {
+                    jvmti->IterateOverHeap(JVMTI_HEAP_OBJECT_EITHER, heapObjectCallback, (void *)storage_data))) {
                 nsk_jvmti_setFailStatus();
             }
         }
@@ -135,7 +131,7 @@
         memset(&caps, 0, sizeof(caps));
         caps.can_tag_objects = 1;
         if (!NSK_JVMTI_VERIFY(
-                NSK_CPP_STUB2(AddCapabilities, jvmti, &caps))) {
+                jvmti->AddCapabilities(&caps))) {
             return JNI_ERR;
         }
     }
--- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/IterateOverHeap/iterheap007/iterheap007.cpp	Fri Oct 05 17:01:07 2018 -0400
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/IterateOverHeap/iterheap007/iterheap007.cpp	Tue Oct 09 14:37:59 2018 +0200
@@ -46,7 +46,7 @@
                    void* user_data) {
 
     if (!NSK_JVMTI_VERIFY(
-            NSK_CPP_STUB2(GetCurrentThreadCpuTimerInfo, st_jvmti, &timer_info1 ))) {
+            st_jvmti->GetCurrentThreadCpuTimerInfo(&timer_info1 ))) {
         nsk_jvmti_setFailStatus();
     }
     /* Check the returned jvmtiTimerInfo structure */
@@ -65,13 +65,13 @@
     /* ---------------------------------------------------------------------- */
 
     if (!NSK_JVMTI_VERIFY(
-            NSK_CPP_STUB2(GetCurrentThreadCpuTime, st_jvmti, &nanos ))) {
+            st_jvmti->GetCurrentThreadCpuTime(&nanos ))) {
         nsk_jvmti_setFailStatus();
     }
     /* ---------------------------------------------------------------------- */
 
     if (!NSK_JVMTI_VERIFY(
-            NSK_CPP_STUB2(GetTimerInfo, st_jvmti, &timer_info2 ))) {
+            st_jvmti->GetTimerInfo(&timer_info2 ))) {
         nsk_jvmti_setFailStatus();
     }
     /* Check the returned jvmtiTimerInfo structure */
@@ -91,7 +91,7 @@
 
     nanos = 0;
     if (!NSK_JVMTI_VERIFY(
-            NSK_CPP_STUB2(GetTime, st_jvmti, &nanos ))) {
+            st_jvmti->GetTime(&nanos ))) {
         nsk_jvmti_setFailStatus();
     }
 
@@ -113,11 +113,7 @@
         NSK_DISPLAY0("Calling IterateOverHeap with filter JVMTI_HEAP_OBJECT_EITHER\n");
         {
             if (!NSK_JVMTI_VERIFY(
-                    NSK_CPP_STUB4(IterateOverHeap,
-                        jvmti,
-                        JVMTI_HEAP_OBJECT_EITHER,
-                        heapObjectCallback,
-                        (void *)user_data))) {
+                    jvmti->IterateOverHeap(JVMTI_HEAP_OBJECT_EITHER, heapObjectCallback, (void *)user_data))) {
                 nsk_jvmti_setFailStatus();
             }
         }
@@ -164,7 +160,7 @@
         caps.can_get_current_thread_cpu_time = 1;
 
         if (!NSK_JVMTI_VERIFY(
-                NSK_CPP_STUB2(AddCapabilities, jvmti, &caps))) {
+                jvmti->AddCapabilities(&caps))) {
             return JNI_ERR;
         }
     }
--- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/IterateOverInstancesOfClass/iterinstcls001/iterinstcls001.cpp	Fri Oct 05 17:01:07 2018 -0400
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/IterateOverInstancesOfClass/iterinstcls001/iterinstcls001.cpp	Tue Oct 09 14:37:59 2018 +0200
@@ -92,14 +92,14 @@
     tag++;
 
     if (!NSK_JNI_VERIFY(jni, (obj =
-            NSK_CPP_STUB3(GetObjectField, jni, firstObject, firstField)) != NULL)) {
+            jni->GetObjectField(firstObject, firstField)) != NULL)) {
         nsk_jvmti_setFailStatus();
         return NSK_FALSE;
     }
 
     objectDescList[count].tag = objTag;
     if (!NSK_JVMTI_VERIFY(
-            NSK_CPP_STUB3(SetTag, jvmti, obj, objTag))) {
+            jvmti->SetTag(obj, objTag))) {
         nsk_jvmti_setFailStatus();
         return NSK_FALSE;
     }
@@ -111,7 +111,7 @@
         return NSK_FALSE;
     }
 
-    NSK_TRACE(NSK_CPP_STUB2(DeleteLocalRef, jni, obj));
+    NSK_TRACE(jni->DeleteLocalRef(obj));
     return success;
 }
 
@@ -136,9 +136,7 @@
     *objectsCount = 2 * chainLength;
 
     NSK_DISPLAY1("Allocate memory for objects list: %d objects\n", *objectsCount);
-    if (!NSK_JVMTI_VERIFY(
-            NSK_CPP_STUB3(Allocate, jvmti, (*objectsCount * sizeof(ObjectDesc)),
-                                                    (unsigned char**)objectDescList))) {
+    if (!NSK_JVMTI_VERIFY(jvmti->Allocate((*objectsCount * sizeof(ObjectDesc)), (unsigned char**)objectDescList))) {
         nsk_jvmti_setFailStatus();
         return NSK_FALSE;
     }
@@ -155,7 +153,7 @@
 
     NSK_DISPLAY1("Find debugee class: %s\n", DEBUGEE_CLASS_NAME);
     if (!NSK_JNI_VERIFY(jni, (debugeeClass =
-            NSK_CPP_STUB2(FindClass, jni, DEBUGEE_CLASS_NAME)) != NULL)) {
+            jni->FindClass(DEBUGEE_CLASS_NAME)) != NULL)) {
         nsk_jvmti_setFailStatus();
         return NSK_FALSE;
     }
@@ -163,7 +161,7 @@
 
     NSK_DISPLAY1("Find root object class: %s\n", ROOT_OBJECT_CLASS_NAME);
     if (!NSK_JNI_VERIFY(jni, (rootObjectClass =
-            NSK_CPP_STUB2(FindClass, jni, ROOT_OBJECT_CLASS_NAME)) != NULL)) {
+            jni->FindClass(ROOT_OBJECT_CLASS_NAME)) != NULL)) {
         nsk_jvmti_setFailStatus();
         return NSK_FALSE;
     }
@@ -171,7 +169,7 @@
 
     NSK_DISPLAY1("Find chain object class: %s\n", CHAIN_OBJECT_CLASS_NAME);
     if (!NSK_JNI_VERIFY(jni, (chainObjectClass =
-            NSK_CPP_STUB2(FindClass, jni, CHAIN_OBJECT_CLASS_NAME)) != NULL)) {
+            jni->FindClass(CHAIN_OBJECT_CLASS_NAME)) != NULL)) {
         nsk_jvmti_setFailStatus();
         return NSK_FALSE;
     }
@@ -179,7 +177,7 @@
 
     NSK_DISPLAY1("Create global ref to tested class: 0x%p\n", chainObjectClass);
     if (!NSK_JNI_VERIFY(jni, (*testedClass = (jclass)
-            NSK_CPP_STUB2(NewGlobalRef, jni, chainObjectClass)) != NULL)) {
+            jni->NewGlobalRef(chainObjectClass)) != NULL)) {
         nsk_jvmti_setFailStatus();
         return NSK_FALSE;
     }
@@ -187,8 +185,7 @@
 
     NSK_DISPLAY1("Find static field in debugee class: %s\n", OBJECT_FIELD_NAME);
     if (!NSK_JNI_VERIFY(jni, (objectField =
-            NSK_CPP_STUB4(GetStaticFieldID, jni, debugeeClass,
-                            OBJECT_FIELD_NAME, ROOT_OBJECT_CLASS_SIG)) != NULL)) {
+            jni->GetStaticFieldID(debugeeClass, OBJECT_FIELD_NAME, ROOT_OBJECT_CLASS_SIG)) != NULL)) {
         nsk_jvmti_setFailStatus();
         return NSK_FALSE;
     }
@@ -196,8 +193,7 @@
 
     NSK_DISPLAY1("Find instance field in root object class: %s\n", REACHABLE_CHAIN_FIELD_NAME);
     if (!NSK_JNI_VERIFY(jni, (reachableChainField =
-            NSK_CPP_STUB4(GetFieldID, jni, rootObjectClass,
-                        REACHABLE_CHAIN_FIELD_NAME, CHAIN_OBJECT_CLASS_SIG)) != NULL)) {
+            jni->GetFieldID(rootObjectClass, REACHABLE_CHAIN_FIELD_NAME, CHAIN_OBJECT_CLASS_SIG)) != NULL)) {
         nsk_jvmti_setFailStatus();
         return NSK_FALSE;
     }
@@ -205,8 +201,7 @@
 
     NSK_DISPLAY1("Find instance field in root object class: %s\n", UNREACHABLE_CHAIN_FIELD_NAME);
     if (!NSK_JNI_VERIFY(jni, (unreachableChainField =
-            NSK_CPP_STUB4(GetFieldID, jni, rootObjectClass,
-                        UNREACHABLE_CHAIN_FIELD_NAME, CHAIN_OBJECT_CLASS_SIG)) != NULL)) {
+            jni->GetFieldID(rootObjectClass, UNREACHABLE_CHAIN_FIELD_NAME, CHAIN_OBJECT_CLASS_SIG)) != NULL)) {
         nsk_jvmti_setFailStatus();
         return NSK_FALSE;
     }
@@ -214,8 +209,7 @@
 
     NSK_DISPLAY1("Find instance field in chain object class: %s\n", TAIL_FIELD_NAME);
     if (!NSK_JNI_VERIFY(jni, (tailField =
-            NSK_CPP_STUB4(GetFieldID, jni, chainObjectClass,
-                            TAIL_FIELD_NAME, CHAIN_OBJECT_CLASS_SIG)) != NULL)) {
+            jni->GetFieldID(chainObjectClass, TAIL_FIELD_NAME, CHAIN_OBJECT_CLASS_SIG)) != NULL)) {
         nsk_jvmti_setFailStatus();
         return NSK_FALSE;
     }
@@ -223,8 +217,7 @@
 
     NSK_DISPLAY1("Get root object from static field: %s\n", OBJECT_FIELD_NAME);
     if (!NSK_JNI_VERIFY(jni, (rootObject =
-            NSK_CPP_STUB3(GetStaticObjectField, jni, debugeeClass,
-                                                    objectField)) != NULL)) {
+            jni->GetStaticObjectField(debugeeClass, objectField)) != NULL)) {
         nsk_jvmti_setFailStatus();
         return NSK_FALSE;
     }
@@ -234,7 +227,7 @@
 
     NSK_DISPLAY0("    tested class object:\n");
     if (!NSK_JVMTI_VERIFY(
-            NSK_CPP_STUB3(SetTag, jvmti, *testedClass, testedClassTag))) {
+            jvmti->SetTag(*testedClass, testedClassTag))) {
         nsk_jvmti_setFailStatus();
         return NSK_FALSE;
     }
@@ -329,13 +322,13 @@
                                         ObjectDesc* objectDescList, jclass testedClass) {
     if (testedClass != NULL) {
         NSK_DISPLAY1("Release object reference to tested class: 0x%p\n", testedClass);
-        NSK_TRACE(NSK_CPP_STUB2(DeleteGlobalRef, jni, testedClass));
+        NSK_TRACE(jni->DeleteGlobalRef(testedClass));
     }
 
     if (objectDescList != NULL) {
         NSK_DISPLAY1("Deallocate objects list: 0x%p\n", (void*)objectDescList);
         if (!NSK_JVMTI_VERIFY(
-            NSK_CPP_STUB2(Deallocate, jvmti, (unsigned char*)objectDescList))) {
+            jvmti->Deallocate((unsigned char*)objectDescList))) {
             nsk_jvmti_setFailStatus();
         }
     }
@@ -450,9 +443,7 @@
         NSK_DISPLAY0(">>> Iterate over instances of tested class with filter JVMTI_HEAP_OBJECT_EITHER\n");
         {
             if (!NSK_JVMTI_VERIFY(
-                    NSK_CPP_STUB5(IterateOverInstancesOfClass, jvmti,
-                        testedClass, JVMTI_HEAP_OBJECT_EITHER,
-                        heapObjectCallback, &fakeUserData))) {
+                    jvmti->IterateOverInstancesOfClass(testedClass, JVMTI_HEAP_OBJECT_EITHER, heapObjectCallback, &fakeUserData))) {
                 nsk_jvmti_setFailStatus();
                 return;
             }
@@ -561,7 +552,7 @@
         caps.can_tag_objects = 1;
         caps.can_generate_object_free_events = 1;
         if (!NSK_JVMTI_VERIFY(
-                NSK_CPP_STUB2(AddCapabilities, jvmti, &caps))) {
+                jvmti->AddCapabilities(&caps))) {
             return JNI_ERR;
         }
     }
@@ -571,8 +562,7 @@
         memset(&eventCallbacks, 0, sizeof(eventCallbacks));
         eventCallbacks.ObjectFree = callbackObjectFree;
         if (!NSK_JVMTI_VERIFY(
-                NSK_CPP_STUB3(SetEventCallbacks, jvmti,
-                                    &eventCallbacks, sizeof(eventCallbacks))))
+                jvmti->SetEventCallbacks(&eventCallbacks, sizeof(eventCallbacks))))
             return JNI_ERR;
     }
 
--- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/IterateOverInstancesOfClass/iterinstcls002/iterinstcls002.cpp	Fri Oct 05 17:01:07 2018 -0400
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/IterateOverInstancesOfClass/iterinstcls002/iterinstcls002.cpp	Tue Oct 09 14:37:59 2018 +0200
@@ -92,14 +92,14 @@
     tag++;
 
     if (!NSK_JNI_VERIFY(jni, (obj =
-            NSK_CPP_STUB3(GetObjectField, jni, firstObject, firstField)) != NULL)) {
+            jni->GetObjectField(firstObject, firstField)) != NULL)) {
         nsk_jvmti_setFailStatus();
         return NSK_FALSE;
     }
 
     objectDescList[count].tag = objTag;
     if (!NSK_JVMTI_VERIFY(
-            NSK_CPP_STUB3(SetTag, jvmti, obj, objTag))) {
+            jvmti->SetTag(obj, objTag))) {
         nsk_jvmti_setFailStatus();
         return NSK_FALSE;
     }
@@ -111,7 +111,7 @@
         return NSK_FALSE;
     }
 
-    NSK_TRACE(NSK_CPP_STUB2(DeleteLocalRef, jni, obj));
+    NSK_TRACE(jni->DeleteLocalRef(obj));
     return success;
 }
 
@@ -136,9 +136,7 @@
     *objectsCount = 2 * chainLength;
 
     NSK_DISPLAY1("Allocate memory for objects list: %d objects\n", *objectsCount);
-    if (!NSK_JVMTI_VERIFY(
-            NSK_CPP_STUB3(Allocate, jvmti, (*objectsCount * sizeof(ObjectDesc)),
-                                                    (unsigned char**)objectDescList))) {
+    if (!NSK_JVMTI_VERIFY(jvmti->Allocate((*objectsCount * sizeof(ObjectDesc)), (unsigned char**)objectDescList))) {
         nsk_jvmti_setFailStatus();
         return NSK_FALSE;
     }
@@ -155,7 +153,7 @@
 
     NSK_DISPLAY1("Find debugee class: %s\n", DEBUGEE_CLASS_NAME);
     if (!NSK_JNI_VERIFY(jni, (debugeeClass =
-            NSK_CPP_STUB2(FindClass, jni, DEBUGEE_CLASS_NAME)) != NULL)) {
+            jni->FindClass(DEBUGEE_CLASS_NAME)) != NULL)) {
         nsk_jvmti_setFailStatus();
         return NSK_FALSE;
     }
@@ -163,7 +161,7 @@
 
     NSK_DISPLAY1("Find root object class: %s\n", ROOT_OBJECT_CLASS_NAME);
     if (!NSK_JNI_VERIFY(jni, (rootObjectClass =
-            NSK_CPP_STUB2(FindClass, jni, ROOT_OBJECT_CLASS_NAME)) != NULL)) {
+            jni->FindClass(ROOT_OBJECT_CLASS_NAME)) != NULL)) {
         nsk_jvmti_setFailStatus();
         return NSK_FALSE;
     }
@@ -171,7 +169,7 @@
 
     NSK_DISPLAY1("Find chain object class: %s\n", CHAIN_OBJECT_CLASS_NAME);
     if (!NSK_JNI_VERIFY(jni, (chainObjectClass =
-            NSK_CPP_STUB2(FindClass, jni, CHAIN_OBJECT_CLASS_NAME)) != NULL)) {
+            jni->FindClass(CHAIN_OBJECT_CLASS_NAME)) != NULL)) {
         nsk_jvmti_setFailStatus();
         return NSK_FALSE;
     }
@@ -179,7 +177,7 @@
 
     NSK_DISPLAY1("Create global ref to tested class: 0x%p\n", chainObjectClass);
     if (!NSK_JNI_VERIFY(jni, (*testedClass = (jclass)
-            NSK_CPP_STUB2(NewGlobalRef, jni, chainObjectClass)) != NULL)) {
+            jni->NewGlobalRef(chainObjectClass)) != NULL)) {
         nsk_jvmti_setFailStatus();
         return NSK_FALSE;
     }
@@ -187,8 +185,7 @@
 
     NSK_DISPLAY1("Find static field in debugee class: %s\n", OBJECT_FIELD_NAME);
     if (!NSK_JNI_VERIFY(jni, (objectField =
-            NSK_CPP_STUB4(GetStaticFieldID, jni, debugeeClass,
-                            OBJECT_FIELD_NAME, ROOT_OBJECT_CLASS_SIG)) != NULL)) {
+            jni->GetStaticFieldID(debugeeClass, OBJECT_FIELD_NAME, ROOT_OBJECT_CLASS_SIG)) != NULL)) {
         nsk_jvmti_setFailStatus();
         return NSK_FALSE;
     }
@@ -196,8 +193,7 @@
 
     NSK_DISPLAY1("Find instance field in root object class: %s\n", REACHABLE_CHAIN_FIELD_NAME);
     if (!NSK_JNI_VERIFY(jni, (reachableChainField =
-            NSK_CPP_STUB4(GetFieldID, jni, rootObjectClass,
-                        REACHABLE_CHAIN_FIELD_NAME, CHAIN_OBJECT_CLASS_SIG)) != NULL)) {
+            jni->GetFieldID(rootObjectClass, REACHABLE_CHAIN_FIELD_NAME, CHAIN_OBJECT_CLASS_SIG)) != NULL)) {
         nsk_jvmti_setFailStatus();
         return NSK_FALSE;
     }
@@ -205,8 +201,7 @@
 
     NSK_DISPLAY1("Find instance field in root object class: %s\n", UNREACHABLE_CHAIN_FIELD_NAME);
     if (!NSK_JNI_VERIFY(jni, (unreachableChainField =
-            NSK_CPP_STUB4(GetFieldID, jni, rootObjectClass,
-                        UNREACHABLE_CHAIN_FIELD_NAME, CHAIN_OBJECT_CLASS_SIG)) != NULL)) {
+            jni->GetFieldID(rootObjectClass, UNREACHABLE_CHAIN_FIELD_NAME, CHAIN_OBJECT_CLASS_SIG)) != NULL)) {
         nsk_jvmti_setFailStatus();
         return NSK_FALSE;
     }
@@ -214,8 +209,7 @@
 
     NSK_DISPLAY1("Find instance field in chain object class: %s\n", TAIL_FIELD_NAME);
     if (!NSK_JNI_VERIFY(jni, (tailField =
-            NSK_CPP_STUB4(GetFieldID, jni, chainObjectClass,
-                            TAIL_FIELD_NAME, CHAIN_OBJECT_CLASS_SIG)) != NULL)) {
+            jni->GetFieldID(chainObjectClass, TAIL_FIELD_NAME, CHAIN_OBJECT_CLASS_SIG)) != NULL)) {
         nsk_jvmti_setFailStatus();
         return NSK_FALSE;
     }
@@ -223,8 +217,7 @@
 
     NSK_DISPLAY1("Get root object from static field: %s\n", OBJECT_FIELD_NAME);
     if (!NSK_JNI_VERIFY(jni, (rootObject =
-            NSK_CPP_STUB3(GetStaticObjectField, jni, debugeeClass,
-                                                    objectField)) != NULL)) {
+            jni->GetStaticObjectField(debugeeClass, objectField)) != NULL)) {
         nsk_jvmti_setFailStatus();
         return NSK_FALSE;
     }
@@ -234,7 +227,7 @@
 
     NSK_DISPLAY0("    tested class object:\n");
     if (!NSK_JVMTI_VERIFY(
-            NSK_CPP_STUB3(SetTag, jvmti, *testedClass, testedClassTag))) {
+            jvmti->SetTag(*testedClass, testedClassTag))) {
         nsk_jvmti_setFailStatus();
         return NSK_FALSE;
     }
@@ -329,13 +322,13 @@
                                         ObjectDesc* objectDescList, jclass testedClass) {
     if (testedClass != NULL) {
         NSK_DISPLAY1("Release object reference to tested class: 0x%p\n", testedClass);
-        NSK_TRACE(NSK_CPP_STUB2(DeleteGlobalRef, jni, testedClass));
+        NSK_TRACE(jni->DeleteGlobalRef(testedClass));
     }
 
     if (objectDescList != NULL) {
         NSK_DISPLAY1("Deallocate objects list: 0x%p\n", (void*)objectDescList);
         if (!NSK_JVMTI_VERIFY(
-            NSK_CPP_STUB2(Deallocate, jvmti, (unsigned char*)objectDescList))) {
+            jvmti->Deallocate((unsigned char*)objectDescList))) {
             nsk_jvmti_setFailStatus();
         }
     }
@@ -458,9 +451,7 @@
         NSK_DISPLAY0(">>> Iterate over instances of tested class with filter JVMTI_HEAP_OBJECT_TAGGED\n");
         {
             if (!NSK_JVMTI_VERIFY(
-                    NSK_CPP_STUB5(IterateOverInstancesOfClass, jvmti,
-                        testedClass, JVMTI_HEAP_OBJECT_TAGGED,
-                        heapObjectCallback, &fakeUserData))) {
+                    jvmti->IterateOverInstancesOfClass(testedClass, JVMTI_HEAP_OBJECT_TAGGED, heapObjectCallback, &fakeUserData))) {
                 nsk_jvmti_setFailStatus();
                 return;
             }
@@ -569,7 +560,7 @@
         caps.can_tag_objects = 1;
         caps.can_generate_object_free_events = 1;
         if (!NSK_JVMTI_VERIFY(
-                NSK_CPP_STUB2(AddCapabilities, jvmti, &caps))) {
+                jvmti->AddCapabilities(&caps))) {
             return JNI_ERR;
         }
     }
@@ -579,8 +570,7 @@
         memset(&eventCallbacks, 0, sizeof(eventCallbacks));
         eventCallbacks.ObjectFree = callbackObjectFree;
         if (!NSK_JVMTI_VERIFY(
-                NSK_CPP_STUB3(SetEventCallbacks, jvmti,
-                                    &eventCallbacks, sizeof(eventCallbacks))))
+                jvmti->SetEventCallbacks(&eventCallbacks, sizeof(eventCallbacks))))
             return JNI_ERR;
     }
 
--- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/IterateOverInstancesOfClass/iterinstcls003/iterinstcls003.cpp	Fri Oct 05 17:01:07 2018 -0400
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/IterateOverInstancesOfClass/iterinstcls003/iterinstcls003.cpp	Tue Oct 09 14:37:59 2018 +0200
@@ -92,14 +92,14 @@
     tag++;
 
     if (!NSK_JNI_VERIFY(jni, (obj =
-            NSK_CPP_STUB3(GetObjectField, jni, firstObject, firstField)) != NULL)) {
+            jni->GetObjectField(firstObject, firstField)) != NULL)) {
         nsk_jvmti_setFailStatus();
         return NSK_FALSE;
     }
 
     objectDescList[count].tag = objTag;
     if (!NSK_JVMTI_VERIFY(
-            NSK_CPP_STUB3(SetTag, jvmti, obj, objTag))) {
+            jvmti->SetTag(obj, objTag))) {
         nsk_jvmti_setFailStatus();
         return NSK_FALSE;
     }
@@ -111,7 +111,7 @@
         return NSK_FALSE;
     }
 
-    NSK_TRACE(NSK_CPP_STUB2(DeleteLocalRef, jni, obj));
+    NSK_TRACE(jni->DeleteLocalRef(obj));
     return success;
 }
 
@@ -136,9 +136,7 @@
     *objectsCount = 2 * chainLength;
 
     NSK_DISPLAY1("Allocate memory for objects list: %d objects\n", *objectsCount);
-    if (!NSK_JVMTI_VERIFY(
-            NSK_CPP_STUB3(Allocate, jvmti, (*objectsCount * sizeof(ObjectDesc)),
-                                                    (unsigned char**)objectDescList))) {
+    if (!NSK_JVMTI_VERIFY(jvmti->Allocate((*objectsCount * sizeof(ObjectDesc)), (unsigned char**)objectDescList))) {
         nsk_jvmti_setFailStatus();
         return NSK_FALSE;
     }
@@ -155,7 +153,7 @@
 
     NSK_DISPLAY1("Find debugee class: %s\n", DEBUGEE_CLASS_NAME);
     if (!NSK_JNI_VERIFY(jni, (debugeeClass =
-            NSK_CPP_STUB2(FindClass, jni, DEBUGEE_CLASS_NAME)) != NULL)) {
+            jni->FindClass(DEBUGEE_CLASS_NAME)) != NULL)) {
         nsk_jvmti_setFailStatus();
         return NSK_FALSE;
     }
@@ -163,7 +161,7 @@
 
     NSK_DISPLAY1("Find root object class: %s\n", ROOT_OBJECT_CLASS_NAME);
     if (!NSK_JNI_VERIFY(jni, (rootObjectClass =
-            NSK_CPP_STUB2(FindClass, jni, ROOT_OBJECT_CLASS_NAME)) != NULL)) {
+            jni->FindClass(ROOT_OBJECT_CLASS_NAME)) != NULL)) {
         nsk_jvmti_setFailStatus();
         return NSK_FALSE;
     }
@@ -171,7 +169,7 @@
 
     NSK_DISPLAY1("Find chain object class: %s\n", CHAIN_OBJECT_CLASS_NAME);
     if (!NSK_JNI_VERIFY(jni, (chainObjectClass =
-            NSK_CPP_STUB2(FindClass, jni, CHAIN_OBJECT_CLASS_NAME)) != NULL)) {
+            jni->FindClass(CHAIN_OBJECT_CLASS_NAME)) != NULL)) {
         nsk_jvmti_setFailStatus();
         return NSK_FALSE;
     }
@@ -179,7 +177,7 @@
 
     NSK_DISPLAY1("Create global ref to tested class: 0x%p\n", chainObjectClass);
     if (!NSK_JNI_VERIFY(jni, (*testedClass = (jclass)
-            NSK_CPP_STUB2(NewGlobalRef, jni, chainObjectClass)) != NULL)) {
+            jni->NewGlobalRef(chainObjectClass)) != NULL)) {
         nsk_jvmti_setFailStatus();
         return NSK_FALSE;
     }
@@ -187,8 +185,7 @@
 
     NSK_DISPLAY1("Find static field in debugee class: %s\n", OBJECT_FIELD_NAME);
     if (!NSK_JNI_VERIFY(jni, (objectField =
-            NSK_CPP_STUB4(GetStaticFieldID, jni, debugeeClass,
-                            OBJECT_FIELD_NAME, ROOT_OBJECT_CLASS_SIG)) != NULL)) {
+            jni->GetStaticFieldID(debugeeClass, OBJECT_FIELD_NAME, ROOT_OBJECT_CLASS_SIG)) != NULL)) {
         nsk_jvmti_setFailStatus();
         return NSK_FALSE;
     }
@@ -196,8 +193,7 @@
 
     NSK_DISPLAY1("Find instance field in root object class: %s\n", REACHABLE_CHAIN_FIELD_NAME);
     if (!NSK_JNI_VERIFY(jni, (reachableChainField =
-            NSK_CPP_STUB4(GetFieldID, jni, rootObjectClass,
-                        REACHABLE_CHAIN_FIELD_NAME, CHAIN_OBJECT_CLASS_SIG)) != NULL)) {
+            jni->GetFieldID(rootObjectClass, REACHABLE_CHAIN_FIELD_NAME, CHAIN_OBJECT_CLASS_SIG)) != NULL)) {
         nsk_jvmti_setFailStatus();
         return NSK_FALSE;
     }
@@ -205,8 +201,7 @@
 
     NSK_DISPLAY1("Find instance field in root object class: %s\n", UNREACHABLE_CHAIN_FIELD_NAME);
     if (!NSK_JNI_VERIFY(jni, (unreachableChainField =
-            NSK_CPP_STUB4(GetFieldID, jni, rootObjectClass,
-                        UNREACHABLE_CHAIN_FIELD_NAME, CHAIN_OBJECT_CLASS_SIG)) != NULL)) {
+            jni->GetFieldID(rootObjectClass, UNREACHABLE_CHAIN_FIELD_NAME, CHAIN_OBJECT_CLASS_SIG)) != NULL)) {
         nsk_jvmti_setFailStatus();
         return NSK_FALSE;
     }
@@ -214,8 +209,7 @@
 
     NSK_DISPLAY1("Find instance field in chain object class: %s\n", TAIL_FIELD_NAME);
     if (!NSK_JNI_VERIFY(jni, (tailField =
-            NSK_CPP_STUB4(GetFieldID, jni, chainObjectClass,
-                            TAIL_FIELD_NAME, CHAIN_OBJECT_CLASS_SIG)) != NULL)) {
+            jni->GetFieldID(chainObjectClass, TAIL_FIELD_NAME, CHAIN_OBJECT_CLASS_SIG)) != NULL)) {
         nsk_jvmti_setFailStatus();
         return NSK_FALSE;
     }
@@ -223,8 +217,7 @@
 
     NSK_DISPLAY1("Get root object from static field: %s\n", OBJECT_FIELD_NAME);
     if (!NSK_JNI_VERIFY(jni, (rootObject =
-            NSK_CPP_STUB3(GetStaticObjectField, jni, debugeeClass,
-                                                    objectField)) != NULL)) {
+            jni->GetStaticObjectField(debugeeClass, objectField)) != NULL)) {
         nsk_jvmti_setFailStatus();
         return NSK_FALSE;
     }
@@ -234,7 +227,7 @@
 
     NSK_DISPLAY0("    tested class object:\n");
     if (!NSK_JVMTI_VERIFY(
-            NSK_CPP_STUB3(SetTag, jvmti, *testedClass, testedClassTag))) {
+            jvmti->SetTag(*testedClass, testedClassTag))) {
         nsk_jvmti_setFailStatus();
         return NSK_FALSE;
     }
@@ -329,13 +322,13 @@
                                         ObjectDesc* objectDescList, jclass testedClass) {
     if (testedClass != NULL) {
         NSK_DISPLAY1("Release object reference to tested class: 0x%p\n", testedClass);
-        NSK_TRACE(NSK_CPP_STUB2(DeleteGlobalRef, jni, testedClass));
+        NSK_TRACE(jni->DeleteGlobalRef(testedClass));
     }
 
     if (objectDescList != NULL) {
         NSK_DISPLAY1("Deallocate objects list: 0x%p\n", (void*)objectDescList);
         if (!NSK_JVMTI_VERIFY(
-            NSK_CPP_STUB2(Deallocate, jvmti, (unsigned char*)objectDescList))) {
+            jvmti->Deallocate((unsigned char*)objectDescList))) {
             nsk_jvmti_setFailStatus();
         }
     }
@@ -459,9 +452,7 @@
         NSK_DISPLAY0(">>> Iterate over instances of tested class with filter JVMTI_HEAP_OBJECT_UNTAGGED\n");
         {
             if (!NSK_JVMTI_VERIFY(
-                    NSK_CPP_STUB5(IterateOverInstancesOfClass, jvmti,
-                        testedClass, JVMTI_HEAP_OBJECT_UNTAGGED,
-                        heapObjectCallback, &fakeUserData))) {
+                    jvmti->IterateOverInstancesOfClass(testedClass, JVMTI_HEAP_OBJECT_UNTAGGED, heapObjectCallback, &fakeUserData))) {
                 nsk_jvmti_setFailStatus();
                 return;
             }
@@ -570,7 +561,7 @@
         caps.can_tag_objects = 1;
         caps.can_generate_object_free_events = 1;
         if (!NSK_JVMTI_VERIFY(
-                NSK_CPP_STUB2(AddCapabilities, jvmti, &caps))) {
+                jvmti->AddCapabilities(&caps))) {
             return JNI_ERR;
         }
     }
@@ -580,8 +571,7 @@
         memset(&eventCallbacks, 0, sizeof(eventCallbacks));
         eventCallbacks.ObjectFree = callbackObjectFree;
         if (!NSK_JVMTI_VERIFY(
-                NSK_CPP_STUB3(SetEventCallbacks, jvmti,
-                                    &eventCallbacks, sizeof(eventCallbacks))))
+                jvmti->SetEventCallbacks(&eventCallbacks, sizeof(eventCallbacks))))
             return JNI_ERR;
     }
 
--- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/IterateOverInstancesOfClass/iterinstcls004/iterinstcls004.cpp	Fri Oct 05 17:01:07 2018 -0400
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/IterateOverInstancesOfClass/iterinstcls004/iterinstcls004.cpp	Tue Oct 09 14:37:59 2018 +0200
@@ -61,9 +61,7 @@
     /* Set tag */
     *tag_ptr = objectCount;
 
-    if (!NSK_JVMTI_VERIFY(
-            NSK_CPP_STUB3(Allocate, st_jvmti, (sizeof(ObjectDesc)),
-                             (unsigned char**)&objectDescBuf))) {
+    if (!NSK_JVMTI_VERIFY(st_jvmti->Allocate((sizeof(ObjectDesc)), (unsigned char**)&objectDescBuf))) {
         nsk_jvmti_setFailStatus();
         allocationError = 1;
     }
@@ -83,8 +81,7 @@
 
     objectCount--;
 
-    if (!NSK_JVMTI_VERIFY(
-            NSK_CPP_STUB2(Deallocate, st_jvmti, (unsigned char*)objectDescBuf))) {
+    if (!NSK_JVMTI_VERIFY(st_jvmti->Deallocate((unsigned char*)objectDescBuf))) {
         nsk_jvmti_setFailStatus();
     }
 
@@ -115,12 +112,7 @@
             NSK_DISPLAY0("Calling IterateOverInstancesOfClass with filter JVMTI_HEAP_OBJECT_UNTAGGED\n");
             {
                 if (!NSK_JVMTI_VERIFY(
-                        NSK_CPP_STUB5(IterateOverInstancesOfClass,
-                            jvmti,
-                            debugeeClass,
-                            JVMTI_HEAP_OBJECT_UNTAGGED,
-                            heapObjectCallback1,
-                            &userData))) {
+                        jvmti->IterateOverInstancesOfClass(debugeeClass, JVMTI_HEAP_OBJECT_UNTAGGED, heapObjectCallback1, &userData))) {
                     nsk_jvmti_setFailStatus();
                     break;
                 }
@@ -139,12 +131,7 @@
             NSK_DISPLAY0("Calling IterateOverInstancesOfClass with filter JVMTI_HEAP_OBJECT_TAGGED\n");
             {
                 if (!NSK_JVMTI_VERIFY(
-                        NSK_CPP_STUB5(IterateOverInstancesOfClass,
-                            jvmti,
-                            debugeeClass,
-                            JVMTI_HEAP_OBJECT_TAGGED,
-                            heapObjectCallback2,
-                            &userData))) {
+                        jvmti->IterateOverInstancesOfClass(debugeeClass, JVMTI_HEAP_OBJECT_TAGGED, heapObjectCallback2, &userData))) {
                     nsk_jvmti_setFailStatus();
                     break;
                 }
@@ -200,7 +187,7 @@
         memset(&caps, 0, sizeof(caps));
         caps.can_tag_objects = 1;
         if (!NSK_JVMTI_VERIFY(
-                NSK_CPP_STUB2(AddCapabilities, jvmti, &caps))) {
+                jvmti->AddCapabilities(&caps))) {
             return JNI_ERR;
         }
     }
--- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/IterateOverInstancesOfClass/iterinstcls005/iterinstcls005.cpp	Fri Oct 05 17:01:07 2018 -0400
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/IterateOverInstancesOfClass/iterinstcls005/iterinstcls005.cpp	Tue Oct 09 14:37:59 2018 +0200
@@ -49,55 +49,46 @@
 
     objCounter++;
 
-    if (!NSK_JVMTI_VERIFY(
-            NSK_CPP_STUB3(CreateRawMonitor, st_jvmti, name, &monitor_ptr))) {
+    if (!NSK_JVMTI_VERIFY(st_jvmti->CreateRawMonitor(name, &monitor_ptr))) {
         nsk_jvmti_setFailStatus();
         return JVMTI_ITERATION_ABORT;
     }
 
-    if (!NSK_JVMTI_VERIFY(
-            NSK_CPP_STUB2(RawMonitorEnter, st_jvmti, monitor_ptr))) {
+    if (!NSK_JVMTI_VERIFY(st_jvmti->RawMonitorEnter(monitor_ptr))) {
         nsk_jvmti_setFailStatus();
         return JVMTI_ITERATION_ABORT;
     }
 
     /* Enter second time */
-    if (!NSK_JVMTI_VERIFY(
-            NSK_CPP_STUB2(RawMonitorEnter, st_jvmti, monitor_ptr))) {
+    if (!NSK_JVMTI_VERIFY(st_jvmti->RawMonitorEnter(monitor_ptr))) {
         nsk_jvmti_setFailStatus();
         return JVMTI_ITERATION_ABORT;
     }
 
-    if (!NSK_JVMTI_VERIFY(
-            NSK_CPP_STUB3(RawMonitorWait, st_jvmti, monitor_ptr, (jlong)100))) {
+    if (!NSK_JVMTI_VERIFY(st_jvmti->RawMonitorWait(monitor_ptr, (jlong)100))) {
         nsk_jvmti_setFailStatus();
     }
 
-    if (!NSK_JVMTI_VERIFY(
-            NSK_CPP_STUB2(RawMonitorNotify, st_jvmti, monitor_ptr))) {
+    if (!NSK_JVMTI_VERIFY(st_jvmti->RawMonitorNotify(monitor_ptr))) {
         nsk_jvmti_setFailStatus();
     }
 
-    if (!NSK_JVMTI_VERIFY(
-            NSK_CPP_STUB2(RawMonitorNotifyAll, st_jvmti, monitor_ptr))) {
+    if (!NSK_JVMTI_VERIFY(st_jvmti->RawMonitorNotifyAll(monitor_ptr))) {
         nsk_jvmti_setFailStatus();
     }
 
-    if (!NSK_JVMTI_VERIFY(
-            NSK_CPP_STUB2(RawMonitorExit, st_jvmti, monitor_ptr))) {
+    if (!NSK_JVMTI_VERIFY(st_jvmti->RawMonitorExit(monitor_ptr))) {
         nsk_jvmti_setFailStatus();
         return JVMTI_ITERATION_ABORT;
     }
 
     /* Exit second time */
-    if (!NSK_JVMTI_VERIFY(
-            NSK_CPP_STUB2(RawMonitorExit, st_jvmti, monitor_ptr))) {
+    if (!NSK_JVMTI_VERIFY(st_jvmti->RawMonitorExit(monitor_ptr))) {
         nsk_jvmti_setFailStatus();
         return JVMTI_ITERATION_ABORT;
     }
 
-    if (!NSK_JVMTI_VERIFY(
-            NSK_CPP_STUB2(DestroyRawMonitor, st_jvmti, monitor_ptr))) {
+    if (!NSK_JVMTI_VERIFY(st_jvmti->DestroyRawMonitor(monitor_ptr))) {
         nsk_jvmti_setFailStatus();
     }
 
@@ -127,12 +118,10 @@
         NSK_DISPLAY0("Calling IterateOverInstancesOfClass with filter JVMTI_HEAP_OBJECT_EITHER\n");
         {
             if (!NSK_JVMTI_VERIFY(
-                    NSK_CPP_STUB5(IterateOverInstancesOfClass,
-                        jvmti,
-                        debugeeClass,
-                        JVMTI_HEAP_OBJECT_EITHER,
-                        heapObjectCallback,
-                        &fakeUserData))) {
+                    jvmti->IterateOverInstancesOfClass(debugeeClass,
+                                                       JVMTI_HEAP_OBJECT_EITHER,
+                                                       heapObjectCallback,
+                                                       &fakeUserData))) {
                 nsk_jvmti_setFailStatus();
             }
         }
@@ -182,8 +171,7 @@
 
         memset(&caps, 0, sizeof(caps));
         caps.can_tag_objects = 1;
-        if (!NSK_JVMTI_VERIFY(
-                NSK_CPP_STUB2(AddCapabilities, jvmti, &caps))) {
+        if (!NSK_JVMTI_VERIFY(jvmti->AddCapabilities(&caps))) {
             return JNI_ERR;
         }
     }
--- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/IterateOverInstancesOfClass/iterinstcls006/iterinstcls006.cpp	Fri Oct 05 17:01:07 2018 -0400
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/IterateOverInstancesOfClass/iterinstcls006/iterinstcls006.cpp	Tue Oct 09 14:37:59 2018 +0200
@@ -45,13 +45,11 @@
                    jlong* tag_ptr,
                    void* storage_data) {
 
-    if (!NSK_JVMTI_VERIFY(
-            NSK_CPP_STUB2(SetEnvironmentLocalStorage, st_jvmti, storage_data ))) {
+    if (!NSK_JVMTI_VERIFY(st_jvmti->SetEnvironmentLocalStorage(storage_data))) {
         nsk_jvmti_setFailStatus();
     }
 
-    if (!NSK_JVMTI_VERIFY(
-            NSK_CPP_STUB2(GetEnvironmentLocalStorage, st_jvmti, &storage_ptr))) {
+    if (!NSK_JVMTI_VERIFY(st_jvmti->GetEnvironmentLocalStorage(&storage_ptr))) {
         nsk_jvmti_setFailStatus();
     }
 
@@ -82,12 +80,10 @@
         NSK_DISPLAY0("Calling IterateOverInstancesOfClass with filter JVMTI_HEAP_OBJECT_EITHER\n");
         {
             if (!NSK_JVMTI_VERIFY(
-                    NSK_CPP_STUB5(IterateOverInstancesOfClass,
-                        jvmti,
-                        debugeeClass,
-                        JVMTI_HEAP_OBJECT_EITHER,
-                        heapObjectCallback,
-                        (void *)storage_data))) {
+                    jvmti->IterateOverInstancesOfClass(debugeeClass,
+                                                       JVMTI_HEAP_OBJECT_EITHER,
+                                                       heapObjectCallback,
+                                                       (void *) storage_data))) {
                 nsk_jvmti_setFailStatus();
             }
         }
@@ -144,8 +140,7 @@
 
         memset(&caps, 0, sizeof(caps));
         caps.can_tag_objects = 1;
-        if (!NSK_JVMTI_VERIFY(
-                NSK_CPP_STUB2(AddCapabilities, jvmti, &caps))) {
+        if (!NSK_JVMTI_VERIFY(jvmti->AddCapabilities(&caps))) {
             return JNI_ERR;
         }
     }
--- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/IterateOverInstancesOfClass/iterinstcls007/iterinstcls007.cpp	Fri Oct 05 17:01:07 2018 -0400
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/IterateOverInstancesOfClass/iterinstcls007/iterinstcls007.cpp	Tue Oct 09 14:37:59 2018 +0200
@@ -46,8 +46,7 @@
                    jlong* tag_ptr,
                    void* user_data) {
 
-    if (!NSK_JVMTI_VERIFY(
-            NSK_CPP_STUB2(GetCurrentThreadCpuTimerInfo, st_jvmti, &timer_info1 ))) {
+    if (!NSK_JVMTI_VERIFY(st_jvmti->GetCurrentThreadCpuTimerInfo(&timer_info1))) {
         nsk_jvmti_setFailStatus();
     }
     /* Check the returned jvmtiTimerInfo structure */
@@ -65,14 +64,12 @@
     }
     /* ---------------------------------------------------------------------- */
 
-    if (!NSK_JVMTI_VERIFY(
-            NSK_CPP_STUB2(GetCurrentThreadCpuTime, st_jvmti, &nanos ))) {
+    if (!NSK_JVMTI_VERIFY(st_jvmti->GetCurrentThreadCpuTime(&nanos))) {
         nsk_jvmti_setFailStatus();
     }
     /* ---------------------------------------------------------------------- */
 
-    if (!NSK_JVMTI_VERIFY(
-            NSK_CPP_STUB2(GetTimerInfo, st_jvmti, &timer_info2 ))) {
+    if (!NSK_JVMTI_VERIFY(st_jvmti->GetTimerInfo(&timer_info2))) {
         nsk_jvmti_setFailStatus();
     }
     /* Check the returned jvmtiTimerInfo structure */
@@ -91,8 +88,7 @@
     /* ---------------------------------------------------------------------- */
 
     nanos = 0;
-    if (!NSK_JVMTI_VERIFY(
-            NSK_CPP_STUB2(GetTime, st_jvmti, &nanos ))) {
+    if (!NSK_JVMTI_VERIFY(st_jvmti->GetTime(&nanos))) {
         nsk_jvmti_setFailStatus();
     }
 
@@ -123,12 +119,10 @@
             }
 
             if (!NSK_JVMTI_VERIFY(
-                    NSK_CPP_STUB5(IterateOverInstancesOfClass,
-                        jvmti,
-                        debugeeClass,
-                        JVMTI_HEAP_OBJECT_EITHER,
-                        heapObjectCallback,
-                        (void *)user_data))) {
+                    jvmti->IterateOverInstancesOfClass(debugeeClass,
+                                                       JVMTI_HEAP_OBJECT_EITHER,
+                                                       heapObjectCallback,
+                                                       (void *) user_data))) {
                 nsk_jvmti_setFailStatus();
             }
         }
@@ -174,8 +168,7 @@
         caps.can_tag_objects = 1;
         caps.can_get_current_thread_cpu_time = 1;
 
-        if (!NSK_JVMTI_VERIFY(
-                NSK_CPP_STUB2(AddCapabilities, jvmti, &caps))) {
+        if (!NSK_JVMTI_VERIFY(jvmti->AddCapabilities(&caps))) {
             return JNI_ERR;
         }
     }
--- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/IterateOverObjectsReachableFromObject/iterobjreachobj001/iterobjreachobj001.cpp	Fri Oct 05 17:01:07 2018 -0400
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/IterateOverObjectsReachableFromObject/iterobjreachobj001/iterobjreachobj001.cpp	Tue Oct 09 14:37:59 2018 +0200
@@ -85,15 +85,13 @@
     count--;
     tag++;
 
-    if (!NSK_JNI_VERIFY(jni, (obj =
-            NSK_CPP_STUB3(GetObjectField, jni, firstObject, firstField)) != NULL)) {
+    if (!NSK_JNI_VERIFY(jni, (obj = jni->GetObjectField(firstObject, firstField)) != NULL)) {
         nsk_jvmti_setFailStatus();
         return NSK_FALSE;
     }
 
     objectDescList[count].tag = objTag;
-    if (!NSK_JVMTI_VERIFY(
-            NSK_CPP_STUB3(SetTag, jvmti, obj, objTag))) {
+    if (!NSK_JVMTI_VERIFY(jvmti->SetTag(obj, objTag))) {
         nsk_jvmti_setFailStatus();
     }
     NSK_DISPLAY2("        tag=%-5ld object=0x%p\n", (long)objTag, (void*)obj);
@@ -104,7 +102,7 @@
         return NSK_FALSE;
     }
 
-    NSK_TRACE(NSK_CPP_STUB2(DeleteLocalRef, jni, obj));
+    NSK_TRACE(jni->DeleteLocalRef(obj));
     return NSK_TRUE;
 }
 
@@ -127,9 +125,8 @@
     *objectsCount = 1 + 2 * chainLength;
 
     NSK_DISPLAY1("Allocate memory for objects list: %d objects\n", *objectsCount);
-    if (!NSK_JVMTI_VERIFY(
-            NSK_CPP_STUB3(Allocate, jvmti, (*objectsCount * sizeof(ObjectDesc)),
-                                                    (unsigned char**)objectDescList))) {
+    if (!NSK_JVMTI_VERIFY(jvmti->Allocate((*objectsCount * sizeof(ObjectDesc)),
+                                          (unsigned char**)objectDescList))) {
         nsk_jvmti_setFailStatus();
         return NSK_FALSE;
     }
@@ -144,16 +141,14 @@
     }
 
     NSK_DISPLAY1("Find debugee class: %s\n", DEBUGEE_CLASS_NAME);
-    if (!NSK_JNI_VERIFY(jni, (debugeeClass =
-            NSK_CPP_STUB2(FindClass, jni, DEBUGEE_CLASS_NAME)) != NULL)) {
+    if (!NSK_JNI_VERIFY(jni, (debugeeClass = jni->FindClass(DEBUGEE_CLASS_NAME)) != NULL)) {
         nsk_jvmti_setFailStatus();
         return NSK_FALSE;
     }
     NSK_DISPLAY1("  ... found class: 0x%p\n", (void*)debugeeClass);
 
     NSK_DISPLAY1("Find root object class: %s\n", ROOT_OBJECT_CLASS_NAME);
-    if (!NSK_JNI_VERIFY(jni, (rootObjectClass =
-            NSK_CPP_STUB2(FindClass, jni, ROOT_OBJECT_CLASS_NAME)) != NULL)) {
+    if (!NSK_JNI_VERIFY(jni, (rootObjectClass = jni->FindClass(ROOT_OBJECT_CLASS_NAME)) != NULL)) {
         nsk_jvmti_setFailStatus();
         return NSK_FALSE;
     }
@@ -161,34 +156,31 @@
 
     NSK_DISPLAY1("Find chain object class: %s\n", CHAIN_OBJECT_CLASS_NAME);
     if (!NSK_JNI_VERIFY(jni, (chainObjectClass =
-            NSK_CPP_STUB2(FindClass, jni, CHAIN_OBJECT_CLASS_NAME)) != NULL)) {
+            jni->FindClass(CHAIN_OBJECT_CLASS_NAME)) != NULL)) {
         nsk_jvmti_setFailStatus();
         return NSK_FALSE;
     }
     NSK_DISPLAY1("  ... found class: 0x%p\n", (void*)chainObjectClass);
 
     NSK_DISPLAY1("Find static field in debugee class: %s\n", OBJECT_FIELD_NAME);
-    if (!NSK_JNI_VERIFY(jni, (objectField =
-            NSK_CPP_STUB4(GetStaticFieldID, jni, debugeeClass,
-                            OBJECT_FIELD_NAME, ROOT_OBJECT_CLASS_SIG)) != NULL)) {
+    if (!NSK_JNI_VERIFY(jni, (objectField = jni->GetStaticFieldID(
+            debugeeClass, OBJECT_FIELD_NAME, ROOT_OBJECT_CLASS_SIG)) != NULL)) {
         nsk_jvmti_setFailStatus();
         return NSK_FALSE;
     }
     NSK_DISPLAY1("  ... got fieldID: 0x%p\n", (void*)objectField);
 
     NSK_DISPLAY1("Find instance field in root object class: %s\n", REACHABLE_CHAIN_FIELD_NAME);
-    if (!NSK_JNI_VERIFY(jni, (reachableChainField =
-            NSK_CPP_STUB4(GetFieldID, jni, rootObjectClass,
-                        REACHABLE_CHAIN_FIELD_NAME, CHAIN_OBJECT_CLASS_SIG)) != NULL)) {
+    if (!NSK_JNI_VERIFY(jni, (reachableChainField = jni->GetFieldID(
+            rootObjectClass, REACHABLE_CHAIN_FIELD_NAME, CHAIN_OBJECT_CLASS_SIG)) != NULL)) {
         nsk_jvmti_setFailStatus();
         return NSK_FALSE;
     }
     NSK_DISPLAY1("  ... got fieldID: 0x%p\n", (void*)reachableChainField);
 
     NSK_DISPLAY1("Find instance field in root object class: %s\n", UNREACHABLE_CHAIN_FIELD_NAME);
-    if (!NSK_JNI_VERIFY(jni, (unreachableChainField =
-            NSK_CPP_STUB4(GetFieldID, jni, rootObjectClass,
-                        UNREACHABLE_CHAIN_FIELD_NAME, CHAIN_OBJECT_CLASS_SIG)) != NULL)) {
+    if (!NSK_JNI_VERIFY(jni, (unreachableChainField = jni->GetFieldID(
+            rootObjectClass, UNREACHABLE_CHAIN_FIELD_NAME, CHAIN_OBJECT_CLASS_SIG)) != NULL)) {
         nsk_jvmti_setFailStatus();
         return NSK_FALSE;
     }
@@ -196,8 +188,7 @@
 
     NSK_DISPLAY1("Find instance field in chain object class: %s\n", TAIL_FIELD_NAME);
     if (!NSK_JNI_VERIFY(jni, (tailField =
-            NSK_CPP_STUB4(GetFieldID, jni, chainObjectClass,
-                            TAIL_FIELD_NAME, CHAIN_OBJECT_CLASS_SIG)) != NULL)) {
+            jni->GetFieldID(chainObjectClass, TAIL_FIELD_NAME, CHAIN_OBJECT_CLASS_SIG)) != NULL)) {
         nsk_jvmti_setFailStatus();
         return NSK_FALSE;
     }
@@ -205,15 +196,13 @@
 
     NSK_DISPLAY1("Get root object from static field: %s\n", OBJECT_FIELD_NAME);
     if (!NSK_JNI_VERIFY(jni, (*rootObject =
-            NSK_CPP_STUB3(GetStaticObjectField, jni, debugeeClass,
-                                                    objectField)) != NULL)) {
+            jni->GetStaticObjectField(debugeeClass, objectField)) != NULL)) {
         nsk_jvmti_setFailStatus();
         return NSK_FALSE;
     }
     NSK_DISPLAY1("  ... got object: 0x%p\n", (void*)*rootObject);
 
-    if (!NSK_JNI_VERIFY(jni, (*rootObject =
-            NSK_CPP_STUB2(NewGlobalRef, jni, *rootObject)) != NULL)) {
+    if (!NSK_JNI_VERIFY(jni, (*rootObject = jni->NewGlobalRef(*rootObject)) != NULL)) {
         nsk_jvmti_setFailStatus();
         return NSK_FALSE;
     }
@@ -222,8 +211,7 @@
     NSK_DISPLAY0("Obtain and tag chain objects:\n");
 
     NSK_DISPLAY0("    root tested object:\n");
-    if (!NSK_JVMTI_VERIFY(
-            NSK_CPP_STUB3(SetTag, jvmti, *rootObject, rootObjectTag))) {
+    if (!NSK_JVMTI_VERIFY(jvmti->SetTag(*rootObject, rootObjectTag))) {
         nsk_jvmti_setFailStatus();
     }
     NSK_DISPLAY2("        tag=%-5ld object=0x%p\n", (long)rootObjectTag, (void*)*rootObject);
@@ -304,13 +292,12 @@
                                         ObjectDesc* objectDescList, jobject rootObject) {
     if (rootObject != NULL) {
         NSK_DISPLAY1("Release object reference to root tested object: 0x%p\n", rootObject);
-        NSK_TRACE(NSK_CPP_STUB2(DeleteGlobalRef, jni, rootObject));
+        NSK_TRACE(jni->DeleteGlobalRef(rootObject));
     }
 
     if (objectDescList != NULL) {
         NSK_DISPLAY1("Deallocate objects list: 0x%p\n", (void*)objectDescList);
-        if (!NSK_JVMTI_VERIFY(
-            NSK_CPP_STUB2(Deallocate, jvmti, (unsigned char*)objectDescList))) {
+        if (!NSK_JVMTI_VERIFY(jvmti->Deallocate((unsigned char*)objectDescList))) {
             nsk_jvmti_setFailStatus();
         }
     }
@@ -445,7 +432,7 @@
         NSK_DISPLAY0(">>> Start iteration for root tested object\n");
         {
             if (!NSK_JVMTI_VERIFY(
-                    NSK_CPP_STUB4(IterateOverObjectsReachableFromObject, jvmti,
+                    jvmti->IterateOverObjectsReachableFromObject(
                         rootObject, objectReferenceCallback, &fakeUserData))) {
                 nsk_jvmti_setFailStatus();
                 return;
@@ -529,8 +516,7 @@
 
         memset(&caps, 0, sizeof(caps));
         caps.can_tag_objects = 1;
-        if (!NSK_JVMTI_VERIFY(
-                NSK_CPP_STUB2(AddCapabilities, jvmti, &caps))) {
+        if (!NSK_JVMTI_VERIFY(jvmti->AddCapabilities(&caps))) {
             return JNI_ERR;
         }
     }
--- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/IterateOverObjectsReachableFromObject/iterobjreachobj002/iterobjreachobj002.cpp	Fri Oct 05 17:01:07 2018 -0400
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/IterateOverObjectsReachableFromObject/iterobjreachobj002/iterobjreachobj002.cpp	Tue Oct 09 14:37:59 2018 +0200
@@ -66,9 +66,8 @@
     /* Set tag */
     *tag_ptr = objectCount;
 
-    if (!NSK_JVMTI_VERIFY(
-            NSK_CPP_STUB3(Allocate, st_jvmti, (sizeof(ObjectDesc)),
-                             (unsigned char**)&objectDescBuf))) {
+    if (!NSK_JVMTI_VERIFY(st_jvmti->Allocate((sizeof(ObjectDesc)),
+                                             (unsigned char**)&objectDescBuf))) {
         nsk_jvmti_setFailStatus();
         allocationError = 1;
     }
@@ -91,8 +90,7 @@
 
     objectCount--;
 
-    if (!NSK_JVMTI_VERIFY(
-            NSK_CPP_STUB2(Deallocate, st_jvmti, (unsigned char*)objectDescBuf))) {
+    if (!NSK_JVMTI_VERIFY(st_jvmti->Deallocate((unsigned char*)objectDescBuf))) {
         nsk_jvmti_setFailStatus();
     }
 
@@ -123,29 +121,23 @@
             }
 
             NSK_DISPLAY1("Find static field in debugee class: %s\n", objectFieldName);
-            if (!NSK_JNI_VERIFY(jni, (objectField =
-                    NSK_CPP_STUB4(GetStaticFieldID, jni, debugeeClass,
-                                     objectFieldName, debugeeClassSignature)) != NULL)) {
+            if (!NSK_JNI_VERIFY(jni, (objectField = jni->GetStaticFieldID(
+                    debugeeClass, objectFieldName, debugeeClassSignature)) != NULL)) {
                 nsk_jvmti_setFailStatus();
                 break;
             }
 
             NSK_DISPLAY1("Find value of static field in debugee class: %s\n", objectFieldName);
             if (!NSK_JNI_VERIFY(jni, (object =
-                    NSK_CPP_STUB3(GetStaticObjectField, jni, debugeeClass,
-                                     objectField)) != NULL)) {
+                    jni->GetStaticObjectField(debugeeClass, objectField)) != NULL)) {
                 nsk_jvmti_setFailStatus();
                 break;
             }
 
             NSK_DISPLAY0("Calling IterateOverObjectsReachableFromObject with allocation\n");
             {
-                if (!NSK_JVMTI_VERIFY(
-                        NSK_CPP_STUB4(IterateOverObjectsReachableFromObject,
-                            jvmti,
-                            object,
-                            objectReferenceCallback1,
-                            &userData))) {
+                if (!NSK_JVMTI_VERIFY(jvmti->IterateOverObjectsReachableFromObject(
+                        object, objectReferenceCallback1, &userData))) {
                     nsk_jvmti_setFailStatus();
                     break;
                 }
@@ -161,12 +153,8 @@
 
             NSK_DISPLAY0("Calling IterateOverObjectsReachableFromObject with deallocation\n");
             {
-                if (!NSK_JVMTI_VERIFY(
-                        NSK_CPP_STUB4(IterateOverObjectsReachableFromObject,
-                            jvmti,
-                            object,
-                            objectReferenceCallback2,
-                            &userData))) {
+                if (!NSK_JVMTI_VERIFY(jvmti->IterateOverObjectsReachableFromObject(
+                        object, objectReferenceCallback2, &userData))) {
                     nsk_jvmti_setFailStatus();
                     break;
                 }
@@ -221,8 +209,7 @@
 
         memset(&caps, 0, sizeof(caps));
         caps.can_tag_objects = 1;
-        if (!NSK_JVMTI_VERIFY(
-                NSK_CPP_STUB2(AddCapabilities, jvmti, &caps))) {
+        if (!NSK_JVMTI_VERIFY(jvmti->AddCapabilities(&caps))) {
             return JNI_ERR;
         }
     }
--- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/IterateOverObjectsReachableFromObject/iterobjreachobj003/iterobjreachobj003.cpp	Fri Oct 05 17:01:07 2018 -0400
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/IterateOverObjectsReachableFromObject/iterobjreachobj003/iterobjreachobj003.cpp	Tue Oct 09 14:37:59 2018 +0200
@@ -53,55 +53,46 @@
 
     objCounter++;
 
-    if (!NSK_JVMTI_VERIFY(
-            NSK_CPP_STUB3(CreateRawMonitor, st_jvmti, name, &monitor_ptr))) {
+    if (!NSK_JVMTI_VERIFY(st_jvmti->CreateRawMonitor(name, &monitor_ptr))) {
         nsk_jvmti_setFailStatus();
         return JVMTI_ITERATION_ABORT;
     }
 
-    if (!NSK_JVMTI_VERIFY(
-            NSK_CPP_STUB2(RawMonitorEnter, st_jvmti, monitor_ptr))) {
+    if (!NSK_JVMTI_VERIFY(st_jvmti->RawMonitorEnter(monitor_ptr))) {
         nsk_jvmti_setFailStatus();
         return JVMTI_ITERATION_ABORT;
     }
 
     /* Enter second time */
-    if (!NSK_JVMTI_VERIFY(
-            NSK_CPP_STUB2(RawMonitorEnter, st_jvmti, monitor_ptr))) {
+    if (!NSK_JVMTI_VERIFY(st_jvmti->RawMonitorEnter(monitor_ptr))) {
         nsk_jvmti_setFailStatus();
         return JVMTI_ITERATION_ABORT;
     }
 
-    if (!NSK_JVMTI_VERIFY(
-            NSK_CPP_STUB3(RawMonitorWait, st_jvmti, monitor_ptr, (jlong)100))) {
+    if (!NSK_JVMTI_VERIFY(st_jvmti->RawMonitorWait(monitor_ptr, (jlong)100))) {
         nsk_jvmti_setFailStatus();
     }
 
-    if (!NSK_JVMTI_VERIFY(
-            NSK_CPP_STUB2(RawMonitorNotify, st_jvmti, monitor_ptr))) {
+    if (!NSK_JVMTI_VERIFY(st_jvmti->RawMonitorNotify(monitor_ptr))) {
         nsk_jvmti_setFailStatus();
     }
 
-    if (!NSK_JVMTI_VERIFY(
-            NSK_CPP_STUB2(RawMonitorNotifyAll, st_jvmti, monitor_ptr))) {
+    if (!NSK_JVMTI_VERIFY(st_jvmti->RawMonitorNotifyAll(monitor_ptr))) {
         nsk_jvmti_setFailStatus();
     }
 
-    if (!NSK_JVMTI_VERIFY(
-            NSK_CPP_STUB2(RawMonitorExit, st_jvmti, monitor_ptr))) {
+    if (!NSK_JVMTI_VERIFY(st_jvmti->RawMonitorExit(monitor_ptr))) {
         nsk_jvmti_setFailStatus();
         return JVMTI_ITERATION_ABORT;
     }
 
     /* Exit second time */
-    if (!NSK_JVMTI_VERIFY(
-            NSK_CPP_STUB2(RawMonitorExit, st_jvmti, monitor_ptr))) {
+    if (!NSK_JVMTI_VERIFY(st_jvmti->RawMonitorExit(monitor_ptr))) {
         nsk_jvmti_setFailStatus();
         return JVMTI_ITERATION_ABORT;
     }
 
-    if (!NSK_JVMTI_VERIFY(
-            NSK_CPP_STUB2(DestroyRawMonitor, st_jvmti, monitor_ptr))) {
+    if (!NSK_JVMTI_VERIFY(st_jvmti->DestroyRawMonitor(monitor_ptr))) {
         nsk_jvmti_setFailStatus();
     }
 
@@ -131,29 +122,23 @@
         }
 
         NSK_DISPLAY1("Find static field in debugee class: %s\n", objectFieldName);
-        if (!NSK_JNI_VERIFY(jni, (objectField =
-                NSK_CPP_STUB4(GetStaticFieldID, jni, debugeeClass,
-                                 objectFieldName, debugeeClassSignature)) != NULL)) {
+        if (!NSK_JNI_VERIFY(jni, (objectField = jni->GetStaticFieldID(
+                debugeeClass, objectFieldName, debugeeClassSignature)) != NULL)) {
             nsk_jvmti_setFailStatus();
             break;
         }
 
         NSK_DISPLAY1("Find value of static field in debugee class: %s\n", objectFieldName);
         if (!NSK_JNI_VERIFY(jni, (object =
-                NSK_CPP_STUB3(GetStaticObjectField, jni, debugeeClass,
-                                 objectField)) != NULL)) {
+                jni->GetStaticObjectField(debugeeClass, objectField)) != NULL)) {
             nsk_jvmti_setFailStatus();
             break;
         }
 
         NSK_DISPLAY0("Calling IterateOverObjectsReachableFromObject with filter JVMTI_HEAP_OBJECT_EITHER\n");
         {
-            if (!NSK_JVMTI_VERIFY(
-                    NSK_CPP_STUB4(IterateOverObjectsReachableFromObject,
-                        jvmti,
-                        object,
-                        objectReferenceCallback,
-                        &fakeUserData))) {
+            if (!NSK_JVMTI_VERIFY(jvmti->IterateOverObjectsReachableFromObject(
+                    object, objectReferenceCallback, &fakeUserData))) {
                 nsk_jvmti_setFailStatus();
             }
         }
@@ -203,8 +188,7 @@
 
         memset(&caps, 0, sizeof(caps));
         caps.can_tag_objects = 1;
-        if (!NSK_JVMTI_VERIFY(
-                NSK_CPP_STUB2(AddCapabilities, jvmti, &caps))) {
+        if (!NSK_JVMTI_VERIFY(jvmti->AddCapabilities(&caps))) {
             return JNI_ERR;
         }
     }
--- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/IterateOverObjectsReachableFromObject/iterobjreachobj004/iterobjreachobj004.cpp	Fri Oct 05 17:01:07 2018 -0400
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/IterateOverObjectsReachableFromObject/iterobjreachobj004/iterobjreachobj004.cpp	Tue Oct 09 14:37:59 2018 +0200
@@ -52,13 +52,11 @@
 
     objCounter++;
 
-    if (!NSK_JVMTI_VERIFY(
-            NSK_CPP_STUB2(SetEnvironmentLocalStorage, st_jvmti, storage_data ))) {
+    if (!NSK_JVMTI_VERIFY(st_jvmti->SetEnvironmentLocalStorage(storage_data))) {
         nsk_jvmti_setFailStatus();
     }
 
-    if (!NSK_JVMTI_VERIFY(
-            NSK_CPP_STUB2(GetEnvironmentLocalStorage, st_jvmti, &storage_ptr))) {
+    if (!NSK_JVMTI_VERIFY(st_jvmti->GetEnvironmentLocalStorage(&storage_ptr))) {
         nsk_jvmti_setFailStatus();
     }
 
@@ -89,29 +87,23 @@
         }
 
         NSK_DISPLAY1("Find static field in debugee class: %s\n", objectFieldName);
-        if (!NSK_JNI_VERIFY(jni, (objectField =
-                NSK_CPP_STUB4(GetStaticFieldID, jni, debugeeClass,
-                                 objectFieldName, debugeeClassSignature)) != NULL)) {
+        if (!NSK_JNI_VERIFY(jni, (objectField = jni->GetStaticFieldID(
+                debugeeClass, objectFieldName, debugeeClassSignature)) != NULL)) {
             nsk_jvmti_setFailStatus();
             break;
         }
 
         NSK_DISPLAY1("Find value of static field in debugee class: %s\n", objectFieldName);
         if (!NSK_JNI_VERIFY(jni, (object =
-                NSK_CPP_STUB3(GetStaticObjectField, jni, debugeeClass,
-                                 objectField)) != NULL)) {
+                jni->GetStaticObjectField(debugeeClass, objectField)) != NULL)) {
             nsk_jvmti_setFailStatus();
             break;
         }
 
         NSK_DISPLAY0("Calling IterateOverObjectsReachableFromObject with filter JVMTI_HEAP_OBJECT_EITHER\n");
         {
-            if (!NSK_JVMTI_VERIFY(
-                    NSK_CPP_STUB4(IterateOverObjectsReachableFromObject,
-                        jvmti,
-                        object,
-                        objectReferenceCallback,
-                        &fakeUserData))) {
+            if (!NSK_JVMTI_VERIFY(jvmti->IterateOverObjectsReachableFromObject(
+                  object, objectReferenceCallback, &fakeUserData))) {
                 nsk_jvmti_setFailStatus();
             }
         }
@@ -173,8 +165,7 @@
 
         memset(&caps, 0, sizeof(caps));
         caps.can_tag_objects = 1;
-        if (!NSK_JVMTI_VERIFY(
-                NSK_CPP_STUB2(AddCapabilities, jvmti, &caps))) {
+        if (!NSK_JVMTI_VERIFY(jvmti->AddCapabilities(&caps))) {
             return JNI_ERR;
         }
     }
--- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/IterateOverObjectsReachableFromObject/iterobjreachobj005/iterobjreachobj005.cpp	Fri Oct 05 17:01:07 2018 -0400
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/IterateOverObjectsReachableFromObject/iterobjreachobj005/iterobjreachobj005.cpp	Tue Oct 09 14:37:59 2018 +0200
@@ -52,8 +52,7 @@
 
     objCounter++;
 
-    if (!NSK_JVMTI_VERIFY(
-            NSK_CPP_STUB2(GetCurrentThreadCpuTimerInfo, st_jvmti, &timer_info1 ))) {
+    if (!NSK_JVMTI_VERIFY(st_jvmti->GetCurrentThreadCpuTimerInfo(&timer_info1))) {
         nsk_jvmti_setFailStatus();
     }
     /* Check the returned jvmtiTimerInfo structure */
@@ -71,14 +70,12 @@
     }
     /* ---------------------------------------------------------------------- */
 
-    if (!NSK_JVMTI_VERIFY(
-            NSK_CPP_STUB2(GetCurrentThreadCpuTime, st_jvmti, &nanos ))) {
+    if (!NSK_JVMTI_VERIFY(st_jvmti->GetCurrentThreadCpuTime(&nanos))) {
         nsk_jvmti_setFailStatus();
     }
     /* ---------------------------------------------------------------------- */
 
-    if (!NSK_JVMTI_VERIFY(
-            NSK_CPP_STUB2(GetTimerInfo, st_jvmti, &timer_info2 ))) {
+    if (!NSK_JVMTI_VERIFY(st_jvmti->GetTimerInfo(&timer_info2))) {
         nsk_jvmti_setFailStatus();
     }
     /* Check the returned jvmtiTimerInfo structure */
@@ -97,8 +94,7 @@
     /* ---------------------------------------------------------------------- */
 
     nanos = 0;
-    if (!NSK_JVMTI_VERIFY(
-            NSK_CPP_STUB2(GetTime, st_jvmti, &nanos ))) {
+    if (!NSK_JVMTI_VERIFY(st_jvmti->GetTime(&nanos))) {
         nsk_jvmti_setFailStatus();
     }
 
@@ -131,29 +127,23 @@
             }
 
             NSK_DISPLAY1("Find static field in debugee class: %s\n", objectFieldName);
-            if (!NSK_JNI_VERIFY(jni, (objectField =
-                    NSK_CPP_STUB4(GetStaticFieldID, jni, debugeeClass,
-                                     objectFieldName, debugeeClassSignature)) != NULL)) {
+            if (!NSK_JNI_VERIFY(jni, (objectField = jni->GetStaticFieldID(
+                    debugeeClass, objectFieldName, debugeeClassSignature)) != NULL)) {
                 nsk_jvmti_setFailStatus();
                 break;
             }
 
             NSK_DISPLAY1("Find value of static field in debugee class: %s\n", objectFieldName);
             if (!NSK_JNI_VERIFY(jni, (object =
-                    NSK_CPP_STUB3(GetStaticObjectField, jni, debugeeClass,
-                                     objectField)) != NULL)) {
+                    jni->GetStaticObjectField(debugeeClass, objectField)) != NULL)) {
                 nsk_jvmti_setFailStatus();
                 break;
             }
 
             NSK_DISPLAY0("Calling IterateOverObjectsReachableFromObject with filter JVMTI_HEAP_OBJECT_EITHER\n");
             {
-                if (!NSK_JVMTI_VERIFY(
-                        NSK_CPP_STUB4(IterateOverObjectsReachableFromObject,
-                            jvmti,
-                            object,
-                            objectReferenceCallback,
-                            &user_data))) {
+                if (!NSK_JVMTI_VERIFY(jvmti->IterateOverObjectsReachableFromObject(
+                        object, objectReferenceCallback, &user_data))) {
                     nsk_jvmti_setFailStatus();
                 }
             }
@@ -205,8 +195,7 @@
         caps.can_tag_objects = 1;
         caps.can_get_current_thread_cpu_time = 1;
 
-        if (!NSK_JVMTI_VERIFY(
-                NSK_CPP_STUB2(AddCapabilities, jvmti, &caps))) {
+        if (!NSK_JVMTI_VERIFY(jvmti->AddCapabilities(&caps))) {
             return JNI_ERR;
         }
     }
--- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/IterateOverReachableObjects/iterreachobj001/iterreachobj001.cpp	Fri Oct 05 17:01:07 2018 -0400
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/IterateOverReachableObjects/iterreachobj001/iterreachobj001.cpp	Tue Oct 09 14:37:59 2018 +0200
@@ -87,15 +87,13 @@
     count--;
     tag++;
 
-    if (!NSK_JNI_VERIFY(jni, (obj =
-            NSK_CPP_STUB3(GetObjectField, jni, firstObject, firstField)) != NULL)) {
+    if (!NSK_JNI_VERIFY(jni, (obj = jni->GetObjectField(firstObject, firstField)) != NULL)) {
         nsk_jvmti_setFailStatus();
         return NSK_FALSE;
     }
 
     objectDescList[count].tag = objTag;
-    if (!NSK_JVMTI_VERIFY(
-            NSK_CPP_STUB3(SetTag, jvmti, obj, objTag))) {
+    if (!NSK_JVMTI_VERIFY(jvmti->SetTag(obj, objTag))) {
         nsk_jvmti_setFailStatus();
         return NSK_FALSE;
     }
@@ -107,7 +105,7 @@
         return NSK_FALSE;
     }
 
-    NSK_TRACE(NSK_CPP_STUB2(DeleteLocalRef, jni, obj));
+    NSK_TRACE(jni->DeleteLocalRef(obj));
     return success;
 }
 
@@ -131,9 +129,8 @@
     *objectsCount = 2 * chainLength;
 
     NSK_DISPLAY1("Allocate memory for objects list: %d objects\n", *objectsCount);
-    if (!NSK_JVMTI_VERIFY(
-            NSK_CPP_STUB3(Allocate, jvmti, (*objectsCount * sizeof(ObjectDesc)),
-                                                    (unsigned char**)objectDescList))) {
+    if (!NSK_JVMTI_VERIFY(jvmti->Allocate((*objectsCount * sizeof(ObjectDesc)),
+                                          (unsigned char**)objectDescList))) {
         nsk_jvmti_setFailStatus();
         return NSK_FALSE;
     }
@@ -148,16 +145,14 @@
     }
 
     NSK_DISPLAY1("Find debugee class: %s\n", DEBUGEE_CLASS_NAME);
-    if (!NSK_JNI_VERIFY(jni, (debugeeClass =
-            NSK_CPP_STUB2(FindClass, jni, DEBUGEE_CLASS_NAME)) != NULL)) {
+    if (!NSK_JNI_VERIFY(jni, (debugeeClass = jni->FindClass(DEBUGEE_CLASS_NAME)) != NULL)) {
         nsk_jvmti_setFailStatus();
         return NSK_FALSE;
     }
     NSK_DISPLAY1("  ... found class: 0x%p\n", (void*)debugeeClass);
 
     NSK_DISPLAY1("Find root object class: %s\n", ROOT_OBJECT_CLASS_NAME);
-    if (!NSK_JNI_VERIFY(jni, (rootObjectClass =
-            NSK_CPP_STUB2(FindClass, jni, ROOT_OBJECT_CLASS_NAME)) != NULL)) {
+    if (!NSK_JNI_VERIFY(jni, (rootObjectClass = jni->FindClass(ROOT_OBJECT_CLASS_NAME)) != NULL)) {
         nsk_jvmti_setFailStatus();
         return NSK_FALSE;
     }
@@ -165,34 +160,31 @@
 
     NSK_DISPLAY1("Find chain object class: %s\n", CHAIN_OBJECT_CLASS_NAME);
     if (!NSK_JNI_VERIFY(jni, (chainObjectClass =
-            NSK_CPP_STUB2(FindClass, jni, CHAIN_OBJECT_CLASS_NAME)) != NULL)) {
+            jni->FindClass(CHAIN_OBJECT_CLASS_NAME)) != NULL)) {
         nsk_jvmti_setFailStatus();
         return NSK_FALSE;
     }
     NSK_DISPLAY1("  ... found class: 0x%p\n", (void*)chainObjectClass);
 
     NSK_DISPLAY1("Find static field in debugee class: %s\n", OBJECT_FIELD_NAME);
-    if (!NSK_JNI_VERIFY(jni, (objectField =
-            NSK_CPP_STUB4(GetStaticFieldID, jni, debugeeClass,
-                            OBJECT_FIELD_NAME, ROOT_OBJECT_CLASS_SIG)) != NULL)) {
+    if (!NSK_JNI_VERIFY(jni, (objectField = jni->GetStaticFieldID(
+            debugeeClass, OBJECT_FIELD_NAME, ROOT_OBJECT_CLASS_SIG)) != NULL)) {
         nsk_jvmti_setFailStatus();
         return NSK_FALSE;
     }
     NSK_DISPLAY1("  ... got fieldID: 0x%p\n", (void*)objectField);
 
     NSK_DISPLAY1("Find instance field in root object class: %s\n", REACHABLE_CHAIN_FIELD_NAME);
-    if (!NSK_JNI_VERIFY(jni, (reachableChainField =
-            NSK_CPP_STUB4(GetFieldID, jni, rootObjectClass,
-                        REACHABLE_CHAIN_FIELD_NAME, CHAIN_OBJECT_CLASS_SIG)) != NULL)) {
+    if (!NSK_JNI_VERIFY(jni, (reachableChainField = jni->GetFieldID(
+            rootObjectClass, REACHABLE_CHAIN_FIELD_NAME, CHAIN_OBJECT_CLASS_SIG)) != NULL)) {
         nsk_jvmti_setFailStatus();
         return NSK_FALSE;
     }
     NSK_DISPLAY1("  ... got fieldID: 0x%p\n", (void*)reachableChainField);
 
     NSK_DISPLAY1("Find instance field in root object class: %s\n", UNREACHABLE_CHAIN_FIELD_NAME);
-    if (!NSK_JNI_VERIFY(jni, (unreachableChainField =
-            NSK_CPP_STUB4(GetFieldID, jni, rootObjectClass,
-                        UNREACHABLE_CHAIN_FIELD_NAME, CHAIN_OBJECT_CLASS_SIG)) != NULL)) {
+    if (!NSK_JNI_VERIFY(jni, (unreachableChainField = jni->GetFieldID(
+            rootObjectClass, UNREACHABLE_CHAIN_FIELD_NAME, CHAIN_OBJECT_CLASS_SIG)) != NULL)) {
         nsk_jvmti_setFailStatus();
         return NSK_FALSE;
     }
@@ -200,8 +192,7 @@
 
     NSK_DISPLAY1("Find instance field in chain object class: %s\n", TAIL_FIELD_NAME);
     if (!NSK_JNI_VERIFY(jni, (tailField =
-            NSK_CPP_STUB4(GetFieldID, jni, chainObjectClass,
-                            TAIL_FIELD_NAME, CHAIN_OBJECT_CLASS_SIG)) != NULL)) {
+            jni->GetFieldID(chainObjectClass, TAIL_FIELD_NAME, CHAIN_OBJECT_CLASS_SIG)) != NULL)) {
         nsk_jvmti_setFailStatus();
         return NSK_FALSE;
     }
@@ -209,8 +200,7 @@
 
     NSK_DISPLAY1("Get root object from static field: %s\n", OBJECT_FIELD_NAME);
     if (!NSK_JNI_VERIFY(jni, (rootObject =
-            NSK_CPP_STUB3(GetStaticObjectField, jni, debugeeClass,
-                                                    objectField)) != NULL)) {
+            jni->GetStaticObjectField(debugeeClass, objectField)) != NULL)) {
         nsk_jvmti_setFailStatus();
         return NSK_FALSE;
     }
@@ -288,8 +278,7 @@
                                                         ObjectDesc* objectDescList) {
     if (objectDescList != NULL) {
         NSK_DISPLAY1("Deallocate objects list: 0x%p\n", (void*)objectDescList);
-        if (!NSK_JVMTI_VERIFY(
-            NSK_CPP_STUB2(Deallocate, jvmti, (unsigned char*)objectDescList))) {
+        if (!NSK_JVMTI_VERIFY(jvmti->Deallocate((unsigned char*)objectDescList))) {
             nsk_jvmti_setFailStatus();
         }
     }
@@ -638,9 +627,10 @@
         NSK_DISPLAY0(">>> Start iteration over reachable objects\n");
         {
             if (!NSK_JVMTI_VERIFY(
-                    NSK_CPP_STUB5(IterateOverReachableObjects, jvmti,
-                                  heapRootCallback, stackReferenceCallback,
-                                  objectReferenceCallback, &fakeUserData))) {
+                    jvmti->IterateOverReachableObjects(heapRootCallback,
+                                                       stackReferenceCallback,
+                                                       objectReferenceCallback,
+                                                       &fakeUserData))) {
                 nsk_jvmti_setFailStatus();
                 return;
             }
@@ -722,8 +712,7 @@
 
         memset(&caps, 0, sizeof(caps));
         caps.can_tag_objects = 1;
-        if (!NSK_JVMTI_VERIFY(
-                NSK_CPP_STUB2(AddCapabilities, jvmti, &caps))) {
+        if (!NSK_JVMTI_VERIFY(jvmti->AddCapabilities(&caps))) {
             return JNI_ERR;
         }
     }
--- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/IterateOverReachableObjects/iterreachobj002/iterreachobj002.cpp	Fri Oct 05 17:01:07 2018 -0400
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/IterateOverReachableObjects/iterreachobj002/iterreachobj002.cpp	Tue Oct 09 14:37:59 2018 +0200
@@ -75,9 +75,7 @@
     /* Set tag */
     *tag_ptr = (jlong)++objectCount;
 
-    if (!NSK_JVMTI_VERIFY(
-            NSK_CPP_STUB3(Allocate, jvmti, (sizeof(ObjectDesc)),
-                             (unsigned char**)&objectDescBuf))) {
+    if (!NSK_JVMTI_VERIFY(jvmti->Allocate((sizeof(ObjectDesc)), (unsigned char**)&objectDescBuf))) {
         nsk_jvmti_setFailStatus();
         callbackAborted = 1;
         NSK_COMPLAIN0("heapRootCallbackForFirstObjectsIteration: Allocation failed. Iteration aborted.\n");
@@ -121,8 +119,7 @@
                      (long)*tag_ptr, (long)tag, objectCount);
 */
     /* Deallocate memory of list element*/
-    if (!NSK_JVMTI_VERIFY(
-            NSK_CPP_STUB2(Deallocate, jvmti, (unsigned char*)objectDescArr[ind]))) {
+    if (!NSK_JVMTI_VERIFY(jvmti->Deallocate((unsigned char*)objectDescArr[ind]))) {
         nsk_jvmti_setFailStatus();
         callbackAborted = 1;
         NSK_COMPLAIN0("heapRootCallbackForSecondObjectsIteration: Deallocation failed. Iteration aborted.\n");
@@ -156,9 +153,7 @@
     /* Set tag */
     *tag_ptr = (jlong)++objectCount;
 
-    if (!NSK_JVMTI_VERIFY(
-            NSK_CPP_STUB3(Allocate, jvmti, (sizeof(ObjectDesc)),
-                             (unsigned char**)&objectDescBuf))) {
+    if (!NSK_JVMTI_VERIFY(jvmti->Allocate((sizeof(ObjectDesc)), (unsigned char**)&objectDescBuf))) {
         nsk_jvmti_setFailStatus();
         callbackAborted = 1;
         NSK_COMPLAIN0("stackReferenceCallbackForFirstObjectsIteration: Allocation failed. Iteration aborted.\n");
@@ -206,8 +201,7 @@
                      (long)*tag_ptr, (long)tag, objectCount);
 */
     /* Deallocate memory of list element*/
-    if (!NSK_JVMTI_VERIFY(
-            NSK_CPP_STUB2(Deallocate, jvmti, (unsigned char*)objectDescArr[ind]))) {
+    if (!NSK_JVMTI_VERIFY(jvmti->Deallocate((unsigned char*)objectDescArr[ind]))) {
         nsk_jvmti_setFailStatus();
         callbackAborted = 1;
         NSK_COMPLAIN0("stackReferenceCallbackForSecondObjectsIteration: Deallocation failed. Iteration aborted.\n");
@@ -239,9 +233,7 @@
     /* Set tag */
     *tag_ptr = (jlong)++objectCount;
 
-    if (!NSK_JVMTI_VERIFY(
-            NSK_CPP_STUB3(Allocate, jvmti, (sizeof(ObjectDesc)),
-                             (unsigned char**)&objectDescBuf))) {
+    if (!NSK_JVMTI_VERIFY(jvmti->Allocate((sizeof(ObjectDesc)), (unsigned char**)&objectDescBuf))) {
         nsk_jvmti_setFailStatus();
         callbackAborted = 1;
         NSK_COMPLAIN0("objectReferenceCallbackForFirstObjectsIteration: Allocation failed. Iteration aborted.\n");
@@ -287,8 +279,7 @@
                      (long)*tag_ptr, (long)tag, objectCount);
 */
     /* Deallocate memory of list element*/
-    if (!NSK_JVMTI_VERIFY(
-            NSK_CPP_STUB2(Deallocate, jvmti, (unsigned char*)objectDescArr[ind]))) {
+    if (!NSK_JVMTI_VERIFY(jvmti->Deallocate((unsigned char*)objectDescArr[ind]))) {
         nsk_jvmti_setFailStatus();
         callbackAborted = 1;
         NSK_COMPLAIN0("objectReferenceCallbackForSecondObjectsIteration: Deallocation failed. Iteration aborted.\n");
@@ -320,9 +311,8 @@
     {
         do {
             /* Allocate memory for first element of objectList */
-            if (!NSK_JVMTI_VERIFY(
-                    NSK_CPP_STUB3(Allocate, jvmti, (sizeof(ObjectDesc)),
-                                      (unsigned char**)&objectDescBuf))) {
+            if (!NSK_JVMTI_VERIFY(jvmti->Allocate((sizeof(ObjectDesc)),
+                                                  (unsigned char**)&objectDescBuf))) {
                 nsk_jvmti_setFailStatus();
                 break;
             }
@@ -331,13 +321,11 @@
 
             NSK_DISPLAY0("Calling IterateOverReachableObjects with allocating object descriptors\n");
             {
-                if (!NSK_JVMTI_VERIFY(
-                        NSK_CPP_STUB5(IterateOverReachableObjects,
-                                      jvmti,
-                                      heapRootCallbackForFirstObjectsIteration,
-                                      stackReferenceCallbackForFirstObjectsIteration,
-                                      objectReferenceCallbackForFirstObjectsIteration,
-                                      &userData))) {
+                if (!NSK_JVMTI_VERIFY(jvmti->IterateOverReachableObjects(
+                        heapRootCallbackForFirstObjectsIteration,
+                        stackReferenceCallbackForFirstObjectsIteration,
+                        objectReferenceCallbackForFirstObjectsIteration,
+                        &userData))) {
                     nsk_jvmti_setFailStatus();
                     break;
                 }
@@ -357,25 +345,22 @@
             objectCountMax = objectCount;
 
             /* Deallocate last unnecessary descriptor */
-            if (!NSK_JVMTI_VERIFY(
-                   NSK_CPP_STUB2(Deallocate, jvmti, (unsigned char*)objectDescList))) {
+            if (!NSK_JVMTI_VERIFY(jvmti->Deallocate((unsigned char*)objectDescList))) {
                 NSK_COMPLAIN0("Unable to deallocate last unnecessary descriptor. \n");
                 nsk_jvmti_setFailStatus();
                 break;
             }
 
             /* Allocate memory for array to save pointers to ObjectDescList elements */
-            if (!NSK_JVMTI_VERIFY(
-                    NSK_CPP_STUB3(Allocate, jvmti, (objectCount * sizeof(ObjectDesc*)),
-                                      (unsigned char**)&objectDescArr))) {
+            if (!NSK_JVMTI_VERIFY(jvmti->Allocate((objectCount * sizeof(ObjectDesc*)),
+                                                  (unsigned char**)&objectDescArr))) {
                 nsk_jvmti_setFailStatus();
                 break;
             }
 
             /* Allocate memory for flags array and fill with false values */
-            if (!NSK_JVMTI_VERIFY(
-                    NSK_CPP_STUB3(Allocate, jvmti, (objectCountMax * sizeof(short)),
-                                      (unsigned char**)&deallocatedFlagsArr))) {
+            if (!NSK_JVMTI_VERIFY(jvmti->Allocate((objectCountMax * sizeof(short)),
+                                                  (unsigned char**)&deallocatedFlagsArr))) {
                 nsk_jvmti_setFailStatus();
                 break;
             }
@@ -395,13 +380,11 @@
 
             NSK_DISPLAY0("Calling IterateOverReachableObjects with deallocating object descriptors\n");
             {
-                if (!NSK_JVMTI_VERIFY(
-                        NSK_CPP_STUB5(IterateOverReachableObjects,
-                                      jvmti,
-                                      heapRootCallbackForSecondObjectsIteration,
-                                      stackReferenceCallbackForSecondObjectsIteration,
-                                      objectReferenceCallbackForSecondObjectsIteration,
-                                      &userData))) {
+                if (!NSK_JVMTI_VERIFY(jvmti->IterateOverReachableObjects(
+                    heapRootCallbackForSecondObjectsIteration,
+                    stackReferenceCallbackForSecondObjectsIteration,
+                    objectReferenceCallbackForSecondObjectsIteration,
+                    &userData))) {
                     nsk_jvmti_setFailStatus();
                     break;
                 }
@@ -415,8 +398,7 @@
 
             for (ind = 0; ind < objectCountMax; ind++) {
                 if (!deallocatedFlagsArr[ind]) {
-                    if (!NSK_JVMTI_VERIFY(
-                           NSK_CPP_STUB2(Deallocate, jvmti, (unsigned char*)objectDescArr[ind]))) {
+                    if (!NSK_JVMTI_VERIFY(jvmti->Deallocate((unsigned char*)objectDescArr[ind]))) {
                         NSK_COMPLAIN1("Unable to deallocate descriptor. Index = %d \n", ind);
                         nsk_jvmti_setFailStatus();
                         return;
@@ -424,13 +406,11 @@
                 }
             }
 
-            if (!NSK_JVMTI_VERIFY(
-                    NSK_CPP_STUB2(Deallocate, jvmti, (unsigned char*)objectDescArr))) {
+            if (!NSK_JVMTI_VERIFY(jvmti->Deallocate((unsigned char*)objectDescArr))) {
                 nsk_jvmti_setFailStatus();
             }
 
-            if (!NSK_JVMTI_VERIFY(
-                    NSK_CPP_STUB2(Deallocate, jvmti, (unsigned char*)deallocatedFlagsArr))) {
+            if (!NSK_JVMTI_VERIFY(jvmti->Deallocate((unsigned char*)deallocatedFlagsArr))) {
                 nsk_jvmti_setFailStatus();
             }
 
@@ -472,13 +452,11 @@
     memset(&caps, 0, sizeof(caps));
     caps.can_tag_objects = 1;
     caps.can_generate_object_free_events = 1;
-    if (!NSK_JVMTI_VERIFY(
-            NSK_CPP_STUB2(AddCapabilities, jvmti, &caps))) {
+    if (!NSK_JVMTI_VERIFY(jvmti->AddCapabilities(&caps))) {
         return JNI_ERR;
     }
 
-    if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB2(GetCapabilities,
-            jvmti, &caps)))
+    if (!NSK_JVMTI_VERIFY(jvmti->GetCapabilities(&caps)))
         return JNI_ERR;
 
     if (!caps.can_tag_objects)
@@ -491,15 +469,15 @@
     (void) memset(&callbacks, 0, sizeof(callbacks));
 
     callbacks.ObjectFree = &ObjectFree;
-    if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB3(SetEventCallbacks,
-            jvmti, &callbacks, sizeof(callbacks))))
+    if (!NSK_JVMTI_VERIFY(jvmti->SetEventCallbacks(&callbacks, sizeof(callbacks))))
         return JNI_ERR;
 
     NSK_DISPLAY0("setting event callbacks done.\n");
 
     NSK_DISPLAY0("enabling JVMTI events ...\n");
-    if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB4(SetEventNotificationMode,
-            jvmti, JVMTI_ENABLE, JVMTI_EVENT_OBJECT_FREE, NULL)))
+    if (!NSK_JVMTI_VERIFY(jvmti->SetEventNotificationMode(JVMTI_ENABLE,
+                                                          JVMTI_EVENT_OBJECT_FREE,
+                                                          NULL)))
         return JNI_ERR;
     NSK_DISPLAY0("enabling the events done.\n");
 
--- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/IterateOverReachableObjects/iterreachobj003/iterreachobj003.cpp	Fri Oct 05 17:01:07 2018 -0400
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/IterateOverReachableObjects/iterreachobj003/iterreachobj003.cpp	Tue Oct 09 14:37:59 2018 +0200
@@ -54,55 +54,46 @@
 
     *tag_ptr = (jlong)++objCounter;
 
-    if (!NSK_JVMTI_VERIFY(
-            NSK_CPP_STUB3(CreateRawMonitor, st_jvmti, "heapRootMonitor", &monitor_ptr))) {
+    if (!NSK_JVMTI_VERIFY(st_jvmti->CreateRawMonitor("heapRootMonitor", &monitor_ptr))) {
         nsk_jvmti_setFailStatus();
         return JVMTI_ITERATION_ABORT;
     }
 
-    if (!NSK_JVMTI_VERIFY(
-            NSK_CPP_STUB2(RawMonitorEnter, st_jvmti, monitor_ptr))) {
+    if (!NSK_JVMTI_VERIFY(st_jvmti->RawMonitorEnter(monitor_ptr))) {
         nsk_jvmti_setFailStatus();
         return JVMTI_ITERATION_ABORT;
     }
 
     /* Enter second time */
-    if (!NSK_JVMTI_VERIFY(
-            NSK_CPP_STUB2(RawMonitorEnter, st_jvmti, monitor_ptr))) {
+    if (!NSK_JVMTI_VERIFY(st_jvmti->RawMonitorEnter(monitor_ptr))) {
         nsk_jvmti_setFailStatus();
         return JVMTI_ITERATION_ABORT;
     }
 
-    if (!NSK_JVMTI_VERIFY(
-            NSK_CPP_STUB3(RawMonitorWait, st_jvmti, monitor_ptr, (jlong)1))) {
+    if (!NSK_JVMTI_VERIFY(st_jvmti->RawMonitorWait(monitor_ptr, (jlong)1))) {
         nsk_jvmti_setFailStatus();
     }
 
-    if (!NSK_JVMTI_VERIFY(
-            NSK_CPP_STUB2(RawMonitorNotify, st_jvmti, monitor_ptr))) {
+    if (!NSK_JVMTI_VERIFY(st_jvmti->RawMonitorNotify(monitor_ptr))) {
         nsk_jvmti_setFailStatus();
     }
 
-    if (!NSK_JVMTI_VERIFY(
-            NSK_CPP_STUB2(RawMonitorNotifyAll, st_jvmti, monitor_ptr))) {
+    if (!NSK_JVMTI_VERIFY(st_jvmti->RawMonitorNotifyAll(monitor_ptr))) {
         nsk_jvmti_setFailStatus();
     }
 
-    if (!NSK_JVMTI_VERIFY(
-            NSK_CPP_STUB2(RawMonitorExit, st_jvmti, monitor_ptr))) {
+    if (!NSK_JVMTI_VERIFY(st_jvmti->RawMonitorExit(monitor_ptr))) {
         nsk_jvmti_setFailStatus();
         return JVMTI_ITERATION_ABORT;
     }
 
     /* Exit second time */
-    if (!NSK_JVMTI_VERIFY(
-            NSK_CPP_STUB2(RawMonitorExit, st_jvmti, monitor_ptr))) {
+    if (!NSK_JVMTI_VERIFY(st_jvmti->RawMonitorExit(monitor_ptr))) {
         nsk_jvmti_setFailStatus();
         return JVMTI_ITERATION_ABORT;
     }
 
-    if (!NSK_JVMTI_VERIFY(
-            NSK_CPP_STUB2(DestroyRawMonitor, st_jvmti, monitor_ptr))) {
+    if (!NSK_JVMTI_VERIFY(st_jvmti->DestroyRawMonitor(monitor_ptr))) {
         nsk_jvmti_setFailStatus();
     }
 /*
@@ -127,55 +118,46 @@
 
     *tag_ptr = (jlong)++objCounter;
 
-    if (!NSK_JVMTI_VERIFY(
-            NSK_CPP_STUB3(CreateRawMonitor, st_jvmti, "stackRefMonitor", &monitor_ptr))) {
+    if (!NSK_JVMTI_VERIFY(st_jvmti->CreateRawMonitor("stackRefMonitor", &monitor_ptr))) {
         nsk_jvmti_setFailStatus();
         return JVMTI_ITERATION_ABORT;
     }
 
-    if (!NSK_JVMTI_VERIFY(
-            NSK_CPP_STUB2(RawMonitorEnter, st_jvmti, monitor_ptr))) {
+    if (!NSK_JVMTI_VERIFY(st_jvmti->RawMonitorEnter(monitor_ptr))) {
         nsk_jvmti_setFailStatus();
         return JVMTI_ITERATION_ABORT;
     }
 
     /* Enter second time */
-    if (!NSK_JVMTI_VERIFY(
-            NSK_CPP_STUB2(RawMonitorEnter, st_jvmti, monitor_ptr))) {
+    if (!NSK_JVMTI_VERIFY(st_jvmti->RawMonitorEnter(monitor_ptr))) {
         nsk_jvmti_setFailStatus();
         return JVMTI_ITERATION_ABORT;
     }
 
-    if (!NSK_JVMTI_VERIFY(
-            NSK_CPP_STUB3(RawMonitorWait, st_jvmti, monitor_ptr, (jlong)1))) {
+    if (!NSK_JVMTI_VERIFY(st_jvmti->RawMonitorWait(monitor_ptr, (jlong)1))) {
         nsk_jvmti_setFailStatus();
     }
 
-    if (!NSK_JVMTI_VERIFY(
-            NSK_CPP_STUB2(RawMonitorNotify, st_jvmti, monitor_ptr))) {
+    if (!NSK_JVMTI_VERIFY(st_jvmti->RawMonitorNotify(monitor_ptr))) {
         nsk_jvmti_setFailStatus();
     }
 
-    if (!NSK_JVMTI_VERIFY(
-            NSK_CPP_STUB2(RawMonitorNotifyAll, st_jvmti, monitor_ptr))) {
+    if (!NSK_JVMTI_VERIFY(st_jvmti->RawMonitorNotifyAll(monitor_ptr))) {
         nsk_jvmti_setFailStatus();
     }
 
-    if (!NSK_JVMTI_VERIFY(
-            NSK_CPP_STUB2(RawMonitorExit, st_jvmti, monitor_ptr))) {
+    if (!NSK_JVMTI_VERIFY(st_jvmti->RawMonitorExit(monitor_ptr))) {
         nsk_jvmti_setFailStatus();
         return JVMTI_ITERATION_ABORT;
     }
 
     /* Exit second time */
-    if (!NSK_JVMTI_VERIFY(
-            NSK_CPP_STUB2(RawMonitorExit, st_jvmti, monitor_ptr))) {
+    if (!NSK_JVMTI_VERIFY(st_jvmti->RawMonitorExit(monitor_ptr))) {
         nsk_jvmti_setFailStatus();
         return JVMTI_ITERATION_ABORT;
     }
 
-    if (!NSK_JVMTI_VERIFY(
-            NSK_CPP_STUB2(DestroyRawMonitor, st_jvmti, monitor_ptr))) {
+    if (!NSK_JVMTI_VERIFY(st_jvmti->DestroyRawMonitor(monitor_ptr))) {
         nsk_jvmti_setFailStatus();
     }
 /*
@@ -199,55 +181,46 @@
 
     *tag_ptr = (jlong)++objCounter;
 
-    if (!NSK_JVMTI_VERIFY(
-            NSK_CPP_STUB3(CreateRawMonitor, st_jvmti, "objRefMonitor", &monitor_ptr))) {
+    if (!NSK_JVMTI_VERIFY(st_jvmti->CreateRawMonitor("objRefMonitor", &monitor_ptr))) {
         nsk_jvmti_setFailStatus();
         return JVMTI_ITERATION_ABORT;
     }
 
-    if (!NSK_JVMTI_VERIFY(
-            NSK_CPP_STUB2(RawMonitorEnter, st_jvmti, monitor_ptr))) {
+    if (!NSK_JVMTI_VERIFY(st_jvmti->RawMonitorEnter(monitor_ptr))) {
         nsk_jvmti_setFailStatus();
         return JVMTI_ITERATION_ABORT;
     }
 
     /* Enter second time */
-    if (!NSK_JVMTI_VERIFY(
-            NSK_CPP_STUB2(RawMonitorEnter, st_jvmti, monitor_ptr))) {
+    if (!NSK_JVMTI_VERIFY(st_jvmti->RawMonitorEnter(monitor_ptr))) {
         nsk_jvmti_setFailStatus();
         return JVMTI_ITERATION_ABORT;
     }
 
-    if (!NSK_JVMTI_VERIFY(
-            NSK_CPP_STUB3(RawMonitorWait, st_jvmti, monitor_ptr, (jlong)1))) {
+    if (!NSK_JVMTI_VERIFY(st_jvmti->RawMonitorWait(monitor_ptr, (jlong)1))) {
         nsk_jvmti_setFailStatus();
     }
 
-    if (!NSK_JVMTI_VERIFY(
-            NSK_CPP_STUB2(RawMonitorNotify, st_jvmti, monitor_ptr))) {
+    if (!NSK_JVMTI_VERIFY(st_jvmti->RawMonitorNotify(monitor_ptr))) {
         nsk_jvmti_setFailStatus();
     }
 
-    if (!NSK_JVMTI_VERIFY(
-            NSK_CPP_STUB2(RawMonitorNotifyAll, st_jvmti, monitor_ptr))) {
+    if (!NSK_JVMTI_VERIFY(st_jvmti->RawMonitorNotifyAll(monitor_ptr))) {
         nsk_jvmti_setFailStatus();
     }
 
-    if (!NSK_JVMTI_VERIFY(
-            NSK_CPP_STUB2(RawMonitorExit, st_jvmti, monitor_ptr))) {
+    if (!NSK_JVMTI_VERIFY(st_jvmti->RawMonitorExit(monitor_ptr))) {
         nsk_jvmti_setFailStatus();
         return JVMTI_ITERATION_ABORT;
     }
 
     /* Exit second time */
-    if (!NSK_JVMTI_VERIFY(
-            NSK_CPP_STUB2(RawMonitorExit, st_jvmti, monitor_ptr))) {
+    if (!NSK_JVMTI_VERIFY(st_jvmti->RawMonitorExit(monitor_ptr))) {
         nsk_jvmti_setFailStatus();
         return JVMTI_ITERATION_ABORT;
     }
 
-    if (!NSK_JVMTI_VERIFY(
-            NSK_CPP_STUB2(DestroyRawMonitor, st_jvmti, monitor_ptr))) {
+    if (!NSK_JVMTI_VERIFY(st_jvmti->DestroyRawMonitor(monitor_ptr))) {
         nsk_jvmti_setFailStatus();
     }
 
@@ -270,12 +243,10 @@
             NSK_DISPLAY0("Calling IterateOverReachableObjects\n");
             {
                 if (!NSK_JVMTI_VERIFY(
-                        NSK_CPP_STUB5(IterateOverReachableObjects,
-                                      jvmti,
-                                      heapRootCallback,
-                                      stackReferenceCallback,
-                                      objectReferenceCallback,
-                                      &userData))) {
+                        jvmti->IterateOverReachableObjects(heapRootCallback,
+                                                           stackReferenceCallback,
+                                                           objectReferenceCallback,
+                                                           &userData))) {
                     nsk_jvmti_setFailStatus();
                     break;
                 }
@@ -333,8 +304,7 @@
 
         memset(&caps, 0, sizeof(caps));
         caps.can_tag_objects = 1;
-        if (!NSK_JVMTI_VERIFY(
-                NSK_CPP_STUB2(AddCapabilities, jvmti, &caps))) {
+        if (!NSK_JVMTI_VERIFY(jvmti->AddCapabilities(&caps))) {
             return JNI_ERR;
         }
     }
--- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/IterateOverReachableObjects/iterreachobj004/iterreachobj004.cpp	Fri Oct 05 17:01:07 2018 -0400
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/IterateOverReachableObjects/iterreachobj004/iterreachobj004.cpp	Tue Oct 09 14:37:59 2018 +0200
@@ -54,14 +54,12 @@
 
     *tag_ptr = (jlong)++objCounter;
 
-    if (!NSK_JVMTI_VERIFY(
-            NSK_CPP_STUB2(SetEnvironmentLocalStorage, st_jvmti, storage_data ))) {
+    if (!NSK_JVMTI_VERIFY(st_jvmti->SetEnvironmentLocalStorage(storage_data))) {
         nsk_jvmti_setFailStatus();
         return JVMTI_ITERATION_ABORT;
     }
 
-    if (!NSK_JVMTI_VERIFY(
-            NSK_CPP_STUB2(GetEnvironmentLocalStorage, st_jvmti, &storage_ptr))) {
+    if (!NSK_JVMTI_VERIFY(st_jvmti->GetEnvironmentLocalStorage(&storage_ptr))) {
         nsk_jvmti_setFailStatus();
         return JVMTI_ITERATION_ABORT;
     }
@@ -100,14 +98,12 @@
 
     *tag_ptr = (jlong)++objCounter;
 
-    if (!NSK_JVMTI_VERIFY(
-            NSK_CPP_STUB2(SetEnvironmentLocalStorage, st_jvmti, storage_data ))) {
+    if (!NSK_JVMTI_VERIFY(st_jvmti->SetEnvironmentLocalStorage(storage_data))) {
         nsk_jvmti_setFailStatus();
         return JVMTI_ITERATION_ABORT;
     }
 
-    if (!NSK_JVMTI_VERIFY(
-            NSK_CPP_STUB2(GetEnvironmentLocalStorage, st_jvmti, &storage_ptr))) {
+    if (!NSK_JVMTI_VERIFY(st_jvmti->GetEnvironmentLocalStorage(&storage_ptr))) {
         nsk_jvmti_setFailStatus();
         return JVMTI_ITERATION_ABORT;
     }
@@ -145,14 +141,12 @@
 
     *tag_ptr = (jlong)++objCounter;
 
-    if (!NSK_JVMTI_VERIFY(
-            NSK_CPP_STUB2(SetEnvironmentLocalStorage, st_jvmti, storage_data ))) {
+    if (!NSK_JVMTI_VERIFY(st_jvmti->SetEnvironmentLocalStorage(storage_data))) {
         nsk_jvmti_setFailStatus();
         return JVMTI_ITERATION_ABORT;
     }
 
-    if (!NSK_JVMTI_VERIFY(
-            NSK_CPP_STUB2(GetEnvironmentLocalStorage, st_jvmti, &storage_ptr))) {
+    if (!NSK_JVMTI_VERIFY(st_jvmti->GetEnvironmentLocalStorage(&storage_ptr))) {
         nsk_jvmti_setFailStatus();
         return JVMTI_ITERATION_ABORT;
     }
@@ -190,12 +184,10 @@
             NSK_DISPLAY0("Calling IterateOverReachableObjects\n");
             {
                 if (!NSK_JVMTI_VERIFY(
-                        NSK_CPP_STUB5(IterateOverReachableObjects,
-                                      jvmti,
-                                      heapRootCallback,
-                                      stackReferenceCallback,
-                                      objectReferenceCallback,
-                                      &userData))) {
+                        jvmti->IterateOverReachableObjects(heapRootCallback,
+                                                           stackReferenceCallback,
+                                                           objectReferenceCallback,
+                                                           &userData))) {
                     nsk_jvmti_setFailStatus();
                     break;
                 }
@@ -253,8 +245,7 @@
 
         memset(&caps, 0, sizeof(caps));
         caps.can_tag_objects = 1;
-        if (!NSK_JVMTI_VERIFY(
-                NSK_CPP_STUB2(AddCapabilities, jvmti, &caps))) {
+        if (!NSK_JVMTI_VERIFY(jvmti->AddCapabilities(&caps))) {
             return JNI_ERR;
         }
     }
--- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/IterateOverReachableObjects/iterreachobj005/iterreachobj005.cpp	Fri Oct 05 17:01:07 2018 -0400
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/IterateOverReachableObjects/iterreachobj005/iterreachobj005.cpp	Tue Oct 09 14:37:59 2018 +0200
@@ -53,8 +53,7 @@
 
     if (!nsk_jvmti_isFailStatus()) {
 
-        if (!NSK_JVMTI_VERIFY(
-                NSK_CPP_STUB2(GetCurrentThreadCpuTimerInfo, st_jvmti, &timer_info1 ))) {
+        if (!NSK_JVMTI_VERIFY(st_jvmti->GetCurrentThreadCpuTimerInfo(&timer_info1))) {
             nsk_jvmti_setFailStatus();
         }
         /* Check the returned jvmtiTimerInfo structure */
@@ -72,14 +71,12 @@
         }
         /* ---------------------------------------------------------------------- */
 
-        if (!NSK_JVMTI_VERIFY(
-                NSK_CPP_STUB2(GetCurrentThreadCpuTime, st_jvmti, &nanos ))) {
+        if (!NSK_JVMTI_VERIFY(st_jvmti->GetCurrentThreadCpuTime(&nanos))) {
             nsk_jvmti_setFailStatus();
         }
         /* ---------------------------------------------------------------------- */
 
-        if (!NSK_JVMTI_VERIFY(
-                NSK_CPP_STUB2(GetTimerInfo, st_jvmti, &timer_info2 ))) {
+        if (!NSK_JVMTI_VERIFY(st_jvmti->GetTimerInfo(&timer_info2))) {
             nsk_jvmti_setFailStatus();
         }
         /* Check the returned jvmtiTimerInfo structure */
@@ -98,8 +95,7 @@
         /* ---------------------------------------------------------------------- */
 
         nanos = 0;
-        if (!NSK_JVMTI_VERIFY(
-                NSK_CPP_STUB2(GetTime, st_jvmti, &nanos ))) {
+        if (!NSK_JVMTI_VERIFY(st_jvmti->GetTime(&nanos))) {
             nsk_jvmti_setFailStatus();
         }
     }
@@ -126,8 +122,7 @@
 
     if (!nsk_jvmti_isFailStatus()) {
 
-        if (!NSK_JVMTI_VERIFY(
-                NSK_CPP_STUB2(GetCurrentThreadCpuTimerInfo, st_jvmti, &timer_info1 ))) {
+        if (!NSK_JVMTI_VERIFY(st_jvmti->GetCurrentThreadCpuTimerInfo(&timer_info1))) {
             nsk_jvmti_setFailStatus();
         }
         /* Check the returned jvmtiTimerInfo structure */
@@ -145,14 +140,12 @@
         }
         /* ---------------------------------------------------------------------- */
 
-        if (!NSK_JVMTI_VERIFY(
-                NSK_CPP_STUB2(GetCurrentThreadCpuTime, st_jvmti, &nanos ))) {
+        if (!NSK_JVMTI_VERIFY(st_jvmti->GetCurrentThreadCpuTime(&nanos))) {
             nsk_jvmti_setFailStatus();
         }
         /* ---------------------------------------------------------------------- */
 
-        if (!NSK_JVMTI_VERIFY(
-                NSK_CPP_STUB2(GetTimerInfo, st_jvmti, &timer_info2 ))) {
+        if (!NSK_JVMTI_VERIFY(st_jvmti->GetTimerInfo(&timer_info2))) {
             nsk_jvmti_setFailStatus();
         }
         /* Check the returned jvmtiTimerInfo structure */
@@ -171,8 +164,7 @@
         /* ---------------------------------------------------------------------- */
 
         nanos = 0;
-        if (!NSK_JVMTI_VERIFY(
-                NSK_CPP_STUB2(GetTime, st_jvmti, &nanos ))) {
+        if (!NSK_JVMTI_VERIFY(st_jvmti->GetTime(&nanos))) {
             nsk_jvmti_setFailStatus();
         }
    }
@@ -196,8 +188,7 @@
 
     *tag_ptr = (jlong)++objCounter;
 
-    if (!NSK_JVMTI_VERIFY(
-            NSK_CPP_STUB2(GetCurrentThreadCpuTimerInfo, st_jvmti, &timer_info1 ))) {
+    if (!NSK_JVMTI_VERIFY(st_jvmti->GetCurrentThreadCpuTimerInfo(&timer_info1))) {
         nsk_jvmti_setFailStatus();
     }
     /* Check the returned jvmtiTimerInfo structure */
@@ -215,15 +206,13 @@
     }
     /* ---------------------------------------------------------------------- */
 
-    if (!NSK_JVMTI_VERIFY(
-            NSK_CPP_STUB2(GetCurrentThreadCpuTime, st_jvmti, &nanos ))) {
+    if (!NSK_JVMTI_VERIFY(st_jvmti->GetCurrentThreadCpuTime(&nanos))) {
         nsk_jvmti_setFailStatus();
     }
     /* ---------------------------------------------------------------------- */
 
 
-    if (!NSK_JVMTI_VERIFY(
-            NSK_CPP_STUB2(GetTimerInfo, st_jvmti, &timer_info2 ))) {
+    if (!NSK_JVMTI_VERIFY(st_jvmti->GetTimerInfo(&timer_info2))) {
         nsk_jvmti_setFailStatus();
     }
     /* Check the returned jvmtiTimerInfo structure */
@@ -242,8 +231,7 @@
     /* ---------------------------------------------------------------------- */
 
     nanos = 0;
-    if (!NSK_JVMTI_VERIFY(
-            NSK_CPP_STUB2(GetTime, st_jvmti, &nanos ))) {
+    if (!NSK_JVMTI_VERIFY(st_jvmti->GetTime(&nanos))) {
         nsk_jvmti_setFailStatus();
     }
 
@@ -265,13 +253,10 @@
         do {
             NSK_DISPLAY0("Calling IterateOverReachableObjects\n");
             {
-                if (!NSK_JVMTI_VERIFY(
-                        NSK_CPP_STUB5(IterateOverReachableObjects,
-                                      jvmti,
-                                      heapRootCallback,
-                                      stackReferenceCallback,
-                                      objectReferenceCallback,
-                                      &userData))) {
+                if (!NSK_JVMTI_VERIFY(jvmti->IterateOverReachableObjects(heapRootCallback,
+                                                                         stackReferenceCallback,
+                                                                         objectReferenceCallback,
+                                                                         &userData))) {
                     nsk_jvmti_setFailStatus();
                     break;
                 }
@@ -330,8 +315,7 @@
         memset(&caps, 0, sizeof(caps));
         caps.can_tag_objects = 1;
         caps.can_get_current_thread_cpu_time = 1;
-        if (!NSK_JVMTI_VERIFY(
-                NSK_CPP_STUB2(AddCapabilities, jvmti, &caps))) {
+        if (!NSK_JVMTI_VERIFY(jvmti->AddCapabilities(&caps))) {
             return JNI_ERR;
         }
     }
--- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/IterateThroughHeap/abort/Abort.cpp	Fri Oct 05 17:01:07 2018 -0400
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/IterateThroughHeap/abort/Abort.cpp	Tue Oct 09 14:37:59 2018 +0200
@@ -95,8 +95,7 @@
   primitive_callbacks.heap_iteration_callback = &heap_callback;
 
   NSK_DISPLAY0("Iterating over reachable objects.\n");
-  if(!NSK_JVMTI_VERIFY(NSK_CPP_STUB5(IterateThroughHeap, jvmti,
-                                     0, NULL, &primitive_callbacks, &invocations))) {
+  if(!NSK_JVMTI_VERIFY(jvmti->IterateThroughHeap(0, NULL, &primitive_callbacks, &invocations))) {
     nsk_jvmti_setFailStatus();
     return;
   }
@@ -139,14 +138,12 @@
   caps.can_tag_objects = 1;
   caps.can_generate_object_free_events = 1;
 
-  if(!NSK_JVMTI_VERIFY(NSK_CPP_STUB2(AddCapabilities, jvmti, &caps))) {
+  if(!NSK_JVMTI_VERIFY(jvmti->AddCapabilities(&caps))) {
     return JNI_ERR;
   }
 
   memset(&event_callbacks, 0, sizeof(jvmtiEventCallbacks));
-  if(!NSK_JVMTI_VERIFY(
-                       NSK_CPP_STUB3(SetEventCallbacks, jvmti,
-                                     &event_callbacks, sizeof(jvmtiEventCallbacks)))) {
+  if(!NSK_JVMTI_VERIFY(jvmti->SetEventCallbacks(&event_callbacks, sizeof(jvmtiEventCallbacks)))) {
     return JNI_ERR;
   }
 
--- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/IterateThroughHeap/callbacks/Callbacks.cpp	Fri Oct 05 17:01:07 2018 -0400
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/IterateThroughHeap/callbacks/Callbacks.cpp	Tue Oct 09 14:37:59 2018 +0200
@@ -368,21 +368,14 @@
   jobjectArray testObjects;
   int object;
 
-  if(!NSK_VERIFY(NULL !=
-                 (debugee = NSK_CPP_STUB2(FindClass, jni, className))))
+  if(!NSK_VERIFY(NULL != (debugee = jni->FindClass(className))))
     return JNI_ERR;
 
-  if(!NSK_VERIFY(NULL !=
-                 (testObjectsField = NSK_CPP_STUB4(GetStaticFieldID,
-                                                   jni, debugee,
-                                                   fieldName,
-                                                   fieldSig))))
+  if(!NSK_VERIFY(NULL != (testObjectsField = jni->GetStaticFieldID(debugee, fieldName, fieldSig))))
     return JNI_ERR;
 
-  if(!NSK_VERIFY(NULL !=
-                 (testObjects = (jobjectArray)(NSK_CPP_STUB3(GetStaticObjectField,
-                                                             jni, debugee,
-                                                             testObjectsField)))))
+  if(!NSK_VERIFY(NULL != (testObjects = (jobjectArray)(jni->GetStaticObjectField(
+          debugee, testObjectsField)))))
     return JNI_ERR;
 
   // For each of test objects tag every field
@@ -393,33 +386,28 @@
     jint field;
 
     memset(&objects_info[object],0,sizeof(object_info_t));
-    if(!NSK_VERIFY(NULL !=
-                   (target = NSK_CPP_STUB3(GetObjectArrayElement,jni,
-                                           testObjects,object))))
+    if(!NSK_VERIFY(NULL != (target = jni->GetObjectArrayElement(testObjects, object))))
+      return JNI_ERR;
+
+    if(!NSK_VERIFY(NULL != (targetClass = jni->GetObjectClass(target))))
       return JNI_ERR;
 
-    if(!NSK_VERIFY(NULL !=
-                   (targetClass = NSK_CPP_STUB2(GetObjectClass, jni, target))))
+    if(!NSK_JVMTI_VERIFY(jvmti->GetClassSignature(targetClass, &(objects_info[object].name), NULL)))
       return JNI_ERR;
 
-    if(!NSK_JVMTI_VERIFY(NSK_CPP_STUB4(GetClassSignature, jvmti, targetClass,
-                                       &(objects_info[object].name), NULL)))
-      return JNI_ERR;
-
-    if(!NSK_JVMTI_VERIFY(NSK_CPP_STUB4(GetClassFields, jvmti, targetClass,
-                                       &(objects_info[object].fields_count),
-                                       &targetFields)))
+    if(!NSK_JVMTI_VERIFY(jvmti->GetClassFields(
+            targetClass, &(objects_info[object].fields_count), &targetFields)))
       return JNI_ERR;
 
     objects_info[object].fields = (field_info_t*)calloc(objects_info[object].fields_count,sizeof(field_info_t));
 
     // Iterate over fields, collect info about it and tag non primitive fields.
     for(field = 0; field < objects_info[object].fields_count; field++) {
-      if(!NSK_JVMTI_VERIFY(NSK_CPP_STUB6(GetFieldName, jvmti,
-                                         targetClass, targetFields[field],
-                                         &objects_info[object].fields[field].name,
-                                         &objects_info[object].fields[field].signature,
-                                         NULL)))
+      if(!NSK_JVMTI_VERIFY(jvmti->GetFieldName(targetClass,
+                                               targetFields[field],
+                                               &objects_info[object].fields[field].name,
+                                               &objects_info[object].fields[field].signature,
+                                               NULL)))
         return JNI_ERR;
       if(is_primitive_type(objects_info[object].fields[field].signature)) {
         objects_info[object].fields[field].primitive = 1;
@@ -427,49 +415,42 @@
         jint modifiers;
         jobject value;
         int tag_type = get_tag_type(objects_info[object].fields[field].signature);
-        if(!NSK_JVMTI_VERIFY(NSK_CPP_STUB4(GetFieldModifiers, jvmti,
-                                           targetClass, targetFields[field],
-                                           &modifiers))) {
+        if(!NSK_JVMTI_VERIFY(jvmti->GetFieldModifiers(
+                targetClass, targetFields[field], &modifiers))) {
           return JNI_ERR;
         }
         if(modifiers & STATIC_FIELD) {
-          if(!NSK_VERIFY(NULL != (value = NSK_CPP_STUB3(GetStaticObjectField, jni,
-                                                        targetClass,
-                                                        targetFields[field])))) {
+          if(!NSK_VERIFY(NULL != (value = jni->GetStaticObjectField(targetClass,
+                                                                    targetFields[field])))) {
             return JNI_ERR;
           }
         } else {
-          if(!NSK_VERIFY(NULL != (value = NSK_CPP_STUB3(GetObjectField, jni,
-                                                        target,
-                                                        targetFields[field])))) {
+          if(!NSK_VERIFY(NULL != (value = jni->GetObjectField(target, targetFields[field])))) {
             return JNI_ERR;
           }
         }
         //tag field's value
-        if(!NSK_JVMTI_VERIFY(NSK_CPP_STUB3(SetTag, jvmti, value,
-                                           ENCODE_TAG(tag_type,object,field)))) {
+        if(!NSK_JVMTI_VERIFY(jvmti->SetTag(value, ENCODE_TAG(tag_type,object,field)))) {
           return JNI_ERR;
         }
         //remove local reference so object will have a chance to become unreachable
-        NSK_CPP_STUB2(DeleteLocalRef, jni, (jobject)value);
+        jni->DeleteLocalRef((jobject)value);
       }
     }
 
     // tag class and it's instance to pass this tag into primitive field callback
-    if(!NSK_JVMTI_VERIFY(NSK_CPP_STUB3(SetTag, jvmti, target,
-                                       ENCODE_TAG(TAG_TYPE_PRIMITIVE,object,0))))
+    if(!NSK_JVMTI_VERIFY(jvmti->SetTag(target, ENCODE_TAG(TAG_TYPE_PRIMITIVE,object,0))))
       return JNI_ERR;
-    if(!NSK_JVMTI_VERIFY(NSK_CPP_STUB3(SetTag, jvmti, targetClass,
-                                       ENCODE_TAG(TAG_TYPE_PRIMITIVE,object,0))))
+    if(!NSK_JVMTI_VERIFY(jvmti->SetTag(targetClass, ENCODE_TAG(TAG_TYPE_PRIMITIVE,object,0))))
       return JNI_ERR;
 
-    NSK_JVMTI_VERIFY(NSK_CPP_STUB2(Deallocate, jvmti, (unsigned char*)targetFields));
+    NSK_JVMTI_VERIFY(jvmti->Deallocate((unsigned char*)targetFields));
 
-    NSK_CPP_STUB2(DeleteLocalRef, jni, (jobject)target);
-    NSK_CPP_STUB2(DeleteLocalRef, jni, (jobject)targetClass);
+    jni->DeleteLocalRef((jobject)target);
+    jni->DeleteLocalRef((jobject)targetClass);
   }
 
-  NSK_CPP_STUB2(DeleteLocalRef, jni, (jobject)testObjects);
+  jni->DeleteLocalRef((jobject)testObjects);
 
   return JNI_OK;
 }
@@ -480,10 +461,10 @@
   int field;
   for(object = 0; object < TEST_OBJECTS_COUNT; object++) {
     for(field = 0; field < objects_info[object].fields_count; field++) {
-      NSK_CPP_STUB2(Deallocate, jvmti, (unsigned char*)objects_info[object].fields[field].name);
-      NSK_CPP_STUB2(Deallocate, jvmti, (unsigned char*)objects_info[object].fields[field].signature);
+      jvmti->Deallocate((unsigned char*)objects_info[object].fields[field].name);
+      jvmti->Deallocate((unsigned char*)objects_info[object].fields[field].signature);
     }
-    NSK_CPP_STUB2(Deallocate, jvmti, (unsigned char*)objects_info[object].name);
+    jvmti->Deallocate((unsigned char*)objects_info[object].name);
     free(objects_info[object].fields);
   }
 }
@@ -553,8 +534,7 @@
   primitive_callbacks.heap_iteration_callback = &heap_callback;
 
   NSK_DISPLAY0("Iterating over reachable objects.\n");
-  if(!NSK_JVMTI_VERIFY(NSK_CPP_STUB5(IterateThroughHeap, jvmti,
-                                     0, NULL, &primitive_callbacks, NULL))) {
+  if(!NSK_JVMTI_VERIFY(jvmti->IterateThroughHeap(0, NULL, &primitive_callbacks, NULL))) {
     nsk_jvmti_setFailStatus();
     return;
   }
@@ -571,8 +551,7 @@
   }
 
   NSK_DISPLAY0("Iterating over unreachable objects.\n");
-  if(!NSK_JVMTI_VERIFY(NSK_CPP_STUB5(IterateThroughHeap, jvmti,
-                                     0, NULL, &primitive_callbacks, NULL))) {
+  if(!NSK_JVMTI_VERIFY(jvmti->IterateThroughHeap(0, NULL, &primitive_callbacks, NULL))) {
     nsk_jvmti_setFailStatus();
     return;
   }
@@ -618,15 +597,13 @@
   caps.can_tag_objects = 1;
   caps.can_generate_object_free_events = 1;
 
-  if(!NSK_JVMTI_VERIFY(NSK_CPP_STUB2(AddCapabilities, jvmti, &caps))) {
+  if(!NSK_JVMTI_VERIFY(jvmti->AddCapabilities(&caps))) {
     return JNI_ERR;
   }
 
   memset(&event_callbacks, 0, sizeof(jvmtiEventCallbacks));
   event_callbacks.ObjectFree = &object_free_callback;
-  if(!NSK_JVMTI_VERIFY(
-                       NSK_CPP_STUB3(SetEventCallbacks, jvmti,
-                                     &event_callbacks, sizeof(jvmtiEventCallbacks)))) {
+  if(!NSK_JVMTI_VERIFY(jvmti->SetEventCallbacks(&event_callbacks, sizeof(jvmtiEventCallbacks)))) {
     return JNI_ERR;
   }
 
--- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/IterateThroughHeap/concrete-klass-filter/ConcreteKlassFilter.cpp	Fri Oct 05 17:01:07 2018 -0400
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/IterateThroughHeap/concrete-klass-filter/ConcreteKlassFilter.cpp	Tue Oct 09 14:37:59 2018 +0200
@@ -152,36 +152,26 @@
   jobject testObject;
   jclass testObjectClass;
 
-  if(!NSK_VERIFY(NULL !=
-                 (debugee = NSK_CPP_STUB2(FindClass, jni, className))))
+  if(!NSK_VERIFY(NULL != (debugee = jni->FindClass(className))))
     return JNI_ERR;
 
-  if(!NSK_VERIFY(NULL !=
-                 (testObjectField = NSK_CPP_STUB4(GetStaticFieldID,
-                                                   jni, debugee,
-                                                   fieldName,
-                                                   fieldSig))))
+  if(!NSK_VERIFY(NULL != (testObjectField = jni->GetStaticFieldID(debugee, fieldName, fieldSig))))
     return JNI_ERR;
 
-  if(!NSK_VERIFY(NULL !=
-                 (testObject = (NSK_CPP_STUB3(GetStaticObjectField,
-                                               jni, debugee,
-                                               testObjectField)))))
+  if(!NSK_VERIFY(NULL != (testObject = (jni->GetStaticObjectField(debugee, testObjectField)))))
     return JNI_ERR;
 
-  if(!NSK_VERIFY(NULL !=
-                 (testObjectClass = (NSK_CPP_STUB2(GetObjectClass,
-                                                   jni, testObject)))))
+  if(!NSK_VERIFY(NULL != (testObjectClass = (jni->GetObjectClass(testObject)))))
     return JNI_ERR;
 
   // tag class and it's instance to pass this tag into primitive field callback
-  if(!NSK_JVMTI_VERIFY(NSK_CPP_STUB3(SetTag, jvmti, testObject, TEST_OBJECT_TAG)))
+  if(!NSK_JVMTI_VERIFY(jvmti->SetTag(testObject, TEST_OBJECT_TAG)))
     return JNI_ERR;
-  if(!NSK_JVMTI_VERIFY(NSK_CPP_STUB3(SetTag, jvmti, testObjectClass, TEST_OBJECT_TAG)))
+  if(!NSK_JVMTI_VERIFY(jvmti->SetTag(testObjectClass, TEST_OBJECT_TAG)))
     return JNI_ERR;
 
-  NSK_CPP_STUB2(DeleteLocalRef, jni, testObjectClass);
-  NSK_CPP_STUB2(DeleteLocalRef, jni, testObject);
+  jni->DeleteLocalRef(testObjectClass);
+  jni->DeleteLocalRef(testObject);
 
   return JNI_OK;
 }
@@ -207,7 +197,7 @@
   jvmtiHeapCallbacks primitive_callbacks;
   jclass klass;
 
-  if(!NSK_VERIFY(NULL != (klass = NSK_CPP_STUB2(FindClass,jni,testClassName)))) {
+  if(!NSK_VERIFY(NULL != (klass = jni->FindClass(testClassName)))) {
     NSK_COMPLAIN1("Can't find class %s.\n",testClassName);
     nsk_jvmti_setFailStatus();
     return;
@@ -233,8 +223,7 @@
   primitive_callbacks.heap_iteration_callback = &heap_callback;
 
   NSK_DISPLAY0("Iterating over reachable objects.\n");
-  if(!NSK_JVMTI_VERIFY(NSK_CPP_STUB5(IterateThroughHeap, jvmti,
-                                     0, klass, &primitive_callbacks, NULL))) {
+  if(!NSK_JVMTI_VERIFY(jvmti->IterateThroughHeap(0, klass, &primitive_callbacks, NULL))) {
     nsk_jvmti_setFailStatus();
     return;
   }
@@ -251,8 +240,7 @@
   }
 
   NSK_DISPLAY0("Iterating over unreachable objects.\n");
-  if(!NSK_JVMTI_VERIFY(NSK_CPP_STUB5(IterateThroughHeap, jvmti,
-                                     0, klass, &primitive_callbacks, NULL))) {
+  if(!NSK_JVMTI_VERIFY(jvmti->IterateThroughHeap(0, klass, &primitive_callbacks, NULL))) {
     nsk_jvmti_setFailStatus();
     return;
   }
@@ -292,15 +280,13 @@
   caps.can_tag_objects = 1;
   caps.can_generate_object_free_events = 1;
 
-  if(!NSK_JVMTI_VERIFY(NSK_CPP_STUB2(AddCapabilities, jvmti, &caps))) {
+  if(!NSK_JVMTI_VERIFY(jvmti->AddCapabilities(&caps))) {
     return JNI_ERR;
   }
 
   memset(&event_callbacks, 0, sizeof(jvmtiEventCallbacks));
   event_callbacks.ObjectFree = &object_free_callback;
-  if(!NSK_JVMTI_VERIFY(
-                       NSK_CPP_STUB3(SetEventCallbacks, jvmti,
-                                     &event_callbacks, sizeof(jvmtiEventCallbacks)))) {
+  if(!NSK_JVMTI_VERIFY(jvmti->SetEventCallbacks(&event_callbacks, sizeof(jvmtiEventCallbacks)))) {
     return JNI_ERR;
   }
 
--- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/IterateThroughHeap/filter-tagged/HeapFilter.cpp	Fri Oct 05 17:01:07 2018 -0400
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/IterateThroughHeap/filter-tagged/HeapFilter.cpp	Tue Oct 09 14:37:59 2018 +0200
@@ -299,21 +299,14 @@
   jobjectArray testObjects;
   int object;
 
-  if(!NSK_VERIFY(NULL !=
-                 (debugee = NSK_CPP_STUB2(FindClass, jni, className))))
+  if(!NSK_VERIFY(NULL != (debugee = jni->FindClass(className))))
     return JNI_ERR;
 
-  if(!NSK_VERIFY(NULL !=
-                 (testObjectsField = NSK_CPP_STUB4(GetStaticFieldID,
-                                                   jni, debugee,
-                                                   fieldName,
-                                                   fieldSig))))
+  if(!NSK_VERIFY(NULL != (testObjectsField = jni->GetStaticFieldID(debugee, fieldName, fieldSig))))
     return JNI_ERR;
 
-  if(!NSK_VERIFY(NULL !=
-                 (testObjects = (jobjectArray)(NSK_CPP_STUB3(GetStaticObjectField,
-                                                             jni, debugee,
-                                                             testObjectsField)))))
+  if(!NSK_VERIFY(NULL != (testObjects = (jobjectArray)(jni->GetStaticObjectField(
+          debugee, testObjectsField)))))
     return JNI_ERR;
 
   // For each of test objects tag every field
@@ -325,22 +318,17 @@
     int tagged = object == 0;
 
     memset(&objects_info[object],0,sizeof(object_info_t));
-    if(!NSK_VERIFY(NULL !=
-                   (target = NSK_CPP_STUB3(GetObjectArrayElement,jni,
-                                           testObjects,object))))
+    if(!NSK_VERIFY(NULL != (target = jni->GetObjectArrayElement(testObjects, object))))
+      return JNI_ERR;
+
+    if(!NSK_VERIFY(NULL != (targetClass = jni->GetObjectClass(target))))
       return JNI_ERR;
 
-    if(!NSK_VERIFY(NULL !=
-                   (targetClass = NSK_CPP_STUB2(GetObjectClass, jni, target))))
+    if(!NSK_JVMTI_VERIFY(jvmti->GetClassSignature(targetClass, &(objects_info[object].name), NULL)))
       return JNI_ERR;
 
-    if(!NSK_JVMTI_VERIFY(NSK_CPP_STUB4(GetClassSignature, jvmti, targetClass,
-                                       &(objects_info[object].name), NULL)))
-      return JNI_ERR;
-
-    if(!NSK_JVMTI_VERIFY(NSK_CPP_STUB4(GetClassFields, jvmti, targetClass,
-                                       &(objects_info[object].fields_count),
-                                       &targetFields)))
+    if(!NSK_JVMTI_VERIFY(jvmti->GetClassFields(
+            targetClass, &(objects_info[object].fields_count), &targetFields)))
       return JNI_ERR;
 
     objects_info[object].fields = (field_info_t*)calloc(objects_info[object].fields_count,sizeof(field_info_t));
@@ -350,15 +338,14 @@
       jint modifiers;
       int is_static = 0;
       int is_primitive = 0;
-      if(!NSK_JVMTI_VERIFY(NSK_CPP_STUB6(GetFieldName, jvmti,
-                                         targetClass, targetFields[field],
-                                         &objects_info[object].fields[field].name,
-                                         &objects_info[object].fields[field].signature,
-                                         NULL)))
+      if(!NSK_JVMTI_VERIFY(jvmti->GetFieldName(targetClass,
+                                               targetFields[field],
+                                               &objects_info[object].fields[field].name,
+                                               &objects_info[object].fields[field].signature,
+                                               NULL)))
         return JNI_ERR;
-      if(!NSK_JVMTI_VERIFY(NSK_CPP_STUB4(GetFieldModifiers, jvmti,
-                                         targetClass, targetFields[field],
-                                         &modifiers))) {
+      if(!NSK_JVMTI_VERIFY(jvmti->GetFieldModifiers(
+              targetClass, targetFields[field], &modifiers))) {
         return JNI_ERR;
       }
       is_static = (modifiers & STATIC_FIELD) == STATIC_FIELD;
@@ -367,31 +354,26 @@
         is_primitive = 1;
       } else {
         jobject value;
-        if(!NSK_JVMTI_VERIFY(NSK_CPP_STUB4(GetFieldModifiers, jvmti,
-                                           targetClass, targetFields[field],
-                                           &modifiers))) {
+        if(!NSK_JVMTI_VERIFY(jvmti->GetFieldModifiers(
+                targetClass, targetFields[field], &modifiers))) {
           return JNI_ERR;
         }
         if(is_static) {
-          if(!NSK_VERIFY(NULL != (value = NSK_CPP_STUB3(GetStaticObjectField, jni,
-                                                        targetClass,
-                                                        targetFields[field])))) {
+          if(!NSK_VERIFY(NULL != (value = jni->GetStaticObjectField(
+                  targetClass, targetFields[field])))) {
             return JNI_ERR;
           }
         } else {
-          if(!NSK_VERIFY(NULL != (value = NSK_CPP_STUB3(GetObjectField, jni,
-                                                        target,
-                                                        targetFields[field])))) {
+          if(!NSK_VERIFY(NULL != (value = jni->GetObjectField(target, targetFields[field])))) {
             return JNI_ERR;
           }
         }
         if(tagged) {
-          if(!NSK_JVMTI_VERIFY(NSK_CPP_STUB3(SetTag, jvmti, value,
-                                             ENCODE_TAG(FIELD_TAG,object,field)))) {
+          if(!NSK_JVMTI_VERIFY(jvmti->SetTag(value, ENCODE_TAG(FIELD_TAG,object,field)))) {
             return JNI_ERR;
           }
         }
-        NSK_CPP_STUB2(DeleteLocalRef, jni, value);
+        jni->DeleteLocalRef(value);
       }
 
       objects_info[object].fields[field].expected =
@@ -403,20 +385,18 @@
 
     // tag class and it's instance to pass this tag into primitive field callback
     if(tagged) {
-      if(!NSK_JVMTI_VERIFY(NSK_CPP_STUB3(SetTag, jvmti, target,
-                                         ENCODE_TAG(OBJECT_TAG,object,0))))
+      if(!NSK_JVMTI_VERIFY(jvmti->SetTag(target, ENCODE_TAG(OBJECT_TAG,object,0))))
         return JNI_ERR;
-      if(!NSK_JVMTI_VERIFY(NSK_CPP_STUB3(SetTag, jvmti, targetClass,
-                                         ENCODE_TAG(CLASS_TAG,object,0))))
+      if(!NSK_JVMTI_VERIFY(jvmti->SetTag(targetClass, ENCODE_TAG(CLASS_TAG,object,0))))
         return JNI_ERR;
     }
 
-    NSK_JVMTI_VERIFY(NSK_CPP_STUB2(Deallocate, jvmti, (unsigned char*)targetFields));
-    NSK_CPP_STUB2(DeleteLocalRef, jni, target);
-    NSK_CPP_STUB2(DeleteLocalRef, jni, targetClass);
+    NSK_JVMTI_VERIFY(jvmti->Deallocate((unsigned char*)targetFields));
+    jni->DeleteLocalRef(target);
+    jni->DeleteLocalRef(targetClass);
   }
 
-  NSK_CPP_STUB2(DeleteLocalRef, jni, testObjects);
+  jni->DeleteLocalRef(testObjects);
 
   return JNI_OK;
 }
@@ -428,12 +408,10 @@
   int field;
   for(object = 0; object < TEST_OBJECTS_COUNT; object++) {
     for(field = 0; field < objects_info[object].fields_count; field++) {
-      NSK_CPP_STUB2(Deallocate, jvmti,
-                    (unsigned char*)objects_info[object].fields[field].name);
-      NSK_CPP_STUB2(Deallocate, jvmti,
-                    (unsigned char*)objects_info[object].fields[field].signature);
+      jvmti->Deallocate((unsigned char*)objects_info[object].fields[field].name);
+      jvmti->Deallocate((unsigned char*)objects_info[object].fields[field].signature);
     }
-    NSK_CPP_STUB2(Deallocate, jvmti, (unsigned char*)objects_info[object].name);
+    jvmti->Deallocate((unsigned char*)objects_info[object].name);
     free(objects_info[object].fields);
   }
 }
@@ -494,8 +472,7 @@
   primitive_callbacks.heap_iteration_callback = &heap_callback;
 
   NSK_DISPLAY0("Iterating over reachable objects.\n");
-  if(!NSK_JVMTI_VERIFY(NSK_CPP_STUB5(IterateThroughHeap, jvmti,
-                                     filter_type, NULL, &primitive_callbacks, NULL))) {
+  if(!NSK_JVMTI_VERIFY(jvmti->IterateThroughHeap(filter_type, NULL, &primitive_callbacks, NULL))) {
     nsk_jvmti_setFailStatus();
     return;
   }
@@ -512,8 +489,7 @@
   }
 
   NSK_DISPLAY0("Iterating over unreachable objects.\n");
-  if(!NSK_JVMTI_VERIFY(NSK_CPP_STUB5(IterateThroughHeap, jvmti,
-                                     filter_type, NULL, &primitive_callbacks, NULL))) {
+  if(!NSK_JVMTI_VERIFY(jvmti->IterateThroughHeap(filter_type, NULL, &primitive_callbacks, NULL))) {
     nsk_jvmti_setFailStatus();
     return;
   }
@@ -526,9 +502,7 @@
    * since it will free some memory that the callback will access.
    */
   memset(&event_callbacks, 0, sizeof(jvmtiEventCallbacks));
-  if(!NSK_JVMTI_VERIFY(
-                       NSK_CPP_STUB3(SetEventCallbacks, jvmti,
-                                     &event_callbacks, sizeof(jvmtiEventCallbacks)))) {
+  if(!NSK_JVMTI_VERIFY(jvmti->SetEventCallbacks(&event_callbacks, sizeof(jvmtiEventCallbacks)))) {
     return;
   }
 
@@ -586,15 +560,13 @@
   caps.can_tag_objects = 1;
   caps.can_generate_object_free_events = 1;
 
-  if(!NSK_JVMTI_VERIFY(NSK_CPP_STUB2(AddCapabilities, jvmti, &caps))) {
+  if(!NSK_JVMTI_VERIFY(jvmti->AddCapabilities(&caps))) {
     return JNI_ERR;
   }
 
   memset(&event_callbacks, 0, sizeof(jvmtiEventCallbacks));
   event_callbacks.ObjectFree = &object_free_callback;
-  if(!NSK_JVMTI_VERIFY(
-                       NSK_CPP_STUB3(SetEventCallbacks, jvmti,
-                                     &event_callbacks, sizeof(jvmtiEventCallbacks)))) {
+  if(!NSK_JVMTI_VERIFY(jvmti->SetEventCallbacks(&event_callbacks, sizeof(jvmtiEventCallbacks)))) {
     return JNI_ERR;
   }
 
--- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/IterateThroughHeap/non-concrete-klass-filter/NonConcreteKlassFilter.cpp	Fri Oct 05 17:01:07 2018 -0400
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/IterateThroughHeap/non-concrete-klass-filter/NonConcreteKlassFilter.cpp	Tue Oct 09 14:37:59 2018 +0200
@@ -156,14 +156,13 @@
 
   phase = ZERO_INVOCATIONS_PHASE;
   for(i = 0; i < FILTER_COUNT; i++) {
-    if(!NSK_VERIFY(NULL != (klass = NSK_CPP_STUB2(FindClass, jni, types[i])))) {
+    if(!NSK_VERIFY(NULL != (klass = jni->FindClass(types[i])))) {
       NSK_COMPLAIN1("Can't find class %s.\n",types[i]);
       nsk_jvmti_setFailStatus();
       return;
     }
     NSK_DISPLAY1("Iterating through heap with klass-filter '%s'.\n",types[i]);
-    if(!NSK_JVMTI_VERIFY(NSK_CPP_STUB5(IterateThroughHeap, jvmti,
-                                       0, klass, &primitive_callbacks, NULL))) {
+    if(!NSK_JVMTI_VERIFY(jvmti->IterateThroughHeap(0, klass, &primitive_callbacks, NULL))) {
       nsk_jvmti_setFailStatus();
       return;
     }
@@ -171,13 +170,12 @@
 
   phase = STATIC_FIELDS_FINDING_PHASE;
   NSK_DISPLAY0("Iterating through heap with klass-filter 'java/lang/Class'.\n");
-  if(!NSK_VERIFY(NULL != (klass = NSK_CPP_STUB2(FindClass, jni, "java/lang/Class")))) {
+  if(!NSK_VERIFY(NULL != (klass = jni->FindClass("java/lang/Class")))) {
     NSK_COMPLAIN0("Can't find class java/lang/Class.\n");
     nsk_jvmti_setFailStatus();
     return;
   }
-  if(!NSK_JVMTI_VERIFY(NSK_CPP_STUB5(IterateThroughHeap, jvmti,
-                                     0, klass, &primitive_callbacks, NULL))) {
+  if(!NSK_JVMTI_VERIFY(jvmti->IterateThroughHeap(0, klass, &primitive_callbacks, NULL))) {
     nsk_jvmti_setFailStatus();
     return;
   }
@@ -222,14 +220,12 @@
   caps.can_tag_objects = 1;
   caps.can_generate_object_free_events = 1;
 
-  if(!NSK_JVMTI_VERIFY(NSK_CPP_STUB2(AddCapabilities, jvmti, &caps))) {
+  if(!NSK_JVMTI_VERIFY(jvmti->AddCapabilities(&caps))) {
     return JNI_ERR;
   }
 
   memset(&event_callbacks, 0, sizeof(jvmtiEventCallbacks));
-  if(!NSK_JVMTI_VERIFY(
-                       NSK_CPP_STUB3(SetEventCallbacks, jvmti,
-                                     &event_callbacks, sizeof(jvmtiEventCallbacks)))) {
+  if(!NSK_JVMTI_VERIFY(jvmti->SetEventCallbacks(&event_callbacks, sizeof(jvmtiEventCallbacks)))) {
     return JNI_ERR;
   }
 
--- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/MonitorContendedEnter/mcontenter001/mcontenter001.cpp	Fri Oct 05 17:01:07 2018 -0400
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/MonitorContendedEnter/mcontenter001/mcontenter001.cpp	Tue Oct 09 14:37:59 2018 +0200
@@ -55,8 +55,8 @@
     }
 
     /* check if event is for tested thread and for tested object */
-    if (NSK_CPP_STUB3(IsSameObject, jni, thread, thr) &&
-        NSK_CPP_STUB3(IsSameObject, jni, object, obj))
+    if (jni->IsSameObject(thread, thr) &&
+        jni->IsSameObject(object, obj))
             eventsCount++;
 }
 
@@ -74,8 +74,7 @@
     NSK_DISPLAY0("Prepare: find tested thread\n");
 
     /* get all live threads */
-    if (!NSK_JVMTI_VERIFY(
-           NSK_CPP_STUB3(GetAllThreads, jvmti, &threads_count, &threads)))
+    if (!NSK_JVMTI_VERIFY(jvmti->GetAllThreads(&threads_count, &threads)))
         return NSK_FALSE;
 
     if (!NSK_VERIFY(threads_count > 0 && threads != NULL))
@@ -87,8 +86,7 @@
             return NSK_FALSE;
 
         /* get thread information */
-        if (!NSK_JVMTI_VERIFY(
-                NSK_CPP_STUB3(GetThreadInfo, jvmti, threads[i], &info)))
+        if (!NSK_JVMTI_VERIFY(jvmti->GetThreadInfo(threads[i], &info)))
             return NSK_FALSE;
 
         NSK_DISPLAY3("    thread #%d (%s): %p\n", i, info.name, threads[i]);
@@ -100,8 +98,7 @@
     }
 
     /* deallocate threads list */
-    if (!NSK_JVMTI_VERIFY(
-            NSK_CPP_STUB2(Deallocate, jvmti, (unsigned char*)threads)))
+    if (!NSK_JVMTI_VERIFY(jvmti->Deallocate((unsigned char*)threads)))
         return NSK_FALSE;
 
     if (thread == NULL) {
@@ -110,35 +107,30 @@
     }
 
     /* make thread accessable for a long time */
-    if (!NSK_JNI_VERIFY(jni, (thread =
-            NSK_CPP_STUB2(NewGlobalRef, jni, thread)) != NULL))
+    if (!NSK_JNI_VERIFY(jni, (thread = jni->NewGlobalRef(thread)) != NULL))
         return NSK_FALSE;
 
     /* get tested thread class */
-    if (!NSK_JNI_VERIFY(jni, (klass =
-            NSK_CPP_STUB2(GetObjectClass, jni, thread)) != NULL))
+    if (!NSK_JNI_VERIFY(jni, (klass = jni->GetObjectClass(thread)) != NULL))
         return NSK_FALSE;
 
     /* get tested thread field 'endingMonitor' */
     if (!NSK_JNI_VERIFY(jni, (field =
-            NSK_CPP_STUB4(GetFieldID, jni, klass,
-                "endingMonitor", "Ljava/lang/Object;")) != NULL))
+            jni->GetFieldID(klass, "endingMonitor", "Ljava/lang/Object;")) != NULL))
         return NSK_FALSE;
 
     /* get 'endingMonitor' object */
-    if (!NSK_JNI_VERIFY(jni, (object =
-            NSK_CPP_STUB3(GetObjectField, jni, thread, field)) != NULL))
+    if (!NSK_JNI_VERIFY(jni, (object = jni->GetObjectField(thread, field)) != NULL))
         return NSK_FALSE;
 
     /* make object accessable for a long time */
-    if (!NSK_JNI_VERIFY(jni, (object =
-            NSK_CPP_STUB2(NewGlobalRef, jni, object)) != NULL))
+    if (!NSK_JNI_VERIFY(jni, (object = jni->NewGlobalRef(object)) != NULL))
         return NSK_FALSE;
 
     /* enable MonitorContendedEnter event */
-    if (!NSK_JVMTI_VERIFY(
-            NSK_CPP_STUB4(SetEventNotificationMode, jvmti, JVMTI_ENABLE,
-                JVMTI_EVENT_MONITOR_CONTENDED_ENTER, NULL)))
+    if (!NSK_JVMTI_VERIFY(jvmti->SetEventNotificationMode(JVMTI_ENABLE,
+                                                          JVMTI_EVENT_MONITOR_CONTENDED_ENTER,
+                                                          NULL)))
         return NSK_FALSE;
 
     return NSK_TRUE;
@@ -147,9 +139,9 @@
 static int clean() {
 
     /* disable MonitorContendedEnter event */
-    if (!NSK_JVMTI_VERIFY(
-            NSK_CPP_STUB4(SetEventNotificationMode, jvmti, JVMTI_DISABLE,
-                JVMTI_EVENT_MONITOR_CONTENDED_ENTER, NULL)))
+    if (!NSK_JVMTI_VERIFY(jvmti->SetEventNotificationMode(JVMTI_DISABLE,
+                                                          JVMTI_EVENT_MONITOR_CONTENDED_ENTER,
+                                                          NULL)))
         nsk_jvmti_setFailStatus();
 
     return NSK_TRUE;
@@ -228,14 +220,13 @@
             nsk_jvmti_createJVMTIEnv(jvm, reserved)) != NULL))
         return JNI_ERR;
 
-    if (!NSK_JVMTI_VERIFY(
-            NSK_CPP_STUB2(GetPotentialCapabilities, jvmti,&caps)))
+    if (!NSK_JVMTI_VERIFY(jvmti->GetPotentialCapabilities(&caps)))
         return JNI_ERR;
 
-    if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB2(AddCapabilities, jvmti, &caps)))
+    if (!NSK_JVMTI_VERIFY(jvmti->AddCapabilities(&caps)))
         return JNI_ERR;
 
-    if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB2(GetCapabilities, jvmti, &caps)))
+    if (!NSK_JVMTI_VERIFY(jvmti->GetCapabilities(&caps)))
         return JNI_ERR;
 
     if (!NSK_VERIFY(caps.can_generate_monitor_events))
@@ -243,9 +234,7 @@
 
     memset(&callbacks, 0, sizeof(callbacks));
     callbacks.MonitorContendedEnter = &MonitorContendedEnter;
-    if (!NSK_JVMTI_VERIFY(
-            NSK_CPP_STUB3(SetEventCallbacks, jvmti,
-                &callbacks, sizeof(callbacks))))
+    if (!NSK_JVMTI_VERIFY(jvmti->SetEventCallbacks(&callbacks, sizeof(callbacks))))
         return JNI_ERR;
 
     /* register agent proc and arg */
--- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/MonitorContendedEntered/mcontentered001/mcontentered001.cpp	Fri Oct 05 17:01:07 2018 -0400
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/MonitorContendedEntered/mcontentered001/mcontentered001.cpp	Tue Oct 09 14:37:59 2018 +0200
@@ -57,8 +57,8 @@
     }
 
     /* check if event is for tested thread and for tested object */
-    if (NSK_CPP_STUB3(IsSameObject, jni, thread, thr) &&
-        NSK_CPP_STUB3(IsSameObject, jni, object, obj))
+    if (jni->IsSameObject(thread, thr) &&
+        jni->IsSameObject(object, obj))
             eventsCount++;
 }
 
@@ -74,8 +74,8 @@
     }
 
     /* check if event is for tested thread and for tested object */
-    if (NSK_CPP_STUB3(IsSameObject, jni, thread, thr) &&
-        NSK_CPP_STUB3(IsSameObject, jni, object, obj))
+    if (jni->IsSameObject(thread, thr) &&
+        jni->IsSameObject(object, obj))
             eventsCount++;
 }
 
@@ -94,8 +94,7 @@
     NSK_DISPLAY0("Prepare: find tested thread\n");
 
     /* get all live threads */
-    if (!NSK_JVMTI_VERIFY(
-           NSK_CPP_STUB3(GetAllThreads, jvmti, &threads_count, &threads)))
+    if (!NSK_JVMTI_VERIFY(jvmti->GetAllThreads(&threads_count, &threads)))
         return NSK_FALSE;
 
     if (!NSK_VERIFY(threads_count > 0 && threads != NULL))
@@ -107,8 +106,7 @@
             return NSK_FALSE;
 
         /* get thread information */
-        if (!NSK_JVMTI_VERIFY(
-                NSK_CPP_STUB3(GetThreadInfo, jvmti, threads[i], &info)))
+        if (!NSK_JVMTI_VERIFY(jvmti->GetThreadInfo(threads[i], &info)))
             return NSK_FALSE;
 
         NSK_DISPLAY3("    thread #%d (%s): %p\n", i, info.name, threads[i]);
@@ -120,8 +118,7 @@
     }
 
     /* deallocate threads list */
-    if (!NSK_JVMTI_VERIFY(
-            NSK_CPP_STUB2(Deallocate, jvmti, (unsigned char*)threads)))
+    if (!NSK_JVMTI_VERIFY(jvmti->Deallocate((unsigned char*)threads)))
         return NSK_FALSE;
 
     if (thread == NULL) {
@@ -130,41 +127,36 @@
     }
 
     /* make thread accessable for a long time */
-    if (!NSK_JNI_VERIFY(jni, (thread =
-            NSK_CPP_STUB2(NewGlobalRef, jni, thread)) != NULL))
+    if (!NSK_JNI_VERIFY(jni, (thread = jni->NewGlobalRef(thread)) != NULL))
         return NSK_FALSE;
 
     /* get tested thread class */
-    if (!NSK_JNI_VERIFY(jni, (klass =
-            NSK_CPP_STUB2(GetObjectClass, jni, thread)) != NULL))
+    if (!NSK_JNI_VERIFY(jni, (klass = jni->GetObjectClass(thread)) != NULL))
         return NSK_FALSE;
 
     /* get tested thread field 'endingMonitor' */
     if (!NSK_JNI_VERIFY(jni, (field =
-            NSK_CPP_STUB4(GetFieldID, jni, klass,
-                "endingMonitor", "Ljava/lang/Object;")) != NULL))
+            jni->GetFieldID(klass, "endingMonitor", "Ljava/lang/Object;")) != NULL))
         return NSK_FALSE;
 
     /* get 'endingMonitor' object */
-    if (!NSK_JNI_VERIFY(jni, (object =
-            NSK_CPP_STUB3(GetObjectField, jni, thread, field)) != NULL))
+    if (!NSK_JNI_VERIFY(jni, (object = jni->GetObjectField(thread, field)) != NULL))
         return NSK_FALSE;
 
     /* make object accessable for a long time */
-    if (!NSK_JNI_VERIFY(jni, (object =
-            NSK_CPP_STUB2(NewGlobalRef, jni, object)) != NULL))
+    if (!NSK_JNI_VERIFY(jni, (object = jni->NewGlobalRef(object)) != NULL))
         return NSK_FALSE;
 
     /* enable MonitorContendedEntered event */
-    if (!NSK_JVMTI_VERIFY(
-            NSK_CPP_STUB4(SetEventNotificationMode, jvmti, JVMTI_ENABLE,
-                JVMTI_EVENT_MONITOR_CONTENDED_ENTERED, NULL)))
+    if (!NSK_JVMTI_VERIFY(jvmti->SetEventNotificationMode(JVMTI_ENABLE,
+                                                          JVMTI_EVENT_MONITOR_CONTENDED_ENTERED,
+                                                          NULL)))
         return NSK_FALSE;
 
     /* enable MonitorContendedEnter event */
-    if (!NSK_JVMTI_VERIFY(
-            NSK_CPP_STUB4(SetEventNotificationMode, jvmti, JVMTI_ENABLE,
-                JVMTI_EVENT_MONITOR_CONTENDED_ENTER, NULL)))
+    if (!NSK_JVMTI_VERIFY(jvmti->SetEventNotificationMode(JVMTI_ENABLE,
+                                                          JVMTI_EVENT_MONITOR_CONTENDED_ENTER,
+                                                          NULL)))
         return NSK_FALSE;
 
     return NSK_TRUE;
@@ -173,9 +165,9 @@
 static int clean() {
 
     /* disable MonitorContendedEntered event */
-    if (!NSK_JVMTI_VERIFY(
-            NSK_CPP_STUB4(SetEventNotificationMode, jvmti, JVMTI_DISABLE,
-                JVMTI_EVENT_MONITOR_CONTENDED_ENTERED, NULL)))
+    if (!NSK_JVMTI_VERIFY(jvmti->SetEventNotificationMode(JVMTI_DISABLE,
+                                                          JVMTI_EVENT_MONITOR_CONTENDED_ENTERED,
+                                                          NULL)))
         nsk_jvmti_setFailStatus();
 
     return NSK_TRUE;
@@ -254,14 +246,13 @@
             nsk_jvmti_createJVMTIEnv(jvm, reserved)) != NULL))
         return JNI_ERR;
 
-    if (!NSK_JVMTI_VERIFY(
-            NSK_CPP_STUB2(GetPotentialCapabilities, jvmti,&caps)))
+    if (!NSK_JVMTI_VERIFY(jvmti->GetPotentialCapabilities(&caps)))
         return JNI_ERR;
 
-    if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB2(AddCapabilities, jvmti, &caps)))
+    if (!NSK_JVMTI_VERIFY(jvmti->AddCapabilities(&caps)))
         return JNI_ERR;
 
-    if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB2(GetCapabilities, jvmti, &caps)))
+    if (!NSK_JVMTI_VERIFY(jvmti->GetCapabilities(&caps)))
         return JNI_ERR;
 
     if (!NSK_VERIFY(caps.can_generate_monitor_events))
@@ -271,9 +262,7 @@
     callbacks.MonitorContendedEntered = &MonitorContendedEntered;
     callbacks.MonitorContendedEnter = &MonitorContendedEnter;
 
-    if (!NSK_JVMTI_VERIFY(
-            NSK_CPP_STUB3(SetEventCallbacks, jvmti,
-                &callbacks, sizeof(callbacks))))
+    if (!NSK_JVMTI_VERIFY(jvmti->SetEventCallbacks(&callbacks, sizeof(callbacks))))
         return JNI_ERR;
 
     /* register agent proc and arg */
--- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/MonitorWait/monitorwait001/monitorwait001.cpp	Fri Oct 05 17:01:07 2018 -0400
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/MonitorWait/monitorwait001/monitorwait001.cpp	Tue Oct 09 14:37:59 2018 +0200
@@ -55,8 +55,8 @@
     }
 
     /* check if event is for tested thread and for tested object */
-    if (NSK_CPP_STUB3(IsSameObject, jni, thread, thr) &&
-            NSK_CPP_STUB3(IsSameObject, jni, object, obj)) {
+    if (jni->IsSameObject(thread, thr) &&
+            jni->IsSameObject(object, obj)) {
         eventsCount++;
         if (tout != timeout) {
             NSK_COMPLAIN1("Unexpected timeout value: %d\n", (int)tout);
@@ -79,8 +79,7 @@
     NSK_DISPLAY0("Prepare: find tested thread\n");
 
     /* get all live threads */
-    if (!NSK_JVMTI_VERIFY(
-           NSK_CPP_STUB3(GetAllThreads, jvmti, &threads_count, &threads)))
+    if (!NSK_JVMTI_VERIFY(jvmti->GetAllThreads(&threads_count, &threads)))
         return NSK_FALSE;
 
     if (!NSK_VERIFY(threads_count > 0 && threads != NULL))
@@ -92,8 +91,7 @@
             return NSK_FALSE;
 
         /* get thread information */
-        if (!NSK_JVMTI_VERIFY(
-                NSK_CPP_STUB3(GetThreadInfo, jvmti, threads[i], &info)))
+        if (!NSK_JVMTI_VERIFY(jvmti->GetThreadInfo(threads[i], &info)))
             return NSK_FALSE;
 
         NSK_DISPLAY3("    thread #%d (%s): %p\n", i, info.name, threads[i]);
@@ -105,8 +103,7 @@
     }
 
     /* deallocate threads list */
-    if (!NSK_JVMTI_VERIFY(
-            NSK_CPP_STUB2(Deallocate, jvmti, (unsigned char*)threads)))
+    if (!NSK_JVMTI_VERIFY(jvmti->Deallocate((unsigned char*)threads)))
         return NSK_FALSE;
 
     if (thread == NULL) {
@@ -115,35 +112,29 @@
     }
 
     /* make thread accessable for a long time */
-    if (!NSK_JNI_VERIFY(jni, (thread =
-            NSK_CPP_STUB2(NewGlobalRef, jni, thread)) != NULL))
+    if (!NSK_JNI_VERIFY(jni, (thread = jni->NewGlobalRef(thread)) != NULL))
         return NSK_FALSE;
 
     /* get tested thread class */
-    if (!NSK_JNI_VERIFY(jni, (klass =
-            NSK_CPP_STUB2(GetObjectClass, jni, thread)) != NULL))
+    if (!NSK_JNI_VERIFY(jni, (klass = jni->GetObjectClass(thread)) != NULL))
         return NSK_FALSE;
 
     /* get tested thread field 'waitingMonitor' */
     if (!NSK_JNI_VERIFY(jni, (field =
-            NSK_CPP_STUB4(GetFieldID, jni, klass,
-                "waitingMonitor", "Ljava/lang/Object;")) != NULL))
+            jni->GetFieldID(klass, "waitingMonitor", "Ljava/lang/Object;")) != NULL))
         return NSK_FALSE;
 
     /* get 'waitingMonitor' object */
-    if (!NSK_JNI_VERIFY(jni, (object =
-            NSK_CPP_STUB3(GetObjectField, jni, thread, field)) != NULL))
+    if (!NSK_JNI_VERIFY(jni, (object = jni->GetObjectField(thread, field)) != NULL))
         return NSK_FALSE;
 
     /* make object accessable for a long time */
-    if (!NSK_JNI_VERIFY(jni, (object =
-            NSK_CPP_STUB2(NewGlobalRef, jni, object)) != NULL))
+    if (!NSK_JNI_VERIFY(jni, (object = jni->NewGlobalRef(object)) != NULL))
         return NSK_FALSE;
 
     /* enable MonitorWait event */
     if (!NSK_JVMTI_VERIFY(
-            NSK_CPP_STUB4(SetEventNotificationMode, jvmti, JVMTI_ENABLE,
-                JVMTI_EVENT_MONITOR_WAIT, NULL)))
+            jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_MONITOR_WAIT, NULL)))
         return NSK_FALSE;
 
     return NSK_TRUE;
@@ -153,13 +144,12 @@
 
     /* disable MonitorWait event */
     if (!NSK_JVMTI_VERIFY(
-            NSK_CPP_STUB4(SetEventNotificationMode, jvmti, JVMTI_DISABLE,
-                JVMTI_EVENT_MONITOR_WAIT, NULL)))
+            jvmti->SetEventNotificationMode(JVMTI_DISABLE, JVMTI_EVENT_MONITOR_WAIT, NULL)))
         nsk_jvmti_setFailStatus();
 
     /* dispose global references */
-    NSK_CPP_STUB2(DeleteGlobalRef, jni, object);
-    NSK_CPP_STUB2(DeleteGlobalRef, jni, thread);
+    jni->DeleteGlobalRef(object);
+    jni->DeleteGlobalRef(thread);
 
     return NSK_TRUE;
 }
@@ -237,14 +227,13 @@
             nsk_jvmti_createJVMTIEnv(jvm, reserved)) != NULL))
         return JNI_ERR;
 
-    if (!NSK_JVMTI_VERIFY(
-            NSK_CPP_STUB2(GetPotentialCapabilities, jvmti,&caps)))
+    if (!NSK_JVMTI_VERIFY(jvmti->GetPotentialCapabilities(&caps)))
         return JNI_ERR;
 
-    if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB2(AddCapabilities, jvmti, &caps)))
+    if (!NSK_JVMTI_VERIFY(jvmti->AddCapabilities(&caps)))
         return JNI_ERR;
 
-    if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB2(GetCapabilities, jvmti, &caps)))
+    if (!NSK_JVMTI_VERIFY(jvmti->GetCapabilities(&caps)))
         return JNI_ERR;
 
     if (!NSK_VERIFY(caps.can_generate_monitor_events))
@@ -252,9 +241,7 @@
 
     memset(&callbacks, 0, sizeof(callbacks));
     callbacks.MonitorWait = &MonitorWait;
-    if (!NSK_JVMTI_VERIFY(
-            NSK_CPP_STUB3(SetEventCallbacks, jvmti,
-                &callbacks, sizeof(callbacks))))
+    if (!NSK_JVMTI_VERIFY(jvmti->SetEventCallbacks(&callbacks, sizeof(callbacks))))
         return JNI_ERR;
 
     /* register agent proc and arg */
--- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/MonitorWaited/monitorwaited001/monitorwaited001.cpp	Fri Oct 05 17:01:07 2018 -0400
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/MonitorWaited/monitorwaited001/monitorwaited001.cpp	Tue Oct 09 14:37:59 2018 +0200
@@ -56,8 +56,8 @@
     }
 
     /* check if event is for tested thread and for tested object */
-    if (NSK_CPP_STUB3(IsSameObject, jni, thread, thr) &&
-            NSK_CPP_STUB3(IsSameObject, jni, object, obj)) {
+    if (jni->IsSameObject(thread, thr) &&
+            jni->IsSameObject(object, obj)) {
         eventsCount++;
         if (timed_out == JNI_TRUE) {
             NSK_COMPLAIN0("Unexpected timed_out value: true\n");
@@ -80,8 +80,7 @@
     NSK_DISPLAY0("Prepare: find tested thread\n");
 
     /* get all live threads */
-    if (!NSK_JVMTI_VERIFY(
-           NSK_CPP_STUB3(GetAllThreads, jvmti, &threads_count, &threads)))
+    if (!NSK_JVMTI_VERIFY(jvmti->GetAllThreads(&threads_count, &threads)))
         return NSK_FALSE;
 
     if (!NSK_VERIFY(threads_count > 0 && threads != NULL))
@@ -93,8 +92,7 @@
             return NSK_FALSE;
 
         /* get thread information */
-        if (!NSK_JVMTI_VERIFY(
-                NSK_CPP_STUB3(GetThreadInfo, jvmti, threads[i], &info)))
+        if (!NSK_JVMTI_VERIFY(jvmti->GetThreadInfo(threads[i], &info)))
             return NSK_FALSE;
 
         NSK_DISPLAY3("    thread #%d (%s): %p\n", i, info.name, threads[i]);
@@ -106,8 +104,7 @@
     }
 
     /* deallocate threads list */
-    if (!NSK_JVMTI_VERIFY(
-            NSK_CPP_STUB2(Deallocate, jvmti, (unsigned char*)threads)))
+    if (!NSK_JVMTI_VERIFY(jvmti->Deallocate((unsigned char*)threads)))
         return NSK_FALSE;
 
     if (thread == NULL) {
@@ -116,35 +113,29 @@
     }
 
     /* make thread accessable for a long time */
-    if (!NSK_JNI_VERIFY(jni, (thread =
-            NSK_CPP_STUB2(NewGlobalRef, jni, thread)) != NULL))
+    if (!NSK_JNI_VERIFY(jni, (thread = jni->NewGlobalRef(thread)) != NULL))
         return NSK_FALSE;
 
     /* get tested thread class */
-    if (!NSK_JNI_VERIFY(jni, (klass =
-            NSK_CPP_STUB2(GetObjectClass, jni, thread)) != NULL))
+    if (!NSK_JNI_VERIFY(jni, (klass = jni->GetObjectClass(thread)) != NULL))
         return NSK_FALSE;
 
     /* get tested thread field 'waitingMonitor' */
     if (!NSK_JNI_VERIFY(jni, (field =
-            NSK_CPP_STUB4(GetFieldID, jni, klass,
-                "waitingMonitor", "Ljava/lang/Object;")) != NULL))
+            jni->GetFieldID(klass, "waitingMonitor", "Ljava/lang/Object;")) != NULL))
         return NSK_FALSE;
 
     /* get 'waitingMonitor' object */
-    if (!NSK_JNI_VERIFY(jni, (object =
-            NSK_CPP_STUB3(GetObjectField, jni, thread, field)) != NULL))
+    if (!NSK_JNI_VERIFY(jni, (object = jni->GetObjectField(thread, field)) != NULL))
         return NSK_FALSE;
 
     /* make object accessable for a long time */
-    if (!NSK_JNI_VERIFY(jni, (object =
-            NSK_CPP_STUB2(NewGlobalRef, jni, object)) != NULL))
+    if (!NSK_JNI_VERIFY(jni, (object = jni->NewGlobalRef(object)) != NULL))
         return NSK_FALSE;
 
     /* enable MonitorWaited event */
     if (!NSK_JVMTI_VERIFY(
-            NSK_CPP_STUB4(SetEventNotificationMode, jvmti, JVMTI_ENABLE,
-                JVMTI_EVENT_MONITOR_WAITED, NULL)))
+            jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_MONITOR_WAITED, NULL)))
         return NSK_FALSE;
 
     return NSK_TRUE;
@@ -154,13 +145,12 @@
 
     /* disable MonitorWaited event */
     if (!NSK_JVMTI_VERIFY(
-            NSK_CPP_STUB4(SetEventNotificationMode, jvmti, JVMTI_DISABLE,
-                JVMTI_EVENT_MONITOR_WAITED, NULL)))
+            jvmti->SetEventNotificationMode(JVMTI_DISABLE, JVMTI_EVENT_MONITOR_WAITED, NULL)))
         nsk_jvmti_setFailStatus();
 
     /* dispose global references */
-    NSK_CPP_STUB2(DeleteGlobalRef, jni, object);
-    NSK_CPP_STUB2(DeleteGlobalRef, jni, thread);
+    jni->DeleteGlobalRef(object);
+    jni->DeleteGlobalRef(thread);
 
     return NSK_TRUE;
 }
@@ -238,14 +228,13 @@
             nsk_jvmti_createJVMTIEnv(jvm, reserved)) != NULL))
         return JNI_ERR;
 
-    if (!NSK_JVMTI_VERIFY(
-            NSK_CPP_STUB2(GetPotentialCapabilities, jvmti,&caps)))
+    if (!NSK_JVMTI_VERIFY(jvmti->GetPotentialCapabilities(&caps)))
         return JNI_ERR;
 
-    if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB2(AddCapabilities, jvmti, &caps)))
+    if (!NSK_JVMTI_VERIFY(jvmti->AddCapabilities(&caps)))
         return JNI_ERR;
 
-    if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB2(GetCapabilities, jvmti, &caps)))
+    if (!NSK_JVMTI_VERIFY(jvmti->GetCapabilities(&caps)))
         return JNI_ERR;
 
     if (!NSK_VERIFY(caps.can_generate_monitor_events))
@@ -253,9 +242,7 @@
 
     memset(&callbacks, 0, sizeof(callbacks));
     callbacks.MonitorWaited = &MonitorWaited;
-    if (!NSK_JVMTI_VERIFY(
-            NSK_CPP_STUB3(SetEventCallbacks, jvmti,
-                &callbacks, sizeof(callbacks))))
+    if (!NSK_JVMTI_VERIFY(jvmti->SetEventCallbacks(&callbacks, sizeof(callbacks))))
         return JNI_ERR;
 
     /* register agent proc and arg */
--- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/NativeMethodBind/nativemethbind001/nativemethbind001.cpp	Fri Oct 05 17:01:07 2018 -0400
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/NativeMethodBind/nativemethbind001/nativemethbind001.cpp	Tue Oct 09 14:37:59 2018 +0200
@@ -59,17 +59,13 @@
 static jrawMonitorID countLock;
 
 static void lock(jvmtiEnv *jvmti_env, JNIEnv *jni_env) {
-    if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB2(RawMonitorEnter,
-            jvmti_env, countLock)))
-        NSK_CPP_STUB2(FatalError, jni_env,
-            "failed to enter a raw monitor\n");
+    if (!NSK_JVMTI_VERIFY(jvmti_env->RawMonitorEnter(countLock)))
+        jni_env->FatalError("failed to enter a raw monitor\n");
 }
 
 static void unlock(jvmtiEnv *jvmti_env, JNIEnv *jni_env) {
-    if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB2(RawMonitorExit,
-            jvmti_env, countLock)))
-        NSK_CPP_STUB2(FatalError, jni_env,
-            "failed to exit a raw monitor\n");
+    if (!NSK_JVMTI_VERIFY(jvmti_env->RawMonitorExit(countLock)))
+        jni_env->FatalError("failed to exit a raw monitor\n");
 }
 
 /** callback functions **/
@@ -84,7 +80,7 @@
 
     NSK_DISPLAY0(">>>> NativeMethodBind event received\n");
 
-    if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB2(GetPhase, jvmti_env, &phase))) {
+    if (!NSK_JVMTI_VERIFY(jvmti_env->GetPhase(&phase))) {
         result = STATUS_FAILED;
         unlock(jvmti_env, jni_env);
         return;
@@ -95,8 +91,7 @@
         return;
     }
 
-    if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB5(GetMethodName,
-            jvmti_env, method, &methNam, &methSig, NULL))) {
+    if (!NSK_JVMTI_VERIFY(jvmti_env->GetMethodName(method, &methNam, &methSig, NULL))) {
         result = STATUS_FAILED;
         NSK_COMPLAIN0("TEST FAILED: unable to get method name during NativeMethodBind callback\n\n");
         unlock(jvmti_env, jni_env);
@@ -118,13 +113,11 @@
         }
     }
 
-    if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB2(Deallocate,
-            jvmti_env, (unsigned char*) methNam))) {
+    if (!NSK_JVMTI_VERIFY(jvmti_env->Deallocate((unsigned char*) methNam))) {
         result = STATUS_FAILED;
         NSK_COMPLAIN0("TEST FAILED: unable to deallocate memory pointed to method name\n\n");
     }
-    if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB2(Deallocate,
-            jvmti_env, (unsigned char*) methSig))) {
+    if (!NSK_JVMTI_VERIFY(jvmti_env->Deallocate((unsigned char*) methSig))) {
         result = STATUS_FAILED;
         NSK_COMPLAIN0("TEST FAILED: unable to deallocate memory pointed to method signature\n\n");
     }
@@ -152,8 +145,7 @@
 
     if (registerNative == JNI_TRUE) {
         NSK_DISPLAY1("Finding class \"%s\" ...\n", CLASS_SIG);
-        if (!NSK_JNI_VERIFY(env, (testedCls =
-                NSK_CPP_STUB2(FindClass, env, CLASS_SIG)) != NULL)) {
+        if (!NSK_JNI_VERIFY(env, (testedCls = env->FindClass(CLASS_SIG)) != NULL)) {
             result = STATUS_FAILED;
             NSK_COMPLAIN1("TEST FAILURE: unable to find class \"%s\"\n\n",
                 CLASS_SIG);
@@ -167,8 +159,7 @@
         NSK_DISPLAY3("Calling RegisterNatives() with \"%s %s\"\n"
                      "\tfor class \"%s\" ...\n",
             METHODS[1][0], METHODS[1][1], CLASS_SIG);
-        if (!NSK_JNI_VERIFY_VOID(env, (NSK_CPP_STUB4(RegisterNatives,
-                env, testedCls, &meth, 1)) != 0)) {
+        if (!NSK_JNI_VERIFY_VOID(env, (env->RegisterNatives(testedCls, &meth, 1)) != 0)) {
             result = STATUS_FAILED;
             NSK_COMPLAIN3("TEST FAILURE: unable to RegisterNatives() \"%s %s\" for class \"%s\"\n\n",
                 METHODS[1][0], METHODS[1][1], CLASS_SIG);
@@ -221,19 +212,16 @@
         return JNI_ERR;
 
     /* create a raw monitor */
-    if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB3(CreateRawMonitor,
-            jvmti, "_counter_lock", &countLock)))
+    if (!NSK_JVMTI_VERIFY(jvmti->CreateRawMonitor("_counter_lock", &countLock)))
         return JNI_ERR;
 
     /* add capability to generate compiled method events */
     memset(&caps, 0, sizeof(jvmtiCapabilities));
     caps.can_generate_native_method_bind_events = 1;
-    if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB2(AddCapabilities,
-            jvmti, &caps)))
+    if (!NSK_JVMTI_VERIFY(jvmti->AddCapabilities(&caps)))
         return JNI_ERR;
 
-    if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB2(GetCapabilities,
-            jvmti, &caps)))
+    if (!NSK_JVMTI_VERIFY(jvmti->GetCapabilities(&caps)))
         return JNI_ERR;
     if (!caps.can_generate_native_method_bind_events)
         NSK_DISPLAY0("Warning: generation of native method bind events is not implemented\n");
@@ -242,13 +230,13 @@
     NSK_DISPLAY0("setting event callbacks ...\n");
     (void) memset(&callbacks, 0, sizeof(callbacks));
     callbacks.NativeMethodBind = &NativeMethodBind;
-    if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB3(SetEventCallbacks,
-            jvmti, &callbacks, sizeof(callbacks))))
+    if (!NSK_JVMTI_VERIFY(jvmti->SetEventCallbacks(&callbacks, sizeof(callbacks))))
         return JNI_ERR;
 
     NSK_DISPLAY0("setting event callbacks done\nenabling JVMTI events ...\n");
-    if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB4(SetEventNotificationMode,
-            jvmti, JVMTI_ENABLE, JVMTI_EVENT_NATIVE_METHOD_BIND, NULL)))
+    if (!NSK_JVMTI_VERIFY(jvmti->SetEventNotificationMode(JVMTI_ENABLE,
+                                                          JVMTI_EVENT_NATIVE_METHOD_BIND,
+                                                          NULL)))
         return JNI_ERR;
     NSK_DISPLAY0("enabling the events done\n\n");
 
--- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/NativeMethodBind/nativemethbind002/nativemethbind002.cpp	Fri Oct 05 17:01:07 2018 -0400
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/NativeMethodBind/nativemethbind002/nativemethbind002.cpp	Tue Oct 09 14:37:59 2018 +0200
@@ -42,17 +42,13 @@
 static jrawMonitorID countLock;
 
 static void lock(jvmtiEnv *jvmti_env, JNIEnv *jni_env) {
-    if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB2(RawMonitorEnter,
-            jvmti_env, countLock)))
-        NSK_CPP_STUB2(FatalError, jni_env,
-            "failed to enter a raw monitor\n");
+    if (!NSK_JVMTI_VERIFY(jvmti_env->RawMonitorEnter(countLock)))
+        jni_env->FatalError("failed to enter a raw monitor\n");
 }
 
 static void unlock(jvmtiEnv *jvmti_env, JNIEnv *jni_env) {
-    if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB2(RawMonitorExit,
-            jvmti_env, countLock)))
-        NSK_CPP_STUB2(FatalError, jni_env,
-            "failed to exit a raw monitor\n");
+    if (!NSK_JVMTI_VERIFY(jvmti_env->RawMonitorExit(countLock)))
+        jni_env->FatalError("failed to exit a raw monitor\n");
 }
 
 /** callback functions **/
@@ -64,8 +60,7 @@
 
     lock(jvmti_env, jni_env);
 
-    if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB2(GetPhase,
-            jvmti_env, &phase))) {
+    if (!NSK_JVMTI_VERIFY(jvmti_env->GetPhase(&phase))) {
         result = STATUS_FAILED;
         NSK_COMPLAIN0(
             "TEST FAILED: unable to obtain phase of the VM execution\n"
@@ -79,8 +74,7 @@
         return;
     }
 
-    if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB5(GetMethodName,
-            jvmti_env, method, &methNam, &methSig, NULL))) {
+    if (!NSK_JVMTI_VERIFY(jvmti_env->GetMethodName(method, &methNam, &methSig, NULL))) {
         result = STATUS_FAILED;
         NSK_COMPLAIN0("TEST FAILED: unable to get method name during NativeMethodBind callback\n\n");
     }
@@ -89,12 +83,10 @@
             methNam, methSig);
 
     if (!(methNam==NULL))
-        if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB2(Deallocate,
-                jvmti_env, (unsigned char*) methNam)))
+        if (!NSK_JVMTI_VERIFY(jvmti_env->Deallocate((unsigned char*) methNam)))
             NSK_COMPLAIN0("TEST FAILED: unable to deallocate memory pointed to method name\n\n");
     if (!(methSig==NULL))
-        if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB2(Deallocate,
-                jvmti_env, (unsigned char*) methSig)))
+        if (!NSK_JVMTI_VERIFY(jvmti_env->Deallocate((unsigned char*) methSig)))
             NSK_COMPLAIN0("TEST FAILED: unable to deallocate memory pointed to method signature\n\n");
 
     unlock(jvmti_env, jni_env);
@@ -149,19 +141,16 @@
         return JNI_ERR;
 
     /* create a raw monitor */
-    if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB3(CreateRawMonitor,
-            jvmti, "_counter_lock", &countLock)))
+    if (!NSK_JVMTI_VERIFY(jvmti->CreateRawMonitor("_counter_lock", &countLock)))
         return JNI_ERR;
 
     /* add capability to generate compiled method events */
     memset(&caps, 0, sizeof(jvmtiCapabilities));
     caps.can_generate_native_method_bind_events = 1;
-    if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB2(AddCapabilities,
-            jvmti, &caps)))
+    if (!NSK_JVMTI_VERIFY(jvmti->AddCapabilities(&caps)))
         return JNI_ERR;
 
-    if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB2(GetCapabilities,
-            jvmti, &caps)))
+    if (!NSK_JVMTI_VERIFY(jvmti->GetCapabilities(&caps)))
         return JNI_ERR;
     if (!caps.can_generate_native_method_bind_events)
         NSK_DISPLAY0("Warning: generation of native method bind events is not implemented\n");
@@ -171,16 +160,17 @@
     (void) memset(&callbacks, 0, sizeof(callbacks));
     callbacks.NativeMethodBind = &NativeMethodBind;
     callbacks.VMDeath = &VMDeath;
-    if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB3(SetEventCallbacks,
-            jvmti, &callbacks, sizeof(callbacks))))
+    if (!NSK_JVMTI_VERIFY(jvmti->SetEventCallbacks(&callbacks, sizeof(callbacks))))
         return JNI_ERR;
 
     NSK_DISPLAY0("setting event callbacks done\nenabling JVMTI events ...\n");
-    if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB4(SetEventNotificationMode,
-            jvmti, JVMTI_ENABLE, JVMTI_EVENT_NATIVE_METHOD_BIND, NULL)))
+    if (!NSK_JVMTI_VERIFY(jvmti->SetEventNotificationMode(JVMTI_ENABLE,
+                                                          JVMTI_EVENT_NATIVE_METHOD_BIND,
+                                                          NULL)))
         return JNI_ERR;
-    if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB4(SetEventNotificationMode,
-            jvmti, JVMTI_ENABLE, JVMTI_EVENT_VM_DEATH, NULL)))
+    if (!NSK_JVMTI_VERIFY(jvmti->SetEventNotificationMode(JVMTI_ENABLE,
+                                                          JVMTI_EVENT_VM_DEATH,
+                                                          NULL)))
         return JNI_ERR;
     NSK_DISPLAY0("enabling the events done\n\n");
 
--- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/NativeMethodBind/nativemethbind003/nativemethbind003.cpp	Fri Oct 05 17:01:07 2018 -0400
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/NativeMethodBind/nativemethbind003/nativemethbind003.cpp	Tue Oct 09 14:37:59 2018 +0200
@@ -52,17 +52,13 @@
 static jrawMonitorID countLock;
 
 static void lock(jvmtiEnv *jvmti_env, JNIEnv *jni_env) {
-    if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB2(RawMonitorEnter,
-            jvmti_env, countLock)))
-        NSK_CPP_STUB2(FatalError, jni_env,
-            "failed to enter a raw monitor\n");
+    if (!NSK_JVMTI_VERIFY(jvmti_env->RawMonitorEnter(countLock)))
+        jni_env->FatalError("failed to enter a raw monitor\n");
 }
 
 static void unlock(jvmtiEnv *jvmti_env, JNIEnv *jni_env) {
-    if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB2(RawMonitorExit,
-            jvmti_env, countLock)))
-        NSK_CPP_STUB2(FatalError, jni_env,
-            "failed to exit a raw monitor\n");
+    if (!NSK_JVMTI_VERIFY(jvmti_env->RawMonitorExit(countLock)))
+        jni_env->FatalError("failed to exit a raw monitor\n");
 }
 
 /** callback functions **/
@@ -76,7 +72,7 @@
 
     NSK_DISPLAY0(">>>> NativeMethodBind event received\n");
 
-    if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB2(GetPhase, jvmti_env, &phase))) {
+    if (!NSK_JVMTI_VERIFY(jvmti_env->GetPhase(&phase))) {
         result = STATUS_FAILED;
         unlock(jvmti_env, jni_env);
         return;
@@ -87,8 +83,7 @@
         return;
     }
 
-    if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB5(GetMethodName,
-            jvmti_env, method, &methNam, &methSig, NULL))) {
+    if (!NSK_JVMTI_VERIFY(jvmti_env->GetMethodName(method, &methNam, &methSig, NULL))) {
         result = STATUS_FAILED;
         NSK_COMPLAIN0("TEST FAILED: unable to get method name during NativeMethodBind callback\n\n");
         unlock(jvmti_env, jni_env);
@@ -102,13 +97,11 @@
         NSK_DISPLAY2("\tmethod: \"%s %s\"\n", methNam, methSig);
     }
 
-    if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB2(Deallocate,
-            jvmti_env, (unsigned char*) methNam))) {
+    if (!NSK_JVMTI_VERIFY(jvmti_env->Deallocate((unsigned char*) methNam))) {
         result = STATUS_FAILED;
         NSK_COMPLAIN0("TEST FAILED: unable to deallocate memory storing method name\n\n");
     }
-    if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB2(Deallocate,
-            jvmti_env, (unsigned char*) methSig))) {
+    if (!NSK_JVMTI_VERIFY(jvmti_env->Deallocate((unsigned char*) methSig))) {
         result = STATUS_FAILED;
         NSK_COMPLAIN0("TEST FAILED: unable to deallocate memory storing method signature\n\n");
     }
@@ -158,8 +151,7 @@
     NSK_DISPLAY1("Inside the registerNative()\n"
                  "Finding class \"%s\" ...\n",
                  CLASS_SIG);
-    if (!NSK_JNI_VERIFY(env, (testedCls =
-            NSK_CPP_STUB2(FindClass, env, CLASS_SIG)) != NULL)) {
+    if (!NSK_JNI_VERIFY(env, (testedCls = env->FindClass(CLASS_SIG)) != NULL)) {
         result = STATUS_FAILED;
         NSK_COMPLAIN1("TEST FAILURE: unable to find class \"%s\"\n\n",
             CLASS_SIG);
@@ -174,8 +166,7 @@
         "Calling RegisterNatives() with \"%s %s\"\n"
         "\tfor class \"%s\" ...\n",
         METHODS[0], METHODS[1], CLASS_SIG);
-    if (!NSK_JNI_VERIFY_VOID(env, (NSK_CPP_STUB4(RegisterNatives,
-            env, testedCls, &meth, 1)) != 0)) {
+    if (!NSK_JNI_VERIFY_VOID(env, (env->RegisterNatives(testedCls, &meth, 1)) != 0)) {
         result = STATUS_FAILED;
         NSK_COMPLAIN3("TEST FAILURE: unable to RegisterNatives() \"%s %s\" for class \"%s\"\n\n",
             METHODS[0], METHODS[1], CLASS_SIG);
@@ -183,8 +174,7 @@
 
     NSK_DISPLAY1("Calling UnregisterNatives() for class \"%s\" ...\n",
         CLASS_SIG);
-    if (!NSK_JNI_VERIFY_VOID(env, (NSK_CPP_STUB2(UnregisterNatives,
-            env, testedCls)) != 0)) {
+    if (!NSK_JNI_VERIFY_VOID(env, (env->UnregisterNatives(testedCls)) != 0)) {
         result = STATUS_FAILED;
         NSK_COMPLAIN3("TEST FAILURE: unable to UnregisterNatives() \"%s %s\" for class \"%s\"\n\n",
             METHODS[1][0], METHODS[1][1], CLASS_SIG);
@@ -215,19 +205,16 @@
         return JNI_ERR;
 
     /* create a raw monitor */
-    if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB3(CreateRawMonitor,
-            jvmti, "_counter_lock", &countLock)))
+    if (!NSK_JVMTI_VERIFY(jvmti->CreateRawMonitor("_counter_lock", &countLock)))
         return JNI_ERR;
 
     /* add capability to generate compiled method events */
     memset(&caps, 0, sizeof(jvmtiCapabilities));
     caps.can_generate_native_method_bind_events = 1;
-    if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB2(AddCapabilities,
-            jvmti, &caps)))
+    if (!NSK_JVMTI_VERIFY(jvmti->AddCapabilities(&caps)))
         return JNI_ERR;
 
-    if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB2(GetCapabilities,
-            jvmti, &caps)))
+    if (!NSK_JVMTI_VERIFY(jvmti->GetCapabilities(&caps)))
         return JNI_ERR;
     if (!caps.can_generate_native_method_bind_events)
         NSK_DISPLAY0("Warning: generation of native method bind events is not implemented\n");
@@ -237,16 +224,17 @@
     (void) memset(&callbacks, 0, sizeof(callbacks));
     callbacks.NativeMethodBind = &NativeMethodBind;
     callbacks.VMDeath = &VMDeath;
-    if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB3(SetEventCallbacks,
-            jvmti, &callbacks, sizeof(callbacks))))
+    if (!NSK_JVMTI_VERIFY(jvmti->SetEventCallbacks(&callbacks, sizeof(callbacks))))
         return JNI_ERR;
 
     NSK_DISPLAY0("setting event callbacks done\nenabling JVMTI events ...\n");
-    if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB4(SetEventNotificationMode,
-            jvmti, JVMTI_ENABLE, JVMTI_EVENT_NATIVE_METHOD_BIND, NULL)))
+    if (!NSK_JVMTI_VERIFY(jvmti->SetEventNotificationMode(JVMTI_ENABLE,
+                                                          JVMTI_EVENT_NATIVE_METHOD_BIND,
+                                                          NULL)))
         return JNI_ERR;
-    if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB4(SetEventNotificationMode,
-            jvmti, JVMTI_ENABLE, JVMTI_EVENT_VM_DEATH, NULL)))
+    if (!NSK_JVMTI_VERIFY(jvmti->SetEventNotificationMode(JVMTI_ENABLE,
+                                                          JVMTI_EVENT_VM_DEATH,
+                                                          NULL)))
         return JNI_ERR;
     NSK_DISPLAY0("enabling the events done\n\n");
 
--- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/NativeMethodBind/nativemethbind004/nativemethbind004.cpp	Fri Oct 05 17:01:07 2018 -0400
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/NativeMethodBind/nativemethbind004/nativemethbind004.cpp	Tue Oct 09 14:37:59 2018 +0200
@@ -67,17 +67,13 @@
 }
 
 static void lock(jvmtiEnv *jvmti_env, JNIEnv *jni_env) {
-    if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB2(RawMonitorEnter,
-            jvmti_env, countLock)))
-        NSK_CPP_STUB2(FatalError, jni_env,
-            "failed to enter a raw monitor\n");
+    if (!NSK_JVMTI_VERIFY(jvmti_env->RawMonitorEnter(countLock)))
+        jni_env->FatalError("failed to enter a raw monitor\n");
 }
 
 static void unlock(jvmtiEnv *jvmti_env, JNIEnv *jni_env) {
-    if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB2(RawMonitorExit,
-            jvmti_env, countLock)))
-        NSK_CPP_STUB2(FatalError, jni_env,
-            "failed to exit a raw monitor\n");
+    if (!NSK_JVMTI_VERIFY(jvmti_env->RawMonitorExit(countLock)))
+        jni_env->FatalError("failed to exit a raw monitor\n");
 }
 
 /** callback functions **/
@@ -90,7 +86,7 @@
 
     NSK_DISPLAY0(">>>> NativeMethodBind event received\n");
 
-    if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB2(GetPhase, jvmti_env, &phase))) {
+    if (!NSK_JVMTI_VERIFY(jvmti_env->GetPhase(&phase))) {
         result = STATUS_FAILED;
         unlock(jvmti_env, jni_env);
         return;
@@ -101,8 +97,7 @@
         return;
     }
 
-    if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB5(GetMethodName,
-            jvmti_env, method, &methNam, &methSig, NULL))) {
+    if (!NSK_JVMTI_VERIFY(jvmti_env->GetMethodName(method, &methNam, &methSig, NULL))) {
         result = STATUS_FAILED;
         NSK_COMPLAIN0("TEST FAILED: unable to get method name during NativeMethodBind callback\n\n");
         unlock(jvmti_env, jni_env);
@@ -117,13 +112,11 @@
         *new_addr = (void*) redirNativeMethod;
     }
 
-    if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB2(Deallocate,
-            jvmti_env, (unsigned char*) methNam))) {
+    if (!NSK_JVMTI_VERIFY(jvmti_env->Deallocate((unsigned char*) methNam))) {
         result = STATUS_FAILED;
         NSK_COMPLAIN0("TEST FAILED: unable to deallocate memory storing method name\n\n");
     }
-    if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB2(Deallocate,
-            jvmti_env, (unsigned char*) methSig))) {
+    if (!NSK_JVMTI_VERIFY(jvmti_env->Deallocate((unsigned char*) methSig))) {
         result = STATUS_FAILED;
         NSK_COMPLAIN0("TEST FAILED: unable to deallocate memory storing method signature\n\n");
     }
@@ -190,19 +183,16 @@
         return JNI_ERR;
 
     /* create a raw monitor */
-    if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB3(CreateRawMonitor,
-            jvmti, "_counter_lock", &countLock)))
+    if (!NSK_JVMTI_VERIFY(jvmti->CreateRawMonitor("_counter_lock", &countLock)))
         return JNI_ERR;
 
     /* add capability to generate compiled method events */
     memset(&caps, 0, sizeof(jvmtiCapabilities));
     caps.can_generate_native_method_bind_events = 1;
-    if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB2(AddCapabilities,
-            jvmti, &caps)))
+    if (!NSK_JVMTI_VERIFY(jvmti->AddCapabilities(&caps)))
         return JNI_ERR;
 
-    if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB2(GetCapabilities,
-            jvmti, &caps)))
+    if (!NSK_JVMTI_VERIFY(jvmti->GetCapabilities(&caps)))
         return JNI_ERR;
     if (!caps.can_generate_native_method_bind_events)
         NSK_DISPLAY0("Warning: generation of native method bind events is not implemented\n");
@@ -211,13 +201,13 @@
     NSK_DISPLAY0("setting event callbacks ...\n");
     (void) memset(&callbacks, 0, sizeof(callbacks));
     callbacks.NativeMethodBind = &NativeMethodBind;
-    if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB3(SetEventCallbacks,
-            jvmti, &callbacks, sizeof(callbacks))))
+    if (!NSK_JVMTI_VERIFY(jvmti->SetEventCallbacks(&callbacks, sizeof(callbacks))))
         return JNI_ERR;
 
     NSK_DISPLAY0("setting event callbacks done\nenabling JVMTI events ...\n");
-    if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB4(SetEventNotificationMode,
-            jvmti, JVMTI_ENABLE, JVMTI_EVENT_NATIVE_METHOD_BIND, NULL)))
+    if (!NSK_JVMTI_VERIFY(jvmti->SetEventNotificationMode(JVMTI_ENABLE,
+                                                          JVMTI_EVENT_NATIVE_METHOD_BIND,
+                                                          NULL)))
         return JNI_ERR;
     NSK_DISPLAY0("enabling the events done\n\n");
 
--- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/ObjectFree/objfree001/objfree001.cpp	Fri Oct 05 17:01:07 2018 -0400
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/ObjectFree/objfree001/objfree001.cpp	Tue Oct 09 14:37:59 2018 +0200
@@ -62,8 +62,7 @@
 
     NSK_DISPLAY1("%s: creating a raw monitor ...\n",
         msg);
-    if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB3(CreateRawMonitor,
-            jvmti_env, "_lock", &_lock))) {
+    if (!NSK_JVMTI_VERIFY(jvmti_env->CreateRawMonitor("_lock", &_lock))) {
         result = STATUS_FAILED;
         NSK_COMPLAIN1("TEST FAILED: %s: unable to create a raw monitor\n\n",
             msg);
@@ -74,8 +73,7 @@
 
     NSK_DISPLAY1("%s: entering the raw monitor ...\n",
         msg);
-    if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB2(RawMonitorEnter,
-            jvmti_env, _lock))) {
+    if (!NSK_JVMTI_VERIFY(jvmti_env->RawMonitorEnter(_lock))) {
         result = STATUS_FAILED;
         NSK_COMPLAIN1("TEST FAILED: %s: unable to enter the raw monitor\n\n",
             msg);
@@ -86,8 +84,7 @@
 
         NSK_DISPLAY1("%s: exiting the raw monitor ...\n",
             msg);
-        if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB2(RawMonitorExit,
-                jvmti_env, _lock))) {
+        if (!NSK_JVMTI_VERIFY(jvmti_env->RawMonitorExit(_lock))) {
             result = STATUS_FAILED;
             NSK_COMPLAIN1("TEST FAILED: %s: unable to exit the raw monitor\n\n",
                 msg);
@@ -98,8 +95,7 @@
 
     NSK_DISPLAY1("%s: destroying the raw monitor ...\n",
         msg);
-    if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB2(DestroyRawMonitor,
-            jvmti_env, _lock))) {
+    if (!NSK_JVMTI_VERIFY(jvmti_env->DestroyRawMonitor(_lock))) {
         result = STATUS_FAILED;
         NSK_COMPLAIN1("TEST FAILED: %s: unable to destroy a raw monitor\n",
             msg);
@@ -112,8 +108,7 @@
 static void memoryFunc(jvmtiEnv *jvmti_env, const char *msg) {
     NSK_DISPLAY1("%s: allocating memory ...\n",
         msg);
-    if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB3(Allocate,
-            jvmti_env, MEM_SIZE, &mem))) {
+    if (!NSK_JVMTI_VERIFY(jvmti_env->Allocate(MEM_SIZE, &mem))) {
         result = STATUS_FAILED;
         NSK_COMPLAIN1("TEST FAILED: %s: unable to allocate memory\n\n",
             msg);
@@ -125,8 +120,7 @@
 
     NSK_DISPLAY1("%s: deallocating memory ...\n",
         msg);
-    if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB2(Deallocate,
-            jvmti_env, mem))) {
+    if (!NSK_JVMTI_VERIFY(jvmti_env->Deallocate(mem))) {
         result = STATUS_FAILED;
         NSK_COMPLAIN1("TEST FAILED: %s: unable to deallocate memory\n\n",
             msg);
@@ -142,8 +136,7 @@
 
     NSK_DISPLAY2("%s: setting an environment local storage 0x%p ...\n",
         msg, (void*) &stor);
-    if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB2(SetEnvironmentLocalStorage,
-            jvmti_env, (const void*) &stor))) {
+    if (!NSK_JVMTI_VERIFY(jvmti_env->SetEnvironmentLocalStorage((const void*) &stor))) {
         result = STATUS_FAILED;
         NSK_COMPLAIN1("TEST FAILED: %s: unable to set an environment local storage\n\n",
             msg);
@@ -155,8 +148,7 @@
 
     NSK_DISPLAY1("%s: getting an environment local storage ...\n",
         msg);
-    if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB2(GetEnvironmentLocalStorage,
-            jvmti_env, (void**) &obtainedData))) {
+    if (!NSK_JVMTI_VERIFY(jvmti_env->GetEnvironmentLocalStorage((void**) &obtainedData))) {
         result = STATUS_FAILED;
         NSK_COMPLAIN1("TEST FAILED: %s: unable to get an environment local storage\n\n",
             msg);
@@ -229,8 +221,7 @@
 
 JNIEXPORT void JNICALL
 Java_nsk_jvmti_ObjectFree_objfree001_setTag(JNIEnv *jni_env, jobject obj, jobject objToTag) {
-    if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB3(SetTag,
-            jvmti, objToTag, (jlong) 1))) {
+    if (!NSK_JVMTI_VERIFY(jvmti->SetTag(objToTag, (jlong) 1))) {
         result = STATUS_FAILED;
         NSK_COMPLAIN0("TEST FAILED: unable to set tag for a tested object\n");
     }
@@ -269,12 +260,10 @@
     memset(&caps, 0, sizeof(jvmtiCapabilities));
     caps.can_generate_object_free_events = 1;
     caps.can_tag_objects = 1;
-    if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB2(AddCapabilities,
-            jvmti, &caps)))
+    if (!NSK_JVMTI_VERIFY(jvmti->AddCapabilities(&caps)))
         return JNI_ERR;
 
-    if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB2(GetCapabilities,
-            jvmti, &caps)))
+    if (!NSK_JVMTI_VERIFY(jvmti->GetCapabilities(&caps)))
         return JNI_ERR;
 
     if (!caps.can_generate_object_free_events)
@@ -287,16 +276,17 @@
     (void) memset(&callbacks, 0, sizeof(callbacks));
     callbacks.VMDeath = &VMDeath;
     callbacks.ObjectFree = &ObjectFree;
-    if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB3(SetEventCallbacks,
-            jvmti, &callbacks, sizeof(callbacks))))
+    if (!NSK_JVMTI_VERIFY(jvmti->SetEventCallbacks(&callbacks, sizeof(callbacks))))
         return JNI_ERR;
 
     NSK_DISPLAY0("setting event callbacks done\nenabling JVMTI events ...\n");
-    if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB4(SetEventNotificationMode,
-            jvmti, JVMTI_ENABLE, JVMTI_EVENT_VM_DEATH, NULL)))
+    if (!NSK_JVMTI_VERIFY(jvmti->SetEventNotificationMode(JVMTI_ENABLE,
+                                                          JVMTI_EVENT_VM_DEATH,
+                                                          NULL)))
         return JNI_ERR;
-    if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB4(SetEventNotificationMode,
-            jvmti, JVMTI_ENABLE, JVMTI_EVENT_OBJECT_FREE, NULL)))
+    if (!NSK_JVMTI_VERIFY(jvmti->SetEventNotificationMode(JVMTI_ENABLE,
+                                                          JVMTI_EVENT_OBJECT_FREE,
+                                                          NULL)))
         return JNI_ERR;
     NSK_DISPLAY0("enabling the events done\n\n");
 
--- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/ObjectFree/objfree002/objfree002.cpp	Fri Oct 05 17:01:07 2018 -0400
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/ObjectFree/objfree002/objfree002.cpp	Tue Oct 09 14:37:59 2018 +0200
@@ -59,8 +59,7 @@
 
     NSK_DISPLAY1("%s: creating a raw monitor ...\n",
         msg);
-    if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB3(CreateRawMonitor,
-            jvmti_env, "_lock", &_lock))) {
+    if (!NSK_JVMTI_VERIFY(jvmti_env->CreateRawMonitor("_lock", &_lock))) {
         result = STATUS_FAILED;
         NSK_COMPLAIN1("TEST FAILED: %s: unable to create a raw monitor\n\n",
             msg);
@@ -71,8 +70,7 @@
 
     NSK_DISPLAY1("%s: entering the raw monitor ...\n",
         msg);
-    if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB2(RawMonitorEnter,
-            jvmti_env, _lock))) {
+    if (!NSK_JVMTI_VERIFY(jvmti_env->RawMonitorEnter(_lock))) {
         result = STATUS_FAILED;
         NSK_COMPLAIN1("TEST FAILED: %s: unable to enter the raw monitor\n\n",
             msg);
@@ -83,8 +81,7 @@
 
         NSK_DISPLAY1("%s: waiting the raw monitor ...\n",
             msg);
-        if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB3(RawMonitorWait,
-                jvmti_env, _lock, (jlong)10))) {
+        if (!NSK_JVMTI_VERIFY(jvmti_env->RawMonitorWait(_lock, (jlong)10))) {
             result = STATUS_FAILED;
             NSK_COMPLAIN1("TEST FAILED: %s: unable to wait the raw monitor\n\n",
                 msg);
@@ -95,8 +92,7 @@
 
         NSK_DISPLAY1("%s: notifying a single thread waiting on the raw monitor ...\n",
             msg);
-        if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB2(RawMonitorNotify,
-                jvmti_env, _lock))) {
+        if (!NSK_JVMTI_VERIFY(jvmti_env->RawMonitorNotify(_lock))) {
             result = STATUS_FAILED;
             NSK_COMPLAIN1("TEST FAILED: %s: unable to notify single thread\n\n",
                 msg);
@@ -107,8 +103,7 @@
 
         NSK_DISPLAY1("%s: notifying all threads waiting on the raw monitor ...\n",
             msg);
-        if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB2(RawMonitorNotifyAll,
-                jvmti_env, _lock))) {
+        if (!NSK_JVMTI_VERIFY(jvmti_env->RawMonitorNotifyAll(_lock))) {
             result = STATUS_FAILED;
             NSK_COMPLAIN1("TEST FAILED: %s: unable to notify all threads\n\n",
                 msg);
@@ -119,8 +114,7 @@
 
         NSK_DISPLAY1("%s: exiting the raw monitor ...\n",
             msg);
-        if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB2(RawMonitorExit,
-                jvmti_env, _lock))) {
+        if (!NSK_JVMTI_VERIFY(jvmti_env->RawMonitorExit(_lock))) {
             result = STATUS_FAILED;
             NSK_COMPLAIN1("TEST FAILED: %s: unable to exit the raw monitor\n\n",
                 msg);
@@ -131,8 +125,7 @@
 
     NSK_DISPLAY1("%s: destroying the raw monitor ...\n",
         msg);
-    if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB2(DestroyRawMonitor,
-            jvmti_env, _lock))) {
+    if (!NSK_JVMTI_VERIFY(jvmti_env->DestroyRawMonitor(_lock))) {
         result = STATUS_FAILED;
         NSK_COMPLAIN1("TEST FAILED: %s: unable to destroy a raw monitor\n",
             msg);
@@ -145,8 +138,7 @@
 static void memoryFunc(jvmtiEnv *jvmti_env, const char *msg) {
     NSK_DISPLAY1("%s: allocating memory ...\n",
         msg);
-    if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB3(Allocate,
-            jvmti_env, MEM_SIZE, &mem))) {
+    if (!NSK_JVMTI_VERIFY(jvmti_env->Allocate(MEM_SIZE, &mem))) {
         result = STATUS_FAILED;
         NSK_COMPLAIN1("TEST FAILED: %s: unable to allocate memory\n\n",
             msg);
@@ -158,8 +150,7 @@
 
     NSK_DISPLAY1("%s: deallocating memory ...\n",
         msg);
-    if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB2(Deallocate,
-            jvmti_env, mem))) {
+    if (!NSK_JVMTI_VERIFY(jvmti_env->Deallocate(mem))) {
         result = STATUS_FAILED;
         NSK_COMPLAIN1("TEST FAILED: %s: unable to deallocate memory\n\n",
             msg);
@@ -175,8 +166,7 @@
 
     NSK_DISPLAY2("%s: setting an environment local storage 0x%p ...\n",
         msg, (void*) &stor);
-    if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB2(SetEnvironmentLocalStorage,
-            jvmti_env, (const void*) &stor))) {
+    if (!NSK_JVMTI_VERIFY(jvmti_env->SetEnvironmentLocalStorage((const void*) &stor))) {
         result = STATUS_FAILED;
         NSK_COMPLAIN1("TEST FAILED: %s: unable to set an environment local storage\n\n",
             msg);
@@ -188,8 +178,7 @@
 
     NSK_DISPLAY1("%s: getting an environment local storage ...\n",
         msg);
-    if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB2(GetEnvironmentLocalStorage,
-            jvmti_env, (void**) &obtainedData))) {
+    if (!NSK_JVMTI_VERIFY(jvmti_env->GetEnvironmentLocalStorage((void**) &obtainedData))) {
         result = STATUS_FAILED;
         NSK_COMPLAIN1("TEST FAILED: %s: unable to get an environment local storage\n\n",
             msg);
@@ -249,8 +238,7 @@
     if ((num % 2) == 0) {
         NSK_DISPLAY2("Setting the tag \"%ld\" for object #%d\n",
             (long) num, num);
-        if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB3(SetTag,
-                jvmti, objToTag, (jlong) num))) {
+        if (!NSK_JVMTI_VERIFY(jvmti->SetTag(objToTag, (jlong) num))) {
             result = STATUS_FAILED;
             NSK_COMPLAIN1("TEST FAILED: unable to set tag for object #%d\n",
                 num);
@@ -292,12 +280,10 @@
     memset(&caps, 0, sizeof(jvmtiCapabilities));
     caps.can_generate_object_free_events = 1;
     caps.can_tag_objects = 1;
-    if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB2(AddCapabilities,
-            jvmti, &caps)))
+    if (!NSK_JVMTI_VERIFY(jvmti->AddCapabilities(&caps)))
         return JNI_ERR;
 
-    if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB2(GetCapabilities,
-            jvmti, &caps)))
+    if (!NSK_JVMTI_VERIFY(jvmti->GetCapabilities(&caps)))
         return JNI_ERR;
 
     if (!caps.can_generate_object_free_events)
@@ -310,16 +296,17 @@
     (void) memset(&callbacks, 0, sizeof(callbacks));
     callbacks.VMDeath = &VMDeath;
     callbacks.ObjectFree = &ObjectFree;
-    if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB3(SetEventCallbacks,
-            jvmti, &callbacks, sizeof(callbacks))))
+    if (!NSK_JVMTI_VERIFY(jvmti->SetEventCallbacks(&callbacks, sizeof(callbacks))))
         return JNI_ERR;
 
     NSK_DISPLAY0("setting event callbacks done\nenabling JVMTI events ...\n");
-    if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB4(SetEventNotificationMode,
-            jvmti, JVMTI_ENABLE, JVMTI_EVENT_VM_DEATH, NULL)))
+    if (!NSK_JVMTI_VERIFY(jvmti->SetEventNotificationMode(JVMTI_ENABLE,
+                                                          JVMTI_EVENT_VM_DEATH,
+                                                          NULL)))
         return JNI_ERR;
-    if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB4(SetEventNotificationMode,
-            jvmti, JVMTI_ENABLE, JVMTI_EVENT_OBJECT_FREE, NULL)))
+    if (!NSK_JVMTI_VERIFY(jvmti->SetEventNotificationMode(JVMTI_ENABLE,
+                                                          JVMTI_EVENT_OBJECT_FREE,
+                                                          NULL)))
         return JNI_ERR;
     NSK_DISPLAY0("enabling the events done\n\n");
 
--- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/PopFrame/popframe005/popframe005.cpp	Fri Oct 05 17:01:07 2018 -0400
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/PopFrame/popframe005/popframe005.cpp	Tue Oct 09 14:37:59 2018 +0200
@@ -33,12 +33,7 @@
 // Deallocate memory region allocated by VM
 #define DEALLOCATE(p) \
     if (p != NULL)                 \
-        if (!NSK_JVMTI_VERIFY(     \
-                    NSK_CPP_STUB2( \
-                        Deallocate \
-                        , jvmti    \
-                        , p        \
-                        )))        \
+        if (!NSK_JVMTI_VERIFY(jvmti->Deallocate(p)))        \
         {                          \
             NSK_COMPLAIN0("Failed to deallocate: ##p##\n"); \
         }
@@ -101,49 +96,22 @@
         int failure = 1;
 
         do {
-            if (!NSK_JVMTI_VERIFY(
-                    NSK_CPP_STUB3(
-                        GetThreadInfo
-                        , jvmti
-                        , thread
-                        , &thr_info
-                        )))
-            {
-                break;
-            }
-
-            if (!NSK_JVMTI_VERIFY(
-                    NSK_CPP_STUB3(
-                        GetMethodDeclaringClass
-                        , jvmti
-                        , method
-                        , &klass
-                        )))
+            if (!NSK_JVMTI_VERIFY(jvmti->GetThreadInfo(thread, &thr_info)))
             {
                 break;
             }
 
-            if (!NSK_JVMTI_VERIFY(
-                    NSK_CPP_STUB4(
-                        GetClassSignature
-                        , jvmti
-                        , klass
-                        , &class_signature
-                        , NULL
-                        )))
+            if (!NSK_JVMTI_VERIFY(jvmti->GetMethodDeclaringClass(method, &klass)))
             {
                 break;
             }
 
-            if (!NSK_JVMTI_VERIFY(
-                    NSK_CPP_STUB5(
-                        GetMethodName
-                        , jvmti
-                        , method
-                        , &entry_name
-                        , &entry_sig
-                        , NULL
-                        )))
+            if (!NSK_JVMTI_VERIFY(jvmti->GetClassSignature(klass, &class_signature, NULL)))
+            {
+                break;
+            }
+
+            if (!NSK_JVMTI_VERIFY(jvmti->GetMethodName(method, &entry_name, &entry_sig, NULL)))
             {
                 break;
             }
@@ -181,12 +149,7 @@
 
     NSK_DISPLAY0(">>>>>>>> Invoke SuspendThread()\n");
 
-    if (!NSK_JVMTI_VERIFY(
-            NSK_CPP_STUB2(
-                SuspendThread
-                , jvmti
-                , suspendedThread
-                )))
+    if (!NSK_JVMTI_VERIFY(jvmti->SuspendThread(suspendedThread)))
     {
         return JNI_FALSE;
     }
@@ -203,12 +166,7 @@
 
     NSK_DISPLAY0(">>>>>>>> Invoke ResumeThread()\n");
 
-    if (!NSK_JVMTI_VERIFY(
-            NSK_CPP_STUB2(
-                ResumeThread
-                , jvmti
-                , suspendedThread
-                )))
+    if (!NSK_JVMTI_VERIFY(jvmti->ResumeThread(suspendedThread)))
     {
         return JNI_FALSE;
     }
@@ -234,25 +192,13 @@
     }
 
     if (!NSK_JVMTI_VERIFY(
-            NSK_CPP_STUB4(
-                SetEventNotificationMode
-                , jvmti
-                , JVMTI_ENABLE
-                , JVMTI_EVENT_METHOD_EXIT
-                , frameThr
-                )))
+            jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_METHOD_EXIT, frameThr)))
     {
         result = JNI_FALSE;
     }
 
     if (!NSK_JVMTI_VERIFY(
-            NSK_CPP_STUB4(
-                SetEventNotificationMode
-                , jvmti
-                , JVMTI_ENABLE
-                , JVMTI_EVENT_FRAME_POP
-                , frameThr
-                )))
+            jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_FRAME_POP, frameThr)))
     {
         result = JNI_FALSE;
     }
@@ -261,12 +207,7 @@
 
     set_watch_jvmti_events(1); /* watch JVMTI events */
 
-    if (!NSK_JVMTI_VERIFY(
-            NSK_CPP_STUB2(
-                PopFrame
-                , jvmti
-                , frameThr
-                )))
+    if (!NSK_JVMTI_VERIFY(jvmti->PopFrame(frameThr)))
     {
         result = JNI_FALSE;
     } else {
@@ -319,32 +260,17 @@
         return JNI_ERR;
     }
 
-    if (!NSK_JVMTI_VERIFY(
-            NSK_CPP_STUB2(
-                GetPotentialCapabilities
-                , jvmti
-                , &caps
-                )))
+    if (!NSK_JVMTI_VERIFY(jvmti->GetPotentialCapabilities(&caps)))
     {
         return JNI_ERR;
     }
 
-    if (!NSK_JVMTI_VERIFY(
-            NSK_CPP_STUB2(
-                AddCapabilities
-                , jvmti
-                , &caps
-                )))
+    if (!NSK_JVMTI_VERIFY(jvmti->AddCapabilities(&caps)))
     {
         return JNI_ERR;
     }
 
-    if (!NSK_JVMTI_VERIFY(
-            NSK_CPP_STUB2(
-                GetCapabilities
-                , jvmti
-                , &caps
-                )))
+    if (!NSK_JVMTI_VERIFY(jvmti->GetCapabilities(&caps)))
     {
         return JNI_ERR;
     }
@@ -365,12 +291,7 @@
         callbacks.MethodExit = &MethodExit;
         callbacks.FramePop = &FramePop;
 
-        if (!NSK_JVMTI_VERIFY(
-                NSK_CPP_STUB3(
-                    SetEventCallbacks
-                    , jvmti
-                    , &callbacks
-                    , sizeof(callbacks)
+        if (!NSK_JVMTI_VERIFY(jvmti->SetEventCallbacks(&callbacks, sizeof(callbacks)
                     )))
         {
             return JNI_ERR;
--- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/RedefineClasses/redefclass028/redefclass028.cpp	Fri Oct 05 17:01:07 2018 -0400
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/RedefineClasses/redefclass028/redefclass028.cpp	Tue Oct 09 14:37:59 2018 +0200
@@ -86,9 +86,9 @@
         (JNIEnv *jni_env, jclass cls, jbyteArray classBytes) {
     jboolean isCopy;
 
-    bytesCount = NSK_CPP_STUB2(GetArrayLength, jni_env, classBytes);
+    bytesCount = jni_env->GetArrayLength(classBytes);
     clsBytes =
-        NSK_CPP_STUB3(GetByteArrayElements, jni_env, classBytes, &isCopy);
+        jni_env->GetByteArrayElements(classBytes, &isCopy);
 }
 
 /** callback functions **/
@@ -100,8 +100,7 @@
     char *sig;
 
     NSK_DISPLAY0("CompiledMethodLoad event received for:\n");
-    if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB5(GetMethodName,
-            jvmti_env, method, &name, &sig, NULL))) {
+    if (!NSK_JVMTI_VERIFY(jvmti_env->GetMethodName(method, &name, &sig, NULL))) {
         nsk_jvmti_setFailStatus();
         return;
     }
@@ -138,8 +137,8 @@
     if (err == JVMTI_ERROR_NONE) {
         NSK_DISPLAY3("for: \tmethod: name=\"%s\" signature=\"%s\"\n\tnative address=0x%p\n",
           name, sig, code_addr);
-        NSK_CPP_STUB2(Deallocate, jvmti_env, (unsigned char*)name);
-        NSK_CPP_STUB2(Deallocate, jvmti_env, (unsigned char*)sig);
+        jvmti_env->Deallocate((unsigned char*)name);
+        jvmti_env->Deallocate((unsigned char*)sig);
     }
 }
 /************************/
@@ -163,8 +162,7 @@
 
     /* at first, send all generated CompiledMethodLoad events */
     NSK_DISPLAY0("agentProc: sending all generated CompiledMethodLoad events ...\n\n");
-    if (!NSK_JVMTI_VERIFY(
-            NSK_CPP_STUB2(GenerateEvents, jvmti, JVMTI_EVENT_COMPILED_METHOD_LOAD))) {
+    if (!NSK_JVMTI_VERIFY(jvmti->GenerateEvents(JVMTI_EVENT_COMPILED_METHOD_LOAD))) {
         nsk_jvmti_setFailStatus();
         nsk_jvmti_resumeSync();
         return;
@@ -185,14 +183,12 @@
 
     NSK_DISPLAY0("agentProc: hotspot method compiled\n\n");
 
-    if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB3(GetMethodDeclaringClass,
-                                        jvmti_env, hsMethodID, &decl_cls))) {
+    if (!NSK_JVMTI_VERIFY(jvmti_env->GetMethodDeclaringClass(hsMethodID, &decl_cls))) {
         nsk_jvmti_setFailStatus();
         nsk_jvmti_resumeSync();
         return;
     }
-    if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB4(GetClassSignature,
-                                        jvmti_env, decl_cls, &cls_sig, NULL))) {
+    if (!NSK_JVMTI_VERIFY(jvmti_env->GetClassSignature(decl_cls, &cls_sig, NULL))) {
         nsk_jvmti_setFailStatus();
         nsk_jvmti_resumeSync();
         return;
@@ -209,8 +205,7 @@
     NSK_DISPLAY1("agentProc: >>>>>>>> Invoke RedefineClasses():\n"
                  "\tnew class byte count=%d\n",
                  classDef.class_byte_count);
-    if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB3(RedefineClasses,
-                                        jvmti, 1, &classDef))) {
+    if (!NSK_JVMTI_VERIFY(jvmti->RedefineClasses(1, &classDef))) {
         nsk_jvmti_setFailStatus();
         nsk_jvmti_resumeSync();
         return;
@@ -261,8 +256,7 @@
     memset(&caps, 0, sizeof(jvmtiCapabilities));
     caps.can_generate_compiled_method_load_events = 1;
     caps.can_redefine_classes = 1;
-    if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB2(AddCapabilities,
-            jvmti, &caps)))
+    if (!NSK_JVMTI_VERIFY(jvmti->AddCapabilities(&caps)))
         return JNI_ERR;
 
     /* set event callback */
@@ -270,8 +264,7 @@
     (void) memset(&callbacks, 0, sizeof(callbacks));
     callbacks.CompiledMethodLoad = &CompiledMethodLoad;
     callbacks.CompiledMethodUnload = &CompiledMethodUnload;
-    if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB3(SetEventCallbacks,
-            jvmti, &callbacks, sizeof(callbacks))))
+    if (!NSK_JVMTI_VERIFY(jvmti->SetEventCallbacks(&callbacks, sizeof(callbacks))))
         return JNI_ERR;
 
     NSK_DISPLAY0("setting event callbacks done\nenabling events ...\n");
--- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/RedefineClasses/redefclass029/redefclass029.cpp	Fri Oct 05 17:01:07 2018 -0400
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/RedefineClasses/redefclass029/redefclass029.cpp	Tue Oct 09 14:37:59 2018 +0200
@@ -85,9 +85,9 @@
         (JNIEnv *jni_env, jclass cls, jbyteArray classBytes) {
     jboolean isCopy;
 
-    bytesCount = NSK_CPP_STUB2(GetArrayLength, jni_env, classBytes);
+    bytesCount = jni_env->GetArrayLength(classBytes);
     clsBytes =
-        NSK_CPP_STUB3(GetByteArrayElements, jni_env, classBytes, &isCopy);
+        jni_env->GetByteArrayElements(classBytes, &isCopy);
 }
 
 /** callback functions **/
@@ -99,8 +99,7 @@
     char *sig;
 
     NSK_DISPLAY0("CompiledMethodLoad event received for:\n");
-    if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB5(GetMethodName,
-            jvmti_env, method, &name, &sig, NULL))) {
+    if (!NSK_JVMTI_VERIFY(jvmti_env->GetMethodName(method, &name, &sig, NULL))) {
         nsk_jvmti_setFailStatus();
         return;
     }
@@ -137,8 +136,8 @@
     if (err == JVMTI_ERROR_NONE) {
         NSK_DISPLAY3("for: \tmethod: name=\"%s\" signature=\"%s\"\n\tnative address=0x%p\n",
           name, sig, code_addr);
-        NSK_CPP_STUB2(Deallocate, jvmti_env, (unsigned char*)name);
-        NSK_CPP_STUB2(Deallocate, jvmti_env, (unsigned char*)sig);
+        jvmti_env->Deallocate((unsigned char*)name);
+        jvmti_env->Deallocate((unsigned char*)sig);
     }
 }
 /************************/
@@ -162,8 +161,7 @@
 
     /* at first, send all generated CompiledMethodLoad events */
     NSK_DISPLAY0("agentProc: sending all generated CompiledMethodLoad events ...\n\n");
-    if (!NSK_JVMTI_VERIFY(
-            NSK_CPP_STUB2(GenerateEvents, jvmti, JVMTI_EVENT_COMPILED_METHOD_LOAD))) {
+    if (!NSK_JVMTI_VERIFY(jvmti->GenerateEvents(JVMTI_EVENT_COMPILED_METHOD_LOAD))) {
         nsk_jvmti_setFailStatus();
         nsk_jvmti_resumeSync();
         return;
@@ -184,14 +182,12 @@
 
     NSK_DISPLAY0("agentProc: hotspot method compiled\n\n");
 
-    if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB3(GetMethodDeclaringClass,
-                                        jvmti_env, hsMethodID, &decl_cls))) {
+    if (!NSK_JVMTI_VERIFY(jvmti_env->GetMethodDeclaringClass(hsMethodID, &decl_cls))) {
         nsk_jvmti_setFailStatus();
         nsk_jvmti_resumeSync();
         return;
     }
-    if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB4(GetClassSignature,
-                                        jvmti_env, decl_cls, &cls_sig, NULL))) {
+    if (!NSK_JVMTI_VERIFY(jvmti_env->GetClassSignature(decl_cls, &cls_sig, NULL))) {
         nsk_jvmti_setFailStatus();
         nsk_jvmti_resumeSync();
         return;
@@ -208,8 +204,7 @@
     NSK_DISPLAY1("agentProc: >>>>>>>> Invoke RedefineClasses():\n"
                  "\tnew class byte count=%d\n",
                  classDef.class_byte_count);
-    if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB3(RedefineClasses,
-                                        jvmti, 1, &classDef))) {
+    if (!NSK_JVMTI_VERIFY(jvmti->RedefineClasses(1, &classDef))) {
       nsk_jvmti_setFailStatus();
       nsk_jvmti_resumeSync();
       return;
@@ -260,8 +255,7 @@
     memset(&caps, 0, sizeof(jvmtiCapabilities));
     caps.can_generate_compiled_method_load_events = 1;
     caps.can_redefine_classes = 1;
-    if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB2(AddCapabilities,
-            jvmti, &caps)))
+    if (!NSK_JVMTI_VERIFY(jvmti->AddCapabilities(&caps)))
         return JNI_ERR;
 
     /* set event callback */
@@ -269,8 +263,7 @@
     (void) memset(&callbacks, 0, sizeof(callbacks));
     callbacks.CompiledMethodLoad = &CompiledMethodLoad;
     callbacks.CompiledMethodUnload = &CompiledMethodUnload;
-    if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB3(SetEventCallbacks,
-            jvmti, &callbacks, sizeof(callbacks))))
+    if (!NSK_JVMTI_VERIFY(jvmti->SetEventCallbacks(&callbacks, sizeof(callbacks))))
         return JNI_ERR;
 
     NSK_DISPLAY0("setting event callbacks done\nenabling events ...\n");
--- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/RedefineClasses/redefclass030/redefclass030.cpp	Fri Oct 05 17:01:07 2018 -0400
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/RedefineClasses/redefclass030/redefclass030.cpp	Tue Oct 09 14:37:59 2018 +0200
@@ -86,9 +86,9 @@
         (JNIEnv *jni_env, jclass cls, jbyteArray classBytes) {
     jboolean isCopy;
 
-    bytesCount = NSK_CPP_STUB2(GetArrayLength, jni_env, classBytes);
+    bytesCount = jni_env->GetArrayLength(classBytes);
     clsBytes =
-        NSK_CPP_STUB3(GetByteArrayElements, jni_env, classBytes, &isCopy);
+        jni_env->GetByteArrayElements(classBytes, &isCopy);
 }
 
 /** callback functions **/
@@ -100,8 +100,7 @@
     char *sig;
 
     NSK_DISPLAY0("CompiledMethodLoad event received for:\n");
-    if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB5(GetMethodName,
-            jvmti_env, method, &name, &sig, NULL))) {
+    if (!NSK_JVMTI_VERIFY(jvmti_env->GetMethodName(method, &name, &sig, NULL))) {
         nsk_jvmti_setFailStatus();
         return;
     }
@@ -138,8 +137,8 @@
     if (err == JVMTI_ERROR_NONE) {
         NSK_DISPLAY3("for: \tmethod: name=\"%s\" signature=\"%s\"\n\tnative address=0x%p\n",
           name, sig, code_addr);
-        NSK_CPP_STUB2(Deallocate, jvmti_env, (unsigned char*)name);
-        NSK_CPP_STUB2(Deallocate, jvmti_env, (unsigned char*)sig);
+        jvmti_env->Deallocate((unsigned char*)name);
+        jvmti_env->Deallocate((unsigned char*)sig);
     }
 }
 /************************/
@@ -163,8 +162,7 @@
 
     /* at first, send all generated CompiledMethodLoad events */
     NSK_DISPLAY0("agentProc: sending all generated CompiledMethodLoad events ...\n\n");
-    if (!NSK_JVMTI_VERIFY(
-            NSK_CPP_STUB2(GenerateEvents, jvmti, JVMTI_EVENT_COMPILED_METHOD_LOAD))) {
+    if (!NSK_JVMTI_VERIFY(jvmti->GenerateEvents(JVMTI_EVENT_COMPILED_METHOD_LOAD))) {
         nsk_jvmti_setFailStatus();
         nsk_jvmti_resumeSync();
         return;
@@ -185,14 +183,12 @@
 
     NSK_DISPLAY0("agentProc: hotspot method compiled\n\n");
 
-    if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB3(GetMethodDeclaringClass,
-                                        jvmti_env, hsMethodID, &decl_cls))) {
+    if (!NSK_JVMTI_VERIFY(jvmti_env->GetMethodDeclaringClass(hsMethodID, &decl_cls))) {
         nsk_jvmti_setFailStatus();
         nsk_jvmti_resumeSync();
         return;
     }
-    if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB4(GetClassSignature,
-                                        jvmti_env, decl_cls, &cls_sig, NULL))) {
+    if (!NSK_JVMTI_VERIFY(jvmti_env->GetClassSignature(decl_cls, &cls_sig, NULL))) {
         nsk_jvmti_setFailStatus();
         nsk_jvmti_resumeSync();
         return;
@@ -209,8 +205,7 @@
     NSK_DISPLAY1("agentProc: >>>>>>>> Invoke RedefineClasses():\n"
                  "\tnew class byte count=%d\n",
                  classDef.class_byte_count);
-    if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB3(RedefineClasses,
-                                        jvmti, 1, &classDef))) {
+    if (!NSK_JVMTI_VERIFY(jvmti->RedefineClasses(1, &classDef))) {
       nsk_jvmti_setFailStatus();
       nsk_jvmti_resumeSync();
       return;
@@ -261,8 +256,7 @@
     memset(&caps, 0, sizeof(jvmtiCapabilities));
     caps.can_generate_compiled_method_load_events = 1;
     caps.can_redefine_classes = 1;
-    if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB2(AddCapabilities,
-            jvmti, &caps)))
+    if (!NSK_JVMTI_VERIFY(jvmti->AddCapabilities(&caps)))
         return JNI_ERR;
 
     /* set event callback */
@@ -270,8 +264,7 @@
     (void) memset(&callbacks, 0, sizeof(callbacks));
     callbacks.CompiledMethodLoad = &CompiledMethodLoad;
     callbacks.CompiledMethodUnload = &CompiledMethodUnload;
-    if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB3(SetEventCallbacks,
-            jvmti, &callbacks, sizeof(callbacks))))
+    if (!NSK_JVMTI_VERIFY(jvmti->SetEventCallbacks(&callbacks, sizeof(callbacks))))
         return JNI_ERR;
 
     NSK_DISPLAY0("setting event callbacks done\nenabling events ...\n");
--- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/RelinquishCapabilities/relcaps001/relcaps001.cpp	Fri Oct 05 17:01:07 2018 -0400
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/RelinquishCapabilities/relcaps001/relcaps001.cpp	Tue Oct 09 14:37:59 2018 +0200
@@ -193,8 +193,7 @@
     memset(&caps, 0, sizeof(jvmtiCapabilities));
 
     NSK_DISPLAY0("GetCapabilities() for current JVMTI env\n");
-    if (!NSK_JVMTI_VERIFY(
-            NSK_CPP_STUB2(GetCapabilities, jvmti, &caps))) {
+    if (!NSK_JVMTI_VERIFY(jvmti->GetCapabilities(&caps))) {
         return NSK_FALSE;
     }
 
@@ -217,8 +216,7 @@
  */
 static int addCapabilities(jvmtiEnv* jvmti, jvmtiCapabilities* caps) {
     NSK_DISPLAY0("AddCapabilities() for current JVMTI env\n");
-    if (!NSK_JVMTI_VERIFY(
-            NSK_CPP_STUB2(AddCapabilities, jvmti, caps))) {
+    if (!NSK_JVMTI_VERIFY(jvmti->AddCapabilities(caps))) {
         return NSK_FALSE;
     }
     NSK_DISPLAY0("  ... set\n");
@@ -232,8 +230,7 @@
  */
 static int removeCapabilities(jvmtiEnv* jvmti, jvmtiCapabilities* caps, const char where[]) {
     NSK_DISPLAY0("RelinquishCapabilities() for current JVMTI env\n");
-    if (!NSK_JVMTI_VERIFY(
-            NSK_CPP_STUB2(RelinquishCapabilities, jvmti, caps))) {
+    if (!NSK_JVMTI_VERIFY(jvmti->RelinquishCapabilities(caps))) {
         return NSK_FALSE;
     }
     NSK_DISPLAY0("  ... relinguished\n");
@@ -247,8 +244,7 @@
  */
 static int getPotentialCapabilities(jvmtiEnv* jvmti, jvmtiCapabilities* caps) {
     NSK_DISPLAY0("GetPotentialCapabilities() for current JVMTI env\n");
-    if (!NSK_JVMTI_VERIFY(
-            NSK_CPP_STUB2(GetPotentialCapabilities, jvmti, caps))) {
+    if (!NSK_JVMTI_VERIFY(jvmti->GetPotentialCapabilities(caps))) {
         return NSK_FALSE;
     }
 
@@ -350,9 +346,7 @@
         memset(&eventCallbacks, 0, sizeof(eventCallbacks));
         eventCallbacks.VMInit = callbackVMInit;
         eventCallbacks.VMDeath = callbackVMDeath;
-        if (!NSK_JVMTI_VERIFY(
-                NSK_CPP_STUB3(SetEventCallbacks, jvmti,
-                                    &eventCallbacks, sizeof(eventCallbacks)))) {
+        if (!NSK_JVMTI_VERIFY(jvmti->SetEventCallbacks(&eventCallbacks, sizeof(eventCallbacks)))) {
             return JNI_ERR;
         }
 
--- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/RelinquishCapabilities/relcaps002/relcaps002.cpp	Fri Oct 05 17:01:07 2018 -0400
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/RelinquishCapabilities/relcaps002/relcaps002.cpp	Tue Oct 09 14:37:59 2018 +0200
@@ -193,8 +193,7 @@
     memset(&caps, 0, sizeof(jvmtiCapabilities));
 
     NSK_DISPLAY0("GetCapabilities() for current JVMTI env\n");
-    if (!NSK_JVMTI_VERIFY(
-            NSK_CPP_STUB2(GetCapabilities, jvmti, &caps))) {
+    if (!NSK_JVMTI_VERIFY(jvmti->GetCapabilities(&caps))) {
         return NSK_FALSE;
     }
 
@@ -217,8 +216,7 @@
  */
 static int addCapabilities(jvmtiEnv* jvmti, jvmtiCapabilities* caps) {
     NSK_DISPLAY0("AddCapabilities() for current JVMTI env\n");
-    if (!NSK_JVMTI_VERIFY(
-            NSK_CPP_STUB2(AddCapabilities, jvmti, caps))) {
+    if (!NSK_JVMTI_VERIFY(jvmti->AddCapabilities(caps))) {
         return NSK_FALSE;
     }
     NSK_DISPLAY0("  ... set\n");
@@ -232,8 +230,7 @@
  */
 static int removeCapabilities(jvmtiEnv* jvmti, jvmtiCapabilities* caps, const char where[]) {
     NSK_DISPLAY0("RelinquishCapabilities() for current JVMTI env\n");
-    if (!NSK_JVMTI_VERIFY(
-            NSK_CPP_STUB2(RelinquishCapabilities, jvmti, caps))) {
+    if (!NSK_JVMTI_VERIFY(jvmti->RelinquishCapabilities(caps))) {
         return NSK_FALSE;
     }
     NSK_DISPLAY0("  ... relinguished\n");
@@ -247,8 +244,7 @@
  */
 static int getPotentialCapabilities(jvmtiEnv* jvmti, jvmtiCapabilities* caps) {
     NSK_DISPLAY0("GetPotentialCapabilities() for current JVMTI env\n");
-    if (!NSK_JVMTI_VERIFY(
-            NSK_CPP_STUB2(GetPotentialCapabilities, jvmti, caps))) {
+    if (!NSK_JVMTI_VERIFY(jvmti->GetPotentialCapabilities(caps))) {
         return NSK_FALSE;
     }
 
@@ -349,9 +345,7 @@
         memset(&eventCallbacks, 0, sizeof(eventCallbacks));
         eventCallbacks.VMInit = callbackVMInit;
         eventCallbacks.VMDeath = callbackVMDeath;
-        if (!NSK_JVMTI_VERIFY(
-                NSK_CPP_STUB3(SetEventCallbacks, jvmti,
-                                    &eventCallbacks, sizeof(eventCallbacks)))) {
+        if (!NSK_JVMTI_VERIFY(jvmti->SetEventCallbacks(&eventCallbacks, sizeof(eventCallbacks)))) {
             return JNI_ERR;
         }
 
--- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/ResourceExhausted/resexhausted.cpp	Fri Oct 05 17:01:07 2018 -0400
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/ResourceExhausted/resexhausted.cpp	Tue Oct 09 14:37:59 2018 +0200
@@ -86,15 +86,17 @@
     memset(&capabilities, 0, sizeof(jvmtiCapabilities));
     capabilities.can_generate_resource_exhaustion_heap_events = 1;
     capabilities.can_generate_resource_exhaustion_threads_events = 1;
-    if ( ! NSK_JVMTI_VERIFY(NSK_CPP_STUB2(AddCapabilities, gJvmti, &capabilities)) )
+    if ( ! NSK_JVMTI_VERIFY(gJvmti->AddCapabilities(&capabilities)) )
         return JNI_ERR;
 
     memset((void *)&callbacks, 0, sizeof(jvmtiEventCallbacks));
     callbacks.ResourceExhausted = resourceExhausted;
-    if ( ! NSK_JVMTI_VERIFY(NSK_CPP_STUB3(SetEventCallbacks, gJvmti, &callbacks, sizeof(callbacks))) )
+    if ( ! NSK_JVMTI_VERIFY(gJvmti->SetEventCallbacks(&callbacks, sizeof(callbacks))) )
         return JNI_ERR;
 
-    if ( ! NSK_JVMTI_VERIFY(NSK_CPP_STUB4(SetEventNotificationMode, gJvmti, JVMTI_ENABLE, JVMTI_EVENT_RESOURCE_EXHAUSTED, NULL) ) )
+    if ( ! NSK_JVMTI_VERIFY(gJvmti->SetEventNotificationMode(JVMTI_ENABLE,
+                                                             JVMTI_EVENT_RESOURCE_EXHAUSTED,
+                                                             NULL) ) )
         return JNI_ERR;
 
     return JNI_OK;
--- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/ResumeThread/resumethrd001/resumethrd001.cpp	Fri Oct 05 17:01:07 2018 -0400
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/ResumeThread/resumethrd001/resumethrd001.cpp	Tue Oct 09 14:37:59 2018 +0200
@@ -58,15 +58,13 @@
         NSK_DISPLAY1("  ... found thread: %p\n", (void*)testedThread);
 
         NSK_DISPLAY1("Suspend thread: %p\n", (void*)testedThread);
-        if (!NSK_JVMTI_VERIFY(
-                NSK_CPP_STUB2(SuspendThread, jvmti, testedThread))) {
+        if (!NSK_JVMTI_VERIFY(jvmti->SuspendThread(testedThread))) {
             nsk_jvmti_setFailStatus();
             return;
         }
 
         NSK_DISPLAY1("Resume thread: %p\n", (void*)testedThread);
-        if (!NSK_JVMTI_VERIFY(
-                NSK_CPP_STUB2(ResumeThread, jvmti, testedThread))) {
+        if (!NSK_JVMTI_VERIFY(jvmti->ResumeThread(testedThread))) {
             nsk_jvmti_setFailStatus();
         }
 
@@ -74,8 +72,7 @@
         {
             jint state = 0;
 
-            if (!NSK_JVMTI_VERIFY(
-                    NSK_CPP_STUB3(GetThreadState, jvmti, testedThread, &state))) {
+            if (!NSK_JVMTI_VERIFY(jvmti->GetThreadState(testedThread, &state))) {
                 nsk_jvmti_setFailStatus();
             }
             NSK_DISPLAY2("  ... got state vector: %s (%d)\n",
@@ -98,7 +95,7 @@
             return;
 
         NSK_DISPLAY0("Delete thread reference\n");
-        NSK_TRACE(NSK_CPP_STUB2(DeleteGlobalRef, jni, testedThread));
+        NSK_TRACE(jni->DeleteGlobalRef(testedThread));
     }
 
     NSK_DISPLAY0("Let debugee to finish\n");
@@ -139,8 +136,7 @@
         jvmtiCapabilities suspendCaps;
         memset(&suspendCaps, 0, sizeof(suspendCaps));
         suspendCaps.can_suspend = 1;
-        if (!NSK_JVMTI_VERIFY(
-                NSK_CPP_STUB2(AddCapabilities, jvmti, &suspendCaps)))
+        if (!NSK_JVMTI_VERIFY(jvmti->AddCapabilities(&suspendCaps)))
             return JNI_ERR;
     }
 
--- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/ResumeThread/resumethrd002/resumethrd002.cpp	Fri Oct 05 17:01:07 2018 -0400
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/ResumeThread/resumethrd002/resumethrd002.cpp	Tue Oct 09 14:37:59 2018 +0200
@@ -72,8 +72,7 @@
             return;
 
         NSK_DISPLAY1("Suspend thread: %p\n", (void*)testedThread);
-        if (!NSK_JVMTI_VERIFY(
-                NSK_CPP_STUB2(SuspendThread, jvmti, testedThread))) {
+        if (!NSK_JVMTI_VERIFY(jvmti->SuspendThread(testedThread))) {
             nsk_jvmti_setFailStatus();
             return;
         }
@@ -83,8 +82,7 @@
             return;
 
         NSK_DISPLAY1("Resume thread: %p\n", (void*)testedThread);
-        if (!NSK_JVMTI_VERIFY(
-                NSK_CPP_STUB2(ResumeThread, jvmti, testedThread))) {
+        if (!NSK_JVMTI_VERIFY(jvmti->ResumeThread(testedThread))) {
             nsk_jvmti_setFailStatus();
         }
 
@@ -112,7 +110,7 @@
             return;
 
         NSK_DISPLAY0("Delete thread reference\n");
-        NSK_TRACE(NSK_CPP_STUB2(DeleteGlobalRef, jni, testedThread));
+        NSK_TRACE(jni->DeleteGlobalRef(testedThread));
     }
 
     NSK_DISPLAY0("Let debugee to finish\n");
@@ -127,7 +125,7 @@
 callbackThreadEnd(jvmtiEnv* jvmti, JNIEnv* jni, jthread thread) {
     /* check if event is for tested thread */
     if (thread != NULL &&
-                NSK_CPP_STUB3(IsSameObject, jni, testedThread, thread)) {
+                jni->IsSameObject(testedThread, thread)) {
         NSK_DISPLAY1("  ... received THREAD_END event for tested thread: %p\n", (void*)thread);
         eventsReceived++;
     } else {
@@ -168,8 +166,7 @@
         jvmtiCapabilities suspendCaps;
         memset(&suspendCaps, 0, sizeof(suspendCaps));
         suspendCaps.can_suspend = 1;
-        if (!NSK_JVMTI_VERIFY(
-                NSK_CPP_STUB2(AddCapabilities, jvmti, &suspendCaps)))
+        if (!NSK_JVMTI_VERIFY(jvmti->AddCapabilities(&suspendCaps)))
             return JNI_ERR;
     }
 
@@ -178,8 +175,7 @@
         jvmtiEventCallbacks callbacks;
         memset(&callbacks, 0, sizeof(callbacks));
         callbacks.ThreadEnd = callbackThreadEnd;
-        if (!NSK_JVMTI_VERIFY(
-                NSK_CPP_STUB3(SetEventCallbacks, jvmti, &callbacks, sizeof(callbacks))))
+        if (!NSK_JVMTI_VERIFY(jvmti->SetEventCallbacks(&callbacks, sizeof(callbacks))))
         return JNI_ERR;
     }
 
--- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/ResumeThreadList/resumethrdlst001/resumethrdlst001.cpp	Fri Oct 05 17:01:07 2018 -0400
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/ResumeThreadList/resumethrdlst001/resumethrdlst001.cpp	Tue Oct 09 14:37:59 2018 +0200
@@ -62,18 +62,16 @@
         int i;
 
         NSK_DISPLAY1("Allocate threads array: %d threads\n", threadsCount);
-        if (!NSK_JVMTI_VERIFY(
-                NSK_CPP_STUB3(Allocate, jvmti, (threadsCount * sizeof(jthread)),
-                                                (unsigned char**)&threads))) {
+        if (!NSK_JVMTI_VERIFY(jvmti->Allocate((threadsCount * sizeof(jthread)),
+                                              (unsigned char**)&threads))) {
             nsk_jvmti_setFailStatus();
             return;
         }
         NSK_DISPLAY1("  ... allocated array: %p\n", (void*)threads);
 
         NSK_DISPLAY1("Allocate results array: %d threads\n", threadsCount);
-        if (!NSK_JVMTI_VERIFY(
-                NSK_CPP_STUB3(Allocate, jvmti, (threadsCount * sizeof(jvmtiError)),
-                                                (unsigned char**)&results))) {
+        if (!NSK_JVMTI_VERIFY(jvmti->Allocate((threadsCount * sizeof(jvmtiError)),
+                                              (unsigned char**)&results))) {
             nsk_jvmti_setFailStatus();
             return;
         }
@@ -84,8 +82,7 @@
             return;
 
         NSK_DISPLAY0("Suspend threads list\n");
-        if (!NSK_JVMTI_VERIFY(
-                NSK_CPP_STUB4(SuspendThreadList, jvmti, threadsCount, threads, results))) {
+        if (!NSK_JVMTI_VERIFY(jvmti->SuspendThreadList(threadsCount, threads, results))) {
             nsk_jvmti_setFailStatus();
             return;
         }
@@ -99,8 +96,7 @@
         }
 
         NSK_DISPLAY0("Resume threads list\n");
-        if (!NSK_JVMTI_VERIFY(
-                NSK_CPP_STUB4(ResumeThreadList, jvmti, threadsCount, threads, results))) {
+        if (!NSK_JVMTI_VERIFY(jvmti->ResumeThreadList(threadsCount, threads, results))) {
             nsk_jvmti_setFailStatus();
             return;
         }
@@ -118,8 +114,7 @@
             jint state = 0;
 
             NSK_DISPLAY2("  thread #%d (%p):\n", i, (void*)threads[i]);
-            if (!NSK_JVMTI_VERIFY(
-                    NSK_CPP_STUB3(GetThreadState, jvmti, threads[i], &state))) {
+            if (!NSK_JVMTI_VERIFY(jvmti->GetThreadState(threads[i], &state))) {
                 nsk_jvmti_setFailStatus();
             }
             NSK_DISPLAY2("  ... got state vector: %s (%d)\n",
@@ -144,18 +139,16 @@
         NSK_DISPLAY0("Delete threads references\n");
         for (i = 0; i < threadsCount; i++) {
             if (threads[i] != NULL)
-                NSK_TRACE(NSK_CPP_STUB2(DeleteGlobalRef, jni, threads[i]));
+                NSK_TRACE(jni->DeleteGlobalRef(threads[i]));
         }
 
         NSK_DISPLAY1("Deallocate threads array: %p\n", (void*)threads);
-        if (!NSK_JVMTI_VERIFY(
-                NSK_CPP_STUB2(Deallocate, jvmti, (unsigned char*)threads))) {
+        if (!NSK_JVMTI_VERIFY(jvmti->Deallocate((unsigned char*)threads))) {
             nsk_jvmti_setFailStatus();
         }
 
         NSK_DISPLAY1("Deallocate results array: %p\n", (void*)results);
-        if (!NSK_JVMTI_VERIFY(
-                NSK_CPP_STUB2(Deallocate, jvmti, (unsigned char*)results))) {
+        if (!NSK_JVMTI_VERIFY(jvmti->Deallocate((unsigned char*)results))) {
             nsk_jvmti_setFailStatus();
         }
     }
@@ -181,8 +174,7 @@
         foundThreads[i] = NULL;
     }
 
-    if (!NSK_JVMTI_VERIFY(
-            NSK_CPP_STUB3(GetAllThreads, jvmti, &count, &threads))) {
+    if (!NSK_JVMTI_VERIFY(jvmti->GetAllThreads(&count, &threads))) {
         nsk_jvmti_setFailStatus();
         return NSK_FALSE;
     }
@@ -191,8 +183,7 @@
     for (i = 0; i < count; i++) {
         jvmtiThreadInfo info;
 
-        if (!NSK_JVMTI_VERIFY(
-                NSK_CPP_STUB3(GetThreadInfo, jvmti, threads[i], &info))) {
+        if (!NSK_JVMTI_VERIFY(jvmti->GetThreadInfo(threads[i], &info))) {
             nsk_jvmti_setFailStatus();
             break;
         }
@@ -207,8 +198,7 @@
 
     }
 
-    if (!NSK_JVMTI_VERIFY(
-                NSK_CPP_STUB2(Deallocate, jvmti, (unsigned char*)threads))) {
+    if (!NSK_JVMTI_VERIFY(jvmti->Deallocate((unsigned char*)threads))) {
         nsk_jvmti_setFailStatus();
         return NSK_FALSE;
     }
@@ -226,7 +216,7 @@
     NSK_DISPLAY1("Make global references for threads: %d threads\n", foundCount);
     for (i = 0; i < foundCount; i++) {
         if (!NSK_JNI_VERIFY(jni, (foundThreads[i] = (jthread)
-                    NSK_CPP_STUB2(NewGlobalRef, jni, foundThreads[i])) != NULL)) {
+                    jni->NewGlobalRef(foundThreads[i])) != NULL)) {
             nsk_jvmti_setFailStatus();
             return NSK_FALSE;
         }
@@ -274,8 +264,7 @@
         jvmtiCapabilities suspendCaps;
         memset(&suspendCaps, 0, sizeof(suspendCaps));
         suspendCaps.can_suspend = 1;
-        if (!NSK_JVMTI_VERIFY(
-                NSK_CPP_STUB2(AddCapabilities, jvmti, &suspendCaps)))
+        if (!NSK_JVMTI_VERIFY(jvmti->AddCapabilities(&suspendCaps)))
             return JNI_ERR;
     }
 
--- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/ResumeThreadList/resumethrdlst002/resumethrdlst002.cpp	Fri Oct 05 17:01:07 2018 -0400
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/ResumeThreadList/resumethrdlst002/resumethrdlst002.cpp	Tue Oct 09 14:37:59 2018 +0200
@@ -71,18 +71,16 @@
         int i;
 
         NSK_DISPLAY1("Allocate threads array: %d threads\n", threadsCount);
-        if (!NSK_JVMTI_VERIFY(
-                NSK_CPP_STUB3(Allocate, jvmti, (threadsCount * sizeof(jthread)),
-                                                (unsigned char**)&threads))) {
+        if (!NSK_JVMTI_VERIFY(jvmti->Allocate((threadsCount * sizeof(jthread)),
+                                              (unsigned char**)&threads))) {
             nsk_jvmti_setFailStatus();
             return;
         }
         NSK_DISPLAY1("  ... allocated array: %p\n", (void*)threads);
 
         NSK_DISPLAY1("Allocate results array: %d threads\n", threadsCount);
-        if (!NSK_JVMTI_VERIFY(
-                NSK_CPP_STUB3(Allocate, jvmti, (threadsCount * sizeof(jvmtiError)),
-                                                (unsigned char**)&results))) {
+        if (!NSK_JVMTI_VERIFY(jvmti->Allocate((threadsCount * sizeof(jvmtiError)),
+                                              (unsigned char**)&results))) {
             nsk_jvmti_setFailStatus();
             return;
         }
@@ -93,8 +91,7 @@
             return;
 
         NSK_DISPLAY0("Suspend threads list\n");
-        if (!NSK_JVMTI_VERIFY(
-                NSK_CPP_STUB4(SuspendThreadList, jvmti, threadsCount, threads, results))) {
+        if (!NSK_JVMTI_VERIFY(jvmti->SuspendThreadList(threadsCount, threads, results))) {
             nsk_jvmti_setFailStatus();
             return;
         }
@@ -117,8 +114,7 @@
             return;
 
         NSK_DISPLAY0("Resume threads list\n");
-        if (!NSK_JVMTI_VERIFY(
-                NSK_CPP_STUB4(ResumeThreadList, jvmti, threadsCount, threads, results))) {
+        if (!NSK_JVMTI_VERIFY(jvmti->ResumeThreadList(threadsCount, threads, results))) {
             nsk_jvmti_setFailStatus();
             return;
         }
@@ -159,18 +155,16 @@
         NSK_DISPLAY0("Delete threads references\n");
         for (i = 0; i < threadsCount; i++) {
             if (threads[i] != NULL)
-                NSK_TRACE(NSK_CPP_STUB2(DeleteGlobalRef, jni, threads[i]));
+                NSK_TRACE(jni->DeleteGlobalRef(threads[i]));
         }
 
         NSK_DISPLAY1("Deallocate threads array: %p\n", (void*)threads);
-        if (!NSK_JVMTI_VERIFY(
-                NSK_CPP_STUB2(Deallocate, jvmti, (unsigned char*)threads))) {
+        if (!NSK_JVMTI_VERIFY(jvmti->Deallocate((unsigned char*)threads))) {
             nsk_jvmti_setFailStatus();
         }
 
         NSK_DISPLAY1("Deallocate results array: %p\n", (void*)results);
-        if (!NSK_JVMTI_VERIFY(
-                NSK_CPP_STUB2(Deallocate, jvmti, (unsigned char*)results))) {
+        if (!NSK_JVMTI_VERIFY(jvmti->Deallocate((unsigned char*)results))) {
             nsk_jvmti_setFailStatus();
         }
     }
@@ -196,8 +190,7 @@
         foundThreads[i] = NULL;
     }
 
-    if (!NSK_JVMTI_VERIFY(
-            NSK_CPP_STUB3(GetAllThreads, jvmti, &count, &threads))) {
+    if (!NSK_JVMTI_VERIFY(jvmti->GetAllThreads(&count, &threads))) {
         nsk_jvmti_setFailStatus();
         return NSK_FALSE;
     }
@@ -206,8 +199,7 @@
     for (i = 0; i < count; i++) {
         jvmtiThreadInfo info;
 
-        if (!NSK_JVMTI_VERIFY(
-                NSK_CPP_STUB3(GetThreadInfo, jvmti, threads[i], &info))) {
+        if (!NSK_JVMTI_VERIFY(jvmti->GetThreadInfo(threads[i], &info))) {
             nsk_jvmti_setFailStatus();
             break;
         }
@@ -222,8 +214,7 @@
 
     }
 
-    if (!NSK_JVMTI_VERIFY(
-                NSK_CPP_STUB2(Deallocate, jvmti, (unsigned char*)threads))) {
+    if (!NSK_JVMTI_VERIFY(jvmti->Deallocate((unsigned char*)threads))) {
         nsk_jvmti_setFailStatus();
         return NSK_FALSE;
     }
@@ -241,7 +232,7 @@
     NSK_DISPLAY1("Make global references for threads: %d threads\n", foundCount);
     for (i = 0; i < foundCount; i++) {
         if (!NSK_JNI_VERIFY(jni, (foundThreads[i] = (jthread)
-                    NSK_CPP_STUB2(NewGlobalRef, jni, foundThreads[i])) != NULL)) {
+                    jni->NewGlobalRef(foundThreads[i])) != NULL)) {
             nsk_jvmti_setFailStatus();
             return NSK_FALSE;
         }
@@ -258,7 +249,7 @@
 callbackThreadEnd(jvmtiEnv* jvmti, JNIEnv* jni, jthread thread) {
     int i = 0;
 
-    jvmtiError e = NSK_CPP_STUB2(RawMonitorEnter, jvmti, eventsReceivedMtx);
+    jvmtiError e = jvmti->RawMonitorEnter(eventsReceivedMtx);
     if ( !NSK_JVMTI_VERIFY(e) ) {
         NSK_DISPLAY1("  ... ERROR entering raw monitor for thread %p\n", (void *) thread);
         return;
@@ -267,15 +258,15 @@
     /* check if event is for tested thread */
     for (i = 0; i < threadsCount; i++) {
         if (thread != NULL &&
-                NSK_CPP_STUB3(IsSameObject, jni, threads[i], thread)) {
+                jni->IsSameObject(threads[i], thread)) {
             NSK_DISPLAY2("  ... received THREAD_END event for thread #%d: %p\n",
                                                                     i, (void*)thread);
             eventsReceived++;
-            NSK_CPP_STUB2(RawMonitorExit, jvmti, eventsReceivedMtx);
+            jvmti->RawMonitorExit(eventsReceivedMtx);
             return;
         }
     }
-    NSK_CPP_STUB2(RawMonitorExit, jvmti, eventsReceivedMtx);
+    jvmti->RawMonitorExit(eventsReceivedMtx);
     NSK_DISPLAY1("  ... received THREAD_END event for unknown thread: %p\n", (void*)thread);
 }
 
@@ -317,8 +308,7 @@
         jvmtiCapabilities suspendCaps;
         memset(&suspendCaps, 0, sizeof(suspendCaps));
         suspendCaps.can_suspend = 1;
-        if (!NSK_JVMTI_VERIFY(
-                NSK_CPP_STUB2(AddCapabilities, jvmti, &suspendCaps)))
+        if (!NSK_JVMTI_VERIFY(jvmti->AddCapabilities(&suspendCaps)))
             return JNI_ERR;
     }
 
@@ -327,15 +317,13 @@
         jvmtiEventCallbacks callbacks;
         memset(&callbacks, 0, sizeof(callbacks));
         callbacks.ThreadEnd = callbackThreadEnd;
-        if (!NSK_JVMTI_VERIFY(
-                NSK_CPP_STUB3(SetEventCallbacks, jvmti, &callbacks, sizeof(callbacks))))
+        if (!NSK_JVMTI_VERIFY(jvmti->SetEventCallbacks(&callbacks, sizeof(callbacks))))
         return JNI_ERR;
     }
 
     /* create a mutex for the eventsReceived variable */
     {
-        if ( ! NSK_JVMTI_VERIFY(
-                    NSK_CPP_STUB3(CreateRawMonitor, jvmti, "eventsReceived", &eventsReceivedMtx))) {
+        if ( ! NSK_JVMTI_VERIFY(jvmti->CreateRawMonitor("eventsReceived", &eventsReceivedMtx))) {
             return JNI_ERR;
         }
     }
--- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/RetransformClasses/retransform002/retransform002.cpp	Fri Oct 05 17:01:07 2018 -0400
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/RetransformClasses/retransform002/retransform002.cpp	Tue Oct 09 14:37:59 2018 +0200
@@ -49,15 +49,7 @@
         )
 {
 
-    if (!NSK_JVMTI_VERIFY(
-                NSK_CPP_STUB3(
-                    RetransformClasses
-                    , jvmti
-                    , 1
-                    , &class_for_retransformation
-                    )
-                )
-       )
+    if (!NSK_JVMTI_VERIFY(jvmti->RetransformClasses(1, &class_for_retransformation)))
         return JNI_FALSE;
 
     return JNI_TRUE;
@@ -114,53 +106,26 @@
        )
         return JNI_ERR;
 
-    if (!NSK_JVMTI_VERIFY(
-                NSK_CPP_STUB2(
-                    GetCapabilities
-                    , jvmti
-                    , &caps)
-                )
-       )
+    if (!NSK_JVMTI_VERIFY(jvmti->GetCapabilities(&caps)))
         return JNI_ERR;
 
     caps.can_retransform_classes = 1;
 
     // Register all necessary JVM capabilities
-    if (!NSK_JVMTI_VERIFY(
-                NSK_CPP_STUB2(
-                    AddCapabilities
-                    , jvmti
-                    , &caps)
-                )
-       )
+    if (!NSK_JVMTI_VERIFY(jvmti->AddCapabilities(&caps)))
         return JNI_ERR;
 
     // Register all necessary event callbacks
     memset(&callbacks, 0, sizeof(callbacks));
     callbacks.ClassFileLoadHook = &ClassFileLoadHook;
 
-    if (!NSK_JVMTI_VERIFY(
-                NSK_CPP_STUB3(
-                    SetEventCallbacks
-                    , jvmti
-                    , &callbacks
-                    , sizeof(callbacks)
-                    )
-                )
-       )
+    if (!NSK_JVMTI_VERIFY(jvmti->SetEventCallbacks(&callbacks, sizeof(callbacks))))
         return JNI_ERR;
 
     // Enable class retransformation
-    if (!NSK_JVMTI_VERIFY(
-                NSK_CPP_STUB4(
-                    SetEventNotificationMode
-                    , jvmti
-                    , JVMTI_ENABLE
-                    , JVMTI_EVENT_CLASS_FILE_LOAD_HOOK
-                    , NULL
-                    )
-                )
-       )
+    if (!NSK_JVMTI_VERIFY(jvmti->SetEventNotificationMode(JVMTI_ENABLE,
+                                                          JVMTI_EVENT_CLASS_FILE_LOAD_HOOK,
+                                                          NULL)))
         return JNI_ERR;
 
     return JNI_OK;
--- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/RetransformClasses/retransform003/retransform003.cpp	Fri Oct 05 17:01:07 2018 -0400
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/RetransformClasses/retransform003/retransform003.cpp	Tue Oct 09 14:37:59 2018 +0200
@@ -63,15 +63,7 @@
         , jclass class_for_retransformation
         )
 {
-    if (!NSK_JVMTI_VERIFY(
-                NSK_CPP_STUB3(
-                    RetransformClasses
-                    , jvmti
-                    , 1
-                    , &class_for_retransformation
-                    )
-                )
-       )
+    if (!NSK_JVMTI_VERIFY(jvmti->RetransformClasses(1, &class_for_retransformation)))
         return JNI_FALSE;
 
     return JNI_TRUE;
@@ -107,88 +99,28 @@
     }
 
     // Get ant the invoke callback function
-    if (!NSK_VERIFY(
-                (loader_class = NSK_CPP_STUB2(
-                    GetObjectClass
-                    , jni
-                    , loader
-                    )
-                ) != NULL
-            )
-       )
+    if (!NSK_VERIFY((loader_class = jni->GetObjectClass(loader)) != NULL))
         return;
 
-    if (!NSK_VERIFY(
-                (method_id = NSK_CPP_STUB4(
-                    GetMethodID
-                    , jni
-                    , loader_class
-                    , "loadClass"
-                    , "(Ljava/lang/String;)Ljava/lang/Class;"
-                    )
-                ) != NULL
-            )
-       )
+    if (!NSK_VERIFY((method_id = jni->GetMethodID(
+            loader_class, "loadClass", "(Ljava/lang/String;)Ljava/lang/Class;")) != NULL))
         return;
 
-    if (!NSK_VERIFY(
-                (class_name_string =
-                 NSK_CPP_STUB2(
-                     NewStringUTF
-                     , jni
-                     , CALLBACK_CLASS_NAME
-                     )
-                ) != NULL
-            )
-       )
+    if (!NSK_VERIFY((class_name_string = jni->NewStringUTF(CALLBACK_CLASS_NAME)) != NULL))
         return;
 
-    if (!NSK_VERIFY(
-                (callback_class = (jclass) NSK_CPP_STUB4(
-                        CallObjectMethod
-                        , jni
-                        , loader
-                        , method_id
-                        , class_name_string
-                        )
-                ) != NULL
-            )
-       )
+    if (!NSK_VERIFY((callback_class = (jclass) jni->CallObjectMethod(
+            loader, method_id, class_name_string)) != NULL))
         return;
 
-    if (!NSK_VERIFY(
-                (method_id = NSK_CPP_STUB4(
-                    GetStaticMethodID
-                    , jni
-                    , callback_class
-                    , "callback"
-                    , "(Ljava/lang/String;I)V"
-                    )
-                ) != NULL
-            )
-       )
+    if (!NSK_VERIFY((method_id = jni->GetStaticMethodID(
+            callback_class, "callback", "(Ljava/lang/String;I)V")) != NULL))
         return;
 
-    if (!NSK_VERIFY(
-                (class_name_string =
-                 NSK_CPP_STUB2(
-                     NewStringUTF
-                     , jni
-                     , name
-                     )
-                ) != NULL
-            )
-       )
+    if (!NSK_VERIFY((class_name_string = jni->NewStringUTF(name)) != NULL))
         return;
 
-    NSK_CPP_STUB5(
-        CallStaticObjectMethod
-        , jni
-        , callback_class
-        , method_id
-        , class_name_string
-        , agent_id
-        );
+    jni->CallStaticObjectMethod(callback_class, method_id, class_name_string, agent_id);
 }
 
 
@@ -219,19 +151,10 @@
 
     agent_id= nsk_jvmti_findOptionIntValue("id", -1);
 
-    if (!NSK_VERIFY(
-                (jvmti = nsk_jvmti_createJVMTIEnv(vm, reserved)) != NULL
-                )
-       )
+    if (!NSK_VERIFY((jvmti = nsk_jvmti_createJVMTIEnv(vm, reserved)) != NULL))
         return JNI_ERR;
 
-    if (!NSK_JVMTI_VERIFY(
-                NSK_CPP_STUB2(
-                    GetCapabilities
-                    , jvmti
-                    , &caps)
-                )
-       )
+    if (!NSK_JVMTI_VERIFY(jvmti->GetCapabilities(&caps)))
         return JNI_ERR;
 
     if(nsk_jvmti_findOptionIntValue("can_retransform_classes", 1)) {
@@ -242,41 +165,21 @@
 
 
     // Register all necessary JVM capabilities
-    if (!NSK_JVMTI_VERIFY(
-                NSK_CPP_STUB2(
-                    AddCapabilities
-                    , jvmti
-                    , &caps)
-                )
-       )
+    if (!NSK_JVMTI_VERIFY(jvmti->AddCapabilities(&caps)))
         return JNI_ERR;
 
     // Register all necessary event callbacks
     memset(&callbacks, 0, sizeof(callbacks));
     callbacks.ClassFileLoadHook = &ClassFileLoadHook;
 
-    if (!NSK_JVMTI_VERIFY(
-                NSK_CPP_STUB3(
-                    SetEventCallbacks
-                    , jvmti
-                    , &callbacks
-                    , sizeof(callbacks)
-                    )
-                )
-       )
+    if (!NSK_JVMTI_VERIFY(jvmti->SetEventCallbacks(&callbacks, sizeof(callbacks))))
         return JNI_ERR;
 
     // Enable class retransformation
     if (!NSK_JVMTI_VERIFY(
-                NSK_CPP_STUB4(
-                    SetEventNotificationMode
-                    , jvmti
-                    , JVMTI_ENABLE
-                    , JVMTI_EVENT_CLASS_FILE_LOAD_HOOK
-                    , NULL
-                    )
-                )
-       )
+                jvmti->SetEventNotificationMode(JVMTI_ENABLE,
+                                                JVMTI_EVENT_CLASS_FILE_LOAD_HOOK,
+                                                NULL)))
         return JNI_ERR;
 
     return JNI_OK;
--- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/RetransformClasses/retransform004/retransform004.cpp	Fri Oct 05 17:01:07 2018 -0400
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/RetransformClasses/retransform004/retransform004.cpp	Tue Oct 09 14:37:59 2018 +0200
@@ -52,15 +52,7 @@
         , jclass class_for_retransformation
         )
 {
-    if (!NSK_JVMTI_VERIFY(
-                NSK_CPP_STUB3(
-                    RetransformClasses
-                    , jvmti
-                    , 1
-                    , &class_for_retransformation
-                    )
-                )
-       )
+    if (!NSK_JVMTI_VERIFY(jvmti->RetransformClasses(1, &class_for_retransformation)))
         return JNI_FALSE;
 
     return JNI_TRUE;
@@ -85,15 +77,7 @@
         )
 {
     // Allocate space for "retransformed" class version
-    if (!NSK_JVMTI_VERIFY(
-                NSK_CPP_STUB3(
-                    Allocate
-                    , jvmti
-                    , class_data_len
-                    , new_class_data
-                    )
-                )
-       )
+    if (!NSK_JVMTI_VERIFY(jvmti->Allocate(class_data_len, new_class_data)))
         return;
 
     // Copy old code
@@ -127,53 +111,27 @@
        )
         return JNI_ERR;
 
-    if (!NSK_JVMTI_VERIFY(
-                NSK_CPP_STUB2(
-                    GetCapabilities
-                    , jvmti
-                    , &caps)
-                )
-       )
+    if (!NSK_JVMTI_VERIFY(jvmti->GetCapabilities(&caps)))
         return JNI_ERR;
 
     caps.can_retransform_classes = 1;
 
     // Register all necessary JVM capabilities
-    if (!NSK_JVMTI_VERIFY(
-                NSK_CPP_STUB2(
-                    AddCapabilities
-                    , jvmti
-                    , &caps)
-                )
-       )
+    if (!NSK_JVMTI_VERIFY(jvmti->AddCapabilities(&caps)))
         return JNI_ERR;
 
     // Register all necessary event callbacks
     memset(&callbacks, 0, sizeof(callbacks));
     callbacks.ClassFileLoadHook = &ClassFileLoadHook;
 
-    if (!NSK_JVMTI_VERIFY(
-                NSK_CPP_STUB3(
-                    SetEventCallbacks
-                    , jvmti
-                    , &callbacks
-                    , sizeof(callbacks)
-                    )
-                )
-       )
+    if (!NSK_JVMTI_VERIFY(jvmti->SetEventCallbacks(&callbacks, sizeof(callbacks))))
         return JNI_ERR;
 
     // Enable class retransformation
     if (!NSK_JVMTI_VERIFY(
-                NSK_CPP_STUB4(
-                    SetEventNotificationMode
-                    , jvmti
-                    , JVMTI_ENABLE
-                    , JVMTI_EVENT_CLASS_FILE_LOAD_HOOK
-                    , NULL
-                    )
-                )
-       )
+                jvmti->SetEventNotificationMode(JVMTI_ENABLE,
+                                                JVMTI_EVENT_CLASS_FILE_LOAD_HOOK,
+                                                NULL)))
         return JNI_ERR;
 
     return JNI_OK;
--- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/allocation/AP01/ap01t001/ap01t001.cpp	Fri Oct 05 17:01:07 2018 -0400
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/allocation/AP01/ap01t001/ap01t001.cpp	Tue Oct 09 14:37:59 2018 +0200
@@ -146,20 +146,13 @@
     jmethodID cid;
     jobject result;
 
-    if (!NSK_JNI_VERIFY(jni, (cid =
-            NSK_CPP_STUB4(GetMethodID, jni,
-                                       cls,
-                                       "<init>",
-                                       "()V" )) != NULL)) {
+    if (!NSK_JNI_VERIFY(jni, (cid = jni->GetMethodID(cls, "<init>", "()V" )) != NULL)) {
          NSK_COMPLAIN0("newObject: GetMethodID returned NULL\n\n");
          nsk_jvmti_setFailStatus();
          return NULL;
     }
 
-    if (!NSK_JNI_VERIFY(jni, ( result =
-            NSK_CPP_STUB3(NewObject, jni,
-                                     cls,
-                                     cid )) != NULL)) {
+    if (!NSK_JNI_VERIFY(jni, ( result = jni->NewObject(cls, cid)) != NULL)) {
 
          NSK_COMPLAIN0("newObject: NewObject returned NULL\n\n");
          nsk_jvmti_setFailStatus();
@@ -174,31 +167,21 @@
     jmethodID cid;
     jobject result;
 
-    if (!NSK_JNI_VERIFY(jni, ( cid =
-            NSK_CPP_STUB4(GetMethodID, jni,
-                                       cls,
-                                       "<init>",
-                                       "()V" )) != NULL)) {
+    if (!NSK_JNI_VERIFY(jni, ( cid = jni->GetMethodID(cls, "<init>", "()V" )) != NULL)) {
 
          NSK_COMPLAIN0("allocObject: GetMethodID returned NULL\n\n");
          nsk_jvmti_setFailStatus();
          return NULL;
     }
 
-    if (!NSK_JNI_VERIFY(jni, ( result =
-            NSK_CPP_STUB2(AllocObject, jni,
-                                       cls )) != NULL)) {
+    if (!NSK_JNI_VERIFY(jni, ( result = jni->AllocObject(cls)) != NULL)) {
 
          NSK_COMPLAIN0("allocObject: AllocObject returned NULL\n\n");
          nsk_jvmti_setFailStatus();
          return NULL;
     }
 
-    if (!NSK_JNI_VERIFY_VOID(jni,
-            NSK_CPP_STUB4(CallNonvirtualVoidMethod, jni,
-                                                    result,
-                                                    cls,
-                                                    cid))) {
+    if (!NSK_JNI_VERIFY_VOID(jni,jni->CallNonvirtualVoidMethod(result, cls, cid))) {
 
          NSK_COMPLAIN0("newObject: CallNonvirtualVoidMethod failed\n\n");
          nsk_jvmti_setFailStatus();
@@ -225,10 +208,7 @@
     }
 
     NSK_DISPLAY0("Set tag for debugee class\n\n");
-    if (!NSK_JVMTI_VERIFY(
-            NSK_CPP_STUB3(SetTag, jvmti,
-                                  debugeeClass,
-                                  DEBUGEE_CLASS_TAG ))) {
+    if (!NSK_JVMTI_VERIFY(jvmti->SetTag(debugeeClass, DEBUGEE_CLASS_TAG))) {
         nsk_jvmti_setFailStatus();
         return;
     }
@@ -236,13 +216,10 @@
 
     NSK_DISPLAY0("Calling IterateOverInstancesOfClass with filter JVMTI_HEAP_OBJECT_UNTAGGED\n");
     obj_count = 0;
-    if (!NSK_JVMTI_VERIFY(
-            NSK_CPP_STUB5(IterateOverInstancesOfClass,
-                              jvmti,
-                              debugeeClass,
-                              JVMTI_HEAP_OBJECT_UNTAGGED,
-                              heapObjectCallback,
-                              &user_data))) {
+    if (!NSK_JVMTI_VERIFY(jvmti->IterateOverInstancesOfClass(debugeeClass,
+                                                             JVMTI_HEAP_OBJECT_UNTAGGED,
+                                                             heapObjectCallback,
+                                                             &user_data))) {
         nsk_jvmti_setFailStatus();
         return;
     }
@@ -261,11 +238,7 @@
     NSK_DISPLAY0("Calling IterateOverHeap with filter JVMTI_HEAP_OBJECT_UNTAGGED\n");
     obj_count = 0;
     if (!NSK_JVMTI_VERIFY(
-            NSK_CPP_STUB4(IterateOverHeap,
-                              jvmti,
-                              JVMTI_HEAP_OBJECT_UNTAGGED,
-                              heapObjectCallback,
-                              &user_data))) {
+            jvmti->IterateOverHeap(JVMTI_HEAP_OBJECT_UNTAGGED, heapObjectCallback, &user_data))) {
         nsk_jvmti_setFailStatus();
         return;
     }
@@ -282,12 +255,10 @@
 
     NSK_DISPLAY0("Calling IterateOverReachableObjects\n");
     obj_count = 0;
-    if (!NSK_JVMTI_VERIFY(
-            NSK_CPP_STUB5(IterateOverReachableObjects, jvmti,
-                                                       heapRootCallback,
-                                                       stackReferenceCallback,
-                                                       objectReferenceCallback,
-                                                       &user_data))) {
+    if (!NSK_JVMTI_VERIFY(jvmti->IterateOverReachableObjects(heapRootCallback,
+                                                             stackReferenceCallback,
+                                                             objectReferenceCallback,
+                                                             &user_data))) {
         nsk_jvmti_setFailStatus();
         return;
     }
@@ -338,12 +309,10 @@
     memset(&caps, 0, sizeof(jvmtiCapabilities));
     caps.can_generate_object_free_events = 1;
     caps.can_tag_objects = 1;
-    if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB2(AddCapabilities,
-            jvmti, &caps)))
+    if (!NSK_JVMTI_VERIFY(jvmti->AddCapabilities(&caps)))
         return JNI_ERR;
 
-    if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB2(GetCapabilities,
-            jvmti, &caps)))
+    if (!NSK_JVMTI_VERIFY(jvmti->GetCapabilities(&caps)))
         return JNI_ERR;
 
     if (!caps.can_generate_object_free_events)
@@ -358,16 +327,17 @@
     callbacks.ObjectFree = &ObjectFree;
     callbacks.VMDeath = &VMDeath;
 
-    if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB3(SetEventCallbacks,
-            jvmti, &callbacks, sizeof(callbacks))))
+    if (!NSK_JVMTI_VERIFY(jvmti->SetEventCallbacks(&callbacks, sizeof(callbacks))))
         return JNI_ERR;
 
     NSK_DISPLAY0("setting event callbacks done\nenabling JVMTI events ...\n");
-    if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB4(SetEventNotificationMode,
-            jvmti, JVMTI_ENABLE, JVMTI_EVENT_OBJECT_FREE, NULL)))
+    if (!NSK_JVMTI_VERIFY(jvmti->SetEventNotificationMode(JVMTI_ENABLE,
+                                                          JVMTI_EVENT_OBJECT_FREE,
+                                                          NULL)))
         return JNI_ERR;
-    if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB4(SetEventNotificationMode,
-            jvmti, JVMTI_ENABLE, JVMTI_EVENT_VM_DEATH, NULL)))
+    if (!NSK_JVMTI_VERIFY(jvmti->SetEventNotificationMode(JVMTI_ENABLE,
+                                                          JVMTI_EVENT_VM_DEATH,
+                                                          NULL)))
         return JNI_ERR;
     NSK_DISPLAY0("enabling the events done\n\n");
 
--- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/allocation/AP02/ap02t001/ap02t001.cpp	Fri Oct 05 17:01:07 2018 -0400
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/allocation/AP02/ap02t001/ap02t001.cpp	Tue Oct 09 14:37:59 2018 +0200
@@ -91,9 +91,7 @@
                                                                   jclass exception_cls ) {
     jint result;
 
-    result = NSK_CPP_STUB3(ThrowNew, jni,
-                                     exception_cls,
-                                     "Got expected exception thrown from native code" );
+    result = jni->ThrowNew(exception_cls, "Got expected exception thrown from native code" );
     if (result != 0) {
         NSK_COMPLAIN1("throwException: Unable to throw exception in native code: %d\n\n", result );
         nsk_jvmti_setFailStatus();
@@ -105,13 +103,10 @@
 static void runIterations (jvmtiEnv* jvmti, jclass testedClass, jint exp_count) {
     NSK_DISPLAY0("Calling IterateOverInstancesOfClass with filter JVMTI_HEAP_OBJECT_EITHER\n");
     obj_count = 0;
-    if (!NSK_JVMTI_VERIFY(
-            NSK_CPP_STUB5(IterateOverInstancesOfClass,
-                              jvmti,
-                              testedClass,
-                              JVMTI_HEAP_OBJECT_EITHER,
-                              heapObjectCallback,
-                              &user_data))) {
+    if (!NSK_JVMTI_VERIFY(jvmti->IterateOverInstancesOfClass(testedClass,
+                                                             JVMTI_HEAP_OBJECT_EITHER,
+                                                             heapObjectCallback,
+                                                             &user_data))) {
         nsk_jvmti_setFailStatus();
         return;
     }
@@ -130,11 +125,7 @@
     NSK_DISPLAY0("Calling IterateOverHeap with filter JVMTI_HEAP_OBJECT_EITHER\n");
     obj_count = 0;
     if (!NSK_JVMTI_VERIFY(
-            NSK_CPP_STUB4(IterateOverHeap,
-                              jvmti,
-                              JVMTI_HEAP_OBJECT_EITHER,
-                              heapObjectCallback,
-                              &user_data))) {
+            jvmti->IterateOverHeap(JVMTI_HEAP_OBJECT_EITHER, heapObjectCallback, &user_data))) {
         nsk_jvmti_setFailStatus();
         return;
     }
@@ -151,12 +142,10 @@
 
     NSK_DISPLAY0("Calling IterateOverReachableObjects\n");
     obj_count = 0;
-    if (!NSK_JVMTI_VERIFY(
-            NSK_CPP_STUB5(IterateOverReachableObjects, jvmti,
-                                                       NULL /*heapRootCallback*/,
-                                                       stackReferenceCallback,
-                                                       NULL /*objectReferenceCallback*/,
-                                                       &user_data))) {
+    if (!NSK_JVMTI_VERIFY(jvmti->IterateOverReachableObjects(NULL /*heapRootCallback*/,
+                                                             stackReferenceCallback,
+                                                             NULL /*objectReferenceCallback*/,
+                                                             &user_data))) {
         nsk_jvmti_setFailStatus();
         return;
     }
@@ -189,15 +178,11 @@
         return;
     }
 
-    if (!NSK_JNI_VERIFY(jni, (testedClass = (jclass)
-            NSK_CPP_STUB2(NewGlobalRef, jni, testedClass)) != NULL))
+    if (!NSK_JNI_VERIFY(jni, (testedClass = (jclass)jni->NewGlobalRef(testedClass)) != NULL))
         return;
 
     NSK_DISPLAY0("Set tag for tested class\n\n");
-    if (!NSK_JVMTI_VERIFY(
-            NSK_CPP_STUB3(SetTag, jvmti,
-                                  testedClass,
-                                  TESTED_CLASS_TAG ))) {
+    if (!NSK_JVMTI_VERIFY(jvmti->SetTag(testedClass, TESTED_CLASS_TAG))) {
         nsk_jvmti_setFailStatus();
         return;
     }
@@ -212,7 +197,7 @@
 
     runIterations (jvmti, testedClass, 2);
 
-    NSK_TRACE(NSK_CPP_STUB2(DeleteGlobalRef, jni, testedClass));
+    NSK_TRACE(jni->DeleteGlobalRef(testedClass));
 
     NSK_DISPLAY0("Let debugee to finish\n");
     if (!NSK_VERIFY(nsk_jvmti_resumeSync()))
@@ -242,12 +227,10 @@
 
     memset(&caps, 0, sizeof(jvmtiCapabilities));
     caps.can_tag_objects = 1;
-    if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB2(AddCapabilities,
-            jvmti, &caps)))
+    if (!NSK_JVMTI_VERIFY(jvmti->AddCapabilities(&caps)))
         return JNI_ERR;
 
-    if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB2(GetCapabilities,
-            jvmti, &caps)))
+    if (!NSK_JVMTI_VERIFY(jvmti->GetCapabilities(&caps)))
         return JNI_ERR;
 
     if (!caps.can_tag_objects)
--- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/allocation/AP03/ap03t001/ap03t001.cpp	Fri Oct 05 17:01:07 2018 -0400
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/allocation/AP03/ap03t001/ap03t001.cpp	Tue Oct 09 14:37:59 2018 +0200
@@ -90,8 +90,7 @@
 JNIEXPORT void JNICALL
 Java_nsk_jvmti_scenarios_allocation_AP03_ap03t001_setTag( JNIEnv* jni, jobject obj, jlong tag) {
 
-    if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB3(SetTag,
-         jvmti, obj, tag))) {
+    if (!NSK_JVMTI_VERIFY(jvmti->SetTag(obj, tag))) {
          nsk_jvmti_setFailStatus();
     }
 }
@@ -117,23 +116,17 @@
         }
 
         NSK_DISPLAY0("Set tag for debugee class\n\n");
-        if (!NSK_JVMTI_VERIFY(
-                NSK_CPP_STUB3(SetTag, jvmti,
-                                      debugeeClass,
-                                      DEBUGEE_CLASS_TAG ))) {
+        if (!NSK_JVMTI_VERIFY(jvmti->SetTag(debugeeClass, DEBUGEE_CLASS_TAG))) {
             nsk_jvmti_setFailStatus();
             break;
         }
 
         NSK_DISPLAY0("Calling IterateOverInstancesOfClass with filter JVMTI_HEAP_OBJECT_TAGGED\n");
         obj_count = 0;
-        if (!NSK_JVMTI_VERIFY(
-                NSK_CPP_STUB5(IterateOverInstancesOfClass,
-                                  jvmti,
-                                  debugeeClass,
-                                  JVMTI_HEAP_OBJECT_TAGGED,
-                                  heapObjectCallback,
-                                  &user_data))) {
+        if (!NSK_JVMTI_VERIFY(jvmti->IterateOverInstancesOfClass(debugeeClass,
+                                                                 JVMTI_HEAP_OBJECT_TAGGED,
+                                                                 heapObjectCallback,
+                                                                 &user_data))) {
             nsk_jvmti_setFailStatus();
             break;
         }
@@ -151,11 +144,7 @@
         NSK_DISPLAY0("Calling IterateOverHeap with filter JVMTI_HEAP_OBJECT_TAGGED\n");
         obj_count = 0;
         if (!NSK_JVMTI_VERIFY(
-                NSK_CPP_STUB4(IterateOverHeap,
-                                  jvmti,
-                                  JVMTI_HEAP_OBJECT_TAGGED,
-                                  heapObjectCallback,
-                                  &user_data))) {
+                jvmti->IterateOverHeap(JVMTI_HEAP_OBJECT_TAGGED, heapObjectCallback, &user_data))) {
             nsk_jvmti_setFailStatus();
             break;
         }
@@ -171,18 +160,13 @@
         }
 
         if (!NSK_JNI_VERIFY(jni, (fid =
-                NSK_CPP_STUB4(GetStaticFieldID, jni,
-                                                debugeeClass,
-                                                "catcher",
-                                                DEBUGEE_SIGNATURE)) != NULL )) {
+                jni->GetStaticFieldID(debugeeClass, "catcher", DEBUGEE_SIGNATURE)) != NULL )) {
             nsk_jvmti_setFailStatus();
             break;
         }
 
         if (!NSK_JNI_VERIFY(jni, (catcher =
-                NSK_CPP_STUB3(GetStaticObjectField, jni,
-                                                    debugeeClass,
-                                                    fid )) != NULL )) {
+                jni->GetStaticObjectField(debugeeClass, fid)) != NULL )) {
             NSK_COMPLAIN0("GetStaticObjectField returned NULL for 'catcher' field value\n\n");
             nsk_jvmti_setFailStatus();
             break;
@@ -190,11 +174,9 @@
 
         NSK_DISPLAY0("Calling IterateOverObjectsReachableFromObject\n");
         obj_count = 0;
-        if (!NSK_JVMTI_VERIFY(
-                NSK_CPP_STUB4(IterateOverObjectsReachableFromObject, jvmti,
-                                                                     catcher,
-                                                                     objectReferenceCallback,
-                                                                     &user_data))) {
+        if (!NSK_JVMTI_VERIFY(jvmti->IterateOverObjectsReachableFromObject(catcher,
+                                                                           objectReferenceCallback,
+                                                                           &user_data))) {
             nsk_jvmti_setFailStatus();
             break;
         }
@@ -239,12 +221,10 @@
     memset(&caps, 0, sizeof(jvmtiCapabilities));
     caps.can_generate_object_free_events = 1;
     caps.can_tag_objects = 1;
-    if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB2(AddCapabilities,
-            jvmti, &caps)))
+    if (!NSK_JVMTI_VERIFY(jvmti->AddCapabilities(&caps)))
         return JNI_ERR;
 
-    if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB2(GetCapabilities,
-            jvmti, &caps)))
+    if (!NSK_JVMTI_VERIFY(jvmti->GetCapabilities(&caps)))
         return JNI_ERR;
 
     if (!caps.can_generate_object_free_events)
@@ -258,13 +238,13 @@
 
     callbacks.ObjectFree = &ObjectFree;
 
-    if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB3(SetEventCallbacks,
-            jvmti, &callbacks, sizeof(callbacks))))
+    if (!NSK_JVMTI_VERIFY(jvmti->SetEventCallbacks(&callbacks, sizeof(callbacks))))
         return JNI_ERR;
 
     NSK_DISPLAY0("setting event callbacks done\nenabling JVMTI events ...\n");
-    if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB4(SetEventNotificationMode,
-            jvmti, JVMTI_ENABLE, JVMTI_EVENT_OBJECT_FREE, NULL)))
+    if (!NSK_JVMTI_VERIFY(jvmti->SetEventNotificationMode(JVMTI_ENABLE,
+                                                          JVMTI_EVENT_OBJECT_FREE,
+                                                          NULL)))
         return JNI_ERR;
     NSK_DISPLAY0("enabling the events done\n\n");
 
--- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/allocation/AP04/ap04t001/ap04t001.cpp	Fri Oct 05 17:01:07 2018 -0400
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/allocation/AP04/ap04t001/ap04t001.cpp	Tue Oct 09 14:37:59 2018 +0200
@@ -66,30 +66,26 @@
 
 static void increaseCounter(volatile int* counterPtr) {
 
-    if (!NSK_JVMTI_VERIFY(
-            NSK_CPP_STUB2(RawMonitorEnter, jvmti, counterMonitor_ptr))) {
+    if (!NSK_JVMTI_VERIFY(jvmti->RawMonitorEnter(counterMonitor_ptr))) {
         nsk_jvmti_setFailStatus();
     }
 
     (*counterPtr)++;
 
-    if (!NSK_JVMTI_VERIFY(
-            NSK_CPP_STUB2(RawMonitorExit, jvmti, counterMonitor_ptr))) {
+    if (!NSK_JVMTI_VERIFY(jvmti->RawMonitorExit(counterMonitor_ptr))) {
         nsk_jvmti_setFailStatus();
     }
 }
 
 static void setCounter(volatile int* counterPtr, int value) {
 
-    if (!NSK_JVMTI_VERIFY(
-            NSK_CPP_STUB2(RawMonitorEnter, jvmti, counterMonitor_ptr))) {
+    if (!NSK_JVMTI_VERIFY(jvmti->RawMonitorEnter(counterMonitor_ptr))) {
         nsk_jvmti_setFailStatus();
     }
 
     *counterPtr = value;
 
-    if (!NSK_JVMTI_VERIFY(
-            NSK_CPP_STUB2(RawMonitorExit, jvmti, counterMonitor_ptr))) {
+    if (!NSK_JVMTI_VERIFY(jvmti->RawMonitorExit(counterMonitor_ptr))) {
         nsk_jvmti_setFailStatus();
     }
 }
@@ -97,15 +93,13 @@
 static int getCounter(volatile int* counterPtr) {
     int result;
 
-    if (!NSK_JVMTI_VERIFY(
-            NSK_CPP_STUB2(RawMonitorEnter, jvmti, counterMonitor_ptr))) {
+    if (!NSK_JVMTI_VERIFY(jvmti->RawMonitorEnter(counterMonitor_ptr))) {
         nsk_jvmti_setFailStatus();
     }
 
     result = *counterPtr;
 
-    if (!NSK_JVMTI_VERIFY(
-            NSK_CPP_STUB2(RawMonitorExit, jvmti, counterMonitor_ptr))) {
+    if (!NSK_JVMTI_VERIFY(jvmti->RawMonitorExit(counterMonitor_ptr))) {
         nsk_jvmti_setFailStatus();
     }
 
@@ -248,7 +242,7 @@
                                                           jobject target, /* object to be tagged */
                                                           jlong   tag ) {
 
-    if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB3(SetTag, jvmti, target, tag))) {
+    if (!NSK_JVMTI_VERIFY(jvmti->SetTag(target, tag))) {
         nsk_jvmti_setFailStatus();
     }
 }
@@ -258,7 +252,7 @@
                                                           jclass  klass) {
 
 NSK_DISPLAY0("  run: ForceGarbageCollection\n");
-    if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB1(ForceGarbageCollection, jvmti))) {
+    if (!NSK_JVMTI_VERIFY(jvmti->ForceGarbageCollection())) {
         nsk_jvmti_setFailStatus();
     }
 }
@@ -273,11 +267,9 @@
     setCounter(&iterationCount, 0);
 
     NSK_DISPLAY0("Calling IterateOverHeap...\n");
-    if (!NSK_JVMTI_VERIFY(
-            NSK_CPP_STUB4(IterateOverHeap, jvmti,
-                                           JVMTI_HEAP_OBJECT_TAGGED,
-                                           heapObjectCallback,
-                                           NULL /*user_data*/))) {
+    if (!NSK_JVMTI_VERIFY(jvmti->IterateOverHeap(JVMTI_HEAP_OBJECT_TAGGED,
+                                                 heapObjectCallback,
+                                                 NULL /*user_data*/))) {
         nsk_jvmti_setFailStatus();
     }
     NSK_DISPLAY0("IterateOverHeap finished.\n");
@@ -303,12 +295,10 @@
     setCounter(&iterationCount, 0);
 
     NSK_DISPLAY0("Calling IterateOverReachableObjects...\n");
-    if (!NSK_JVMTI_VERIFY(
-            NSK_CPP_STUB5(IterateOverReachableObjects, jvmti,
-                                                       heapRootCallback,
-                                                       stackReferenceCallback,
-                                                       objectReferenceCallback,
-                                                       NULL /*user_data*/))) {
+    if (!NSK_JVMTI_VERIFY(jvmti->IterateOverReachableObjects(heapRootCallback,
+                                                             stackReferenceCallback,
+                                                             objectReferenceCallback,
+                                                             NULL /*user_data*/))) {
         nsk_jvmti_setFailStatus();
     }
     NSK_DISPLAY0("IterateOverReachableObjects finished.\n");
@@ -334,12 +324,10 @@
     setCounter(&iterationCount, 0);
 
     NSK_DISPLAY0("Calling IterateOverInstancesOfClass...\n");
-    if (!NSK_JVMTI_VERIFY(
-            NSK_CPP_STUB5(IterateOverInstancesOfClass, jvmti,
-                                                       debugeeClass,
-                                                       JVMTI_HEAP_OBJECT_TAGGED,
-                                                       heapObjectCallback,
-                                                       NULL /*user_data*/))) {
+    if (!NSK_JVMTI_VERIFY(jvmti->IterateOverInstancesOfClass(debugeeClass,
+                                                             JVMTI_HEAP_OBJECT_TAGGED,
+                                                             heapObjectCallback,
+                                                             NULL /*user_data*/))) {
         nsk_jvmti_setFailStatus();
     }
     NSK_DISPLAY0("IterateOverInstancesOfClass finished.\n");
@@ -363,27 +351,23 @@
     int count = 0;
 
     if (!NSK_JNI_VERIFY(jni, (root =
-            NSK_CPP_STUB3(GetStaticObjectField, jni,
-                                                debugeeClass,
-                                                rootFieldID )) != NULL )) {
+            jni->GetStaticObjectField(debugeeClass, rootFieldID)) != NULL )) {
         NSK_COMPLAIN0("GetStaticObjectField returned NULL for 'root' field value\n\n");
         nsk_jvmti_setFailStatus();
         return;
     }
 
     // release secondary lock
-    NSK_CPP_STUB3(CallStaticVoidMethod, jni, debugeeClass, unlockSecondaryID);
+    jni->CallStaticVoidMethod(debugeeClass, unlockSecondaryID);
 
     setCounter(&errorCount, 0);
     setCounter(&eventCount, 0);
     setCounter(&iterationCount, 0);
 
     NSK_DISPLAY0("Calling IterateOverObjectsReachableFromObject...\n");
-    if (!NSK_JVMTI_VERIFY(
-            NSK_CPP_STUB4(IterateOverObjectsReachableFromObject, jvmti,
-                                                                 root,
-                                                                 objectReferenceCallback,
-                                                                 NULL /*user_data*/))) {
+    if (!NSK_JVMTI_VERIFY(jvmti->IterateOverObjectsReachableFromObject(root,
+                                                                       objectReferenceCallback,
+                                                                       NULL /*user_data*/))) {
         nsk_jvmti_setFailStatus();
     }
     NSK_DISPLAY0("IterateOverObjectsReachableFromObject finished.\n");
@@ -413,26 +397,19 @@
         return;
     }
 
-    if (!NSK_JNI_VERIFY(jni, (debugeeClass = (jclass)
-            NSK_CPP_STUB2(NewGlobalRef, jni, debugeeClass)) != NULL))
+    if (!NSK_JNI_VERIFY(jni, (debugeeClass = (jclass)jni->NewGlobalRef(debugeeClass)) != NULL))
         return;
 
     NSK_DISPLAY1("Find ID of 'root' field: %s\n", ROOT_SIGNATURE);
     if (!NSK_JNI_VERIFY(jni, (rootFieldID =
-            NSK_CPP_STUB4(GetStaticFieldID, jni,
-                                            debugeeClass,
-                                            "root",
-                                            ROOT_SIGNATURE)) != NULL )) {
+            jni->GetStaticFieldID(debugeeClass, "root", ROOT_SIGNATURE)) != NULL )) {
         nsk_jvmti_setFailStatus();
         return;
     }
 
     NSK_DISPLAY1("Find ID of 'unlockSecondary' method: %s\n", ROOT_SIGNATURE);
     if (!NSK_JNI_VERIFY(jni, (unlockSecondaryID =
-            NSK_CPP_STUB4(GetStaticMethodID, jni,
-                                            debugeeClass,
-                                            "unlockSecondary",
-                                            "()V")) != NULL )) {
+            jni->GetStaticMethodID(debugeeClass, "unlockSecondary", "()V")) != NULL )) {
         nsk_jvmti_setFailStatus();
         return;
     }
@@ -448,8 +425,8 @@
 
     nsk_jvmti_enableEvents(JVMTI_DISABLE, eventsCount, events, NULL);
 
-    NSK_TRACE(NSK_CPP_STUB2(DeleteGlobalRef, jni, debugeeClass));
-    NSK_TRACE(NSK_CPP_STUB2(DestroyRawMonitor, jvmti, counterMonitor_ptr));
+    NSK_TRACE(jni->DeleteGlobalRef(debugeeClass));
+    NSK_TRACE(jvmti->DestroyRawMonitor(counterMonitor_ptr));
 
     NSK_DISPLAY0("Let debugee to finish\n");
     if (!NSK_VERIFY(nsk_jvmti_resumeSync()))
@@ -477,8 +454,7 @@
             nsk_jvmti_createJVMTIEnv(jvm, reserved)) != NULL))
         return JNI_ERR;
 
-    if (!NSK_JVMTI_VERIFY(
-            NSK_CPP_STUB3(CreateRawMonitor, jvmti, "counterMonitor", &counterMonitor_ptr))) {
+    if (!NSK_JVMTI_VERIFY(jvmti->CreateRawMonitor("counterMonitor", &counterMonitor_ptr))) {
         return JNI_ERR;
     }
 
@@ -487,12 +463,10 @@
     caps.can_generate_object_free_events = 1;
     caps.can_generate_garbage_collection_events = 1;
 
-    if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB2(AddCapabilities,
-            jvmti, &caps)))
+    if (!NSK_JVMTI_VERIFY(jvmti->AddCapabilities(&caps)))
         return JNI_ERR;
 
-    if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB2(GetCapabilities,
-            jvmti, &caps)))
+    if (!NSK_JVMTI_VERIFY(jvmti->GetCapabilities(&caps)))
         return JNI_ERR;
 
     if (!caps.can_tag_objects)
@@ -509,8 +483,7 @@
     callbacks.ObjectFree = &ObjectFree;
     callbacks.GarbageCollectionStart = &GarbageCollectionStart;
     callbacks.GarbageCollectionFinish = &GarbageCollectionFinish;
-    if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB3(SetEventCallbacks,
-            jvmti, &callbacks, sizeof(callbacks))))
+    if (!NSK_JVMTI_VERIFY(jvmti->SetEventCallbacks(&callbacks, sizeof(callbacks))))
         return JNI_ERR;
 
     NSK_DISPLAY0("setting event callbacks done.\n");
--- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/allocation/AP04/ap04t002/ap04t002.cpp	Fri Oct 05 17:01:07 2018 -0400
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/allocation/AP04/ap04t002/ap04t002.cpp	Tue Oct 09 14:37:59 2018 +0200
@@ -59,30 +59,26 @@
 
 static void increaseCounter(volatile int* counterPtr) {
 
-    if (!NSK_JVMTI_VERIFY(
-            NSK_CPP_STUB2(RawMonitorEnter, jvmti, counterMonitor_ptr))) {
+    if (!NSK_JVMTI_VERIFY(jvmti->RawMonitorEnter(counterMonitor_ptr))) {
         nsk_jvmti_setFailStatus();
     }
 
     (*counterPtr)++;
 
-    if (!NSK_JVMTI_VERIFY(
-            NSK_CPP_STUB2(RawMonitorExit, jvmti, counterMonitor_ptr))) {
+    if (!NSK_JVMTI_VERIFY(jvmti->RawMonitorExit(counterMonitor_ptr))) {
         nsk_jvmti_setFailStatus();
     }
 }
 
 static void setCounter(volatile int* counterPtr, int value) {
 
-    if (!NSK_JVMTI_VERIFY(
-            NSK_CPP_STUB2(RawMonitorEnter, jvmti, counterMonitor_ptr))) {
+    if (!NSK_JVMTI_VERIFY(jvmti->RawMonitorEnter(counterMonitor_ptr))) {
         nsk_jvmti_setFailStatus();
     }
 
     *counterPtr = value;
 
-    if (!NSK_JVMTI_VERIFY(
-            NSK_CPP_STUB2(RawMonitorExit, jvmti, counterMonitor_ptr))) {
+    if (!NSK_JVMTI_VERIFY(jvmti->RawMonitorExit(counterMonitor_ptr))) {
         nsk_jvmti_setFailStatus();
     }
 }
@@ -90,15 +86,13 @@
 static int getCounter(volatile int* counterPtr) {
     int result;
 
-    if (!NSK_JVMTI_VERIFY(
-            NSK_CPP_STUB2(RawMonitorEnter, jvmti, counterMonitor_ptr))) {
+    if (!NSK_JVMTI_VERIFY(jvmti->RawMonitorEnter(counterMonitor_ptr))) {
         nsk_jvmti_setFailStatus();
     }
 
     result = *counterPtr;
 
-    if (!NSK_JVMTI_VERIFY(
-            NSK_CPP_STUB2(RawMonitorExit, jvmti, counterMonitor_ptr))) {
+    if (!NSK_JVMTI_VERIFY(jvmti->RawMonitorExit(counterMonitor_ptr))) {
         nsk_jvmti_setFailStatus();
     }
 
@@ -238,7 +232,7 @@
                                                           jobject target, /* object to be tagged */
                                                           jlong   tag ) {
 
-    if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB3(SetTag, jvmti, target, tag))) {
+    if (!NSK_JVMTI_VERIFY(jvmti->SetTag(target, tag))) {
         nsk_jvmti_setFailStatus();
     }
 }
@@ -253,11 +247,9 @@
     setCounter(&iterationCount, 0);
 
     NSK_DISPLAY0("Calling IterateOverHeap...\n");
-    if (!NSK_JVMTI_VERIFY(
-            NSK_CPP_STUB4(IterateOverHeap, jvmti,
-                                           JVMTI_HEAP_OBJECT_TAGGED,
-                                           heapObjectCallback,
-                                           NULL /*user_data*/))) {
+    if (!NSK_JVMTI_VERIFY(jvmti->IterateOverHeap(JVMTI_HEAP_OBJECT_TAGGED,
+                                                 heapObjectCallback,
+                                                 NULL /*user_data*/))) {
         nsk_jvmti_setFailStatus();
     }
     NSK_DISPLAY0("IterateOverHeap finished.\n");
@@ -284,12 +276,10 @@
     setCounter(&iterationCount, 0);
 
     NSK_DISPLAY0("Calling IterateOverReachableObjects...\n");
-    if (!NSK_JVMTI_VERIFY(
-            NSK_CPP_STUB5(IterateOverReachableObjects, jvmti,
-                                                       heapRootCallback,
-                                                       stackReferenceCallback,
-                                                       objectReferenceCallback,
-                                                       NULL /*user_data*/))) {
+    if (!NSK_JVMTI_VERIFY(jvmti->IterateOverReachableObjects(heapRootCallback,
+                                                             stackReferenceCallback,
+                                                             objectReferenceCallback,
+                                                             NULL /*user_data*/))) {
         nsk_jvmti_setFailStatus();
     }
     NSK_DISPLAY0("IterateOverReachableObjects finished.\n");
@@ -316,12 +306,10 @@
     setCounter(&iterationCount, 0);
 
     NSK_DISPLAY0("Calling IterateOverInstancesOfClass...\n");
-    if (!NSK_JVMTI_VERIFY(
-            NSK_CPP_STUB5(IterateOverInstancesOfClass, jvmti,
-                                                       debugeeClass,
-                                                       JVMTI_HEAP_OBJECT_TAGGED,
-                                                       heapObjectCallback,
-                                                       NULL /*user_data*/))) {
+    if (!NSK_JVMTI_VERIFY(jvmti->IterateOverInstancesOfClass(debugeeClass,
+                                                             JVMTI_HEAP_OBJECT_TAGGED,
+                                                             heapObjectCallback,
+                                                             NULL /*user_data*/))) {
         nsk_jvmti_setFailStatus();
     }
     NSK_DISPLAY0("IterateOverInstancesOfClass finished.\n");
@@ -345,9 +333,7 @@
     int count = 0;
 
     if (!NSK_JNI_VERIFY(jni, (root =
-                NSK_CPP_STUB3(GetStaticObjectField, jni,
-                                                    debugeeClass,
-                                                    rootFieldID )) != NULL )) {
+                jni->GetStaticObjectField(debugeeClass, rootFieldID)) != NULL )) {
         NSK_COMPLAIN0("GetStaticObjectField returned NULL for 'root' field value\n\n");
         nsk_jvmti_setFailStatus();
         return;
@@ -358,11 +344,9 @@
     setCounter(&iterationCount, 0);
 
     NSK_DISPLAY0("Calling IterateOverObjectsReachableFromObject...\n");
-    if (!NSK_JVMTI_VERIFY(
-                NSK_CPP_STUB4(IterateOverObjectsReachableFromObject, jvmti,
-                                                                     root,
-                                                                     objectReferenceCallback,
-                                                                     NULL /*user_data*/))) {
+    if (!NSK_JVMTI_VERIFY(jvmti->IterateOverObjectsReachableFromObject(root,
+                                                                       objectReferenceCallback,
+                                                                       NULL /*user_data*/))) {
         nsk_jvmti_setFailStatus();
     }
     NSK_DISPLAY0("IterateOverObjectsReachableFromObject finished.\n");
@@ -393,35 +377,25 @@
         return;
     }
 
-    if (!NSK_JNI_VERIFY(jni, (debugeeClass = (jclass)
-            NSK_CPP_STUB2(NewGlobalRef, jni, debugeeClass)) != NULL))
+    if (!NSK_JNI_VERIFY(jni, (debugeeClass = (jclass)jni->NewGlobalRef(debugeeClass)) != NULL))
         return;
 
     NSK_DISPLAY1("Find ID of 'root' field: %s\n", ROOT_SIGNATURE);
     if (!NSK_JNI_VERIFY(jni, (rootFieldID =
-            NSK_CPP_STUB4(GetStaticFieldID, jni,
-                                            debugeeClass,
-                                            "root",
-                                            ROOT_SIGNATURE)) != NULL )) {
+            jni->GetStaticFieldID(debugeeClass, "root", ROOT_SIGNATURE)) != NULL )) {
         nsk_jvmti_setFailStatus();
         return;
     }
 
     NSK_DISPLAY0("Find ID of 'modified' field\n");
     if (!NSK_JNI_VERIFY(jni, (modifiedFieldID =
-            NSK_CPP_STUB4(GetStaticFieldID, jni,
-                                            debugeeClass,
-                                            "modified",
-                                            "I")) != NULL )) {
+            jni->GetStaticFieldID(debugeeClass, "modified", "I")) != NULL )) {
         nsk_jvmti_setFailStatus();
         return;
     }
 
     NSK_DISPLAY0("Set FieldModification watchpoint for 'modified' field\n");
-    if (!NSK_JVMTI_VERIFY(
-            NSK_CPP_STUB3(SetFieldModificationWatch, jvmti,
-                                                     debugeeClass,
-                                                     modifiedFieldID))) {
+    if (!NSK_JVMTI_VERIFY(jvmti->SetFieldModificationWatch(debugeeClass, modifiedFieldID))) {
         nsk_jvmti_setFailStatus();
         return;
     }
@@ -434,8 +408,8 @@
     if (!NSK_VERIFY(nsk_jvmti_waitForSync(timeout)))
         return;
 
-    NSK_TRACE(NSK_CPP_STUB2(DeleteGlobalRef, jni, debugeeClass));
-    NSK_TRACE(NSK_CPP_STUB2(DestroyRawMonitor, jvmti, counterMonitor_ptr));
+    NSK_TRACE(jni->DeleteGlobalRef(debugeeClass));
+    NSK_TRACE(jvmti->DestroyRawMonitor(counterMonitor_ptr));
 
     NSK_DISPLAY0("Let debugee to finish\n");
     if (!NSK_VERIFY(nsk_jvmti_resumeSync()))
@@ -463,8 +437,7 @@
             nsk_jvmti_createJVMTIEnv(jvm, reserved)) != NULL))
         return JNI_ERR;
 
-    if (!NSK_JVMTI_VERIFY(
-            NSK_CPP_STUB3(CreateRawMonitor, jvmti, "counterMonitor", &counterMonitor_ptr))) {
+    if (!NSK_JVMTI_VERIFY(jvmti->CreateRawMonitor("counterMonitor", &counterMonitor_ptr))) {
         return JNI_ERR;
     }
 
@@ -472,12 +445,10 @@
     caps.can_tag_objects = 1;
     caps.can_generate_field_modification_events = 1;
 
-    if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB2(AddCapabilities,
-            jvmti, &caps)))
+    if (!NSK_JVMTI_VERIFY(jvmti->AddCapabilities(&caps)))
         return JNI_ERR;
 
-    if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB2(GetCapabilities,
-            jvmti, &caps)))
+    if (!NSK_JVMTI_VERIFY(jvmti->GetCapabilities(&caps)))
         return JNI_ERR;
 
     if (!caps.can_tag_objects)
@@ -490,18 +461,15 @@
     (void) memset(&callbacks, 0, sizeof(callbacks));
 
     callbacks.FieldModification = &FieldModification;
-    if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB3(SetEventCallbacks,
-            jvmti, &callbacks, sizeof(callbacks))))
+    if (!NSK_JVMTI_VERIFY(jvmti->SetEventCallbacks(&callbacks, sizeof(callbacks))))
         return JNI_ERR;
 
     NSK_DISPLAY0("setting event callbacks done.\n");
 
     NSK_DISPLAY0("enabling JVMTI events ...\n");
-    if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB4( SetEventNotificationMode,
-                                         jvmti,
-                                         JVMTI_ENABLE,
-                                         JVMTI_EVENT_FIELD_MODIFICATION,
-                                         NULL)))
+    if (!NSK_JVMTI_VERIFY(jvmti->SetEventNotificationMode(JVMTI_ENABLE,
+                                                          JVMTI_EVENT_FIELD_MODIFICATION,
+                                                          NULL)))
         return JNI_ERR;
     NSK_DISPLAY0("enabling the events done.\n");
 
--- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/allocation/AP04/ap04t003/ap04t003.cpp	Fri Oct 05 17:01:07 2018 -0400
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/allocation/AP04/ap04t003/ap04t003.cpp	Tue Oct 09 14:37:59 2018 +0200
@@ -61,30 +61,26 @@
 
 static void increaseCounter(volatile int* counterPtr) {
 
-    if (!NSK_JVMTI_VERIFY(
-            NSK_CPP_STUB2(RawMonitorEnter, jvmti, counterMonitor_ptr))) {
+    if (!NSK_JVMTI_VERIFY(jvmti->RawMonitorEnter(counterMonitor_ptr))) {
         nsk_jvmti_setFailStatus();
     }
 
     (*counterPtr)++;
 
-    if (!NSK_JVMTI_VERIFY(
-            NSK_CPP_STUB2(RawMonitorExit, jvmti, counterMonitor_ptr))) {
+    if (!NSK_JVMTI_VERIFY(jvmti->RawMonitorExit(counterMonitor_ptr))) {
         nsk_jvmti_setFailStatus();
     }
 }
 
 static void setCounter(volatile int* counterPtr, int value) {
 
-    if (!NSK_JVMTI_VERIFY(
-            NSK_CPP_STUB2(RawMonitorEnter, jvmti, counterMonitor_ptr))) {
+    if (!NSK_JVMTI_VERIFY(jvmti->RawMonitorEnter(counterMonitor_ptr))) {
         nsk_jvmti_setFailStatus();
     }
 
     *counterPtr = value;
 
-    if (!NSK_JVMTI_VERIFY(
-            NSK_CPP_STUB2(RawMonitorExit, jvmti, counterMonitor_ptr))) {
+    if (!NSK_JVMTI_VERIFY(jvmti->RawMonitorExit(counterMonitor_ptr))) {
         nsk_jvmti_setFailStatus();
     }
 }
@@ -92,15 +88,13 @@
 static int getCounter(volatile int* counterPtr) {
     int result;
 
-    if (!NSK_JVMTI_VERIFY(
-            NSK_CPP_STUB2(RawMonitorEnter, jvmti, counterMonitor_ptr))) {
+    if (!NSK_JVMTI_VERIFY(jvmti->RawMonitorEnter(counterMonitor_ptr))) {
         nsk_jvmti_setFailStatus();
     }
 
     result = *counterPtr;
 
-    if (!NSK_JVMTI_VERIFY(
-            NSK_CPP_STUB2(RawMonitorExit, jvmti, counterMonitor_ptr))) {
+    if (!NSK_JVMTI_VERIFY(jvmti->RawMonitorExit(counterMonitor_ptr))) {
         nsk_jvmti_setFailStatus();
     }
 
@@ -113,16 +107,13 @@
 
     /* enter and notify runLock */
     {
-        if (!NSK_JVMTI_VERIFY(
-                NSK_CPP_STUB2(RawMonitorEnter, jvmti, runLock))) {
+        if (!NSK_JVMTI_VERIFY(jvmti->RawMonitorEnter(runLock))) {
             nsk_jvmti_setFailStatus();
         }
-        if (!NSK_JVMTI_VERIFY(
-                NSK_CPP_STUB2(RawMonitorNotify, jvmti, runLock))) {
+        if (!NSK_JVMTI_VERIFY(jvmti->RawMonitorNotify(runLock))) {
             nsk_jvmti_setFailStatus();
         }
-        if (!NSK_JVMTI_VERIFY(
-                NSK_CPP_STUB2(RawMonitorExit, jvmti, runLock))) {
+        if (!NSK_JVMTI_VERIFY(jvmti->RawMonitorExit(runLock))) {
             nsk_jvmti_setFailStatus();
         }
     }
@@ -227,12 +218,8 @@
     {
         jlong tag = (jlong)1;
 
-        if (!NSK_JVMTI_VERIFY(
-                NSK_CPP_STUB6(GetObjectsWithTags, jvmti,
-                                              1, &tag,
-                                              &taggedObjectsCount,
-                                              &taggedObjectsList,
-                                              NULL))) {
+        if (!NSK_JVMTI_VERIFY(jvmti->GetObjectsWithTags(
+                1, &tag, &taggedObjectsCount, &taggedObjectsList, NULL))) {
             nsk_jvmti_setFailStatus();
             return;
         }
@@ -246,23 +233,19 @@
     }
 
     /* enter runLock */
-    if (!NSK_JVMTI_VERIFY(
-            NSK_CPP_STUB2(RawMonitorEnter, jvmti, runLock))) {
+    if (!NSK_JVMTI_VERIFY(jvmti->RawMonitorEnter(runLock))) {
         nsk_jvmti_setFailStatus();
     }
 
     /* enter and notify startLock */
     {
-        if (!NSK_JVMTI_VERIFY(
-                NSK_CPP_STUB2(RawMonitorEnter, jvmti, startLock))) {
+        if (!NSK_JVMTI_VERIFY(jvmti->RawMonitorEnter(startLock))) {
             nsk_jvmti_setFailStatus();
         }
-        if (!NSK_JVMTI_VERIFY(
-                NSK_CPP_STUB2(RawMonitorNotify, jvmti, startLock))) {
+        if (!NSK_JVMTI_VERIFY(jvmti->RawMonitorNotify(startLock))) {
             nsk_jvmti_setFailStatus();
         }
-        if (!NSK_JVMTI_VERIFY(
-                NSK_CPP_STUB2(RawMonitorExit, jvmti, startLock))) {
+        if (!NSK_JVMTI_VERIFY(jvmti->RawMonitorExit(startLock))) {
             nsk_jvmti_setFailStatus();
         }
     }
@@ -271,12 +254,10 @@
 
     /* wait on runLock */
     {
-        if (!NSK_JVMTI_VERIFY(
-                NSK_CPP_STUB3(RawMonitorWait, jvmti, runLock, timeout))) {
+        if (!NSK_JVMTI_VERIFY(jvmti->RawMonitorWait(runLock, timeout))) {
             nsk_jvmti_setFailStatus();
         }
-        if (!NSK_JVMTI_VERIFY(
-                NSK_CPP_STUB2(RawMonitorExit, jvmti, runLock))) {
+        if (!NSK_JVMTI_VERIFY(jvmti->RawMonitorExit(runLock))) {
             nsk_jvmti_setFailStatus();
         }
     }
@@ -288,8 +269,7 @@
         int modified = 0;
         int i;
         for (i = 0; i < taggedObjectsCount; i+=2) {
-            if (!NSK_JVMTI_VERIFY(
-                    NSK_CPP_STUB3(SetTag, jvmti, taggedObjectsList[i], 0))) {
+            if (!NSK_JVMTI_VERIFY(jvmti->SetTag(taggedObjectsList[i], 0))) {
                 nsk_jvmti_setFailStatus();
                 continue;
             }
@@ -302,24 +282,20 @@
 
     /* destroy objects list */
     {
-        if (!NSK_JVMTI_VERIFY(
-                NSK_CPP_STUB2(Deallocate, jvmti, (unsigned char*)taggedObjectsList))) {
+        if (!NSK_JVMTI_VERIFY(jvmti->Deallocate((unsigned char*)taggedObjectsList))) {
             nsk_jvmti_setFailStatus();
         }
     }
 
     /* enter and notify endLock */
     {
-        if (!NSK_JVMTI_VERIFY(
-                NSK_CPP_STUB2(RawMonitorEnter, jvmti, endLock))) {
+        if (!NSK_JVMTI_VERIFY(jvmti->RawMonitorEnter(endLock))) {
             nsk_jvmti_setFailStatus();
         }
-        if (!NSK_JVMTI_VERIFY(
-                NSK_CPP_STUB2(RawMonitorNotify, jvmti, endLock))) {
+        if (!NSK_JVMTI_VERIFY(jvmti->RawMonitorNotify(endLock))) {
             nsk_jvmti_setFailStatus();
         }
-        if (!NSK_JVMTI_VERIFY(
-                NSK_CPP_STUB2(RawMonitorExit, jvmti, endLock))) {
+        if (!NSK_JVMTI_VERIFY(jvmti->RawMonitorExit(endLock))) {
             nsk_jvmti_setFailStatus();
         }
     }
@@ -333,31 +309,24 @@
     int success = NSK_TRUE;
 
     /* enter startLock */
-    if (!NSK_JVMTI_VERIFY(
-            NSK_CPP_STUB2(RawMonitorEnter, jvmti, startLock))) {
+    if (!NSK_JVMTI_VERIFY(jvmti->RawMonitorEnter(startLock))) {
         nsk_jvmti_setFailStatus();
     }
 
     /* start thread */
     if (!NSK_JVMTI_VERIFY(
-            NSK_CPP_STUB5(RunAgentThread, jvmti,
-                                          threadObj,
-                                          agent_start,
-                                          NULL,
-                                          JVMTI_THREAD_NORM_PRIORITY))) {
+            jvmti->RunAgentThread(threadObj, agent_start, NULL, JVMTI_THREAD_NORM_PRIORITY))) {
         success = NSK_FALSE;
         nsk_jvmti_setFailStatus();
     } else {
         /* wait on startLock */
-        if (!NSK_JVMTI_VERIFY(
-                NSK_CPP_STUB3(RawMonitorWait, jvmti, startLock, timeout))) {
+        if (!NSK_JVMTI_VERIFY(jvmti->RawMonitorWait(startLock, timeout))) {
             nsk_jvmti_setFailStatus();
         }
     }
 
     /* exit starLock */
-    if (!NSK_JVMTI_VERIFY(
-            NSK_CPP_STUB2(RawMonitorExit, jvmti, startLock))) {
+    if (!NSK_JVMTI_VERIFY(jvmti->RawMonitorExit(startLock))) {
         nsk_jvmti_setFailStatus();
     }
 
@@ -370,26 +339,17 @@
     jmethodID cid;
     jthread result = NULL;
 
-    if (!NSK_JNI_VERIFY(jni, (thrClass =
-            NSK_CPP_STUB2(FindClass, jni,
-                                     "java/lang/Thread")) != NULL )) {
+    if (!NSK_JNI_VERIFY(jni, (thrClass = jni->FindClass("java/lang/Thread")) != NULL )) {
         nsk_jvmti_setFailStatus();
         return result;
     }
 
-    if (!NSK_JNI_VERIFY(jni, (cid =
-            NSK_CPP_STUB4(GetMethodID, jni,
-                                       thrClass,
-                                       "<init>",
-                                       "()V")) != NULL )) {
+    if (!NSK_JNI_VERIFY(jni, (cid = jni->GetMethodID(thrClass, "<init>", "()V")) != NULL )) {
         nsk_jvmti_setFailStatus();
         return result;
     }
 
-    if (!NSK_JNI_VERIFY(jni, (result =
-            NSK_CPP_STUB3(NewObject, jni,
-                                     thrClass,
-                                     cid )) != NULL )) {
+    if (!NSK_JNI_VERIFY(jni, (result = jni->NewObject(thrClass, cid)) != NULL )) {
         nsk_jvmti_setFailStatus();
         return result;
     }
@@ -412,8 +372,7 @@
     }
 
     /* enter endLock */
-    if (!NSK_JVMTI_VERIFY(
-            NSK_CPP_STUB2(RawMonitorEnter, jvmti, endLock))) {
+    if (!NSK_JVMTI_VERIFY(jvmti->RawMonitorEnter(endLock))) {
         nsk_jvmti_setFailStatus();
     }
 
@@ -430,14 +389,12 @@
     NSK_DISPLAY0("Wait for new agent thread to complete\n");
 
     /* wait on endLock */
-    if (!NSK_JVMTI_VERIFY(
-            NSK_CPP_STUB3(RawMonitorWait, jvmti, endLock, timeout))) {
+    if (!NSK_JVMTI_VERIFY(jvmti->RawMonitorWait(endLock, timeout))) {
         nsk_jvmti_setFailStatus();
     }
 
     /* exit endLock */
-    if (!NSK_JVMTI_VERIFY(
-            NSK_CPP_STUB2(RawMonitorExit, jvmti, endLock))) {
+    if (!NSK_JVMTI_VERIFY(jvmti->RawMonitorExit(endLock))) {
         nsk_jvmti_setFailStatus();
     }
 }
@@ -450,7 +407,7 @@
                                                           jobject target, /* object to be tagged */
                                                           jlong   tag ) {
 
-    if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB3(SetTag, jvmti, target, tag))) {
+    if (!NSK_JVMTI_VERIFY(jvmti->SetTag(target, tag))) {
         nsk_jvmti_setFailStatus();
     }
 }
@@ -465,11 +422,9 @@
         return;
 
     NSK_DISPLAY0("Calling IterateOverHeap...\n");
-    if (!NSK_JVMTI_VERIFY(
-            NSK_CPP_STUB4(IterateOverHeap, jvmti,
-                                           JVMTI_HEAP_OBJECT_TAGGED,
-                                           heapObjectCallback,
-                                           NULL /*user_data*/))) {
+    if (!NSK_JVMTI_VERIFY(jvmti->IterateOverHeap(JVMTI_HEAP_OBJECT_TAGGED,
+                                                 heapObjectCallback,
+                                                 NULL /*user_data*/))) {
         nsk_jvmti_setFailStatus();
     }
     NSK_DISPLAY0("IterateOverHeap finished.\n");
@@ -497,12 +452,10 @@
         return;
 
     NSK_DISPLAY0("Calling IterateOverReachableObjects...\n");
-    if (!NSK_JVMTI_VERIFY(
-            NSK_CPP_STUB5(IterateOverReachableObjects, jvmti,
-                                                       heapRootCallback,
-                                                       stackReferenceCallback,
-                                                       objectReferenceCallback,
-                                                       NULL /*user_data*/))) {
+    if (!NSK_JVMTI_VERIFY(jvmti->IterateOverReachableObjects(heapRootCallback,
+                                                             stackReferenceCallback,
+                                                             objectReferenceCallback,
+                                                             NULL /*user_data*/))) {
         nsk_jvmti_setFailStatus();
     }
     NSK_DISPLAY0("IterateOverReachableObjects finished.\n");
@@ -530,12 +483,10 @@
         return;
 
     NSK_DISPLAY0("Calling IterateOverInstancesOfClass...\n");
-    if (!NSK_JVMTI_VERIFY(
-            NSK_CPP_STUB5(IterateOverInstancesOfClass, jvmti,
-                                                       debugeeClass,
-                                                       JVMTI_HEAP_OBJECT_TAGGED,
-                                                       heapObjectCallback,
-                                                       NULL /*user_data*/))) {
+    if (!NSK_JVMTI_VERIFY(jvmti->IterateOverInstancesOfClass(debugeeClass,
+                                                             JVMTI_HEAP_OBJECT_TAGGED,
+                                                             heapObjectCallback,
+                                                             NULL /*user_data*/))) {
         nsk_jvmti_setFailStatus();
     }
     NSK_DISPLAY0("IterateOverInstancesOfClass finished.\n");
@@ -561,9 +512,7 @@
     int found = 0;
 
     if (!NSK_JNI_VERIFY(jni, (root =
-            NSK_CPP_STUB3(GetStaticObjectField, jni,
-                                                debugeeClass,
-                                                rootFieldID )) != NULL )) {
+            jni->GetStaticObjectField(debugeeClass, rootFieldID)) != NULL )) {
         NSK_COMPLAIN0("GetStaticObjectField returned NULL for 'root' field value\n\n");
         nsk_jvmti_setFailStatus();
         return;
@@ -573,11 +522,9 @@
         return;
 
     NSK_DISPLAY0("Calling IterateOverObjectsReachableFromObject...\n");
-    if (!NSK_JVMTI_VERIFY(
-            NSK_CPP_STUB4(IterateOverObjectsReachableFromObject, jvmti,
-                                                                 root,
-                                                                 objectReferenceCallback,
-                                                                 NULL /*user_data*/))) {
+    if (!NSK_JVMTI_VERIFY(jvmti->IterateOverObjectsReachableFromObject(root,
+                                                                       objectReferenceCallback,
+                                                                       NULL /*user_data*/))) {
         nsk_jvmti_setFailStatus();
     }
     NSK_DISPLAY0("IterateOverObjectsReachableFromObject finished.\n");
@@ -609,16 +556,12 @@
         return;
     }
 
-    if (!NSK_JNI_VERIFY(jni, (debugeeClass = (jclass)
-            NSK_CPP_STUB2(NewGlobalRef, jni, debugeeClass)) != NULL))
+    if (!NSK_JNI_VERIFY(jni, (debugeeClass = (jclass)jni->NewGlobalRef(debugeeClass)) != NULL))
         return;
 
     NSK_DISPLAY1("Find ID of 'root' field: %s\n", ROOT_SIGNATURE);
     if (!NSK_JNI_VERIFY(jni, (rootFieldID =
-            NSK_CPP_STUB4(GetStaticFieldID, jni,
-                                            debugeeClass,
-                                            "root",
-                                            ROOT_SIGNATURE)) != NULL )) {
+            jni->GetStaticFieldID(debugeeClass, "root", ROOT_SIGNATURE)) != NULL )) {
         nsk_jvmti_setFailStatus();
         return;
     }
@@ -631,11 +574,11 @@
     if (!NSK_VERIFY(nsk_jvmti_waitForSync(timeout)))
         return;
 
-    NSK_TRACE(NSK_CPP_STUB2(DeleteGlobalRef, jni, debugeeClass));
-    NSK_TRACE(NSK_CPP_STUB2(DestroyRawMonitor, jvmti, counterMonitor_ptr));
-    NSK_TRACE(NSK_CPP_STUB2(DestroyRawMonitor, jvmti, startLock));
-    NSK_TRACE(NSK_CPP_STUB2(DestroyRawMonitor, jvmti, runLock));
-    NSK_TRACE(NSK_CPP_STUB2(DestroyRawMonitor, jvmti, endLock));
+    NSK_TRACE(jni->DeleteGlobalRef(debugeeClass));
+    NSK_TRACE(jvmti->DestroyRawMonitor(counterMonitor_ptr));
+    NSK_TRACE(jvmti->DestroyRawMonitor(startLock));
+    NSK_TRACE(jvmti->DestroyRawMonitor(runLock));
+    NSK_TRACE(jvmti->DestroyRawMonitor(endLock));
 
     NSK_DISPLAY0("Let debugee to finish\n");
     if (!NSK_VERIFY(nsk_jvmti_resumeSync()))
@@ -663,33 +606,27 @@
             nsk_jvmti_createJVMTIEnv(jvm, reserved)) != NULL))
         return JNI_ERR;
 
-    if (!NSK_JVMTI_VERIFY(
-            NSK_CPP_STUB3(CreateRawMonitor, jvmti, "counterMonitor", &counterMonitor_ptr))) {
+    if (!NSK_JVMTI_VERIFY(jvmti->CreateRawMonitor("counterMonitor", &counterMonitor_ptr))) {
         return JNI_ERR;
     }
 
-    if (!NSK_JVMTI_VERIFY(
-            NSK_CPP_STUB3(CreateRawMonitor, jvmti, "startLock", &startLock))) {
+    if (!NSK_JVMTI_VERIFY(jvmti->CreateRawMonitor("startLock", &startLock))) {
         return JNI_ERR;
     }
-    if (!NSK_JVMTI_VERIFY(
-            NSK_CPP_STUB3(CreateRawMonitor, jvmti, "runLock", &runLock))) {
+    if (!NSK_JVMTI_VERIFY(jvmti->CreateRawMonitor("runLock", &runLock))) {
         return JNI_ERR;
     }
-    if (!NSK_JVMTI_VERIFY(
-            NSK_CPP_STUB3(CreateRawMonitor, jvmti, "endLock", &endLock))) {
+    if (!NSK_JVMTI_VERIFY(jvmti->CreateRawMonitor("endLock", &endLock))) {
         return JNI_ERR;
     }
 
     memset(&caps, 0, sizeof(jvmtiCapabilities));
     caps.can_tag_objects = 1;
 
-    if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB2(AddCapabilities,
-            jvmti, &caps)))
+    if (!NSK_JVMTI_VERIFY(jvmti->AddCapabilities(&caps)))
         return JNI_ERR;
 
-    if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB2(GetCapabilities,
-            jvmti, &caps)))
+    if (!NSK_JVMTI_VERIFY(jvmti->GetCapabilities(&caps)))
         return JNI_ERR;
 
     if (!caps.can_tag_objects)
--- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/allocation/AP05/ap05t001/ap05t001.cpp	Fri Oct 05 17:01:07 2018 -0400
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/allocation/AP05/ap05t001/ap05t001.cpp	Tue Oct 09 14:37:59 2018 +0200
@@ -105,15 +105,14 @@
                                                           jobject target,
                                                           jlong   tag ) {
 
-    if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB3(SetTag, jvmti, target, tag))) {
+    if (!NSK_JVMTI_VERIFY(jvmti->SetTag(target, tag))) {
         nsk_jvmti_setFailStatus();
     }
 }
 
 JNIEXPORT void JNICALL
 Java_nsk_jvmti_scenarios_allocation_AP05_ap05t001_setReferrer( JNIEnv* jni, jclass klass, jobject ref) {
-    if (!NSK_JNI_VERIFY(jni, (referrer =
-            NSK_CPP_STUB2(NewGlobalRef, jni, ref)) != NULL))
+    if (!NSK_JNI_VERIFY(jni, (referrer = jni->NewGlobalRef(ref)) != NULL))
         nsk_jvmti_setFailStatus();
 }
 
@@ -130,12 +129,10 @@
         staticFieldsCount = 0;
         instanceFieldsCount = 0;
         NSK_DISPLAY0("\nCalling IterateOverReachableObjects\n");
-        if (!NSK_JVMTI_VERIFY(
-                NSK_CPP_STUB5(IterateOverReachableObjects, jvmti,
-                                                           heapRootCallback,
-                                                           stackReferenceCallback,
-                                                           objectReferenceCallback,
-                                                           NULL /*user_data*/))) {
+        if (!NSK_JVMTI_VERIFY(jvmti->IterateOverReachableObjects(heapRootCallback,
+                                                                 stackReferenceCallback,
+                                                                 objectReferenceCallback,
+                                                                 NULL /*user_data*/))) {
             nsk_jvmti_setFailStatus();
             break;
         }
@@ -156,12 +153,8 @@
         instanceFieldsCount = 0;
         NSK_DISPLAY0("\nCalling IterateOverObjectsReachableFromObject\n");
         {
-            if (!NSK_JVMTI_VERIFY(
-                    NSK_CPP_STUB4(IterateOverObjectsReachableFromObject,
-                        jvmti,
-                        referrer,
-                        objectReferenceCallback,
-                        NULL /*user_data*/))) {
+            if (!NSK_JVMTI_VERIFY(jvmti->IterateOverObjectsReachableFromObject(
+                    referrer, objectReferenceCallback, NULL /*user_data*/))) {
                 nsk_jvmti_setFailStatus();
                 break;
             }
@@ -180,7 +173,7 @@
         }
 
 
-        NSK_TRACE(NSK_CPP_STUB2(DeleteGlobalRef, jni, referrer));
+        NSK_TRACE(jni->DeleteGlobalRef(referrer));
 
     } while (0);
 
@@ -213,12 +206,10 @@
     memset(&caps, 0, sizeof(jvmtiCapabilities));
     caps.can_tag_objects = 1;
 
-    if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB2(AddCapabilities,
-            jvmti, &caps)))
+    if (!NSK_JVMTI_VERIFY(jvmti->AddCapabilities(&caps)))
         return JNI_ERR;
 
-    if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB2(GetCapabilities,
-            jvmti, &caps)))
+    if (!NSK_JVMTI_VERIFY(jvmti->GetCapabilities(&caps)))
         return JNI_ERR;
 
     if (!caps.can_tag_objects)
--- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/allocation/AP05/ap05t002/ap05t002.cpp	Fri Oct 05 17:01:07 2018 -0400
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/allocation/AP05/ap05t002/ap05t002.cpp	Tue Oct 09 14:37:59 2018 +0200
@@ -103,7 +103,7 @@
                                                           jobject target,
                                                           jlong   tag ) {
 
-    if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB3(SetTag, jvmti, target, tag))) {
+    if (!NSK_JVMTI_VERIFY(jvmti->SetTag(target, tag))) {
         nsk_jvmti_setFailStatus();
     }
 }
@@ -111,8 +111,7 @@
 JNIEXPORT void JNICALL
 Java_nsk_jvmti_scenarios_allocation_AP05_ap05t002_setReferrer( JNIEnv* jni, jclass klass, jobject ref, jint caseNum) {
     caseNumber = caseNum;
-    if (!NSK_JNI_VERIFY(jni, (referrer =
-            NSK_CPP_STUB2(NewGlobalRef, jni, ref)) != NULL))
+    if (!NSK_JNI_VERIFY(jni, (referrer = jni->NewGlobalRef(ref)) != NULL))
         nsk_jvmti_setFailStatus();
 }
 
@@ -120,12 +119,10 @@
     NSK_DISPLAY0("\nCalling IterateOverReachableObjects\n");
     forthRef = 0;
     backRef = 0;
-    if (!NSK_JVMTI_VERIFY(
-            NSK_CPP_STUB5(IterateOverReachableObjects, jvmti,
-                                                       heapRootCallback,
-                                                       stackReferenceCallback,
-                                                       objectReferenceCallback,
-                                                       NULL /*user_data*/))) {
+    if (!NSK_JVMTI_VERIFY(jvmti->IterateOverReachableObjects(heapRootCallback,
+                                                             stackReferenceCallback,
+                                                             objectReferenceCallback,
+                                                             NULL /*user_data*/))) {
         nsk_jvmti_setFailStatus();
     }
     if (forthRef != 1) {
@@ -142,12 +139,9 @@
     NSK_DISPLAY0("\nCalling IterateOverObjectsReachableFromObject\n");
     forthRef = 0;
     backRef = 0;
-    if (!NSK_JVMTI_VERIFY(
-            NSK_CPP_STUB4(IterateOverObjectsReachableFromObject,
-                jvmti,
-                referrer,
-                objectReferenceCallback,
-                NULL /*user_data*/))) {
+    if (!NSK_JVMTI_VERIFY(jvmti->IterateOverObjectsReachableFromObject(referrer,
+                                                                       objectReferenceCallback,
+                                                                       NULL /*user_data*/))) {
         nsk_jvmti_setFailStatus();
     }
     if (forthRef != 1) {
@@ -175,7 +169,7 @@
         NSK_DISPLAY0("CASE #1\n");
         runCase();
 
-        NSK_TRACE(NSK_CPP_STUB2(DeleteGlobalRef, jni, referrer));
+        NSK_TRACE(jni->DeleteGlobalRef(referrer));
         if (!NSK_VERIFY(nsk_jvmti_resumeSync()))
             return;
         if (!NSK_VERIFY(nsk_jvmti_waitForSync(timeout)))
@@ -184,7 +178,7 @@
         NSK_DISPLAY0("CASE #2\n");
         runCase();
 
-        NSK_TRACE(NSK_CPP_STUB2(DeleteGlobalRef, jni, referrer));
+        NSK_TRACE(jni->DeleteGlobalRef(referrer));
     } while (0);
 
     NSK_DISPLAY0("Let debugee to finish\n");
@@ -216,12 +210,10 @@
     memset(&caps, 0, sizeof(jvmtiCapabilities));
     caps.can_tag_objects = 1;
 
-    if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB2(AddCapabilities,
-            jvmti, &caps)))
+    if (!NSK_JVMTI_VERIFY(jvmti->AddCapabilities(&caps)))
         return JNI_ERR;
 
-    if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB2(GetCapabilities,
-            jvmti, &caps)))
+    if (!NSK_JVMTI_VERIFY(jvmti->GetCapabilities(&caps)))
         return JNI_ERR;
 
     if (!caps.can_tag_objects)
--- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/capability/CM02/cm02t001.java	Fri Oct 05 17:01:07 2018 -0400
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/capability/CM02/cm02t001.java	Tue Oct 09 14:37:59 2018 +0200
@@ -81,8 +81,8 @@
                     return status;
                 thread.letFinish();
 
-                // pause to provoke contention
-                Thread.sleep(100);
+                // pause to provoke contention on thread.endingMonitor
+                Thread.sleep(1000);
             } catch (InterruptedException e) {
                 throw new Failure(e);
             }
--- a/test/jdk/ProblemList.txt	Fri Oct 05 17:01:07 2018 -0400
+++ b/test/jdk/ProblemList.txt	Tue Oct 09 14:37:59 2018 +0200
@@ -565,7 +565,6 @@
 java/nio/channels/DatagramChannel/ChangingAddress.java          7141822 macosx-all
 
 java/nio/channels/Selector/Wakeup.java                          6963118 windows-all
-java/nio/channels/Selector/RacyDeregister.java                  8201765 windows-all
 
 java/nio/file/WatchService/Basic.java                           7158947 solaris-all Solaris 11
 java/nio/file/WatchService/MayFlies.java                        7158947 solaris-all Solaris 11
@@ -867,6 +866,8 @@
 
 javax/rmi/ssl/SSLSocketParametersTest.sh                        8162906 generic-all
 
+javax/naming/module/RunBasic.java                               8211850 generic-all
+
 ############################################################################
 
 ###########################################################################
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/jdk/java/lang/ModuleLayer/automatic/AutomaticModulesTest.java	Tue Oct 09 14:37:59 2018 +0200
@@ -0,0 +1,152 @@
+/*
+ * Copyright (c) 2018, 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.
+ */
+
+/**
+ * @test
+ * @bug 8211825
+ * @modules jdk.compiler
+ * @library /test/lib
+ * @build jdk.test.lib.compiler.CompilerUtils jdk.test.lib.util.JarUtils
+ * @run testng/othervm AutomaticModulesTest
+ * @summary Tests automatic modules in module layers
+ */
+
+import java.nio.file.Files;
+import java.nio.file.Path;
+import java.lang.ModuleLayer.Controller;
+import java.lang.module.*;
+import java.lang.reflect.Method;
+import java.util.List;
+import java.util.Set;
+
+import jdk.test.lib.compiler.CompilerUtils;
+import jdk.test.lib.util.JarUtils;
+
+import org.testng.annotations.BeforeTest;
+import org.testng.annotations.Test;
+import static org.testng.Assert.*;
+
+/**
+ * This test uses two modules:
+ *     m requires alib and has an entry point p.Main
+ *     alib is an automatic module
+ */
+
+@Test
+public class AutomaticModulesTest {
+
+    private static final String TEST_SRC = System.getProperty("test.src");
+
+    private static final Path CLASSES = Path.of("classes");
+    private static final Path LIB = Path.of("lib");
+    private static final Path MODS = Path.of("mods");
+
+    @BeforeTest
+    public void setup() throws Exception {
+        // javac -d classes src/alib/**
+        // jar cf lib/alib.jar -C classes .
+        Files.createDirectory(CLASSES);
+        assertTrue(CompilerUtils.compile(Path.of(TEST_SRC, "src", "alib"), CLASSES));
+        JarUtils.createJarFile(LIB.resolve("alib.jar"), CLASSES);
+
+        // javac -p lib -d mods/m - src/m/**
+        Path src = Path.of(TEST_SRC, "src", "m");
+        Path output = Files.createDirectories(MODS.resolve("m"));
+        assertTrue(CompilerUtils.compile(src, output, "-p", LIB.toString()));
+    }
+
+    /**
+     * Create a module layer with modules m and alib mapped to the same class
+     * loader.
+     */
+    public void testOneLoader() throws Exception {
+        Configuration cf = ModuleLayer.boot()
+                .configuration()
+                .resolve(ModuleFinder.of(), ModuleFinder.of(MODS, LIB), Set.of("m"));
+        ResolvedModule m = cf.findModule("m").orElseThrow();
+        ResolvedModule alib = cf.findModule("alib").orElseThrow();
+        assertTrue(m.reads().contains(alib));
+        assertTrue(alib.reference().descriptor().isAutomatic());
+        ModuleLayer bootLayer = ModuleLayer.boot();
+        ClassLoader scl = ClassLoader.getSystemClassLoader();
+        Controller controller = ModuleLayer.defineModulesWithOneLoader(cf, List.of(bootLayer), scl);
+        invokeMain(controller, "m/p.Main");
+    }
+
+    /**
+     * Create a module layer with modules m and alib mapped to different class
+     * loaders. This will test that L(m) delegates to L(alib) in the same layer.
+     */
+    public void testManyLoaders() throws Exception {
+        Configuration cf = ModuleLayer.boot()
+                .configuration()
+                .resolve(ModuleFinder.of(), ModuleFinder.of(MODS, LIB), Set.of("m"));
+        ResolvedModule m = cf.findModule("m").orElseThrow();
+        ResolvedModule alib = cf.findModule("alib").orElseThrow();
+        assertTrue(m.reads().contains(alib));
+        assertTrue(alib.reference().descriptor().isAutomatic());
+        ModuleLayer bootLayer = ModuleLayer.boot();
+        ClassLoader scl = ClassLoader.getSystemClassLoader();
+        Controller controller = ModuleLayer.defineModulesWithManyLoaders(cf, List.of(bootLayer), scl);
+        invokeMain(controller, "m/p.Main");
+    }
+
+    /**
+     * Create a module layer with alib and another module layer with m.
+     * This will test that L(m) delegates to L(alib) in a parent layer.
+     */
+    public void testAutomaticModuleInParent() throws Exception {
+        ModuleLayer bootLayer = ModuleLayer.boot();
+        ClassLoader scl = ClassLoader.getSystemClassLoader();
+
+        // configuration/layer containing alib
+        Configuration cf1 = bootLayer
+                .configuration()
+                .resolve(ModuleFinder.of(), ModuleFinder.of(LIB), Set.of("alib"));
+        ModuleLayer layer1 = bootLayer.defineModulesWithOneLoader(cf1, scl);
+
+        // configuration/layer containing m
+        Configuration cf2 = cf1.resolve(ModuleFinder.of(), ModuleFinder.of(MODS), Set.of("m"));
+        Controller controller = ModuleLayer.defineModulesWithOneLoader(cf2, List.of(layer1), scl);
+
+        invokeMain(controller, "m/p.Main");
+    }
+
+    /**
+     * Invokes the main method of the given entry point (module-name/class-name)
+     */
+    private void invokeMain(Controller controller, String entry) throws Exception {
+        String[] s = entry.split("/");
+        String moduleName = s[0];
+        String className = s[1];
+        int pos = className.lastIndexOf('.');
+        String packageName = className.substring(0, pos);
+        ModuleLayer layer = controller.layer();
+        Module module = layer.findModule(moduleName).orElseThrow();
+        controller.addExports(module, packageName, this.getClass().getModule());
+        ClassLoader loader = layer.findLoader(moduleName);
+        Class<?> c = loader.loadClass(className);
+        Method m = c.getMethod("main", String[].class);
+        m.invoke(null, (Object)new String[0]);
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/jdk/java/lang/ModuleLayer/automatic/src/alib/q/Lib.java	Tue Oct 09 14:37:59 2018 +0200
@@ -0,0 +1,31 @@
+/*
+ * Copyright (c) 2018, 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 q;
+
+public class Lib {
+    private Lib() { }
+
+    public static String generate() {
+        return "something useful";
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/jdk/java/lang/ModuleLayer/automatic/src/m/module-info.java	Tue Oct 09 14:37:59 2018 +0200
@@ -0,0 +1,25 @@
+/*
+ * Copyright (c) 2018, 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.
+ */
+module m {
+    requires alib;
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/jdk/java/lang/ModuleLayer/automatic/src/m/p/Main.java	Tue Oct 09 14:37:59 2018 +0200
@@ -0,0 +1,32 @@
+/*
+ * Copyright (c) 2018, 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 p;
+
+import q.Lib;
+
+public class Main {
+    public static void main(String[] args) {
+        String s = Lib.generate();
+        System.out.println(s);
+    }
+}
--- a/test/jdk/java/util/jar/JarFile/Constructor.java	Fri Oct 05 17:01:07 2018 -0400
+++ b/test/jdk/java/util/jar/JarFile/Constructor.java	Tue Oct 09 14:37:59 2018 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2003, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 2018 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
@@ -23,7 +23,7 @@
 
 /**
  * @test
- * @bug 4842702
+ * @bug 4842702 8211765
  * @summary Check that constructors throw specified exceptions
  * @author Martin Buchholz
  */
@@ -63,5 +63,13 @@
 
         try { Unreached (new JarFile (new File ("NoSuchJar.jar"))); }
         catch (IOException e) {}
+
+        // Test that an IOExcception is thrown when an invalid charater
+        // is part of the path on Windows and Unix
+        final String invalidOSPath = System.getProperty("os.name")
+                .startsWith("Windows") ? "C:\\*" : "foo\u0000bar";
+
+        try { Unreached (new JarFile (invalidOSPath)); }
+        catch (IOException e) {}
     }
 }
--- a/test/jdk/java/util/jar/JarFile/mrjar/TestVersionedStream.java	Fri Oct 05 17:01:07 2018 -0400
+++ b/test/jdk/java/util/jar/JarFile/mrjar/TestVersionedStream.java	Tue Oct 09 14:37:59 2018 +0200
@@ -23,7 +23,7 @@
 
 /*
  * @test
- * @bug 8163798 8189611
+ * @bug 8163798 8189611 8211728
  * @summary basic tests for multi-release jar versioned streams
  * @library /test/lib
  * @modules jdk.jartool/sun.tools.jar java.base/jdk.internal.util.jar
@@ -82,7 +82,8 @@
                 "v10/p/Foo.class",
                 "v10/q/Bar.class",
                 "v" + LATEST_VERSION + "/p/Bar.class",
-                "v" + LATEST_VERSION + "/p/Foo.class"
+                "v" + LATEST_VERSION + "/p/Foo.class",
+                "v" + LATEST_VERSION + "/META-INF/Foo.class"
         );
 
         jar("cf mmr.jar -C base . " +
@@ -224,6 +225,11 @@
                     throw new UncheckedIOException(x);
                 }
             });
+
+            if (!unversionedEntryNames.contains("META-INF/Foo.class") ||
+                versionedNames.indexOf("META-INF/Foo.class") != -1) {
+                Assert.fail("versioned META-INF/Foo.class test failed");
+            }
         }
     }
 
--- a/test/jdk/javax/imageio/plugins/png/ItxtUtf8Test.java	Fri Oct 05 17:01:07 2018 -0400
+++ b/test/jdk/javax/imageio/plugins/png/ItxtUtf8Test.java	Tue Oct 09 14:37:59 2018 +0200
@@ -30,7 +30,7 @@
  *
  * @run main ItxtUtf8Test
  *
- * @run main/othervm/timeout=10 -Xmx4m ItxtUtf8Test truncate
+ * @run main/othervm/timeout=10 -Xmx6m ItxtUtf8Test truncate
  */
 
 import java.awt.image.BufferedImage;
--- a/test/jdk/javax/naming/module/RunBasic.java	Fri Oct 05 17:01:07 2018 -0400
+++ b/test/jdk/javax/naming/module/RunBasic.java	Tue Oct 09 14:37:59 2018 +0200
@@ -27,8 +27,10 @@
 import jdk.test.lib.process.ProcessTools;
 
 import java.io.IOException;
+import java.net.InetAddress;
 import java.nio.file.Files;
 import java.nio.file.Path;
+import java.time.Duration;
 import java.util.Collection;
 import java.util.Collections;
 import java.util.List;
@@ -65,6 +67,8 @@
 
     private static final List<String> JAVA_CMDS;
 
+    static final String HOST_NAME = InetAddress.getLoopbackAddress().getHostName();
+
     static {
         String javaPath = JDKToolFinder.getJDKTool("java");
 
@@ -85,6 +89,8 @@
         prepareModule("test", "--module-source-path",
                 Path.of(TEST_SRC, "src").toString());
 
+        System.out.println("Hostname: [" + HOST_NAME + "]");
+
         // run tests
         runTest("java.desktop", "test.StoreObject");
         runTest("person", "test.StorePerson");
@@ -98,9 +104,12 @@
     private static void prepareModule(String mod, String... opts)
             throws IOException {
         System.out.println("Preparing the '" + mod + "' module...");
+        long start = System.nanoTime();
         makeDir("mods", mod);
         CompilerUtils.compile(Path.of(TEST_SRC, "src", mod),
                 Path.of("mods", (mod.equals("test") ? "" : mod)), opts);
+        Duration duration = Duration.ofNanos(System.nanoTime() - start);
+        System.out.println("completed: duration - " + duration );
     }
 
     private static void makeDir(String first, String... more)
@@ -111,7 +120,7 @@
     private static void runTest(String desc, String clsName) throws Throwable {
         System.out.println("Running with the '" + desc + "' module...");
         runJava("-Dtest.src=" + TEST_SRC, "-p", "mods", "-m", "test/" + clsName,
-                "ldap://localhost/dc=ie,dc=oracle,dc=com");
+                "ldap://" + HOST_NAME + "/dc=ie,dc=oracle,dc=com");
     }
 
     private static void runJava(String... opts) throws Throwable {
--- a/test/jdk/javax/naming/module/src/test/test/ConnectWithAuthzId.java	Fri Oct 05 17:01:07 2018 -0400
+++ b/test/jdk/javax/naming/module/src/test/test/ConnectWithAuthzId.java	Tue Oct 09 14:37:59 2018 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2015, 2018, 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
@@ -29,6 +29,7 @@
 
 package test;
 
+import java.io.PrintStream;
 import java.net.*;
 import java.util.*;
 import javax.naming.*;
@@ -40,12 +41,18 @@
 
 public class ConnectWithAuthzId {
 
+    static {
+        final PrintStream out = new PrintStream(System.out, true);
+        final PrintStream err = new PrintStream(System.err, true);
+
+        System.setOut(out);
+        System.setErr(err);
+    }
+
     // LDAP capture file
     private static final String LDAP_CAPTURE_FILE =
         System.getProperty("test.src") +
         "/src/test/test/ConnectWithAuthzId.ldap";
-    // LDAPServer socket
-    private static ServerSocket serverSocket;
 
     public static void main(String[] args) throws Exception {
 
@@ -68,67 +75,69 @@
          * Launch the LDAP server with the ConnectWithAuthzId.ldap capture file
          */
 
-        serverSocket = new ServerSocket(0);
-        new Thread(new Runnable() {
-            @Override
-            public void run() {
-                try {
-                    new LDAPServer(serverSocket, LDAP_CAPTURE_FILE);
-               } catch (Exception e) {
-                   System.out.println("ERROR: unable to launch LDAP server");
-                   e.printStackTrace();
-               }
-            }
-        }).start();
-
-        /*
-         * Connect to the LDAP directory
-         */
-
-        Hashtable<String,Object> env = new Hashtable<>();
-        env.put(Context.INITIAL_CONTEXT_FACTORY,
-            "com.sun.jndi.ldap.LdapCtxFactory");
-        URI ldapUri = new URI(args[0]);
-        if (ldapUri.getPort() == -1) {
-            ldapUri = new URI(ldapUri.getScheme(), null, ldapUri.getHost(),
-                serverSocket.getLocalPort(), ldapUri.getPath(), null, null);
-        }
-        env.put(Context.PROVIDER_URL, ldapUri.toString());
-        env.put(Context.SECURITY_AUTHENTICATION, "simple");
-        env.put(Context.SECURITY_PRINCIPAL, "cn=admin,dc=ie,dc=oracle,dc=com");
-        env.put(Context.SECURITY_CREDENTIALS, "changeit");
-        env.put(LdapContext.CONTROL_FACTORIES,
-            "org.example.authz.AuthzIdResponseControlFactory");
-        if (args[args.length - 1].equalsIgnoreCase("-trace")) {
-            env.put("com.sun.jndi.ldap.trace.ber", System.out);
-        }
-
-        System.out.println("ConnectWithAuthzId: connecting to " + ldapUri);
-        LdapContext ctx = null;
-        Control[] connectionControls = { new AuthzIdRequestControl(false) };
-
-        try {
-            ctx = new InitialLdapContext(env, connectionControls);
-            System.out.println("ConnectWithAuthzId: connected");
-            // Retrieve the response controls
-            Control[] responseControls = ctx.getResponseControls();
-            if (responseControls != null) {
-                for (Control responseControl : responseControls) {
-                    System.out.println("ConnectWithAuthzId: received response" +
-                        " control: " + responseControl.getID());
-                    if (responseControl instanceof AuthzIdResponseControl) {
-                        AuthzIdResponseControl authzId =
-                            (AuthzIdResponseControl)responseControl;
-                        System.out.println("ConnectWithAuthzId: identity is  " +
-                            authzId.getIdentity());
+        try (ServerSocket serverSocket = new ServerSocket()) {
+            serverSocket.bind(new InetSocketAddress(InetAddress.getLoopbackAddress(), 0));
+            new Thread(new Runnable() {
+                @Override
+                public void run() {
+                    try {
+                        new LDAPServer(serverSocket, LDAP_CAPTURE_FILE);
+                    } catch (Exception e) {
+                        System.out.println("ERROR: unable to launch LDAP server");
+                        e.printStackTrace();
                     }
                 }
+            }).start();
+
+            /*
+             * Connect to the LDAP directory
+             */
+
+            Hashtable<String,Object> env = new Hashtable<>();
+            env.put(Context.INITIAL_CONTEXT_FACTORY,
+                    "com.sun.jndi.ldap.LdapCtxFactory");
+            URI ldapUri = new URI(args[0]);
+            if (ldapUri.getPort() == -1) {
+                ldapUri = new URI(ldapUri.getScheme(), null, ldapUri.getHost(),
+                        serverSocket.getLocalPort(), ldapUri.getPath(), null, null);
             }
-        } catch (NamingException e) {
-            System.err.println("ConnectWithAuthzId: error connecting " + e);
-        } finally {
-            if (ctx != null) {
-                ctx.close();
+            env.put(Context.PROVIDER_URL, ldapUri.toString());
+            env.put(Context.SECURITY_AUTHENTICATION, "simple");
+            env.put(Context.SECURITY_PRINCIPAL, "cn=admin,dc=ie,dc=oracle,dc=com");
+            env.put(Context.SECURITY_CREDENTIALS, "changeit");
+            env.put(LdapContext.CONTROL_FACTORIES,
+                    "org.example.authz.AuthzIdResponseControlFactory");
+            if (args[args.length - 1].equalsIgnoreCase("-trace")) {
+                env.put("com.sun.jndi.ldap.trace.ber", System.out);
+            }
+
+            System.out.println("ConnectWithAuthzId: connecting to " + ldapUri);
+            LdapContext ctx = null;
+            Control[] connectionControls = { new AuthzIdRequestControl(false) };
+
+            try {
+                ctx = new InitialLdapContext(env, connectionControls);
+                System.out.println("ConnectWithAuthzId: connected");
+                // Retrieve the response controls
+                Control[] responseControls = ctx.getResponseControls();
+                if (responseControls != null) {
+                    for (Control responseControl : responseControls) {
+                        System.out.println("ConnectWithAuthzId: received response" +
+                                " control: " + responseControl.getID());
+                        if (responseControl instanceof AuthzIdResponseControl) {
+                            AuthzIdResponseControl authzId =
+                                    (AuthzIdResponseControl)responseControl;
+                            System.out.println("ConnectWithAuthzId: identity is  " +
+                                    authzId.getIdentity());
+                        }
+                    }
+                }
+            } catch (NamingException e) {
+                System.err.println("ConnectWithAuthzId: error connecting " + e);
+            } finally {
+                if (ctx != null) {
+                    ctx.close();
+                }
             }
         }
     }
--- a/test/jdk/javax/naming/module/src/test/test/ConnectWithFoo.java	Fri Oct 05 17:01:07 2018 -0400
+++ b/test/jdk/javax/naming/module/src/test/test/ConnectWithFoo.java	Tue Oct 09 14:37:59 2018 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2015, 2018, 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
@@ -28,6 +28,7 @@
 
 package test;
 
+import java.io.PrintStream;
 import java.net.*;
 import java.util.*;
 import javax.naming.*;
@@ -38,11 +39,17 @@
 
 public class ConnectWithFoo {
 
+    static {
+        final PrintStream out = new PrintStream(System.out, true);
+        final PrintStream err = new PrintStream(System.err, true);
+
+        System.setOut(out);
+        System.setErr(err);
+    }
+
     // LDAP capture file
     private static final String LDAP_CAPTURE_FILE =
         System.getProperty("test.src") + "/src/test/test/ConnectWithFoo.ldap";
-    // LDAPServer socket
-    private static ServerSocket serverSocket;
 
     public static void main(String[] args) throws Exception {
 
@@ -65,48 +72,50 @@
          * Launch the LDAP server with the ConnectWithFoo.ldap capture file
          */
 
-        serverSocket = new ServerSocket(0);
-        new Thread(new Runnable() {
-            @Override
-            public void run() {
-                try {
-                    new LDAPServer(serverSocket, LDAP_CAPTURE_FILE);
-               } catch (Exception e) {
-                   System.out.println("ERROR: unable to launch LDAP server");
-                   e.printStackTrace();
-               }
-            }
-        }).start();
+        try (ServerSocket serverSocket = new ServerSocket()) {
+            serverSocket.bind(new InetSocketAddress(InetAddress.getLoopbackAddress(), 0));
+            new Thread(new Runnable() {
+                @Override
+                public void run() {
+                    try {
+                        new LDAPServer(serverSocket, LDAP_CAPTURE_FILE);
+                    } catch (Exception e) {
+                        System.out.println("ERROR: unable to launch LDAP server");
+                        e.printStackTrace();
+                    }
+                }
+            }).start();
 
-        /*
-         * Connect to the LDAP directory
-         */
+            /*
+             * Connect to the LDAP directory
+             */
 
-        Hashtable<String,Object> env = new Hashtable<>();
-        env.put(Context.INITIAL_CONTEXT_FACTORY,
-            "com.sun.jndi.ldap.LdapCtxFactory");
-        URI ldapUri = new URI(args[0]);
-        if (ldapUri.getPort() == -1) {
-            ldapUri = new URI(ldapUri.getScheme(), null, ldapUri.getHost(),
-                serverSocket.getLocalPort(), ldapUri.getPath(), null, null);
-        }
-        env.put(Context.PROVIDER_URL, ldapUri.toString());
-        if (args[args.length - 1].equalsIgnoreCase("-trace")) {
-            env.put("com.sun.jndi.ldap.trace.ber", System.out);
-        }
+            Hashtable<String,Object> env = new Hashtable<>();
+            env.put(Context.INITIAL_CONTEXT_FACTORY,
+                    "com.sun.jndi.ldap.LdapCtxFactory");
+            URI ldapUri = new URI(args[0]);
+            if (ldapUri.getPort() == -1) {
+                ldapUri = new URI(ldapUri.getScheme(), null, ldapUri.getHost(),
+                        serverSocket.getLocalPort(), ldapUri.getPath(), null, null);
+            }
+            env.put(Context.PROVIDER_URL, ldapUri.toString());
+            if (args[args.length - 1].equalsIgnoreCase("-trace")) {
+                env.put("com.sun.jndi.ldap.trace.ber", System.out);
+            }
 
-        System.out.println("ConnectWithFoo: connecting to " + ldapUri);
-        LdapContext ctx = null;
-        Control[] connectionControls = { new FooControl(false) };
+            System.out.println("ConnectWithFoo: connecting to " + ldapUri);
+            LdapContext ctx = null;
+            Control[] connectionControls = { new FooControl(false) };
 
-        try {
-            ctx = new InitialLdapContext(env, connectionControls);
-            System.out.println("ConnectWithFoo: connected");
-        } catch (NamingException e) {
-            System.err.println("ConnectWithFoo: error connecting " + e);
-        } finally {
-            if (ctx != null) {
-                ctx.close();
+            try {
+                ctx = new InitialLdapContext(env, connectionControls);
+                System.out.println("ConnectWithFoo: connected");
+            } catch (NamingException e) {
+                System.err.println("ConnectWithFoo: error connecting " + e);
+            } finally {
+                if (ctx != null) {
+                    ctx.close();
+                }
             }
         }
     }
--- a/test/jdk/javax/naming/module/src/test/test/ReadByUrl.java	Fri Oct 05 17:01:07 2018 -0400
+++ b/test/jdk/javax/naming/module/src/test/test/ReadByUrl.java	Tue Oct 09 14:37:59 2018 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2015, 2018, 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
@@ -28,6 +28,7 @@
 
 package test;
 
+import java.io.PrintStream;
 import java.net.*;
 import java.util.*;
 import javax.naming.*;
@@ -36,11 +37,17 @@
 
 public class ReadByUrl {
 
+    static {
+        final PrintStream out = new PrintStream(System.out, true);
+        final PrintStream err = new PrintStream(System.err, true);
+
+        System.setOut(out);
+        System.setErr(err);
+    }
+
     // LDAP capture file
     private static final String LDAP_CAPTURE_FILE =
         System.getProperty("test.src") + "/src/test/test/ReadByUrl.ldap";
-    // LDAPServer socket
-    private static ServerSocket serverSocket;
 
     public static void main(String[] args) throws Exception {
 
@@ -63,50 +70,52 @@
          * Launch the LDAP server with the ReadByUrl.ldap capture file
          */
 
-        serverSocket = new ServerSocket(0);
-        new Thread(new Runnable() {
-            @Override
-            public void run() {
-                try {
-                    new LDAPServer(serverSocket, LDAP_CAPTURE_FILE);
-               } catch (Exception e) {
-                   System.out.println("ERROR: unable to launch LDAP server");
-                   e.printStackTrace();
-               }
-            }
-        }).start();
+        try (ServerSocket serverSocket = new ServerSocket()) {
+            serverSocket.bind(new InetSocketAddress(InetAddress.getLoopbackAddress(), 0));
+            new Thread(new Runnable() {
+                @Override
+                public void run() {
+                    try {
+                        new LDAPServer(serverSocket, LDAP_CAPTURE_FILE);
+                    } catch (Exception e) {
+                        System.out.println("ERROR: unable to launch LDAP server");
+                        e.printStackTrace();
+                    }
+                }
+            }).start();
 
-        /*
-         * Connect to the LDAP directory
-         */
+            /*
+             * Connect to the LDAP directory
+             */
 
-        Hashtable<String,Object> env = new Hashtable<>();
-        URI ldapUri = new URI(args[0]);
-        if (ldapUri.getPort() == -1) {
-            ldapUri = new URI("ldapv4", null, ldapUri.getHost(),
-                serverSocket.getLocalPort(), ldapUri.getPath(), null, null);
-        }
-        env.put(Context.PROVIDER_URL, ldapUri.toString());
-        if (args[args.length - 1].equalsIgnoreCase("-trace")) {
-            env.put("com.sun.jndi.ldap.trace.ber", System.out);
-        }
+            Hashtable<String,Object> env = new Hashtable<>();
+            URI ldapUri = new URI(args[0]);
+            if (ldapUri.getPort() == -1) {
+                ldapUri = new URI("ldapv4", null, ldapUri.getHost(),
+                        serverSocket.getLocalPort(), ldapUri.getPath(), null, null);
+            }
+            env.put(Context.PROVIDER_URL, ldapUri.toString());
+            if (args[args.length - 1].equalsIgnoreCase("-trace")) {
+                env.put("com.sun.jndi.ldap.trace.ber", System.out);
+            }
 
-        // URL context factory location for 'ldapv4://'
-        env.put(Context.URL_PKG_PREFIXES, "org.example");
+            // URL context factory location for 'ldapv4://'
+            env.put(Context.URL_PKG_PREFIXES, "org.example");
 
-        System.out.println("ReadByUrl: connecting to " + ldapUri);
-        DirContext ctx = null;
+            System.out.println("ReadByUrl: connecting to " + ldapUri);
+            DirContext ctx = null;
 
-        try {
-            ctx = new InitialDirContext(env);
-            System.out.println("ReadByUrl: connected");
-            DirContext entry = (DirContext) ctx.lookup(ldapUri.toString());
-            entry.close();
-        } catch (NamingException e) {
-            System.err.println("ReadByUrl: error connecting " + e);
-        } finally {
-            if (ctx != null) {
-                ctx.close();
+            try {
+                ctx = new InitialDirContext(env);
+                System.out.println("ReadByUrl: connected");
+                DirContext entry = (DirContext) ctx.lookup(ldapUri.toString());
+                entry.close();
+            } catch (NamingException e) {
+                System.err.println("ReadByUrl: error connecting " + e);
+            } finally {
+                if (ctx != null) {
+                    ctx.close();
+                }
             }
         }
     }
--- a/test/jdk/javax/naming/module/src/test/test/StoreFruit.java	Fri Oct 05 17:01:07 2018 -0400
+++ b/test/jdk/javax/naming/module/src/test/test/StoreFruit.java	Tue Oct 09 14:37:59 2018 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2015, 2018, 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
@@ -29,6 +29,7 @@
 
 package test;
 
+import java.io.PrintStream;
 import java.net.*;
 import java.util.*;
 import javax.naming.*;
@@ -38,18 +39,24 @@
 
 public class StoreFruit {
 
+    static {
+        final PrintStream out = new PrintStream(System.out, true);
+        final PrintStream err = new PrintStream(System.err, true);
+
+        System.setOut(out);
+        System.setErr(err);
+    }
+
+
     // LDAP capture file
     private static final String LDAP_CAPTURE_FILE =
         System.getProperty("test.src") + "/src/test/test/StoreFruit.ldap";
-    // LDAPServer socket
-    private static ServerSocket serverSocket;
 
     public static void main(String[] args) throws Exception {
 
         /*
          * Process arguments
          */
-
         int argc = args.length;
         if ((argc < 1) ||
             ((argc == 1) && (args[0].equalsIgnoreCase("-help")))) {
@@ -58,97 +65,98 @@
             System.err.println("        <ldapurl> is the LDAP URL of the parent entry\n");
             System.err.println("example:");
             System.err.println("        java StoreFruit ldap://oasis/o=airius.com");
-    return;
+            return;
         }
 
         /*
          * Launch the LDAP server with the StoreFruit.ldap capture file
          */
+        try (ServerSocket serverSocket = new ServerSocket()) {
+            serverSocket.bind(new InetSocketAddress(InetAddress.getLoopbackAddress(), 0));
+            new Thread(new Runnable() {
+                @Override
+                public void run() {
+                    try {
+                        new LDAPServer(serverSocket, LDAP_CAPTURE_FILE);
+                    } catch (Exception e) {
+                        System.out.println("ERROR: unable to launch LDAP server");
+                        e.printStackTrace();
+                    }
+                }
+            }).start();
 
-        serverSocket = new ServerSocket(0);
-        new Thread(new Runnable() {
-            @Override
-            public void run() {
-                try {
-                    new LDAPServer(serverSocket, LDAP_CAPTURE_FILE);
-               } catch (Exception e) {
-                   System.out.println("ERROR: unable to launch LDAP server");
-                   e.printStackTrace();
-               }
-            }
-        }).start();
-
-        /*
-         * Store fruit objects in the LDAP directory
-         */
+            /*
+             * Store fruit objects in the LDAP directory
+             */
 
-        Hashtable<String,Object> env = new Hashtable<>();
-        env.put(Context.INITIAL_CONTEXT_FACTORY,
-    "com.sun.jndi.ldap.LdapCtxFactory");
-        URI ldapUri = new URI(args[0]);
-        if (ldapUri.getPort() == -1) {
-            ldapUri = new URI(ldapUri.getScheme(), null, ldapUri.getHost(),
-                serverSocket.getLocalPort(), ldapUri.getPath(), null, null);
-        }
-        env.put(Context.PROVIDER_URL, ldapUri.toString());
-        if (args[args.length - 1].equalsIgnoreCase("-trace")) {
-            env.put("com.sun.jndi.ldap.trace.ber", System.out);
-        }
+            Hashtable<String,Object> env = new Hashtable<>();
+            env.put(Context.INITIAL_CONTEXT_FACTORY,
+                    "com.sun.jndi.ldap.LdapCtxFactory");
+            URI ldapUri = new URI(args[0]);
+            if (ldapUri.getPort() == -1) {
+                ldapUri = new URI(ldapUri.getScheme(), null, ldapUri.getHost(),
+                        serverSocket.getLocalPort(), ldapUri.getPath(), null, null);
+            }
+            env.put(Context.PROVIDER_URL, ldapUri.toString());
+            if (args[args.length - 1].equalsIgnoreCase("-trace")) {
+                env.put("com.sun.jndi.ldap.trace.ber", System.out);
+            }
 
-        System.out.println("StoreFruit: connecting to " + ldapUri);
-        DirContext ctx = new InitialDirContext(env);
-        Fruit fruit = null;
-        String dn = "cn=myfruit";
-        String dn2 = "cn=myapple";
+            System.out.println("StoreFruit: connecting to " + ldapUri);
+            DirContext ctx = new InitialDirContext(env);
+            Fruit fruit = null;
+            String dn = "cn=myfruit";
+            String dn2 = "cn=myapple";
 
-        try {
-            fruit = new Fruit("orange");
-            ctx.bind(dn, fruit);
-            System.out.println("StoreFruit: created entry '" + dn + "'");
-        } catch (NameAlreadyBoundException e) {
-            System.err.println("StoreFruit: entry '" + dn +
-                "' already exists");
-            cleanup(ctx, (String)null);
-            return;
-        }
+            try {
+                fruit = new Fruit("orange");
+                ctx.bind(dn, fruit);
+                System.out.println("StoreFruit: created entry '" + dn + "'");
+            } catch (NameAlreadyBoundException e) {
+                System.err.println("StoreFruit: entry '" + dn +
+                        "' already exists");
+                cleanup(ctx, (String)null);
+                return;
+            }
 
-        try {
-            ctx.bind(dn2, new Fruit("apple"));
-            System.out.println("StoreFruit: created entry '" + dn2 + "'");
-        } catch (NameAlreadyBoundException e) {
-            System.err.println("StoreFruit: entry '" + dn2 +
-                "' already exists");
-            cleanup(ctx, dn);
-            return;
-        }
+            try {
+                ctx.bind(dn2, new Fruit("apple"));
+                System.out.println("StoreFruit: created entry '" + dn2 + "'");
+            } catch (NameAlreadyBoundException e) {
+                System.err.println("StoreFruit: entry '" + dn2 +
+                        "' already exists");
+                cleanup(ctx, dn);
+                return;
+            }
+
+            /*
+             * Retrieve fruit objects from the LDAP directory
+             */
 
-        /*
-         * Retrieve fruit objects from the LDAP directory
-         */
+            try {
+                Fruit fruit2 = (Fruit) ctx.lookup(dn);
+                System.out.println("StoreFruit: retrieved object: " + fruit2);
+            } catch (NamingException e) {
+                System.err.println("StoreFruit: error retrieving entry '" +
+                        dn + "' " + e);
+                e.printStackTrace();
+                cleanup(ctx, dn, dn2);
+                return;
+            }
 
-        try {
-            Fruit fruit2 = (Fruit) ctx.lookup(dn);
-            System.out.println("StoreFruit: retrieved object: " + fruit2);
-        } catch (NamingException e) {
-            System.err.println("StoreFruit: error retrieving entry '" +
-                dn + "' " + e);
-            e.printStackTrace();
+            try {
+                Fruit fruit3 = (Fruit) ctx.lookup(dn2);
+                System.out.println("StoreFruit: retrieved object: " + fruit3);
+            } catch (NamingException e) {
+                System.err.println("StoreFruit: error retrieving entry '" +
+                        dn2 + "' " + e);
+                e.printStackTrace();
+                cleanup(ctx, dn, dn2);
+                return;
+            }
+
             cleanup(ctx, dn, dn2);
-            return;
         }
-
-        try {
-            Fruit fruit3 = (Fruit) ctx.lookup(dn2);
-            System.out.println("StoreFruit: retrieved object: " + fruit3);
-        } catch (NamingException e) {
-            System.err.println("StoreFruit: error retrieving entry '" +
-                dn2 + "' " + e);
-            e.printStackTrace();
-            cleanup(ctx, dn, dn2);
-            return;
-        }
-
-        cleanup(ctx, dn, dn2);
     }
 
     /*
--- a/test/jdk/javax/naming/module/src/test/test/StoreObject.java	Fri Oct 05 17:01:07 2018 -0400
+++ b/test/jdk/javax/naming/module/src/test/test/StoreObject.java	Tue Oct 09 14:37:59 2018 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2015, 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2015, 2018, 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
@@ -30,6 +30,7 @@
 package test;
 
 import java.awt.event.ActionEvent;
+import java.io.PrintStream;
 import java.net.*;
 import java.util.*;
 import javax.naming.*;
@@ -37,11 +38,17 @@
 
 public class StoreObject {
 
+    static {
+        final PrintStream out = new PrintStream(System.out, true);
+        final PrintStream err = new PrintStream(System.err, true);
+
+        System.setOut(out);
+        System.setErr(err);
+    }
+
     // LDAP capture file
     private static final String LDAP_CAPTURE_FILE =
         System.getProperty("test.src") + "/src/test/test/StoreObject.ldap";
-    // LDAPServer socket
-    private static ServerSocket serverSocket;
 
     public static void main(String[] args) throws Exception {
 
@@ -64,89 +71,91 @@
          * Launch the LDAP server with the StoreObject.ldap capture file
          */
 
-        serverSocket = new ServerSocket(0);
-        new Thread(new Runnable() {
-            @Override
-            public void run() {
-                try {
-                    new LDAPServer(serverSocket, LDAP_CAPTURE_FILE);
-               } catch (Exception e) {
-                   System.out.println("ERROR: unable to launch LDAP server");
-                   e.printStackTrace();
-               }
-            }
-        }).start();
+        try (ServerSocket serverSocket = new ServerSocket()) {
+            serverSocket.bind(new InetSocketAddress(InetAddress.getLoopbackAddress(), 0));
+            new Thread(new Runnable() {
+                @Override
+                public void run() {
+                    try {
+                        new LDAPServer(serverSocket, LDAP_CAPTURE_FILE);
+                    } catch (Exception e) {
+                        System.out.println("ERROR: unable to launch LDAP server");
+                        e.printStackTrace();
+                    }
+                }
+            }).start();
 
-        /*
-         * Store objects in the LDAP directory
-         */
+            /*
+             * Store objects in the LDAP directory
+             */
 
-        Hashtable<String,Object> env = new Hashtable<>();
-        env.put(Context.INITIAL_CONTEXT_FACTORY,
-            "com.sun.jndi.ldap.LdapCtxFactory");
-        URI ldapUri = new URI(args[0]);
-        if (ldapUri.getPort() == -1) {
-            ldapUri = new URI(ldapUri.getScheme(), null, ldapUri.getHost(),
-                serverSocket.getLocalPort(), ldapUri.getPath(), null, null);
-        }
-        env.put(Context.PROVIDER_URL, ldapUri.toString());
-        if (args[args.length - 1].equalsIgnoreCase("-trace")) {
-            env.put("com.sun.jndi.ldap.trace.ber", System.out);
-        }
+            Hashtable<String,Object> env = new Hashtable<>();
+            env.put(Context.INITIAL_CONTEXT_FACTORY,
+                    "com.sun.jndi.ldap.LdapCtxFactory");
+            URI ldapUri = new URI(args[0]);
+            if (ldapUri.getPort() == -1) {
+                ldapUri = new URI(ldapUri.getScheme(), null, ldapUri.getHost(),
+                        serverSocket.getLocalPort(), ldapUri.getPath(), null, null);
+            }
+            env.put(Context.PROVIDER_URL, ldapUri.toString());
+            if (args[args.length - 1].equalsIgnoreCase("-trace")) {
+                env.put("com.sun.jndi.ldap.trace.ber", System.out);
+            }
 
-        System.out.println("StoreObject: connecting to " + ldapUri);
-        DirContext ctx = new InitialDirContext(env);
-        String dn = "cn=myevent";
-        String dn2 = "cn=myevent2";
+            System.out.println("StoreObject: connecting to " + ldapUri);
+            DirContext ctx = new InitialDirContext(env);
+            String dn = "cn=myevent";
+            String dn2 = "cn=myevent2";
 
-        try {
-            ctx.bind(dn, new ActionEvent("", 1, "Hello1"));
-            System.out.println("StoreObject: created entry '" + dn + "'");
-        } catch (NameAlreadyBoundException e) {
-            System.err.println("StoreObject: entry '" + dn +
-                "' already exists");
-            cleanup(ctx, (String)null);
-            return;
-        }
+            try {
+                ctx.bind(dn, new ActionEvent("", 1, "Hello1"));
+                System.out.println("StoreObject: created entry '" + dn + "'");
+            } catch (NameAlreadyBoundException e) {
+                System.err.println("StoreObject: entry '" + dn +
+                        "' already exists");
+                cleanup(ctx, (String)null);
+                return;
+            }
 
-        try {
-            ctx.bind(dn2, new ActionEvent("", 2, "Hello2"));
-            System.out.println("StoreObject: created entry '" + dn2 + "'");
-        } catch (NameAlreadyBoundException e) {
-            System.err.println("StoreObject: entry '" + dn2 +
-                "' already exists");
-            cleanup(ctx, dn);
-            return;
-        }
+            try {
+                ctx.bind(dn2, new ActionEvent("", 2, "Hello2"));
+                System.out.println("StoreObject: created entry '" + dn2 + "'");
+            } catch (NameAlreadyBoundException e) {
+                System.err.println("StoreObject: entry '" + dn2 +
+                        "' already exists");
+                cleanup(ctx, dn);
+                return;
+            }
 
-        /*
-         * Retrieve objects from the LDAP directory
-         */
+            /*
+             * Retrieve objects from the LDAP directory
+             */
 
-        try {
-            ActionEvent b = (ActionEvent) ctx.lookup(dn);
-            System.out.println("StoreObject: retrieved object: " + b);
-        } catch (NamingException e) {
-            System.err.println("StoreObject: error retrieving entry '" +
-                dn + "' " + e);
-            e.printStackTrace();
-            cleanup(ctx, dn, dn2);
-            return;
-        }
+            try {
+                ActionEvent b = (ActionEvent) ctx.lookup(dn);
+                System.out.println("StoreObject: retrieved object: " + b);
+            } catch (NamingException e) {
+                System.err.println("StoreObject: error retrieving entry '" +
+                        dn + "' " + e);
+                e.printStackTrace();
+                cleanup(ctx, dn, dn2);
+                return;
+            }
 
-        try {
-            ActionEvent t = (ActionEvent) ctx.lookup(dn2);
-            System.out.println("StoreObject: retrieved object: " + t);
-        } catch (NamingException e) {
-            System.err.println("StoreObject: error retrieving entry '" +
-                dn2 + "' " + e);
-            e.printStackTrace();
+            try {
+                ActionEvent t = (ActionEvent) ctx.lookup(dn2);
+                System.out.println("StoreObject: retrieved object: " + t);
+            } catch (NamingException e) {
+                System.err.println("StoreObject: error retrieving entry '" +
+                        dn2 + "' " + e);
+                e.printStackTrace();
+                cleanup(ctx, dn, dn2);
+                return;
+            }
+
             cleanup(ctx, dn, dn2);
-            return;
+            ctx.close();
         }
-
-        cleanup(ctx, dn, dn2);
-        ctx.close();
     }
 
     /*
--- a/test/jdk/javax/naming/module/src/test/test/StorePerson.java	Fri Oct 05 17:01:07 2018 -0400
+++ b/test/jdk/javax/naming/module/src/test/test/StorePerson.java	Tue Oct 09 14:37:59 2018 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2015, 2018, 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
@@ -31,6 +31,7 @@
 
 package test;
 
+import java.io.PrintStream;
 import java.net.*;
 import java.util.*;
 import javax.naming.*;
@@ -40,11 +41,17 @@
 
 public class StorePerson {
 
+    static {
+        final PrintStream out = new PrintStream(System.out, true);
+        final PrintStream err = new PrintStream(System.err, true);
+
+        System.setOut(out);
+        System.setErr(err);
+    }
+
     // LDAP capture file
     private static final String LDAP_CAPTURE_FILE =
         System.getProperty("test.src") + "/src/test/test/StorePerson.ldap";
-    // LDAPServer socket
-    private static ServerSocket serverSocket;
 
     public static void main(String[] args) throws Exception {
 
@@ -67,115 +74,116 @@
          * Launch the LDAP server with the StorePerson.ldap capture file
          */
 
-        serverSocket = new ServerSocket(0);
-        new Thread(new Runnable() {
-            @Override
-            public void run() {
-                try {
-                    new LDAPServer(serverSocket, LDAP_CAPTURE_FILE);
-               } catch (Exception e) {
-                   System.out.println("ERROR: unable to launch LDAP server");
-                   e.printStackTrace();
-               }
-            }
-        }).start();
+        try (ServerSocket serverSocket = new ServerSocket()) {
+            serverSocket.bind(new InetSocketAddress(InetAddress.getLoopbackAddress(), 0));
+            new Thread(new Runnable() {
+                @Override
+                public void run() {
+                    try {
+                        new LDAPServer(serverSocket, LDAP_CAPTURE_FILE);
+                    } catch (Exception e) {
+                        System.out.println("ERROR: unable to launch LDAP server");
+                        e.printStackTrace();
+                    }
+                }
+            }).start();
 
-        /*
-         * Store Person objects in the LDAP directory
-         */
+            /*
+             * Store Person objects in the LDAP directory
+             */
 
-        Hashtable<String,Object> env = new Hashtable<>();
-        env.put(Context.INITIAL_CONTEXT_FACTORY,
-    "com.sun.jndi.ldap.LdapCtxFactory");
-        URI ldapUri = new URI(args[0]);
-        if (ldapUri.getPort() == -1) {
-            ldapUri = new URI(ldapUri.getScheme(), null, ldapUri.getHost(),
-                serverSocket.getLocalPort(), ldapUri.getPath(), null, null);
-        }
-        env.put(Context.PROVIDER_URL, ldapUri.toString());
-        if (args[args.length - 1].equalsIgnoreCase("-trace")) {
-            env.put("com.sun.jndi.ldap.trace.ber", System.out);
-        }
+            Hashtable<String,Object> env = new Hashtable<>();
+            env.put(Context.INITIAL_CONTEXT_FACTORY,
+                    "com.sun.jndi.ldap.LdapCtxFactory");
+            URI ldapUri = new URI(args[0]);
+            if (ldapUri.getPort() == -1) {
+                ldapUri = new URI(ldapUri.getScheme(), null, ldapUri.getHost(),
+                        serverSocket.getLocalPort(), ldapUri.getPath(), null, null);
+            }
+            env.put(Context.PROVIDER_URL, ldapUri.toString());
+            if (args[args.length - 1].equalsIgnoreCase("-trace")) {
+                env.put("com.sun.jndi.ldap.trace.ber", System.out);
+            }
 
-        // Specify the factory classname explicitly
-        env.put(Context.STATE_FACTORIES, "org.example.person.PersonFactory");
-        env.put(Context.OBJECT_FACTORIES, "org.example.person.PersonFactory");
+            // Specify the factory classname explicitly
+            env.put(Context.STATE_FACTORIES, "org.example.person.PersonFactory");
+            env.put(Context.OBJECT_FACTORIES, "org.example.person.PersonFactory");
 
-        System.out.println("StorePerson: connecting to " + ldapUri);
-        DirContext ctx = new InitialDirContext(env);
-        Person person = null;
-        String name = "John Smith";
-        String dn = "cn=" + name;
+            System.out.println("StorePerson: connecting to " + ldapUri);
+            DirContext ctx = new InitialDirContext(env);
+            Person person = null;
+            String name = "John Smith";
+            String dn = "cn=" + name;
 
-        try {
-            person = new Person(name, "Smith");
-            person.setMailAddress("jsmith@smith.com");
-            ctx.bind(dn, person);
-            System.out.println("StorePerson: created entry '" + dn + "'");
-        } catch (NameAlreadyBoundException e) {
-            System.err.println("StorePerson: entry '" + dn +
-                "' already exists");
-            cleanup(ctx, (String)null);
-            return;
-        }
+            try {
+                person = new Person(name, "Smith");
+                person.setMailAddress("jsmith@smith.com");
+                ctx.bind(dn, person);
+                System.out.println("StorePerson: created entry '" + dn + "'");
+            } catch (NameAlreadyBoundException e) {
+                System.err.println("StorePerson: entry '" + dn +
+                        "' already exists");
+                cleanup(ctx, (String)null);
+                return;
+            }
 
-        name = "Jill Smyth";
-        String dn2 = "cn=" + name;
-        Person person2 = new Person(name, "Smyth");
-        person2.setMailAddress("jsmyth@smith.com");
+            name = "Jill Smyth";
+            String dn2 = "cn=" + name;
+            Person person2 = new Person(name, "Smyth");
+            person2.setMailAddress("jsmyth@smith.com");
 
-        try {
-            ctx.bind(dn2, person2);
-            System.out.println("StorePerson: created entry '" + dn2 + "'");
-        } catch (NameAlreadyBoundException e) {
-            System.err.println("StorePerson: entry '" + dn2 +
-                "' already exists");
-            cleanup(ctx, dn);
-            return;
-        }
-
-        /*
-         * Retrieve Person objects from the LDAP directory
-         */
-
-        try {
-            Person person3 = (Person) ctx.lookup(dn);
-            System.out.println("StorePerson: retrieved object: " + person3);
-            if (person.getAttributes().equals(person3.getAttributes())) {
-                System.out.println(
-                    "StorePerson: retrieved person matches original");
-            } else {
-                System.out.println(
-                    "StorePerson: retrieved person does NOT match original");
+            try {
+                ctx.bind(dn2, person2);
+                System.out.println("StorePerson: created entry '" + dn2 + "'");
+            } catch (NameAlreadyBoundException e) {
+                System.err.println("StorePerson: entry '" + dn2 +
+                        "' already exists");
+                cleanup(ctx, dn);
+                return;
             }
-        } catch (NamingException e) {
-            System.err.println("StorePerson: error retrieving entry '" +
-                dn + "' " + e);
-            e.printStackTrace();
-            cleanup(ctx, dn, dn2);
-            return;
-        }
+
+            /*
+             * Retrieve Person objects from the LDAP directory
+             */
 
-        try {
-            Person person4 = (Person) ctx.lookup(dn2);
-            System.out.println("StorePerson: retrieved object: " + person4);
-            if (person2.getAttributes().equals(person4.getAttributes())) {
-                System.out.println(
-                    "StorePerson: retrieved person matches original");
-            } else {
-                System.out.println(
-                    "StorePerson: retrieved person does NOT match original");
+            try {
+                Person person3 = (Person) ctx.lookup(dn);
+                System.out.println("StorePerson: retrieved object: " + person3);
+                if (person.getAttributes().equals(person3.getAttributes())) {
+                    System.out.println(
+                            "StorePerson: retrieved person matches original");
+                } else {
+                    System.out.println(
+                            "StorePerson: retrieved person does NOT match original");
+                }
+            } catch (NamingException e) {
+                System.err.println("StorePerson: error retrieving entry '" +
+                        dn + "' " + e);
+                e.printStackTrace();
+                cleanup(ctx, dn, dn2);
+                return;
             }
-        } catch (NamingException e) {
-            System.err.println("StorePerson: error retrieving entry '" +
-                dn2 + "' " + e);
-            e.printStackTrace();
+
+            try {
+                Person person4 = (Person) ctx.lookup(dn2);
+                System.out.println("StorePerson: retrieved object: " + person4);
+                if (person2.getAttributes().equals(person4.getAttributes())) {
+                    System.out.println(
+                            "StorePerson: retrieved person matches original");
+                } else {
+                    System.out.println(
+                            "StorePerson: retrieved person does NOT match original");
+                }
+            } catch (NamingException e) {
+                System.err.println("StorePerson: error retrieving entry '" +
+                        dn2 + "' " + e);
+                e.printStackTrace();
+                cleanup(ctx, dn, dn2);
+                return;
+            }
+
             cleanup(ctx, dn, dn2);
-            return;
         }
-
-        cleanup(ctx, dn, dn2);
-        return;
     }
 
     /*
--- a/test/jdk/javax/naming/module/src/test/test/StoreRemote.java	Fri Oct 05 17:01:07 2018 -0400
+++ b/test/jdk/javax/naming/module/src/test/test/StoreRemote.java	Tue Oct 09 14:37:59 2018 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2015, 2018, 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
@@ -40,11 +40,17 @@
 
 public class StoreRemote {
 
+    static {
+        final PrintStream out = new PrintStream(System.out, true);
+        final PrintStream err = new PrintStream(System.err, true);
+
+        System.setOut(out);
+        System.setErr(err);
+    }
+
     // LDAP capture file
     private static final String LDAP_CAPTURE_FILE =
         System.getProperty("test.src") + "/src/test/test/StoreRemote.ldap";
-    // LDAPServer socket
-    private static ServerSocket serverSocket;
 
     public static void main(String[] args) throws Exception {
 
@@ -67,77 +73,79 @@
          * Launch the LDAP server with the StoreRemote.ldap capture file
          */
 
-        serverSocket = new ServerSocket(0);
-        new Thread(new Runnable() {
-            @Override
-            public void run() {
-                try {
-                    new LDAPServer(serverSocket, LDAP_CAPTURE_FILE);
-               } catch (Exception e) {
-                   System.out.println("ERROR: unable to launch LDAP server");
-                   e.printStackTrace();
-               }
-            }
-        }).start();
-
-        /*
-         * Store a Remote object in the LDAP directory
-         */
+        try (ServerSocket serverSocket = new ServerSocket()){
+            serverSocket.bind(new InetSocketAddress(InetAddress.getLoopbackAddress(), 0));
+            new Thread(new Runnable() {
+                @Override
+                public void run() {
+                    try {
+                        new LDAPServer(serverSocket, LDAP_CAPTURE_FILE);
+                    } catch (Exception e) {
+                        System.out.println("ERROR: unable to launch LDAP server");
+                        e.printStackTrace();
+                    }
+                }
+            }).start();
 
-        Hashtable<String,Object> env = new Hashtable<>();
-        env.put(Context.INITIAL_CONTEXT_FACTORY,
-            "com.sun.jndi.ldap.LdapCtxFactory");
-        URI ldapUri = new URI(args[0]);
-        if (ldapUri.getPort() == -1) {
-            ldapUri = new URI(ldapUri.getScheme(), null, ldapUri.getHost(),
-                serverSocket.getLocalPort(), ldapUri.getPath(), null, null);
-        }
-        env.put(Context.PROVIDER_URL, ldapUri.toString());
-        if (args[args.length - 1].equalsIgnoreCase("-trace")) {
-            env.put("com.sun.jndi.ldap.trace.ber", System.out);
-        }
+            /*
+             * Store a Remote object in the LDAP directory
+             */
 
-        System.out.println("StoreRemote: connecting to " + ldapUri);
-        DirContext ctx = new InitialDirContext(env);
-        String dn = "cn=myremote";
+            Hashtable<String,Object> env = new Hashtable<>();
+            env.put(Context.INITIAL_CONTEXT_FACTORY,
+                    "com.sun.jndi.ldap.LdapCtxFactory");
+            URI ldapUri = new URI(args[0]);
+            if (ldapUri.getPort() == -1) {
+                ldapUri = new URI(ldapUri.getScheme(), null, ldapUri.getHost(),
+                        serverSocket.getLocalPort(), ldapUri.getPath(), null, null);
+            }
+            env.put(Context.PROVIDER_URL, ldapUri.toString());
+            if (args[args.length - 1].equalsIgnoreCase("-trace")) {
+                env.put("com.sun.jndi.ldap.trace.ber", System.out);
+            }
+
+            System.out.println("StoreRemote: connecting to " + ldapUri);
+            DirContext ctx = new InitialDirContext(env);
+            String dn = "cn=myremote";
 
-        try {
-            Hello hello = new HelloImpl();
-            ctx.bind(dn, hello);
-            System.out.println("StoreRemote: created entry '" + dn + "'");
+            try {
+                Hello hello = new HelloImpl();
+                ctx.bind(dn, hello);
+                System.out.println("StoreRemote: created entry '" + dn + "'");
 
-            // Explicitly release the RMI object
-            UnicastRemoteObject.unexportObject(hello, true);
+                // Explicitly release the RMI object
+                UnicastRemoteObject.unexportObject(hello, true);
 
-        } catch (NameAlreadyBoundException e) {
-            System.err.println("StoreRemote: entry '" + dn +
-                "' already exists");
-            cleanup(ctx, (String)null);
-            return;
-        }
+            } catch (NameAlreadyBoundException e) {
+                System.err.println("StoreRemote: entry '" + dn +
+                        "' already exists");
+                cleanup(ctx, (String)null);
+                return;
+            }
 
-        /*
-         * Retrieve the Remote object from the LDAP directory
-         */
+            /*
+             * Retrieve the Remote object from the LDAP directory
+             */
 
-        try {
-            Hello obj = (Hello) ctx.lookup(dn);
-            System.out.println("StoreRemote: retrieved object: " + obj);
-            System.out.println("StoreRemote: calling Hello.sayHello()...\n" +
-                obj.sayHello());
+            try {
+                Hello obj = (Hello) ctx.lookup(dn);
+                System.out.println("StoreRemote: retrieved object: " + obj);
+                System.out.println("StoreRemote: calling Hello.sayHello()...\n" +
+                        obj.sayHello());
 
-            // Explicitly release the RMI object
-            UnicastRemoteObject.unexportObject(obj, true);
+                // Explicitly release the RMI object
+                UnicastRemoteObject.unexportObject(obj, true);
 
-        } catch (NamingException e) {
-            System.err.println("StoreRemote: error retrieving entry '" +
-                dn + "' " + e);
-            e.printStackTrace();
+            } catch (NamingException e) {
+                System.err.println("StoreRemote: error retrieving entry '" +
+                        dn + "' " + e);
+                e.printStackTrace();
+                cleanup(ctx, dn);
+                return;
+            }
+
             cleanup(ctx, dn);
-            return;
         }
-
-        cleanup(ctx, dn);
     }
 
     /*
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/langtools/jdk/javadoc/doclet/testSerialTag/TestSerialTag.java	Tue Oct 09 14:37:59 2018 +0200
@@ -0,0 +1,145 @@
+/*
+ * Copyright (c) 2018, 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.
+ */
+
+/*
+ * @test
+ * @bug 8207214
+ * @summary Test package-level at-serial tags
+ * @library /tools/lib ../lib
+ * @modules jdk.javadoc/jdk.javadoc.internal.tool
+ * @build JavadocTester toolbox.ToolBox
+ * @run main TestSerialTag
+ */
+
+import java.io.IOException;
+import java.nio.file.Path;
+
+import toolbox.ToolBox;
+
+public class TestSerialTag extends JavadocTester {
+    public static void main(String... args) throws Exception {
+        TestSerialTag tester = new TestSerialTag();
+        tester.runTests(m -> new Object[] { Path.of(m.getName()) });
+    }
+
+    private final ToolBox tb;
+
+    TestSerialTag() {
+        tb = new ToolBox();
+    }
+
+    @Test
+    public void testCombo(Path base) throws IOException {
+        boolean[] moduleValues = { false, true };
+        String[] tagValues = { "", "@serial include", "@serial exclude" };
+        for (boolean module : moduleValues ) {
+            for (String tag : tagValues ) {
+                String name = (module ? "module-" : "")
+                              + (tag.isEmpty() ? "default" : tag.replace("@serial ", ""));
+                Path dir = base.resolve(name);
+                test(dir, module, tag);
+            }
+        }
+
+    }
+
+    void test(Path base, boolean module, String tag) throws IOException {
+        out.println("Test: module:" + module + ", tag:" + tag);
+
+        Path srcDir = generateSource(base, module, tag);
+
+        Path outDir = base.resolve("out");
+        if (module) {
+            javadoc("-d", outDir.toString(),
+                "--module-source-path", srcDir.toString(),
+                "--module", "m");
+        } else {
+            javadoc("-d", outDir.toString(),
+                "-sourcepath", srcDir.toString(),
+                "p", "q");
+        }
+        checkExit(Exit.OK);
+
+        boolean expectLink = !tag.equals("@serial exclude");
+        checkSeeSerializedForm(module, expectLink);
+    }
+
+    /**
+     * Generates source for a test case.
+     * Two classes are generated, in two different packages.
+     * One package has a variable at-serial tag to test;
+     * The other package is a control and always has no special tag.
+     *
+     * @param base the working directory for the test case
+     * @param module whether or not to enclose the packages in a module
+     * @param tag the at-serial tag to be tested
+     * @return the directory in which the source was created
+     */
+    Path generateSource(Path base, boolean module, String tag) throws IOException {
+        Path srcDir = base.resolve("src");
+
+        Path dir;
+        if (module) {
+            dir = srcDir.resolve("m");
+            tb.writeJavaFiles(dir,
+                "module m { exports p; exports q; }");
+        } else {
+            dir = srcDir;
+        }
+
+        tb.writeJavaFiles(dir,
+            "/** This is package p;\n * " + tag + "\n */\n"
+            + "package p;",
+            "/** This is class p.C1;\n */\n"
+            + "package p; public class C1 implements java.io.Serializable { }",
+            "/** This is package q;\n */\n"
+            + "package q;",
+            "/** This is class q.C2;\n */\n"
+            + "package q; public class C2 implements java.io.Serializable { }"
+        );
+
+        return srcDir;
+    }
+
+    /**
+     * Checks the link to the serialized form page,
+     * and whether classes are documented on that page.
+     *
+     * @param module whether or not the output is module-oriented
+     * @param b whether or not class p.C1 should be documented as serializable
+     */
+    void checkSeeSerializedForm(boolean module, boolean b) {
+        String prefix = module ? "m/" : "";
+
+        checkOutput(prefix + "p/C1.html", b,
+            "serialized-form.html");
+        checkOutput("serialized-form.html", b,
+            "C1");
+
+        checkOutput(prefix + "q/C2.html", true,
+            "serialized-form.html");
+        checkOutput("serialized-form.html", true,
+            "C2");
+    }
+}
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/langtools/tools/javac/lambda/T8209407/VerifierErrorInnerPlusLambda.java	Tue Oct 09 14:37:59 2018 +0200
@@ -0,0 +1,42 @@
+/*
+ * Copyright (c) 2018, 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.
+ */
+
+/*
+ * @test
+ * @bug 8209407
+ * @summary VerifyError is thrown for inner class with lambda
+ */
+
+import java.util.function.Supplier;
+
+public class VerifierErrorInnerPlusLambda {
+    public static void main(String[] args) {
+        Object a = new Object();
+        class Local { Object ref = a; }
+        new Object() {
+            void unused() {
+                Supplier<Local> s = () -> new Local();
+            }
+        };
+    }
+}
--- a/test/lib/jdk/test/lib/Platform.java	Fri Oct 05 17:01:07 2018 -0400
+++ b/test/lib/jdk/test/lib/Platform.java	Tue Oct 09 14:37:59 2018 +0200
@@ -325,6 +325,19 @@
         }
     }
 
+    public static boolean isDefaultCDSArchiveSupported() {
+        return (is64bit()  &&
+                isServer() &&
+                (isLinux()   ||
+                 isOSX()     ||
+                 isSolaris() ||
+                 isWindows()) &&
+                !isZero()    &&
+                !isMinimal() &&
+                !isAArch64() &&
+                !isARM());
+    }
+
     /*
      * This should match the #if condition in ClassListParser::load_class_from_source().
      */
--- a/test/lib/jdk/test/lib/SecurityTools.java	Fri Oct 05 17:01:07 2018 -0400
+++ b/test/lib/jdk/test/lib/SecurityTools.java	Tue Oct 09 14:37:59 2018 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2016, 2017, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2016, 2018, 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
@@ -28,7 +28,6 @@
 import java.nio.file.Files;
 import java.nio.file.Path;
 import java.nio.file.Paths;
-import java.util.Arrays;
 import java.util.List;
 import java.util.stream.Collectors;
 import java.util.stream.Stream;
@@ -36,10 +35,23 @@
 import jdk.test.lib.process.OutputAnalyzer;
 import jdk.test.lib.process.ProcessTools;
 
+/**
+ * Run security tools (including jarsigner and keytool) in a new process.
+ * The en_US locale is always used so a test can always match output to
+ * English text. {@code /dev/urandom} is used as entropy source so tool will
+ * not block because of entropy scarcity. {@code -Jvm-options} is supported
+ * as an argument.
+ */
 public class SecurityTools {
 
+    /**
+     * The response file name for keytool. Use {@link #setResponse} to
+     * create one. Do NOT manipulate it directly.
+     */
     public static final String RESPONSE_FILE = "security_tools_response.txt";
 
+    private SecurityTools() {}
+
     private static ProcessBuilder getProcessBuilder(String tool, List<String> args) {
         JDKToolLauncher launcher = JDKToolLauncher.createUsingTestJDK(tool)
                 .addVMArg("-Duser.language=en")
@@ -57,8 +69,13 @@
         return new ProcessBuilder(launcher.getCommand());
     }
 
-    // keytool
-
+    /**
+     * Runs keytool.
+     *
+     * @param args arguments to keytool
+     * @return an {@link OutputAnalyzer} object
+     * @throws Exception if there is an error
+     */
     public static OutputAnalyzer keytool(List<String> args)
             throws Exception {
 
@@ -77,15 +94,46 @@
         }
     }
 
-    // Only call this if there is no white space in every argument
+    /**
+     * Runs keytool.
+     *
+     * @param args arguments to keytool in a single string. Only call this if
+     *             there is no white space inside an argument. This string will
+     *             be split with {@code \s+}.
+     * @return an {@link OutputAnalyzer} object
+     * @throws Exception if there is an error
+     */
     public static OutputAnalyzer keytool(String args) throws Exception {
         return keytool(args.split("\\s+"));
     }
 
+    /**
+     * Runs keytool.
+     *
+     * @param args arguments to keytool
+     * @return an {@link OutputAnalyzer} object
+     * @throws Exception if there is an error
+     */
     public static OutputAnalyzer keytool(String... args) throws Exception {
         return keytool(List.of(args));
     }
 
+
+    /**
+     * Sets the responses (user input) for keytool.
+     * <p>
+     * For example, if keytool requires entering a password twice, call
+     * {@code setResponse("password", "password")}. Do NOT append a newline
+     * character to each response. If there are useless responses at the end,
+     * they will be discarded silently. If there are less responses than
+     * necessary, keytool will read EOF. The responses will be written into
+     * {@linkplain #RESPONSE_FILE a local file} and will only be used by the
+     * next keytool run. After the run, the file is removed. Calling this
+     * method will always overwrite the previous response file (if exists).
+     *
+     * @param responses response to keytool
+     * @throws IOException if there is an error
+     */
     public static void setResponse(String... responses) throws IOException {
         String text;
         if (responses.length > 0) {
@@ -97,8 +145,13 @@
         Files.write(Paths.get(RESPONSE_FILE), text.getBytes());
     }
 
-    // jarsigner
-
+    /**
+     * Runs jarsigner.
+     *
+     * @param args arguments to jarsigner
+     * @return an {@link OutputAnalyzer} object
+     * @throws Exception if there is an error
+     */
     public static OutputAnalyzer jarsigner(List<String> args)
             throws Exception {
         return execute(getProcessBuilder("jarsigner", args));
@@ -118,12 +171,27 @@
         }
     }
 
-    // Only call this if there is no white space in every argument
+    /**
+     * Runs jarsigner.
+     *
+     * @param args arguments to jarsigner in a single string. Only call this if
+     *             there is no white space inside an argument. This string will
+     *             be split with {@code \s+}.
+     * @return an {@link OutputAnalyzer} object
+     * @throws Exception if there is an error
+     */
     public static OutputAnalyzer jarsigner(String args) throws Exception {
 
         return jarsigner(args.split("\\s+"));
     }
 
+    /**
+     * Runs jarsigner.
+     *
+     * @param args arguments to jarsigner
+     * @return an {@link OutputAnalyzer} object
+     * @throws Exception if there is an error
+     */
     public static OutputAnalyzer jarsigner(String... args) throws Exception {
         return jarsigner(List.of(args));
     }
--- a/test/lib/jdk/test/lib/util/JarUtils.java	Fri Oct 05 17:01:07 2018 -0400
+++ b/test/lib/jdk/test/lib/util/JarUtils.java	Tue Oct 09 14:37:59 2018 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2015, 2017, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2015, 2018, 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
@@ -222,6 +222,7 @@
      *              be either updated or added. The files in the 2nd group
      *              will be removed. If no "-" exists, all files belong to
      *              the 1st group.
+     * @throws IOException if there is an error
      */
     @Deprecated
     public static void updateJar(String src, String dest, String... files)
@@ -259,7 +260,7 @@
      *                Value can be Path, byte[] or String. If key exists in
      *                src but value is Boolean FALSE. The entry is removed.
      *                Existing entries in src not a key is unmodified.
-     * @throws IOException
+     * @throws IOException if there is an error
      */
     @Deprecated
     public static void updateJar(String src, String dest,
--- a/test/lib/sun/hotspot/WhiteBox.java	Fri Oct 05 17:01:07 2018 -0400
+++ b/test/lib/sun/hotspot/WhiteBox.java	Tue Oct 09 14:37:59 2018 +0200
@@ -512,6 +512,8 @@
   public native void assertMatchingSafepointCalls(boolean mutexSafepointValue, boolean attemptedNoSafepointValue);
 
   // Sharing & archiving
+  public native String  getDefaultArchivePath();
+  public native boolean isSharingEnabled();
   public native boolean isShared(Object o);
   public native boolean isSharedClass(Class<?> c);
   public native boolean areSharedStringsIgnored();