15 * You should have received a copy of the GNU General Public License version
16 * 2 along with this work; if not, write to the Free Software Foundation,
17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
18 *
19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
20 * or visit www.oracle.com if you need additional information or have any
21 * questions.
22 */
23
24 import sun.hotspot.WhiteBox;
25
26 import java.lang.reflect.Method;
27 import java.net.URL;
28 import java.net.URLClassLoader;
29
30 /*
31 * @test MethodUnloadingTest
32 * @bug 8029443
33 * @summary "Tests the unloading of methods to to class unloading"
34 * @library /testlibrary /../../test/lib
35 * @build TestMethodUnloading
36 * @build WorkerClass
37 * @run main ClassFileInstaller sun.hotspot.WhiteBox
38 * sun.hotspot.WhiteBox$WhiteBoxPermission
39 * @run main/othervm -Xbootclasspath/a:. -XX:+IgnoreUnrecognizedVMOptions -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI -XX:-BackgroundCompilation -XX:-UseCompressedOops -XX:CompileOnly=TestMethodUnloading::doWork TestMethodUnloading
40 */
41 public class TestMethodUnloading {
42 private static final String workerClassName = "WorkerClass";
43 private static int work = -1;
44
45 private static final WhiteBox WHITE_BOX = WhiteBox.getWhiteBox();
46 private static int COMP_LEVEL_SIMPLE = 1;
47 private static int COMP_LEVEL_FULL_OPTIMIZATION = 4;
48
49 /**
50 * Does some work by either using the workerClass or locally producing values.
51 * @param workerClass Class performing some work (will be unloaded)
52 * @param useWorker If true the workerClass is used
53 */
54 static private void doWork(Class<?> workerClass, boolean useWorker) throws InstantiationException, IllegalAccessException {
55 if (useWorker) {
|
15 * You should have received a copy of the GNU General Public License version
16 * 2 along with this work; if not, write to the Free Software Foundation,
17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
18 *
19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
20 * or visit www.oracle.com if you need additional information or have any
21 * questions.
22 */
23
24 import sun.hotspot.WhiteBox;
25
26 import java.lang.reflect.Method;
27 import java.net.URL;
28 import java.net.URLClassLoader;
29
30 /*
31 * @test MethodUnloadingTest
32 * @bug 8029443
33 * @summary "Tests the unloading of methods to to class unloading"
34 * @library /testlibrary /../../test/lib
35 * @build com.oracle.java.testlibrary.* TestMethodUnloading
36 * @build WorkerClass
37 * @run main ClassFileInstaller sun.hotspot.WhiteBox
38 * sun.hotspot.WhiteBox$WhiteBoxPermission
39 * @run main/othervm -Xbootclasspath/a:. -XX:+IgnoreUnrecognizedVMOptions -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI -XX:-BackgroundCompilation -XX:-UseCompressedOops -XX:CompileOnly=TestMethodUnloading::doWork TestMethodUnloading
40 */
41 public class TestMethodUnloading {
42 private static final String workerClassName = "WorkerClass";
43 private static int work = -1;
44
45 private static final WhiteBox WHITE_BOX = WhiteBox.getWhiteBox();
46 private static int COMP_LEVEL_SIMPLE = 1;
47 private static int COMP_LEVEL_FULL_OPTIMIZATION = 4;
48
49 /**
50 * Does some work by either using the workerClass or locally producing values.
51 * @param workerClass Class performing some work (will be unloaded)
52 * @param useWorker If true the workerClass is used
53 */
54 static private void doWork(Class<?> workerClass, boolean useWorker) throws InstantiationException, IllegalAccessException {
55 if (useWorker) {
|