Skip to content
Permalink
Browse files
8267163: Rename anonymous loader tests to hidden loader tests
Reviewed-by: mdoerr
Backport-of: 5c21c0044104b52fcaf3f3a830ea6e219d504ada
  • Loading branch information
GoeLin committed Mar 14, 2022
1 parent c82e18f commit d4d334886cbb86826cb2a43a244486055362b310
Showing 14 changed files with 52 additions and 52 deletions.
@@ -37,23 +37,23 @@
* /test/lib
*
* @comment build test class and indify classes
* @build vm.mlvm.anonloader.func.findByName.Test
* @build vm.mlvm.hiddenloader.func.findByName.Test
* @run driver vm.mlvm.share.IndifiedClassesBuilder
*
* @run main/othervm vm.mlvm.anonloader.func.findByName.Test
* @run main/othervm vm.mlvm.hiddenloader.func.findByName.Test
*/

package vm.mlvm.anonloader.func.findByName;
package vm.mlvm.hiddenloader.func.findByName;

import java.lang.invoke.MethodHandles;
import java.lang.invoke.MethodHandles.Lookup;

import vm.mlvm.anonloader.share.AnonkTestee01;
import vm.mlvm.hiddenloader.share.HiddenkTestee01;
import vm.mlvm.share.MlvmTest;
import vm.share.FileUtils;

public class Test extends MlvmTest {
private static final Class<?> PARENT = AnonkTestee01.class;
private static final Class<?> PARENT = HiddenkTestee01.class;

public boolean run() throws Exception {
try {
@@ -21,11 +21,11 @@
* questions.
*/

package vm.mlvm.anonloader.share;
package vm.mlvm.hiddenloader.share;

import vm.mlvm.share.Env;

public class AnonkTestee01 {
public class HiddenkTestee01 {
public final static String muzzy = "BIG \uFFFF\u0000\uFFFE\uFEFF MUZZY";
public final static String
theDrumIsTheDrumIsTheDrumIsTheDrumIsTheDrumIsTheDrumIsTheDrumIsTheDrumIsTheDrumIsTheDrumIsTheDrumIsTheDrumIsTheDrumIsTheDrumIsTheDrumIsTheDrumIsTheDrumIsTheDrumIsTheDrumIsTheDrumIsTheDrumIsTheDrumIsTheDrumIsTheDrumIsTheDrum
@@ -21,8 +21,8 @@
* questions.
*/

package vm.mlvm.anonloader.share;
package vm.mlvm.hiddenloader.share;

public class AnonkTestee02 extends AnonkTestee01 {
public AnonkTestee02() {}
public class HiddenkTestee02 extends HiddenkTestee01 {
public HiddenkTestee02() {}
}
@@ -21,7 +21,7 @@
* questions.
*/

package vm.mlvm.anonloader.share;
package vm.mlvm.hiddenloader.share;

import java.lang.invoke.MethodHandles;
import java.lang.invoke.MethodHandles.Lookup;
@@ -65,14 +65,14 @@
* <p>The test fails, if there were hangups.
*
* <p>By default, before loading class, the bytes are
* saved to {@code _AnonkTestee01.class} file in the current directory.
* saved to {@code _HiddenkTestee01.class} file in the current directory.
* If JVM crashes, the bytecodes can be analysed.
* Class saving is controlled by -saveClassFile option.
* A prefix can be added to the file name using {@link #setFileNamePrefix}
* function.
*/
public abstract class StressClassLoadingTest extends MlvmTest {
private static final String RESCUE_FILE_NAME = "_AnonkTestee01.class";
private static final String RESCUE_FILE_NAME = "_HiddenkTestee01.class";
private static final String HUNG_CLASS_FILE_NAME = "hang.class";

@Option(name = "iterations", default_value = "100000",
@@ -100,7 +100,7 @@ public abstract class StressClassLoadingTest extends MlvmTest {

/**
* Sets prefix for names of the files, created by test:
* _AnonkTestee01.class and hangXX.class.
* _HiddenkTestee01.class and hangXX.class.
*
* @param p a prefix to add before file name.
* @throws java.lang.NullPointerException if p is null
@@ -27,23 +27,23 @@
* @key randomness
* @modules java.base/jdk.internal.misc
*
* @summary converted from VM Testbase vm/mlvm/anonloader/stress/byteMutation.
* @summary converted from VM Testbase vm/mlvm/hiddenloader/stress/byteMutation.
* VM Testbase keywords: [feature_mlvm, nonconcurrent]
*
* @library /vmTestbase
* /test/lib
*
* @comment build test class and indify classes
* @build vm.mlvm.anonloader.stress.byteMutation.Test
* @build vm.mlvm.hiddenloader.stress.byteMutation.Test
* @run driver vm.mlvm.share.IndifiedClassesBuilder
*
* @run main/othervm vm.mlvm.anonloader.stress.byteMutation.Test -stressIterationsFactor 100000
* @run main/othervm vm.mlvm.hiddenloader.stress.byteMutation.Test -stressIterationsFactor 100000
*/

package vm.mlvm.anonloader.stress.byteMutation;
package vm.mlvm.hiddenloader.stress.byteMutation;

import vm.mlvm.anonloader.share.AnonkTestee01;
import vm.mlvm.anonloader.share.StressClassLoadingTest;
import vm.mlvm.hiddenloader.share.HiddenkTestee01;
import vm.mlvm.hiddenloader.share.StressClassLoadingTest;
import vm.share.FileUtils;
import vm.share.options.Option;

@@ -67,7 +67,7 @@
*
*/
public class Test extends StressClassLoadingTest {
private final static Class<?> HOST_CLASS = AnonkTestee01.class;
private final static Class<?> HOST_CLASS = HiddenkTestee01.class;
private final byte[] testeeBytes;
@Option(name = "mutationCount", default_value = "3",
description = "How many bytes to mutate in a class")
@@ -76,26 +76,26 @@ public class Test extends StressClassLoadingTest {
/**
* Constructs the test.
* @throws Exception if there are any errors when
* reading {@link vm.mlvm.anonloader.share.AnonkTestee01} class bytecodes.
* reading {@link vm.mlvm.hiddenloader.share.HiddenkTestee01} class bytecodes.
*/
public Test() throws Exception {
this.testeeBytes = FileUtils.readClass(AnonkTestee01.class.getName());
this.testeeBytes = FileUtils.readClass(HiddenkTestee01.class.getName());
}

/**
* Returns {@link vm.mlvm.anonloader.share.AnonkTestee01} class to the
* Returns {@link vm.mlvm.hiddenloader.share.HiddenkTestee01} class to the
* parent.
* @return {@link vm.mlvm.anonloader.share.AnonkTestee01} class.
* @return {@link vm.mlvm.hiddenloader.share.HiddenkTestee01} class.
*/
@Override
protected Class<?> getHostClass() {
return HOST_CLASS;
}

/**
* Takes {@link vm.mlvm.anonloader.share.AnonkTestee01} class bytecodes
* Takes {@link vm.mlvm.hiddenloader.share.HiddenkTestee01} class bytecodes
* and modifies mutationCount bytes setting them to random values.
* @return {@link vm.mlvm.anonloader.share.AnonkTestee01} class bytecodes with modified bytes.
* @return {@link vm.mlvm.hiddenloader.share.HiddenkTestee01} class bytecodes with modified bytes.
*/
@Override
protected byte[] generateClassBytes() {
@@ -34,20 +34,20 @@
* /test/lib
*
* @comment build test class and indify classes
* @build vm.mlvm.anonloader.stress.oome.heap.Test
* @build vm.mlvm.hiddenloader.stress.oome.heap.Test
* @run driver vm.mlvm.share.IndifiedClassesBuilder
*
* @run main/othervm -XX:-UseGCOverheadLimit -Xmx128m vm.mlvm.anonloader.stress.oome.heap.Test
* @run main/othervm -XX:-UseGCOverheadLimit -Xmx128m vm.mlvm.hiddenloader.stress.oome.heap.Test
*/

package vm.mlvm.anonloader.stress.oome.heap;
package vm.mlvm.hiddenloader.stress.oome.heap;

import java.lang.invoke.MethodHandles;
import java.lang.invoke.MethodHandles.Lookup;
import java.util.List;
import java.io.IOException;

import vm.mlvm.anonloader.share.AnonkTestee01;
import vm.mlvm.hiddenloader.share.HiddenkTestee01;
import vm.mlvm.share.MlvmOOMTest;
import vm.mlvm.share.MlvmTestExecutor;
import vm.mlvm.share.Env;
@@ -71,14 +71,14 @@ protected void checkOOME(OutOfMemoryError oome) {
protected void eatMemory(List<Object> list) {
byte[] classBytes = null;
try {
classBytes = FileUtils.readClass(AnonkTestee01.class.getName());
classBytes = FileUtils.readClass(HiddenkTestee01.class.getName());
} catch (IOException e) {
Env.throwAsUncheckedException(e);
}
try {
while (true) {
Lookup lookup = MethodHandles.lookup();
Lookup ank_lookup = MethodHandles.privateLookupIn(AnonkTestee01.class, lookup);
Lookup ank_lookup = MethodHandles.privateLookupIn(HiddenkTestee01.class, lookup);
Class<?> c = ank_lookup.defineHiddenClass(classBytes, true).lookupClass();
list.add(c.newInstance());
}
@@ -33,21 +33,21 @@
* /test/lib
*
* @comment build test class and indify classes
* @build vm.mlvm.anonloader.stress.oome.metaspace.Test
* @build vm.mlvm.hiddenloader.stress.oome.metaspace.Test
* @run driver vm.mlvm.share.IndifiedClassesBuilder
*
* @run main/othervm -XX:MaxRAMPercentage=25 -XX:-UseGCOverheadLimit -XX:MetaspaceSize=10m
* -XX:MaxMetaspaceSize=20m vm.mlvm.anonloader.stress.oome.metaspace.Test
* -XX:MaxMetaspaceSize=20m vm.mlvm.hiddenloader.stress.oome.metaspace.Test
*/

package vm.mlvm.anonloader.stress.oome.metaspace;
package vm.mlvm.hiddenloader.stress.oome.metaspace;

import java.lang.invoke.MethodHandles;
import java.lang.invoke.MethodHandles.Lookup;
import java.util.List;
import java.io.IOException;

import vm.mlvm.anonloader.share.AnonkTestee01;
import vm.mlvm.hiddenloader.share.HiddenkTestee01;
import vm.mlvm.share.MlvmOOMTest;
import vm.mlvm.share.MlvmTestExecutor;
import vm.mlvm.share.Env;
@@ -71,14 +71,14 @@ protected void checkOOME(OutOfMemoryError oome) {
protected void eatMemory(List<Object> list) {
byte[] classBytes = null;
try {
classBytes = FileUtils.readClass(AnonkTestee01.class.getName());
classBytes = FileUtils.readClass(HiddenkTestee01.class.getName());
} catch (IOException e) {
Env.throwAsUncheckedException(e);
}
try {
while (true) {
Lookup lookup = MethodHandles.lookup();
Lookup ank_lookup = MethodHandles.privateLookupIn(AnonkTestee01.class, lookup);
Lookup ank_lookup = MethodHandles.privateLookupIn(HiddenkTestee01.class, lookup);
Class<?> c = ank_lookup.defineHiddenClass(classBytes, true).lookupClass();
list.add(c.newInstance());
}
@@ -33,22 +33,22 @@
* /test/lib
*
* @comment build test class and indify classes
* @build vm.mlvm.anonloader.stress.parallelLoad.Test
* @build vm.mlvm.hiddenloader.stress.parallelLoad.Test
* @run driver vm.mlvm.share.IndifiedClassesBuilder
*
* @run main/othervm
* -Xverify:all
* vm.mlvm.anonloader.stress.parallelLoad.Test
* vm.mlvm.hiddenloader.stress.parallelLoad.Test
* -threadsPerCpu 4
* -threadsExtra 20
* -parseTimeout 0
* -hiddenLoad true
*/

package vm.mlvm.anonloader.stress.parallelLoad;
package vm.mlvm.hiddenloader.stress.parallelLoad;

import vm.mlvm.anonloader.share.StressClassLoadingTest;
import vm.mlvm.anonloader.share.AnonkTestee01;
import vm.mlvm.hiddenloader.share.StressClassLoadingTest;
import vm.mlvm.hiddenloader.share.HiddenkTestee01;
import vm.mlvm.share.MlvmTestExecutor;
import vm.mlvm.share.MultiThreadedTest;
import vm.share.FileUtils;
@@ -60,7 +60,7 @@
*
*/
public class Test extends MultiThreadedTest {
private static final Class<?> HOST_CLASS = AnonkTestee01.class;
private static final Class<?> HOST_CLASS = HiddenkTestee01.class;
private static final String NAME_PREFIX = "thread%03d";

private final byte[] classBytes;
@@ -89,7 +89,7 @@ public Test() throws Exception {

/**
* Constructs a sub-test class and runs it. The sub-test class loads
* {@link vm.mlvm.anonloader.share.AnonkTestee01} class bytecodes
* {@link vm.mlvm.hiddenloader.share.HiddenkTestee01} class bytecodes
* using {@link java.lang.invoke.MethodHandles.Lookup#defineHiddenClass}
* @param numThread Number of the thread
* @throws Exception if there any exceptions thrown in the sub-test
@@ -34,16 +34,16 @@
* /test/lib
*
* @comment build test class and indify classes
* @build vm.mlvm.anonloader.stress.randomBytecodes.Test
* @build vm.mlvm.hiddenloader.stress.randomBytecodes.Test
* @run driver vm.mlvm.share.IndifiedClassesBuilder
*
* @run main/othervm vm.mlvm.anonloader.stress.randomBytecodes.Test -stressIterationsFactor 100000
* @run main/othervm vm.mlvm.hiddenloader.stress.randomBytecodes.Test -stressIterationsFactor 100000
*/

package vm.mlvm.anonloader.stress.randomBytecodes;
package vm.mlvm.hiddenloader.stress.randomBytecodes;

import java.util.Arrays;
import vm.mlvm.anonloader.share.StressClassLoadingTest;
import vm.mlvm.hiddenloader.share.StressClassLoadingTest;

/**
* The test does the following in a cycle:
@@ -72,9 +72,9 @@ public class Test extends StressClassLoadingTest {
};

/**
* Returns {@link vm.mlvm.anonloader.share.AnonkTestee01} class to the
* Returns {@link vm.mlvm.hiddenloader.share.HiddenkTestee01} class to the
* parent.
* @return {@link vm.mlvm.anonloader.share.AnonkTestee01} class.
* @return {@link vm.mlvm.hiddenloader.share.HiddenkTestee01} class.
*/
@Override
protected Class<?> getHostClass() {

1 comment on commit d4d3348

@openjdk-notifier
Copy link

@openjdk-notifier openjdk-notifier bot commented on d4d3348 Mar 14, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.