8289764: gc/lock tests failed with "OutOfMemoryError: Java heap space: failed reallocation of scalar replaced objects"

Reviewed-by: lmesnik
diff --git a/test/hotspot/jtreg/TEST.quick-groups b/test/hotspot/jtreg/TEST.quick-groups
index e509b85..bf16315 100644
--- a/test/hotspot/jtreg/TEST.quick-groups
+++ b/test/hotspot/jtreg/TEST.quick-groups
@@ -1557,9 +1557,9 @@
   vmTestbase/gc/gctests/StringInternGC/StringInternGC.java \
   vmTestbase/gc/gctests/ReferencesGC/ReferencesGC.java \
   vmTestbase/gc/lock/jni/jnilock001/TestDescription.java \
-  vmTestbase/gc/lock/jniref/jnireflock04/TestDescription.java \
-  vmTestbase/gc/lock/jvmti/alloc/jvmtialloclock02/TestDescription.java \
-  vmTestbase/gc/lock/malloc/malloclock03/TestDescription.java
+  vmTestbase/gc/lock/jniref/jnireflock01/TestDescription.java \
+  vmTestbase/gc/lock/jvmti/alloc/jvmtialloclock01/TestDescription.java \
+  vmTestbase/gc/lock/malloc/malloclock01/TestDescription.java
 
 vmTestbase_vm_compiler_quick = \
   vmTestbase/vm/compiler/jbe/constprop/constprop01/constprop01.java \
diff --git a/test/hotspot/jtreg/vmTestbase/gc/lock/LockerTest.java b/test/hotspot/jtreg/vmTestbase/gc/lock/LockerTest.java
index 33bf680..d11aff2 100644
--- a/test/hotspot/jtreg/vmTestbase/gc/lock/LockerTest.java
+++ b/test/hotspot/jtreg/vmTestbase/gc/lock/LockerTest.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2010, 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2010, 2022, 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
@@ -22,9 +22,10 @@
  */
 package gc.lock;
 
+import jdk.test.whitebox.WhiteBox;
 import nsk.share.runner.*;
 import nsk.share.gc.*;
-import nsk.share.gc.gp.*;
+import nsk.share.gc.gp.GarbageUtils;
 import nsk.share.gc.lock.*;
 import nsk.share.test.ExecutionController;
 
@@ -33,26 +34,30 @@
  *
  * A number of threads is started. Each one locks and eats memory.
  */
-public class LockerTest extends ThreadedGCTest implements GarbageProducerAware, GarbageProducer1Aware, LockersAware {
+public class LockerTest extends ThreadedGCTest implements LockersAware {
 
-    private GarbageProducer garbageProducer;
-    private GarbageProducer garbageProducer1;
     private Lockers lockers;
     private long objectSize = 1000;
 
     private class Worker implements Runnable {
 
-        byte[] rezerve = new byte[1024 * 1024];
-        private Locker locker = lockers.createLocker(garbageProducer1.create(objectSize));
+        byte[] rezerve = new byte[1024];
+        private Locker locker = lockers.createLocker(rezerve);
 
         public Worker() {
             locker.enable();
         }
 
         public void run() {
-            locker.lock();
-            GarbageUtils.eatMemory(getExecutionController(), garbageProducer);
-            locker.unlock();
+            ExecutionController stresser = getExecutionController();
+            // Use only 30% of the heap.
+            final long testMemorySize = 3 * Runtime.getRuntime().maxMemory() / 10;
+
+            while (stresser.continueExecution()) {
+                locker.lock();
+                GarbageUtils.engageGC(testMemorySize);
+                locker.unlock();
+            }
         }
     }
 
@@ -60,14 +65,6 @@
         return new Worker();
     }
 
-    public void setGarbageProducer(GarbageProducer garbageProducer) {
-        this.garbageProducer = garbageProducer;
-    }
-
-    public void setGarbageProducer1(GarbageProducer garbageProducer1) {
-        this.garbageProducer1 = garbageProducer1;
-    }
-
     public void setLockers(Lockers lockers) {
         this.lockers = lockers;
     }
diff --git a/test/hotspot/jtreg/vmTestbase/gc/lock/jni/jnilock001/TestDescription.java b/test/hotspot/jtreg/vmTestbase/gc/lock/jni/jnilock001/TestDescription.java
index 74fa24c..41de075 100644
--- a/test/hotspot/jtreg/vmTestbase/gc/lock/jni/jnilock001/TestDescription.java
+++ b/test/hotspot/jtreg/vmTestbase/gc/lock/jni/jnilock001/TestDescription.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2017, 2020, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2017, 2022, 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,10 +31,8 @@
  *
  * @library /vmTestbase
  *          /test/lib
- * @run main/othervm/native
- *      -XX:-UseGCOverheadLimit
- *      gc.lock.LockerTest
- *      -gp1 randomString
- *      -lockers jni
+ * @build jdk.test.whitebox.WhiteBox
+ * @run driver jdk.test.lib.helpers.ClassFileInstaller jdk.test.whitebox.WhiteBox
+ * @run main/othervm/native -Xbootclasspath/a:. -Xlog:gc=debug:gc.log -XX:+HeapDumpOnOutOfMemoryError -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI gc.lock.LockerTest -lockers jni -t 1
  */
 
diff --git a/test/hotspot/jtreg/vmTestbase/gc/lock/jni/jnilock002/TEST.properties b/test/hotspot/jtreg/vmTestbase/gc/lock/jni/jnilock002/TEST.properties
deleted file mode 100644
index 04b22a1..0000000
--- a/test/hotspot/jtreg/vmTestbase/gc/lock/jni/jnilock002/TEST.properties
+++ /dev/null
@@ -1,23 +0,0 @@
-#
-# Copyright (c) 2017, 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.
-#
-exclusiveAccess.dirs=.
diff --git a/test/hotspot/jtreg/vmTestbase/gc/lock/jni/jnilock002/TestDescription.java b/test/hotspot/jtreg/vmTestbase/gc/lock/jni/jnilock002/TestDescription.java
deleted file mode 100644
index 3df984c..0000000
--- a/test/hotspot/jtreg/vmTestbase/gc/lock/jni/jnilock002/TestDescription.java
+++ /dev/null
@@ -1,40 +0,0 @@
-/*
- * Copyright (c) 2017, 2020, 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
- * @key stress randomness
- *
- * @summary converted from VM Testbase gc/lock/jni/jnilock002.
- * VM Testbase keywords: [gc, stress, stressopt, nonconcurrent]
- *
- * @library /vmTestbase
- *          /test/lib
- * @run main/othervm/native
- *      -XX:-UseGCOverheadLimit
- *      gc.lock.LockerTest
- *      -gp1 random(primitiveArrays)
- *      -lockers jni
- */
-
diff --git a/test/hotspot/jtreg/vmTestbase/gc/lock/jni/jnilock003/TEST.properties b/test/hotspot/jtreg/vmTestbase/gc/lock/jni/jnilock003/TEST.properties
deleted file mode 100644
index 04b22a1..0000000
--- a/test/hotspot/jtreg/vmTestbase/gc/lock/jni/jnilock003/TEST.properties
+++ /dev/null
@@ -1,23 +0,0 @@
-#
-# Copyright (c) 2017, 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.
-#
-exclusiveAccess.dirs=.
diff --git a/test/hotspot/jtreg/vmTestbase/gc/lock/jni/jnilock003/TestDescription.java b/test/hotspot/jtreg/vmTestbase/gc/lock/jni/jnilock003/TestDescription.java
deleted file mode 100644
index 3518c46..0000000
--- a/test/hotspot/jtreg/vmTestbase/gc/lock/jni/jnilock003/TestDescription.java
+++ /dev/null
@@ -1,40 +0,0 @@
-/*
- * Copyright (c) 2017, 2020, 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
- * @key stress randomness
- *
- * @summary converted from VM Testbase gc/lock/jni/jnilock003.
- * VM Testbase keywords: [gc, stress, stressopt, nonconcurrent]
- *
- * @library /vmTestbase
- *          /test/lib
- * @run main/othervm/native
- *      -XX:-UseGCOverheadLimit
- *      gc.lock.LockerTest
- *      -gp1 interned(randomString)
- *      -lockers jni
- */
-
diff --git a/test/hotspot/jtreg/vmTestbase/gc/lock/jniref/jniglobalreflock01/TestDescription.java b/test/hotspot/jtreg/vmTestbase/gc/lock/jniref/jniglobalreflock01/TestDescription.java
index 145c827..4b78d02 100644
--- a/test/hotspot/jtreg/vmTestbase/gc/lock/jniref/jniglobalreflock01/TestDescription.java
+++ b/test/hotspot/jtreg/vmTestbase/gc/lock/jniref/jniglobalreflock01/TestDescription.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2017, 2020, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2017, 2022, 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,10 +31,8 @@
  *
  * @library /vmTestbase
  *          /test/lib
- * @run main/othervm/native
- *      -XX:-UseGCOverheadLimit
- *      gc.lock.LockerTest
- *      -gp1 randomString
- *      -lockers jniGlobalRef
+ * @build jdk.test.whitebox.WhiteBox
+ * @run driver jdk.test.lib.helpers.ClassFileInstaller jdk.test.whitebox.WhiteBox
+ * @run main/othervm/native -Xbootclasspath/a:. -Xlog:gc=debug:gc.log -XX:+HeapDumpOnOutOfMemoryError -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI gc.lock.LockerTest -lockers jniGlobalRef -t 1
  */
 
diff --git a/test/hotspot/jtreg/vmTestbase/gc/lock/jniref/jniglobalreflock02/TEST.properties b/test/hotspot/jtreg/vmTestbase/gc/lock/jniref/jniglobalreflock02/TEST.properties
deleted file mode 100644
index 04b22a1..0000000
--- a/test/hotspot/jtreg/vmTestbase/gc/lock/jniref/jniglobalreflock02/TEST.properties
+++ /dev/null
@@ -1,23 +0,0 @@
-#
-# Copyright (c) 2017, 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.
-#
-exclusiveAccess.dirs=.
diff --git a/test/hotspot/jtreg/vmTestbase/gc/lock/jniref/jniglobalreflock02/TestDescription.java b/test/hotspot/jtreg/vmTestbase/gc/lock/jniref/jniglobalreflock02/TestDescription.java
deleted file mode 100644
index 7caeb88..0000000
--- a/test/hotspot/jtreg/vmTestbase/gc/lock/jniref/jniglobalreflock02/TestDescription.java
+++ /dev/null
@@ -1,40 +0,0 @@
-/*
- * Copyright (c) 2017, 2020, 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
- * @key stress randomness
- *
- * @summary converted from VM Testbase gc/lock/jniref/jniglobalreflock02.
- * VM Testbase keywords: [gc, stress, stressopt, nonconcurrent]
- *
- * @library /vmTestbase
- *          /test/lib
- * @run main/othervm/native
- *      -XX:-UseGCOverheadLimit
- *      gc.lock.LockerTest
- *      -gp1 random(primitiveArrays)
- *      -lockers jniGlobalRef
- */
-
diff --git a/test/hotspot/jtreg/vmTestbase/gc/lock/jniref/jniglobalreflock03/TEST.properties b/test/hotspot/jtreg/vmTestbase/gc/lock/jniref/jniglobalreflock03/TEST.properties
deleted file mode 100644
index 04b22a1..0000000
--- a/test/hotspot/jtreg/vmTestbase/gc/lock/jniref/jniglobalreflock03/TEST.properties
+++ /dev/null
@@ -1,23 +0,0 @@
-#
-# Copyright (c) 2017, 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.
-#
-exclusiveAccess.dirs=.
diff --git a/test/hotspot/jtreg/vmTestbase/gc/lock/jniref/jniglobalreflock03/TestDescription.java b/test/hotspot/jtreg/vmTestbase/gc/lock/jniref/jniglobalreflock03/TestDescription.java
deleted file mode 100644
index 7e2a78a..0000000
--- a/test/hotspot/jtreg/vmTestbase/gc/lock/jniref/jniglobalreflock03/TestDescription.java
+++ /dev/null
@@ -1,40 +0,0 @@
-/*
- * Copyright (c) 2017, 2020, 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
- * @key stress randomness
- *
- * @summary converted from VM Testbase gc/lock/jniref/jniglobalreflock03.
- * VM Testbase keywords: [gc, stress, stressopt, nonconcurrent]
- *
- * @library /vmTestbase
- *          /test/lib
- * @run main/othervm/native
- *      -XX:-UseGCOverheadLimit
- *      gc.lock.LockerTest
- *      -gp1 interned(randomString)
- *      -lockers jniGlobalRef
- */
-
diff --git a/test/hotspot/jtreg/vmTestbase/gc/lock/jniref/jniglobalreflock04/TEST.properties b/test/hotspot/jtreg/vmTestbase/gc/lock/jniref/jniglobalreflock04/TEST.properties
deleted file mode 100644
index 04b22a1..0000000
--- a/test/hotspot/jtreg/vmTestbase/gc/lock/jniref/jniglobalreflock04/TEST.properties
+++ /dev/null
@@ -1,23 +0,0 @@
-#
-# Copyright (c) 2017, 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.
-#
-exclusiveAccess.dirs=.
diff --git a/test/hotspot/jtreg/vmTestbase/gc/lock/jniref/jniglobalreflock04/TestDescription.java b/test/hotspot/jtreg/vmTestbase/gc/lock/jniref/jniglobalreflock04/TestDescription.java
deleted file mode 100644
index b62fbb8..0000000
--- a/test/hotspot/jtreg/vmTestbase/gc/lock/jniref/jniglobalreflock04/TestDescription.java
+++ /dev/null
@@ -1,40 +0,0 @@
-/*
- * Copyright (c) 2017, 2020, 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
- * @key stress randomness
- *
- * @summary converted from VM Testbase gc/lock/jniref/jniglobalreflock04.
- * VM Testbase keywords: [gc, stress, stressopt, nonconcurrent]
- *
- * @library /vmTestbase
- *          /test/lib
- * @run main/othervm/native
- *      -XX:-UseGCOverheadLimit
- *      gc.lock.LockerTest
- *      -gp1 class
- *      -lockers jniGlobalRef
- */
-
diff --git a/test/hotspot/jtreg/vmTestbase/gc/lock/jniref/jnilocalreflock01/TestDescription.java b/test/hotspot/jtreg/vmTestbase/gc/lock/jniref/jnilocalreflock01/TestDescription.java
index 2f98e7d..d56ff12 100644
--- a/test/hotspot/jtreg/vmTestbase/gc/lock/jniref/jnilocalreflock01/TestDescription.java
+++ b/test/hotspot/jtreg/vmTestbase/gc/lock/jniref/jnilocalreflock01/TestDescription.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2017, 2020, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2017, 2022, 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,10 +31,8 @@
  *
  * @library /vmTestbase
  *          /test/lib
- * @run main/othervm/native
- *      -XX:-UseGCOverheadLimit
- *      gc.lock.LockerTest
- *      -gp1 randomString
- *      -lockers jniLocalRef
+ * @build jdk.test.whitebox.WhiteBox
+ * @run driver jdk.test.lib.helpers.ClassFileInstaller jdk.test.whitebox.WhiteBox
+ * @run main/othervm/native -Xbootclasspath/a:. -Xlog:gc=debug:gc.log -XX:+HeapDumpOnOutOfMemoryError -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI gc.lock.LockerTest -lockers jniLocalRef -t 1
  */
 
diff --git a/test/hotspot/jtreg/vmTestbase/gc/lock/jniref/jnilocalreflock02/TEST.properties b/test/hotspot/jtreg/vmTestbase/gc/lock/jniref/jnilocalreflock02/TEST.properties
deleted file mode 100644
index 04b22a1..0000000
--- a/test/hotspot/jtreg/vmTestbase/gc/lock/jniref/jnilocalreflock02/TEST.properties
+++ /dev/null
@@ -1,23 +0,0 @@
-#
-# Copyright (c) 2017, 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.
-#
-exclusiveAccess.dirs=.
diff --git a/test/hotspot/jtreg/vmTestbase/gc/lock/jniref/jnilocalreflock02/TestDescription.java b/test/hotspot/jtreg/vmTestbase/gc/lock/jniref/jnilocalreflock02/TestDescription.java
deleted file mode 100644
index e6ceb45..0000000
--- a/test/hotspot/jtreg/vmTestbase/gc/lock/jniref/jnilocalreflock02/TestDescription.java
+++ /dev/null
@@ -1,40 +0,0 @@
-/*
- * Copyright (c) 2017, 2020, 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
- * @key stress randomness
- *
- * @summary converted from VM Testbase gc/lock/jniref/jnilocalreflock02.
- * VM Testbase keywords: [gc, stress, stressopt, nonconcurrent]
- *
- * @library /vmTestbase
- *          /test/lib
- * @run main/othervm/native
- *      -XX:-UseGCOverheadLimit
- *      gc.lock.LockerTest
- *      -gp1 random(primitiveArrays)
- *      -lockers jniLocalRef
- */
-
diff --git a/test/hotspot/jtreg/vmTestbase/gc/lock/jniref/jnilocalreflock03/TEST.properties b/test/hotspot/jtreg/vmTestbase/gc/lock/jniref/jnilocalreflock03/TEST.properties
deleted file mode 100644
index 04b22a1..0000000
--- a/test/hotspot/jtreg/vmTestbase/gc/lock/jniref/jnilocalreflock03/TEST.properties
+++ /dev/null
@@ -1,23 +0,0 @@
-#
-# Copyright (c) 2017, 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.
-#
-exclusiveAccess.dirs=.
diff --git a/test/hotspot/jtreg/vmTestbase/gc/lock/jniref/jnilocalreflock03/TestDescription.java b/test/hotspot/jtreg/vmTestbase/gc/lock/jniref/jnilocalreflock03/TestDescription.java
deleted file mode 100644
index 7b15ea0..0000000
--- a/test/hotspot/jtreg/vmTestbase/gc/lock/jniref/jnilocalreflock03/TestDescription.java
+++ /dev/null
@@ -1,40 +0,0 @@
-/*
- * Copyright (c) 2017, 2020, 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
- * @key stress randomness
- *
- * @summary converted from VM Testbase gc/lock/jniref/jnilocalreflock03.
- * VM Testbase keywords: [gc, stress, stressopt, nonconcurrent]
- *
- * @library /vmTestbase
- *          /test/lib
- * @run main/othervm/native
- *      -XX:-UseGCOverheadLimit
- *      gc.lock.LockerTest
- *      -gp1 interned(randomString)
- *      -lockers jniLocalRef
- */
-
diff --git a/test/hotspot/jtreg/vmTestbase/gc/lock/jniref/jnilocalreflock04/TEST.properties b/test/hotspot/jtreg/vmTestbase/gc/lock/jniref/jnilocalreflock04/TEST.properties
deleted file mode 100644
index 04b22a1..0000000
--- a/test/hotspot/jtreg/vmTestbase/gc/lock/jniref/jnilocalreflock04/TEST.properties
+++ /dev/null
@@ -1,23 +0,0 @@
-#
-# Copyright (c) 2017, 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.
-#
-exclusiveAccess.dirs=.
diff --git a/test/hotspot/jtreg/vmTestbase/gc/lock/jniref/jnilocalreflock04/TestDescription.java b/test/hotspot/jtreg/vmTestbase/gc/lock/jniref/jnilocalreflock04/TestDescription.java
deleted file mode 100644
index 42d7299..0000000
--- a/test/hotspot/jtreg/vmTestbase/gc/lock/jniref/jnilocalreflock04/TestDescription.java
+++ /dev/null
@@ -1,40 +0,0 @@
-/*
- * Copyright (c) 2017, 2020, 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
- * @key stress randomness
- *
- * @summary converted from VM Testbase gc/lock/jniref/jnilocalreflock04.
- * VM Testbase keywords: [gc, stress, stressopt, nonconcurrent]
- *
- * @library /vmTestbase
- *          /test/lib
- * @run main/othervm/native
- *      -XX:-UseGCOverheadLimit
- *      gc.lock.LockerTest
- *      -gp1 class
- *      -lockers jniLocalRef
- */
-
diff --git a/test/hotspot/jtreg/vmTestbase/gc/lock/jniref/jnireflock01/TestDescription.java b/test/hotspot/jtreg/vmTestbase/gc/lock/jniref/jnireflock01/TestDescription.java
index a7afe84..294ee1d 100644
--- a/test/hotspot/jtreg/vmTestbase/gc/lock/jniref/jnireflock01/TestDescription.java
+++ b/test/hotspot/jtreg/vmTestbase/gc/lock/jniref/jnireflock01/TestDescription.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2017, 2020, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2017, 2022, 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,10 +31,8 @@
  *
  * @library /vmTestbase
  *          /test/lib
- * @run main/othervm/native
- *      -XX:-UseGCOverheadLimit
- *      gc.lock.LockerTest
- *      -gp1 randomString
- *      -lockers jniRef
+ * @build jdk.test.whitebox.WhiteBox
+ * @run driver jdk.test.lib.helpers.ClassFileInstaller jdk.test.whitebox.WhiteBox
+ * @run main/othervm/native -Xbootclasspath/a:. -Xlog:gc=debug:gc.log -XX:+HeapDumpOnOutOfMemoryError -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI gc.lock.LockerTest -lockers jniRef -t 1
  */
 
diff --git a/test/hotspot/jtreg/vmTestbase/gc/lock/jniref/jnireflock02/TEST.properties b/test/hotspot/jtreg/vmTestbase/gc/lock/jniref/jnireflock02/TEST.properties
deleted file mode 100644
index 04b22a1..0000000
--- a/test/hotspot/jtreg/vmTestbase/gc/lock/jniref/jnireflock02/TEST.properties
+++ /dev/null
@@ -1,23 +0,0 @@
-#
-# Copyright (c) 2017, 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.
-#
-exclusiveAccess.dirs=.
diff --git a/test/hotspot/jtreg/vmTestbase/gc/lock/jniref/jnireflock02/TestDescription.java b/test/hotspot/jtreg/vmTestbase/gc/lock/jniref/jnireflock02/TestDescription.java
deleted file mode 100644
index 05e356a..0000000
--- a/test/hotspot/jtreg/vmTestbase/gc/lock/jniref/jnireflock02/TestDescription.java
+++ /dev/null
@@ -1,40 +0,0 @@
-/*
- * Copyright (c) 2017, 2020, 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
- * @key stress randomness
- *
- * @summary converted from VM Testbase gc/lock/jniref/jnireflock02.
- * VM Testbase keywords: [gc, stress, stressopt, nonconcurrent]
- *
- * @library /vmTestbase
- *          /test/lib
- * @run main/othervm/native
- *      -XX:-UseGCOverheadLimit
- *      gc.lock.LockerTest
- *      -gp1 random(primitiveArrays)
- *      -lockers jniRef
- */
-
diff --git a/test/hotspot/jtreg/vmTestbase/gc/lock/jniref/jnireflock03/TEST.properties b/test/hotspot/jtreg/vmTestbase/gc/lock/jniref/jnireflock03/TEST.properties
deleted file mode 100644
index 04b22a1..0000000
--- a/test/hotspot/jtreg/vmTestbase/gc/lock/jniref/jnireflock03/TEST.properties
+++ /dev/null
@@ -1,23 +0,0 @@
-#
-# Copyright (c) 2017, 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.
-#
-exclusiveAccess.dirs=.
diff --git a/test/hotspot/jtreg/vmTestbase/gc/lock/jniref/jnireflock03/TestDescription.java b/test/hotspot/jtreg/vmTestbase/gc/lock/jniref/jnireflock03/TestDescription.java
deleted file mode 100644
index 53a16c9..0000000
--- a/test/hotspot/jtreg/vmTestbase/gc/lock/jniref/jnireflock03/TestDescription.java
+++ /dev/null
@@ -1,40 +0,0 @@
-/*
- * Copyright (c) 2017, 2020, 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
- * @key stress randomness
- *
- * @summary converted from VM Testbase gc/lock/jniref/jnireflock03.
- * VM Testbase keywords: [gc, stress, stressopt, nonconcurrent]
- *
- * @library /vmTestbase
- *          /test/lib
- * @run main/othervm/native
- *      -XX:-UseGCOverheadLimit
- *      gc.lock.LockerTest
- *      -gp1 interned(randomString)
- *      -lockers jniRef
- */
-
diff --git a/test/hotspot/jtreg/vmTestbase/gc/lock/jniref/jnireflock04/TEST.properties b/test/hotspot/jtreg/vmTestbase/gc/lock/jniref/jnireflock04/TEST.properties
deleted file mode 100644
index 04b22a1..0000000
--- a/test/hotspot/jtreg/vmTestbase/gc/lock/jniref/jnireflock04/TEST.properties
+++ /dev/null
@@ -1,23 +0,0 @@
-#
-# Copyright (c) 2017, 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.
-#
-exclusiveAccess.dirs=.
diff --git a/test/hotspot/jtreg/vmTestbase/gc/lock/jniref/jnireflock04/TestDescription.java b/test/hotspot/jtreg/vmTestbase/gc/lock/jniref/jnireflock04/TestDescription.java
deleted file mode 100644
index 8e61aa3..0000000
--- a/test/hotspot/jtreg/vmTestbase/gc/lock/jniref/jnireflock04/TestDescription.java
+++ /dev/null
@@ -1,36 +0,0 @@
-/*
- * Copyright (c) 2017, 2020, 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
- * @key stress randomness
- *
- * @summary converted from VM Testbase gc/lock/jniref/jnireflock04.
- * VM Testbase keywords: [gc, stress, stressopt, nonconcurrent, quick]
- *
- * @library /vmTestbase
- *          /test/lib
- * @run main/othervm/native -XX:-UseGCOverheadLimit gc.lock.LockerTest -gp1 class -lockers jniRef
- */
-
diff --git a/test/hotspot/jtreg/vmTestbase/gc/lock/jniref/jniweakglobalreflock01/TestDescription.java b/test/hotspot/jtreg/vmTestbase/gc/lock/jniref/jniweakglobalreflock01/TestDescription.java
index d0c0caa..9609e34 100644
--- a/test/hotspot/jtreg/vmTestbase/gc/lock/jniref/jniweakglobalreflock01/TestDescription.java
+++ b/test/hotspot/jtreg/vmTestbase/gc/lock/jniref/jniweakglobalreflock01/TestDescription.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2017, 2020, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2017, 2022, 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,10 +31,8 @@
  *
  * @library /vmTestbase
  *          /test/lib
- * @run main/othervm/native
- *      -XX:-UseGCOverheadLimit
- *      gc.lock.LockerTest
- *      -gp1 randomString
- *      -lockers jniWeakGlobalRef
+ * @build jdk.test.whitebox.WhiteBox
+ * @run driver jdk.test.lib.helpers.ClassFileInstaller jdk.test.whitebox.WhiteBox
+ * @run main/othervm/native -Xbootclasspath/a:. -Xlog:gc=debug:gc.log -XX:+HeapDumpOnOutOfMemoryError -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI gc.lock.LockerTest -lockers jniWeakGlobalRef -t 1
  */
 
diff --git a/test/hotspot/jtreg/vmTestbase/gc/lock/jniref/jniweakglobalreflock02/TEST.properties b/test/hotspot/jtreg/vmTestbase/gc/lock/jniref/jniweakglobalreflock02/TEST.properties
deleted file mode 100644
index 04b22a1..0000000
--- a/test/hotspot/jtreg/vmTestbase/gc/lock/jniref/jniweakglobalreflock02/TEST.properties
+++ /dev/null
@@ -1,23 +0,0 @@
-#
-# Copyright (c) 2017, 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.
-#
-exclusiveAccess.dirs=.
diff --git a/test/hotspot/jtreg/vmTestbase/gc/lock/jniref/jniweakglobalreflock02/TestDescription.java b/test/hotspot/jtreg/vmTestbase/gc/lock/jniref/jniweakglobalreflock02/TestDescription.java
deleted file mode 100644
index 63b600b..0000000
--- a/test/hotspot/jtreg/vmTestbase/gc/lock/jniref/jniweakglobalreflock02/TestDescription.java
+++ /dev/null
@@ -1,40 +0,0 @@
-/*
- * Copyright (c) 2017, 2020, 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
- * @key stress randomness
- *
- * @summary converted from VM Testbase gc/lock/jniref/jniweakglobalreflock02.
- * VM Testbase keywords: [gc, stress, stressopt, nonconcurrent]
- *
- * @library /vmTestbase
- *          /test/lib
- * @run main/othervm/native
- *      -XX:-UseGCOverheadLimit
- *      gc.lock.LockerTest
- *      -gp1 random(primitiveArrays)
- *      -lockers jniWeakGlobalRef
- */
-
diff --git a/test/hotspot/jtreg/vmTestbase/gc/lock/jniref/jniweakglobalreflock03/TEST.properties b/test/hotspot/jtreg/vmTestbase/gc/lock/jniref/jniweakglobalreflock03/TEST.properties
deleted file mode 100644
index 04b22a1..0000000
--- a/test/hotspot/jtreg/vmTestbase/gc/lock/jniref/jniweakglobalreflock03/TEST.properties
+++ /dev/null
@@ -1,23 +0,0 @@
-#
-# Copyright (c) 2017, 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.
-#
-exclusiveAccess.dirs=.
diff --git a/test/hotspot/jtreg/vmTestbase/gc/lock/jniref/jniweakglobalreflock03/TestDescription.java b/test/hotspot/jtreg/vmTestbase/gc/lock/jniref/jniweakglobalreflock03/TestDescription.java
deleted file mode 100644
index 86fc198..0000000
--- a/test/hotspot/jtreg/vmTestbase/gc/lock/jniref/jniweakglobalreflock03/TestDescription.java
+++ /dev/null
@@ -1,40 +0,0 @@
-/*
- * Copyright (c) 2017, 2020, 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
- * @key stress randomness
- *
- * @summary converted from VM Testbase gc/lock/jniref/jniweakglobalreflock03.
- * VM Testbase keywords: [gc, stress, stressopt, nonconcurrent]
- *
- * @library /vmTestbase
- *          /test/lib
- * @run main/othervm/native
- *      -XX:-UseGCOverheadLimit
- *      gc.lock.LockerTest
- *      -gp1 interned(randomString)
- *      -lockers jniWeakGlobalRef
- */
-
diff --git a/test/hotspot/jtreg/vmTestbase/gc/lock/jniref/jniweakglobalreflock04/TEST.properties b/test/hotspot/jtreg/vmTestbase/gc/lock/jniref/jniweakglobalreflock04/TEST.properties
deleted file mode 100644
index 04b22a1..0000000
--- a/test/hotspot/jtreg/vmTestbase/gc/lock/jniref/jniweakglobalreflock04/TEST.properties
+++ /dev/null
@@ -1,23 +0,0 @@
-#
-# Copyright (c) 2017, 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.
-#
-exclusiveAccess.dirs=.
diff --git a/test/hotspot/jtreg/vmTestbase/gc/lock/jniref/jniweakglobalreflock04/TestDescription.java b/test/hotspot/jtreg/vmTestbase/gc/lock/jniref/jniweakglobalreflock04/TestDescription.java
deleted file mode 100644
index 3de445e..0000000
--- a/test/hotspot/jtreg/vmTestbase/gc/lock/jniref/jniweakglobalreflock04/TestDescription.java
+++ /dev/null
@@ -1,40 +0,0 @@
-/*
- * Copyright (c) 2017, 2020, 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
- * @key stress randomness
- *
- * @summary converted from VM Testbase gc/lock/jniref/jniweakglobalreflock04.
- * VM Testbase keywords: [gc, stress, stressopt, nonconcurrent]
- *
- * @library /vmTestbase
- *          /test/lib
- * @run main/othervm/native
- *      -XX:-UseGCOverheadLimit
- *      gc.lock.LockerTest
- *      -gp1 class
- *      -lockers jniWeakGlobalRef
- */
-
diff --git a/test/hotspot/jtreg/vmTestbase/gc/lock/jvmti/alloc/jvmtialloclock01/TestDescription.java b/test/hotspot/jtreg/vmTestbase/gc/lock/jvmti/alloc/jvmtialloclock01/TestDescription.java
index 21224bc..ec47cd8 100644
--- a/test/hotspot/jtreg/vmTestbase/gc/lock/jvmti/alloc/jvmtialloclock01/TestDescription.java
+++ b/test/hotspot/jtreg/vmTestbase/gc/lock/jvmti/alloc/jvmtialloclock01/TestDescription.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2017, 2020, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2017, 2022, 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,11 +31,8 @@
  *
  * @library /vmTestbase
  *          /test/lib
- * @run main/othervm/native
- *      -XX:-UseGCOverheadLimit
- *      -agentlib:JVMTIAllocLocker
- *      gc.lock.LockerTest
- *      -gp1 randomString
- *      -lockers jvmtiAlloc
+ * @build jdk.test.whitebox.WhiteBox
+ * @run driver jdk.test.lib.helpers.ClassFileInstaller jdk.test.whitebox.WhiteBox
+ * @run main/othervm/native -Xbootclasspath/a:. -Xlog:gc=debug:gc.log -XX:+HeapDumpOnOutOfMemoryError -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI -agentlib:JVMTIAllocLocker gc.lock.LockerTest -lockers jvmtiAlloc -t 1
  */
 
diff --git a/test/hotspot/jtreg/vmTestbase/gc/lock/jvmti/alloc/jvmtialloclock02/TEST.properties b/test/hotspot/jtreg/vmTestbase/gc/lock/jvmti/alloc/jvmtialloclock02/TEST.properties
deleted file mode 100644
index 04b22a1..0000000
--- a/test/hotspot/jtreg/vmTestbase/gc/lock/jvmti/alloc/jvmtialloclock02/TEST.properties
+++ /dev/null
@@ -1,23 +0,0 @@
-#
-# Copyright (c) 2017, 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.
-#
-exclusiveAccess.dirs=.
diff --git a/test/hotspot/jtreg/vmTestbase/gc/lock/jvmti/alloc/jvmtialloclock02/TestDescription.java b/test/hotspot/jtreg/vmTestbase/gc/lock/jvmti/alloc/jvmtialloclock02/TestDescription.java
deleted file mode 100644
index 14e004b..0000000
--- a/test/hotspot/jtreg/vmTestbase/gc/lock/jvmti/alloc/jvmtialloclock02/TestDescription.java
+++ /dev/null
@@ -1,41 +0,0 @@
-/*
- * Copyright (c) 2017, 2020, 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
- * @key stress randomness
- *
- * @summary converted from VM Testbase gc/lock/jvmti/alloc/jvmtialloclock02.
- * VM Testbase keywords: [gc, stress, stressopt, jvmti, nonconcurrent, quick]
- *
- * @library /vmTestbase
- *          /test/lib
- * @run main/othervm/native
- *      -XX:-UseGCOverheadLimit
- *      -agentlib:JVMTIAllocLocker
- *      gc.lock.LockerTest
- *      -gp1 random(primitiveArrays)
- *      -lockers jvmtiAlloc
- */
-
diff --git a/test/hotspot/jtreg/vmTestbase/gc/lock/jvmti/alloc/jvmtialloclock03/TEST.properties b/test/hotspot/jtreg/vmTestbase/gc/lock/jvmti/alloc/jvmtialloclock03/TEST.properties
deleted file mode 100644
index 04b22a1..0000000
--- a/test/hotspot/jtreg/vmTestbase/gc/lock/jvmti/alloc/jvmtialloclock03/TEST.properties
+++ /dev/null
@@ -1,23 +0,0 @@
-#
-# Copyright (c) 2017, 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.
-#
-exclusiveAccess.dirs=.
diff --git a/test/hotspot/jtreg/vmTestbase/gc/lock/jvmti/alloc/jvmtialloclock03/TestDescription.java b/test/hotspot/jtreg/vmTestbase/gc/lock/jvmti/alloc/jvmtialloclock03/TestDescription.java
deleted file mode 100644
index bcc954a..0000000
--- a/test/hotspot/jtreg/vmTestbase/gc/lock/jvmti/alloc/jvmtialloclock03/TestDescription.java
+++ /dev/null
@@ -1,41 +0,0 @@
-/*
- * Copyright (c) 2017, 2020, 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
- * @key stress randomness
- *
- * @summary converted from VM Testbase gc/lock/jvmti/alloc/jvmtialloclock03.
- * VM Testbase keywords: [gc, stress, stressopt, jvmti, nonconcurrent]
- *
- * @library /vmTestbase
- *          /test/lib
- * @run main/othervm/native
- *      -XX:-UseGCOverheadLimit
- *      -agentlib:JVMTIAllocLocker
- *      gc.lock.LockerTest
- *      -gp1 interned(randomString)
- *      -lockers jvmtiAlloc
- */
-
diff --git a/test/hotspot/jtreg/vmTestbase/gc/lock/jvmti/alloc/jvmtialloclock04/TEST.properties b/test/hotspot/jtreg/vmTestbase/gc/lock/jvmti/alloc/jvmtialloclock04/TEST.properties
deleted file mode 100644
index 04b22a1..0000000
--- a/test/hotspot/jtreg/vmTestbase/gc/lock/jvmti/alloc/jvmtialloclock04/TEST.properties
+++ /dev/null
@@ -1,23 +0,0 @@
-#
-# Copyright (c) 2017, 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.
-#
-exclusiveAccess.dirs=.
diff --git a/test/hotspot/jtreg/vmTestbase/gc/lock/jvmti/alloc/jvmtialloclock04/TestDescription.java b/test/hotspot/jtreg/vmTestbase/gc/lock/jvmti/alloc/jvmtialloclock04/TestDescription.java
deleted file mode 100644
index 9164567..0000000
--- a/test/hotspot/jtreg/vmTestbase/gc/lock/jvmti/alloc/jvmtialloclock04/TestDescription.java
+++ /dev/null
@@ -1,41 +0,0 @@
-/*
- * Copyright (c) 2017, 2020, 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
- * @key stress randomness
- *
- * @summary converted from VM Testbase gc/lock/jvmti/alloc/jvmtialloclock04.
- * VM Testbase keywords: [gc, stress, stressopt, jvmti, nonconcurrent]
- *
- * @library /vmTestbase
- *          /test/lib
- * @run main/othervm/native
- *      -XX:-UseGCOverheadLimit
- *      -agentlib:JVMTIAllocLocker
- *      gc.lock.LockerTest
- *      -gp1 class
- *      -lockers jvmtiAlloc
- */
-
diff --git a/test/hotspot/jtreg/vmTestbase/gc/lock/malloc/malloclock01/TestDescription.java b/test/hotspot/jtreg/vmTestbase/gc/lock/malloc/malloclock01/TestDescription.java
index 5349f58..47663fe 100644
--- a/test/hotspot/jtreg/vmTestbase/gc/lock/malloc/malloclock01/TestDescription.java
+++ b/test/hotspot/jtreg/vmTestbase/gc/lock/malloc/malloclock01/TestDescription.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2017, 2020, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2017, 2022, 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,10 +31,8 @@
  *
  * @library /vmTestbase
  *          /test/lib
- * @run main/othervm/native
- *      -XX:-UseGCOverheadLimit
- *      gc.lock.LockerTest
- *      -gp1 randomString
- *      -lockers malloc
+ * @build jdk.test.whitebox.WhiteBox
+ * @run driver jdk.test.lib.helpers.ClassFileInstaller jdk.test.whitebox.WhiteBox
+ * @run main/othervm/native -Xbootclasspath/a:. -Xlog:gc=debug:gc.log -XX:+HeapDumpOnOutOfMemoryError -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI gc.lock.LockerTest -lockers malloc -t 1
  */
 
diff --git a/test/hotspot/jtreg/vmTestbase/gc/lock/malloc/malloclock02/TEST.properties b/test/hotspot/jtreg/vmTestbase/gc/lock/malloc/malloclock02/TEST.properties
deleted file mode 100644
index 04b22a1..0000000
--- a/test/hotspot/jtreg/vmTestbase/gc/lock/malloc/malloclock02/TEST.properties
+++ /dev/null
@@ -1,23 +0,0 @@
-#
-# Copyright (c) 2017, 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.
-#
-exclusiveAccess.dirs=.
diff --git a/test/hotspot/jtreg/vmTestbase/gc/lock/malloc/malloclock02/TestDescription.java b/test/hotspot/jtreg/vmTestbase/gc/lock/malloc/malloclock02/TestDescription.java
deleted file mode 100644
index a584d96..0000000
--- a/test/hotspot/jtreg/vmTestbase/gc/lock/malloc/malloclock02/TestDescription.java
+++ /dev/null
@@ -1,40 +0,0 @@
-/*
- * Copyright (c) 2017, 2020, 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
- * @key stress randomness
- *
- * @summary converted from VM Testbase gc/lock/malloc/malloclock02.
- * VM Testbase keywords: [gc, stress, stressopt, nonconcurrent]
- *
- * @library /vmTestbase
- *          /test/lib
- * @run main/othervm/native
- *      -XX:-UseGCOverheadLimit
- *      gc.lock.LockerTest
- *      -gp1 random(primitiveArrays)
- *      -lockers malloc
- */
-
diff --git a/test/hotspot/jtreg/vmTestbase/gc/lock/malloc/malloclock03/TEST.properties b/test/hotspot/jtreg/vmTestbase/gc/lock/malloc/malloclock03/TEST.properties
deleted file mode 100644
index 04b22a1..0000000
--- a/test/hotspot/jtreg/vmTestbase/gc/lock/malloc/malloclock03/TEST.properties
+++ /dev/null
@@ -1,23 +0,0 @@
-#
-# Copyright (c) 2017, 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.
-#
-exclusiveAccess.dirs=.
diff --git a/test/hotspot/jtreg/vmTestbase/gc/lock/malloc/malloclock03/TestDescription.java b/test/hotspot/jtreg/vmTestbase/gc/lock/malloc/malloclock03/TestDescription.java
deleted file mode 100644
index 866c7c3..0000000
--- a/test/hotspot/jtreg/vmTestbase/gc/lock/malloc/malloclock03/TestDescription.java
+++ /dev/null
@@ -1,40 +0,0 @@
-/*
- * Copyright (c) 2017, 2020, 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
- * @key stress randomness
- *
- * @summary converted from VM Testbase gc/lock/malloc/malloclock03.
- * VM Testbase keywords: [gc, stress, stressopt, nonconcurrent, quick]
- *
- * @library /vmTestbase
- *          /test/lib
- * @run main/othervm/native
- *      -XX:-UseGCOverheadLimit
- *      gc.lock.LockerTest
- *      -gp1 interned(randomString)
- *      -lockers malloc
- */
-
diff --git a/test/hotspot/jtreg/vmTestbase/gc/lock/malloc/malloclock04/TEST.properties b/test/hotspot/jtreg/vmTestbase/gc/lock/malloc/malloclock04/TEST.properties
deleted file mode 100644
index 04b22a1..0000000
--- a/test/hotspot/jtreg/vmTestbase/gc/lock/malloc/malloclock04/TEST.properties
+++ /dev/null
@@ -1,23 +0,0 @@
-#
-# Copyright (c) 2017, 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.
-#
-exclusiveAccess.dirs=.
diff --git a/test/hotspot/jtreg/vmTestbase/gc/lock/malloc/malloclock04/TestDescription.java b/test/hotspot/jtreg/vmTestbase/gc/lock/malloc/malloclock04/TestDescription.java
deleted file mode 100644
index d70a82a..0000000
--- a/test/hotspot/jtreg/vmTestbase/gc/lock/malloc/malloclock04/TestDescription.java
+++ /dev/null
@@ -1,36 +0,0 @@
-/*
- * Copyright (c) 2017, 2020, 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
- * @key stress randomness
- *
- * @summary converted from VM Testbase gc/lock/malloc/malloclock04.
- * VM Testbase keywords: [gc, stress, stressopt, nonconcurrent]
- *
- * @library /vmTestbase
- *          /test/lib
- * @run main/othervm/native -XX:-UseGCOverheadLimit gc.lock.LockerTest -gp1 class -lockers malloc
- */
-
diff --git a/test/hotspot/jtreg/vmTestbase/nsk/share/gc/gp/GarbageUtils.java b/test/hotspot/jtreg/vmTestbase/nsk/share/gc/gp/GarbageUtils.java
index 87dff30..dc5bc5e 100644
--- a/test/hotspot/jtreg/vmTestbase/nsk/share/gc/gp/GarbageUtils.java
+++ b/test/hotspot/jtreg/vmTestbase/nsk/share/gc/gp/GarbageUtils.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2007, 2021, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2007, 2022, 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 @@
 import java.io.StringWriter;
 import java.lang.invoke.*;
 import java.util.*;
+import jdk.test.whitebox.WhiteBox;
 import nsk.share.gc.gp.array.*;
 import nsk.share.gc.gp.string.*;
 import nsk.share.gc.gp.list.*;
@@ -87,6 +88,27 @@
         }
 
         /**
+         * engages GC by allocating memory chunks and triggering youngGC.
+         * Allocations are done for a total of YOUNG_GC_ITERATIONS times.
+         * Each iteration, we allocate a memory chunk and trigger youngGC.
+         * Finally fullGC is run once.
+         * This way the objects get to travel to various GC regions.
+         * @param testMemory - memory size to be operated on
+         */
+        public static void engageGC(long testMemory) {
+            final int YOUNG_GC_ITERATIONS = 100;
+            final long memChunk = testMemory / YOUNG_GC_ITERATIONS;
+            int iteration = 0;
+            Object referenceArray[] = new Object[YOUNG_GC_ITERATIONS];
+
+            while (iteration < YOUNG_GC_ITERATIONS) {
+                referenceArray[iteration++] = byteArrayProducer.create(memChunk);
+                WhiteBox.getWhiteBox().youngGC();
+            }
+            WhiteBox.getWhiteBox().fullGC();
+        }
+
+        /**
          * Eat memory using execution controller that waits for 2 minutes.
          * @return number of OOME occured
          */