8199370: [TESTBUG] Open source vm testbase GC tests
Reviewed-by: erikj, ihse, ehelin
diff --git a/test/hotspot/jtreg/vmTestbase/gc/g1/unloading/ClassNNN.java.template b/test/hotspot/jtreg/vmTestbase/gc/g1/unloading/ClassNNN.java.template
new file mode 100644
index 0000000..6e74d6a
--- /dev/null
+++ b/test/hotspot/jtreg/vmTestbase/gc/g1/unloading/ClassNNN.java.template
@@ -0,0 +1,1030 @@
+#
+# Copyright (c) 2014, 2018, Oracle and/or its affiliates. All rights reserved.
+# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+#
+# This code is free software; you can redistribute it and/or modify it
+# 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.
+#
+# Template to produce a ton of similar classes
+#
+package gc.g1.unloading.rootSetHelper.classesPool;
+
+public class Class_NNN_ {
+ public static java.lang.Object staticField;
+ public static java.lang.Object staticField1;
+ public static java.lang.Object staticField2;
+ public static java.lang.Object staticField3;
+ public static java.lang.Object staticField4;
+ public static java.lang.Object staticField5;
+ public static java.lang.Object staticField6;
+ public static java.lang.Object staticField7;
+ public static java.lang.Object staticField8;
+ public static java.lang.Object staticField9;
+ public static java.lang.Object staticField10;
+ public static java.lang.Object staticField11;
+ public static java.lang.Object staticField12;
+ public static java.lang.Object staticField13;
+ public static java.lang.Object staticField14;
+ public static java.lang.Object staticField15;
+ public static java.lang.Object staticField16;
+ public static java.lang.Object staticField17;
+ public static java.lang.Object staticField18;
+ public static java.lang.Object staticField19;
+ public static java.lang.Object staticField20;
+ public static java.lang.Object staticField21;
+ public static java.lang.Object staticField22;
+ public static java.lang.Object staticField23;
+ public static java.lang.Object staticField24;
+ public static java.lang.Object staticField25;
+ public static java.lang.Object staticField26;
+ public static java.lang.Object staticField27;
+ public static java.lang.Object staticField28;
+ public static java.lang.Object staticField29;
+ public static java.lang.Object staticField30;
+ public static java.lang.Object staticField31;
+ public static java.lang.Object staticField32;
+ public static java.lang.Object staticField33;
+ public static java.lang.Object staticField34;
+ public static java.lang.Object staticField35;
+ public static java.lang.Object staticField36;
+ public static java.lang.Object staticField37;
+ public static java.lang.Object staticField38;
+ public static java.lang.Object staticField39;
+ public static java.lang.Object staticField40;
+ public static java.lang.Object staticField41;
+ public static java.lang.Object staticField42;
+ public static java.lang.Object staticField43;
+ public static java.lang.Object staticField44;
+ public static java.lang.Object staticField45;
+ public static java.lang.Object staticField46;
+ public static java.lang.Object staticField47;
+ public static java.lang.Object staticField48;
+ public static java.lang.Object staticField49;
+ public static java.lang.Object staticField50;
+ public static java.lang.Object staticField51;
+ public static java.lang.Object staticField52;
+ public static java.lang.Object staticField53;
+ public static java.lang.Object staticField54;
+ public static java.lang.Object staticField55;
+ public static java.lang.Object staticField56;
+ public static java.lang.Object staticField57;
+ public static java.lang.Object staticField58;
+ public static java.lang.Object staticField59;
+ public static java.lang.Object staticField60;
+ public static java.lang.Object staticField61;
+ public static java.lang.Object staticField62;
+ public static java.lang.Object staticField63;
+ public static java.lang.Object staticField64;
+ public static java.lang.Object staticField65;
+ public static java.lang.Object staticField66;
+ public static java.lang.Object staticField67;
+ public static java.lang.Object staticField68;
+ public static java.lang.Object staticField69;
+ public static java.lang.Object staticField70;
+ public static java.lang.Object staticField71;
+ public static java.lang.Object staticField72;
+ public static java.lang.Object staticField73;
+ public static java.lang.Object staticField74;
+ public static java.lang.Object staticField75;
+ public static java.lang.Object staticField76;
+ public static java.lang.Object staticField77;
+ public static java.lang.Object staticField78;
+ public static java.lang.Object staticField79;
+ public static java.lang.Object staticField80;
+ public static java.lang.Object staticField81;
+ public static java.lang.Object staticField82;
+ public static java.lang.Object staticField83;
+ public static java.lang.Object staticField84;
+ public static java.lang.Object staticField85;
+ public static java.lang.Object staticField86;
+ public static java.lang.Object staticField87;
+ public static java.lang.Object staticField88;
+ public static java.lang.Object staticField89;
+ public static java.lang.Object staticField90;
+ public static java.lang.Object staticField91;
+ public static java.lang.Object staticField92;
+ public static java.lang.Object staticField93;
+ public static java.lang.Object staticField94;
+ public static java.lang.Object staticField95;
+ public static java.lang.Object staticField96;
+ public static java.lang.Object staticField97;
+ public static java.lang.Object staticField98;
+ public static java.lang.Object staticField99;
+ public static java.lang.Object staticField100;
+ public static java.lang.Object staticField101;
+ public static java.lang.Object staticField102;
+ public static java.lang.Object staticField103;
+ public static java.lang.Object staticField104;
+ public static java.lang.Object staticField105;
+ public static java.lang.Object staticField106;
+ public static java.lang.Object staticField107;
+ public static java.lang.Object staticField108;
+ public static java.lang.Object staticField109;
+ public static java.lang.Object staticField110;
+ public static java.lang.Object staticField111;
+ public static java.lang.Object staticField112;
+ public static java.lang.Object staticField113;
+ public static java.lang.Object staticField114;
+ public static java.lang.Object staticField115;
+ public static java.lang.Object staticField116;
+ public static java.lang.Object staticField117;
+ public static java.lang.Object staticField118;
+ public static java.lang.Object staticField119;
+ public static java.lang.Object staticField120;
+ public static java.lang.Object staticField121;
+ public static java.lang.Object staticField122;
+ public static java.lang.Object staticField123;
+ public static java.lang.Object staticField124;
+ public static java.lang.Object staticField125;
+ public static java.lang.Object staticField126;
+ public static java.lang.Object staticField127;
+ public static java.lang.Object staticField128;
+ public static java.lang.Object staticField129;
+ public static java.lang.Object staticField130;
+ public static java.lang.Object staticField131;
+ public static java.lang.Object staticField132;
+ public static java.lang.Object staticField133;
+ public static java.lang.Object staticField134;
+ public static java.lang.Object staticField135;
+ public static java.lang.Object staticField136;
+ public static java.lang.Object staticField137;
+ public static java.lang.Object staticField138;
+ public static java.lang.Object staticField139;
+ public static java.lang.Object staticField140;
+ public static java.lang.Object staticField141;
+ public static java.lang.Object staticField142;
+ public static java.lang.Object staticField143;
+ public static java.lang.Object staticField144;
+ public static java.lang.Object staticField145;
+ public static java.lang.Object staticField146;
+ public static java.lang.Object staticField147;
+ public static java.lang.Object staticField148;
+ public static java.lang.Object staticField149;
+ public static java.lang.Object staticField150;
+ public static java.lang.Object staticField151;
+ public static java.lang.Object staticField152;
+ public static java.lang.Object staticField153;
+ public static java.lang.Object staticField154;
+ public static java.lang.Object staticField155;
+ public static java.lang.Object staticField156;
+ public static java.lang.Object staticField157;
+ public static java.lang.Object staticField158;
+ public static java.lang.Object staticField159;
+ public static java.lang.Object staticField160;
+ public static java.lang.Object staticField161;
+ public static java.lang.Object staticField162;
+ public static java.lang.Object staticField163;
+ public static java.lang.Object staticField164;
+ public static java.lang.Object staticField165;
+ public static java.lang.Object staticField166;
+ public static java.lang.Object staticField167;
+ public static java.lang.Object staticField168;
+ public static java.lang.Object staticField169;
+ public static java.lang.Object staticField170;
+ public static java.lang.Object staticField171;
+ public static java.lang.Object staticField172;
+ public static java.lang.Object staticField173;
+ public static java.lang.Object staticField174;
+ public static java.lang.Object staticField175;
+ public static java.lang.Object staticField176;
+ public static java.lang.Object staticField177;
+ public static java.lang.Object staticField178;
+ public static java.lang.Object staticField179;
+ public static java.lang.Object staticField180;
+ public static java.lang.Object staticField181;
+ public static java.lang.Object staticField182;
+ public static java.lang.Object staticField183;
+ public static java.lang.Object staticField184;
+ public static java.lang.Object staticField185;
+ public static java.lang.Object staticField186;
+ public static java.lang.Object staticField187;
+ public static java.lang.Object staticField188;
+ public static java.lang.Object staticField189;
+ public static java.lang.Object staticField190;
+ public static java.lang.Object staticField191;
+ public static java.lang.Object staticField192;
+ public static java.lang.Object staticField193;
+ public static java.lang.Object staticField194;
+ public static java.lang.Object staticField195;
+ public static java.lang.Object staticField196;
+ public static java.lang.Object staticField197;
+ public static java.lang.Object staticField198;
+ public static java.lang.Object staticField199;
+ public static java.lang.Object staticField200;
+ public static java.lang.Object staticField201;
+ public static java.lang.Object staticField202;
+ public static java.lang.Object staticField203;
+ public static java.lang.Object staticField204;
+ public static java.lang.Object staticField205;
+ public static java.lang.Object staticField206;
+ public static java.lang.Object staticField207;
+ public static java.lang.Object staticField208;
+ public static java.lang.Object staticField209;
+ public static java.lang.Object staticField210;
+ public static java.lang.Object staticField211;
+ public static java.lang.Object staticField212;
+ public static java.lang.Object staticField213;
+ public static java.lang.Object staticField214;
+ public static java.lang.Object staticField215;
+ public static java.lang.Object staticField216;
+ public static java.lang.Object staticField217;
+ public static java.lang.Object staticField218;
+ public static java.lang.Object staticField219;
+ public static java.lang.Object staticField220;
+ public static java.lang.Object staticField221;
+ public static java.lang.Object staticField222;
+ public static java.lang.Object staticField223;
+ public static java.lang.Object staticField224;
+ public static java.lang.Object staticField225;
+ public static java.lang.Object staticField226;
+ public static java.lang.Object staticField227;
+ public static java.lang.Object staticField228;
+ public static java.lang.Object staticField229;
+ public static java.lang.Object staticField230;
+ public static java.lang.Object staticField231;
+ public static java.lang.Object staticField232;
+ public static java.lang.Object staticField233;
+ public static java.lang.Object staticField234;
+ public static java.lang.Object staticField235;
+ public static java.lang.Object staticField236;
+ public static java.lang.Object staticField237;
+ public static java.lang.Object staticField238;
+ public static java.lang.Object staticField239;
+ public static java.lang.Object staticField240;
+ public static java.lang.Object staticField241;
+ public static java.lang.Object staticField242;
+ public static java.lang.Object staticField243;
+ public static java.lang.Object staticField244;
+ public static java.lang.Object staticField245;
+ public static java.lang.Object staticField246;
+ public static java.lang.Object staticField247;
+ public static java.lang.Object staticField248;
+ public static java.lang.Object staticField249;
+ public static java.lang.Object staticField250;
+ public static java.lang.Object staticField251;
+ public static java.lang.Object staticField252;
+ public static java.lang.Object staticField253;
+ public static java.lang.Object staticField254;
+ public static java.lang.Object staticField255;
+ public static java.lang.Object staticField256;
+ public static java.lang.Object staticField257;
+ public static java.lang.Object staticField258;
+ public static java.lang.Object staticField259;
+ public static java.lang.Object staticField260;
+ public static java.lang.Object staticField261;
+ public static java.lang.Object staticField262;
+ public static java.lang.Object staticField263;
+ public static java.lang.Object staticField264;
+ public static java.lang.Object staticField265;
+ public static java.lang.Object staticField266;
+ public static java.lang.Object staticField267;
+ public static java.lang.Object staticField268;
+ public static java.lang.Object staticField269;
+ public static java.lang.Object staticField270;
+ public static java.lang.Object staticField271;
+ public static java.lang.Object staticField272;
+ public static java.lang.Object staticField273;
+ public static java.lang.Object staticField274;
+ public static java.lang.Object staticField275;
+ public static java.lang.Object staticField276;
+ public static java.lang.Object staticField277;
+ public static java.lang.Object staticField278;
+ public static java.lang.Object staticField279;
+ public static java.lang.Object staticField280;
+ public static java.lang.Object staticField281;
+ public static java.lang.Object staticField282;
+ public static java.lang.Object staticField283;
+ public static java.lang.Object staticField284;
+ public static java.lang.Object staticField285;
+ public static java.lang.Object staticField286;
+ public static java.lang.Object staticField287;
+ public static java.lang.Object staticField288;
+ public static java.lang.Object staticField289;
+ public static java.lang.Object staticField290;
+ public static java.lang.Object staticField291;
+ public static java.lang.Object staticField292;
+ public static java.lang.Object staticField293;
+ public static java.lang.Object staticField294;
+ public static java.lang.Object staticField295;
+ public static java.lang.Object staticField296;
+ public static java.lang.Object staticField297;
+ public static java.lang.Object staticField298;
+ public static java.lang.Object staticField299;
+ public static java.lang.Object staticField300;
+ public static java.lang.Object staticField301;
+ public static java.lang.Object staticField302;
+ public static java.lang.Object staticField303;
+ public static java.lang.Object staticField304;
+ public static java.lang.Object staticField305;
+ public static java.lang.Object staticField306;
+ public static java.lang.Object staticField307;
+ public static java.lang.Object staticField308;
+ public static java.lang.Object staticField309;
+ public static java.lang.Object staticField310;
+ public static java.lang.Object staticField311;
+ public static java.lang.Object staticField312;
+ public static java.lang.Object staticField313;
+ public static java.lang.Object staticField314;
+ public static java.lang.Object staticField315;
+ public static java.lang.Object staticField316;
+ public static java.lang.Object staticField317;
+ public static java.lang.Object staticField318;
+ public static java.lang.Object staticField319;
+ public static java.lang.Object staticField320;
+ public static java.lang.Object staticField321;
+ public static java.lang.Object staticField322;
+ public static java.lang.Object staticField323;
+ public static java.lang.Object staticField324;
+ public static java.lang.Object staticField325;
+ public static java.lang.Object staticField326;
+ public static java.lang.Object staticField327;
+ public static java.lang.Object staticField328;
+ public static java.lang.Object staticField329;
+ public static java.lang.Object staticField330;
+ public static java.lang.Object staticField331;
+ public static java.lang.Object staticField332;
+ public static java.lang.Object staticField333;
+ public static java.lang.Object staticField334;
+ public static java.lang.Object staticField335;
+ public static java.lang.Object staticField336;
+ public static java.lang.Object staticField337;
+ public static java.lang.Object staticField338;
+ public static java.lang.Object staticField339;
+ public static java.lang.Object staticField340;
+ public static java.lang.Object staticField341;
+ public static java.lang.Object staticField342;
+ public static java.lang.Object staticField343;
+ public static java.lang.Object staticField344;
+ public static java.lang.Object staticField345;
+ public static java.lang.Object staticField346;
+ public static java.lang.Object staticField347;
+ public static java.lang.Object staticField348;
+ public static java.lang.Object staticField349;
+ public static java.lang.Object staticField350;
+ public static java.lang.Object staticField351;
+ public static java.lang.Object staticField352;
+ public static java.lang.Object staticField353;
+ public static java.lang.Object staticField354;
+ public static java.lang.Object staticField355;
+ public static java.lang.Object staticField356;
+ public static java.lang.Object staticField357;
+ public static java.lang.Object staticField358;
+ public static java.lang.Object staticField359;
+ public static java.lang.Object staticField360;
+ public static java.lang.Object staticField361;
+ public static java.lang.Object staticField362;
+ public static java.lang.Object staticField363;
+ public static java.lang.Object staticField364;
+ public static java.lang.Object staticField365;
+ public static java.lang.Object staticField366;
+ public static java.lang.Object staticField367;
+ public static java.lang.Object staticField368;
+ public static java.lang.Object staticField369;
+ public static java.lang.Object staticField370;
+ public static java.lang.Object staticField371;
+ public static java.lang.Object staticField372;
+ public static java.lang.Object staticField373;
+ public static java.lang.Object staticField374;
+ public static java.lang.Object staticField375;
+ public static java.lang.Object staticField376;
+ public static java.lang.Object staticField377;
+ public static java.lang.Object staticField378;
+ public static java.lang.Object staticField379;
+ public static java.lang.Object staticField380;
+ public static java.lang.Object staticField381;
+ public static java.lang.Object staticField382;
+ public static java.lang.Object staticField383;
+ public static java.lang.Object staticField384;
+ public static java.lang.Object staticField385;
+ public static java.lang.Object staticField386;
+ public static java.lang.Object staticField387;
+ public static java.lang.Object staticField388;
+ public static java.lang.Object staticField389;
+ public static java.lang.Object staticField390;
+ public static java.lang.Object staticField391;
+ public static java.lang.Object staticField392;
+ public static java.lang.Object staticField393;
+ public static java.lang.Object staticField394;
+ public static java.lang.Object staticField395;
+ public static java.lang.Object staticField396;
+ public static java.lang.Object staticField397;
+ public static java.lang.Object staticField398;
+ public static java.lang.Object staticField399;
+ public static java.lang.Object staticField400;
+ public static java.lang.Object staticField401;
+ public static java.lang.Object staticField402;
+ public static java.lang.Object staticField403;
+ public static java.lang.Object staticField404;
+ public static java.lang.Object staticField405;
+ public static java.lang.Object staticField406;
+ public static java.lang.Object staticField407;
+ public static java.lang.Object staticField408;
+ public static java.lang.Object staticField409;
+ public static java.lang.Object staticField410;
+ public static java.lang.Object staticField411;
+ public static java.lang.Object staticField412;
+ public static java.lang.Object staticField413;
+ public static java.lang.Object staticField414;
+ public static java.lang.Object staticField415;
+ public static java.lang.Object staticField416;
+ public static java.lang.Object staticField417;
+ public static java.lang.Object staticField418;
+ public static java.lang.Object staticField419;
+ public static java.lang.Object staticField420;
+ public static java.lang.Object staticField421;
+ public static java.lang.Object staticField422;
+ public static java.lang.Object staticField423;
+ public static java.lang.Object staticField424;
+ public static java.lang.Object staticField425;
+ public static java.lang.Object staticField426;
+ public static java.lang.Object staticField427;
+ public static java.lang.Object staticField428;
+ public static java.lang.Object staticField429;
+ public static java.lang.Object staticField430;
+ public static java.lang.Object staticField431;
+ public static java.lang.Object staticField432;
+ public static java.lang.Object staticField433;
+ public static java.lang.Object staticField434;
+ public static java.lang.Object staticField435;
+ public static java.lang.Object staticField436;
+ public static java.lang.Object staticField437;
+ public static java.lang.Object staticField438;
+ public static java.lang.Object staticField439;
+ public static java.lang.Object staticField440;
+ public static java.lang.Object staticField441;
+ public static java.lang.Object staticField442;
+ public static java.lang.Object staticField443;
+ public static java.lang.Object staticField444;
+ public static java.lang.Object staticField445;
+ public static java.lang.Object staticField446;
+ public static java.lang.Object staticField447;
+ public static java.lang.Object staticField448;
+ public static java.lang.Object staticField449;
+ public static java.lang.Object staticField450;
+ public static java.lang.Object staticField451;
+ public static java.lang.Object staticField452;
+ public static java.lang.Object staticField453;
+ public static java.lang.Object staticField454;
+ public static java.lang.Object staticField455;
+ public static java.lang.Object staticField456;
+ public static java.lang.Object staticField457;
+ public static java.lang.Object staticField458;
+ public static java.lang.Object staticField459;
+ public static java.lang.Object staticField460;
+ public static java.lang.Object staticField461;
+ public static java.lang.Object staticField462;
+ public static java.lang.Object staticField463;
+ public static java.lang.Object staticField464;
+ public static java.lang.Object staticField465;
+ public static java.lang.Object staticField466;
+ public static java.lang.Object staticField467;
+ public static java.lang.Object staticField468;
+ public static java.lang.Object staticField469;
+ public static java.lang.Object staticField470;
+ public static java.lang.Object staticField471;
+ public static java.lang.Object staticField472;
+ public static java.lang.Object staticField473;
+ public static java.lang.Object staticField474;
+ public static java.lang.Object staticField475;
+ public static java.lang.Object staticField476;
+ public static java.lang.Object staticField477;
+ public static java.lang.Object staticField478;
+ public static java.lang.Object staticField479;
+ public static java.lang.Object staticField480;
+ public static java.lang.Object staticField481;
+ public static java.lang.Object staticField482;
+ public static java.lang.Object staticField483;
+ public static java.lang.Object staticField484;
+ public static java.lang.Object staticField485;
+ public static java.lang.Object staticField486;
+ public static java.lang.Object staticField487;
+ public static java.lang.Object staticField488;
+ public static java.lang.Object staticField489;
+ public static java.lang.Object staticField490;
+ public static java.lang.Object staticField491;
+ public static java.lang.Object staticField492;
+ public static java.lang.Object staticField493;
+ public static java.lang.Object staticField494;
+ public static java.lang.Object staticField495;
+ public static java.lang.Object staticField496;
+ public static java.lang.Object staticField497;
+ public static java.lang.Object staticField498;
+ public static java.lang.Object staticField499;
+ public static java.lang.Object staticField500;
+ public static java.lang.Object staticField501;
+ public static java.lang.Object staticField502;
+ public static java.lang.Object staticField503;
+ public static java.lang.Object staticField504;
+ public static java.lang.Object staticField505;
+ public static java.lang.Object staticField506;
+ public static java.lang.Object staticField507;
+ public static java.lang.Object staticField508;
+ public static java.lang.Object staticField509;
+ public static java.lang.Object staticField510;
+ public static java.lang.Object staticField511;
+ public static java.lang.Object staticField512;
+ public static java.lang.Object staticField513;
+ public static java.lang.Object staticField514;
+ public static java.lang.Object staticField515;
+ public static java.lang.Object staticField516;
+ public static java.lang.Object staticField517;
+ public static java.lang.Object staticField518;
+ public static java.lang.Object staticField519;
+ public static java.lang.Object staticField520;
+ public static java.lang.Object staticField521;
+ public static java.lang.Object staticField522;
+ public static java.lang.Object staticField523;
+ public static java.lang.Object staticField524;
+ public static java.lang.Object staticField525;
+ public static java.lang.Object staticField526;
+ public static java.lang.Object staticField527;
+ public static java.lang.Object staticField528;
+ public static java.lang.Object staticField529;
+ public static java.lang.Object staticField530;
+ public static java.lang.Object staticField531;
+ public static java.lang.Object staticField532;
+ public static java.lang.Object staticField533;
+ public static java.lang.Object staticField534;
+ public static java.lang.Object staticField535;
+ public static java.lang.Object staticField536;
+ public static java.lang.Object staticField537;
+ public static java.lang.Object staticField538;
+ public static java.lang.Object staticField539;
+ public static java.lang.Object staticField540;
+ public static java.lang.Object staticField541;
+ public static java.lang.Object staticField542;
+ public static java.lang.Object staticField543;
+ public static java.lang.Object staticField544;
+ public static java.lang.Object staticField545;
+ public static java.lang.Object staticField546;
+ public static java.lang.Object staticField547;
+ public static java.lang.Object staticField548;
+ public static java.lang.Object staticField549;
+ public static java.lang.Object staticField550;
+ public static java.lang.Object staticField551;
+ public static java.lang.Object staticField552;
+ public static java.lang.Object staticField553;
+ public static java.lang.Object staticField554;
+ public static java.lang.Object staticField555;
+ public static java.lang.Object staticField556;
+ public static java.lang.Object staticField557;
+ public static java.lang.Object staticField558;
+ public static java.lang.Object staticField559;
+ public static java.lang.Object staticField560;
+ public static java.lang.Object staticField561;
+ public static java.lang.Object staticField562;
+ public static java.lang.Object staticField563;
+ public static java.lang.Object staticField564;
+ public static java.lang.Object staticField565;
+ public static java.lang.Object staticField566;
+ public static java.lang.Object staticField567;
+ public static java.lang.Object staticField568;
+ public static java.lang.Object staticField569;
+ public static java.lang.Object staticField570;
+ public static java.lang.Object staticField571;
+ public static java.lang.Object staticField572;
+ public static java.lang.Object staticField573;
+ public static java.lang.Object staticField574;
+ public static java.lang.Object staticField575;
+ public static java.lang.Object staticField576;
+ public static java.lang.Object staticField577;
+ public static java.lang.Object staticField578;
+ public static java.lang.Object staticField579;
+ public static java.lang.Object staticField580;
+ public static java.lang.Object staticField581;
+ public static java.lang.Object staticField582;
+ public static java.lang.Object staticField583;
+ public static java.lang.Object staticField584;
+ public static java.lang.Object staticField585;
+ public static java.lang.Object staticField586;
+ public static java.lang.Object staticField587;
+ public static java.lang.Object staticField588;
+ public static java.lang.Object staticField589;
+ public static java.lang.Object staticField590;
+ public static java.lang.Object staticField591;
+ public static java.lang.Object staticField592;
+ public static java.lang.Object staticField593;
+ public static java.lang.Object staticField594;
+ public static java.lang.Object staticField595;
+ public static java.lang.Object staticField596;
+ public static java.lang.Object staticField597;
+ public static java.lang.Object staticField598;
+ public static java.lang.Object staticField599;
+ public static java.lang.Object staticField600;
+ public static java.lang.Object staticField601;
+ public static java.lang.Object staticField602;
+ public static java.lang.Object staticField603;
+ public static java.lang.Object staticField604;
+ public static java.lang.Object staticField605;
+ public static java.lang.Object staticField606;
+ public static java.lang.Object staticField607;
+ public static java.lang.Object staticField608;
+ public static java.lang.Object staticField609;
+ public static java.lang.Object staticField610;
+ public static java.lang.Object staticField611;
+ public static java.lang.Object staticField612;
+ public static java.lang.Object staticField613;
+ public static java.lang.Object staticField614;
+ public static java.lang.Object staticField615;
+ public static java.lang.Object staticField616;
+ public static java.lang.Object staticField617;
+ public static java.lang.Object staticField618;
+ public static java.lang.Object staticField619;
+ public static java.lang.Object staticField620;
+ public static java.lang.Object staticField621;
+ public static java.lang.Object staticField622;
+ public static java.lang.Object staticField623;
+ public static java.lang.Object staticField624;
+ public static java.lang.Object staticField625;
+ public static java.lang.Object staticField626;
+ public static java.lang.Object staticField627;
+ public static java.lang.Object staticField628;
+ public static java.lang.Object staticField629;
+ public static java.lang.Object staticField630;
+ public static java.lang.Object staticField631;
+ public static java.lang.Object staticField632;
+ public static java.lang.Object staticField633;
+ public static java.lang.Object staticField634;
+ public static java.lang.Object staticField635;
+ public static java.lang.Object staticField636;
+ public static java.lang.Object staticField637;
+ public static java.lang.Object staticField638;
+ public static java.lang.Object staticField639;
+ public static java.lang.Object staticField640;
+ public static java.lang.Object staticField641;
+ public static java.lang.Object staticField642;
+ public static java.lang.Object staticField643;
+ public static java.lang.Object staticField644;
+ public static java.lang.Object staticField645;
+ public static java.lang.Object staticField646;
+ public static java.lang.Object staticField647;
+ public static java.lang.Object staticField648;
+ public static java.lang.Object staticField649;
+ public static java.lang.Object staticField650;
+ public static java.lang.Object staticField651;
+ public static java.lang.Object staticField652;
+ public static java.lang.Object staticField653;
+ public static java.lang.Object staticField654;
+ public static java.lang.Object staticField655;
+ public static java.lang.Object staticField656;
+ public static java.lang.Object staticField657;
+ public static java.lang.Object staticField658;
+ public static java.lang.Object staticField659;
+ public static java.lang.Object staticField660;
+ public static java.lang.Object staticField661;
+ public static java.lang.Object staticField662;
+ public static java.lang.Object staticField663;
+ public static java.lang.Object staticField664;
+ public static java.lang.Object staticField665;
+ public static java.lang.Object staticField666;
+ public static java.lang.Object staticField667;
+ public static java.lang.Object staticField668;
+ public static java.lang.Object staticField669;
+ public static java.lang.Object staticField670;
+ public static java.lang.Object staticField671;
+ public static java.lang.Object staticField672;
+ public static java.lang.Object staticField673;
+ public static java.lang.Object staticField674;
+ public static java.lang.Object staticField675;
+ public static java.lang.Object staticField676;
+ public static java.lang.Object staticField677;
+ public static java.lang.Object staticField678;
+ public static java.lang.Object staticField679;
+ public static java.lang.Object staticField680;
+ public static java.lang.Object staticField681;
+ public static java.lang.Object staticField682;
+ public static java.lang.Object staticField683;
+ public static java.lang.Object staticField684;
+ public static java.lang.Object staticField685;
+ public static java.lang.Object staticField686;
+ public static java.lang.Object staticField687;
+ public static java.lang.Object staticField688;
+ public static java.lang.Object staticField689;
+ public static java.lang.Object staticField690;
+ public static java.lang.Object staticField691;
+ public static java.lang.Object staticField692;
+ public static java.lang.Object staticField693;
+ public static java.lang.Object staticField694;
+ public static java.lang.Object staticField695;
+ public static java.lang.Object staticField696;
+ public static java.lang.Object staticField697;
+ public static java.lang.Object staticField698;
+ public static java.lang.Object staticField699;
+ public static java.lang.Object staticField700;
+ public static java.lang.Object staticField701;
+ public static java.lang.Object staticField702;
+ public static java.lang.Object staticField703;
+ public static java.lang.Object staticField704;
+ public static java.lang.Object staticField705;
+ public static java.lang.Object staticField706;
+ public static java.lang.Object staticField707;
+ public static java.lang.Object staticField708;
+ public static java.lang.Object staticField709;
+ public static java.lang.Object staticField710;
+ public static java.lang.Object staticField711;
+ public static java.lang.Object staticField712;
+ public static java.lang.Object staticField713;
+ public static java.lang.Object staticField714;
+ public static java.lang.Object staticField715;
+ public static java.lang.Object staticField716;
+ public static java.lang.Object staticField717;
+ public static java.lang.Object staticField718;
+ public static java.lang.Object staticField719;
+ public static java.lang.Object staticField720;
+ public static java.lang.Object staticField721;
+ public static java.lang.Object staticField722;
+ public static java.lang.Object staticField723;
+ public static java.lang.Object staticField724;
+ public static java.lang.Object staticField725;
+ public static java.lang.Object staticField726;
+ public static java.lang.Object staticField727;
+ public static java.lang.Object staticField728;
+ public static java.lang.Object staticField729;
+ public static java.lang.Object staticField730;
+ public static java.lang.Object staticField731;
+ public static java.lang.Object staticField732;
+ public static java.lang.Object staticField733;
+ public static java.lang.Object staticField734;
+ public static java.lang.Object staticField735;
+ public static java.lang.Object staticField736;
+ public static java.lang.Object staticField737;
+ public static java.lang.Object staticField738;
+ public static java.lang.Object staticField739;
+ public static java.lang.Object staticField740;
+ public static java.lang.Object staticField741;
+ public static java.lang.Object staticField742;
+ public static java.lang.Object staticField743;
+ public static java.lang.Object staticField744;
+ public static java.lang.Object staticField745;
+ public static java.lang.Object staticField746;
+ public static java.lang.Object staticField747;
+ public static java.lang.Object staticField748;
+ public static java.lang.Object staticField749;
+ public static java.lang.Object staticField750;
+ public static java.lang.Object staticField751;
+ public static java.lang.Object staticField752;
+ public static java.lang.Object staticField753;
+ public static java.lang.Object staticField754;
+ public static java.lang.Object staticField755;
+ public static java.lang.Object staticField756;
+ public static java.lang.Object staticField757;
+ public static java.lang.Object staticField758;
+ public static java.lang.Object staticField759;
+ public static java.lang.Object staticField760;
+ public static java.lang.Object staticField761;
+ public static java.lang.Object staticField762;
+ public static java.lang.Object staticField763;
+ public static java.lang.Object staticField764;
+ public static java.lang.Object staticField765;
+ public static java.lang.Object staticField766;
+ public static java.lang.Object staticField767;
+ public static java.lang.Object staticField768;
+ public static java.lang.Object staticField769;
+ public static java.lang.Object staticField770;
+ public static java.lang.Object staticField771;
+ public static java.lang.Object staticField772;
+ public static java.lang.Object staticField773;
+ public static java.lang.Object staticField774;
+ public static java.lang.Object staticField775;
+ public static java.lang.Object staticField776;
+ public static java.lang.Object staticField777;
+ public static java.lang.Object staticField778;
+ public static java.lang.Object staticField779;
+ public static java.lang.Object staticField780;
+ public static java.lang.Object staticField781;
+ public static java.lang.Object staticField782;
+ public static java.lang.Object staticField783;
+ public static java.lang.Object staticField784;
+ public static java.lang.Object staticField785;
+ public static java.lang.Object staticField786;
+ public static java.lang.Object staticField787;
+ public static java.lang.Object staticField788;
+ public static java.lang.Object staticField789;
+ public static java.lang.Object staticField790;
+ public static java.lang.Object staticField791;
+ public static java.lang.Object staticField792;
+ public static java.lang.Object staticField793;
+ public static java.lang.Object staticField794;
+ public static java.lang.Object staticField795;
+ public static java.lang.Object staticField796;
+ public static java.lang.Object staticField797;
+ public static java.lang.Object staticField798;
+ public static java.lang.Object staticField799;
+ public static java.lang.Object staticField800;
+ public static java.lang.Object staticField801;
+ public static java.lang.Object staticField802;
+ public static java.lang.Object staticField803;
+ public static java.lang.Object staticField804;
+ public static java.lang.Object staticField805;
+ public static java.lang.Object staticField806;
+ public static java.lang.Object staticField807;
+ public static java.lang.Object staticField808;
+ public static java.lang.Object staticField809;
+ public static java.lang.Object staticField810;
+ public static java.lang.Object staticField811;
+ public static java.lang.Object staticField812;
+ public static java.lang.Object staticField813;
+ public static java.lang.Object staticField814;
+ public static java.lang.Object staticField815;
+ public static java.lang.Object staticField816;
+ public static java.lang.Object staticField817;
+ public static java.lang.Object staticField818;
+ public static java.lang.Object staticField819;
+ public static java.lang.Object staticField820;
+ public static java.lang.Object staticField821;
+ public static java.lang.Object staticField822;
+ public static java.lang.Object staticField823;
+ public static java.lang.Object staticField824;
+ public static java.lang.Object staticField825;
+ public static java.lang.Object staticField826;
+ public static java.lang.Object staticField827;
+ public static java.lang.Object staticField828;
+ public static java.lang.Object staticField829;
+ public static java.lang.Object staticField830;
+ public static java.lang.Object staticField831;
+ public static java.lang.Object staticField832;
+ public static java.lang.Object staticField833;
+ public static java.lang.Object staticField834;
+ public static java.lang.Object staticField835;
+ public static java.lang.Object staticField836;
+ public static java.lang.Object staticField837;
+ public static java.lang.Object staticField838;
+ public static java.lang.Object staticField839;
+ public static java.lang.Object staticField840;
+ public static java.lang.Object staticField841;
+ public static java.lang.Object staticField842;
+ public static java.lang.Object staticField843;
+ public static java.lang.Object staticField844;
+ public static java.lang.Object staticField845;
+ public static java.lang.Object staticField846;
+ public static java.lang.Object staticField847;
+ public static java.lang.Object staticField848;
+ public static java.lang.Object staticField849;
+ public static java.lang.Object staticField850;
+ public static java.lang.Object staticField851;
+ public static java.lang.Object staticField852;
+ public static java.lang.Object staticField853;
+ public static java.lang.Object staticField854;
+ public static java.lang.Object staticField855;
+ public static java.lang.Object staticField856;
+ public static java.lang.Object staticField857;
+ public static java.lang.Object staticField858;
+ public static java.lang.Object staticField859;
+ public static java.lang.Object staticField860;
+ public static java.lang.Object staticField861;
+ public static java.lang.Object staticField862;
+ public static java.lang.Object staticField863;
+ public static java.lang.Object staticField864;
+ public static java.lang.Object staticField865;
+ public static java.lang.Object staticField866;
+ public static java.lang.Object staticField867;
+ public static java.lang.Object staticField868;
+ public static java.lang.Object staticField869;
+ public static java.lang.Object staticField870;
+ public static java.lang.Object staticField871;
+ public static java.lang.Object staticField872;
+ public static java.lang.Object staticField873;
+ public static java.lang.Object staticField874;
+ public static java.lang.Object staticField875;
+ public static java.lang.Object staticField876;
+ public static java.lang.Object staticField877;
+ public static java.lang.Object staticField878;
+ public static java.lang.Object staticField879;
+ public static java.lang.Object staticField880;
+ public static java.lang.Object staticField881;
+ public static java.lang.Object staticField882;
+ public static java.lang.Object staticField883;
+ public static java.lang.Object staticField884;
+ public static java.lang.Object staticField885;
+ public static java.lang.Object staticField886;
+ public static java.lang.Object staticField887;
+ public static java.lang.Object staticField888;
+ public static java.lang.Object staticField889;
+ public static java.lang.Object staticField890;
+ public static java.lang.Object staticField891;
+ public static java.lang.Object staticField892;
+ public static java.lang.Object staticField893;
+ public static java.lang.Object staticField894;
+ public static java.lang.Object staticField895;
+ public static java.lang.Object staticField896;
+ public static java.lang.Object staticField897;
+ public static java.lang.Object staticField898;
+ public static java.lang.Object staticField899;
+ public static java.lang.Object staticField900;
+ public static java.lang.Object staticField901;
+ public static java.lang.Object staticField902;
+ public static java.lang.Object staticField903;
+ public static java.lang.Object staticField904;
+ public static java.lang.Object staticField905;
+ public static java.lang.Object staticField906;
+ public static java.lang.Object staticField907;
+ public static java.lang.Object staticField908;
+ public static java.lang.Object staticField909;
+ public static java.lang.Object staticField910;
+ public static java.lang.Object staticField911;
+ public static java.lang.Object staticField912;
+ public static java.lang.Object staticField913;
+ public static java.lang.Object staticField914;
+ public static java.lang.Object staticField915;
+ public static java.lang.Object staticField916;
+ public static java.lang.Object staticField917;
+ public static java.lang.Object staticField918;
+ public static java.lang.Object staticField919;
+ public static java.lang.Object staticField920;
+ public static java.lang.Object staticField921;
+ public static java.lang.Object staticField922;
+ public static java.lang.Object staticField923;
+ public static java.lang.Object staticField924;
+ public static java.lang.Object staticField925;
+ public static java.lang.Object staticField926;
+ public static java.lang.Object staticField927;
+ public static java.lang.Object staticField928;
+ public static java.lang.Object staticField929;
+ public static java.lang.Object staticField930;
+ public static java.lang.Object staticField931;
+ public static java.lang.Object staticField932;
+ public static java.lang.Object staticField933;
+ public static java.lang.Object staticField934;
+ public static java.lang.Object staticField935;
+ public static java.lang.Object staticField936;
+ public static java.lang.Object staticField937;
+ public static java.lang.Object staticField938;
+ public static java.lang.Object staticField939;
+ public static java.lang.Object staticField940;
+ public static java.lang.Object staticField941;
+ public static java.lang.Object staticField942;
+ public static java.lang.Object staticField943;
+ public static java.lang.Object staticField944;
+ public static java.lang.Object staticField945;
+ public static java.lang.Object staticField946;
+ public static java.lang.Object staticField947;
+ public static java.lang.Object staticField948;
+ public static java.lang.Object staticField949;
+ public static java.lang.Object staticField950;
+ public static java.lang.Object staticField951;
+ public static java.lang.Object staticField952;
+ public static java.lang.Object staticField953;
+ public static java.lang.Object staticField954;
+ public static java.lang.Object staticField955;
+ public static java.lang.Object staticField956;
+ public static java.lang.Object staticField957;
+ public static java.lang.Object staticField958;
+ public static java.lang.Object staticField959;
+ public static java.lang.Object staticField960;
+ public static java.lang.Object staticField961;
+ public static java.lang.Object staticField962;
+ public static java.lang.Object staticField963;
+ public static java.lang.Object staticField964;
+ public static java.lang.Object staticField965;
+ public static java.lang.Object staticField966;
+ public static java.lang.Object staticField967;
+ public static java.lang.Object staticField968;
+ public static java.lang.Object staticField969;
+ public static java.lang.Object staticField970;
+ public static java.lang.Object staticField971;
+ public static java.lang.Object staticField972;
+ public static java.lang.Object staticField973;
+ public static java.lang.Object staticField974;
+ public static java.lang.Object staticField975;
+ public static java.lang.Object staticField976;
+ public static java.lang.Object staticField977;
+ public static java.lang.Object staticField978;
+ public static java.lang.Object staticField979;
+ public static java.lang.Object staticField980;
+ public static java.lang.Object staticField981;
+ public static java.lang.Object staticField982;
+ public static java.lang.Object staticField983;
+ public static java.lang.Object staticField984;
+ public static java.lang.Object staticField985;
+ public static java.lang.Object staticField986;
+ public static java.lang.Object staticField987;
+ public static java.lang.Object staticField988;
+ public static java.lang.Object staticField989;
+ public static java.lang.Object staticField990;
+ public static java.lang.Object staticField991;
+ public static java.lang.Object staticField992;
+ public static java.lang.Object staticField993;
+ public static java.lang.Object staticField994;
+ public static java.lang.Object staticField995;
+ public static java.lang.Object staticField996;
+ public static java.lang.Object staticField997;
+ public static java.lang.Object staticField998;
+ public static java.lang.Object staticField999;
+ public static java.lang.Object staticField1000;
+ public Class_NNN_() {System.out.println("In constructor of Class_NNN_"); };
+}
diff --git a/test/hotspot/jtreg/vmTestbase/gc/g1/unloading/ExecutionTask.java b/test/hotspot/jtreg/vmTestbase/gc/g1/unloading/ExecutionTask.java
new file mode 100644
index 0000000..51054d6
--- /dev/null
+++ b/test/hotspot/jtreg/vmTestbase/gc/g1/unloading/ExecutionTask.java
@@ -0,0 +1,51 @@
+/*
+ * Copyright (c) 2014, 2018, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+package gc.g1.unloading;
+
+import nsk.share.test.ExecutionController;
+
+/**
+ * Utility superclass for threads that employ ExecutionController.
+ *
+ */
+public abstract class ExecutionTask implements Runnable {
+
+ protected ExecutionController executionController;
+
+ public ExecutionTask(ExecutionController executionController) {
+ this.executionController = executionController;
+ }
+
+ abstract protected void task() throws Exception;
+
+ @Override
+ public void run() {
+ try {
+ while (executionController.continueExecution()) {
+ task();
+ }
+ } catch (Exception e) {
+ throw new RuntimeException("Something went wrong in PhantomizationServiceThread");
+ }
+ }
+}
diff --git a/test/hotspot/jtreg/vmTestbase/gc/g1/unloading/GenClassPoolJar.java b/test/hotspot/jtreg/vmTestbase/gc/g1/unloading/GenClassPoolJar.java
new file mode 100644
index 0000000..9818ee7
--- /dev/null
+++ b/test/hotspot/jtreg/vmTestbase/gc/g1/unloading/GenClassPoolJar.java
@@ -0,0 +1,286 @@
+/*
+ * Copyright (c) 2014, 2018, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package gc.g1.unloading;
+
+import java.io.File;
+import java.io.FileOutputStream;
+import java.io.IOException;
+import java.nio.file.FileVisitResult;
+import java.nio.file.FileVisitor;
+import java.nio.file.Files;
+import java.nio.file.Path;
+import java.nio.file.Paths;
+import java.nio.file.attribute.BasicFileAttributes;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.List;
+import java.util.jar.JarEntry;
+import java.util.jar.JarOutputStream;
+import java.util.jar.Manifest;
+import javax.tools.JavaCompiler;
+import javax.tools.JavaFileObject;
+import javax.tools.StandardJavaFileManager;
+import javax.tools.ToolProvider;
+import jdk.internal.org.objectweb.asm.ClassReader;
+import jdk.internal.org.objectweb.asm.ClassVisitor;
+import jdk.internal.org.objectweb.asm.ClassWriter;
+import jdk.internal.org.objectweb.asm.Opcodes;
+
+/**
+ * Class that imitates shell script to produce jar file with many similar
+ * classes inside.
+ *
+ * The class generates sources, compiles the first one, applies magic of ASM
+ * to multiply classes and packs into classPool.jar
+ *
+ * Generation template is supposed to be ClassNNN.java.template
+ */
+public class GenClassPoolJar {
+
+ private final String templateFile;
+ private final String destDir;
+ private final int count;
+
+ private final File tmpArea;
+ private final File pkgDir;
+
+ private static final String JAR_NAME = "classPool.jar";
+ private static final String PKG_DIR_NAME = "gc/g1/unloading/rootSetHelper/classesPool";
+
+ public static void main(String args[]) {
+ new GenClassPoolJar(args).script();
+ }
+
+ /**
+ * Creates generator and parses command line args.
+ * @param args command line args
+ */
+ public GenClassPoolJar(String args[]) {
+ if (args.length != 3) {
+ System.err.println("Usage:");
+ System.err.println("java " + GenClassPoolJar.class.getCanonicalName() +
+ " <template-file> <ouput-dir> <count>" );
+ throw new Error("Illegal number of parameters");
+ }
+ templateFile = args[0];
+ destDir = args[1];
+ count = Integer.parseInt(args[2]);
+
+ tmpArea = new File(destDir, "tmp-area");
+ pkgDir = new File(tmpArea, PKG_DIR_NAME);
+
+ }
+ /**
+ * Does everything.
+ */
+ public void script() {
+ long startTime = System.currentTimeMillis();
+ System.out.println("Trying to produce: " + destDir + "/" + JAR_NAME);
+ try {
+
+ if (!pkgDir.exists() && !pkgDir.mkdirs()) {
+ throw new Error("Failed to create " + pkgDir);
+ }
+
+
+ String javaTemplate = readTemplate(templateFile);
+ File java0 = new File(pkgDir, "Class0.java");
+ File class0 = new File(pkgDir, "Class0.class");
+ writeSource(java0, generateSource(javaTemplate, 0));
+
+ /*
+ * Generating and compiling all the sources is not our way -
+ * too easy and too slow.
+ * We compile just first class and use ASM to obtain others
+ * via instrumenting.
+ */
+ File[] toCompile = {java0};
+ compile(toCompile, tmpArea.getAbsolutePath());
+ byte[] classTemplate = readFile(class0); // the first compiled class
+ createJar(new File(destDir, JAR_NAME), javaTemplate, classTemplate, count);
+
+
+ deleteFolder(tmpArea);
+ long endTime = System.currentTimeMillis();
+ System.out.println("Success in " + ((endTime - startTime)/1000) + " seconds");
+ } catch (Throwable whatever) {
+ throw new Error(whatever);
+ }
+ }
+
+ /**
+ * Generates source number num.
+ * @param template template to generate from
+ * @param num number
+ * @return content of java file
+ */
+ String generateSource(String template, int num) {
+ return template.replaceAll("_NNN_", "" + num);
+ }
+
+ /**
+ * Reads content of the given file.
+ * @param file name of file to read
+ * @return file content
+ * @throws IOException if something bad has happened
+ */
+ String readTemplate(String file) throws IOException {
+ if (!new File(file).exists()) {
+ throw new Error("Template " + file + " doesn't exist");
+ }
+ List<String> lines = Files.readAllLines(Paths.get(file));
+ StringBuilder sb = new StringBuilder();
+ for (String line: lines) {
+ if (line.trim().startsWith("#")) {
+ continue;
+ }
+ sb.append(line).append(System.lineSeparator());
+ }
+ return sb.toString();
+ }
+
+ /**
+ * Writes given content to the given file.
+ *
+ * @param file to create
+ * @param content java source
+ * @throws IOException if something bad has happened
+ */
+ void writeSource(File file, String content) throws IOException {
+ List<String> list = Arrays.asList(content.split(System.lineSeparator()));
+ Files.write(Paths.get(file.getAbsolutePath()), list);
+ }
+
+
+ /**
+ * Compiles given files into given folder.
+ *
+ * @param files to compile
+ * @param destDir where to compile
+ * @throws IOException
+ */
+ void compile(File[] files, String destDir) throws IOException {
+ JavaCompiler compiler = ToolProvider.getSystemJavaCompiler();
+ List<String> optionList = new ArrayList<>();
+ optionList.addAll(Arrays.asList("-d", destDir));
+ StandardJavaFileManager sjfm = compiler.getStandardFileManager(null, null, null);
+ Iterable<? extends JavaFileObject> fileObjects = sjfm.getJavaFileObjects(files);
+ JavaCompiler.CompilationTask task = compiler.getTask(null, null, null, optionList, null, fileObjects);
+ task.call();
+ sjfm.close();
+ }
+
+ /**
+ * Puts a number of classes and java sources in the given jar.
+ *
+ * @param jarFile name of jar file
+ * @param javaTemplate content of java source template
+ * @param classTemplate content of compiled java class
+ * @param count number of classes to generate
+ * @throws IOException
+ */
+ void createJar(File jarFile, String javaTemplate, byte[] classTemplate, int count) throws IOException {
+ try (JarOutputStream jar = new JarOutputStream(new FileOutputStream(jarFile), new Manifest())) {
+ for (int i = 1; i <= count; i++) {
+ String name = PKG_DIR_NAME + "/Class" + i;
+ jar.putNextEntry(new JarEntry(name + ".java"));
+ byte[] content = generateSource(javaTemplate, 0).getBytes();
+ jar.write(content, 0, content.length);
+
+ jar.putNextEntry(new JarEntry(name + ".class"));
+ content = morphClass(classTemplate, name);
+ jar.write(content, 0, content.length);
+ }
+ }
+ }
+
+ byte[] readFile(File f) throws IOException {
+ return Files.readAllBytes(Paths.get(f.getAbsolutePath()));
+ }
+
+ void writeFile(File f, byte[] content) throws IOException {
+ Files.write(Paths.get(f.getAbsolutePath()), content);
+ }
+
+ void deleteFolder(File dir) throws IOException {
+ Files.walkFileTree(Paths.get(dir.getAbsolutePath()), new FileVisitor<Path>() {
+
+ @Override
+ public FileVisitResult preVisitDirectory(Path dir, BasicFileAttributes attrs) throws IOException {
+ return FileVisitResult.CONTINUE;
+ }
+
+ @Override
+ public FileVisitResult visitFile(Path file, BasicFileAttributes attrs) throws IOException {
+ Files.delete(file);
+ return FileVisitResult.CONTINUE;
+ }
+
+ @Override
+ public FileVisitResult visitFileFailed(Path file, IOException exc) throws IOException {
+ return FileVisitResult.CONTINUE;
+ }
+
+ @Override
+ public FileVisitResult postVisitDirectory(Path dir, IOException exc) throws IOException {
+ Files.delete(dir);
+ return FileVisitResult.CONTINUE;
+ }
+
+ });
+ }
+
+ /**
+ * Puts new name on the given class.
+ *
+ * @param classToMorph class file content
+ * @param newName new name
+ * @return new class file to write into class
+ */
+ byte[] morphClass(byte[] classToMorph, String newName) {
+ ClassReader cr = new ClassReader(classToMorph);
+ ClassWriter cw = new ClassWriter(cr, ClassWriter.COMPUTE_MAXS);
+ ClassVisitor cv = new ClassRenamer(cw, newName);
+ cr.accept(cv, 0);
+ return cw.toByteArray();
+ }
+
+ /**
+ * Visitor to rename class.
+ */
+ static class ClassRenamer extends ClassVisitor implements Opcodes {
+ private final String newName;
+
+ public ClassRenamer(ClassVisitor cv, String newName) {
+ super(ASM4, cv);
+ this.newName = newName;
+ }
+
+ @Override
+ public void visit(int version, int access, String name, String signature, String superName, String[] interfaces) {
+ cv.visit(version, access, newName, signature, superName, interfaces);
+ }
+
+ }
+}
diff --git a/test/hotspot/jtreg/vmTestbase/gc/g1/unloading/GenClassesBuilder.java b/test/hotspot/jtreg/vmTestbase/gc/g1/unloading/GenClassesBuilder.java
new file mode 100644
index 0000000..75e77b2
--- /dev/null
+++ b/test/hotspot/jtreg/vmTestbase/gc/g1/unloading/GenClassesBuilder.java
@@ -0,0 +1,65 @@
+/*
+ * 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.
+ */
+
+package gc.g1.unloading;
+
+import jdk.test.lib.Utils;
+
+import java.nio.file.Files;
+import java.nio.file.Path;
+import java.nio.file.Paths;
+
+/**
+ * Uses {@link gc.g1.unloading.GenClassPoolJar} to build {@code classPool.jar}
+ * in current directory.
+ */
+public class GenClassesBuilder {
+ public static void main(String[] args) {
+ Path template = testRoot().resolve("vmTestbase")
+ .resolve("gc")
+ .resolve("g1")
+ .resolve("unloading")
+ .resolve("ClassNNN.java.template")
+ .toAbsolutePath();
+ Path dir = Paths.get(".").toAbsolutePath();
+ String count = "1000";
+ if (Files.notExists(template)) {
+ throw new Error("can't find template file: " + template);
+ }
+ try {
+ GenClassPoolJar.main(new String[]{template.toString(), dir.toString(), count});
+ } catch (Exception e) {
+ throw new Error("can't generate classPool.jar", e);
+ }
+ }
+
+ private static Path testRoot() {
+ Path p = Paths.get(Utils.TEST_SRC);
+ while (!Files.exists(p.resolve("TEST.ROOT"))) {
+ p = p.getParent();
+ }
+ return p;
+ }
+}
+
+
diff --git a/test/hotspot/jtreg/vmTestbase/gc/g1/unloading/README b/test/hotspot/jtreg/vmTestbase/gc/g1/unloading/README
new file mode 100644
index 0000000..6ecd1d2
--- /dev/null
+++ b/test/hotspot/jtreg/vmTestbase/gc/g1/unloading/README
@@ -0,0 +1,123 @@
+Copyright (c) 2014, 2018, Oracle and/or its affiliates. All rights reserved.
+DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+
+This code is free software; you can redistribute it and/or modify it
+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.
+
+Here are tests that were developed for "G1 support for long running applications" feature. In effect,
+ here is only one test with a lot of configurations.
+
+Feature description:
+ G1 used to unload classes only during full collections. Goal of feature is to unload unused classes
+ without resorting to full gc.
+
+What does test checks:
+ - that unreferenced classloader will be collected without full gc. This is checked with WhiteBox.is
+ClassAlive method.
+ - that referenced classloader will live. This is checked with WhiteBox.isClassAlive method as well.
+ Also it is checked that classloader will be finalized and enqueued to queue of phantom references.
+
+In what aspects/circumstances checks performed:
+ - classloaders that we expect to be collected can be comlpetely unreferenced, referenced with phant
+om reference and with weak reference. Test can check that presence of phantom/weak reference doesn't
+keep classloader alive.
+ Test has flag "-referenceMode" that has valid options:
+ "phantom" for phantom reference,
+ "weak" for weak reference and
+ "none" for not keeping reference at all.
+ - to avoid class unloading we can keep reference to classloader itself, class or object.
+ This behavior can be adjusted with flag "-keep" that has valid options:
+ "classloader",
+ "class" and
+ "object".
+ - according to test plan several ways of classloading are covered.
+ This behavior is adjusted with "classloadingMethod" flag that has valid options
+ "plain",
+ "reflection",
+ "jni",
+ "anonymous_classloader".
+ - classloaders that we expect to live can be referenced in several ways.
+ This behavior can be adjusted with flag "-keepRefMode" that has valid options:
+ "strong_reference" for starighforward keeping strong reference,
+ "static_field" for keeping reference in static field of alive class,
+ "stack_local" for keeping reference in local variable of running thread,
+ "thread_field" for keeping reference in field of running thread's object,
+ "thread_itself" if we want object to be a running thread itself,
+ "static_field_of_root_class". In this case reference will be kept in static field of class that wa
+s loaded by null classloader.
+ "jni_global_ref". In this case global reference will be kept in native library.
+ "jni_local_ref", In this case local reference will be kept in JNI call in running thread.
+ - Another aspect is that class can be humongous.
+ Humongous classes can be enabled with "-humongousClass" command line option. Valid options are
+"true" and "false".
+ - Another aspect that is covered with tests is that class methods can be compiled by JIT compiler.
+ This behavior can be adjusted with "-compilationLevel" and "-compilationNumber" options. First
+one has self-explaining name, latter sets number of optimization/deoptimozation of each class.
+ - Next aspect is class redefinition.
+ You can enable classes redefinition with "-redefineClasses" flag.
+
+Test implementation details:
+ Test supposed to be ran with G1 gc and -XX:+ExplicitGCProvokesConcurrent option. In the end of exec
+ution test checks if full gc happened. If this is the case the test throws descriptive exception and
+fails.
+
+Test guts design:
+ Test in loop performs the following until time is over (timelimit is set up with "-stressTime" opti
+on):
+ - loads class that gonna live or gonna be unloaded. Decision depends upon Random.nextBoolean().
+ - previous action produces collection of Assertions (what assertion is is explained a little bit lat
+er). Assertions are saved into AssertionContainer.
+ - takes from AssertionContainer assertions that are already mature for check and performs checks. "M
+ature" means that required number of System.gc() calls happened since assertion was created.
+
+What "Assertion" is:
+ Assertion incapsulates check that concrete class will be alive or dead. Hazard is that we can't perf
+orm check just after we removed last reference to classloader. We have to wait some number of concurr
+ent-mark-cycles, i.e. System.gc() calls. For this reason we put each assertion in AssertionContainer
+and get back much later, when it's ready for check.
+ Classes of assertions form the following simple hierarchy:
+
+ gc.g1.unloading.check.Assertion
+ || || ||
+ \/ || \/
+ gc.g1.unloading.check.FinalizedAssertion || gc.g1.unloading.check.PhantomizedAssertion
+ \/
+ gc.g1.unloading.check.ClassAssertion
+
+FinalizedAssertion checks that unreferenced classloader will be finalized.
+PhantomizedAssertion checks that phantom reference to classloader will be enqueued to ReferenceQueue.
+ClassAssertion checks that class will be dead or alive using WhiteBox.isClassAlive method.
+
+Other implemention notes:
+ There are some other auxiliary threads, but they are not crucial for understanding the logic.
+ There are a lot of configurations of the same test in testlist. All configurations use the same mai
+n method as entry point, but impose different test flags. Configurations are autogenerated with "gene
+rate.sh" script.
+
+Other test options:
+ -DFailTestIfNothingChecked=true. (vm flag) Set this if you want test to fail if nothing was checked
+and test appeared to be useless. It can happen, for example, in slow modes that force compilation.
+ -numberOfChecksLimit. (test flag) Set this number if you want test to pass after certain number of c
+hecks performed. (Not to waste time.) To some extent this turns stress test into functional test.
+ -numberOfGCsBeforeCheck. (test flag) This option sets number of System.gc() calls that have to be do
+ne before each assertion will be ready to perform checks.
+ -inMemoryCompilation. (test flag) This option defines the way of classes creation. If this is true t
+hen classes are compiled with javac API. If false - classes are produced by rewriting classname in "g
+olden" bytecode.
+
+
diff --git a/test/hotspot/jtreg/vmTestbase/gc/g1/unloading/UnloadingTest.java b/test/hotspot/jtreg/vmTestbase/gc/g1/unloading/UnloadingTest.java
new file mode 100644
index 0000000..d1b30a5
--- /dev/null
+++ b/test/hotspot/jtreg/vmTestbase/gc/g1/unloading/UnloadingTest.java
@@ -0,0 +1,185 @@
+/*
+ * Copyright (c) 2014, 2018, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+package gc.g1.unloading;
+
+import java.lang.Thread.UncaughtExceptionHandler;
+import java.lang.management.*;
+import java.util.Collection;
+import java.util.List;
+import java.util.Random;
+import java.util.concurrent.atomic.AtomicLong;
+
+import gc.g1.unloading.check.Assertion;
+import gc.g1.unloading.check.AssertionContainer;
+import gc.g1.unloading.check.ClassAssertion;
+import gc.g1.unloading.configuration.*;
+import nsk.share.gc.GCTestBase;
+import nsk.share.test.ExecutionController;
+import nsk.share.test.Stresser;
+import nsk.share.test.Tests;
+
+import gc.g1.unloading.loading.*;
+
+/**
+ * This class contains main method. It's entry point for all configurations.
+ *
+ */
+public class UnloadingTest extends GCTestBase {
+
+ private static String[] args;
+
+ private TestConfiguration configuration;
+
+ private AssertionContainer assertionContainer = new AssertionContainer();
+
+ private Random random;
+
+ private static final String classNamePrefix = "ClassAbc_";
+
+ private static final long DELAY = 300;
+
+ private static AtomicLong systemGcCallsCounter = new AtomicLong(0);
+
+ public static void main(String[] args) {
+ UnloadingTest.args = args;
+ Tests.runTest(new UnloadingTest(), args);
+ }
+
+ @Override
+ public void run() {
+ configuration = TestConfiguration.createTestConfiguration(args);
+
+ checkIfG1Used();
+ checkFlags();
+
+ ExecutionController stresser = new Stresser(args);
+ stresser.start(1);
+
+ Thread.setDefaultUncaughtExceptionHandler(new UncaughtExceptionHandler() {
+ @Override
+ public void uncaughtException(Thread t, Throwable e) {
+ System.out.println("Throwable \"" + e + "\" in thread " + t.getName() + ", id=" + t.getId());
+ e.printStackTrace();
+ try {
+ checkGCCounters();
+ } catch (Throwable thr) {
+ thr.printStackTrace();
+ }
+ System.exit(2);
+ }
+ });
+
+ random = new Random(runParams.getSeed());
+ ClassLoadingHelper classLoadingHelper = new ClassLoadingHelper(stresser, random.nextLong(), configuration);
+
+ int classesCounter = 0;
+ while (stresser.continueExecution()) {
+ Collection<Assertion> assertions = null;
+ String className = classNamePrefix + (classesCounter++);
+
+ try {
+ Thread.sleep(DELAY);
+ } catch (InterruptedException | IllegalArgumentException e) {
+ throw new RuntimeException("Something went wrong in ClassLoadingHelper", e);
+ }
+
+ if (random.nextBoolean()) {
+ assertions = classLoadingHelper.loadClassThatGonnaDie(className);
+ } else {
+ assertions = classLoadingHelper.loadClassThatGonnaLive(className);
+ }
+
+ System.gc();
+ long systemGCCalls = systemGcCallsCounter.incrementAndGet();
+
+ assertionContainer.enqueue(assertions, systemGCCalls);
+
+ check(assertionContainer.getElder(systemGCCalls - configuration.getNumberOfGCsBeforeCheck()));
+
+ if (configuration.getNumberOfChecksLimit() >= 0 &&
+ ClassAssertion.getCounterOfCheckedAlive() >= configuration.getNumberOfChecksLimit() &&
+ ClassAssertion.getCounterOfCheckedUnloaded() >= configuration.getNumberOfChecksLimit()) {
+ System.out.println("Exiting because numberOfChecksLimit exceeded.");
+ stresser.finish();
+ break;
+ }
+ }
+
+ System.out.println("ClassAssertion.getCounterOfCheckedAlive() = " + ClassAssertion.getCounterOfCheckedAlive());
+ System.out.println("ClassAssertion.getCounterOfCheckedUnloaded() = " + ClassAssertion.getCounterOfCheckedUnloaded());
+ checkGCCounters();
+ if (System.getProperty("FailTestIfNothingChecked") != null) {
+ if (ClassAssertion.getCounterOfCheckedAlive() == 0 || ClassAssertion.getCounterOfCheckedUnloaded() == 0) {
+ throw new RuntimeException("Test was useless. Smthng not checked: " + ClassAssertion.getCounterOfCheckedAlive() + " " +
+ ClassAssertion.getCounterOfCheckedUnloaded());
+ }
+ }
+ }
+
+ private void check(Collection<Assertion> assertions) {
+ if (assertions.isEmpty()) {
+ return;
+ }
+ for (Assertion assertion : assertions) {
+ assertion.check();
+ assertion.cleanup();
+ }
+ }
+
+ private static void checkGCCounters() {
+// System.out.println("WhiteBox.getWhiteBox().g1GetTotalCollections() = \t" + WhiteBox.getWhiteBox().g1GetTotalCollections());
+// System.out.println("WhiteBox.getWhiteBox().g1GetTotalFullCollections() = \t" + WhiteBox.getWhiteBox().g1GetTotalFullCollections());
+ GarbageCollectorMXBean oldGenBean = null;
+ for (GarbageCollectorMXBean bean : ManagementFactory.getGarbageCollectorMXBeans()) {
+ System.out.println("bean.getName() = \t\"" + bean.getName() + "\", bean.getCollectionCount() = \t" + bean.getCollectionCount());
+ if (bean.getName().contains("Old")) {
+ oldGenBean = bean;
+ }
+ }
+// if (WhiteBox.getWhiteBox().g1GetTotalFullCollections() != 0 || (oldGenBean != null && oldGenBean.getCollectionCount() != 0)) {
+ if (oldGenBean != null && oldGenBean.getCollectionCount() != 0) {
+ throw new RuntimeException("Full gc happened. Test was useless.");
+ }
+ }
+
+ private void checkIfG1Used() {
+ for (GarbageCollectorMXBean bean : ManagementFactory.getGarbageCollectorMXBeans()) {
+ if (!bean.getName().contains("G1")) {
+ System.err.println("This test was created to cover G1 class unloading feature. It should be ran with -XX:+UseG1GC. Skipping silently.");
+ System.exit(0);
+ }
+ }
+ }
+
+ private void checkFlags() {
+ RuntimeMXBean runtimeMxBean = ManagementFactory.getRuntimeMXBean();
+ List<String> arguments = runtimeMxBean.getInputArguments();
+ for (String argument : arguments) {
+ if (argument.contains("ExplicitGCInvokesConcurrent")) {
+ return;
+ }
+ }
+ throw new RuntimeException("This test supposed to be ran with -XX:+ExplicitGCInvokesConcurrent flag");
+ }
+
+}
diff --git a/test/hotspot/jtreg/vmTestbase/gc/g1/unloading/bytecode/Bytecode.java b/test/hotspot/jtreg/vmTestbase/gc/g1/unloading/bytecode/Bytecode.java
new file mode 100644
index 0000000..d1a1c80
--- /dev/null
+++ b/test/hotspot/jtreg/vmTestbase/gc/g1/unloading/bytecode/Bytecode.java
@@ -0,0 +1,56 @@
+/*
+ * Copyright (c) 2014, 2018, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+package gc.g1.unloading.bytecode;
+
+/**
+ * This is container for class name and bytecode. Bytecode is what BytecodeFactory produces.
+ */
+public class Bytecode {
+
+ private String className;
+
+ private byte[] bytecode;
+
+ public String getClassName() {
+ return className;
+ }
+
+ public void setClassName(String className) {
+ this.className = className;
+ }
+
+ public byte[] getBytecode() {
+ return bytecode;
+ }
+
+ public void setBytecode(byte[] bytecode) {
+ this.bytecode = bytecode;
+ }
+
+ public Bytecode(String className, byte[] bytecode) {
+ super();
+ this.className = className;
+ this.bytecode = bytecode;
+ }
+
+}
diff --git a/test/hotspot/jtreg/vmTestbase/gc/g1/unloading/bytecode/BytecodeFactory.java b/test/hotspot/jtreg/vmTestbase/gc/g1/unloading/bytecode/BytecodeFactory.java
new file mode 100644
index 0000000..4257aa7
--- /dev/null
+++ b/test/hotspot/jtreg/vmTestbase/gc/g1/unloading/bytecode/BytecodeFactory.java
@@ -0,0 +1,29 @@
+/*
+ * Copyright (c) 2014, 2018, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+package gc.g1.unloading.bytecode;
+
+public interface BytecodeFactory {
+
+ Bytecode createBytecode(String className);
+
+}
diff --git a/test/hotspot/jtreg/vmTestbase/gc/g1/unloading/bytecode/BytecodeGeneratorFactory.java b/test/hotspot/jtreg/vmTestbase/gc/g1/unloading/bytecode/BytecodeGeneratorFactory.java
new file mode 100644
index 0000000..cad856f
--- /dev/null
+++ b/test/hotspot/jtreg/vmTestbase/gc/g1/unloading/bytecode/BytecodeGeneratorFactory.java
@@ -0,0 +1,56 @@
+/*
+ * Copyright (c) 2014, 2018, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+package gc.g1.unloading.bytecode;
+
+import java.util.HashMap;
+import java.util.Map;
+import java.util.Random;
+
+import vm.share.InMemoryJavaCompiler;
+
+/**
+ * BytecodeFactory that employs in memory compilation.
+ */
+public class BytecodeGeneratorFactory implements BytecodeFactory {
+
+ private Random random;
+
+ private SourceGenerator sourceGenerator;
+
+ public BytecodeGeneratorFactory(long seed) {
+ random = new Random(seed);
+ sourceGenerator = new SourceGenerator(random.nextLong());
+ }
+
+ @Override
+ public Bytecode createBytecode(String className) {
+ Map<String, CharSequence> sources = new HashMap<String, CharSequence>();
+ sources.put(className, sourceGenerator.generateSource(className,
+ "public static void main() { System.out.println(\"From main method in in-mem-compiled code " + random.nextGaussian() +
+ " + str_bytesToReplace0 str_bytesToReplace1\"); }\n " +
+ "public static int methodForCompilation(Object object) { int i = object.hashCode(); i = i * 2000 / 1994 + 153; return i; }\n"));
+ byte[] bytecode = InMemoryJavaCompiler.compile(sources).values().iterator().next();
+ return new Bytecode(className, bytecode);
+ }
+
+}
diff --git a/test/hotspot/jtreg/vmTestbase/gc/g1/unloading/bytecode/BytecodeMutatorFactory.java b/test/hotspot/jtreg/vmTestbase/gc/g1/unloading/bytecode/BytecodeMutatorFactory.java
new file mode 100644
index 0000000..396ccec
--- /dev/null
+++ b/test/hotspot/jtreg/vmTestbase/gc/g1/unloading/bytecode/BytecodeMutatorFactory.java
@@ -0,0 +1,125 @@
+/*
+ * Copyright (c) 2014, 2018, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+package gc.g1.unloading.bytecode;
+
+import java.io.*;
+import java.nio.charset.*;
+import java.util.*;
+
+
+/**
+ * This BytecodeFactory produces bytecode that is golden bytecode with className substituted.
+ */
+public class BytecodeMutatorFactory implements BytecodeFactory {
+
+ private static final String FILLER_CHARACTER = "_";
+
+ /**
+ * Utility method in this class
+ */
+ public static String padName(String s, int length) {
+ int difference = length - s.length();
+ StringBuilder sb = new StringBuilder(s);
+ for (int i = 0; i < difference; i++) {
+ sb.append(FILLER_CHARACTER);
+ }
+ return sb.toString();
+ }
+
+ public String padName(String s) {
+ return padName(s, getNameLength());
+ }
+
+ private final Charset CHARACTER_SET = StandardCharsets.UTF_8;
+
+ private List<Integer> offsets = new LinkedList<>();
+
+ private byte[] templateBytecode;
+
+ private String templateClassName;
+
+ private byte[] templateClassNameAsBytes;
+
+ public BytecodeMutatorFactory() {
+ this(DefaultTemplateClass.class.getName());
+ }
+
+ public BytecodeMutatorFactory(String templateClassName) {
+ this.templateClassName = templateClassName;
+
+ // Read bytecode to array
+ InputStream is = ClassLoader.getSystemResourceAsStream(templateClassName.replace('.', '/').concat(".class"));
+ try {
+ templateBytecode = new byte[is.available()];
+ is.read(templateBytecode);
+ is.close();
+ } catch (IOException e) {
+ throw new RuntimeException(e);
+ }
+
+ // Save offsets
+ templateClassNameAsBytes = templateClassName.replace('.', '/').getBytes(CHARACTER_SET);
+ for (int i = 0; i < templateBytecode.length; i++) {
+ boolean match = true;
+ for (int j = 0; j < templateClassNameAsBytes.length; j++) {
+ if (i + j >= templateBytecode.length || templateClassNameAsBytes[j] != templateBytecode[i + j]) {
+ match = false;
+ break;
+ }
+ }
+ if (match) {
+ offsets.add(i);
+ }
+ }
+ }
+
+ public byte[] getBytecode(String className) {
+
+ // Check size of name constraint
+ byte[] newClassNameAsBytes = className.replace('.', '/').getBytes(CHARACTER_SET);
+ if (newClassNameAsBytes.length != templateClassNameAsBytes.length) {
+ throw new RuntimeException("Can't produce bytecode with \"" + className + "\" substituted as class name. " +
+ "Length of this name differs from length of \"" + templateClassName + "\" which equals to " + templateClassName.length() +
+ ". Length of \"" + className + "\" is " + className.length() + ".");
+ }
+
+ // Prepare bytecode
+ byte[] result = Arrays.copyOf(templateBytecode, templateBytecode.length);
+ for (int offset : offsets) {
+ System.arraycopy(newClassNameAsBytes, 0, result, offset, newClassNameAsBytes.length);
+ }
+ return result;
+ }
+
+ public int getNameLength() {
+ return templateClassName.length();
+ }
+
+ @Override
+ public Bytecode createBytecode(String className) {
+ String finalClassName = padName(className);
+ byte[] bytecode = getBytecode(finalClassName);
+ return new Bytecode(finalClassName, bytecode);
+ }
+
+}
diff --git a/test/hotspot/jtreg/vmTestbase/gc/g1/unloading/bytecode/BytecodePatcher.java b/test/hotspot/jtreg/vmTestbase/gc/g1/unloading/bytecode/BytecodePatcher.java
new file mode 100644
index 0000000..da128c6
--- /dev/null
+++ b/test/hotspot/jtreg/vmTestbase/gc/g1/unloading/bytecode/BytecodePatcher.java
@@ -0,0 +1,58 @@
+/*
+ * Copyright (c) 2014, 2018, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+package gc.g1.unloading.bytecode;
+
+import java.util.*;
+
+
+/**
+ * This utility class replaces peaces of bytes in bytecode by another peaces according to dictionary. This is useful for class redefenition.
+ */
+public class BytecodePatcher {
+
+ static private Map<byte[], byte[]> dictionary = new HashMap<>();
+
+ static {
+ dictionary.put("bytesToReplace0".getBytes(), "bytesToReplace1".getBytes());
+ dictionary.put("bytesToReplace2".getBytes(), "bytesToReplace3".getBytes());
+ }
+
+ public static void patch(byte[] bytecode) {
+ for (Map.Entry<byte[], byte[]> entry : dictionary.entrySet()) {
+ for (int i = 0; i + entry.getKey().length < bytecode.length; i++) {
+ boolean match = true;
+ for (int j = 0; j < entry.getKey().length; j++) {
+ if (bytecode[i + j] != entry.getKey()[j]) {
+ match = false;
+ break;
+ }
+ }
+ if (match) {
+ for (int j = 0; j < entry.getKey().length; j++)
+ bytecode[i + j] = entry.getValue()[j];
+ }
+ }
+ }
+ }
+
+}
diff --git a/test/hotspot/jtreg/vmTestbase/gc/g1/unloading/bytecode/DefaultTemplateClass.java b/test/hotspot/jtreg/vmTestbase/gc/g1/unloading/bytecode/DefaultTemplateClass.java
new file mode 100644
index 0000000..0531927
--- /dev/null
+++ b/test/hotspot/jtreg/vmTestbase/gc/g1/unloading/bytecode/DefaultTemplateClass.java
@@ -0,0 +1,45 @@
+/*
+ * Copyright (c) 2014, 2018, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+package gc.g1.unloading.bytecode;
+
+import java.util.Random;
+
+/**
+ * This is template class. Loaded classes will derive from it.
+ */
+public class DefaultTemplateClass {
+
+ public static void main() {
+ System.out.println("In method of generated class. Random.nextDouble = " + new Random().nextDouble());
+ System.out.println(" Printing bytesToReplace0 bytesToReplace2");
+ }
+
+ public static long field;
+
+ public static void methodForCompilation(Object object) {
+ int i = object.hashCode();
+ i = i * 2000 / 1994 + 153;
+ field = i;
+ }
+
+}
diff --git a/test/hotspot/jtreg/vmTestbase/gc/g1/unloading/bytecode/GenClassesBuilder.java b/test/hotspot/jtreg/vmTestbase/gc/g1/unloading/bytecode/GenClassesBuilder.java
new file mode 100644
index 0000000..881e7a6
--- /dev/null
+++ b/test/hotspot/jtreg/vmTestbase/gc/g1/unloading/bytecode/GenClassesBuilder.java
@@ -0,0 +1,88 @@
+/*
+ * 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.
+ */
+
+package gc.g1.unloading.bytecode;
+
+import jdk.test.lib.JDKToolLauncher;
+import jdk.test.lib.Utils;
+import jdk.test.lib.process.ProcessTools;
+
+import java.io.IOException;
+import java.nio.file.Files;
+import java.nio.file.Path;
+import java.nio.file.Paths;
+import java.util.Arrays;
+import java.util.stream.Stream;
+
+/**
+ * Uses {@link gc.g1.unloading.bytecode.HumongousTemplateClassGen} to generate
+ * source code of HumongousTemplateClass and compiles it to {@code test.classes}.
+ */
+public class GenClassesBuilder {
+ public static void main(String[] args) {
+ Path genSrc = Paths.get("genSrc").toAbsolutePath();
+ Path classesDir = Paths.get(Utils.TEST_CLASSES).toAbsolutePath();
+ generateSource(genSrc);
+ compileSource(genSrc, classesDir);
+ }
+
+ private static void compileSource(Path srcDst, Path classesDir) {
+ JDKToolLauncher javac = JDKToolLauncher.create("javac")
+ .addToolArg("-d")
+ .addToolArg(classesDir.toString())
+ .addToolArg("-cp")
+ .addToolArg(Utils.TEST_CLASS_PATH);
+ try (Stream<Path> stream = Files.walk(srcDst)) {
+ stream.map(Path::toAbsolutePath)
+ .map(Path::toString)
+ .filter(s -> s.endsWith(".java"))
+ .forEach(javac::addToolArg);
+ } catch (IOException e) {
+ throw new Error("traverse source dir " + srcDst, e);
+ }
+ String[] command = javac.getCommand();
+ try {
+ ProcessTools.executeCommand(command)
+ .shouldHaveExitValue(0);
+ } catch (Error | RuntimeException e) {
+ throw e;
+ } catch (Throwable e) {
+ throw new Error("execution of javac(" + Arrays.toString(command) + ") failed", e);
+ }
+ }
+
+ private static void generateSource(Path dir) {
+ try {
+ Files.createDirectories(dir);
+ } catch (IOException e) {
+ throw new Error("can't create dirs for" + dir, e);
+ }
+
+ try {
+ HumongousTemplateClassGen.main(new String[]{dir.toString()});
+ } catch (Exception e) {
+ throw new Error("can't generate classes", e);
+ }
+ }
+}
+
diff --git a/test/hotspot/jtreg/vmTestbase/gc/g1/unloading/bytecode/HumongousTemplateClassGen.java b/test/hotspot/jtreg/vmTestbase/gc/g1/unloading/bytecode/HumongousTemplateClassGen.java
new file mode 100644
index 0000000..6daed6b
--- /dev/null
+++ b/test/hotspot/jtreg/vmTestbase/gc/g1/unloading/bytecode/HumongousTemplateClassGen.java
@@ -0,0 +1,123 @@
+/*
+ * Copyright (c) 2015, 2018, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package gc.g1.unloading.bytecode;
+
+import java.io.BufferedWriter;
+import java.io.File;
+import java.io.FileWriter;
+import java.io.IOException;
+import java.util.ArrayList;
+import java.util.List;
+
+/*
+ * This class is compiled and invoke due the build to produce
+ * HumongousTemplateClass.java. The size of generated file is
+ * too large to store it in the repository.
+ */
+
+public class HumongousTemplateClassGen {
+
+private static final String CLASS_NAME = "HumongousTemplateClass";
+private static final String PKG_NAME = "gc.g1.unloading.bytecode";
+private static final String PKG_DIR_NAME = PKG_NAME.replace(".",
+ File.separator);
+private static final int ITERATIONS = 1075;
+private static final double MG = (Math.pow(1024, 2));
+private static final int RECORD_COUNT = 16 * ITERATIONS + 10;
+
+public static void addFileTop(List<String> records) {
+ records.add("package " + PKG_NAME + ";\n");
+ records.add("\n");
+ records.add("import java.util.*;\n");
+ records.add("\n");
+ records.add("public class " + CLASS_NAME + " {\n");
+ records.add(" public static void main() {\n");
+ records.add(" System.out.println(\"In humongous class \");\n");
+ records.add(" }");
+ records.add("\n");
+}
+
+public static void addIteration(int itNum, List<String> records) {
+ records.add(" public static Object public_static_object_" + itNum
+ + " = new Object();\n");
+ records.add(" protected static Object protected_static_object_" + itNum
+ + " = new Object();\n");
+ records.add(" private static Object private_static_Object_" + itNum
+ + " = new Object();\n");
+ records.add("\n");
+ records.add(" public static long public_static_long_" + itNum + ";\n");
+ records.add(" protected static long protected_static_long_" + itNum
+ + " = new Random().nextLong();\n");
+ records.add(" private static long private_static_long_" + itNum
+ + " = 42;\n");
+ records.add("\n");
+ records.add(" public Object public_object_" + itNum
+ + " = new Object();\n");
+ records.add(" protected Object protected_object_" + itNum
+ + " = new Object();\n");
+ records.add(" private Object private_Object_" + itNum
+ + " = new Object();\n");
+ records.add("\n");
+ records.add(" public long public_long_" + itNum + " = 43;\n");
+ records.add(" protected long protected_long_" + itNum + " = 44;\n");
+ records.add(" private long private_long_" + itNum
+ + " = new Random().nextLong();\n");
+}
+public static void main(String[] args) throws Exception {
+ if (args.length < 1) {
+ System.out.println("Usage: HumongousTemplateClassGen "
+ + "<vm-testbase_src_folder>");
+ return;
+ }
+
+ List<String> records = new ArrayList<String>(RECORD_COUNT);
+ addFileTop(records);
+ for (int i = 1; i < ITERATIONS; i++) {
+ addIteration(i, records);
+ }
+ records.add("}");
+ writeBuffered(records, (int) (MG * 1), args[0]);
+}
+
+private static void writeBuffered(List<String> records, int bufSize,
+ String srcDir) throws IOException {
+ String path = srcDir + File.separator + PKG_DIR_NAME + File.separator
+ + CLASS_NAME + ".java";
+ System.out.println("Path="+path);
+ File file = new File (path);
+ file.getParentFile().mkdirs();
+ file.createNewFile();
+ long start = System.currentTimeMillis();
+ FileWriter writer = new FileWriter(file);
+ BufferedWriter bufferedWriter = new BufferedWriter(writer, bufSize);
+
+ for (String record: records) {
+ bufferedWriter.write(record);
+ }
+ bufferedWriter.flush();
+ bufferedWriter.close();
+ long end = System.currentTimeMillis();
+ System.out.println((end - start) / 1000f + " seconds");
+}
+}
diff --git a/test/hotspot/jtreg/vmTestbase/gc/g1/unloading/bytecode/SourceGenerator.java b/test/hotspot/jtreg/vmTestbase/gc/g1/unloading/bytecode/SourceGenerator.java
new file mode 100644
index 0000000..ad8df7a
--- /dev/null
+++ b/test/hotspot/jtreg/vmTestbase/gc/g1/unloading/bytecode/SourceGenerator.java
@@ -0,0 +1,228 @@
+/*
+ * Copyright (c) 2014, 2018, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+package gc.g1.unloading.bytecode;
+
+import java.util.Collections;
+import java.util.LinkedList;
+import java.util.List;
+import java.util.Random;
+import java.util.concurrent.atomic.AtomicLong;
+
+/**
+ * I hope I'll reuse this source code generator. That's why I extracted it to separate class.
+ *
+ */
+public class SourceGenerator {
+
+ private static final int METHODS_NUMBER_LIMIT = 100;
+
+ private static final int LOCALS_NUMBER_LIMIT = 50;
+
+ private static final int METHOD_ARGS_NUMBER_LIMIT = 15;
+
+ private static final int FIELDS_NUMBER_LIMIT = 200;
+
+ private Random rnd;
+
+ private static AtomicLong atomicLong = new AtomicLong();
+
+ public SourceGenerator(long seed) {
+ rnd = new Random(seed);
+ }
+
+ public CharSequence generateSource(String className) {
+ return generateSource(className, null);
+ }
+
+ public CharSequence generateSource(String className, CharSequence insert) {
+ StringBuilder sb = new StringBuilder("public class " + className + " { ");
+
+ List<CharSequence> hunks = new LinkedList<>();
+ int fieldsNumber = rnd.nextInt(FIELDS_NUMBER_LIMIT);
+ for (int i = 0; i < fieldsNumber; i++) {
+ hunks.add(createField(rnd));
+ }
+ int methodsNumber = rnd.nextInt(METHODS_NUMBER_LIMIT);
+ for (int i = 0; i < methodsNumber; i++) {
+ hunks.add(createMethod(rnd));
+ }
+
+ Collections.shuffle(hunks, rnd);
+ for (CharSequence cs : hunks) {
+ sb.append(cs);
+ }
+ if (insert != null) {
+ sb.append(insert);
+ }
+ sb.append(" } ");
+ return sb;
+ }
+
+ private CharSequence createField(Random rnd) {
+ StringBuilder sb = new StringBuilder();
+ if (rnd.nextBoolean())
+ sb.append(" static ");
+ boolean isFinal;
+ if (isFinal = rnd.nextBoolean())
+ sb.append(" final ");
+ if (rnd.nextBoolean() && !isFinal)
+ sb.append(" volatile ");
+ sb.append(AccessModifier.getRandomAccessModifier(rnd).toString());
+ Type type = Type.getRandomType(rnd);
+ sb.append(type.toString());
+ sb.append(" field_" + atomicLong.getAndIncrement());
+ if (rnd.nextBoolean() || isFinal)
+ sb.append(" = " + type.init(rnd));
+ sb.append(";\n");
+ return sb.toString();
+ }
+
+ private CharSequence createMethod(Random rnd) {
+ StringBuilder sb = new StringBuilder();
+ if (rnd.nextBoolean())
+ sb.append(" static ");
+ if (rnd.nextBoolean())
+ sb.append(" final ");
+ if (rnd.nextBoolean())
+ sb.append(" synchronized ");
+ sb.append(AccessModifier.getRandomAccessModifier(rnd).toString());
+ Type returnType = Type.getRandomType(rnd);
+ sb.append(returnType.toString());
+ sb.append(" method_" + atomicLong.getAndIncrement());
+ sb.append("(");
+ sb.append(generateMethodArgs(rnd));
+ sb.append(") {\n");
+ sb.append(generateMethodContent(rnd));
+ sb.append(" return " + returnType.init(rnd));
+ sb.append("; };\n");
+ return sb.toString();
+ }
+
+ private CharSequence generateMethodContent(Random rnd) {
+ StringBuilder sb = new StringBuilder();
+ int number = rnd.nextInt(LOCALS_NUMBER_LIMIT);
+ for (int i = 0; i < number; i++) {
+ Type type = Type.getRandomType(rnd);
+ sb.append(type + " ");
+ String localName = " local_" + i;
+ sb.append(localName);
+ boolean initialized;
+ if (initialized = rnd.nextBoolean()) {
+ sb.append(" = " + type.init(rnd));
+ }
+ sb.append(";\n");
+ if (initialized)
+ sb.append("System.out.println(\" \" + " + localName + ");");
+ }
+ return sb.toString();
+ }
+
+ private CharSequence generateMethodArgs(Random rnd) {
+ StringBuilder sb = new StringBuilder();
+ int number = rnd.nextInt(METHOD_ARGS_NUMBER_LIMIT);
+ for (int i = 0; i < number; i++) {
+ sb.append(Type.getRandomType(rnd));
+ sb.append(" arg_" + i);
+ if (i < number - 1) {
+ sb.append(" , ");
+ }
+ }
+ return sb.toString();
+ }
+
+}
+
+enum AccessModifier {
+ PRIVATE, PROTECTED, PACKAGE, PUBLIC;
+
+ public String toString() {
+ switch (this) {
+ case PRIVATE:
+ return " private ";
+ case PROTECTED:
+ return " protected ";
+ case PACKAGE:
+ return " ";
+ default:
+ return " public ";
+ }
+ };
+
+ public static AccessModifier getRandomAccessModifier(Random rnd) {
+ AccessModifier[] a = AccessModifier.class.getEnumConstants();
+ return a[rnd.nextInt(a.length)];
+ }
+}
+
+enum Type {
+ LONG, INT, BOOLEAN, OBJECT, STRING, DOUBLE, DATE;
+
+ public String toString() {
+ switch (this) {
+ case LONG:
+ return " long ";
+ case INT:
+ return " int ";
+ case BOOLEAN:
+ return " boolean ";
+ case OBJECT:
+ return " Object ";
+ case STRING:
+ return " String ";
+ case DOUBLE:
+ return " double ";
+ case DATE:
+ return " java.util.Date ";
+ default:
+ return null;
+ }
+ }
+
+ ;
+
+ public String init(Random rnd) {
+ switch (this) {
+ case LONG:
+ return " " + rnd.nextLong() + "L ";
+ case INT:
+ return rnd.nextBoolean() ? " " + rnd.nextInt() : " new Object().hashCode() ";
+ case BOOLEAN:
+ return " " + rnd.nextBoolean();
+ case OBJECT:
+ return " new Object() ";
+ case STRING:
+ return " \"str_bytesToReplace" + rnd.nextInt(4) + "\"";
+ case DOUBLE:
+ return " " + rnd.nextDouble();
+ case DATE:
+ return " new java.util.Date() ";
+ default:
+ return null;
+ }
+ }
+
+ public static Type getRandomType(Random rnd) {
+ Type[] a = Type.class.getEnumConstants();
+ return a[rnd.nextInt(a.length)];
+ }
+}
diff --git a/test/hotspot/jtreg/vmTestbase/gc/g1/unloading/bytecode/TemplateClassWithStaticField.java b/test/hotspot/jtreg/vmTestbase/gc/g1/unloading/bytecode/TemplateClassWithStaticField.java
new file mode 100644
index 0000000..9c07e10
--- /dev/null
+++ b/test/hotspot/jtreg/vmTestbase/gc/g1/unloading/bytecode/TemplateClassWithStaticField.java
@@ -0,0 +1,42 @@
+/*
+ * Copyright (c) 2014, 2018, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+package gc.g1.unloading.bytecode;
+
+public class TemplateClassWithStaticField {
+
+ private static Object field;
+
+ public static void setField(Object field) {
+ TemplateClassWithStaticField.field = field;
+ }
+
+ static int field2 = -1;
+
+ public static void methodForCompilation(Object object) {
+ int i = object.hashCode();
+ i = i * 2000 / 1994 + 153;
+ field2 = i;
+ }
+
+
+}
diff --git a/test/hotspot/jtreg/vmTestbase/gc/g1/unloading/bytecode/ThreadTemplateClass.java b/test/hotspot/jtreg/vmTestbase/gc/g1/unloading/bytecode/ThreadTemplateClass.java
new file mode 100644
index 0000000..020df3b
--- /dev/null
+++ b/test/hotspot/jtreg/vmTestbase/gc/g1/unloading/bytecode/ThreadTemplateClass.java
@@ -0,0 +1,53 @@
+/*
+ * Copyright (c) 2014, 2018, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+package gc.g1.unloading.bytecode;
+
+/**
+ * This is another template class that extends Thread.
+ */
+public class ThreadTemplateClass extends Thread {
+
+ synchronized public void finishThread() {
+ notifyAll();
+ }
+
+ @Override
+ public synchronized void run() {
+ super.run();
+ try {
+ wait();
+ } catch (InterruptedException e) {
+ throw new RuntimeException("Unexpected InterruptedException ", e);
+ }
+ }
+
+ static int field2 = -1;
+
+ public static void methodForCompilation(Object object) {
+ int i = object.hashCode();
+ i = i * 2000 / 1994 + 153;
+ field2 = i;
+ }
+
+
+}
diff --git a/test/hotspot/jtreg/vmTestbase/gc/g1/unloading/check/Assertion.java b/test/hotspot/jtreg/vmTestbase/gc/g1/unloading/check/Assertion.java
new file mode 100644
index 0000000..c6733e3
--- /dev/null
+++ b/test/hotspot/jtreg/vmTestbase/gc/g1/unloading/check/Assertion.java
@@ -0,0 +1,55 @@
+/*
+ * Copyright (c) 2014, 2018, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+package gc.g1.unloading.check;
+
+import gc.g1.unloading.check.cleanup.CleanupAction;
+
+import java.util.LinkedList;
+import java.util.List;
+
+/**
+ * Superclass for assertion.
+ */
+public abstract class Assertion {
+
+ public abstract void check();
+
+ private List<Object> storage = new LinkedList<>();
+
+ public void keepLink(Object object) {
+ storage.add(object);
+ }
+
+ public void cleanup() {
+ try {
+ for (Object o : storage) {
+ if (o instanceof CleanupAction) {
+ ((CleanupAction) o).cleanup();
+ }
+ }
+ } catch (Exception e) {
+ throw new RuntimeException("Something bad happened while cleaning after checked assertion", e);
+ }
+ }
+
+}
diff --git a/test/hotspot/jtreg/vmTestbase/gc/g1/unloading/check/AssertionContainer.java b/test/hotspot/jtreg/vmTestbase/gc/g1/unloading/check/AssertionContainer.java
new file mode 100644
index 0000000..c5a96ed
--- /dev/null
+++ b/test/hotspot/jtreg/vmTestbase/gc/g1/unloading/check/AssertionContainer.java
@@ -0,0 +1,66 @@
+/*
+ * Copyright (c) 2014, 2018, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+package gc.g1.unloading.check;
+
+import java.util.*;
+
+/**
+ * This is the storage for assertions. Here assertions are stored until required number of garbage collections happen.
+ * This container isn't thread-safe.
+ */
+public class AssertionContainer {
+
+ private SortedMap<Long, List<Assertion>> sortedMap = new TreeMap<>();
+
+ /**
+ * Enqueue assertion to storage.
+ * @param assertions
+ * @param gcCounter - gc counter value as of assertion created
+ */
+ public void enqueue(Collection<Assertion> assertions, Long gcCounter) {
+ if (sortedMap.get(gcCounter) != null) {
+ sortedMap.get(gcCounter).addAll(assertions);
+ } else {
+ List<Assertion> newList = new LinkedList<>();
+ newList.addAll(assertions);
+ sortedMap.put(gcCounter, newList);
+ }
+ }
+
+ /**
+ * Get assertions that are ready for check. That means they where created when gc counter was less then
+ * specified value.
+ * @param bound - value of gc counter
+ * @return - collection of assertions. It can be empty if no assertions are mature yet.
+ */
+ public Collection<Assertion> getElder(Long bound) {
+ Collection<Assertion> returnValue = new LinkedList<>();
+ SortedMap<Long, List<Assertion>> filteredView = sortedMap.headMap(bound);
+ for (Long l : filteredView.keySet()) {
+ List<Assertion> list = filteredView.remove(l);
+ returnValue.addAll(list);
+ }
+ return returnValue;
+ }
+
+}
diff --git a/test/hotspot/jtreg/vmTestbase/gc/g1/unloading/check/ClassAssertion.java b/test/hotspot/jtreg/vmTestbase/gc/g1/unloading/check/ClassAssertion.java
new file mode 100644
index 0000000..19c595f
--- /dev/null
+++ b/test/hotspot/jtreg/vmTestbase/gc/g1/unloading/check/ClassAssertion.java
@@ -0,0 +1,81 @@
+/*
+ * Copyright (c) 2014, 2018, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+package gc.g1.unloading.check;
+
+import sun.hotspot.WhiteBox;
+
+/**
+ * This assertion checks that class is alive using WhiteBox isClassAlive method.
+ */
+public class ClassAssertion extends Assertion {
+
+ private String className;
+
+ private boolean shouldBeAlive;
+
+ private static long counterOfCheckedUnloaded = 0;
+
+ private static long counterOfCheckedAlive = 0;
+
+ public static long getCounterOfCheckedUnloaded() {
+ return counterOfCheckedUnloaded;
+ }
+
+ public static long getCounterOfCheckedAlive() {
+ return counterOfCheckedAlive;
+ }
+
+ public ClassAssertion(String className, boolean shouldBeAlive) {
+ this.shouldBeAlive = shouldBeAlive;
+ this.className = className;
+ }
+
+ @Override
+ public void check() {
+ boolean isAlive = WhiteBox.getWhiteBox().isClassAlive(className);
+ if (isAlive != shouldBeAlive) {
+ if (isAlive) {
+ throw new RuntimeException("Class " + className + " was not unloaded! Failing test.");
+ } else {
+ throw new RuntimeException("Class " + className + " must live! Failing test.");
+ }
+ } else {
+ System.out.println(" Check OK, class " + className + ", isAlive = " + isAlive + ", shouldBeAlive = " + shouldBeAlive);
+ if (isAlive) {
+ counterOfCheckedAlive++;
+ } else {
+ counterOfCheckedUnloaded++;
+ }
+ }
+ }
+
+ private static long numberOfChecksLimit = -1;
+
+ static {
+ String s;
+ if ((s = System.getProperty("NumberOfChecksLimit")) != null) {
+ numberOfChecksLimit = Long.valueOf(s);
+ }
+ }
+
+}
diff --git a/test/hotspot/jtreg/vmTestbase/gc/g1/unloading/check/FinalizedAssertion.java b/test/hotspot/jtreg/vmTestbase/gc/g1/unloading/check/FinalizedAssertion.java
new file mode 100644
index 0000000..0b8dfa0
--- /dev/null
+++ b/test/hotspot/jtreg/vmTestbase/gc/g1/unloading/check/FinalizedAssertion.java
@@ -0,0 +1,43 @@
+/*
+ * Copyright (c) 2014, 2018, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+package gc.g1.unloading.check;
+
+/**
+ * This assertion checks that classloader will be finalized.
+ */
+public class FinalizedAssertion extends Assertion {
+
+ private boolean finalized = false;
+
+ public void setFinalized() {
+ finalized = true;
+ }
+
+ @Override
+ public void check() {
+ if (!finalized) {
+ throw new RuntimeException("Failing test! Object wasn't finalized.");
+ }
+ }
+
+}
diff --git a/test/hotspot/jtreg/vmTestbase/gc/g1/unloading/check/PhantomizationServiceThread.java b/test/hotspot/jtreg/vmTestbase/gc/g1/unloading/check/PhantomizationServiceThread.java
new file mode 100644
index 0000000..55cf5db
--- /dev/null
+++ b/test/hotspot/jtreg/vmTestbase/gc/g1/unloading/check/PhantomizationServiceThread.java
@@ -0,0 +1,66 @@
+/*
+ * Copyright (c) 2014, 2018, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+package gc.g1.unloading.check;
+
+
+import gc.g1.unloading.ExecutionTask;
+
+import java.lang.ref.Reference;
+import java.lang.ref.ReferenceQueue;
+import java.util.*;
+
+import nsk.share.test.ExecutionController;
+
+/**
+ * This thread listens to queue of phantomized classloaders and marks corresponding assertions as passed.
+ */
+public class PhantomizationServiceThread extends ExecutionTask {
+
+ private static final int TIMEOUT = 100;
+
+ private Map<Reference<?>, PhantomizedAssertion> map = new HashMap<>();
+
+ private ReferenceQueue queue = new ReferenceQueue();
+
+ public PhantomizationServiceThread(ExecutionController executionController) {
+ super(executionController);
+ }
+
+ public void add(Reference ref, PhantomizedAssertion assertion) {
+ map.put(ref, assertion);
+ }
+
+ public ReferenceQueue getQueue() {
+ return queue;
+ }
+
+ @Override
+ protected void task() throws Exception {
+ Reference ref = queue.remove(TIMEOUT);
+ PhantomizedAssertion assertion = map.remove(ref);
+ if (assertion != null) {
+ assertion.setPhantomized();
+ }
+ }
+
+}
diff --git a/test/hotspot/jtreg/vmTestbase/gc/g1/unloading/check/PhantomizedAssertion.java b/test/hotspot/jtreg/vmTestbase/gc/g1/unloading/check/PhantomizedAssertion.java
new file mode 100644
index 0000000..4fd9b8a
--- /dev/null
+++ b/test/hotspot/jtreg/vmTestbase/gc/g1/unloading/check/PhantomizedAssertion.java
@@ -0,0 +1,43 @@
+/*
+ * Copyright (c) 2014, 2018, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+package gc.g1.unloading.check;
+
+/**
+ * This assertions checks that classloader will be phantomized.
+ */
+public class PhantomizedAssertion extends Assertion {
+
+ private boolean phantomized = false;
+
+ public void setPhantomized() {
+ phantomized = true;
+ }
+
+ @Override
+ public void check() {
+ if (!phantomized) {
+ throw new RuntimeException("Failing test! Object wasn't phantomized!");
+ }
+ }
+
+}
diff --git a/test/hotspot/jtreg/vmTestbase/gc/g1/unloading/check/cleanup/CleanupAction.java b/test/hotspot/jtreg/vmTestbase/gc/g1/unloading/check/cleanup/CleanupAction.java
new file mode 100644
index 0000000..bd01afa
--- /dev/null
+++ b/test/hotspot/jtreg/vmTestbase/gc/g1/unloading/check/cleanup/CleanupAction.java
@@ -0,0 +1,32 @@
+/*
+ * Copyright (c) 2014, 2018, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+package gc.g1.unloading.check.cleanup;
+
+/**
+ * Some classes requires cleanup after check. This is cleanup action.
+ */
+public interface CleanupAction {
+
+ public void cleanup() throws Exception;
+
+}
diff --git a/test/hotspot/jtreg/vmTestbase/gc/g1/unloading/check/cleanup/UnusedThreadKiller.java b/test/hotspot/jtreg/vmTestbase/gc/g1/unloading/check/cleanup/UnusedThreadKiller.java
new file mode 100644
index 0000000..1e06fe0
--- /dev/null
+++ b/test/hotspot/jtreg/vmTestbase/gc/g1/unloading/check/cleanup/UnusedThreadKiller.java
@@ -0,0 +1,50 @@
+/*
+ * Copyright (c) 2014, 2018, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+package gc.g1.unloading.check.cleanup;
+
+import java.lang.reflect.Method;
+
+/**
+ * This utility class helps to finish threads that are not required anymore.
+ */
+public class UnusedThreadKiller implements CleanupAction {
+
+ private long threadId;
+
+ public UnusedThreadKiller(long threadId) {
+ this.threadId = threadId;
+ }
+
+ @Override
+ public void cleanup() throws Exception {
+ for (Thread thread : Thread.getAllStackTraces().keySet()) {
+ if (thread.getId() == threadId) {
+ for (Method m : thread.getClass().getMethods()) {
+ if ("finishThread".equals(m.getName())) {
+ m.invoke(thread);
+ }
+ }
+ }
+ }
+ }
+}
diff --git a/test/hotspot/jtreg/vmTestbase/gc/g1/unloading/classloaders/DoItYourselfClassLoader.java b/test/hotspot/jtreg/vmTestbase/gc/g1/unloading/classloaders/DoItYourselfClassLoader.java
new file mode 100644
index 0000000..c4653f5
--- /dev/null
+++ b/test/hotspot/jtreg/vmTestbase/gc/g1/unloading/classloaders/DoItYourselfClassLoader.java
@@ -0,0 +1,52 @@
+/*
+ * Copyright (c) 2014, 2018, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+package gc.g1.unloading.classloaders;
+
+import java.net.MalformedURLException;
+import java.net.URL;
+import java.security.CodeSigner;
+import java.security.CodeSource;
+
+/**
+ *
+ * This is just a classloader that doesn't follow delegation pattern.
+ *
+ */
+public class DoItYourselfClassLoader extends FinalizableClassloader {
+
+ private static long counter = 0;
+
+ /**
+ * We force different classes to have different protection domains
+ */
+ public Class<?> defineClass(String name, byte[] bytes) {
+ URL url;
+ try {
+ url = new URL("http://random.url.com/" + (counter++));
+ } catch (MalformedURLException e) {
+ throw new RuntimeException("This is impossible, but there is mistake in simple call to URL constructor", e);
+ }
+ return defineClass(name, bytes, 0, bytes.length, new CodeSource(url, new CodeSigner[] {}));
+ }
+
+}
diff --git a/test/hotspot/jtreg/vmTestbase/gc/g1/unloading/classloaders/FinalizableClassloader.java b/test/hotspot/jtreg/vmTestbase/gc/g1/unloading/classloaders/FinalizableClassloader.java
new file mode 100644
index 0000000..57c7ad7
--- /dev/null
+++ b/test/hotspot/jtreg/vmTestbase/gc/g1/unloading/classloaders/FinalizableClassloader.java
@@ -0,0 +1,48 @@
+/*
+ * Copyright (c) 2014, 2018, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+package gc.g1.unloading.classloaders;
+
+import java.security.SecureClassLoader;
+
+import gc.g1.unloading.check.FinalizedAssertion;
+
+/**
+ * Classloader that keeps reference to FinalizedAssertion and marks it as passed when finalized.
+ *
+ */
+public class FinalizableClassloader extends SecureClassLoader {
+
+ private FinalizedAssertion finalizedAssertion;
+
+ public void setFinalizedAssertion(FinalizedAssertion finalizedAssertion) {
+ this.finalizedAssertion = finalizedAssertion;
+ }
+
+ @Override
+ protected void finalize() throws Throwable {
+ if (finalizedAssertion != null) {
+ finalizedAssertion.setFinalized();
+ }
+ }
+
+}
diff --git a/test/hotspot/jtreg/vmTestbase/gc/g1/unloading/classloaders/JNIClassloader.java b/test/hotspot/jtreg/vmTestbase/gc/g1/unloading/classloaders/JNIClassloader.java
new file mode 100644
index 0000000..0df44ac
--- /dev/null
+++ b/test/hotspot/jtreg/vmTestbase/gc/g1/unloading/classloaders/JNIClassloader.java
@@ -0,0 +1,40 @@
+/*
+ * Copyright (c) 2014, 2018, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+package gc.g1.unloading.classloaders;
+
+import gc.g1.unloading.loading.LibLoader;
+
+/**
+ * We don't call loadClass or defineClass methods explicitly, we invoke loadThroughJNI.
+ */
+public class JNIClassloader extends FinalizableClassloader {
+
+ static { new LibLoader().hashCode(); /* Load library*/ }
+
+ private static native Class<?> loadThroughJNI0(String className, ClassLoader classloader, byte[] bytecode);
+
+ public static Class<?> loadThroughJNI(String className, byte[] bytecode) {
+ return loadThroughJNI0(className.replace('.', '/'), new JNIClassloader(), bytecode);
+ }
+
+}
diff --git a/test/hotspot/jtreg/vmTestbase/gc/g1/unloading/classloaders/ReflectionClassloader.java b/test/hotspot/jtreg/vmTestbase/gc/g1/unloading/classloaders/ReflectionClassloader.java
new file mode 100644
index 0000000..e305190
--- /dev/null
+++ b/test/hotspot/jtreg/vmTestbase/gc/g1/unloading/classloaders/ReflectionClassloader.java
@@ -0,0 +1,49 @@
+/*
+ * Copyright (c) 2014, 2018, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+package gc.g1.unloading.classloaders;
+
+/**
+ * Classloader that will be useful for Class.forName classloading way.
+ *
+ */
+public class ReflectionClassloader extends DoItYourselfClassLoader {
+
+ private byte[] savedBytes;
+
+ private String className;
+
+ public ReflectionClassloader(byte[] savedBytes, String className) {
+ this.savedBytes = savedBytes;
+ this.className = className;
+ }
+
+ @Override
+ public Class<?> loadClass(String name) throws ClassNotFoundException {
+ if (name.equals(className)) {
+ return defineClass(name, savedBytes);
+ } else {
+ return super.loadClass(name);
+ }
+ }
+
+}
diff --git a/test/hotspot/jtreg/vmTestbase/gc/g1/unloading/configuration/ClassloadingMethod.java b/test/hotspot/jtreg/vmTestbase/gc/g1/unloading/configuration/ClassloadingMethod.java
new file mode 100644
index 0000000..ab61446
--- /dev/null
+++ b/test/hotspot/jtreg/vmTestbase/gc/g1/unloading/configuration/ClassloadingMethod.java
@@ -0,0 +1,29 @@
+/*
+ * Copyright (c) 2014, 2018, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+package gc.g1.unloading.configuration;
+
+public enum ClassloadingMethod {
+
+ PLAIN, REFLECTION, JNI, ANONYMOUS_CLASSLOADER
+
+}
diff --git a/test/hotspot/jtreg/vmTestbase/gc/g1/unloading/configuration/KeepRefMode.java b/test/hotspot/jtreg/vmTestbase/gc/g1/unloading/configuration/KeepRefMode.java
new file mode 100644
index 0000000..b984847
--- /dev/null
+++ b/test/hotspot/jtreg/vmTestbase/gc/g1/unloading/configuration/KeepRefMode.java
@@ -0,0 +1,33 @@
+/*
+ * Copyright (c) 2014, 2018, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+package gc.g1.unloading.configuration;
+
+
+/**
+ * In which way we are going to keep class from being garbage collected
+ *
+ */
+public enum KeepRefMode {
+ STRONG_REFERENCE, SOFT_REFERENCE, STATIC_FIELD, STACK_LOCAL, THREAD_FIELD, THREAD_ITSELF, STATIC_FIELD_OF_ROOT_CLASS, JNI_GLOBAL_REF, JNI_LOCAL_REF
+
+}
diff --git a/test/hotspot/jtreg/vmTestbase/gc/g1/unloading/configuration/ReleaseRefMode.java b/test/hotspot/jtreg/vmTestbase/gc/g1/unloading/configuration/ReleaseRefMode.java
new file mode 100644
index 0000000..f0f09cf
--- /dev/null
+++ b/test/hotspot/jtreg/vmTestbase/gc/g1/unloading/configuration/ReleaseRefMode.java
@@ -0,0 +1,33 @@
+/*
+ * Copyright (c) 2014, 2018, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+package gc.g1.unloading.configuration;
+
+/**
+ * What reference should we keep if we want class to be collected
+ *
+ */
+public enum ReleaseRefMode {
+
+ WEAK, PHANTOM, NONE
+
+}
diff --git a/test/hotspot/jtreg/vmTestbase/gc/g1/unloading/configuration/TestConfiguration.java b/test/hotspot/jtreg/vmTestbase/gc/g1/unloading/configuration/TestConfiguration.java
new file mode 100644
index 0000000..36be542
--- /dev/null
+++ b/test/hotspot/jtreg/vmTestbase/gc/g1/unloading/configuration/TestConfiguration.java
@@ -0,0 +1,139 @@
+/*
+ * Copyright (c) 2014, 2018, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+package gc.g1.unloading.configuration;
+
+/**
+ * Configuration object encapsulates test configuration.
+ */
+public class TestConfiguration {
+
+ private ReleaseRefMode releaseRefMode = ReleaseRefMode.NONE;
+
+ private WhatToKeep whatToKeep = WhatToKeep.CLASS;
+
+ private ClassloadingMethod classloadingMethod = ClassloadingMethod.REFLECTION;
+
+ private KeepRefMode keepRefMode = KeepRefMode.STRONG_REFERENCE;
+
+ private boolean humongousClass = false;
+
+ private int compilationLevel = 0;
+
+ private int compilationNumber = 2;
+
+ private boolean redefineClasses = false;
+
+ private boolean inMemoryCompilation = false;
+
+ public ReleaseRefMode getReleaseRefMode() {
+ return releaseRefMode;
+ }
+
+ public WhatToKeep getWhatToKeep() {
+ return whatToKeep;
+ }
+
+ public ClassloadingMethod getClassloadingMethod() {
+ return classloadingMethod;
+ }
+
+ public KeepRefMode getKeepRefMode() {
+ return keepRefMode;
+ }
+
+ public boolean isHumongousClass() {
+ return humongousClass;
+ }
+
+ public int getCompilationLevel() {
+ return compilationLevel;
+ }
+
+ public int getCompilationNumber() {
+ return compilationNumber;
+ }
+
+ public boolean isRedefineClasses() {
+ return redefineClasses;
+ }
+
+ public boolean isInMemoryCompilation() {
+ return inMemoryCompilation;
+ }
+
+ public int getNumberOfGCsBeforeCheck() {
+ return numberOfGCsBeforeCheck;
+ }
+
+ public int getNumberOfChecksLimit() {
+ return numberOfChecksLimit;
+ }
+
+ private int numberOfGCsBeforeCheck = 50;
+
+ private int numberOfChecksLimit = -1;
+
+ public static TestConfiguration createTestConfiguration(String[] args) {
+ TestConfiguration c = new TestConfiguration();
+ for (int i = 0; i < args.length; i++) {
+ if ("-referenceMode".equalsIgnoreCase(args[i])) {
+ c.releaseRefMode = ReleaseRefMode.valueOf(args[i + 1].toUpperCase());
+ } else if ("-numberOfGCsBeforeCheck".equalsIgnoreCase(args[i])) {
+ c.numberOfGCsBeforeCheck = Integer.valueOf(args[i + 1].toUpperCase());
+ } else if ("-keep".equalsIgnoreCase(args[i])) {
+ c.whatToKeep = WhatToKeep.valueOf(args[i + 1].toUpperCase());
+ } else if ("-classloadingMethod".equalsIgnoreCase(args[i])) {
+ c.classloadingMethod = ClassloadingMethod.valueOf(args[ i + 1].toUpperCase());
+ } else if ("-keepRefMode".equalsIgnoreCase(args[i])) {
+ c.keepRefMode = KeepRefMode.valueOf(args[i + 1]);
+ } else if ("-humongousClass".equalsIgnoreCase(args[i])) {
+ c.humongousClass = "true".equals(args[i + 1]);
+ } else if ("-compilationLevel".equalsIgnoreCase(args[i])) {
+ c.compilationLevel = Integer.valueOf(args[i + 1]);
+ } else if ("-compilationNumber".equalsIgnoreCase(args[i])) {
+ c.compilationNumber = Integer.valueOf(args[i + 1]);
+ } else if ("-redefineClasses".equalsIgnoreCase(args[i])) {
+ c.redefineClasses = "true".equals(args[i + 1]);
+ } else if ("-inMemoryCompilation".equalsIgnoreCase(args[i])) {
+ c.inMemoryCompilation = "true".equals(args[i + 1]);
+ } else if ("-numberOfChecksLimit".equalsIgnoreCase(args[i])) {
+ c.numberOfChecksLimit = Integer.parseInt(args[i + 1]);
+ } else if (args[i].startsWith("-") && ! "-stressTime".equals(args[i]) && ! args[i].toLowerCase().contains("seed")) {
+ System.out.println("\n\nWarning!! Unrecognized option " + args[i] + "\n\n");
+ }
+ }
+ System.out.println("releaseRefMode = " + c.releaseRefMode);
+ System.out.println("whatToKeep = " + c.whatToKeep);
+ System.out.println("classlodingMethod = " + c.classloadingMethod);
+ System.out.println("numberOfGCsBeforeCheck = " + c.numberOfGCsBeforeCheck);
+ System.out.println("keepRefMode = " + c.keepRefMode);
+ System.out.println("humongousClass = " + c.humongousClass);
+ System.out.println("compilationLevel = " + c.compilationLevel);
+ System.out.println("compilationNumber = " + c.compilationNumber);
+ System.out.println("redefineClasses = " + c.redefineClasses);
+ System.out.println("inMemoryCompilation = " + c.inMemoryCompilation);
+ System.out.println("numberOfChecksLimit = " + c.numberOfChecksLimit);
+ return c;
+ }
+
+}
diff --git a/test/hotspot/jtreg/vmTestbase/gc/g1/unloading/configuration/WhatToKeep.java b/test/hotspot/jtreg/vmTestbase/gc/g1/unloading/configuration/WhatToKeep.java
new file mode 100644
index 0000000..d0dac6d
--- /dev/null
+++ b/test/hotspot/jtreg/vmTestbase/gc/g1/unloading/configuration/WhatToKeep.java
@@ -0,0 +1,47 @@
+/*
+ * Copyright (c) 2014, 2018, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+package gc.g1.unloading.configuration;
+
+/**
+ * What reference are we going to keep
+ *
+ */
+public enum WhatToKeep {
+
+ CLASSLOADER, CLASS, OBJECT;
+
+ public Object decideUponRefToKeep(Class<?> clazz, ClassLoader classloader, Object object) {
+ switch (this) {
+ case OBJECT:
+ return object;
+ case CLASS:
+ return clazz;
+ case CLASSLOADER:
+ return classloader != null ? classloader : object;
+ default:
+ return null;
+ }
+ }
+
+
+}
diff --git a/test/hotspot/jtreg/vmTestbase/gc/g1/unloading/keepref/InStackLocalHolder.java b/test/hotspot/jtreg/vmTestbase/gc/g1/unloading/keepref/InStackLocalHolder.java
new file mode 100644
index 0000000..f75acf8
--- /dev/null
+++ b/test/hotspot/jtreg/vmTestbase/gc/g1/unloading/keepref/InStackLocalHolder.java
@@ -0,0 +1,95 @@
+/*
+ * Copyright (c) 2014, 2018, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+package gc.g1.unloading.keepref;
+
+import gc.g1.unloading.check.cleanup.UnusedThreadKiller;
+
+/**
+ * This holder prevents class from being unloaded by keeping reference in stack local.
+ *
+ */
+public class InStackLocalHolder implements RefHolder {
+
+ public static class AuxiliaryThread extends Thread {
+ private static final int STACK_DEPTH = 300;
+
+ private ReferenceHolder referenceHolder;
+
+ public AuxiliaryThread(ReferenceHolder referenceHolder) {
+ this.referenceHolder = referenceHolder;
+ }
+
+ synchronized public void finishThread() {
+ notifyAll();
+ }
+
+ @Override
+ synchronized public void run() {
+ new A().call(referenceHolder, STACK_DEPTH);
+ }
+ }
+
+ private static class A {
+ public void call(ReferenceHolder holder, int stackDepth) {
+ if (stackDepth > 0) {
+ new A().call(holder, stackDepth - 1);
+ } else {
+ Object ref = holder.obtainAndClear();
+ synchronized (Thread.currentThread()) {
+ try {
+ Thread.currentThread().wait();
+ if (ref.hashCode() == 42) {
+ System.out.println("This clause is made to prevent compiler and javac optimizations from eliminating local reference \"ref\".");
+ }
+ } catch (InterruptedException e) {
+ new RuntimeException("Unexpected InterruptedException");
+ }
+ }
+ }
+ }
+ }
+
+ private static class ReferenceHolder {
+ private Object reference;
+
+ public ReferenceHolder(Object reference) {
+ this.reference = reference;
+ }
+
+ public Object obtainAndClear() {
+ Object returnValue = reference;
+ reference = new Object();
+ return returnValue;
+ }
+
+ }
+
+ @Override
+ public Object hold(Object object) {
+ Thread thread = new AuxiliaryThread(new ReferenceHolder(object));
+ thread.setDaemon(true);
+ thread.start();
+ return new UnusedThreadKiller(thread.getId());
+ }
+
+}
diff --git a/test/hotspot/jtreg/vmTestbase/gc/g1/unloading/keepref/InStaticFieldHolder.java b/test/hotspot/jtreg/vmTestbase/gc/g1/unloading/keepref/InStaticFieldHolder.java
new file mode 100644
index 0000000..7c7ec51
--- /dev/null
+++ b/test/hotspot/jtreg/vmTestbase/gc/g1/unloading/keepref/InStaticFieldHolder.java
@@ -0,0 +1,64 @@
+/*
+ * Copyright (c) 2014, 2018, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+package gc.g1.unloading.keepref;
+
+import gc.g1.unloading.bytecode.BytecodeMutatorFactory;
+import gc.g1.unloading.bytecode.TemplateClassWithStaticField;
+import gc.g1.unloading.classloaders.DoItYourselfClassLoader;
+
+import java.lang.reflect.InvocationTargetException;
+import java.lang.reflect.Method;
+import java.util.concurrent.atomic.AtomicLong;
+
+/**
+ * This holder prevents class from being collected by keeping link in static field of another class.
+ *
+ */
+public class InStaticFieldHolder implements RefHolder {
+
+ private static BytecodeMutatorFactory bm = new BytecodeMutatorFactory(TemplateClassWithStaticField.class.getName());
+
+ private static final String CLASS_NAME_BASE = "StaticFieldHolder_";
+
+ private static AtomicLong counter = new AtomicLong(0);
+
+ @Override
+ public Object hold(Object object) {
+ try {
+ String className = bm.padName(CLASS_NAME_BASE + counter.getAndIncrement());
+ byte[] bytecode = bm.getBytecode(className);
+ DoItYourselfClassLoader loader = new DoItYourselfClassLoader();
+ Class<?> clazz = loader.defineClass(className, bytecode);
+ for (Method m : clazz.getMethods()) {
+ if ("setField".equals(m.getName())) {
+ m.invoke(null, object);
+ }
+ }
+ Object instance = clazz.newInstance();
+ return instance;
+ } catch (InstantiationException | IllegalAccessException | IllegalArgumentException | InvocationTargetException e) {
+ throw new RuntimeException("Something went wrong in StaticFieldHolder ", e);
+ }
+ }
+
+}
diff --git a/test/hotspot/jtreg/vmTestbase/gc/g1/unloading/keepref/InThreadFieldHolder.java b/test/hotspot/jtreg/vmTestbase/gc/g1/unloading/keepref/InThreadFieldHolder.java
new file mode 100644
index 0000000..2d1da7c
--- /dev/null
+++ b/test/hotspot/jtreg/vmTestbase/gc/g1/unloading/keepref/InThreadFieldHolder.java
@@ -0,0 +1,62 @@
+/*
+ * Copyright (c) 2014, 2018, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+package gc.g1.unloading.keepref;
+
+import gc.g1.unloading.check.cleanup.UnusedThreadKiller;
+
+/**
+ * This holder prevents class from being collected by keeping link in static field of running thread.
+ *
+ */
+public class InThreadFieldHolder implements RefHolder {
+
+ public static class AuxiliaryThread2 extends Thread {
+ private Object ref;
+
+ public AuxiliaryThread2(Object ref) {
+ this.ref = ref;
+ }
+
+ synchronized public void finishThread() {
+ notifyAll();
+ }
+
+ @Override
+ synchronized public void run() {
+ try {
+ wait();
+ } catch (InterruptedException e) {
+ throw new RuntimeException("Unexpected InterruptedException ", e);
+ }
+ }
+ }
+
+ @Override
+ public Object hold(Object object) {
+ Thread thread = new AuxiliaryThread2(object);
+ thread.setDaemon(true);
+ thread.start();
+ return new UnusedThreadKiller(thread.getId());
+ }
+
+}
diff --git a/test/hotspot/jtreg/vmTestbase/gc/g1/unloading/keepref/JNIGlobalRefHolder.java b/test/hotspot/jtreg/vmTestbase/gc/g1/unloading/keepref/JNIGlobalRefHolder.java
new file mode 100644
index 0000000..75236c3
--- /dev/null
+++ b/test/hotspot/jtreg/vmTestbase/gc/g1/unloading/keepref/JNIGlobalRefHolder.java
@@ -0,0 +1,55 @@
+/*
+ * Copyright (c) 2014, 2018, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+package gc.g1.unloading.keepref;
+
+import gc.g1.unloading.check.cleanup.CleanupAction;
+import gc.g1.unloading.loading.LibLoader;
+
+/**
+ * This holder keeps reference through JNI global reference.
+ */
+public class JNIGlobalRefHolder implements RefHolder {
+
+ static {
+ //Force loading library
+ new LibLoader().hashCode();
+ }
+
+ public static native int keepGlobalJNIReference(Object object);
+
+ public static native void deleteGlobalJNIReference(int index);
+
+ @Override
+ public Object hold(Object object) {
+ final Integer index = keepGlobalJNIReference(object);
+ return new CleanupAction() {
+ @Override
+ public void cleanup() throws Exception {
+ // Clenup global reference when it's not needed anymore
+ JNIGlobalRefHolder.deleteGlobalJNIReference(index);
+ }
+ };
+
+ }
+
+}
diff --git a/test/hotspot/jtreg/vmTestbase/gc/g1/unloading/keepref/JNILocalRefHolder.java b/test/hotspot/jtreg/vmTestbase/gc/g1/unloading/keepref/JNILocalRefHolder.java
new file mode 100644
index 0000000..3be7b5d
--- /dev/null
+++ b/test/hotspot/jtreg/vmTestbase/gc/g1/unloading/keepref/JNILocalRefHolder.java
@@ -0,0 +1,69 @@
+/*
+ * Copyright (c) 2014, 2018, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+package gc.g1.unloading.keepref;
+
+import gc.g1.unloading.check.cleanup.CleanupAction;
+import gc.g1.unloading.loading.LibLoader;
+
+/**
+ * This holder keeps reference through JNI local reference.
+ */
+public class JNILocalRefHolder implements RefHolder {
+
+ static {
+ //Force loading library
+ new LibLoader().hashCode();
+ }
+
+ // We use this field to transfer object into native JNI call. Idea is to avoid transferring link through method
+ // arguments.
+ private Object objectToKeep;
+
+ private native void holdWithJNILocalReference(Object syncObject);
+
+ @Override
+ public Object hold(Object object) {
+ objectToKeep = object;
+ final Object syncObject = new Object();
+ Thread keepingThread = new Thread(new Runnable() {
+ @Override
+ public void run() {
+ synchronized (syncObject) {
+ holdWithJNILocalReference(syncObject);
+ }
+ }
+ });
+ keepingThread.setDaemon(true);
+ keepingThread.start();
+ return new CleanupAction() {
+ @Override
+ public void cleanup() throws Exception {
+ synchronized (syncObject) {
+ syncObject.notify();
+ }
+ }
+ };
+ }
+
+
+}
diff --git a/test/hotspot/jtreg/vmTestbase/gc/g1/unloading/keepref/NullClassloaderHolder.java b/test/hotspot/jtreg/vmTestbase/gc/g1/unloading/keepref/NullClassloaderHolder.java
new file mode 100644
index 0000000..9c4e408
--- /dev/null
+++ b/test/hotspot/jtreg/vmTestbase/gc/g1/unloading/keepref/NullClassloaderHolder.java
@@ -0,0 +1,79 @@
+/*
+ * Copyright (c) 2014, 2018, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+package gc.g1.unloading.keepref;
+
+import java.lang.reflect.*;
+import java.util.*;
+
+/**
+ * This holder keeps class from being collected by saving link in static field of class loaded by null classloader.
+ * It uses pool of classes that should reside in bootclasspath.
+ */
+public class NullClassloaderHolder implements RefHolder {
+
+ private static final int NUMBER_OF_CLASSES = 1000;
+ private static Set<Class<?>> classesPool = Collections.synchronizedSet(new HashSet<Class<?>>());
+
+ static {
+ for (int i = 1; i <= NUMBER_OF_CLASSES; i++) {
+ String className = "gc.g1.unloading.rootSetHelper.classesPool.Class" + i;
+ try {
+ Class<?> clazz = Class.forName(className);
+ if (clazz.getClassLoader() != null) {
+ throw new RuntimeException("Test bug! Classes from pool implied to be loaded by bootclassloader.");
+ }
+ classesPool.add(clazz);
+ } catch (ClassNotFoundException e) {
+ throw new RuntimeException("Test bug", e);
+ }
+ }
+ }
+
+ @Override
+ public Object hold(Object object) {
+ if (classesPool.isEmpty()) {
+ return null;
+ } else {
+ Class<?> clazz = (Class<?>) classesPool.iterator().next();
+ classesPool.remove(clazz);
+ Field f = getRandomField(clazz);
+ try {
+ f.set(null, object);
+ return clazz.newInstance();
+ } catch (IllegalArgumentException | IllegalAccessException | InstantiationException e) {
+ throw new RuntimeException("Test bug", e);
+ }
+ }
+ }
+
+ private static Field getRandomField(Class<?> clazz) {
+ ArrayList<Field> fields = new ArrayList<>();
+ for (Field f : clazz.getFields()) {
+ if (f.getName().startsWith("staticField")) {
+ fields.add(f);
+ }
+ }
+ return fields.get(new Random().nextInt(fields.size()));
+ }
+
+}
diff --git a/test/hotspot/jtreg/vmTestbase/gc/g1/unloading/keepref/RefHolder.java b/test/hotspot/jtreg/vmTestbase/gc/g1/unloading/keepref/RefHolder.java
new file mode 100644
index 0000000..9f1b90c
--- /dev/null
+++ b/test/hotspot/jtreg/vmTestbase/gc/g1/unloading/keepref/RefHolder.java
@@ -0,0 +1,39 @@
+/*
+ * Copyright (c) 2014, 2018, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+package gc.g1.unloading.keepref;
+
+/**
+ * Classes implementing this interface hold reference to object in different ways. This is done to prevent something of being garbage collected/unloaded.
+ *
+ */
+public interface RefHolder {
+
+ /**
+ * This method keeps reference to object in different ways.
+ *
+ * @param object
+ * @return object that should be kept reference to (if any)
+ */
+ Object hold(Object object);
+
+}
diff --git a/test/hotspot/jtreg/vmTestbase/gc/g1/unloading/libdefine.c b/test/hotspot/jtreg/vmTestbase/gc/g1/unloading/libdefine.c
new file mode 100644
index 0000000..b15f182
--- /dev/null
+++ b/test/hotspot/jtreg/vmTestbase/gc/g1/unloading/libdefine.c
@@ -0,0 +1,194 @@
+/*
+ * Copyright (c) 2014, 2018, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * 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.
+ */
+#include <jni.h>
+#include <stdio.h>
+
+#include <string.h>
+#include <jvmti.h>
+
+#define STATUS_FAILED 2
+#define STATUS_PASSED 0
+
+#define REFERENCES_ARRAY_SIZE 10000000
+
+#ifndef JNI_ENV_ARG
+
+#ifdef __cplusplus
+#define JNI_ENV_ARG(x, y) x
+#define JNI_ENV_PTR(x) x
+#else
+#define JNI_ENV_ARG(x, y) x , y
+#define JNI_ENV_PTR(x) (*x)
+#endif
+
+#endif
+
+#ifndef _Included_gc_g1_unloading_unloading_classloaders_JNIClassloader
+#define _Included_gc_g1_unloading_unloading_classloaders_JNIClassloader
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/*
+ * Class: gc_g1_unloading_unloading_classloaders_JNIClassloader
+ * Method: loadThroughJNI0
+ * Signature: (Ljava/lang/String;Ljava/lang/ClassLoader;[B)Ljava/lang/Class;
+ */
+JNIEXPORT jclass JNICALL Java_gc_g1_unloading_classloaders_JNIClassloader_loadThroughJNI0 (JNIEnv * env,
+ jclass clazz, jstring className, jobject classLoader, jbyteArray bytecode) {
+
+ const char * classNameChar = JNI_ENV_PTR(env)->GetStringUTFChars(JNI_ENV_ARG(env, className), NULL);
+ jbyte * arrayContent = JNI_ENV_PTR(env)->GetByteArrayElements(JNI_ENV_ARG(env, bytecode), NULL);
+ jsize bytecodeLength = JNI_ENV_PTR(env)->GetArrayLength(JNI_ENV_ARG(env, bytecode));
+ jclass returnValue = JNI_ENV_PTR(env)->DefineClass(JNI_ENV_ARG(env, classNameChar), classLoader, arrayContent, bytecodeLength);
+ if (!returnValue) {
+ printf("ERROR: DefineClass call returned NULL by some reason. Classloading failed.\n");
+ }
+
+ return returnValue;
+}
+
+ /*
+ * Class: gc_g1_unloading_unloading_loading_ClassLoadingThread
+ * Method: makeRedefinition0
+ * Signature: (ILjava/lang/Class;[B)I
+ */
+JNIEXPORT jint JNICALL Java_gc_g1_unloading_loading_ClassLoadingThread_makeRedefinition0(JNIEnv *env,
+ jclass cls, jint fl, jclass redefCls, jbyteArray classBytes) {
+ JavaVM * jvm;
+ jvmtiEnv * jvmti;
+ jvmtiError err;
+ jvmtiCapabilities caps;
+ jvmtiClassDefinition classDef;
+ jint jint_err = JNI_ENV_PTR(env)->GetJavaVM(JNI_ENV_ARG(env, &jvm));
+ if (jint_err) {
+ printf("GetJavaVM returned nonzero: %d", jint_err);
+ return STATUS_FAILED;
+ }
+
+ jint_err = JNI_ENV_PTR(jvm)->GetEnv(JNI_ENV_ARG(jvm, (void **)&jvmti), JVMTI_VERSION_1_0);
+ if (jint_err) {
+ printf("GetEnv returned nonzero: %d", jint_err);
+ return STATUS_FAILED;
+ }
+
+ err = JNI_ENV_PTR(jvmti)->GetPotentialCapabilities(JNI_ENV_ARG(jvmti, &caps));
+ if (err != JVMTI_ERROR_NONE) {
+ printf("(GetPotentialCapabilities) unexpected error: %d\n",err);
+ return JNI_ERR;
+ }
+
+ err = JNI_ENV_PTR(jvmti)->AddCapabilities(JNI_ENV_ARG(jvmti, &caps));
+ if (err != JVMTI_ERROR_NONE) {
+ printf("(AddCapabilities) unexpected error: %d\n", err);
+ return JNI_ERR;
+ }
+
+ if (!caps.can_redefine_classes) {
+ printf("ERROR: Can't redefine classes. jvmtiCapabilities.can_redefine_classes isn't set up.");
+ return STATUS_FAILED;
+ }
+
+ classDef.klass = redefCls;
+ classDef.class_byte_count =
+ JNI_ENV_PTR(env)->GetArrayLength(JNI_ENV_ARG(env, classBytes));
+ classDef.class_bytes = (unsigned char *)
+ JNI_ENV_PTR(env)->GetByteArrayElements(JNI_ENV_ARG(env, classBytes),
+ NULL);
+
+ if (fl == 2) {
+ printf(">>>>>>>> Invoke RedefineClasses():\n");
+ printf("\tnew class byte count=%d\n", classDef.class_byte_count);
+ }
+ err = JNI_ENV_PTR(jvmti)->RedefineClasses(JNI_ENV_ARG(jvmti, 1), &classDef);
+ if (err != JVMTI_ERROR_NONE) {
+ printf("%s: Failed to call RedefineClasses():\n", __FILE__);
+ printf("\tthe function returned error %d\n", err);
+ printf("\tFor more info about this error see the JVMTI spec.\n");
+ return STATUS_FAILED;
+ }
+ if (fl == 2)
+ printf("<<<<<<<< RedefineClasses() is successfully done\n");
+
+ return STATUS_PASSED;
+}
+
+jobject referencesArray[REFERENCES_ARRAY_SIZE];
+int firstFreeIndex = 0;
+
+/*
+ * Class: gc_g1_unloading_unloading_keepref_JNIGlobalRefHolder
+ * Method: keepGlobalJNIReference
+ * Signature: (Ljava/lang/Object;)I
+ */
+JNIEXPORT jint JNICALL Java_gc_g1_unloading_keepref_JNIGlobalRefHolder_keepGlobalJNIReference
+ (JNIEnv * env, jclass clazz, jobject obj) {
+ int returnValue;
+ referencesArray[firstFreeIndex] = JNI_ENV_PTR(env)->NewGlobalRef(JNI_ENV_ARG(env, obj));
+ printf("checkpoint1 %d \n", firstFreeIndex);
+ returnValue = firstFreeIndex;
+ firstFreeIndex++;
+ return returnValue;
+}
+
+/*
+ * Class: gc_g1_unloading_unloading_keepref_JNIGlobalRefHolder
+ * Method: deleteGlobalJNIReference
+ * Signature: (I)V
+ */
+JNIEXPORT void JNICALL Java_gc_g1_unloading_keepref_JNIGlobalRefHolder_deleteGlobalJNIReference
+ (JNIEnv * env, jclass clazz, jint index) {
+ JNI_ENV_PTR(env)->DeleteGlobalRef(JNI_ENV_ARG(env, referencesArray[index]));
+}
+
+
+/*
+ * Class: gc_g1_unloading_unloading_keepref_JNILocalRefHolder
+ * Method: holdWithJNILocalReference
+ * Signature: (Ljava/lang/Object;)V
+ */
+JNIEXPORT void JNICALL Java_gc_g1_unloading_keepref_JNILocalRefHolder_holdWithJNILocalReference
+ (JNIEnv * env, jobject thisObject, jobject syncObject) {
+ jclass clazz, objectClazz;
+ jfieldID objectToKeepField;
+ jobject objectToKeep, localRef;
+ jmethodID waitMethod;
+
+ clazz = (*env)->GetObjectClass(env, thisObject);
+ objectToKeepField = (*env)->GetFieldID(env, clazz, "objectToKeep", "Ljava/lang/Object;");
+ objectToKeep = (*env)->GetObjectField(env, thisObject, objectToKeepField);
+ localRef = (*env)->NewLocalRef(env, objectToKeep);
+ (*env)->SetObjectField(env, thisObject, objectToKeepField, NULL);
+
+ objectClazz = (*env)->FindClass(env, "Ljava/lang/Object;");
+ waitMethod = (*env)->GetMethodID(env, objectClazz, "wait", "()V");
+ (*env)->CallVoidMethod(env, syncObject, waitMethod);
+ printf("checkpoint2 \n");
+ }
+
+
+#ifdef __cplusplus
+}
+#endif
+#endif
diff --git a/test/hotspot/jtreg/vmTestbase/gc/g1/unloading/loading/ClassLoadingHelper.java b/test/hotspot/jtreg/vmTestbase/gc/g1/unloading/loading/ClassLoadingHelper.java
new file mode 100644
index 0000000..f570d8b
--- /dev/null
+++ b/test/hotspot/jtreg/vmTestbase/gc/g1/unloading/loading/ClassLoadingHelper.java
@@ -0,0 +1,349 @@
+/*
+ * Copyright (c) 2014, 2018, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+package gc.g1.unloading.loading;
+
+import gc.g1.unloading.ExecutionTask;
+import gc.g1.unloading.bytecode.*;
+//import gc.g1.unloading.check.*;
+import gc.g1.unloading.check.Assertion;
+import gc.g1.unloading.check.ClassAssertion;
+import gc.g1.unloading.check.PhantomizedAssertion;
+
+import gc.g1.unloading.check.FinalizedAssertion;
+import gc.g1.unloading.check.PhantomizationServiceThread;
+import gc.g1.unloading.check.cleanup.UnusedThreadKiller;
+import gc.g1.unloading.classloaders.DoItYourselfClassLoader;
+import gc.g1.unloading.classloaders.FinalizableClassloader;
+import gc.g1.unloading.classloaders.JNIClassloader;
+import gc.g1.unloading.classloaders.ReflectionClassloader;
+import gc.g1.unloading.configuration.ClassloadingMethod;
+import gc.g1.unloading.configuration.KeepRefMode;
+import gc.g1.unloading.configuration.TestConfiguration;
+import gc.g1.unloading.keepref.*;
+import nsk.share.test.ExecutionController;
+import sun.hotspot.WhiteBox;
+import jdk.internal.misc.Unsafe;
+
+import java.lang.ref.*;
+import java.lang.reflect.Field;
+import java.lang.reflect.InvocationTargetException;
+import java.lang.reflect.Method;
+import java.util.Collection;
+import java.util.LinkedList;
+import java.util.Random;
+
+/**
+ * This helper performs dirty job: loads classes, instantiate objects, performs redefinition etc...
+ */
+public class ClassLoadingHelper {
+
+ private static final int NATIVE_VERBOSITY = 2;
+
+ private static final Object[] NO_CP_PATCHES = new Object[0];
+
+ private static BytecodeFactory bf;
+
+ private ExecutionController executionController;
+
+ private PhantomizationServiceThread phantomizationServiceThread;
+
+ private Random random;
+
+ private TestConfiguration configuration;
+
+ /**
+ * Constructor that creates instance of helper. All arguments are self-explaining.
+ * @param executionController
+ * @param randomSeed
+ * @param testConfiguration
+ */
+ public ClassLoadingHelper(ExecutionController executionController,
+ long randomSeed, TestConfiguration testConfiguration) {
+ random = new Random(randomSeed);
+ this.executionController = executionController;
+ this.configuration = testConfiguration;
+
+ phantomizationServiceThread = new PhantomizationServiceThread(executionController);
+ Thread thread = new Thread(phantomizationServiceThread);
+ thread.setDaemon(true);
+ thread.start();
+
+ if (configuration.isInMemoryCompilation() && !configuration.isHumongousClass() && !(configuration.getKeepRefMode() == KeepRefMode.THREAD_ITSELF)) {
+ bf = new BytecodeGeneratorFactory(random.nextLong());
+ } else {
+ if (configuration.isHumongousClass()) {
+ bf = new BytecodeMutatorFactory(HumongousTemplateClass.class.getName());
+ } else if (configuration.getKeepRefMode() == KeepRefMode.THREAD_ITSELF) {
+ bf = new BytecodeMutatorFactory(ThreadTemplateClass.class.getName());
+ } else {
+ bf = new BytecodeMutatorFactory();
+ }
+ }
+ }
+
+ /**
+ * Load class that's supposed to live. Method returns collection of assertions to check it will live.
+ * @param className_
+ * @return
+ */
+ public Collection<Assertion> loadClassThatGonnaLive(String className_) {
+ Bytecode kit = bf.createBytecode(className_);
+ String className = kit.getClassName();
+ byte[] bytecode = kit.getBytecode();
+ Class<?> clazz = loadClass(className, bytecode);
+ Object object = instantiateObject(clazz);
+ Object referenceToKeep = configuration.getWhatToKeep().decideUponRefToKeep(clazz, clazz.getClassLoader(), object);
+
+ redefineIfNeeded(bytecode, clazz);
+
+ warmUpClassIfNeeded(object);
+ Assertion assertion;
+ // The JVM prepends the host class's package to the anonymous class name.
+ if (configuration.getClassloadingMethod() != ClassloadingMethod.ANONYMOUS_CLASSLOADER) {
+ assertion = new ClassAssertion(className, true);
+ } else {
+ assertion = new ClassAssertion("gc/g1/unloading/loading/" + className, true);
+ }
+ switch (configuration.getKeepRefMode()) {
+ case STRONG_REFERENCE:
+ assertion.keepLink(referenceToKeep);
+ break;
+ case SOFT_REFERENCE:
+ assertion.keepLink(new SoftReference<Object>(referenceToKeep));
+ break;
+ case STATIC_FIELD:
+ RefHolder holder1 = new InStaticFieldHolder();
+ assertion.keepLink(holder1.hold(referenceToKeep));
+ break;
+ case STACK_LOCAL:
+ RefHolder holder2 = new InStackLocalHolder(); // UnusedThreadKiller
+ assertion.keepLink(holder2.hold(referenceToKeep));
+ break;
+ case THREAD_FIELD:
+ RefHolder holder3 = new InThreadFieldHolder(); // UnusedThreadKiller
+ assertion.keepLink(holder3.hold(referenceToKeep));
+ break;
+ case THREAD_ITSELF:
+ Thread objectThread = (Thread) object;
+ objectThread.setDaemon(true);
+ objectThread.start();
+ assertion.keepLink(new UnusedThreadKiller(objectThread.getId())); // UnusedThreadKiller
+ break;
+ case STATIC_FIELD_OF_ROOT_CLASS:
+ RefHolder holder4 = new NullClassloaderHolder();
+ Object keep = holder4.hold(referenceToKeep);
+ if (keep != null) {
+ assertion.keepLink(keep);
+ }
+ break;
+ case JNI_GLOBAL_REF:
+ JNIGlobalRefHolder holder5 = new JNIGlobalRefHolder();
+ assertion.keepLink(holder5.hold(referenceToKeep));
+ break;
+ case JNI_LOCAL_REF:
+ JNILocalRefHolder holder6 = new JNILocalRefHolder();
+ assertion.keepLink(holder6.hold(referenceToKeep));
+ break;
+ }
+
+ Collection<Assertion> returnValue = new LinkedList<>();
+ returnValue.add(assertion);
+ return returnValue;
+ }
+
+ /**
+ * Load class that's supposed to be unloaded. Method returns collection of assertions to check it will be unloaded.
+ * @param className_
+ * @return
+ */
+ public Collection<Assertion> loadClassThatGonnaDie(String className_) {
+ Collection<Assertion> returnValue = new LinkedList<>();
+ Bytecode kit = bf.createBytecode(className_);
+ String className = kit.getClassName();
+ byte[] bytecode = kit.getBytecode();
+ Class<?> clazz = loadClass(className, bytecode);
+ FinalizableClassloader cl = null;
+ if (clazz.getClassLoader() instanceof FinalizableClassloader) {
+ cl = (FinalizableClassloader) clazz.getClassLoader();
+ }
+ Object object = instantiateObject(clazz);
+ Object referenceToKeep = configuration.getWhatToKeep().decideUponRefToKeep(clazz, clazz.getClassLoader(), object);
+
+ redefineIfNeeded(bytecode, clazz);
+
+ warmUpClassIfNeeded(object);
+ Assertion assertion;
+ // The JVM prepends the host class's package to the anonymous class name.
+ if (configuration.getClassloadingMethod() != ClassloadingMethod.ANONYMOUS_CLASSLOADER) {
+ assertion = new ClassAssertion(className, false);
+ } else {
+ assertion = new ClassAssertion("gc/g1/unloading/loading/" + className, false);
+ }
+ switch (configuration.getReleaseRefMode()) {
+ case WEAK:
+ assertion.keepLink(new WeakReference<Object>(referenceToKeep));
+ break;
+ case PHANTOM:
+ final ReferenceQueue queue = new ReferenceQueue<Object>();
+ assertion.keepLink(new PhantomReference<Object>(referenceToKeep, queue));
+ new Thread(new ReferenceCleaningThread(executionController, queue)).start();
+ break;
+ }
+ returnValue.add(assertion);
+
+ if (cl != null) {
+ // Check that classloader will be finalized
+ FinalizedAssertion finalizedAssertion = new FinalizedAssertion();
+ cl.setFinalizedAssertion(finalizedAssertion);
+ returnValue.add(finalizedAssertion);
+
+ // Check that classloader will be phantomized
+ PhantomizedAssertion phantomizedAssertion = new PhantomizedAssertion();
+ PhantomReference phantomReference = new PhantomReference<Object>(cl, phantomizationServiceThread.getQueue());
+ phantomizationServiceThread.add(phantomReference, phantomizedAssertion);
+ returnValue.add(phantomizedAssertion);
+ }
+ return returnValue;
+ }
+
+ private void redefineIfNeeded(byte[] bytecode, Class<?> clazz) {
+ if (configuration.isRedefineClasses()) {
+ BytecodePatcher.patch(bytecode);
+ makeRedefinition(NATIVE_VERBOSITY, clazz, bytecode);
+
+ // This will call class's method
+ instantiateObject(clazz);
+ }
+ }
+
+ private Class<?> loadClass(String className, byte[] bytecode) {
+ try {
+ switch (configuration.getClassloadingMethod()) {
+ case PLAIN:
+ DoItYourselfClassLoader loader1 = new DoItYourselfClassLoader();
+ return loader1.defineClass(className, bytecode);
+ case REFLECTION:
+ return Class.forName(className, true, new ReflectionClassloader(bytecode, className));
+ case JNI:
+ return JNIClassloader.loadThroughJNI(className, bytecode);
+ case ANONYMOUS_CLASSLOADER:
+ return getUnsafe().defineAnonymousClass(ClassLoadingHelper.class, bytecode, NO_CP_PATCHES);
+ }
+ return null;
+ } catch (ClassNotFoundException e) {
+ throw new RuntimeException("Test bug!", e);
+ }
+ }
+
+ private Object instantiateObject(Class<?> clazz) {
+ try {
+ Object object = clazz.newInstance();
+
+ // Call method just for fun
+ for (Method m : clazz.getMethods()) {
+ if (m.getName().equals("main")) {
+ m.invoke(object);
+ }
+ }
+ return object;
+ } catch (InstantiationException | IllegalAccessException | IllegalArgumentException | InvocationTargetException e) {
+ throw new RuntimeException("Test bug!", e);
+ }
+ }
+
+ private void warmUpClassIfNeeded(Object object) {
+ if (configuration.getCompilationLevel() < 1 || configuration.getCompilationNumber() == 0) {
+ return;
+ }
+ Method m = null;
+ for (Method method : object.getClass().getMethods()) {
+ if (method.getName().equalsIgnoreCase("methodForCompilation")) {
+ m = method;
+ }
+ }
+ WhiteBox wb = WhiteBox.getWhiteBox();
+ if (!wb.isMethodCompilable(m)) {
+ throw new RuntimeException("Test bug! Method occured to be not compilable. Requires investigation.");
+ }
+
+ for (int i = configuration.getCompilationNumber(); i >= 0 && executionController.continueExecution(); i--) {
+ if (!wb.isMethodCompilable(m, configuration.getCompilationLevel())) {
+ continue;
+ }
+ wb.enqueueMethodForCompilation(m, configuration.getCompilationLevel());
+ while (!wb.isMethodCompiled(m) && executionController.continueExecution()) {
+ sleep(50);
+ try {
+ m.invoke(object, new Object());
+ } catch (IllegalAccessException | IllegalArgumentException | InvocationTargetException e) {
+ throw new RuntimeException("Something went wrong while compilation", e);
+ }
+ }
+ if (i > 0) {
+ wb.deoptimizeMethod(m);
+ }
+ }
+ }
+
+ native static int makeRedefinition0(int verbose, Class<?> redefClass, byte[] classBytes);
+
+ private static void makeRedefinition(int verbose, Class<?> redefClass, byte[] classBytes) {
+ new LibLoader().hashCode();
+ if (makeRedefinition0(verbose, redefClass, classBytes) != 0) {
+ throw new RuntimeException("Test bug: native method \"makeRedefinition\" return nonzero");
+ }
+ }
+
+ private static void sleep(long millis) {
+ try {
+ Thread.sleep(millis);
+ } catch (InterruptedException e) {
+ throw new RuntimeException("Got InterruptedException while sleeping.", e);
+ }
+ }
+
+ private static Unsafe getUnsafe() {
+ return Unsafe.getUnsafe();
+ }
+
+}
+
+class ReferenceCleaningThread extends ExecutionTask {
+
+ private ReferenceQueue<?> queue;
+
+ public ReferenceCleaningThread(ExecutionController executionController, ReferenceQueue<?> queue) {
+ super(executionController);
+ this.queue = queue;
+ }
+
+ @Override
+ protected void task() throws Exception {
+ Reference<?> ref = queue.remove(100);
+ if (ref != null) {
+ ref.clear();
+ return;
+ }
+ }
+
+}
diff --git a/test/hotspot/jtreg/vmTestbase/gc/g1/unloading/loading/LibLoader.java b/test/hotspot/jtreg/vmTestbase/gc/g1/unloading/loading/LibLoader.java
new file mode 100644
index 0000000..cd4e999
--- /dev/null
+++ b/test/hotspot/jtreg/vmTestbase/gc/g1/unloading/loading/LibLoader.java
@@ -0,0 +1,37 @@
+/*
+ * Copyright (c) 2014, 2018, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+package gc.g1.unloading.loading;
+
+public class LibLoader {
+
+ static {
+ try {
+ System.loadLibrary("define");
+ } catch (UnsatisfiedLinkError e) {
+ System.err.println("Could not load \"define\" library");
+ System.err.println("java.library.path:" + System.getProperty("java.library.path"));
+ throw e;
+ }
+ }
+
+}
diff --git a/test/hotspot/jtreg/vmTestbase/gc/g1/unloading/tests/unloading_anonclassloader_inMemoryCompilation_keep_class/TEST.properties b/test/hotspot/jtreg/vmTestbase/gc/g1/unloading/tests/unloading_anonclassloader_inMemoryCompilation_keep_class/TEST.properties
new file mode 100644
index 0000000..04b22a1
--- /dev/null
+++ b/test/hotspot/jtreg/vmTestbase/gc/g1/unloading/tests/unloading_anonclassloader_inMemoryCompilation_keep_class/TEST.properties
@@ -0,0 +1,23 @@
+#
+# 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/g1/unloading/tests/unloading_anonclassloader_inMemoryCompilation_keep_class/TestDescription.java b/test/hotspot/jtreg/vmTestbase/gc/g1/unloading/tests/unloading_anonclassloader_inMemoryCompilation_keep_class/TestDescription.java
new file mode 100644
index 0000000..8cea250
--- /dev/null
+++ b/test/hotspot/jtreg/vmTestbase/gc/g1/unloading/tests/unloading_anonclassloader_inMemoryCompilation_keep_class/TestDescription.java
@@ -0,0 +1,67 @@
+/*
+ * 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.
+ */
+
+
+/*
+ * @test
+ * @modules java.base/jdk.internal.misc:+open
+ * @key stress gc
+ *
+ * @summary converted from VM Testbase gc/g1/unloading/tests/unloading_anonclassloader_inMemoryCompilation_keep_class.
+ * VM Testbase keywords: [gc, stress, stressopt, nonconcurrent, javac]
+ *
+ * @modules java.base/jdk.internal.misc
+ * @library /vmTestbase
+ * /test/lib
+ *
+ * @run driver jdk.test.lib.FileInstaller . .
+ *
+ * @comment generate HumongousTemplateClass and compile it to test.classes
+ * @run driver gc.g1.unloading.bytecode.GenClassesBuilder
+ *
+ * @build sun.hotspot.WhiteBox
+ * @run driver ClassFileInstaller sun.hotspot.WhiteBox
+ * sun.hotspot.WhiteBox$WhiteBoxPermission
+ * @run main/othervm
+ * -Xbootclasspath/a:.
+ * -XX:+UnlockDiagnosticVMOptions
+ * -XX:+WhiteBoxAPI
+ * -XX:+UseG1GC
+ * -XX:+ExplicitGCInvokesConcurrent
+ * -Xbootclasspath/a:.
+ * -XX:+UnlockDiagnosticVMOptions
+ * -XX:+WhiteBoxAPI
+ * -XX:+UseG1GC
+ * -XX:+ExplicitGCInvokesConcurrent
+ * -Xlog:gc:gc.log
+ * -XX:-UseGCOverheadLimit
+ * -Xlog:gc:gc.log
+ * -XX:-UseGCOverheadLimit
+ * gc.g1.unloading.UnloadingTest
+ * -classloadingMethod anonymous_classloader
+ * -inMemoryCompilation
+ * -keep class
+ * -numberOfChecksLimit 4
+ * -stressTime 180
+ */
+
diff --git a/test/hotspot/jtreg/vmTestbase/gc/g1/unloading/tests/unloading_anonclassloader_inMemoryCompilation_keep_obj/TEST.properties b/test/hotspot/jtreg/vmTestbase/gc/g1/unloading/tests/unloading_anonclassloader_inMemoryCompilation_keep_obj/TEST.properties
new file mode 100644
index 0000000..04b22a1
--- /dev/null
+++ b/test/hotspot/jtreg/vmTestbase/gc/g1/unloading/tests/unloading_anonclassloader_inMemoryCompilation_keep_obj/TEST.properties
@@ -0,0 +1,23 @@
+#
+# 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/g1/unloading/tests/unloading_anonclassloader_inMemoryCompilation_keep_obj/TestDescription.java b/test/hotspot/jtreg/vmTestbase/gc/g1/unloading/tests/unloading_anonclassloader_inMemoryCompilation_keep_obj/TestDescription.java
new file mode 100644
index 0000000..90f42b6
--- /dev/null
+++ b/test/hotspot/jtreg/vmTestbase/gc/g1/unloading/tests/unloading_anonclassloader_inMemoryCompilation_keep_obj/TestDescription.java
@@ -0,0 +1,67 @@
+/*
+ * 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.
+ */
+
+
+/*
+ * @test
+ * @modules java.base/jdk.internal.misc:+open
+ * @key stress gc
+ *
+ * @summary converted from VM Testbase gc/g1/unloading/tests/unloading_anonclassloader_inMemoryCompilation_keep_obj.
+ * VM Testbase keywords: [gc, stress, stressopt, nonconcurrent, javac]
+ *
+ * @modules java.base/jdk.internal.misc
+ * @library /vmTestbase
+ * /test/lib
+ *
+ * @run driver jdk.test.lib.FileInstaller . .
+ *
+ * @comment generate HumongousTemplateClass and compile it to test.classes
+ * @run driver gc.g1.unloading.bytecode.GenClassesBuilder
+ *
+ * @build sun.hotspot.WhiteBox
+ * @run driver ClassFileInstaller sun.hotspot.WhiteBox
+ * sun.hotspot.WhiteBox$WhiteBoxPermission
+ * @run main/othervm
+ * -Xbootclasspath/a:.
+ * -XX:+UnlockDiagnosticVMOptions
+ * -XX:+WhiteBoxAPI
+ * -XX:+UseG1GC
+ * -XX:+ExplicitGCInvokesConcurrent
+ * -Xbootclasspath/a:.
+ * -XX:+UnlockDiagnosticVMOptions
+ * -XX:+WhiteBoxAPI
+ * -XX:+UseG1GC
+ * -XX:+ExplicitGCInvokesConcurrent
+ * -Xlog:gc:gc.log
+ * -XX:-UseGCOverheadLimit
+ * -Xlog:gc:gc.log
+ * -XX:-UseGCOverheadLimit
+ * gc.g1.unloading.UnloadingTest
+ * -classloadingMethod anonymous_classloader
+ * -inMemoryCompilation
+ * -keep object
+ * -numberOfChecksLimit 4
+ * -stressTime 180
+ */
+
diff --git a/test/hotspot/jtreg/vmTestbase/gc/g1/unloading/tests/unloading_anonclassloader_keep_class/TEST.properties b/test/hotspot/jtreg/vmTestbase/gc/g1/unloading/tests/unloading_anonclassloader_keep_class/TEST.properties
new file mode 100644
index 0000000..04b22a1
--- /dev/null
+++ b/test/hotspot/jtreg/vmTestbase/gc/g1/unloading/tests/unloading_anonclassloader_keep_class/TEST.properties
@@ -0,0 +1,23 @@
+#
+# 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/g1/unloading/tests/unloading_anonclassloader_keep_class/TestDescription.java b/test/hotspot/jtreg/vmTestbase/gc/g1/unloading/tests/unloading_anonclassloader_keep_class/TestDescription.java
new file mode 100644
index 0000000..f685f76
--- /dev/null
+++ b/test/hotspot/jtreg/vmTestbase/gc/g1/unloading/tests/unloading_anonclassloader_keep_class/TestDescription.java
@@ -0,0 +1,66 @@
+/*
+ * 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.
+ */
+
+
+/*
+ * @test
+ * @modules java.base/jdk.internal.misc:+open
+ * @key stress gc
+ *
+ * @summary converted from VM Testbase gc/g1/unloading/tests/unloading_anonclassloader_keep_class.
+ * VM Testbase keywords: [gc, stress, stressopt, nonconcurrent, javac]
+ *
+ * @modules java.base/jdk.internal.misc
+ * @library /vmTestbase
+ * /test/lib
+ *
+ * @run driver jdk.test.lib.FileInstaller . .
+ *
+ * @comment generate HumongousTemplateClass and compile it to test.classes
+ * @run driver gc.g1.unloading.bytecode.GenClassesBuilder
+ *
+ * @build sun.hotspot.WhiteBox
+ * @run driver ClassFileInstaller sun.hotspot.WhiteBox
+ * sun.hotspot.WhiteBox$WhiteBoxPermission
+ * @run main/othervm
+ * -Xbootclasspath/a:.
+ * -XX:+UnlockDiagnosticVMOptions
+ * -XX:+WhiteBoxAPI
+ * -XX:+UseG1GC
+ * -XX:+ExplicitGCInvokesConcurrent
+ * -Xbootclasspath/a:.
+ * -XX:+UnlockDiagnosticVMOptions
+ * -XX:+WhiteBoxAPI
+ * -XX:+UseG1GC
+ * -XX:+ExplicitGCInvokesConcurrent
+ * -Xlog:gc:gc.log
+ * -XX:-UseGCOverheadLimit
+ * -Xlog:gc:gc.log
+ * -XX:-UseGCOverheadLimit
+ * gc.g1.unloading.UnloadingTest
+ * -classloadingMethod anonymous_classloader
+ * -keep class
+ * -numberOfChecksLimit 4
+ * -stressTime 180
+ */
+
diff --git a/test/hotspot/jtreg/vmTestbase/gc/g1/unloading/tests/unloading_anonclassloader_keep_obj/TEST.properties b/test/hotspot/jtreg/vmTestbase/gc/g1/unloading/tests/unloading_anonclassloader_keep_obj/TEST.properties
new file mode 100644
index 0000000..04b22a1
--- /dev/null
+++ b/test/hotspot/jtreg/vmTestbase/gc/g1/unloading/tests/unloading_anonclassloader_keep_obj/TEST.properties
@@ -0,0 +1,23 @@
+#
+# 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/g1/unloading/tests/unloading_anonclassloader_keep_obj/TestDescription.java b/test/hotspot/jtreg/vmTestbase/gc/g1/unloading/tests/unloading_anonclassloader_keep_obj/TestDescription.java
new file mode 100644
index 0000000..02f37d5
--- /dev/null
+++ b/test/hotspot/jtreg/vmTestbase/gc/g1/unloading/tests/unloading_anonclassloader_keep_obj/TestDescription.java
@@ -0,0 +1,66 @@
+/*
+ * 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.
+ */
+
+
+/*
+ * @test
+ * @modules java.base/jdk.internal.misc:+open
+ * @key stress gc
+ *
+ * @summary converted from VM Testbase gc/g1/unloading/tests/unloading_anonclassloader_keep_obj.
+ * VM Testbase keywords: [gc, stress, stressopt, nonconcurrent, javac]
+ *
+ * @modules java.base/jdk.internal.misc
+ * @library /vmTestbase
+ * /test/lib
+ *
+ * @run driver jdk.test.lib.FileInstaller . .
+ *
+ * @comment generate HumongousTemplateClass and compile it to test.classes
+ * @run driver gc.g1.unloading.bytecode.GenClassesBuilder
+ *
+ * @build sun.hotspot.WhiteBox
+ * @run driver ClassFileInstaller sun.hotspot.WhiteBox
+ * sun.hotspot.WhiteBox$WhiteBoxPermission
+ * @run main/othervm
+ * -Xbootclasspath/a:.
+ * -XX:+UnlockDiagnosticVMOptions
+ * -XX:+WhiteBoxAPI
+ * -XX:+UseG1GC
+ * -XX:+ExplicitGCInvokesConcurrent
+ * -Xbootclasspath/a:.
+ * -XX:+UnlockDiagnosticVMOptions
+ * -XX:+WhiteBoxAPI
+ * -XX:+UseG1GC
+ * -XX:+ExplicitGCInvokesConcurrent
+ * -Xlog:gc:gc.log
+ * -XX:-UseGCOverheadLimit
+ * -Xlog:gc:gc.log
+ * -XX:-UseGCOverheadLimit
+ * gc.g1.unloading.UnloadingTest
+ * -classloadingMethod anonymous_classloader
+ * -keep object
+ * -numberOfChecksLimit 4
+ * -stressTime 180
+ */
+
diff --git a/test/hotspot/jtreg/vmTestbase/gc/g1/unloading/tests/unloading_compilation_level1_inMemoryCompilation_keep_cl/TEST.properties b/test/hotspot/jtreg/vmTestbase/gc/g1/unloading/tests/unloading_compilation_level1_inMemoryCompilation_keep_cl/TEST.properties
new file mode 100644
index 0000000..04b22a1
--- /dev/null
+++ b/test/hotspot/jtreg/vmTestbase/gc/g1/unloading/tests/unloading_compilation_level1_inMemoryCompilation_keep_cl/TEST.properties
@@ -0,0 +1,23 @@
+#
+# 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/g1/unloading/tests/unloading_compilation_level1_inMemoryCompilation_keep_cl/TestDescription.java b/test/hotspot/jtreg/vmTestbase/gc/g1/unloading/tests/unloading_compilation_level1_inMemoryCompilation_keep_cl/TestDescription.java
new file mode 100644
index 0000000..94e56ec
--- /dev/null
+++ b/test/hotspot/jtreg/vmTestbase/gc/g1/unloading/tests/unloading_compilation_level1_inMemoryCompilation_keep_cl/TestDescription.java
@@ -0,0 +1,67 @@
+/*
+ * 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.
+ */
+
+
+/*
+ * @test
+ * @key stress gc
+ *
+ * @summary converted from VM Testbase gc/g1/unloading/tests/unloading_compilation_level1_inMemoryCompilation_keep_cl.
+ * VM Testbase keywords: [gc, stress, stressopt, nonconcurrent, javac]
+ *
+ * @modules java.base/jdk.internal.misc
+ * @library /vmTestbase
+ * /test/lib
+ *
+ * @run driver jdk.test.lib.FileInstaller . .
+ *
+ * @comment generate HumongousTemplateClass and compile it to test.classes
+ * @run driver gc.g1.unloading.bytecode.GenClassesBuilder
+ *
+ * @build sun.hotspot.WhiteBox
+ * @run driver ClassFileInstaller sun.hotspot.WhiteBox
+ * sun.hotspot.WhiteBox$WhiteBoxPermission
+ * @run main/othervm
+ * -Xbootclasspath/a:.
+ * -XX:+UnlockDiagnosticVMOptions
+ * -XX:+WhiteBoxAPI
+ * -XX:+UseG1GC
+ * -XX:+ExplicitGCInvokesConcurrent
+ * -Xbootclasspath/a:.
+ * -XX:+UnlockDiagnosticVMOptions
+ * -XX:+WhiteBoxAPI
+ * -XX:+UseG1GC
+ * -XX:+ExplicitGCInvokesConcurrent
+ * -Xlog:gc:gc.log
+ * -XX:-UseGCOverheadLimit
+ * -Xlog:gc:gc.log
+ * -XX:-UseGCOverheadLimit
+ * gc.g1.unloading.UnloadingTest
+ * -compilationNumber 1
+ * -compilationLevel 1
+ * -inMemoryCompilation
+ * -keep classloader
+ * -numberOfChecksLimit 4
+ * -stressTime 180
+ */
+
diff --git a/test/hotspot/jtreg/vmTestbase/gc/g1/unloading/tests/unloading_compilation_level1_inMemoryCompilation_keep_class/TEST.properties b/test/hotspot/jtreg/vmTestbase/gc/g1/unloading/tests/unloading_compilation_level1_inMemoryCompilation_keep_class/TEST.properties
new file mode 100644
index 0000000..04b22a1
--- /dev/null
+++ b/test/hotspot/jtreg/vmTestbase/gc/g1/unloading/tests/unloading_compilation_level1_inMemoryCompilation_keep_class/TEST.properties
@@ -0,0 +1,23 @@
+#
+# 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/g1/unloading/tests/unloading_compilation_level1_inMemoryCompilation_keep_class/TestDescription.java b/test/hotspot/jtreg/vmTestbase/gc/g1/unloading/tests/unloading_compilation_level1_inMemoryCompilation_keep_class/TestDescription.java
new file mode 100644
index 0000000..7ffd76d
--- /dev/null
+++ b/test/hotspot/jtreg/vmTestbase/gc/g1/unloading/tests/unloading_compilation_level1_inMemoryCompilation_keep_class/TestDescription.java
@@ -0,0 +1,67 @@
+/*
+ * 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.
+ */
+
+
+/*
+ * @test
+ * @key stress gc
+ *
+ * @summary converted from VM Testbase gc/g1/unloading/tests/unloading_compilation_level1_inMemoryCompilation_keep_class.
+ * VM Testbase keywords: [gc, stress, stressopt, nonconcurrent, javac]
+ *
+ * @modules java.base/jdk.internal.misc
+ * @library /vmTestbase
+ * /test/lib
+ *
+ * @run driver jdk.test.lib.FileInstaller . .
+ *
+ * @comment generate HumongousTemplateClass and compile it to test.classes
+ * @run driver gc.g1.unloading.bytecode.GenClassesBuilder
+ *
+ * @build sun.hotspot.WhiteBox
+ * @run driver ClassFileInstaller sun.hotspot.WhiteBox
+ * sun.hotspot.WhiteBox$WhiteBoxPermission
+ * @run main/othervm
+ * -Xbootclasspath/a:.
+ * -XX:+UnlockDiagnosticVMOptions
+ * -XX:+WhiteBoxAPI
+ * -XX:+UseG1GC
+ * -XX:+ExplicitGCInvokesConcurrent
+ * -Xbootclasspath/a:.
+ * -XX:+UnlockDiagnosticVMOptions
+ * -XX:+WhiteBoxAPI
+ * -XX:+UseG1GC
+ * -XX:+ExplicitGCInvokesConcurrent
+ * -Xlog:gc:gc.log
+ * -XX:-UseGCOverheadLimit
+ * -Xlog:gc:gc.log
+ * -XX:-UseGCOverheadLimit
+ * gc.g1.unloading.UnloadingTest
+ * -compilationNumber 1
+ * -compilationLevel 1
+ * -inMemoryCompilation
+ * -keep class
+ * -numberOfChecksLimit 4
+ * -stressTime 180
+ */
+
diff --git a/test/hotspot/jtreg/vmTestbase/gc/g1/unloading/tests/unloading_compilation_level1_inMemoryCompilation_keep_obj/TEST.properties b/test/hotspot/jtreg/vmTestbase/gc/g1/unloading/tests/unloading_compilation_level1_inMemoryCompilation_keep_obj/TEST.properties
new file mode 100644
index 0000000..04b22a1
--- /dev/null
+++ b/test/hotspot/jtreg/vmTestbase/gc/g1/unloading/tests/unloading_compilation_level1_inMemoryCompilation_keep_obj/TEST.properties
@@ -0,0 +1,23 @@
+#
+# 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/g1/unloading/tests/unloading_compilation_level1_inMemoryCompilation_keep_obj/TestDescription.java b/test/hotspot/jtreg/vmTestbase/gc/g1/unloading/tests/unloading_compilation_level1_inMemoryCompilation_keep_obj/TestDescription.java
new file mode 100644
index 0000000..4b364b2
--- /dev/null
+++ b/test/hotspot/jtreg/vmTestbase/gc/g1/unloading/tests/unloading_compilation_level1_inMemoryCompilation_keep_obj/TestDescription.java
@@ -0,0 +1,67 @@
+/*
+ * 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.
+ */
+
+
+/*
+ * @test
+ * @key stress gc
+ *
+ * @summary converted from VM Testbase gc/g1/unloading/tests/unloading_compilation_level1_inMemoryCompilation_keep_obj.
+ * VM Testbase keywords: [gc, stress, stressopt, nonconcurrent, javac]
+ *
+ * @modules java.base/jdk.internal.misc
+ * @library /vmTestbase
+ * /test/lib
+ *
+ * @run driver jdk.test.lib.FileInstaller . .
+ *
+ * @comment generate HumongousTemplateClass and compile it to test.classes
+ * @run driver gc.g1.unloading.bytecode.GenClassesBuilder
+ *
+ * @build sun.hotspot.WhiteBox
+ * @run driver ClassFileInstaller sun.hotspot.WhiteBox
+ * sun.hotspot.WhiteBox$WhiteBoxPermission
+ * @run main/othervm
+ * -Xbootclasspath/a:.
+ * -XX:+UnlockDiagnosticVMOptions
+ * -XX:+WhiteBoxAPI
+ * -XX:+UseG1GC
+ * -XX:+ExplicitGCInvokesConcurrent
+ * -Xbootclasspath/a:.
+ * -XX:+UnlockDiagnosticVMOptions
+ * -XX:+WhiteBoxAPI
+ * -XX:+UseG1GC
+ * -XX:+ExplicitGCInvokesConcurrent
+ * -Xlog:gc:gc.log
+ * -XX:-UseGCOverheadLimit
+ * -Xlog:gc:gc.log
+ * -XX:-UseGCOverheadLimit
+ * gc.g1.unloading.UnloadingTest
+ * -compilationNumber 1
+ * -compilationLevel 1
+ * -inMemoryCompilation
+ * -keep object
+ * -numberOfChecksLimit 4
+ * -stressTime 180
+ */
+
diff --git a/test/hotspot/jtreg/vmTestbase/gc/g1/unloading/tests/unloading_compilation_level1_keep_cl/TEST.properties b/test/hotspot/jtreg/vmTestbase/gc/g1/unloading/tests/unloading_compilation_level1_keep_cl/TEST.properties
new file mode 100644
index 0000000..04b22a1
--- /dev/null
+++ b/test/hotspot/jtreg/vmTestbase/gc/g1/unloading/tests/unloading_compilation_level1_keep_cl/TEST.properties
@@ -0,0 +1,23 @@
+#
+# 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/g1/unloading/tests/unloading_compilation_level1_keep_cl/TestDescription.java b/test/hotspot/jtreg/vmTestbase/gc/g1/unloading/tests/unloading_compilation_level1_keep_cl/TestDescription.java
new file mode 100644
index 0000000..085ea32
--- /dev/null
+++ b/test/hotspot/jtreg/vmTestbase/gc/g1/unloading/tests/unloading_compilation_level1_keep_cl/TestDescription.java
@@ -0,0 +1,66 @@
+/*
+ * 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.
+ */
+
+
+/*
+ * @test
+ * @key stress gc
+ *
+ * @summary converted from VM Testbase gc/g1/unloading/tests/unloading_compilation_level1_keep_cl.
+ * VM Testbase keywords: [gc, stress, stressopt, nonconcurrent, javac]
+ *
+ * @modules java.base/jdk.internal.misc
+ * @library /vmTestbase
+ * /test/lib
+ *
+ * @run driver jdk.test.lib.FileInstaller . .
+ *
+ * @comment generate HumongousTemplateClass and compile it to test.classes
+ * @run driver gc.g1.unloading.bytecode.GenClassesBuilder
+ *
+ * @build sun.hotspot.WhiteBox
+ * @run driver ClassFileInstaller sun.hotspot.WhiteBox
+ * sun.hotspot.WhiteBox$WhiteBoxPermission
+ * @run main/othervm
+ * -Xbootclasspath/a:.
+ * -XX:+UnlockDiagnosticVMOptions
+ * -XX:+WhiteBoxAPI
+ * -XX:+UseG1GC
+ * -XX:+ExplicitGCInvokesConcurrent
+ * -Xbootclasspath/a:.
+ * -XX:+UnlockDiagnosticVMOptions
+ * -XX:+WhiteBoxAPI
+ * -XX:+UseG1GC
+ * -XX:+ExplicitGCInvokesConcurrent
+ * -Xlog:gc:gc.log
+ * -XX:-UseGCOverheadLimit
+ * -Xlog:gc:gc.log
+ * -XX:-UseGCOverheadLimit
+ * gc.g1.unloading.UnloadingTest
+ * -compilationNumber 1
+ * -compilationLevel 1
+ * -keep classloader
+ * -numberOfChecksLimit 4
+ * -stressTime 180
+ */
+
diff --git a/test/hotspot/jtreg/vmTestbase/gc/g1/unloading/tests/unloading_compilation_level1_keep_class/TEST.properties b/test/hotspot/jtreg/vmTestbase/gc/g1/unloading/tests/unloading_compilation_level1_keep_class/TEST.properties
new file mode 100644
index 0000000..04b22a1
--- /dev/null
+++ b/test/hotspot/jtreg/vmTestbase/gc/g1/unloading/tests/unloading_compilation_level1_keep_class/TEST.properties
@@ -0,0 +1,23 @@
+#
+# 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/g1/unloading/tests/unloading_compilation_level1_keep_class/TestDescription.java b/test/hotspot/jtreg/vmTestbase/gc/g1/unloading/tests/unloading_compilation_level1_keep_class/TestDescription.java
new file mode 100644
index 0000000..afe1b15
--- /dev/null
+++ b/test/hotspot/jtreg/vmTestbase/gc/g1/unloading/tests/unloading_compilation_level1_keep_class/TestDescription.java
@@ -0,0 +1,66 @@
+/*
+ * 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.
+ */
+
+
+/*
+ * @test
+ * @key stress gc
+ *
+ * @summary converted from VM Testbase gc/g1/unloading/tests/unloading_compilation_level1_keep_class.
+ * VM Testbase keywords: [gc, stress, stressopt, nonconcurrent, javac]
+ *
+ * @modules java.base/jdk.internal.misc
+ * @library /vmTestbase
+ * /test/lib
+ *
+ * @run driver jdk.test.lib.FileInstaller . .
+ *
+ * @comment generate HumongousTemplateClass and compile it to test.classes
+ * @run driver gc.g1.unloading.bytecode.GenClassesBuilder
+ *
+ * @build sun.hotspot.WhiteBox
+ * @run driver ClassFileInstaller sun.hotspot.WhiteBox
+ * sun.hotspot.WhiteBox$WhiteBoxPermission
+ * @run main/othervm
+ * -Xbootclasspath/a:.
+ * -XX:+UnlockDiagnosticVMOptions
+ * -XX:+WhiteBoxAPI
+ * -XX:+UseG1GC
+ * -XX:+ExplicitGCInvokesConcurrent
+ * -Xbootclasspath/a:.
+ * -XX:+UnlockDiagnosticVMOptions
+ * -XX:+WhiteBoxAPI
+ * -XX:+UseG1GC
+ * -XX:+ExplicitGCInvokesConcurrent
+ * -Xlog:gc:gc.log
+ * -XX:-UseGCOverheadLimit
+ * -Xlog:gc:gc.log
+ * -XX:-UseGCOverheadLimit
+ * gc.g1.unloading.UnloadingTest
+ * -compilationNumber 1
+ * -compilationLevel 1
+ * -keep class
+ * -numberOfChecksLimit 4
+ * -stressTime 180
+ */
+
diff --git a/test/hotspot/jtreg/vmTestbase/gc/g1/unloading/tests/unloading_compilation_level1_keep_obj/TEST.properties b/test/hotspot/jtreg/vmTestbase/gc/g1/unloading/tests/unloading_compilation_level1_keep_obj/TEST.properties
new file mode 100644
index 0000000..04b22a1
--- /dev/null
+++ b/test/hotspot/jtreg/vmTestbase/gc/g1/unloading/tests/unloading_compilation_level1_keep_obj/TEST.properties
@@ -0,0 +1,23 @@
+#
+# 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/g1/unloading/tests/unloading_compilation_level1_keep_obj/TestDescription.java b/test/hotspot/jtreg/vmTestbase/gc/g1/unloading/tests/unloading_compilation_level1_keep_obj/TestDescription.java
new file mode 100644
index 0000000..f158a97
--- /dev/null
+++ b/test/hotspot/jtreg/vmTestbase/gc/g1/unloading/tests/unloading_compilation_level1_keep_obj/TestDescription.java
@@ -0,0 +1,66 @@
+/*
+ * 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.
+ */
+
+
+/*
+ * @test
+ * @key stress gc
+ *
+ * @summary converted from VM Testbase gc/g1/unloading/tests/unloading_compilation_level1_keep_obj.
+ * VM Testbase keywords: [gc, stress, stressopt, nonconcurrent, javac]
+ *
+ * @modules java.base/jdk.internal.misc
+ * @library /vmTestbase
+ * /test/lib
+ *
+ * @run driver jdk.test.lib.FileInstaller . .
+ *
+ * @comment generate HumongousTemplateClass and compile it to test.classes
+ * @run driver gc.g1.unloading.bytecode.GenClassesBuilder
+ *
+ * @build sun.hotspot.WhiteBox
+ * @run driver ClassFileInstaller sun.hotspot.WhiteBox
+ * sun.hotspot.WhiteBox$WhiteBoxPermission
+ * @run main/othervm
+ * -Xbootclasspath/a:.
+ * -XX:+UnlockDiagnosticVMOptions
+ * -XX:+WhiteBoxAPI
+ * -XX:+UseG1GC
+ * -XX:+ExplicitGCInvokesConcurrent
+ * -Xbootclasspath/a:.
+ * -XX:+UnlockDiagnosticVMOptions
+ * -XX:+WhiteBoxAPI
+ * -XX:+UseG1GC
+ * -XX:+ExplicitGCInvokesConcurrent
+ * -Xlog:gc:gc.log
+ * -XX:-UseGCOverheadLimit
+ * -Xlog:gc:gc.log
+ * -XX:-UseGCOverheadLimit
+ * gc.g1.unloading.UnloadingTest
+ * -compilationNumber 1
+ * -compilationLevel 1
+ * -keep object
+ * -numberOfChecksLimit 4
+ * -stressTime 180
+ */
+
diff --git a/test/hotspot/jtreg/vmTestbase/gc/g1/unloading/tests/unloading_compilation_level2_inMemoryCompilation_keep_cl/TEST.properties b/test/hotspot/jtreg/vmTestbase/gc/g1/unloading/tests/unloading_compilation_level2_inMemoryCompilation_keep_cl/TEST.properties
new file mode 100644
index 0000000..04b22a1
--- /dev/null
+++ b/test/hotspot/jtreg/vmTestbase/gc/g1/unloading/tests/unloading_compilation_level2_inMemoryCompilation_keep_cl/TEST.properties
@@ -0,0 +1,23 @@
+#
+# 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/g1/unloading/tests/unloading_compilation_level2_inMemoryCompilation_keep_cl/TestDescription.java b/test/hotspot/jtreg/vmTestbase/gc/g1/unloading/tests/unloading_compilation_level2_inMemoryCompilation_keep_cl/TestDescription.java
new file mode 100644
index 0000000..7308e0e
--- /dev/null
+++ b/test/hotspot/jtreg/vmTestbase/gc/g1/unloading/tests/unloading_compilation_level2_inMemoryCompilation_keep_cl/TestDescription.java
@@ -0,0 +1,67 @@
+/*
+ * 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.
+ */
+
+
+/*
+ * @test
+ * @key stress gc
+ *
+ * @summary converted from VM Testbase gc/g1/unloading/tests/unloading_compilation_level2_inMemoryCompilation_keep_cl.
+ * VM Testbase keywords: [gc, stress, stressopt, nonconcurrent, javac]
+ *
+ * @modules java.base/jdk.internal.misc
+ * @library /vmTestbase
+ * /test/lib
+ *
+ * @run driver jdk.test.lib.FileInstaller . .
+ *
+ * @comment generate HumongousTemplateClass and compile it to test.classes
+ * @run driver gc.g1.unloading.bytecode.GenClassesBuilder
+ *
+ * @build sun.hotspot.WhiteBox
+ * @run driver ClassFileInstaller sun.hotspot.WhiteBox
+ * sun.hotspot.WhiteBox$WhiteBoxPermission
+ * @run main/othervm
+ * -Xbootclasspath/a:.
+ * -XX:+UnlockDiagnosticVMOptions
+ * -XX:+WhiteBoxAPI
+ * -XX:+UseG1GC
+ * -XX:+ExplicitGCInvokesConcurrent
+ * -Xbootclasspath/a:.
+ * -XX:+UnlockDiagnosticVMOptions
+ * -XX:+WhiteBoxAPI
+ * -XX:+UseG1GC
+ * -XX:+ExplicitGCInvokesConcurrent
+ * -Xlog:gc:gc.log
+ * -XX:-UseGCOverheadLimit
+ * -Xlog:gc:gc.log
+ * -XX:-UseGCOverheadLimit
+ * gc.g1.unloading.UnloadingTest
+ * -compilationNumber 1
+ * -compilationLevel 2
+ * -inMemoryCompilation
+ * -keep classloader
+ * -numberOfChecksLimit 4
+ * -stressTime 180
+ */
+
diff --git a/test/hotspot/jtreg/vmTestbase/gc/g1/unloading/tests/unloading_compilation_level2_inMemoryCompilation_keep_class/TEST.properties b/test/hotspot/jtreg/vmTestbase/gc/g1/unloading/tests/unloading_compilation_level2_inMemoryCompilation_keep_class/TEST.properties
new file mode 100644
index 0000000..04b22a1
--- /dev/null
+++ b/test/hotspot/jtreg/vmTestbase/gc/g1/unloading/tests/unloading_compilation_level2_inMemoryCompilation_keep_class/TEST.properties
@@ -0,0 +1,23 @@
+#
+# 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/g1/unloading/tests/unloading_compilation_level2_inMemoryCompilation_keep_class/TestDescription.java b/test/hotspot/jtreg/vmTestbase/gc/g1/unloading/tests/unloading_compilation_level2_inMemoryCompilation_keep_class/TestDescription.java
new file mode 100644
index 0000000..be421e4
--- /dev/null
+++ b/test/hotspot/jtreg/vmTestbase/gc/g1/unloading/tests/unloading_compilation_level2_inMemoryCompilation_keep_class/TestDescription.java
@@ -0,0 +1,67 @@
+/*
+ * 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.
+ */
+
+
+/*
+ * @test
+ * @key stress gc
+ *
+ * @summary converted from VM Testbase gc/g1/unloading/tests/unloading_compilation_level2_inMemoryCompilation_keep_class.
+ * VM Testbase keywords: [gc, stress, stressopt, nonconcurrent, javac]
+ *
+ * @modules java.base/jdk.internal.misc
+ * @library /vmTestbase
+ * /test/lib
+ *
+ * @run driver jdk.test.lib.FileInstaller . .
+ *
+ * @comment generate HumongousTemplateClass and compile it to test.classes
+ * @run driver gc.g1.unloading.bytecode.GenClassesBuilder
+ *
+ * @build sun.hotspot.WhiteBox
+ * @run driver ClassFileInstaller sun.hotspot.WhiteBox
+ * sun.hotspot.WhiteBox$WhiteBoxPermission
+ * @run main/othervm
+ * -Xbootclasspath/a:.
+ * -XX:+UnlockDiagnosticVMOptions
+ * -XX:+WhiteBoxAPI
+ * -XX:+UseG1GC
+ * -XX:+ExplicitGCInvokesConcurrent
+ * -Xbootclasspath/a:.
+ * -XX:+UnlockDiagnosticVMOptions
+ * -XX:+WhiteBoxAPI
+ * -XX:+UseG1GC
+ * -XX:+ExplicitGCInvokesConcurrent
+ * -Xlog:gc:gc.log
+ * -XX:-UseGCOverheadLimit
+ * -Xlog:gc:gc.log
+ * -XX:-UseGCOverheadLimit
+ * gc.g1.unloading.UnloadingTest
+ * -compilationNumber 1
+ * -compilationLevel 2
+ * -inMemoryCompilation
+ * -keep class
+ * -numberOfChecksLimit 4
+ * -stressTime 180
+ */
+
diff --git a/test/hotspot/jtreg/vmTestbase/gc/g1/unloading/tests/unloading_compilation_level2_inMemoryCompilation_keep_obj/TEST.properties b/test/hotspot/jtreg/vmTestbase/gc/g1/unloading/tests/unloading_compilation_level2_inMemoryCompilation_keep_obj/TEST.properties
new file mode 100644
index 0000000..04b22a1
--- /dev/null
+++ b/test/hotspot/jtreg/vmTestbase/gc/g1/unloading/tests/unloading_compilation_level2_inMemoryCompilation_keep_obj/TEST.properties
@@ -0,0 +1,23 @@
+#
+# 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/g1/unloading/tests/unloading_compilation_level2_inMemoryCompilation_keep_obj/TestDescription.java b/test/hotspot/jtreg/vmTestbase/gc/g1/unloading/tests/unloading_compilation_level2_inMemoryCompilation_keep_obj/TestDescription.java
new file mode 100644
index 0000000..06c5ecd
--- /dev/null
+++ b/test/hotspot/jtreg/vmTestbase/gc/g1/unloading/tests/unloading_compilation_level2_inMemoryCompilation_keep_obj/TestDescription.java
@@ -0,0 +1,67 @@
+/*
+ * 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.
+ */
+
+
+/*
+ * @test
+ * @key stress gc
+ *
+ * @summary converted from VM Testbase gc/g1/unloading/tests/unloading_compilation_level2_inMemoryCompilation_keep_obj.
+ * VM Testbase keywords: [gc, stress, stressopt, nonconcurrent, javac]
+ *
+ * @modules java.base/jdk.internal.misc
+ * @library /vmTestbase
+ * /test/lib
+ *
+ * @run driver jdk.test.lib.FileInstaller . .
+ *
+ * @comment generate HumongousTemplateClass and compile it to test.classes
+ * @run driver gc.g1.unloading.bytecode.GenClassesBuilder
+ *
+ * @build sun.hotspot.WhiteBox
+ * @run driver ClassFileInstaller sun.hotspot.WhiteBox
+ * sun.hotspot.WhiteBox$WhiteBoxPermission
+ * @run main/othervm
+ * -Xbootclasspath/a:.
+ * -XX:+UnlockDiagnosticVMOptions
+ * -XX:+WhiteBoxAPI
+ * -XX:+UseG1GC
+ * -XX:+ExplicitGCInvokesConcurrent
+ * -Xbootclasspath/a:.
+ * -XX:+UnlockDiagnosticVMOptions
+ * -XX:+WhiteBoxAPI
+ * -XX:+UseG1GC
+ * -XX:+ExplicitGCInvokesConcurrent
+ * -Xlog:gc:gc.log
+ * -XX:-UseGCOverheadLimit
+ * -Xlog:gc:gc.log
+ * -XX:-UseGCOverheadLimit
+ * gc.g1.unloading.UnloadingTest
+ * -compilationNumber 1
+ * -compilationLevel 2
+ * -inMemoryCompilation
+ * -keep object
+ * -numberOfChecksLimit 4
+ * -stressTime 180
+ */
+
diff --git a/test/hotspot/jtreg/vmTestbase/gc/g1/unloading/tests/unloading_compilation_level2_keep_cl/TEST.properties b/test/hotspot/jtreg/vmTestbase/gc/g1/unloading/tests/unloading_compilation_level2_keep_cl/TEST.properties
new file mode 100644
index 0000000..04b22a1
--- /dev/null
+++ b/test/hotspot/jtreg/vmTestbase/gc/g1/unloading/tests/unloading_compilation_level2_keep_cl/TEST.properties
@@ -0,0 +1,23 @@
+#
+# 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/g1/unloading/tests/unloading_compilation_level2_keep_cl/TestDescription.java b/test/hotspot/jtreg/vmTestbase/gc/g1/unloading/tests/unloading_compilation_level2_keep_cl/TestDescription.java
new file mode 100644
index 0000000..b2bc1a9
--- /dev/null
+++ b/test/hotspot/jtreg/vmTestbase/gc/g1/unloading/tests/unloading_compilation_level2_keep_cl/TestDescription.java
@@ -0,0 +1,66 @@
+/*
+ * 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.
+ */
+
+
+/*
+ * @test
+ * @key stress gc
+ *
+ * @summary converted from VM Testbase gc/g1/unloading/tests/unloading_compilation_level2_keep_cl.
+ * VM Testbase keywords: [gc, stress, stressopt, nonconcurrent, javac]
+ *
+ * @modules java.base/jdk.internal.misc
+ * @library /vmTestbase
+ * /test/lib
+ *
+ * @run driver jdk.test.lib.FileInstaller . .
+ *
+ * @comment generate HumongousTemplateClass and compile it to test.classes
+ * @run driver gc.g1.unloading.bytecode.GenClassesBuilder
+ *
+ * @build sun.hotspot.WhiteBox
+ * @run driver ClassFileInstaller sun.hotspot.WhiteBox
+ * sun.hotspot.WhiteBox$WhiteBoxPermission
+ * @run main/othervm
+ * -Xbootclasspath/a:.
+ * -XX:+UnlockDiagnosticVMOptions
+ * -XX:+WhiteBoxAPI
+ * -XX:+UseG1GC
+ * -XX:+ExplicitGCInvokesConcurrent
+ * -Xbootclasspath/a:.
+ * -XX:+UnlockDiagnosticVMOptions
+ * -XX:+WhiteBoxAPI
+ * -XX:+UseG1GC
+ * -XX:+ExplicitGCInvokesConcurrent
+ * -Xlog:gc:gc.log
+ * -XX:-UseGCOverheadLimit
+ * -Xlog:gc:gc.log
+ * -XX:-UseGCOverheadLimit
+ * gc.g1.unloading.UnloadingTest
+ * -compilationNumber 1
+ * -compilationLevel 2
+ * -keep classloader
+ * -numberOfChecksLimit 4
+ * -stressTime 180
+ */
+
diff --git a/test/hotspot/jtreg/vmTestbase/gc/g1/unloading/tests/unloading_compilation_level2_keep_class/TEST.properties b/test/hotspot/jtreg/vmTestbase/gc/g1/unloading/tests/unloading_compilation_level2_keep_class/TEST.properties
new file mode 100644
index 0000000..04b22a1
--- /dev/null
+++ b/test/hotspot/jtreg/vmTestbase/gc/g1/unloading/tests/unloading_compilation_level2_keep_class/TEST.properties
@@ -0,0 +1,23 @@
+#
+# 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/g1/unloading/tests/unloading_compilation_level2_keep_class/TestDescription.java b/test/hotspot/jtreg/vmTestbase/gc/g1/unloading/tests/unloading_compilation_level2_keep_class/TestDescription.java
new file mode 100644
index 0000000..2c4d23b
--- /dev/null
+++ b/test/hotspot/jtreg/vmTestbase/gc/g1/unloading/tests/unloading_compilation_level2_keep_class/TestDescription.java
@@ -0,0 +1,66 @@
+/*
+ * 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.
+ */
+
+
+/*
+ * @test
+ * @key stress gc
+ *
+ * @summary converted from VM Testbase gc/g1/unloading/tests/unloading_compilation_level2_keep_class.
+ * VM Testbase keywords: [gc, stress, stressopt, nonconcurrent, javac]
+ *
+ * @modules java.base/jdk.internal.misc
+ * @library /vmTestbase
+ * /test/lib
+ *
+ * @run driver jdk.test.lib.FileInstaller . .
+ *
+ * @comment generate HumongousTemplateClass and compile it to test.classes
+ * @run driver gc.g1.unloading.bytecode.GenClassesBuilder
+ *
+ * @build sun.hotspot.WhiteBox
+ * @run driver ClassFileInstaller sun.hotspot.WhiteBox
+ * sun.hotspot.WhiteBox$WhiteBoxPermission
+ * @run main/othervm
+ * -Xbootclasspath/a:.
+ * -XX:+UnlockDiagnosticVMOptions
+ * -XX:+WhiteBoxAPI
+ * -XX:+UseG1GC
+ * -XX:+ExplicitGCInvokesConcurrent
+ * -Xbootclasspath/a:.
+ * -XX:+UnlockDiagnosticVMOptions
+ * -XX:+WhiteBoxAPI
+ * -XX:+UseG1GC
+ * -XX:+ExplicitGCInvokesConcurrent
+ * -Xlog:gc:gc.log
+ * -XX:-UseGCOverheadLimit
+ * -Xlog:gc:gc.log
+ * -XX:-UseGCOverheadLimit
+ * gc.g1.unloading.UnloadingTest
+ * -compilationNumber 1
+ * -compilationLevel 2
+ * -keep class
+ * -numberOfChecksLimit 4
+ * -stressTime 180
+ */
+
diff --git a/test/hotspot/jtreg/vmTestbase/gc/g1/unloading/tests/unloading_compilation_level2_keep_obj/TEST.properties b/test/hotspot/jtreg/vmTestbase/gc/g1/unloading/tests/unloading_compilation_level2_keep_obj/TEST.properties
new file mode 100644
index 0000000..04b22a1
--- /dev/null
+++ b/test/hotspot/jtreg/vmTestbase/gc/g1/unloading/tests/unloading_compilation_level2_keep_obj/TEST.properties
@@ -0,0 +1,23 @@
+#
+# 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/g1/unloading/tests/unloading_compilation_level2_keep_obj/TestDescription.java b/test/hotspot/jtreg/vmTestbase/gc/g1/unloading/tests/unloading_compilation_level2_keep_obj/TestDescription.java
new file mode 100644
index 0000000..2fb515e
--- /dev/null
+++ b/test/hotspot/jtreg/vmTestbase/gc/g1/unloading/tests/unloading_compilation_level2_keep_obj/TestDescription.java
@@ -0,0 +1,66 @@
+/*
+ * 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.
+ */
+
+
+/*
+ * @test
+ * @key stress gc
+ *
+ * @summary converted from VM Testbase gc/g1/unloading/tests/unloading_compilation_level2_keep_obj.
+ * VM Testbase keywords: [gc, stress, stressopt, nonconcurrent, javac]
+ *
+ * @modules java.base/jdk.internal.misc
+ * @library /vmTestbase
+ * /test/lib
+ *
+ * @run driver jdk.test.lib.FileInstaller . .
+ *
+ * @comment generate HumongousTemplateClass and compile it to test.classes
+ * @run driver gc.g1.unloading.bytecode.GenClassesBuilder
+ *
+ * @build sun.hotspot.WhiteBox
+ * @run driver ClassFileInstaller sun.hotspot.WhiteBox
+ * sun.hotspot.WhiteBox$WhiteBoxPermission
+ * @run main/othervm
+ * -Xbootclasspath/a:.
+ * -XX:+UnlockDiagnosticVMOptions
+ * -XX:+WhiteBoxAPI
+ * -XX:+UseG1GC
+ * -XX:+ExplicitGCInvokesConcurrent
+ * -Xbootclasspath/a:.
+ * -XX:+UnlockDiagnosticVMOptions
+ * -XX:+WhiteBoxAPI
+ * -XX:+UseG1GC
+ * -XX:+ExplicitGCInvokesConcurrent
+ * -Xlog:gc:gc.log
+ * -XX:-UseGCOverheadLimit
+ * -Xlog:gc:gc.log
+ * -XX:-UseGCOverheadLimit
+ * gc.g1.unloading.UnloadingTest
+ * -compilationNumber 1
+ * -compilationLevel 2
+ * -keep object
+ * -numberOfChecksLimit 4
+ * -stressTime 180
+ */
+
diff --git a/test/hotspot/jtreg/vmTestbase/gc/g1/unloading/tests/unloading_compilation_level3_inMemoryCompilation_keep_cl/TEST.properties b/test/hotspot/jtreg/vmTestbase/gc/g1/unloading/tests/unloading_compilation_level3_inMemoryCompilation_keep_cl/TEST.properties
new file mode 100644
index 0000000..04b22a1
--- /dev/null
+++ b/test/hotspot/jtreg/vmTestbase/gc/g1/unloading/tests/unloading_compilation_level3_inMemoryCompilation_keep_cl/TEST.properties
@@ -0,0 +1,23 @@
+#
+# 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/g1/unloading/tests/unloading_compilation_level3_inMemoryCompilation_keep_cl/TestDescription.java b/test/hotspot/jtreg/vmTestbase/gc/g1/unloading/tests/unloading_compilation_level3_inMemoryCompilation_keep_cl/TestDescription.java
new file mode 100644
index 0000000..776e7f8
--- /dev/null
+++ b/test/hotspot/jtreg/vmTestbase/gc/g1/unloading/tests/unloading_compilation_level3_inMemoryCompilation_keep_cl/TestDescription.java
@@ -0,0 +1,67 @@
+/*
+ * 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.
+ */
+
+
+/*
+ * @test
+ * @key stress gc
+ *
+ * @summary converted from VM Testbase gc/g1/unloading/tests/unloading_compilation_level3_inMemoryCompilation_keep_cl.
+ * VM Testbase keywords: [gc, stress, stressopt, nonconcurrent, javac]
+ *
+ * @modules java.base/jdk.internal.misc
+ * @library /vmTestbase
+ * /test/lib
+ *
+ * @run driver jdk.test.lib.FileInstaller . .
+ *
+ * @comment generate HumongousTemplateClass and compile it to test.classes
+ * @run driver gc.g1.unloading.bytecode.GenClassesBuilder
+ *
+ * @build sun.hotspot.WhiteBox
+ * @run driver ClassFileInstaller sun.hotspot.WhiteBox
+ * sun.hotspot.WhiteBox$WhiteBoxPermission
+ * @run main/othervm
+ * -Xbootclasspath/a:.
+ * -XX:+UnlockDiagnosticVMOptions
+ * -XX:+WhiteBoxAPI
+ * -XX:+UseG1GC
+ * -XX:+ExplicitGCInvokesConcurrent
+ * -Xbootclasspath/a:.
+ * -XX:+UnlockDiagnosticVMOptions
+ * -XX:+WhiteBoxAPI
+ * -XX:+UseG1GC
+ * -XX:+ExplicitGCInvokesConcurrent
+ * -Xlog:gc:gc.log
+ * -XX:-UseGCOverheadLimit
+ * -Xlog:gc:gc.log
+ * -XX:-UseGCOverheadLimit
+ * gc.g1.unloading.UnloadingTest
+ * -compilationNumber 1
+ * -compilationLevel 3
+ * -inMemoryCompilation
+ * -keep classloader
+ * -numberOfChecksLimit 4
+ * -stressTime 180
+ */
+
diff --git a/test/hotspot/jtreg/vmTestbase/gc/g1/unloading/tests/unloading_compilation_level3_inMemoryCompilation_keep_class/TEST.properties b/test/hotspot/jtreg/vmTestbase/gc/g1/unloading/tests/unloading_compilation_level3_inMemoryCompilation_keep_class/TEST.properties
new file mode 100644
index 0000000..04b22a1
--- /dev/null
+++ b/test/hotspot/jtreg/vmTestbase/gc/g1/unloading/tests/unloading_compilation_level3_inMemoryCompilation_keep_class/TEST.properties
@@ -0,0 +1,23 @@
+#
+# 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/g1/unloading/tests/unloading_compilation_level3_inMemoryCompilation_keep_class/TestDescription.java b/test/hotspot/jtreg/vmTestbase/gc/g1/unloading/tests/unloading_compilation_level3_inMemoryCompilation_keep_class/TestDescription.java
new file mode 100644
index 0000000..2f0f2bc
--- /dev/null
+++ b/test/hotspot/jtreg/vmTestbase/gc/g1/unloading/tests/unloading_compilation_level3_inMemoryCompilation_keep_class/TestDescription.java
@@ -0,0 +1,67 @@
+/*
+ * 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.
+ */
+
+
+/*
+ * @test
+ * @key stress gc
+ *
+ * @summary converted from VM Testbase gc/g1/unloading/tests/unloading_compilation_level3_inMemoryCompilation_keep_class.
+ * VM Testbase keywords: [gc, stress, stressopt, nonconcurrent, javac]
+ *
+ * @modules java.base/jdk.internal.misc
+ * @library /vmTestbase
+ * /test/lib
+ *
+ * @run driver jdk.test.lib.FileInstaller . .
+ *
+ * @comment generate HumongousTemplateClass and compile it to test.classes
+ * @run driver gc.g1.unloading.bytecode.GenClassesBuilder
+ *
+ * @build sun.hotspot.WhiteBox
+ * @run driver ClassFileInstaller sun.hotspot.WhiteBox
+ * sun.hotspot.WhiteBox$WhiteBoxPermission
+ * @run main/othervm
+ * -Xbootclasspath/a:.
+ * -XX:+UnlockDiagnosticVMOptions
+ * -XX:+WhiteBoxAPI
+ * -XX:+UseG1GC
+ * -XX:+ExplicitGCInvokesConcurrent
+ * -Xbootclasspath/a:.
+ * -XX:+UnlockDiagnosticVMOptions
+ * -XX:+WhiteBoxAPI
+ * -XX:+UseG1GC
+ * -XX:+ExplicitGCInvokesConcurrent
+ * -Xlog:gc:gc.log
+ * -XX:-UseGCOverheadLimit
+ * -Xlog:gc:gc.log
+ * -XX:-UseGCOverheadLimit
+ * gc.g1.unloading.UnloadingTest
+ * -compilationNumber 1
+ * -compilationLevel 3
+ * -inMemoryCompilation
+ * -keep class
+ * -numberOfChecksLimit 4
+ * -stressTime 180
+ */
+
diff --git a/test/hotspot/jtreg/vmTestbase/gc/g1/unloading/tests/unloading_compilation_level3_inMemoryCompilation_keep_obj/TEST.properties b/test/hotspot/jtreg/vmTestbase/gc/g1/unloading/tests/unloading_compilation_level3_inMemoryCompilation_keep_obj/TEST.properties
new file mode 100644
index 0000000..04b22a1
--- /dev/null
+++ b/test/hotspot/jtreg/vmTestbase/gc/g1/unloading/tests/unloading_compilation_level3_inMemoryCompilation_keep_obj/TEST.properties
@@ -0,0 +1,23 @@
+#
+# 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/g1/unloading/tests/unloading_compilation_level3_inMemoryCompilation_keep_obj/TestDescription.java b/test/hotspot/jtreg/vmTestbase/gc/g1/unloading/tests/unloading_compilation_level3_inMemoryCompilation_keep_obj/TestDescription.java
new file mode 100644
index 0000000..4b6873b
--- /dev/null
+++ b/test/hotspot/jtreg/vmTestbase/gc/g1/unloading/tests/unloading_compilation_level3_inMemoryCompilation_keep_obj/TestDescription.java
@@ -0,0 +1,67 @@
+/*
+ * 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.
+ */
+
+
+/*
+ * @test
+ * @key stress gc
+ *
+ * @summary converted from VM Testbase gc/g1/unloading/tests/unloading_compilation_level3_inMemoryCompilation_keep_obj.
+ * VM Testbase keywords: [gc, stress, stressopt, nonconcurrent, javac]
+ *
+ * @modules java.base/jdk.internal.misc
+ * @library /vmTestbase
+ * /test/lib
+ *
+ * @run driver jdk.test.lib.FileInstaller . .
+ *
+ * @comment generate HumongousTemplateClass and compile it to test.classes
+ * @run driver gc.g1.unloading.bytecode.GenClassesBuilder
+ *
+ * @build sun.hotspot.WhiteBox
+ * @run driver ClassFileInstaller sun.hotspot.WhiteBox
+ * sun.hotspot.WhiteBox$WhiteBoxPermission
+ * @run main/othervm
+ * -Xbootclasspath/a:.
+ * -XX:+UnlockDiagnosticVMOptions
+ * -XX:+WhiteBoxAPI
+ * -XX:+UseG1GC
+ * -XX:+ExplicitGCInvokesConcurrent
+ * -Xbootclasspath/a:.
+ * -XX:+UnlockDiagnosticVMOptions
+ * -XX:+WhiteBoxAPI
+ * -XX:+UseG1GC
+ * -XX:+ExplicitGCInvokesConcurrent
+ * -Xlog:gc:gc.log
+ * -XX:-UseGCOverheadLimit
+ * -Xlog:gc:gc.log
+ * -XX:-UseGCOverheadLimit
+ * gc.g1.unloading.UnloadingTest
+ * -compilationNumber 1
+ * -compilationLevel 3
+ * -inMemoryCompilation
+ * -keep object
+ * -numberOfChecksLimit 4
+ * -stressTime 180
+ */
+
diff --git a/test/hotspot/jtreg/vmTestbase/gc/g1/unloading/tests/unloading_compilation_level3_keep_cl/TEST.properties b/test/hotspot/jtreg/vmTestbase/gc/g1/unloading/tests/unloading_compilation_level3_keep_cl/TEST.properties
new file mode 100644
index 0000000..04b22a1
--- /dev/null
+++ b/test/hotspot/jtreg/vmTestbase/gc/g1/unloading/tests/unloading_compilation_level3_keep_cl/TEST.properties
@@ -0,0 +1,23 @@
+#
+# 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/g1/unloading/tests/unloading_compilation_level3_keep_cl/TestDescription.java b/test/hotspot/jtreg/vmTestbase/gc/g1/unloading/tests/unloading_compilation_level3_keep_cl/TestDescription.java
new file mode 100644
index 0000000..e268738
--- /dev/null
+++ b/test/hotspot/jtreg/vmTestbase/gc/g1/unloading/tests/unloading_compilation_level3_keep_cl/TestDescription.java
@@ -0,0 +1,66 @@
+/*
+ * 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.
+ */
+
+
+/*
+ * @test
+ * @key stress gc
+ *
+ * @summary converted from VM Testbase gc/g1/unloading/tests/unloading_compilation_level3_keep_cl.
+ * VM Testbase keywords: [gc, stress, stressopt, nonconcurrent, javac]
+ *
+ * @modules java.base/jdk.internal.misc
+ * @library /vmTestbase
+ * /test/lib
+ *
+ * @run driver jdk.test.lib.FileInstaller . .
+ *
+ * @comment generate HumongousTemplateClass and compile it to test.classes
+ * @run driver gc.g1.unloading.bytecode.GenClassesBuilder
+ *
+ * @build sun.hotspot.WhiteBox
+ * @run driver ClassFileInstaller sun.hotspot.WhiteBox
+ * sun.hotspot.WhiteBox$WhiteBoxPermission
+ * @run main/othervm
+ * -Xbootclasspath/a:.
+ * -XX:+UnlockDiagnosticVMOptions
+ * -XX:+WhiteBoxAPI
+ * -XX:+UseG1GC
+ * -XX:+ExplicitGCInvokesConcurrent
+ * -Xbootclasspath/a:.
+ * -XX:+UnlockDiagnosticVMOptions
+ * -XX:+WhiteBoxAPI
+ * -XX:+UseG1GC
+ * -XX:+ExplicitGCInvokesConcurrent
+ * -Xlog:gc:gc.log
+ * -XX:-UseGCOverheadLimit
+ * -Xlog:gc:gc.log
+ * -XX:-UseGCOverheadLimit
+ * gc.g1.unloading.UnloadingTest
+ * -compilationNumber 1
+ * -compilationLevel 3
+ * -keep classloader
+ * -numberOfChecksLimit 4
+ * -stressTime 180
+ */
+
diff --git a/test/hotspot/jtreg/vmTestbase/gc/g1/unloading/tests/unloading_compilation_level3_keep_class/TEST.properties b/test/hotspot/jtreg/vmTestbase/gc/g1/unloading/tests/unloading_compilation_level3_keep_class/TEST.properties
new file mode 100644
index 0000000..04b22a1
--- /dev/null
+++ b/test/hotspot/jtreg/vmTestbase/gc/g1/unloading/tests/unloading_compilation_level3_keep_class/TEST.properties
@@ -0,0 +1,23 @@
+#
+# 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/g1/unloading/tests/unloading_compilation_level3_keep_class/TestDescription.java b/test/hotspot/jtreg/vmTestbase/gc/g1/unloading/tests/unloading_compilation_level3_keep_class/TestDescription.java
new file mode 100644
index 0000000..bf67082
--- /dev/null
+++ b/test/hotspot/jtreg/vmTestbase/gc/g1/unloading/tests/unloading_compilation_level3_keep_class/TestDescription.java
@@ -0,0 +1,66 @@
+/*
+ * 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.
+ */
+
+
+/*
+ * @test
+ * @key stress gc
+ *
+ * @summary converted from VM Testbase gc/g1/unloading/tests/unloading_compilation_level3_keep_class.
+ * VM Testbase keywords: [gc, stress, stressopt, nonconcurrent, javac]
+ *
+ * @modules java.base/jdk.internal.misc
+ * @library /vmTestbase
+ * /test/lib
+ *
+ * @run driver jdk.test.lib.FileInstaller . .
+ *
+ * @comment generate HumongousTemplateClass and compile it to test.classes
+ * @run driver gc.g1.unloading.bytecode.GenClassesBuilder
+ *
+ * @build sun.hotspot.WhiteBox
+ * @run driver ClassFileInstaller sun.hotspot.WhiteBox
+ * sun.hotspot.WhiteBox$WhiteBoxPermission
+ * @run main/othervm
+ * -Xbootclasspath/a:.
+ * -XX:+UnlockDiagnosticVMOptions
+ * -XX:+WhiteBoxAPI
+ * -XX:+UseG1GC
+ * -XX:+ExplicitGCInvokesConcurrent
+ * -Xbootclasspath/a:.
+ * -XX:+UnlockDiagnosticVMOptions
+ * -XX:+WhiteBoxAPI
+ * -XX:+UseG1GC
+ * -XX:+ExplicitGCInvokesConcurrent
+ * -Xlog:gc:gc.log
+ * -XX:-UseGCOverheadLimit
+ * -Xlog:gc:gc.log
+ * -XX:-UseGCOverheadLimit
+ * gc.g1.unloading.UnloadingTest
+ * -compilationNumber 1
+ * -compilationLevel 3
+ * -keep class
+ * -numberOfChecksLimit 4
+ * -stressTime 180
+ */
+
diff --git a/test/hotspot/jtreg/vmTestbase/gc/g1/unloading/tests/unloading_compilation_level3_keep_obj/TEST.properties b/test/hotspot/jtreg/vmTestbase/gc/g1/unloading/tests/unloading_compilation_level3_keep_obj/TEST.properties
new file mode 100644
index 0000000..04b22a1
--- /dev/null
+++ b/test/hotspot/jtreg/vmTestbase/gc/g1/unloading/tests/unloading_compilation_level3_keep_obj/TEST.properties
@@ -0,0 +1,23 @@
+#
+# 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/g1/unloading/tests/unloading_compilation_level3_keep_obj/TestDescription.java b/test/hotspot/jtreg/vmTestbase/gc/g1/unloading/tests/unloading_compilation_level3_keep_obj/TestDescription.java
new file mode 100644
index 0000000..b0d5ce1
--- /dev/null
+++ b/test/hotspot/jtreg/vmTestbase/gc/g1/unloading/tests/unloading_compilation_level3_keep_obj/TestDescription.java
@@ -0,0 +1,66 @@
+/*
+ * 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.
+ */
+
+
+/*
+ * @test
+ * @key stress gc
+ *
+ * @summary converted from VM Testbase gc/g1/unloading/tests/unloading_compilation_level3_keep_obj.
+ * VM Testbase keywords: [gc, stress, stressopt, nonconcurrent, javac]
+ *
+ * @modules java.base/jdk.internal.misc
+ * @library /vmTestbase
+ * /test/lib
+ *
+ * @run driver jdk.test.lib.FileInstaller . .
+ *
+ * @comment generate HumongousTemplateClass and compile it to test.classes
+ * @run driver gc.g1.unloading.bytecode.GenClassesBuilder
+ *
+ * @build sun.hotspot.WhiteBox
+ * @run driver ClassFileInstaller sun.hotspot.WhiteBox
+ * sun.hotspot.WhiteBox$WhiteBoxPermission
+ * @run main/othervm
+ * -Xbootclasspath/a:.
+ * -XX:+UnlockDiagnosticVMOptions
+ * -XX:+WhiteBoxAPI
+ * -XX:+UseG1GC
+ * -XX:+ExplicitGCInvokesConcurrent
+ * -Xbootclasspath/a:.
+ * -XX:+UnlockDiagnosticVMOptions
+ * -XX:+WhiteBoxAPI
+ * -XX:+UseG1GC
+ * -XX:+ExplicitGCInvokesConcurrent
+ * -Xlog:gc:gc.log
+ * -XX:-UseGCOverheadLimit
+ * -Xlog:gc:gc.log
+ * -XX:-UseGCOverheadLimit
+ * gc.g1.unloading.UnloadingTest
+ * -compilationNumber 1
+ * -compilationLevel 3
+ * -keep object
+ * -numberOfChecksLimit 4
+ * -stressTime 180
+ */
+
diff --git a/test/hotspot/jtreg/vmTestbase/gc/g1/unloading/tests/unloading_compilation_level4_inMemoryCompilation_keep_cl/TEST.properties b/test/hotspot/jtreg/vmTestbase/gc/g1/unloading/tests/unloading_compilation_level4_inMemoryCompilation_keep_cl/TEST.properties
new file mode 100644
index 0000000..04b22a1
--- /dev/null
+++ b/test/hotspot/jtreg/vmTestbase/gc/g1/unloading/tests/unloading_compilation_level4_inMemoryCompilation_keep_cl/TEST.properties
@@ -0,0 +1,23 @@
+#
+# 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/g1/unloading/tests/unloading_compilation_level4_inMemoryCompilation_keep_cl/TestDescription.java b/test/hotspot/jtreg/vmTestbase/gc/g1/unloading/tests/unloading_compilation_level4_inMemoryCompilation_keep_cl/TestDescription.java
new file mode 100644
index 0000000..f4fa303
--- /dev/null
+++ b/test/hotspot/jtreg/vmTestbase/gc/g1/unloading/tests/unloading_compilation_level4_inMemoryCompilation_keep_cl/TestDescription.java
@@ -0,0 +1,67 @@
+/*
+ * 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.
+ */
+
+
+/*
+ * @test
+ * @key stress gc
+ *
+ * @summary converted from VM Testbase gc/g1/unloading/tests/unloading_compilation_level4_inMemoryCompilation_keep_cl.
+ * VM Testbase keywords: [gc, stress, stressopt, nonconcurrent, javac]
+ *
+ * @modules java.base/jdk.internal.misc
+ * @library /vmTestbase
+ * /test/lib
+ *
+ * @run driver jdk.test.lib.FileInstaller . .
+ *
+ * @comment generate HumongousTemplateClass and compile it to test.classes
+ * @run driver gc.g1.unloading.bytecode.GenClassesBuilder
+ *
+ * @build sun.hotspot.WhiteBox
+ * @run driver ClassFileInstaller sun.hotspot.WhiteBox
+ * sun.hotspot.WhiteBox$WhiteBoxPermission
+ * @run main/othervm
+ * -Xbootclasspath/a:.
+ * -XX:+UnlockDiagnosticVMOptions
+ * -XX:+WhiteBoxAPI
+ * -XX:+UseG1GC
+ * -XX:+ExplicitGCInvokesConcurrent
+ * -Xbootclasspath/a:.
+ * -XX:+UnlockDiagnosticVMOptions
+ * -XX:+WhiteBoxAPI
+ * -XX:+UseG1GC
+ * -XX:+ExplicitGCInvokesConcurrent
+ * -Xlog:gc:gc.log
+ * -XX:-UseGCOverheadLimit
+ * -Xlog:gc:gc.log
+ * -XX:-UseGCOverheadLimit
+ * gc.g1.unloading.UnloadingTest
+ * -compilationNumber 1
+ * -compilationLevel 4
+ * -inMemoryCompilation
+ * -keep classloader
+ * -numberOfChecksLimit 4
+ * -stressTime 180
+ */
+
diff --git a/test/hotspot/jtreg/vmTestbase/gc/g1/unloading/tests/unloading_compilation_level4_inMemoryCompilation_keep_class/TEST.properties b/test/hotspot/jtreg/vmTestbase/gc/g1/unloading/tests/unloading_compilation_level4_inMemoryCompilation_keep_class/TEST.properties
new file mode 100644
index 0000000..04b22a1
--- /dev/null
+++ b/test/hotspot/jtreg/vmTestbase/gc/g1/unloading/tests/unloading_compilation_level4_inMemoryCompilation_keep_class/TEST.properties
@@ -0,0 +1,23 @@
+#
+# 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/g1/unloading/tests/unloading_compilation_level4_inMemoryCompilation_keep_class/TestDescription.java b/test/hotspot/jtreg/vmTestbase/gc/g1/unloading/tests/unloading_compilation_level4_inMemoryCompilation_keep_class/TestDescription.java
new file mode 100644
index 0000000..8a09e95
--- /dev/null
+++ b/test/hotspot/jtreg/vmTestbase/gc/g1/unloading/tests/unloading_compilation_level4_inMemoryCompilation_keep_class/TestDescription.java
@@ -0,0 +1,67 @@
+/*
+ * 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.
+ */
+
+
+/*
+ * @test
+ * @key stress gc
+ *
+ * @summary converted from VM Testbase gc/g1/unloading/tests/unloading_compilation_level4_inMemoryCompilation_keep_class.
+ * VM Testbase keywords: [gc, stress, stressopt, nonconcurrent, javac]
+ *
+ * @modules java.base/jdk.internal.misc
+ * @library /vmTestbase
+ * /test/lib
+ *
+ * @run driver jdk.test.lib.FileInstaller . .
+ *
+ * @comment generate HumongousTemplateClass and compile it to test.classes
+ * @run driver gc.g1.unloading.bytecode.GenClassesBuilder
+ *
+ * @build sun.hotspot.WhiteBox
+ * @run driver ClassFileInstaller sun.hotspot.WhiteBox
+ * sun.hotspot.WhiteBox$WhiteBoxPermission
+ * @run main/othervm
+ * -Xbootclasspath/a:.
+ * -XX:+UnlockDiagnosticVMOptions
+ * -XX:+WhiteBoxAPI
+ * -XX:+UseG1GC
+ * -XX:+ExplicitGCInvokesConcurrent
+ * -Xbootclasspath/a:.
+ * -XX:+UnlockDiagnosticVMOptions
+ * -XX:+WhiteBoxAPI
+ * -XX:+UseG1GC
+ * -XX:+ExplicitGCInvokesConcurrent
+ * -Xlog:gc:gc.log
+ * -XX:-UseGCOverheadLimit
+ * -Xlog:gc:gc.log
+ * -XX:-UseGCOverheadLimit
+ * gc.g1.unloading.UnloadingTest
+ * -compilationNumber 1
+ * -compilationLevel 4
+ * -inMemoryCompilation
+ * -keep class
+ * -numberOfChecksLimit 4
+ * -stressTime 180
+ */
+
diff --git a/test/hotspot/jtreg/vmTestbase/gc/g1/unloading/tests/unloading_compilation_level4_inMemoryCompilation_keep_obj/TEST.properties b/test/hotspot/jtreg/vmTestbase/gc/g1/unloading/tests/unloading_compilation_level4_inMemoryCompilation_keep_obj/TEST.properties
new file mode 100644
index 0000000..04b22a1
--- /dev/null
+++ b/test/hotspot/jtreg/vmTestbase/gc/g1/unloading/tests/unloading_compilation_level4_inMemoryCompilation_keep_obj/TEST.properties
@@ -0,0 +1,23 @@
+#
+# 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/g1/unloading/tests/unloading_compilation_level4_inMemoryCompilation_keep_obj/TestDescription.java b/test/hotspot/jtreg/vmTestbase/gc/g1/unloading/tests/unloading_compilation_level4_inMemoryCompilation_keep_obj/TestDescription.java
new file mode 100644
index 0000000..fc6e3d1
--- /dev/null
+++ b/test/hotspot/jtreg/vmTestbase/gc/g1/unloading/tests/unloading_compilation_level4_inMemoryCompilation_keep_obj/TestDescription.java
@@ -0,0 +1,67 @@
+/*
+ * 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.
+ */
+
+
+/*
+ * @test
+ * @key stress gc
+ *
+ * @summary converted from VM Testbase gc/g1/unloading/tests/unloading_compilation_level4_inMemoryCompilation_keep_obj.
+ * VM Testbase keywords: [gc, stress, stressopt, nonconcurrent, javac]
+ *
+ * @modules java.base/jdk.internal.misc
+ * @library /vmTestbase
+ * /test/lib
+ *
+ * @run driver jdk.test.lib.FileInstaller . .
+ *
+ * @comment generate HumongousTemplateClass and compile it to test.classes
+ * @run driver gc.g1.unloading.bytecode.GenClassesBuilder
+ *
+ * @build sun.hotspot.WhiteBox
+ * @run driver ClassFileInstaller sun.hotspot.WhiteBox
+ * sun.hotspot.WhiteBox$WhiteBoxPermission
+ * @run main/othervm
+ * -Xbootclasspath/a:.
+ * -XX:+UnlockDiagnosticVMOptions
+ * -XX:+WhiteBoxAPI
+ * -XX:+UseG1GC
+ * -XX:+ExplicitGCInvokesConcurrent
+ * -Xbootclasspath/a:.
+ * -XX:+UnlockDiagnosticVMOptions
+ * -XX:+WhiteBoxAPI
+ * -XX:+UseG1GC
+ * -XX:+ExplicitGCInvokesConcurrent
+ * -Xlog:gc:gc.log
+ * -XX:-UseGCOverheadLimit
+ * -Xlog:gc:gc.log
+ * -XX:-UseGCOverheadLimit
+ * gc.g1.unloading.UnloadingTest
+ * -compilationNumber 1
+ * -compilationLevel 4
+ * -inMemoryCompilation
+ * -keep object
+ * -numberOfChecksLimit 4
+ * -stressTime 180
+ */
+
diff --git a/test/hotspot/jtreg/vmTestbase/gc/g1/unloading/tests/unloading_compilation_level4_keep_cl/TEST.properties b/test/hotspot/jtreg/vmTestbase/gc/g1/unloading/tests/unloading_compilation_level4_keep_cl/TEST.properties
new file mode 100644
index 0000000..04b22a1
--- /dev/null
+++ b/test/hotspot/jtreg/vmTestbase/gc/g1/unloading/tests/unloading_compilation_level4_keep_cl/TEST.properties
@@ -0,0 +1,23 @@
+#
+# 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/g1/unloading/tests/unloading_compilation_level4_keep_cl/TestDescription.java b/test/hotspot/jtreg/vmTestbase/gc/g1/unloading/tests/unloading_compilation_level4_keep_cl/TestDescription.java
new file mode 100644
index 0000000..16e4d85
--- /dev/null
+++ b/test/hotspot/jtreg/vmTestbase/gc/g1/unloading/tests/unloading_compilation_level4_keep_cl/TestDescription.java
@@ -0,0 +1,66 @@
+/*
+ * 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.
+ */
+
+
+/*
+ * @test
+ * @key stress gc
+ *
+ * @summary converted from VM Testbase gc/g1/unloading/tests/unloading_compilation_level4_keep_cl.
+ * VM Testbase keywords: [gc, stress, stressopt, nonconcurrent, javac]
+ *
+ * @modules java.base/jdk.internal.misc
+ * @library /vmTestbase
+ * /test/lib
+ *
+ * @run driver jdk.test.lib.FileInstaller . .
+ *
+ * @comment generate HumongousTemplateClass and compile it to test.classes
+ * @run driver gc.g1.unloading.bytecode.GenClassesBuilder
+ *
+ * @build sun.hotspot.WhiteBox
+ * @run driver ClassFileInstaller sun.hotspot.WhiteBox
+ * sun.hotspot.WhiteBox$WhiteBoxPermission
+ * @run main/othervm
+ * -Xbootclasspath/a:.
+ * -XX:+UnlockDiagnosticVMOptions
+ * -XX:+WhiteBoxAPI
+ * -XX:+UseG1GC
+ * -XX:+ExplicitGCInvokesConcurrent
+ * -Xbootclasspath/a:.
+ * -XX:+UnlockDiagnosticVMOptions
+ * -XX:+WhiteBoxAPI
+ * -XX:+UseG1GC
+ * -XX:+ExplicitGCInvokesConcurrent
+ * -Xlog:gc:gc.log
+ * -XX:-UseGCOverheadLimit
+ * -Xlog:gc:gc.log
+ * -XX:-UseGCOverheadLimit
+ * gc.g1.unloading.UnloadingTest
+ * -compilationNumber 1
+ * -compilationLevel 4
+ * -keep classloader
+ * -numberOfChecksLimit 4
+ * -stressTime 180
+ */
+
diff --git a/test/hotspot/jtreg/vmTestbase/gc/g1/unloading/tests/unloading_compilation_level4_keep_class/TEST.properties b/test/hotspot/jtreg/vmTestbase/gc/g1/unloading/tests/unloading_compilation_level4_keep_class/TEST.properties
new file mode 100644
index 0000000..04b22a1
--- /dev/null
+++ b/test/hotspot/jtreg/vmTestbase/gc/g1/unloading/tests/unloading_compilation_level4_keep_class/TEST.properties
@@ -0,0 +1,23 @@
+#
+# 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/g1/unloading/tests/unloading_compilation_level4_keep_class/TestDescription.java b/test/hotspot/jtreg/vmTestbase/gc/g1/unloading/tests/unloading_compilation_level4_keep_class/TestDescription.java
new file mode 100644
index 0000000..14b0aed
--- /dev/null
+++ b/test/hotspot/jtreg/vmTestbase/gc/g1/unloading/tests/unloading_compilation_level4_keep_class/TestDescription.java
@@ -0,0 +1,66 @@
+/*
+ * 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.
+ */
+
+
+/*
+ * @test
+ * @key stress gc
+ *
+ * @summary converted from VM Testbase gc/g1/unloading/tests/unloading_compilation_level4_keep_class.
+ * VM Testbase keywords: [gc, stress, stressopt, nonconcurrent, javac]
+ *
+ * @modules java.base/jdk.internal.misc
+ * @library /vmTestbase
+ * /test/lib
+ *
+ * @run driver jdk.test.lib.FileInstaller . .
+ *
+ * @comment generate HumongousTemplateClass and compile it to test.classes
+ * @run driver gc.g1.unloading.bytecode.GenClassesBuilder
+ *
+ * @build sun.hotspot.WhiteBox
+ * @run driver ClassFileInstaller sun.hotspot.WhiteBox
+ * sun.hotspot.WhiteBox$WhiteBoxPermission
+ * @run main/othervm
+ * -Xbootclasspath/a:.
+ * -XX:+UnlockDiagnosticVMOptions
+ * -XX:+WhiteBoxAPI
+ * -XX:+UseG1GC
+ * -XX:+ExplicitGCInvokesConcurrent
+ * -Xbootclasspath/a:.
+ * -XX:+UnlockDiagnosticVMOptions
+ * -XX:+WhiteBoxAPI
+ * -XX:+UseG1GC
+ * -XX:+ExplicitGCInvokesConcurrent
+ * -Xlog:gc:gc.log
+ * -XX:-UseGCOverheadLimit
+ * -Xlog:gc:gc.log
+ * -XX:-UseGCOverheadLimit
+ * gc.g1.unloading.UnloadingTest
+ * -compilationNumber 1
+ * -compilationLevel 4
+ * -keep class
+ * -numberOfChecksLimit 4
+ * -stressTime 180
+ */
+
diff --git a/test/hotspot/jtreg/vmTestbase/gc/g1/unloading/tests/unloading_compilation_level4_keep_obj/TEST.properties b/test/hotspot/jtreg/vmTestbase/gc/g1/unloading/tests/unloading_compilation_level4_keep_obj/TEST.properties
new file mode 100644
index 0000000..04b22a1
--- /dev/null
+++ b/test/hotspot/jtreg/vmTestbase/gc/g1/unloading/tests/unloading_compilation_level4_keep_obj/TEST.properties
@@ -0,0 +1,23 @@
+#
+# 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/g1/unloading/tests/unloading_compilation_level4_keep_obj/TestDescription.java b/test/hotspot/jtreg/vmTestbase/gc/g1/unloading/tests/unloading_compilation_level4_keep_obj/TestDescription.java
new file mode 100644
index 0000000..05a662a
--- /dev/null
+++ b/test/hotspot/jtreg/vmTestbase/gc/g1/unloading/tests/unloading_compilation_level4_keep_obj/TestDescription.java
@@ -0,0 +1,66 @@
+/*
+ * 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.
+ */
+
+
+/*
+ * @test
+ * @key stress gc
+ *
+ * @summary converted from VM Testbase gc/g1/unloading/tests/unloading_compilation_level4_keep_obj.
+ * VM Testbase keywords: [gc, stress, stressopt, nonconcurrent, javac]
+ *
+ * @modules java.base/jdk.internal.misc
+ * @library /vmTestbase
+ * /test/lib
+ *
+ * @run driver jdk.test.lib.FileInstaller . .
+ *
+ * @comment generate HumongousTemplateClass and compile it to test.classes
+ * @run driver gc.g1.unloading.bytecode.GenClassesBuilder
+ *
+ * @build sun.hotspot.WhiteBox
+ * @run driver ClassFileInstaller sun.hotspot.WhiteBox
+ * sun.hotspot.WhiteBox$WhiteBoxPermission
+ * @run main/othervm
+ * -Xbootclasspath/a:.
+ * -XX:+UnlockDiagnosticVMOptions
+ * -XX:+WhiteBoxAPI
+ * -XX:+UseG1GC
+ * -XX:+ExplicitGCInvokesConcurrent
+ * -Xbootclasspath/a:.
+ * -XX:+UnlockDiagnosticVMOptions
+ * -XX:+WhiteBoxAPI
+ * -XX:+UseG1GC
+ * -XX:+ExplicitGCInvokesConcurrent
+ * -Xlog:gc:gc.log
+ * -XX:-UseGCOverheadLimit
+ * -Xlog:gc:gc.log
+ * -XX:-UseGCOverheadLimit
+ * gc.g1.unloading.UnloadingTest
+ * -compilationNumber 1
+ * -compilationLevel 4
+ * -keep object
+ * -numberOfChecksLimit 4
+ * -stressTime 180
+ */
+
diff --git a/test/hotspot/jtreg/vmTestbase/gc/g1/unloading/tests/unloading_humongous_class_inMemoryCompilation_keep_cl/TEST.properties b/test/hotspot/jtreg/vmTestbase/gc/g1/unloading/tests/unloading_humongous_class_inMemoryCompilation_keep_cl/TEST.properties
new file mode 100644
index 0000000..04b22a1
--- /dev/null
+++ b/test/hotspot/jtreg/vmTestbase/gc/g1/unloading/tests/unloading_humongous_class_inMemoryCompilation_keep_cl/TEST.properties
@@ -0,0 +1,23 @@
+#
+# 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/g1/unloading/tests/unloading_humongous_class_inMemoryCompilation_keep_cl/TestDescription.java b/test/hotspot/jtreg/vmTestbase/gc/g1/unloading/tests/unloading_humongous_class_inMemoryCompilation_keep_cl/TestDescription.java
new file mode 100644
index 0000000..b677c9f
--- /dev/null
+++ b/test/hotspot/jtreg/vmTestbase/gc/g1/unloading/tests/unloading_humongous_class_inMemoryCompilation_keep_cl/TestDescription.java
@@ -0,0 +1,66 @@
+/*
+ * 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.
+ */
+
+
+/*
+ * @test
+ * @key stress gc
+ *
+ * @summary converted from VM Testbase gc/g1/unloading/tests/unloading_humongous_class_inMemoryCompilation_keep_cl.
+ * VM Testbase keywords: [gc, stress, stressopt, nonconcurrent, javac]
+ *
+ * @modules java.base/jdk.internal.misc
+ * @library /vmTestbase
+ * /test/lib
+ *
+ * @run driver jdk.test.lib.FileInstaller . .
+ *
+ * @comment generate HumongousTemplateClass and compile it to test.classes
+ * @run driver gc.g1.unloading.bytecode.GenClassesBuilder
+ *
+ * @build sun.hotspot.WhiteBox
+ * @run driver ClassFileInstaller sun.hotspot.WhiteBox
+ * sun.hotspot.WhiteBox$WhiteBoxPermission
+ * @run main/othervm
+ * -Xbootclasspath/a:.
+ * -XX:+UnlockDiagnosticVMOptions
+ * -XX:+WhiteBoxAPI
+ * -XX:+UseG1GC
+ * -XX:+ExplicitGCInvokesConcurrent
+ * -Xbootclasspath/a:.
+ * -XX:+UnlockDiagnosticVMOptions
+ * -XX:+WhiteBoxAPI
+ * -XX:+UseG1GC
+ * -XX:+ExplicitGCInvokesConcurrent
+ * -Xlog:gc:gc.log
+ * -XX:-UseGCOverheadLimit
+ * -Xlog:gc:gc.log
+ * -XX:-UseGCOverheadLimit
+ * gc.g1.unloading.UnloadingTest
+ * -humongousClass
+ * -inMemoryCompilation
+ * -keep classloader
+ * -numberOfChecksLimit 4
+ * -stressTime 180
+ */
+
diff --git a/test/hotspot/jtreg/vmTestbase/gc/g1/unloading/tests/unloading_humongous_class_inMemoryCompilation_keep_class/TEST.properties b/test/hotspot/jtreg/vmTestbase/gc/g1/unloading/tests/unloading_humongous_class_inMemoryCompilation_keep_class/TEST.properties
new file mode 100644
index 0000000..04b22a1
--- /dev/null
+++ b/test/hotspot/jtreg/vmTestbase/gc/g1/unloading/tests/unloading_humongous_class_inMemoryCompilation_keep_class/TEST.properties
@@ -0,0 +1,23 @@
+#
+# 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/g1/unloading/tests/unloading_humongous_class_inMemoryCompilation_keep_class/TestDescription.java b/test/hotspot/jtreg/vmTestbase/gc/g1/unloading/tests/unloading_humongous_class_inMemoryCompilation_keep_class/TestDescription.java
new file mode 100644
index 0000000..7e50336
--- /dev/null
+++ b/test/hotspot/jtreg/vmTestbase/gc/g1/unloading/tests/unloading_humongous_class_inMemoryCompilation_keep_class/TestDescription.java
@@ -0,0 +1,66 @@
+/*
+ * 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.
+ */
+
+
+/*
+ * @test
+ * @key stress gc
+ *
+ * @summary converted from VM Testbase gc/g1/unloading/tests/unloading_humongous_class_inMemoryCompilation_keep_class.
+ * VM Testbase keywords: [gc, stress, stressopt, nonconcurrent, javac]
+ *
+ * @modules java.base/jdk.internal.misc
+ * @library /vmTestbase
+ * /test/lib
+ *
+ * @run driver jdk.test.lib.FileInstaller . .
+ *
+ * @comment generate HumongousTemplateClass and compile it to test.classes
+ * @run driver gc.g1.unloading.bytecode.GenClassesBuilder
+ *
+ * @build sun.hotspot.WhiteBox
+ * @run driver ClassFileInstaller sun.hotspot.WhiteBox
+ * sun.hotspot.WhiteBox$WhiteBoxPermission
+ * @run main/othervm
+ * -Xbootclasspath/a:.
+ * -XX:+UnlockDiagnosticVMOptions
+ * -XX:+WhiteBoxAPI
+ * -XX:+UseG1GC
+ * -XX:+ExplicitGCInvokesConcurrent
+ * -Xbootclasspath/a:.
+ * -XX:+UnlockDiagnosticVMOptions
+ * -XX:+WhiteBoxAPI
+ * -XX:+UseG1GC
+ * -XX:+ExplicitGCInvokesConcurrent
+ * -Xlog:gc:gc.log
+ * -XX:-UseGCOverheadLimit
+ * -Xlog:gc:gc.log
+ * -XX:-UseGCOverheadLimit
+ * gc.g1.unloading.UnloadingTest
+ * -humongousClass
+ * -inMemoryCompilation
+ * -keep class
+ * -numberOfChecksLimit 4
+ * -stressTime 180
+ */
+
diff --git a/test/hotspot/jtreg/vmTestbase/gc/g1/unloading/tests/unloading_humongous_class_inMemoryCompilation_keep_obj/TEST.properties b/test/hotspot/jtreg/vmTestbase/gc/g1/unloading/tests/unloading_humongous_class_inMemoryCompilation_keep_obj/TEST.properties
new file mode 100644
index 0000000..04b22a1
--- /dev/null
+++ b/test/hotspot/jtreg/vmTestbase/gc/g1/unloading/tests/unloading_humongous_class_inMemoryCompilation_keep_obj/TEST.properties
@@ -0,0 +1,23 @@
+#
+# 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/g1/unloading/tests/unloading_humongous_class_inMemoryCompilation_keep_obj/TestDescription.java b/test/hotspot/jtreg/vmTestbase/gc/g1/unloading/tests/unloading_humongous_class_inMemoryCompilation_keep_obj/TestDescription.java
new file mode 100644
index 0000000..e47ca2e
--- /dev/null
+++ b/test/hotspot/jtreg/vmTestbase/gc/g1/unloading/tests/unloading_humongous_class_inMemoryCompilation_keep_obj/TestDescription.java
@@ -0,0 +1,66 @@
+/*
+ * 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.
+ */
+
+
+/*
+ * @test
+ * @key stress gc
+ *
+ * @summary converted from VM Testbase gc/g1/unloading/tests/unloading_humongous_class_inMemoryCompilation_keep_obj.
+ * VM Testbase keywords: [gc, stress, stressopt, nonconcurrent, javac]
+ *
+ * @modules java.base/jdk.internal.misc
+ * @library /vmTestbase
+ * /test/lib
+ *
+ * @run driver jdk.test.lib.FileInstaller . .
+ *
+ * @comment generate HumongousTemplateClass and compile it to test.classes
+ * @run driver gc.g1.unloading.bytecode.GenClassesBuilder
+ *
+ * @build sun.hotspot.WhiteBox
+ * @run driver ClassFileInstaller sun.hotspot.WhiteBox
+ * sun.hotspot.WhiteBox$WhiteBoxPermission
+ * @run main/othervm
+ * -Xbootclasspath/a:.
+ * -XX:+UnlockDiagnosticVMOptions
+ * -XX:+WhiteBoxAPI
+ * -XX:+UseG1GC
+ * -XX:+ExplicitGCInvokesConcurrent
+ * -Xbootclasspath/a:.
+ * -XX:+UnlockDiagnosticVMOptions
+ * -XX:+WhiteBoxAPI
+ * -XX:+UseG1GC
+ * -XX:+ExplicitGCInvokesConcurrent
+ * -Xlog:gc:gc.log
+ * -XX:-UseGCOverheadLimit
+ * -Xlog:gc:gc.log
+ * -XX:-UseGCOverheadLimit
+ * gc.g1.unloading.UnloadingTest
+ * -humongousClass
+ * -inMemoryCompilation
+ * -keep object
+ * -numberOfChecksLimit 4
+ * -stressTime 180
+ */
+
diff --git a/test/hotspot/jtreg/vmTestbase/gc/g1/unloading/tests/unloading_humongous_class_keep_cl/TEST.properties b/test/hotspot/jtreg/vmTestbase/gc/g1/unloading/tests/unloading_humongous_class_keep_cl/TEST.properties
new file mode 100644
index 0000000..04b22a1
--- /dev/null
+++ b/test/hotspot/jtreg/vmTestbase/gc/g1/unloading/tests/unloading_humongous_class_keep_cl/TEST.properties
@@ -0,0 +1,23 @@
+#
+# 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/g1/unloading/tests/unloading_humongous_class_keep_cl/TestDescription.java b/test/hotspot/jtreg/vmTestbase/gc/g1/unloading/tests/unloading_humongous_class_keep_cl/TestDescription.java
new file mode 100644
index 0000000..6c318e6
--- /dev/null
+++ b/test/hotspot/jtreg/vmTestbase/gc/g1/unloading/tests/unloading_humongous_class_keep_cl/TestDescription.java
@@ -0,0 +1,65 @@
+/*
+ * 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.
+ */
+
+
+/*
+ * @test
+ * @key stress gc
+ *
+ * @summary converted from VM Testbase gc/g1/unloading/tests/unloading_humongous_class_keep_cl.
+ * VM Testbase keywords: [gc, stress, stressopt, nonconcurrent, javac]
+ *
+ * @modules java.base/jdk.internal.misc
+ * @library /vmTestbase
+ * /test/lib
+ *
+ * @run driver jdk.test.lib.FileInstaller . .
+ *
+ * @comment generate HumongousTemplateClass and compile it to test.classes
+ * @run driver gc.g1.unloading.bytecode.GenClassesBuilder
+ *
+ * @build sun.hotspot.WhiteBox
+ * @run driver ClassFileInstaller sun.hotspot.WhiteBox
+ * sun.hotspot.WhiteBox$WhiteBoxPermission
+ * @run main/othervm
+ * -Xbootclasspath/a:.
+ * -XX:+UnlockDiagnosticVMOptions
+ * -XX:+WhiteBoxAPI
+ * -XX:+UseG1GC
+ * -XX:+ExplicitGCInvokesConcurrent
+ * -Xbootclasspath/a:.
+ * -XX:+UnlockDiagnosticVMOptions
+ * -XX:+WhiteBoxAPI
+ * -XX:+UseG1GC
+ * -XX:+ExplicitGCInvokesConcurrent
+ * -Xlog:gc:gc.log
+ * -XX:-UseGCOverheadLimit
+ * -Xlog:gc:gc.log
+ * -XX:-UseGCOverheadLimit
+ * gc.g1.unloading.UnloadingTest
+ * -humongousClass
+ * -keep classloader
+ * -numberOfChecksLimit 4
+ * -stressTime 180
+ */
+
diff --git a/test/hotspot/jtreg/vmTestbase/gc/g1/unloading/tests/unloading_humongous_class_keep_class/TEST.properties b/test/hotspot/jtreg/vmTestbase/gc/g1/unloading/tests/unloading_humongous_class_keep_class/TEST.properties
new file mode 100644
index 0000000..04b22a1
--- /dev/null
+++ b/test/hotspot/jtreg/vmTestbase/gc/g1/unloading/tests/unloading_humongous_class_keep_class/TEST.properties
@@ -0,0 +1,23 @@
+#
+# 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/g1/unloading/tests/unloading_humongous_class_keep_class/TestDescription.java b/test/hotspot/jtreg/vmTestbase/gc/g1/unloading/tests/unloading_humongous_class_keep_class/TestDescription.java
new file mode 100644
index 0000000..22a2b46
--- /dev/null
+++ b/test/hotspot/jtreg/vmTestbase/gc/g1/unloading/tests/unloading_humongous_class_keep_class/TestDescription.java
@@ -0,0 +1,65 @@
+/*
+ * 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.
+ */
+
+
+/*
+ * @test
+ * @key stress gc
+ *
+ * @summary converted from VM Testbase gc/g1/unloading/tests/unloading_humongous_class_keep_class.
+ * VM Testbase keywords: [gc, stress, stressopt, nonconcurrent, javac]
+ *
+ * @modules java.base/jdk.internal.misc
+ * @library /vmTestbase
+ * /test/lib
+ *
+ * @run driver jdk.test.lib.FileInstaller . .
+ *
+ * @comment generate HumongousTemplateClass and compile it to test.classes
+ * @run driver gc.g1.unloading.bytecode.GenClassesBuilder
+ *
+ * @build sun.hotspot.WhiteBox
+ * @run driver ClassFileInstaller sun.hotspot.WhiteBox
+ * sun.hotspot.WhiteBox$WhiteBoxPermission
+ * @run main/othervm
+ * -Xbootclasspath/a:.
+ * -XX:+UnlockDiagnosticVMOptions
+ * -XX:+WhiteBoxAPI
+ * -XX:+UseG1GC
+ * -XX:+ExplicitGCInvokesConcurrent
+ * -Xbootclasspath/a:.
+ * -XX:+UnlockDiagnosticVMOptions
+ * -XX:+WhiteBoxAPI
+ * -XX:+UseG1GC
+ * -XX:+ExplicitGCInvokesConcurrent
+ * -Xlog:gc:gc.log
+ * -XX:-UseGCOverheadLimit
+ * -Xlog:gc:gc.log
+ * -XX:-UseGCOverheadLimit
+ * gc.g1.unloading.UnloadingTest
+ * -humongousClass
+ * -keep class
+ * -numberOfChecksLimit 4
+ * -stressTime 180
+ */
+
diff --git a/test/hotspot/jtreg/vmTestbase/gc/g1/unloading/tests/unloading_humongous_class_keep_obj/TEST.properties b/test/hotspot/jtreg/vmTestbase/gc/g1/unloading/tests/unloading_humongous_class_keep_obj/TEST.properties
new file mode 100644
index 0000000..04b22a1
--- /dev/null
+++ b/test/hotspot/jtreg/vmTestbase/gc/g1/unloading/tests/unloading_humongous_class_keep_obj/TEST.properties
@@ -0,0 +1,23 @@
+#
+# 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/g1/unloading/tests/unloading_humongous_class_keep_obj/TestDescription.java b/test/hotspot/jtreg/vmTestbase/gc/g1/unloading/tests/unloading_humongous_class_keep_obj/TestDescription.java
new file mode 100644
index 0000000..d1e15fd
--- /dev/null
+++ b/test/hotspot/jtreg/vmTestbase/gc/g1/unloading/tests/unloading_humongous_class_keep_obj/TestDescription.java
@@ -0,0 +1,65 @@
+/*
+ * 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.
+ */
+
+
+/*
+ * @test
+ * @key stress gc
+ *
+ * @summary converted from VM Testbase gc/g1/unloading/tests/unloading_humongous_class_keep_obj.
+ * VM Testbase keywords: [gc, stress, stressopt, nonconcurrent, javac]
+ *
+ * @modules java.base/jdk.internal.misc
+ * @library /vmTestbase
+ * /test/lib
+ *
+ * @run driver jdk.test.lib.FileInstaller . .
+ *
+ * @comment generate HumongousTemplateClass and compile it to test.classes
+ * @run driver gc.g1.unloading.bytecode.GenClassesBuilder
+ *
+ * @build sun.hotspot.WhiteBox
+ * @run driver ClassFileInstaller sun.hotspot.WhiteBox
+ * sun.hotspot.WhiteBox$WhiteBoxPermission
+ * @run main/othervm
+ * -Xbootclasspath/a:.
+ * -XX:+UnlockDiagnosticVMOptions
+ * -XX:+WhiteBoxAPI
+ * -XX:+UseG1GC
+ * -XX:+ExplicitGCInvokesConcurrent
+ * -Xbootclasspath/a:.
+ * -XX:+UnlockDiagnosticVMOptions
+ * -XX:+WhiteBoxAPI
+ * -XX:+UseG1GC
+ * -XX:+ExplicitGCInvokesConcurrent
+ * -Xlog:gc:gc.log
+ * -XX:-UseGCOverheadLimit
+ * -Xlog:gc:gc.log
+ * -XX:-UseGCOverheadLimit
+ * gc.g1.unloading.UnloadingTest
+ * -humongousClass
+ * -keep object
+ * -numberOfChecksLimit 4
+ * -stressTime 180
+ */
+
diff --git a/test/hotspot/jtreg/vmTestbase/gc/g1/unloading/tests/unloading_jni_classloading_inMemoryCompilation_keep_cl/TEST.properties b/test/hotspot/jtreg/vmTestbase/gc/g1/unloading/tests/unloading_jni_classloading_inMemoryCompilation_keep_cl/TEST.properties
new file mode 100644
index 0000000..04b22a1
--- /dev/null
+++ b/test/hotspot/jtreg/vmTestbase/gc/g1/unloading/tests/unloading_jni_classloading_inMemoryCompilation_keep_cl/TEST.properties
@@ -0,0 +1,23 @@
+#
+# 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/g1/unloading/tests/unloading_jni_classloading_inMemoryCompilation_keep_cl/TestDescription.java b/test/hotspot/jtreg/vmTestbase/gc/g1/unloading/tests/unloading_jni_classloading_inMemoryCompilation_keep_cl/TestDescription.java
new file mode 100644
index 0000000..c0cf8b3
--- /dev/null
+++ b/test/hotspot/jtreg/vmTestbase/gc/g1/unloading/tests/unloading_jni_classloading_inMemoryCompilation_keep_cl/TestDescription.java
@@ -0,0 +1,66 @@
+/*
+ * 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.
+ */
+
+
+/*
+ * @test
+ * @key stress gc
+ *
+ * @summary converted from VM Testbase gc/g1/unloading/tests/unloading_jni_classloading_inMemoryCompilation_keep_cl.
+ * VM Testbase keywords: [gc, stress, stressopt, nonconcurrent, javac]
+ *
+ * @modules java.base/jdk.internal.misc
+ * @library /vmTestbase
+ * /test/lib
+ *
+ * @run driver jdk.test.lib.FileInstaller . .
+ *
+ * @comment generate HumongousTemplateClass and compile it to test.classes
+ * @run driver gc.g1.unloading.bytecode.GenClassesBuilder
+ *
+ * @build sun.hotspot.WhiteBox
+ * @run driver ClassFileInstaller sun.hotspot.WhiteBox
+ * sun.hotspot.WhiteBox$WhiteBoxPermission
+ * @run main/othervm/native
+ * -Xbootclasspath/a:.
+ * -XX:+UnlockDiagnosticVMOptions
+ * -XX:+WhiteBoxAPI
+ * -XX:+UseG1GC
+ * -XX:+ExplicitGCInvokesConcurrent
+ * -Xbootclasspath/a:.
+ * -XX:+UnlockDiagnosticVMOptions
+ * -XX:+WhiteBoxAPI
+ * -XX:+UseG1GC
+ * -XX:+ExplicitGCInvokesConcurrent
+ * -Xlog:gc:gc.log
+ * -XX:-UseGCOverheadLimit
+ * -Xlog:gc:gc.log
+ * -XX:-UseGCOverheadLimit
+ * gc.g1.unloading.UnloadingTest
+ * -classloadingMethod jni
+ * -inMemoryCompilation
+ * -keep classloader
+ * -numberOfChecksLimit 4
+ * -stressTime 180
+ */
+
diff --git a/test/hotspot/jtreg/vmTestbase/gc/g1/unloading/tests/unloading_jni_classloading_inMemoryCompilation_keep_class/TEST.properties b/test/hotspot/jtreg/vmTestbase/gc/g1/unloading/tests/unloading_jni_classloading_inMemoryCompilation_keep_class/TEST.properties
new file mode 100644
index 0000000..04b22a1
--- /dev/null
+++ b/test/hotspot/jtreg/vmTestbase/gc/g1/unloading/tests/unloading_jni_classloading_inMemoryCompilation_keep_class/TEST.properties
@@ -0,0 +1,23 @@
+#
+# 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/g1/unloading/tests/unloading_jni_classloading_inMemoryCompilation_keep_class/TestDescription.java b/test/hotspot/jtreg/vmTestbase/gc/g1/unloading/tests/unloading_jni_classloading_inMemoryCompilation_keep_class/TestDescription.java
new file mode 100644
index 0000000..7f34d53
--- /dev/null
+++ b/test/hotspot/jtreg/vmTestbase/gc/g1/unloading/tests/unloading_jni_classloading_inMemoryCompilation_keep_class/TestDescription.java
@@ -0,0 +1,66 @@
+/*
+ * 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.
+ */
+
+
+/*
+ * @test
+ * @key stress gc
+ *
+ * @summary converted from VM Testbase gc/g1/unloading/tests/unloading_jni_classloading_inMemoryCompilation_keep_class.
+ * VM Testbase keywords: [gc, stress, stressopt, nonconcurrent, javac]
+ *
+ * @modules java.base/jdk.internal.misc
+ * @library /vmTestbase
+ * /test/lib
+ *
+ * @run driver jdk.test.lib.FileInstaller . .
+ *
+ * @comment generate HumongousTemplateClass and compile it to test.classes
+ * @run driver gc.g1.unloading.bytecode.GenClassesBuilder
+ *
+ * @build sun.hotspot.WhiteBox
+ * @run driver ClassFileInstaller sun.hotspot.WhiteBox
+ * sun.hotspot.WhiteBox$WhiteBoxPermission
+ * @run main/othervm/native
+ * -Xbootclasspath/a:.
+ * -XX:+UnlockDiagnosticVMOptions
+ * -XX:+WhiteBoxAPI
+ * -XX:+UseG1GC
+ * -XX:+ExplicitGCInvokesConcurrent
+ * -Xbootclasspath/a:.
+ * -XX:+UnlockDiagnosticVMOptions
+ * -XX:+WhiteBoxAPI
+ * -XX:+UseG1GC
+ * -XX:+ExplicitGCInvokesConcurrent
+ * -Xlog:gc:gc.log
+ * -XX:-UseGCOverheadLimit
+ * -Xlog:gc:gc.log
+ * -XX:-UseGCOverheadLimit
+ * gc.g1.unloading.UnloadingTest
+ * -classloadingMethod jni
+ * -inMemoryCompilation
+ * -keep class
+ * -numberOfChecksLimit 4
+ * -stressTime 180
+ */
+
diff --git a/test/hotspot/jtreg/vmTestbase/gc/g1/unloading/tests/unloading_jni_classloading_inMemoryCompilation_keep_obj/TEST.properties b/test/hotspot/jtreg/vmTestbase/gc/g1/unloading/tests/unloading_jni_classloading_inMemoryCompilation_keep_obj/TEST.properties
new file mode 100644
index 0000000..04b22a1
--- /dev/null
+++ b/test/hotspot/jtreg/vmTestbase/gc/g1/unloading/tests/unloading_jni_classloading_inMemoryCompilation_keep_obj/TEST.properties
@@ -0,0 +1,23 @@
+#
+# 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/g1/unloading/tests/unloading_jni_classloading_inMemoryCompilation_keep_obj/TestDescription.java b/test/hotspot/jtreg/vmTestbase/gc/g1/unloading/tests/unloading_jni_classloading_inMemoryCompilation_keep_obj/TestDescription.java
new file mode 100644
index 0000000..72d2207
--- /dev/null
+++ b/test/hotspot/jtreg/vmTestbase/gc/g1/unloading/tests/unloading_jni_classloading_inMemoryCompilation_keep_obj/TestDescription.java
@@ -0,0 +1,66 @@
+/*
+ * 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.
+ */
+
+
+/*
+ * @test
+ * @key stress gc
+ *
+ * @summary converted from VM Testbase gc/g1/unloading/tests/unloading_jni_classloading_inMemoryCompilation_keep_obj.
+ * VM Testbase keywords: [gc, stress, stressopt, nonconcurrent, javac]
+ *
+ * @modules java.base/jdk.internal.misc
+ * @library /vmTestbase
+ * /test/lib
+ *
+ * @run driver jdk.test.lib.FileInstaller . .
+ *
+ * @comment generate HumongousTemplateClass and compile it to test.classes
+ * @run driver gc.g1.unloading.bytecode.GenClassesBuilder
+ *
+ * @build sun.hotspot.WhiteBox
+ * @run driver ClassFileInstaller sun.hotspot.WhiteBox
+ * sun.hotspot.WhiteBox$WhiteBoxPermission
+ * @run main/othervm/native
+ * -Xbootclasspath/a:.
+ * -XX:+UnlockDiagnosticVMOptions
+ * -XX:+WhiteBoxAPI
+ * -XX:+UseG1GC
+ * -XX:+ExplicitGCInvokesConcurrent
+ * -Xbootclasspath/a:.
+ * -XX:+UnlockDiagnosticVMOptions
+ * -XX:+WhiteBoxAPI
+ * -XX:+UseG1GC
+ * -XX:+ExplicitGCInvokesConcurrent
+ * -Xlog:gc:gc.log
+ * -XX:-UseGCOverheadLimit
+ * -Xlog:gc:gc.log
+ * -XX:-UseGCOverheadLimit
+ * gc.g1.unloading.UnloadingTest
+ * -classloadingMethod jni
+ * -inMemoryCompilation
+ * -keep object
+ * -numberOfChecksLimit 4
+ * -stressTime 180
+ */
+
diff --git a/test/hotspot/jtreg/vmTestbase/gc/g1/unloading/tests/unloading_jni_classloading_keep_cl/TEST.properties b/test/hotspot/jtreg/vmTestbase/gc/g1/unloading/tests/unloading_jni_classloading_keep_cl/TEST.properties
new file mode 100644
index 0000000..04b22a1
--- /dev/null
+++ b/test/hotspot/jtreg/vmTestbase/gc/g1/unloading/tests/unloading_jni_classloading_keep_cl/TEST.properties
@@ -0,0 +1,23 @@
+#
+# 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/g1/unloading/tests/unloading_jni_classloading_keep_cl/TestDescription.java b/test/hotspot/jtreg/vmTestbase/gc/g1/unloading/tests/unloading_jni_classloading_keep_cl/TestDescription.java
new file mode 100644
index 0000000..337ecc2
--- /dev/null
+++ b/test/hotspot/jtreg/vmTestbase/gc/g1/unloading/tests/unloading_jni_classloading_keep_cl/TestDescription.java
@@ -0,0 +1,65 @@
+/*
+ * 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.
+ */
+
+
+/*
+ * @test
+ * @key stress gc
+ *
+ * @summary converted from VM Testbase gc/g1/unloading/tests/unloading_jni_classloading_keep_cl.
+ * VM Testbase keywords: [gc, stress, stressopt, nonconcurrent, javac]
+ *
+ * @modules java.base/jdk.internal.misc
+ * @library /vmTestbase
+ * /test/lib
+ *
+ * @run driver jdk.test.lib.FileInstaller . .
+ *
+ * @comment generate HumongousTemplateClass and compile it to test.classes
+ * @run driver gc.g1.unloading.bytecode.GenClassesBuilder
+ *
+ * @build sun.hotspot.WhiteBox
+ * @run driver ClassFileInstaller sun.hotspot.WhiteBox
+ * sun.hotspot.WhiteBox$WhiteBoxPermission
+ * @run main/othervm/native
+ * -Xbootclasspath/a:.
+ * -XX:+UnlockDiagnosticVMOptions
+ * -XX:+WhiteBoxAPI
+ * -XX:+UseG1GC
+ * -XX:+ExplicitGCInvokesConcurrent
+ * -Xbootclasspath/a:.
+ * -XX:+UnlockDiagnosticVMOptions
+ * -XX:+WhiteBoxAPI
+ * -XX:+UseG1GC
+ * -XX:+ExplicitGCInvokesConcurrent
+ * -Xlog:gc:gc.log
+ * -XX:-UseGCOverheadLimit
+ * -Xlog:gc:gc.log
+ * -XX:-UseGCOverheadLimit
+ * gc.g1.unloading.UnloadingTest
+ * -classloadingMethod jni
+ * -keep classloader
+ * -numberOfChecksLimit 4
+ * -stressTime 180
+ */
+
diff --git a/test/hotspot/jtreg/vmTestbase/gc/g1/unloading/tests/unloading_jni_classloading_keep_class/TEST.properties b/test/hotspot/jtreg/vmTestbase/gc/g1/unloading/tests/unloading_jni_classloading_keep_class/TEST.properties
new file mode 100644
index 0000000..04b22a1
--- /dev/null
+++ b/test/hotspot/jtreg/vmTestbase/gc/g1/unloading/tests/unloading_jni_classloading_keep_class/TEST.properties
@@ -0,0 +1,23 @@
+#
+# 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/g1/unloading/tests/unloading_jni_classloading_keep_class/TestDescription.java b/test/hotspot/jtreg/vmTestbase/gc/g1/unloading/tests/unloading_jni_classloading_keep_class/TestDescription.java
new file mode 100644
index 0000000..aa8e202
--- /dev/null
+++ b/test/hotspot/jtreg/vmTestbase/gc/g1/unloading/tests/unloading_jni_classloading_keep_class/TestDescription.java
@@ -0,0 +1,65 @@
+/*
+ * 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.
+ */
+
+
+/*
+ * @test
+ * @key stress gc
+ *
+ * @summary converted from VM Testbase gc/g1/unloading/tests/unloading_jni_classloading_keep_class.
+ * VM Testbase keywords: [gc, stress, stressopt, nonconcurrent, javac]
+ *
+ * @modules java.base/jdk.internal.misc
+ * @library /vmTestbase
+ * /test/lib
+ *
+ * @run driver jdk.test.lib.FileInstaller . .
+ *
+ * @comment generate HumongousTemplateClass and compile it to test.classes
+ * @run driver gc.g1.unloading.bytecode.GenClassesBuilder
+ *
+ * @build sun.hotspot.WhiteBox
+ * @run driver ClassFileInstaller sun.hotspot.WhiteBox
+ * sun.hotspot.WhiteBox$WhiteBoxPermission
+ * @run main/othervm/native
+ * -Xbootclasspath/a:.
+ * -XX:+UnlockDiagnosticVMOptions
+ * -XX:+WhiteBoxAPI
+ * -XX:+UseG1GC
+ * -XX:+ExplicitGCInvokesConcurrent
+ * -Xbootclasspath/a:.
+ * -XX:+UnlockDiagnosticVMOptions
+ * -XX:+WhiteBoxAPI
+ * -XX:+UseG1GC
+ * -XX:+ExplicitGCInvokesConcurrent
+ * -Xlog:gc:gc.log
+ * -XX:-UseGCOverheadLimit
+ * -Xlog:gc:gc.log
+ * -XX:-UseGCOverheadLimit
+ * gc.g1.unloading.UnloadingTest
+ * -classloadingMethod jni
+ * -keep class
+ * -numberOfChecksLimit 4
+ * -stressTime 180
+ */
+
diff --git a/test/hotspot/jtreg/vmTestbase/gc/g1/unloading/tests/unloading_jni_classloading_keep_obj/TEST.properties b/test/hotspot/jtreg/vmTestbase/gc/g1/unloading/tests/unloading_jni_classloading_keep_obj/TEST.properties
new file mode 100644
index 0000000..04b22a1
--- /dev/null
+++ b/test/hotspot/jtreg/vmTestbase/gc/g1/unloading/tests/unloading_jni_classloading_keep_obj/TEST.properties
@@ -0,0 +1,23 @@
+#
+# 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/g1/unloading/tests/unloading_jni_classloading_keep_obj/TestDescription.java b/test/hotspot/jtreg/vmTestbase/gc/g1/unloading/tests/unloading_jni_classloading_keep_obj/TestDescription.java
new file mode 100644
index 0000000..808c630
--- /dev/null
+++ b/test/hotspot/jtreg/vmTestbase/gc/g1/unloading/tests/unloading_jni_classloading_keep_obj/TestDescription.java
@@ -0,0 +1,65 @@
+/*
+ * 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.
+ */
+
+
+/*
+ * @test
+ * @key stress gc
+ *
+ * @summary converted from VM Testbase gc/g1/unloading/tests/unloading_jni_classloading_keep_obj.
+ * VM Testbase keywords: [gc, stress, stressopt, nonconcurrent, javac]
+ *
+ * @modules java.base/jdk.internal.misc
+ * @library /vmTestbase
+ * /test/lib
+ *
+ * @run driver jdk.test.lib.FileInstaller . .
+ *
+ * @comment generate HumongousTemplateClass and compile it to test.classes
+ * @run driver gc.g1.unloading.bytecode.GenClassesBuilder
+ *
+ * @build sun.hotspot.WhiteBox
+ * @run driver ClassFileInstaller sun.hotspot.WhiteBox
+ * sun.hotspot.WhiteBox$WhiteBoxPermission
+ * @run main/othervm/native
+ * -Xbootclasspath/a:.
+ * -XX:+UnlockDiagnosticVMOptions
+ * -XX:+WhiteBoxAPI
+ * -XX:+UseG1GC
+ * -XX:+ExplicitGCInvokesConcurrent
+ * -Xbootclasspath/a:.
+ * -XX:+UnlockDiagnosticVMOptions
+ * -XX:+WhiteBoxAPI
+ * -XX:+UseG1GC
+ * -XX:+ExplicitGCInvokesConcurrent
+ * -Xlog:gc:gc.log
+ * -XX:-UseGCOverheadLimit
+ * -Xlog:gc:gc.log
+ * -XX:-UseGCOverheadLimit
+ * gc.g1.unloading.UnloadingTest
+ * -classloadingMethod jni
+ * -keep object
+ * -numberOfChecksLimit 4
+ * -stressTime 180
+ */
+
diff --git a/test/hotspot/jtreg/vmTestbase/gc/g1/unloading/tests/unloading_keepRef_jni_global_ref_inMemoryCompilation_keep_cl/TEST.properties b/test/hotspot/jtreg/vmTestbase/gc/g1/unloading/tests/unloading_keepRef_jni_global_ref_inMemoryCompilation_keep_cl/TEST.properties
new file mode 100644
index 0000000..04b22a1
--- /dev/null
+++ b/test/hotspot/jtreg/vmTestbase/gc/g1/unloading/tests/unloading_keepRef_jni_global_ref_inMemoryCompilation_keep_cl/TEST.properties
@@ -0,0 +1,23 @@
+#
+# 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/g1/unloading/tests/unloading_keepRef_jni_global_ref_inMemoryCompilation_keep_cl/TestDescription.java b/test/hotspot/jtreg/vmTestbase/gc/g1/unloading/tests/unloading_keepRef_jni_global_ref_inMemoryCompilation_keep_cl/TestDescription.java
new file mode 100644
index 0000000..374c809
--- /dev/null
+++ b/test/hotspot/jtreg/vmTestbase/gc/g1/unloading/tests/unloading_keepRef_jni_global_ref_inMemoryCompilation_keep_cl/TestDescription.java
@@ -0,0 +1,66 @@
+/*
+ * 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.
+ */
+
+
+/*
+ * @test
+ * @key stress gc
+ *
+ * @summary converted from VM Testbase gc/g1/unloading/tests/unloading_keepRef_jni_global_ref_inMemoryCompilation_keep_cl.
+ * VM Testbase keywords: [gc, stress, stressopt, nonconcurrent, javac]
+ *
+ * @modules java.base/jdk.internal.misc
+ * @library /vmTestbase
+ * /test/lib
+ *
+ * @run driver jdk.test.lib.FileInstaller . .
+ *
+ * @comment generate HumongousTemplateClass and compile it to test.classes
+ * @run driver gc.g1.unloading.bytecode.GenClassesBuilder
+ *
+ * @build sun.hotspot.WhiteBox
+ * @run driver ClassFileInstaller sun.hotspot.WhiteBox
+ * sun.hotspot.WhiteBox$WhiteBoxPermission
+ * @run main/othervm/native
+ * -Xbootclasspath/a:.
+ * -XX:+UnlockDiagnosticVMOptions
+ * -XX:+WhiteBoxAPI
+ * -XX:+UseG1GC
+ * -XX:+ExplicitGCInvokesConcurrent
+ * -Xbootclasspath/a:.
+ * -XX:+UnlockDiagnosticVMOptions
+ * -XX:+WhiteBoxAPI
+ * -XX:+UseG1GC
+ * -XX:+ExplicitGCInvokesConcurrent
+ * -Xlog:gc:gc.log
+ * -XX:-UseGCOverheadLimit
+ * -Xlog:gc:gc.log
+ * -XX:-UseGCOverheadLimit
+ * gc.g1.unloading.UnloadingTest
+ * -keepRefMode JNI_GLOBAL_REF
+ * -inMemoryCompilation
+ * -keep classloader
+ * -numberOfChecksLimit 4
+ * -stressTime 180
+ */
+
diff --git a/test/hotspot/jtreg/vmTestbase/gc/g1/unloading/tests/unloading_keepRef_jni_global_ref_inMemoryCompilation_keep_class/TEST.properties b/test/hotspot/jtreg/vmTestbase/gc/g1/unloading/tests/unloading_keepRef_jni_global_ref_inMemoryCompilation_keep_class/TEST.properties
new file mode 100644
index 0000000..04b22a1
--- /dev/null
+++ b/test/hotspot/jtreg/vmTestbase/gc/g1/unloading/tests/unloading_keepRef_jni_global_ref_inMemoryCompilation_keep_class/TEST.properties
@@ -0,0 +1,23 @@
+#
+# 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/g1/unloading/tests/unloading_keepRef_jni_global_ref_inMemoryCompilation_keep_class/TestDescription.java b/test/hotspot/jtreg/vmTestbase/gc/g1/unloading/tests/unloading_keepRef_jni_global_ref_inMemoryCompilation_keep_class/TestDescription.java
new file mode 100644
index 0000000..4aa5d3e7
--- /dev/null
+++ b/test/hotspot/jtreg/vmTestbase/gc/g1/unloading/tests/unloading_keepRef_jni_global_ref_inMemoryCompilation_keep_class/TestDescription.java
@@ -0,0 +1,66 @@
+/*
+ * 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.
+ */
+
+
+/*
+ * @test
+ * @key stress gc
+ *
+ * @summary converted from VM Testbase gc/g1/unloading/tests/unloading_keepRef_jni_global_ref_inMemoryCompilation_keep_class.
+ * VM Testbase keywords: [gc, stress, stressopt, nonconcurrent, javac]
+ *
+ * @modules java.base/jdk.internal.misc
+ * @library /vmTestbase
+ * /test/lib
+ *
+ * @run driver jdk.test.lib.FileInstaller . .
+ *
+ * @comment generate HumongousTemplateClass and compile it to test.classes
+ * @run driver gc.g1.unloading.bytecode.GenClassesBuilder
+ *
+ * @build sun.hotspot.WhiteBox
+ * @run driver ClassFileInstaller sun.hotspot.WhiteBox
+ * sun.hotspot.WhiteBox$WhiteBoxPermission
+ * @run main/othervm/native
+ * -Xbootclasspath/a:.
+ * -XX:+UnlockDiagnosticVMOptions
+ * -XX:+WhiteBoxAPI
+ * -XX:+UseG1GC
+ * -XX:+ExplicitGCInvokesConcurrent
+ * -Xbootclasspath/a:.
+ * -XX:+UnlockDiagnosticVMOptions
+ * -XX:+WhiteBoxAPI
+ * -XX:+UseG1GC
+ * -XX:+ExplicitGCInvokesConcurrent
+ * -Xlog:gc:gc.log
+ * -XX:-UseGCOverheadLimit
+ * -Xlog:gc:gc.log
+ * -XX:-UseGCOverheadLimit
+ * gc.g1.unloading.UnloadingTest
+ * -keepRefMode JNI_GLOBAL_REF
+ * -inMemoryCompilation
+ * -keep class
+ * -numberOfChecksLimit 4
+ * -stressTime 180
+ */
+
diff --git a/test/hotspot/jtreg/vmTestbase/gc/g1/unloading/tests/unloading_keepRef_jni_global_ref_inMemoryCompilation_keep_obj/TEST.properties b/test/hotspot/jtreg/vmTestbase/gc/g1/unloading/tests/unloading_keepRef_jni_global_ref_inMemoryCompilation_keep_obj/TEST.properties
new file mode 100644
index 0000000..04b22a1
--- /dev/null
+++ b/test/hotspot/jtreg/vmTestbase/gc/g1/unloading/tests/unloading_keepRef_jni_global_ref_inMemoryCompilation_keep_obj/TEST.properties
@@ -0,0 +1,23 @@
+#
+# 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/g1/unloading/tests/unloading_keepRef_jni_global_ref_inMemoryCompilation_keep_obj/TestDescription.java b/test/hotspot/jtreg/vmTestbase/gc/g1/unloading/tests/unloading_keepRef_jni_global_ref_inMemoryCompilation_keep_obj/TestDescription.java
new file mode 100644
index 0000000..2a09774
--- /dev/null
+++ b/test/hotspot/jtreg/vmTestbase/gc/g1/unloading/tests/unloading_keepRef_jni_global_ref_inMemoryCompilation_keep_obj/TestDescription.java
@@ -0,0 +1,66 @@
+/*
+ * 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.
+ */
+
+
+/*
+ * @test
+ * @key stress gc
+ *
+ * @summary converted from VM Testbase gc/g1/unloading/tests/unloading_keepRef_jni_global_ref_inMemoryCompilation_keep_obj.
+ * VM Testbase keywords: [gc, stress, stressopt, nonconcurrent, javac]
+ *
+ * @modules java.base/jdk.internal.misc
+ * @library /vmTestbase
+ * /test/lib
+ *
+ * @run driver jdk.test.lib.FileInstaller . .
+ *
+ * @comment generate HumongousTemplateClass and compile it to test.classes
+ * @run driver gc.g1.unloading.bytecode.GenClassesBuilder
+ *
+ * @build sun.hotspot.WhiteBox
+ * @run driver ClassFileInstaller sun.hotspot.WhiteBox
+ * sun.hotspot.WhiteBox$WhiteBoxPermission
+ * @run main/othervm/native
+ * -Xbootclasspath/a:.
+ * -XX:+UnlockDiagnosticVMOptions
+ * -XX:+WhiteBoxAPI
+ * -XX:+UseG1GC
+ * -XX:+ExplicitGCInvokesConcurrent
+ * -Xbootclasspath/a:.
+ * -XX:+UnlockDiagnosticVMOptions
+ * -XX:+WhiteBoxAPI
+ * -XX:+UseG1GC
+ * -XX:+ExplicitGCInvokesConcurrent
+ * -Xlog:gc:gc.log
+ * -XX:-UseGCOverheadLimit
+ * -Xlog:gc:gc.log
+ * -XX:-UseGCOverheadLimit
+ * gc.g1.unloading.UnloadingTest
+ * -keepRefMode JNI_GLOBAL_REF
+ * -inMemoryCompilation
+ * -keep object
+ * -numberOfChecksLimit 4
+ * -stressTime 180
+ */
+
diff --git a/test/hotspot/jtreg/vmTestbase/gc/g1/unloading/tests/unloading_keepRef_jni_global_ref_keep_cl/TEST.properties b/test/hotspot/jtreg/vmTestbase/gc/g1/unloading/tests/unloading_keepRef_jni_global_ref_keep_cl/TEST.properties
new file mode 100644
index 0000000..04b22a1
--- /dev/null
+++ b/test/hotspot/jtreg/vmTestbase/gc/g1/unloading/tests/unloading_keepRef_jni_global_ref_keep_cl/TEST.properties
@@ -0,0 +1,23 @@
+#
+# 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/g1/unloading/tests/unloading_keepRef_jni_global_ref_keep_cl/TestDescription.java b/test/hotspot/jtreg/vmTestbase/gc/g1/unloading/tests/unloading_keepRef_jni_global_ref_keep_cl/TestDescription.java
new file mode 100644
index 0000000..c6f8c1f
--- /dev/null
+++ b/test/hotspot/jtreg/vmTestbase/gc/g1/unloading/tests/unloading_keepRef_jni_global_ref_keep_cl/TestDescription.java
@@ -0,0 +1,65 @@
+/*
+ * 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.
+ */
+
+
+/*
+ * @test
+ * @key stress gc
+ *
+ * @summary converted from VM Testbase gc/g1/unloading/tests/unloading_keepRef_jni_global_ref_keep_cl.
+ * VM Testbase keywords: [gc, stress, stressopt, nonconcurrent, javac]
+ *
+ * @modules java.base/jdk.internal.misc
+ * @library /vmTestbase
+ * /test/lib
+ *
+ * @run driver jdk.test.lib.FileInstaller . .
+ *
+ * @comment generate HumongousTemplateClass and compile it to test.classes
+ * @run driver gc.g1.unloading.bytecode.GenClassesBuilder
+ *
+ * @build sun.hotspot.WhiteBox
+ * @run driver ClassFileInstaller sun.hotspot.WhiteBox
+ * sun.hotspot.WhiteBox$WhiteBoxPermission
+ * @run main/othervm/native
+ * -Xbootclasspath/a:.
+ * -XX:+UnlockDiagnosticVMOptions
+ * -XX:+WhiteBoxAPI
+ * -XX:+UseG1GC
+ * -XX:+ExplicitGCInvokesConcurrent
+ * -Xbootclasspath/a:.
+ * -XX:+UnlockDiagnosticVMOptions
+ * -XX:+WhiteBoxAPI
+ * -XX:+UseG1GC
+ * -XX:+ExplicitGCInvokesConcurrent
+ * -Xlog:gc:gc.log
+ * -XX:-UseGCOverheadLimit
+ * -Xlog:gc:gc.log
+ * -XX:-UseGCOverheadLimit
+ * gc.g1.unloading.UnloadingTest
+ * -keepRefMode JNI_GLOBAL_REF
+ * -keep classloader
+ * -numberOfChecksLimit 4
+ * -stressTime 180
+ */
+
diff --git a/test/hotspot/jtreg/vmTestbase/gc/g1/unloading/tests/unloading_keepRef_jni_global_ref_keep_class/TEST.properties b/test/hotspot/jtreg/vmTestbase/gc/g1/unloading/tests/unloading_keepRef_jni_global_ref_keep_class/TEST.properties
new file mode 100644
index 0000000..04b22a1
--- /dev/null
+++ b/test/hotspot/jtreg/vmTestbase/gc/g1/unloading/tests/unloading_keepRef_jni_global_ref_keep_class/TEST.properties
@@ -0,0 +1,23 @@
+#
+# 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/g1/unloading/tests/unloading_keepRef_jni_global_ref_keep_class/TestDescription.java b/test/hotspot/jtreg/vmTestbase/gc/g1/unloading/tests/unloading_keepRef_jni_global_ref_keep_class/TestDescription.java
new file mode 100644
index 0000000..f42324c
--- /dev/null
+++ b/test/hotspot/jtreg/vmTestbase/gc/g1/unloading/tests/unloading_keepRef_jni_global_ref_keep_class/TestDescription.java
@@ -0,0 +1,65 @@
+/*
+ * 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.
+ */
+
+
+/*
+ * @test
+ * @key stress gc
+ *
+ * @summary converted from VM Testbase gc/g1/unloading/tests/unloading_keepRef_jni_global_ref_keep_class.
+ * VM Testbase keywords: [gc, stress, stressopt, nonconcurrent, javac]
+ *
+ * @modules java.base/jdk.internal.misc
+ * @library /vmTestbase
+ * /test/lib
+ *
+ * @run driver jdk.test.lib.FileInstaller . .
+ *
+ * @comment generate HumongousTemplateClass and compile it to test.classes
+ * @run driver gc.g1.unloading.bytecode.GenClassesBuilder
+ *
+ * @build sun.hotspot.WhiteBox
+ * @run driver ClassFileInstaller sun.hotspot.WhiteBox
+ * sun.hotspot.WhiteBox$WhiteBoxPermission
+ * @run main/othervm/native
+ * -Xbootclasspath/a:.
+ * -XX:+UnlockDiagnosticVMOptions
+ * -XX:+WhiteBoxAPI
+ * -XX:+UseG1GC
+ * -XX:+ExplicitGCInvokesConcurrent
+ * -Xbootclasspath/a:.
+ * -XX:+UnlockDiagnosticVMOptions
+ * -XX:+WhiteBoxAPI
+ * -XX:+UseG1GC
+ * -XX:+ExplicitGCInvokesConcurrent
+ * -Xlog:gc:gc.log
+ * -XX:-UseGCOverheadLimit
+ * -Xlog:gc:gc.log
+ * -XX:-UseGCOverheadLimit
+ * gc.g1.unloading.UnloadingTest
+ * -keepRefMode JNI_GLOBAL_REF
+ * -keep class
+ * -numberOfChecksLimit 4
+ * -stressTime 180
+ */
+
diff --git a/test/hotspot/jtreg/vmTestbase/gc/g1/unloading/tests/unloading_keepRef_jni_global_ref_keep_obj/TEST.properties b/test/hotspot/jtreg/vmTestbase/gc/g1/unloading/tests/unloading_keepRef_jni_global_ref_keep_obj/TEST.properties
new file mode 100644
index 0000000..04b22a1
--- /dev/null
+++ b/test/hotspot/jtreg/vmTestbase/gc/g1/unloading/tests/unloading_keepRef_jni_global_ref_keep_obj/TEST.properties
@@ -0,0 +1,23 @@
+#
+# 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/g1/unloading/tests/unloading_keepRef_jni_global_ref_keep_obj/TestDescription.java b/test/hotspot/jtreg/vmTestbase/gc/g1/unloading/tests/unloading_keepRef_jni_global_ref_keep_obj/TestDescription.java
new file mode 100644
index 0000000..6603419
--- /dev/null
+++ b/test/hotspot/jtreg/vmTestbase/gc/g1/unloading/tests/unloading_keepRef_jni_global_ref_keep_obj/TestDescription.java
@@ -0,0 +1,65 @@
+/*
+ * 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.
+ */
+
+
+/*
+ * @test
+ * @key stress gc
+ *
+ * @summary converted from VM Testbase gc/g1/unloading/tests/unloading_keepRef_jni_global_ref_keep_obj.
+ * VM Testbase keywords: [gc, stress, stressopt, nonconcurrent, javac]
+ *
+ * @modules java.base/jdk.internal.misc
+ * @library /vmTestbase
+ * /test/lib
+ *
+ * @run driver jdk.test.lib.FileInstaller . .
+ *
+ * @comment generate HumongousTemplateClass and compile it to test.classes
+ * @run driver gc.g1.unloading.bytecode.GenClassesBuilder
+ *
+ * @build sun.hotspot.WhiteBox
+ * @run driver ClassFileInstaller sun.hotspot.WhiteBox
+ * sun.hotspot.WhiteBox$WhiteBoxPermission
+ * @run main/othervm/native
+ * -Xbootclasspath/a:.
+ * -XX:+UnlockDiagnosticVMOptions
+ * -XX:+WhiteBoxAPI
+ * -XX:+UseG1GC
+ * -XX:+ExplicitGCInvokesConcurrent
+ * -Xbootclasspath/a:.
+ * -XX:+UnlockDiagnosticVMOptions
+ * -XX:+WhiteBoxAPI
+ * -XX:+UseG1GC
+ * -XX:+ExplicitGCInvokesConcurrent
+ * -Xlog:gc:gc.log
+ * -XX:-UseGCOverheadLimit
+ * -Xlog:gc:gc.log
+ * -XX:-UseGCOverheadLimit
+ * gc.g1.unloading.UnloadingTest
+ * -keepRefMode JNI_GLOBAL_REF
+ * -keep object
+ * -numberOfChecksLimit 4
+ * -stressTime 180
+ */
+
diff --git a/test/hotspot/jtreg/vmTestbase/gc/g1/unloading/tests/unloading_keepRef_jni_local_ref_inMemoryCompilation_keep_cl/TEST.properties b/test/hotspot/jtreg/vmTestbase/gc/g1/unloading/tests/unloading_keepRef_jni_local_ref_inMemoryCompilation_keep_cl/TEST.properties
new file mode 100644
index 0000000..04b22a1
--- /dev/null
+++ b/test/hotspot/jtreg/vmTestbase/gc/g1/unloading/tests/unloading_keepRef_jni_local_ref_inMemoryCompilation_keep_cl/TEST.properties
@@ -0,0 +1,23 @@
+#
+# 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/g1/unloading/tests/unloading_keepRef_jni_local_ref_inMemoryCompilation_keep_cl/TestDescription.java b/test/hotspot/jtreg/vmTestbase/gc/g1/unloading/tests/unloading_keepRef_jni_local_ref_inMemoryCompilation_keep_cl/TestDescription.java
new file mode 100644
index 0000000..c033afb
--- /dev/null
+++ b/test/hotspot/jtreg/vmTestbase/gc/g1/unloading/tests/unloading_keepRef_jni_local_ref_inMemoryCompilation_keep_cl/TestDescription.java
@@ -0,0 +1,66 @@
+/*
+ * 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.
+ */
+
+
+/*
+ * @test
+ * @key stress gc
+ *
+ * @summary converted from VM Testbase gc/g1/unloading/tests/unloading_keepRef_jni_local_ref_inMemoryCompilation_keep_cl.
+ * VM Testbase keywords: [gc, stress, stressopt, nonconcurrent, javac]
+ *
+ * @modules java.base/jdk.internal.misc
+ * @library /vmTestbase
+ * /test/lib
+ *
+ * @run driver jdk.test.lib.FileInstaller . .
+ *
+ * @comment generate HumongousTemplateClass and compile it to test.classes
+ * @run driver gc.g1.unloading.bytecode.GenClassesBuilder
+ *
+ * @build sun.hotspot.WhiteBox
+ * @run driver ClassFileInstaller sun.hotspot.WhiteBox
+ * sun.hotspot.WhiteBox$WhiteBoxPermission
+ * @run main/othervm/native
+ * -Xbootclasspath/a:.
+ * -XX:+UnlockDiagnosticVMOptions
+ * -XX:+WhiteBoxAPI
+ * -XX:+UseG1GC
+ * -XX:+ExplicitGCInvokesConcurrent
+ * -Xbootclasspath/a:.
+ * -XX:+UnlockDiagnosticVMOptions
+ * -XX:+WhiteBoxAPI
+ * -XX:+UseG1GC
+ * -XX:+ExplicitGCInvokesConcurrent
+ * -Xlog:gc:gc.log
+ * -XX:-UseGCOverheadLimit
+ * -Xlog:gc:gc.log
+ * -XX:-UseGCOverheadLimit
+ * gc.g1.unloading.UnloadingTest
+ * -keepRefMode JNI_LOCAL_REF
+ * -inMemoryCompilation
+ * -keep classloader
+ * -numberOfChecksLimit 4
+ * -stressTime 180
+ */
+
diff --git a/test/hotspot/jtreg/vmTestbase/gc/g1/unloading/tests/unloading_keepRef_jni_local_ref_inMemoryCompilation_keep_class/TEST.properties b/test/hotspot/jtreg/vmTestbase/gc/g1/unloading/tests/unloading_keepRef_jni_local_ref_inMemoryCompilation_keep_class/TEST.properties
new file mode 100644
index 0000000..04b22a1
--- /dev/null
+++ b/test/hotspot/jtreg/vmTestbase/gc/g1/unloading/tests/unloading_keepRef_jni_local_ref_inMemoryCompilation_keep_class/TEST.properties
@@ -0,0 +1,23 @@
+#
+# 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/g1/unloading/tests/unloading_keepRef_jni_local_ref_inMemoryCompilation_keep_class/TestDescription.java b/test/hotspot/jtreg/vmTestbase/gc/g1/unloading/tests/unloading_keepRef_jni_local_ref_inMemoryCompilation_keep_class/TestDescription.java
new file mode 100644
index 0000000..d2295a7
--- /dev/null
+++ b/test/hotspot/jtreg/vmTestbase/gc/g1/unloading/tests/unloading_keepRef_jni_local_ref_inMemoryCompilation_keep_class/TestDescription.java
@@ -0,0 +1,66 @@
+/*
+ * 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.
+ */
+
+
+/*
+ * @test
+ * @key stress gc
+ *
+ * @summary converted from VM Testbase gc/g1/unloading/tests/unloading_keepRef_jni_local_ref_inMemoryCompilation_keep_class.
+ * VM Testbase keywords: [gc, stress, stressopt, nonconcurrent, javac]
+ *
+ * @modules java.base/jdk.internal.misc
+ * @library /vmTestbase
+ * /test/lib
+ *
+ * @run driver jdk.test.lib.FileInstaller . .
+ *
+ * @comment generate HumongousTemplateClass and compile it to test.classes
+ * @run driver gc.g1.unloading.bytecode.GenClassesBuilder
+ *
+ * @build sun.hotspot.WhiteBox
+ * @run driver ClassFileInstaller sun.hotspot.WhiteBox
+ * sun.hotspot.WhiteBox$WhiteBoxPermission
+ * @run main/othervm/native
+ * -Xbootclasspath/a:.
+ * -XX:+UnlockDiagnosticVMOptions
+ * -XX:+WhiteBoxAPI
+ * -XX:+UseG1GC
+ * -XX:+ExplicitGCInvokesConcurrent
+ * -Xbootclasspath/a:.
+ * -XX:+UnlockDiagnosticVMOptions
+ * -XX:+WhiteBoxAPI
+ * -XX:+UseG1GC
+ * -XX:+ExplicitGCInvokesConcurrent
+ * -Xlog:gc:gc.log
+ * -XX:-UseGCOverheadLimit
+ * -Xlog:gc:gc.log
+ * -XX:-UseGCOverheadLimit
+ * gc.g1.unloading.UnloadingTest
+ * -keepRefMode JNI_LOCAL_REF
+ * -inMemoryCompilation
+ * -keep class
+ * -numberOfChecksLimit 4
+ * -stressTime 180
+ */
+
diff --git a/test/hotspot/jtreg/vmTestbase/gc/g1/unloading/tests/unloading_keepRef_jni_local_ref_inMemoryCompilation_keep_obj/TEST.properties b/test/hotspot/jtreg/vmTestbase/gc/g1/unloading/tests/unloading_keepRef_jni_local_ref_inMemoryCompilation_keep_obj/TEST.properties
new file mode 100644
index 0000000..04b22a1
--- /dev/null
+++ b/test/hotspot/jtreg/vmTestbase/gc/g1/unloading/tests/unloading_keepRef_jni_local_ref_inMemoryCompilation_keep_obj/TEST.properties
@@ -0,0 +1,23 @@
+#
+# 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/g1/unloading/tests/unloading_keepRef_jni_local_ref_inMemoryCompilation_keep_obj/TestDescription.java b/test/hotspot/jtreg/vmTestbase/gc/g1/unloading/tests/unloading_keepRef_jni_local_ref_inMemoryCompilation_keep_obj/TestDescription.java
new file mode 100644
index 0000000..d607c32
--- /dev/null
+++ b/test/hotspot/jtreg/vmTestbase/gc/g1/unloading/tests/unloading_keepRef_jni_local_ref_inMemoryCompilation_keep_obj/TestDescription.java
@@ -0,0 +1,66 @@
+/*
+ * 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.
+ */
+
+
+/*
+ * @test
+ * @key stress gc
+ *
+ * @summary converted from VM Testbase gc/g1/unloading/tests/unloading_keepRef_jni_local_ref_inMemoryCompilation_keep_obj.
+ * VM Testbase keywords: [gc, stress, stressopt, nonconcurrent, javac]
+ *
+ * @modules java.base/jdk.internal.misc
+ * @library /vmTestbase
+ * /test/lib
+ *
+ * @run driver jdk.test.lib.FileInstaller . .
+ *
+ * @comment generate HumongousTemplateClass and compile it to test.classes
+ * @run driver gc.g1.unloading.bytecode.GenClassesBuilder
+ *
+ * @build sun.hotspot.WhiteBox
+ * @run driver ClassFileInstaller sun.hotspot.WhiteBox
+ * sun.hotspot.WhiteBox$WhiteBoxPermission
+ * @run main/othervm/native
+ * -Xbootclasspath/a:.
+ * -XX:+UnlockDiagnosticVMOptions
+ * -XX:+WhiteBoxAPI
+ * -XX:+UseG1GC
+ * -XX:+ExplicitGCInvokesConcurrent
+ * -Xbootclasspath/a:.
+ * -XX:+UnlockDiagnosticVMOptions
+ * -XX:+WhiteBoxAPI
+ * -XX:+UseG1GC
+ * -XX:+ExplicitGCInvokesConcurrent
+ * -Xlog:gc:gc.log
+ * -XX:-UseGCOverheadLimit
+ * -Xlog:gc:gc.log
+ * -XX:-UseGCOverheadLimit
+ * gc.g1.unloading.UnloadingTest
+ * -keepRefMode JNI_LOCAL_REF
+ * -inMemoryCompilation
+ * -keep object
+ * -numberOfChecksLimit 4
+ * -stressTime 180
+ */
+
diff --git a/test/hotspot/jtreg/vmTestbase/gc/g1/unloading/tests/unloading_keepRef_jni_local_ref_keep_cl/TEST.properties b/test/hotspot/jtreg/vmTestbase/gc/g1/unloading/tests/unloading_keepRef_jni_local_ref_keep_cl/TEST.properties
new file mode 100644
index 0000000..04b22a1
--- /dev/null
+++ b/test/hotspot/jtreg/vmTestbase/gc/g1/unloading/tests/unloading_keepRef_jni_local_ref_keep_cl/TEST.properties
@@ -0,0 +1,23 @@
+#
+# 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/g1/unloading/tests/unloading_keepRef_jni_local_ref_keep_cl/TestDescription.java b/test/hotspot/jtreg/vmTestbase/gc/g1/unloading/tests/unloading_keepRef_jni_local_ref_keep_cl/TestDescription.java
new file mode 100644
index 0000000..517b567
--- /dev/null
+++ b/test/hotspot/jtreg/vmTestbase/gc/g1/unloading/tests/unloading_keepRef_jni_local_ref_keep_cl/TestDescription.java
@@ -0,0 +1,65 @@
+/*
+ * 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.
+ */
+
+
+/*
+ * @test
+ * @key stress gc
+ *
+ * @summary converted from VM Testbase gc/g1/unloading/tests/unloading_keepRef_jni_local_ref_keep_cl.
+ * VM Testbase keywords: [gc, stress, stressopt, nonconcurrent, javac]
+ *
+ * @modules java.base/jdk.internal.misc
+ * @library /vmTestbase
+ * /test/lib
+ *
+ * @run driver jdk.test.lib.FileInstaller . .
+ *
+ * @comment generate HumongousTemplateClass and compile it to test.classes
+ * @run driver gc.g1.unloading.bytecode.GenClassesBuilder
+ *
+ * @build sun.hotspot.WhiteBox
+ * @run driver ClassFileInstaller sun.hotspot.WhiteBox
+ * sun.hotspot.WhiteBox$WhiteBoxPermission
+ * @run main/othervm/native
+ * -Xbootclasspath/a:.
+ * -XX:+UnlockDiagnosticVMOptions
+ * -XX:+WhiteBoxAPI
+ * -XX:+UseG1GC
+ * -XX:+ExplicitGCInvokesConcurrent
+ * -Xbootclasspath/a:.
+ * -XX:+UnlockDiagnosticVMOptions
+ * -XX:+WhiteBoxAPI
+ * -XX:+UseG1GC
+ * -XX:+ExplicitGCInvokesConcurrent
+ * -Xlog:gc:gc.log
+ * -XX:-UseGCOverheadLimit
+ * -Xlog:gc:gc.log
+ * -XX:-UseGCOverheadLimit
+ * gc.g1.unloading.UnloadingTest
+ * -keepRefMode JNI_LOCAL_REF
+ * -keep classloader
+ * -numberOfChecksLimit 4
+ * -stressTime 180
+ */
+
diff --git a/test/hotspot/jtreg/vmTestbase/gc/g1/unloading/tests/unloading_keepRef_jni_local_ref_keep_class/TEST.properties b/test/hotspot/jtreg/vmTestbase/gc/g1/unloading/tests/unloading_keepRef_jni_local_ref_keep_class/TEST.properties
new file mode 100644
index 0000000..04b22a1
--- /dev/null
+++ b/test/hotspot/jtreg/vmTestbase/gc/g1/unloading/tests/unloading_keepRef_jni_local_ref_keep_class/TEST.properties
@@ -0,0 +1,23 @@
+#
+# 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/g1/unloading/tests/unloading_keepRef_jni_local_ref_keep_class/TestDescription.java b/test/hotspot/jtreg/vmTestbase/gc/g1/unloading/tests/unloading_keepRef_jni_local_ref_keep_class/TestDescription.java
new file mode 100644
index 0000000..53e8260
--- /dev/null
+++ b/test/hotspot/jtreg/vmTestbase/gc/g1/unloading/tests/unloading_keepRef_jni_local_ref_keep_class/TestDescription.java
@@ -0,0 +1,65 @@
+/*
+ * 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.
+ */
+
+
+/*
+ * @test
+ * @key stress gc
+ *
+ * @summary converted from VM Testbase gc/g1/unloading/tests/unloading_keepRef_jni_local_ref_keep_class.
+ * VM Testbase keywords: [gc, stress, stressopt, nonconcurrent, javac]
+ *
+ * @modules java.base/jdk.internal.misc
+ * @library /vmTestbase
+ * /test/lib
+ *
+ * @run driver jdk.test.lib.FileInstaller . .
+ *
+ * @comment generate HumongousTemplateClass and compile it to test.classes
+ * @run driver gc.g1.unloading.bytecode.GenClassesBuilder
+ *
+ * @build sun.hotspot.WhiteBox
+ * @run driver ClassFileInstaller sun.hotspot.WhiteBox
+ * sun.hotspot.WhiteBox$WhiteBoxPermission
+ * @run main/othervm/native
+ * -Xbootclasspath/a:.
+ * -XX:+UnlockDiagnosticVMOptions
+ * -XX:+WhiteBoxAPI
+ * -XX:+UseG1GC
+ * -XX:+ExplicitGCInvokesConcurrent
+ * -Xbootclasspath/a:.
+ * -XX:+UnlockDiagnosticVMOptions
+ * -XX:+WhiteBoxAPI
+ * -XX:+UseG1GC
+ * -XX:+ExplicitGCInvokesConcurrent
+ * -Xlog:gc:gc.log
+ * -XX:-UseGCOverheadLimit
+ * -Xlog:gc:gc.log
+ * -XX:-UseGCOverheadLimit
+ * gc.g1.unloading.UnloadingTest
+ * -keepRefMode JNI_LOCAL_REF
+ * -keep class
+ * -numberOfChecksLimit 4
+ * -stressTime 180
+ */
+
diff --git a/test/hotspot/jtreg/vmTestbase/gc/g1/unloading/tests/unloading_keepRef_jni_local_ref_keep_obj/TEST.properties b/test/hotspot/jtreg/vmTestbase/gc/g1/unloading/tests/unloading_keepRef_jni_local_ref_keep_obj/TEST.properties
new file mode 100644
index 0000000..04b22a1
--- /dev/null
+++ b/test/hotspot/jtreg/vmTestbase/gc/g1/unloading/tests/unloading_keepRef_jni_local_ref_keep_obj/TEST.properties
@@ -0,0 +1,23 @@
+#
+# 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/g1/unloading/tests/unloading_keepRef_jni_local_ref_keep_obj/TestDescription.java b/test/hotspot/jtreg/vmTestbase/gc/g1/unloading/tests/unloading_keepRef_jni_local_ref_keep_obj/TestDescription.java
new file mode 100644
index 0000000..4efa166
--- /dev/null
+++ b/test/hotspot/jtreg/vmTestbase/gc/g1/unloading/tests/unloading_keepRef_jni_local_ref_keep_obj/TestDescription.java
@@ -0,0 +1,65 @@
+/*
+ * 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.
+ */
+
+
+/*
+ * @test
+ * @key stress gc
+ *
+ * @summary converted from VM Testbase gc/g1/unloading/tests/unloading_keepRef_jni_local_ref_keep_obj.
+ * VM Testbase keywords: [gc, stress, stressopt, nonconcurrent, javac]
+ *
+ * @modules java.base/jdk.internal.misc
+ * @library /vmTestbase
+ * /test/lib
+ *
+ * @run driver jdk.test.lib.FileInstaller . .
+ *
+ * @comment generate HumongousTemplateClass and compile it to test.classes
+ * @run driver gc.g1.unloading.bytecode.GenClassesBuilder
+ *
+ * @build sun.hotspot.WhiteBox
+ * @run driver ClassFileInstaller sun.hotspot.WhiteBox
+ * sun.hotspot.WhiteBox$WhiteBoxPermission
+ * @run main/othervm/native
+ * -Xbootclasspath/a:.
+ * -XX:+UnlockDiagnosticVMOptions
+ * -XX:+WhiteBoxAPI
+ * -XX:+UseG1GC
+ * -XX:+ExplicitGCInvokesConcurrent
+ * -Xbootclasspath/a:.
+ * -XX:+UnlockDiagnosticVMOptions
+ * -XX:+WhiteBoxAPI
+ * -XX:+UseG1GC
+ * -XX:+ExplicitGCInvokesConcurrent
+ * -Xlog:gc:gc.log
+ * -XX:-UseGCOverheadLimit
+ * -Xlog:gc:gc.log
+ * -XX:-UseGCOverheadLimit
+ * gc.g1.unloading.UnloadingTest
+ * -keepRefMode JNI_LOCAL_REF
+ * -keep object
+ * -numberOfChecksLimit 4
+ * -stressTime 180
+ */
+
diff --git a/test/hotspot/jtreg/vmTestbase/gc/g1/unloading/tests/unloading_keepRef_rootClass_inMemoryCompilation_keep_cl/TEST.properties b/test/hotspot/jtreg/vmTestbase/gc/g1/unloading/tests/unloading_keepRef_rootClass_inMemoryCompilation_keep_cl/TEST.properties
new file mode 100644
index 0000000..04b22a1
--- /dev/null
+++ b/test/hotspot/jtreg/vmTestbase/gc/g1/unloading/tests/unloading_keepRef_rootClass_inMemoryCompilation_keep_cl/TEST.properties
@@ -0,0 +1,23 @@
+#
+# 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/g1/unloading/tests/unloading_keepRef_rootClass_inMemoryCompilation_keep_cl/TestDescription.java b/test/hotspot/jtreg/vmTestbase/gc/g1/unloading/tests/unloading_keepRef_rootClass_inMemoryCompilation_keep_cl/TestDescription.java
new file mode 100644
index 0000000..9c4b1d7
--- /dev/null
+++ b/test/hotspot/jtreg/vmTestbase/gc/g1/unloading/tests/unloading_keepRef_rootClass_inMemoryCompilation_keep_cl/TestDescription.java
@@ -0,0 +1,71 @@
+/*
+ * 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.
+ */
+
+
+/*
+ * @test
+ * @key stress gc
+ *
+ * @summary converted from VM Testbase gc/g1/unloading/tests/unloading_keepRef_rootClass_inMemoryCompilation_keep_cl.
+ * VM Testbase keywords: [gc, stress, stressopt, nonconcurrent, javac]
+ *
+ * @modules java.base/jdk.internal.misc
+ * java.base/jdk.internal.org.objectweb.asm
+ * @library /vmTestbase
+ * /test/lib
+ *
+ * @run driver jdk.test.lib.FileInstaller . .
+ *
+ * @comment generate HumongousTemplateClass and compile it to test.classes
+ * @run driver gc.g1.unloading.bytecode.GenClassesBuilder
+ *
+ * @comment build classPool.jar
+ * @run driver gc.g1.unloading.GenClassesBuilder
+ *
+ * @build sun.hotspot.WhiteBox
+ * @run driver ClassFileInstaller sun.hotspot.WhiteBox
+ * sun.hotspot.WhiteBox$WhiteBoxPermission
+ * @run main/othervm
+ * -Xbootclasspath/a:.
+ * -XX:+UnlockDiagnosticVMOptions
+ * -XX:+WhiteBoxAPI
+ * -XX:+UseG1GC
+ * -XX:+ExplicitGCInvokesConcurrent
+ * -Xbootclasspath/a:classPool.jar
+ * -Xbootclasspath/a:.
+ * -XX:+UnlockDiagnosticVMOptions
+ * -XX:+WhiteBoxAPI
+ * -XX:+UseG1GC
+ * -XX:+ExplicitGCInvokesConcurrent
+ * -Xlog:gc:gc.log
+ * -XX:-UseGCOverheadLimit
+ * -Xlog:gc:gc.log
+ * -XX:-UseGCOverheadLimit
+ * gc.g1.unloading.UnloadingTest
+ * -keepRefMode STATIC_FIELD_OF_ROOT_CLASS
+ * -inMemoryCompilation
+ * -keep classloader
+ * -numberOfChecksLimit 4
+ * -stressTime 180
+ */
+
diff --git a/test/hotspot/jtreg/vmTestbase/gc/g1/unloading/tests/unloading_keepRef_rootClass_inMemoryCompilation_keep_class/TEST.properties b/test/hotspot/jtreg/vmTestbase/gc/g1/unloading/tests/unloading_keepRef_rootClass_inMemoryCompilation_keep_class/TEST.properties
new file mode 100644
index 0000000..04b22a1
--- /dev/null
+++ b/test/hotspot/jtreg/vmTestbase/gc/g1/unloading/tests/unloading_keepRef_rootClass_inMemoryCompilation_keep_class/TEST.properties
@@ -0,0 +1,23 @@
+#
+# 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/g1/unloading/tests/unloading_keepRef_rootClass_inMemoryCompilation_keep_class/TestDescription.java b/test/hotspot/jtreg/vmTestbase/gc/g1/unloading/tests/unloading_keepRef_rootClass_inMemoryCompilation_keep_class/TestDescription.java
new file mode 100644
index 0000000..e2ff13e
--- /dev/null
+++ b/test/hotspot/jtreg/vmTestbase/gc/g1/unloading/tests/unloading_keepRef_rootClass_inMemoryCompilation_keep_class/TestDescription.java
@@ -0,0 +1,71 @@
+/*
+ * 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.
+ */
+
+
+/*
+ * @test
+ * @key stress gc
+ *
+ * @summary converted from VM Testbase gc/g1/unloading/tests/unloading_keepRef_rootClass_inMemoryCompilation_keep_class.
+ * VM Testbase keywords: [gc, stress, stressopt, nonconcurrent, javac]
+ *
+ * @modules java.base/jdk.internal.misc
+ * java.base/jdk.internal.org.objectweb.asm
+ * @library /vmTestbase
+ * /test/lib
+ *
+ * @run driver jdk.test.lib.FileInstaller . .
+ *
+ * @comment generate HumongousTemplateClass and compile it to test.classes
+ * @run driver gc.g1.unloading.bytecode.GenClassesBuilder
+ *
+ * @comment build classPool.jar
+ * @run driver gc.g1.unloading.GenClassesBuilder
+ *
+ * @build sun.hotspot.WhiteBox
+ * @run driver ClassFileInstaller sun.hotspot.WhiteBox
+ * sun.hotspot.WhiteBox$WhiteBoxPermission
+ * @run main/othervm
+ * -Xbootclasspath/a:.
+ * -XX:+UnlockDiagnosticVMOptions
+ * -XX:+WhiteBoxAPI
+ * -XX:+UseG1GC
+ * -XX:+ExplicitGCInvokesConcurrent
+ * -Xbootclasspath/a:classPool.jar
+ * -Xbootclasspath/a:.
+ * -XX:+UnlockDiagnosticVMOptions
+ * -XX:+WhiteBoxAPI
+ * -XX:+UseG1GC
+ * -XX:+ExplicitGCInvokesConcurrent
+ * -Xlog:gc:gc.log
+ * -XX:-UseGCOverheadLimit
+ * -Xlog:gc:gc.log
+ * -XX:-UseGCOverheadLimit
+ * gc.g1.unloading.UnloadingTest
+ * -keepRefMode STATIC_FIELD_OF_ROOT_CLASS
+ * -inMemoryCompilation
+ * -keep class
+ * -numberOfChecksLimit 4
+ * -stressTime 180
+ */
+
diff --git a/test/hotspot/jtreg/vmTestbase/gc/g1/unloading/tests/unloading_keepRef_rootClass_inMemoryCompilation_keep_obj/TEST.properties b/test/hotspot/jtreg/vmTestbase/gc/g1/unloading/tests/unloading_keepRef_rootClass_inMemoryCompilation_keep_obj/TEST.properties
new file mode 100644
index 0000000..04b22a1
--- /dev/null
+++ b/test/hotspot/jtreg/vmTestbase/gc/g1/unloading/tests/unloading_keepRef_rootClass_inMemoryCompilation_keep_obj/TEST.properties
@@ -0,0 +1,23 @@
+#
+# 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/g1/unloading/tests/unloading_keepRef_rootClass_inMemoryCompilation_keep_obj/TestDescription.java b/test/hotspot/jtreg/vmTestbase/gc/g1/unloading/tests/unloading_keepRef_rootClass_inMemoryCompilation_keep_obj/TestDescription.java
new file mode 100644
index 0000000..babf59f
--- /dev/null
+++ b/test/hotspot/jtreg/vmTestbase/gc/g1/unloading/tests/unloading_keepRef_rootClass_inMemoryCompilation_keep_obj/TestDescription.java
@@ -0,0 +1,71 @@
+/*
+ * 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.
+ */
+
+
+/*
+ * @test
+ * @key stress gc
+ *
+ * @summary converted from VM Testbase gc/g1/unloading/tests/unloading_keepRef_rootClass_inMemoryCompilation_keep_obj.
+ * VM Testbase keywords: [gc, stress, stressopt, nonconcurrent, javac]
+ *
+ * @modules java.base/jdk.internal.misc
+ * java.base/jdk.internal.org.objectweb.asm
+ * @library /vmTestbase
+ * /test/lib
+ *
+ * @run driver jdk.test.lib.FileInstaller . .
+ *
+ * @comment generate HumongousTemplateClass and compile it to test.classes
+ * @run driver gc.g1.unloading.bytecode.GenClassesBuilder
+ *
+ * @comment build classPool.jar
+ * @run driver gc.g1.unloading.GenClassesBuilder
+ *
+ * @build sun.hotspot.WhiteBox
+ * @run driver ClassFileInstaller sun.hotspot.WhiteBox
+ * sun.hotspot.WhiteBox$WhiteBoxPermission
+ * @run main/othervm
+ * -Xbootclasspath/a:.
+ * -XX:+UnlockDiagnosticVMOptions
+ * -XX:+WhiteBoxAPI
+ * -XX:+UseG1GC
+ * -XX:+ExplicitGCInvokesConcurrent
+ * -Xbootclasspath/a:classPool.jar
+ * -Xbootclasspath/a:.
+ * -XX:+UnlockDiagnosticVMOptions
+ * -XX:+WhiteBoxAPI
+ * -XX:+UseG1GC
+ * -XX:+ExplicitGCInvokesConcurrent
+ * -Xlog:gc:gc.log
+ * -XX:-UseGCOverheadLimit
+ * -Xlog:gc:gc.log
+ * -XX:-UseGCOverheadLimit
+ * gc.g1.unloading.UnloadingTest
+ * -keepRefMode STATIC_FIELD_OF_ROOT_CLASS
+ * -inMemoryCompilation
+ * -keep object
+ * -numberOfChecksLimit 4
+ * -stressTime 180
+ */
+
diff --git a/test/hotspot/jtreg/vmTestbase/gc/g1/unloading/tests/unloading_keepRef_rootClass_keep_cl/TEST.properties b/test/hotspot/jtreg/vmTestbase/gc/g1/unloading/tests/unloading_keepRef_rootClass_keep_cl/TEST.properties
new file mode 100644
index 0000000..04b22a1
--- /dev/null
+++ b/test/hotspot/jtreg/vmTestbase/gc/g1/unloading/tests/unloading_keepRef_rootClass_keep_cl/TEST.properties
@@ -0,0 +1,23 @@
+#
+# 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/g1/unloading/tests/unloading_keepRef_rootClass_keep_cl/TestDescription.java b/test/hotspot/jtreg/vmTestbase/gc/g1/unloading/tests/unloading_keepRef_rootClass_keep_cl/TestDescription.java
new file mode 100644
index 0000000..a848313
--- /dev/null
+++ b/test/hotspot/jtreg/vmTestbase/gc/g1/unloading/tests/unloading_keepRef_rootClass_keep_cl/TestDescription.java
@@ -0,0 +1,70 @@
+/*
+ * 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.
+ */
+
+
+/*
+ * @test
+ * @key stress gc
+ *
+ * @summary converted from VM Testbase gc/g1/unloading/tests/unloading_keepRef_rootClass_keep_cl.
+ * VM Testbase keywords: [gc, stress, stressopt, nonconcurrent, javac]
+ *
+ * @modules java.base/jdk.internal.misc
+ * java.base/jdk.internal.org.objectweb.asm
+ * @library /vmTestbase
+ * /test/lib
+ *
+ * @run driver jdk.test.lib.FileInstaller . .
+ *
+ * @comment generate HumongousTemplateClass and compile it to test.classes
+ * @run driver gc.g1.unloading.bytecode.GenClassesBuilder
+ *
+ * @comment build classPool.jar
+ * @run driver gc.g1.unloading.GenClassesBuilder
+ *
+ * @build sun.hotspot.WhiteBox
+ * @run driver ClassFileInstaller sun.hotspot.WhiteBox
+ * sun.hotspot.WhiteBox$WhiteBoxPermission
+ * @run main/othervm
+ * -Xbootclasspath/a:.
+ * -XX:+UnlockDiagnosticVMOptions
+ * -XX:+WhiteBoxAPI
+ * -XX:+UseG1GC
+ * -XX:+ExplicitGCInvokesConcurrent
+ * -Xbootclasspath/a:classPool.jar
+ * -Xbootclasspath/a:.
+ * -XX:+UnlockDiagnosticVMOptions
+ * -XX:+WhiteBoxAPI
+ * -XX:+UseG1GC
+ * -XX:+ExplicitGCInvokesConcurrent
+ * -Xlog:gc:gc.log
+ * -XX:-UseGCOverheadLimit
+ * -Xlog:gc:gc.log
+ * -XX:-UseGCOverheadLimit
+ * gc.g1.unloading.UnloadingTest
+ * -keepRefMode STATIC_FIELD_OF_ROOT_CLASS
+ * -keep classloader
+ * -numberOfChecksLimit 4
+ * -stressTime 180
+ */
+
diff --git a/test/hotspot/jtreg/vmTestbase/gc/g1/unloading/tests/unloading_keepRef_rootClass_keep_class/TEST.properties b/test/hotspot/jtreg/vmTestbase/gc/g1/unloading/tests/unloading_keepRef_rootClass_keep_class/TEST.properties
new file mode 100644
index 0000000..04b22a1
--- /dev/null
+++ b/test/hotspot/jtreg/vmTestbase/gc/g1/unloading/tests/unloading_keepRef_rootClass_keep_class/TEST.properties
@@ -0,0 +1,23 @@
+#
+# 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/g1/unloading/tests/unloading_keepRef_rootClass_keep_class/TestDescription.java b/test/hotspot/jtreg/vmTestbase/gc/g1/unloading/tests/unloading_keepRef_rootClass_keep_class/TestDescription.java
new file mode 100644
index 0000000..cfde5dd
--- /dev/null
+++ b/test/hotspot/jtreg/vmTestbase/gc/g1/unloading/tests/unloading_keepRef_rootClass_keep_class/TestDescription.java
@@ -0,0 +1,70 @@
+/*
+ * 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.
+ */
+
+
+/*
+ * @test
+ * @key stress gc
+ *
+ * @summary converted from VM Testbase gc/g1/unloading/tests/unloading_keepRef_rootClass_keep_class.
+ * VM Testbase keywords: [gc, stress, stressopt, nonconcurrent, javac]
+ *
+ * @modules java.base/jdk.internal.misc
+ * java.base/jdk.internal.org.objectweb.asm
+ * @library /vmTestbase
+ * /test/lib
+ *
+ * @run driver jdk.test.lib.FileInstaller . .
+ *
+ * @comment generate HumongousTemplateClass and compile it to test.classes
+ * @run driver gc.g1.unloading.bytecode.GenClassesBuilder
+ *
+ * @comment build classPool.jar
+ * @run driver gc.g1.unloading.GenClassesBuilder
+ *
+ * @build sun.hotspot.WhiteBox
+ * @run driver ClassFileInstaller sun.hotspot.WhiteBox
+ * sun.hotspot.WhiteBox$WhiteBoxPermission
+ * @run main/othervm
+ * -Xbootclasspath/a:.
+ * -XX:+UnlockDiagnosticVMOptions
+ * -XX:+WhiteBoxAPI
+ * -XX:+UseG1GC
+ * -XX:+ExplicitGCInvokesConcurrent
+ * -Xbootclasspath/a:classPool.jar
+ * -Xbootclasspath/a:.
+ * -XX:+UnlockDiagnosticVMOptions
+ * -XX:+WhiteBoxAPI
+ * -XX:+UseG1GC
+ * -XX:+ExplicitGCInvokesConcurrent
+ * -Xlog:gc:gc.log
+ * -XX:-UseGCOverheadLimit
+ * -Xlog:gc:gc.log
+ * -XX:-UseGCOverheadLimit
+ * gc.g1.unloading.UnloadingTest
+ * -keepRefMode STATIC_FIELD_OF_ROOT_CLASS
+ * -keep class
+ * -numberOfChecksLimit 4
+ * -stressTime 180
+ */
+
diff --git a/test/hotspot/jtreg/vmTestbase/gc/g1/unloading/tests/unloading_keepRef_rootClass_keep_obj/TEST.properties b/test/hotspot/jtreg/vmTestbase/gc/g1/unloading/tests/unloading_keepRef_rootClass_keep_obj/TEST.properties
new file mode 100644
index 0000000..04b22a1
--- /dev/null
+++ b/test/hotspot/jtreg/vmTestbase/gc/g1/unloading/tests/unloading_keepRef_rootClass_keep_obj/TEST.properties
@@ -0,0 +1,23 @@
+#
+# 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/g1/unloading/tests/unloading_keepRef_rootClass_keep_obj/TestDescription.java b/test/hotspot/jtreg/vmTestbase/gc/g1/unloading/tests/unloading_keepRef_rootClass_keep_obj/TestDescription.java
new file mode 100644
index 0000000..5c30e1a
--- /dev/null
+++ b/test/hotspot/jtreg/vmTestbase/gc/g1/unloading/tests/unloading_keepRef_rootClass_keep_obj/TestDescription.java
@@ -0,0 +1,70 @@
+/*
+ * 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.
+ */
+
+
+/*
+ * @test
+ * @key stress gc
+ *
+ * @summary converted from VM Testbase gc/g1/unloading/tests/unloading_keepRef_rootClass_keep_obj.
+ * VM Testbase keywords: [gc, stress, stressopt, nonconcurrent, javac]
+ *
+ * @modules java.base/jdk.internal.misc
+ * java.base/jdk.internal.org.objectweb.asm
+ * @library /vmTestbase
+ * /test/lib
+ *
+ * @run driver jdk.test.lib.FileInstaller . .
+ *
+ * @comment generate HumongousTemplateClass and compile it to test.classes
+ * @run driver gc.g1.unloading.bytecode.GenClassesBuilder
+ *
+ * @comment build classPool.jar
+ * @run driver gc.g1.unloading.GenClassesBuilder
+ *
+ * @build sun.hotspot.WhiteBox
+ * @run driver ClassFileInstaller sun.hotspot.WhiteBox
+ * sun.hotspot.WhiteBox$WhiteBoxPermission
+ * @run main/othervm
+ * -Xbootclasspath/a:.
+ * -XX:+UnlockDiagnosticVMOptions
+ * -XX:+WhiteBoxAPI
+ * -XX:+UseG1GC
+ * -XX:+ExplicitGCInvokesConcurrent
+ * -Xbootclasspath/a:classPool.jar
+ * -Xbootclasspath/a:.
+ * -XX:+UnlockDiagnosticVMOptions
+ * -XX:+WhiteBoxAPI
+ * -XX:+UseG1GC
+ * -XX:+ExplicitGCInvokesConcurrent
+ * -Xlog:gc:gc.log
+ * -XX:-UseGCOverheadLimit
+ * -Xlog:gc:gc.log
+ * -XX:-UseGCOverheadLimit
+ * gc.g1.unloading.UnloadingTest
+ * -keepRefMode STATIC_FIELD_OF_ROOT_CLASS
+ * -keep object
+ * -numberOfChecksLimit 4
+ * -stressTime 180
+ */
+
diff --git a/test/hotspot/jtreg/vmTestbase/gc/g1/unloading/tests/unloading_keepRef_stackLocal_inMemoryCompilation_keep_cl/TEST.properties b/test/hotspot/jtreg/vmTestbase/gc/g1/unloading/tests/unloading_keepRef_stackLocal_inMemoryCompilation_keep_cl/TEST.properties
new file mode 100644
index 0000000..04b22a1
--- /dev/null
+++ b/test/hotspot/jtreg/vmTestbase/gc/g1/unloading/tests/unloading_keepRef_stackLocal_inMemoryCompilation_keep_cl/TEST.properties
@@ -0,0 +1,23 @@
+#
+# 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/g1/unloading/tests/unloading_keepRef_stackLocal_inMemoryCompilation_keep_cl/TestDescription.java b/test/hotspot/jtreg/vmTestbase/gc/g1/unloading/tests/unloading_keepRef_stackLocal_inMemoryCompilation_keep_cl/TestDescription.java
new file mode 100644
index 0000000..3efb050
--- /dev/null
+++ b/test/hotspot/jtreg/vmTestbase/gc/g1/unloading/tests/unloading_keepRef_stackLocal_inMemoryCompilation_keep_cl/TestDescription.java
@@ -0,0 +1,66 @@
+/*
+ * 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.
+ */
+
+
+/*
+ * @test
+ * @key stress gc
+ *
+ * @summary converted from VM Testbase gc/g1/unloading/tests/unloading_keepRef_stackLocal_inMemoryCompilation_keep_cl.
+ * VM Testbase keywords: [gc, stress, stressopt, nonconcurrent, javac]
+ *
+ * @modules java.base/jdk.internal.misc
+ * @library /vmTestbase
+ * /test/lib
+ *
+ * @run driver jdk.test.lib.FileInstaller . .
+ *
+ * @comment generate HumongousTemplateClass and compile it to test.classes
+ * @run driver gc.g1.unloading.bytecode.GenClassesBuilder
+ *
+ * @build sun.hotspot.WhiteBox
+ * @run driver ClassFileInstaller sun.hotspot.WhiteBox
+ * sun.hotspot.WhiteBox$WhiteBoxPermission
+ * @run main/othervm
+ * -Xbootclasspath/a:.
+ * -XX:+UnlockDiagnosticVMOptions
+ * -XX:+WhiteBoxAPI
+ * -XX:+UseG1GC
+ * -XX:+ExplicitGCInvokesConcurrent
+ * -Xbootclasspath/a:.
+ * -XX:+UnlockDiagnosticVMOptions
+ * -XX:+WhiteBoxAPI
+ * -XX:+UseG1GC
+ * -XX:+ExplicitGCInvokesConcurrent
+ * -Xlog:gc:gc.log
+ * -XX:-UseGCOverheadLimit
+ * -Xlog:gc:gc.log
+ * -XX:-UseGCOverheadLimit
+ * gc.g1.unloading.UnloadingTest
+ * -keepRefMode STACK_LOCAL
+ * -inMemoryCompilation
+ * -keep classloader
+ * -numberOfChecksLimit 4
+ * -stressTime 180
+ */
+
diff --git a/test/hotspot/jtreg/vmTestbase/gc/g1/unloading/tests/unloading_keepRef_stackLocal_inMemoryCompilation_keep_class/TEST.properties b/test/hotspot/jtreg/vmTestbase/gc/g1/unloading/tests/unloading_keepRef_stackLocal_inMemoryCompilation_keep_class/TEST.properties
new file mode 100644
index 0000000..04b22a1
--- /dev/null
+++ b/test/hotspot/jtreg/vmTestbase/gc/g1/unloading/tests/unloading_keepRef_stackLocal_inMemoryCompilation_keep_class/TEST.properties
@@ -0,0 +1,23 @@
+#
+# 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/g1/unloading/tests/unloading_keepRef_stackLocal_inMemoryCompilation_keep_class/TestDescription.java b/test/hotspot/jtreg/vmTestbase/gc/g1/unloading/tests/unloading_keepRef_stackLocal_inMemoryCompilation_keep_class/TestDescription.java
new file mode 100644
index 0000000..4b43ade
--- /dev/null
+++ b/test/hotspot/jtreg/vmTestbase/gc/g1/unloading/tests/unloading_keepRef_stackLocal_inMemoryCompilation_keep_class/TestDescription.java
@@ -0,0 +1,66 @@
+/*
+ * 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.
+ */
+
+
+/*
+ * @test
+ * @key stress gc
+ *
+ * @summary converted from VM Testbase gc/g1/unloading/tests/unloading_keepRef_stackLocal_inMemoryCompilation_keep_class.
+ * VM Testbase keywords: [gc, stress, stressopt, nonconcurrent, javac]
+ *
+ * @modules java.base/jdk.internal.misc
+ * @library /vmTestbase
+ * /test/lib
+ *
+ * @run driver jdk.test.lib.FileInstaller . .
+ *
+ * @comment generate HumongousTemplateClass and compile it to test.classes
+ * @run driver gc.g1.unloading.bytecode.GenClassesBuilder
+ *
+ * @build sun.hotspot.WhiteBox
+ * @run driver ClassFileInstaller sun.hotspot.WhiteBox
+ * sun.hotspot.WhiteBox$WhiteBoxPermission
+ * @run main/othervm
+ * -Xbootclasspath/a:.
+ * -XX:+UnlockDiagnosticVMOptions
+ * -XX:+WhiteBoxAPI
+ * -XX:+UseG1GC
+ * -XX:+ExplicitGCInvokesConcurrent
+ * -Xbootclasspath/a:.
+ * -XX:+UnlockDiagnosticVMOptions
+ * -XX:+WhiteBoxAPI
+ * -XX:+UseG1GC
+ * -XX:+ExplicitGCInvokesConcurrent
+ * -Xlog:gc:gc.log
+ * -XX:-UseGCOverheadLimit
+ * -Xlog:gc:gc.log
+ * -XX:-UseGCOverheadLimit
+ * gc.g1.unloading.UnloadingTest
+ * -keepRefMode STACK_LOCAL
+ * -inMemoryCompilation
+ * -keep class
+ * -numberOfChecksLimit 4
+ * -stressTime 180
+ */
+
diff --git a/test/hotspot/jtreg/vmTestbase/gc/g1/unloading/tests/unloading_keepRef_stackLocal_inMemoryCompilation_keep_obj/TEST.properties b/test/hotspot/jtreg/vmTestbase/gc/g1/unloading/tests/unloading_keepRef_stackLocal_inMemoryCompilation_keep_obj/TEST.properties
new file mode 100644
index 0000000..04b22a1
--- /dev/null
+++ b/test/hotspot/jtreg/vmTestbase/gc/g1/unloading/tests/unloading_keepRef_stackLocal_inMemoryCompilation_keep_obj/TEST.properties
@@ -0,0 +1,23 @@
+#
+# 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/g1/unloading/tests/unloading_keepRef_stackLocal_inMemoryCompilation_keep_obj/TestDescription.java b/test/hotspot/jtreg/vmTestbase/gc/g1/unloading/tests/unloading_keepRef_stackLocal_inMemoryCompilation_keep_obj/TestDescription.java
new file mode 100644
index 0000000..0b9e691
--- /dev/null
+++ b/test/hotspot/jtreg/vmTestbase/gc/g1/unloading/tests/unloading_keepRef_stackLocal_inMemoryCompilation_keep_obj/TestDescription.java
@@ -0,0 +1,66 @@
+/*
+ * 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.
+ */
+
+
+/*
+ * @test
+ * @key stress gc
+ *
+ * @summary converted from VM Testbase gc/g1/unloading/tests/unloading_keepRef_stackLocal_inMemoryCompilation_keep_obj.
+ * VM Testbase keywords: [gc, stress, stressopt, nonconcurrent, javac]
+ *
+ * @modules java.base/jdk.internal.misc
+ * @library /vmTestbase
+ * /test/lib
+ *
+ * @run driver jdk.test.lib.FileInstaller . .
+ *
+ * @comment generate HumongousTemplateClass and compile it to test.classes
+ * @run driver gc.g1.unloading.bytecode.GenClassesBuilder
+ *
+ * @build sun.hotspot.WhiteBox
+ * @run driver ClassFileInstaller sun.hotspot.WhiteBox
+ * sun.hotspot.WhiteBox$WhiteBoxPermission
+ * @run main/othervm
+ * -Xbootclasspath/a:.
+ * -XX:+UnlockDiagnosticVMOptions
+ * -XX:+WhiteBoxAPI
+ * -XX:+UseG1GC
+ * -XX:+ExplicitGCInvokesConcurrent
+ * -Xbootclasspath/a:.
+ * -XX:+UnlockDiagnosticVMOptions
+ * -XX:+WhiteBoxAPI
+ * -XX:+UseG1GC
+ * -XX:+ExplicitGCInvokesConcurrent
+ * -Xlog:gc:gc.log
+ * -XX:-UseGCOverheadLimit
+ * -Xlog:gc:gc.log
+ * -XX:-UseGCOverheadLimit
+ * gc.g1.unloading.UnloadingTest
+ * -keepRefMode STACK_LOCAL
+ * -inMemoryCompilation
+ * -keep object
+ * -numberOfChecksLimit 4
+ * -stressTime 180
+ */
+
diff --git a/test/hotspot/jtreg/vmTestbase/gc/g1/unloading/tests/unloading_keepRef_stackLocal_keep_cl/TEST.properties b/test/hotspot/jtreg/vmTestbase/gc/g1/unloading/tests/unloading_keepRef_stackLocal_keep_cl/TEST.properties
new file mode 100644
index 0000000..04b22a1
--- /dev/null
+++ b/test/hotspot/jtreg/vmTestbase/gc/g1/unloading/tests/unloading_keepRef_stackLocal_keep_cl/TEST.properties
@@ -0,0 +1,23 @@
+#
+# 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/g1/unloading/tests/unloading_keepRef_stackLocal_keep_cl/TestDescription.java b/test/hotspot/jtreg/vmTestbase/gc/g1/unloading/tests/unloading_keepRef_stackLocal_keep_cl/TestDescription.java
new file mode 100644
index 0000000..cafe8c5
--- /dev/null
+++ b/test/hotspot/jtreg/vmTestbase/gc/g1/unloading/tests/unloading_keepRef_stackLocal_keep_cl/TestDescription.java
@@ -0,0 +1,65 @@
+/*
+ * 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.
+ */
+
+
+/*
+ * @test
+ * @key stress gc
+ *
+ * @summary converted from VM Testbase gc/g1/unloading/tests/unloading_keepRef_stackLocal_keep_cl.
+ * VM Testbase keywords: [gc, stress, stressopt, nonconcurrent, javac]
+ *
+ * @modules java.base/jdk.internal.misc
+ * @library /vmTestbase
+ * /test/lib
+ *
+ * @run driver jdk.test.lib.FileInstaller . .
+ *
+ * @comment generate HumongousTemplateClass and compile it to test.classes
+ * @run driver gc.g1.unloading.bytecode.GenClassesBuilder
+ *
+ * @build sun.hotspot.WhiteBox
+ * @run driver ClassFileInstaller sun.hotspot.WhiteBox
+ * sun.hotspot.WhiteBox$WhiteBoxPermission
+ * @run main/othervm
+ * -Xbootclasspath/a:.
+ * -XX:+UnlockDiagnosticVMOptions
+ * -XX:+WhiteBoxAPI
+ * -XX:+UseG1GC
+ * -XX:+ExplicitGCInvokesConcurrent
+ * -Xbootclasspath/a:.
+ * -XX:+UnlockDiagnosticVMOptions
+ * -XX:+WhiteBoxAPI
+ * -XX:+UseG1GC
+ * -XX:+ExplicitGCInvokesConcurrent
+ * -Xlog:gc:gc.log
+ * -XX:-UseGCOverheadLimit
+ * -Xlog:gc:gc.log
+ * -XX:-UseGCOverheadLimit
+ * gc.g1.unloading.UnloadingTest
+ * -keepRefMode STACK_LOCAL
+ * -keep classloader
+ * -numberOfChecksLimit 4
+ * -stressTime 180
+ */
+
diff --git a/test/hotspot/jtreg/vmTestbase/gc/g1/unloading/tests/unloading_keepRef_stackLocal_keep_class/TEST.properties b/test/hotspot/jtreg/vmTestbase/gc/g1/unloading/tests/unloading_keepRef_stackLocal_keep_class/TEST.properties
new file mode 100644
index 0000000..04b22a1
--- /dev/null
+++ b/test/hotspot/jtreg/vmTestbase/gc/g1/unloading/tests/unloading_keepRef_stackLocal_keep_class/TEST.properties
@@ -0,0 +1,23 @@
+#
+# 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/g1/unloading/tests/unloading_keepRef_stackLocal_keep_class/TestDescription.java b/test/hotspot/jtreg/vmTestbase/gc/g1/unloading/tests/unloading_keepRef_stackLocal_keep_class/TestDescription.java
new file mode 100644
index 0000000..7ef3bf5
--- /dev/null
+++ b/test/hotspot/jtreg/vmTestbase/gc/g1/unloading/tests/unloading_keepRef_stackLocal_keep_class/TestDescription.java
@@ -0,0 +1,65 @@
+/*
+ * 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.
+ */
+
+
+/*
+ * @test
+ * @key stress gc
+ *
+ * @summary converted from VM Testbase gc/g1/unloading/tests/unloading_keepRef_stackLocal_keep_class.
+ * VM Testbase keywords: [gc, stress, stressopt, nonconcurrent, javac]
+ *
+ * @modules java.base/jdk.internal.misc
+ * @library /vmTestbase
+ * /test/lib
+ *
+ * @run driver jdk.test.lib.FileInstaller . .
+ *
+ * @comment generate HumongousTemplateClass and compile it to test.classes
+ * @run driver gc.g1.unloading.bytecode.GenClassesBuilder
+ *
+ * @build sun.hotspot.WhiteBox
+ * @run driver ClassFileInstaller sun.hotspot.WhiteBox
+ * sun.hotspot.WhiteBox$WhiteBoxPermission
+ * @run main/othervm
+ * -Xbootclasspath/a:.
+ * -XX:+UnlockDiagnosticVMOptions
+ * -XX:+WhiteBoxAPI
+ * -XX:+UseG1GC
+ * -XX:+ExplicitGCInvokesConcurrent
+ * -Xbootclasspath/a:.
+ * -XX:+UnlockDiagnosticVMOptions
+ * -XX:+WhiteBoxAPI
+ * -XX:+UseG1GC
+ * -XX:+ExplicitGCInvokesConcurrent
+ * -Xlog:gc:gc.log
+ * -XX:-UseGCOverheadLimit
+ * -Xlog:gc:gc.log
+ * -XX:-UseGCOverheadLimit
+ * gc.g1.unloading.UnloadingTest
+ * -keepRefMode STACK_LOCAL
+ * -keep class
+ * -numberOfChecksLimit 4
+ * -stressTime 180
+ */
+
diff --git a/test/hotspot/jtreg/vmTestbase/gc/g1/unloading/tests/unloading_keepRef_stackLocal_keep_obj/TEST.properties b/test/hotspot/jtreg/vmTestbase/gc/g1/unloading/tests/unloading_keepRef_stackLocal_keep_obj/TEST.properties
new file mode 100644
index 0000000..04b22a1
--- /dev/null
+++ b/test/hotspot/jtreg/vmTestbase/gc/g1/unloading/tests/unloading_keepRef_stackLocal_keep_obj/TEST.properties
@@ -0,0 +1,23 @@
+#
+# 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/g1/unloading/tests/unloading_keepRef_stackLocal_keep_obj/TestDescription.java b/test/hotspot/jtreg/vmTestbase/gc/g1/unloading/tests/unloading_keepRef_stackLocal_keep_obj/TestDescription.java
new file mode 100644
index 0000000..1097b4d
--- /dev/null
+++ b/test/hotspot/jtreg/vmTestbase/gc/g1/unloading/tests/unloading_keepRef_stackLocal_keep_obj/TestDescription.java
@@ -0,0 +1,65 @@
+/*
+ * 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.
+ */
+
+
+/*
+ * @test
+ * @key stress gc
+ *
+ * @summary converted from VM Testbase gc/g1/unloading/tests/unloading_keepRef_stackLocal_keep_obj.
+ * VM Testbase keywords: [gc, stress, stressopt, nonconcurrent, javac]
+ *
+ * @modules java.base/jdk.internal.misc
+ * @library /vmTestbase
+ * /test/lib
+ *
+ * @run driver jdk.test.lib.FileInstaller . .
+ *
+ * @comment generate HumongousTemplateClass and compile it to test.classes
+ * @run driver gc.g1.unloading.bytecode.GenClassesBuilder
+ *
+ * @build sun.hotspot.WhiteBox
+ * @run driver ClassFileInstaller sun.hotspot.WhiteBox
+ * sun.hotspot.WhiteBox$WhiteBoxPermission
+ * @run main/othervm
+ * -Xbootclasspath/a:.
+ * -XX:+UnlockDiagnosticVMOptions
+ * -XX:+WhiteBoxAPI
+ * -XX:+UseG1GC
+ * -XX:+ExplicitGCInvokesConcurrent
+ * -Xbootclasspath/a:.
+ * -XX:+UnlockDiagnosticVMOptions
+ * -XX:+WhiteBoxAPI
+ * -XX:+UseG1GC
+ * -XX:+ExplicitGCInvokesConcurrent
+ * -Xlog:gc:gc.log
+ * -XX:-UseGCOverheadLimit
+ * -Xlog:gc:gc.log
+ * -XX:-UseGCOverheadLimit
+ * gc.g1.unloading.UnloadingTest
+ * -keepRefMode STACK_LOCAL
+ * -keep object
+ * -numberOfChecksLimit 4
+ * -stressTime 180
+ */
+
diff --git a/test/hotspot/jtreg/vmTestbase/gc/g1/unloading/tests/unloading_keepRef_staticField_inMemoryCompilation_keep_cl/TEST.properties b/test/hotspot/jtreg/vmTestbase/gc/g1/unloading/tests/unloading_keepRef_staticField_inMemoryCompilation_keep_cl/TEST.properties
new file mode 100644
index 0000000..04b22a1
--- /dev/null
+++ b/test/hotspot/jtreg/vmTestbase/gc/g1/unloading/tests/unloading_keepRef_staticField_inMemoryCompilation_keep_cl/TEST.properties
@@ -0,0 +1,23 @@
+#
+# 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/g1/unloading/tests/unloading_keepRef_staticField_inMemoryCompilation_keep_cl/TestDescription.java b/test/hotspot/jtreg/vmTestbase/gc/g1/unloading/tests/unloading_keepRef_staticField_inMemoryCompilation_keep_cl/TestDescription.java
new file mode 100644
index 0000000..ab17c62
--- /dev/null
+++ b/test/hotspot/jtreg/vmTestbase/gc/g1/unloading/tests/unloading_keepRef_staticField_inMemoryCompilation_keep_cl/TestDescription.java
@@ -0,0 +1,66 @@
+/*
+ * 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.
+ */
+
+
+/*
+ * @test
+ * @key stress gc
+ *
+ * @summary converted from VM Testbase gc/g1/unloading/tests/unloading_keepRef_staticField_inMemoryCompilation_keep_cl.
+ * VM Testbase keywords: [gc, stress, stressopt, nonconcurrent, javac]
+ *
+ * @modules java.base/jdk.internal.misc
+ * @library /vmTestbase
+ * /test/lib
+ *
+ * @run driver jdk.test.lib.FileInstaller . .
+ *
+ * @comment generate HumongousTemplateClass and compile it to test.classes
+ * @run driver gc.g1.unloading.bytecode.GenClassesBuilder
+ *
+ * @build sun.hotspot.WhiteBox
+ * @run driver ClassFileInstaller sun.hotspot.WhiteBox
+ * sun.hotspot.WhiteBox$WhiteBoxPermission
+ * @run main/othervm
+ * -Xbootclasspath/a:.
+ * -XX:+UnlockDiagnosticVMOptions
+ * -XX:+WhiteBoxAPI
+ * -XX:+UseG1GC
+ * -XX:+ExplicitGCInvokesConcurrent
+ * -Xbootclasspath/a:.
+ * -XX:+UnlockDiagnosticVMOptions
+ * -XX:+WhiteBoxAPI
+ * -XX:+UseG1GC
+ * -XX:+ExplicitGCInvokesConcurrent
+ * -Xlog:gc:gc.log
+ * -XX:-UseGCOverheadLimit
+ * -Xlog:gc:gc.log
+ * -XX:-UseGCOverheadLimit
+ * gc.g1.unloading.UnloadingTest
+ * -keepRefMode STATIC_FIELD
+ * -inMemoryCompilation
+ * -keep classloader
+ * -numberOfChecksLimit 4
+ * -stressTime 180
+ */
+
diff --git a/test/hotspot/jtreg/vmTestbase/gc/g1/unloading/tests/unloading_keepRef_staticField_inMemoryCompilation_keep_class/TEST.properties b/test/hotspot/jtreg/vmTestbase/gc/g1/unloading/tests/unloading_keepRef_staticField_inMemoryCompilation_keep_class/TEST.properties
new file mode 100644
index 0000000..04b22a1
--- /dev/null
+++ b/test/hotspot/jtreg/vmTestbase/gc/g1/unloading/tests/unloading_keepRef_staticField_inMemoryCompilation_keep_class/TEST.properties
@@ -0,0 +1,23 @@
+#
+# 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/g1/unloading/tests/unloading_keepRef_staticField_inMemoryCompilation_keep_class/TestDescription.java b/test/hotspot/jtreg/vmTestbase/gc/g1/unloading/tests/unloading_keepRef_staticField_inMemoryCompilation_keep_class/TestDescription.java
new file mode 100644
index 0000000..8bb515a
--- /dev/null
+++ b/test/hotspot/jtreg/vmTestbase/gc/g1/unloading/tests/unloading_keepRef_staticField_inMemoryCompilation_keep_class/TestDescription.java
@@ -0,0 +1,66 @@
+/*
+ * 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.
+ */
+
+
+/*
+ * @test
+ * @key stress gc
+ *
+ * @summary converted from VM Testbase gc/g1/unloading/tests/unloading_keepRef_staticField_inMemoryCompilation_keep_class.
+ * VM Testbase keywords: [gc, stress, stressopt, nonconcurrent, javac]
+ *
+ * @modules java.base/jdk.internal.misc
+ * @library /vmTestbase
+ * /test/lib
+ *
+ * @run driver jdk.test.lib.FileInstaller . .
+ *
+ * @comment generate HumongousTemplateClass and compile it to test.classes
+ * @run driver gc.g1.unloading.bytecode.GenClassesBuilder
+ *
+ * @build sun.hotspot.WhiteBox
+ * @run driver ClassFileInstaller sun.hotspot.WhiteBox
+ * sun.hotspot.WhiteBox$WhiteBoxPermission
+ * @run main/othervm
+ * -Xbootclasspath/a:.
+ * -XX:+UnlockDiagnosticVMOptions
+ * -XX:+WhiteBoxAPI
+ * -XX:+UseG1GC
+ * -XX:+ExplicitGCInvokesConcurrent
+ * -Xbootclasspath/a:.
+ * -XX:+UnlockDiagnosticVMOptions
+ * -XX:+WhiteBoxAPI
+ * -XX:+UseG1GC
+ * -XX:+ExplicitGCInvokesConcurrent
+ * -Xlog:gc:gc.log
+ * -XX:-UseGCOverheadLimit
+ * -Xlog:gc:gc.log
+ * -XX:-UseGCOverheadLimit
+ * gc.g1.unloading.UnloadingTest
+ * -keepRefMode STATIC_FIELD
+ * -inMemoryCompilation
+ * -keep class
+ * -numberOfChecksLimit 4
+ * -stressTime 180
+ */
+
diff --git a/test/hotspot/jtreg/vmTestbase/gc/g1/unloading/tests/unloading_keepRef_staticField_inMemoryCompilation_keep_obj/TEST.properties b/test/hotspot/jtreg/vmTestbase/gc/g1/unloading/tests/unloading_keepRef_staticField_inMemoryCompilation_keep_obj/TEST.properties
new file mode 100644
index 0000000..04b22a1
--- /dev/null
+++ b/test/hotspot/jtreg/vmTestbase/gc/g1/unloading/tests/unloading_keepRef_staticField_inMemoryCompilation_keep_obj/TEST.properties
@@ -0,0 +1,23 @@
+#
+# 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/g1/unloading/tests/unloading_keepRef_staticField_inMemoryCompilation_keep_obj/TestDescription.java b/test/hotspot/jtreg/vmTestbase/gc/g1/unloading/tests/unloading_keepRef_staticField_inMemoryCompilation_keep_obj/TestDescription.java
new file mode 100644
index 0000000..83d5aab
--- /dev/null
+++ b/test/hotspot/jtreg/vmTestbase/gc/g1/unloading/tests/unloading_keepRef_staticField_inMemoryCompilation_keep_obj/TestDescription.java
@@ -0,0 +1,66 @@
+/*
+ * 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.
+ */
+
+
+/*
+ * @test
+ * @key stress gc
+ *
+ * @summary converted from VM Testbase gc/g1/unloading/tests/unloading_keepRef_staticField_inMemoryCompilation_keep_obj.
+ * VM Testbase keywords: [gc, stress, stressopt, nonconcurrent, javac]
+ *
+ * @modules java.base/jdk.internal.misc
+ * @library /vmTestbase
+ * /test/lib
+ *
+ * @run driver jdk.test.lib.FileInstaller . .
+ *
+ * @comment generate HumongousTemplateClass and compile it to test.classes
+ * @run driver gc.g1.unloading.bytecode.GenClassesBuilder
+ *
+ * @build sun.hotspot.WhiteBox
+ * @run driver ClassFileInstaller sun.hotspot.WhiteBox
+ * sun.hotspot.WhiteBox$WhiteBoxPermission
+ * @run main/othervm
+ * -Xbootclasspath/a:.
+ * -XX:+UnlockDiagnosticVMOptions
+ * -XX:+WhiteBoxAPI
+ * -XX:+UseG1GC
+ * -XX:+ExplicitGCInvokesConcurrent
+ * -Xbootclasspath/a:.
+ * -XX:+UnlockDiagnosticVMOptions
+ * -XX:+WhiteBoxAPI
+ * -XX:+UseG1GC
+ * -XX:+ExplicitGCInvokesConcurrent
+ * -Xlog:gc:gc.log
+ * -XX:-UseGCOverheadLimit
+ * -Xlog:gc:gc.log
+ * -XX:-UseGCOverheadLimit
+ * gc.g1.unloading.UnloadingTest
+ * -keepRefMode STATIC_FIELD
+ * -inMemoryCompilation
+ * -keep object
+ * -numberOfChecksLimit 4
+ * -stressTime 180
+ */
+
diff --git a/test/hotspot/jtreg/vmTestbase/gc/g1/unloading/tests/unloading_keepRef_staticField_keep_cl/TEST.properties b/test/hotspot/jtreg/vmTestbase/gc/g1/unloading/tests/unloading_keepRef_staticField_keep_cl/TEST.properties
new file mode 100644
index 0000000..04b22a1
--- /dev/null
+++ b/test/hotspot/jtreg/vmTestbase/gc/g1/unloading/tests/unloading_keepRef_staticField_keep_cl/TEST.properties
@@ -0,0 +1,23 @@
+#
+# 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/g1/unloading/tests/unloading_keepRef_staticField_keep_cl/TestDescription.java b/test/hotspot/jtreg/vmTestbase/gc/g1/unloading/tests/unloading_keepRef_staticField_keep_cl/TestDescription.java
new file mode 100644
index 0000000..da593ce
--- /dev/null
+++ b/test/hotspot/jtreg/vmTestbase/gc/g1/unloading/tests/unloading_keepRef_staticField_keep_cl/TestDescription.java
@@ -0,0 +1,65 @@
+/*
+ * 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.
+ */
+
+
+/*
+ * @test
+ * @key stress gc
+ *
+ * @summary converted from VM Testbase gc/g1/unloading/tests/unloading_keepRef_staticField_keep_cl.
+ * VM Testbase keywords: [gc, stress, stressopt, nonconcurrent, javac]
+ *
+ * @modules java.base/jdk.internal.misc
+ * @library /vmTestbase
+ * /test/lib
+ *
+ * @run driver jdk.test.lib.FileInstaller . .
+ *
+ * @comment generate HumongousTemplateClass and compile it to test.classes
+ * @run driver gc.g1.unloading.bytecode.GenClassesBuilder
+ *
+ * @build sun.hotspot.WhiteBox
+ * @run driver ClassFileInstaller sun.hotspot.WhiteBox
+ * sun.hotspot.WhiteBox$WhiteBoxPermission
+ * @run main/othervm
+ * -Xbootclasspath/a:.
+ * -XX:+UnlockDiagnosticVMOptions
+ * -XX:+WhiteBoxAPI
+ * -XX:+UseG1GC
+ * -XX:+ExplicitGCInvokesConcurrent
+ * -Xbootclasspath/a:.
+ * -XX:+UnlockDiagnosticVMOptions
+ * -XX:+WhiteBoxAPI
+ * -XX:+UseG1GC
+ * -XX:+ExplicitGCInvokesConcurrent
+ * -Xlog:gc:gc.log
+ * -XX:-UseGCOverheadLimit
+ * -Xlog:gc:gc.log
+ * -XX:-UseGCOverheadLimit
+ * gc.g1.unloading.UnloadingTest
+ * -keepRefMode STATIC_FIELD
+ * -keep classloader
+ * -numberOfChecksLimit 4
+ * -stressTime 180
+ */
+
diff --git a/test/hotspot/jtreg/vmTestbase/gc/g1/unloading/tests/unloading_keepRef_staticField_keep_class/TEST.properties b/test/hotspot/jtreg/vmTestbase/gc/g1/unloading/tests/unloading_keepRef_staticField_keep_class/TEST.properties
new file mode 100644
index 0000000..04b22a1
--- /dev/null
+++ b/test/hotspot/jtreg/vmTestbase/gc/g1/unloading/tests/unloading_keepRef_staticField_keep_class/TEST.properties
@@ -0,0 +1,23 @@
+#
+# 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/g1/unloading/tests/unloading_keepRef_staticField_keep_class/TestDescription.java b/test/hotspot/jtreg/vmTestbase/gc/g1/unloading/tests/unloading_keepRef_staticField_keep_class/TestDescription.java
new file mode 100644
index 0000000..4828d11
--- /dev/null
+++ b/test/hotspot/jtreg/vmTestbase/gc/g1/unloading/tests/unloading_keepRef_staticField_keep_class/TestDescription.java
@@ -0,0 +1,65 @@
+/*
+ * 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.
+ */
+
+
+/*
+ * @test
+ * @key stress gc
+ *
+ * @summary converted from VM Testbase gc/g1/unloading/tests/unloading_keepRef_staticField_keep_class.
+ * VM Testbase keywords: [gc, stress, stressopt, nonconcurrent, javac]
+ *
+ * @modules java.base/jdk.internal.misc
+ * @library /vmTestbase
+ * /test/lib
+ *
+ * @run driver jdk.test.lib.FileInstaller . .
+ *
+ * @comment generate HumongousTemplateClass and compile it to test.classes
+ * @run driver gc.g1.unloading.bytecode.GenClassesBuilder
+ *
+ * @build sun.hotspot.WhiteBox
+ * @run driver ClassFileInstaller sun.hotspot.WhiteBox
+ * sun.hotspot.WhiteBox$WhiteBoxPermission
+ * @run main/othervm
+ * -Xbootclasspath/a:.
+ * -XX:+UnlockDiagnosticVMOptions
+ * -XX:+WhiteBoxAPI
+ * -XX:+UseG1GC
+ * -XX:+ExplicitGCInvokesConcurrent
+ * -Xbootclasspath/a:.
+ * -XX:+UnlockDiagnosticVMOptions
+ * -XX:+WhiteBoxAPI
+ * -XX:+UseG1GC
+ * -XX:+ExplicitGCInvokesConcurrent
+ * -Xlog:gc:gc.log
+ * -XX:-UseGCOverheadLimit
+ * -Xlog:gc:gc.log
+ * -XX:-UseGCOverheadLimit
+ * gc.g1.unloading.UnloadingTest
+ * -keepRefMode STATIC_FIELD
+ * -keep class
+ * -numberOfChecksLimit 4
+ * -stressTime 180
+ */
+
diff --git a/test/hotspot/jtreg/vmTestbase/gc/g1/unloading/tests/unloading_keepRef_staticField_keep_obj/TEST.properties b/test/hotspot/jtreg/vmTestbase/gc/g1/unloading/tests/unloading_keepRef_staticField_keep_obj/TEST.properties
new file mode 100644
index 0000000..04b22a1
--- /dev/null
+++ b/test/hotspot/jtreg/vmTestbase/gc/g1/unloading/tests/unloading_keepRef_staticField_keep_obj/TEST.properties
@@ -0,0 +1,23 @@
+#
+# 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/g1/unloading/tests/unloading_keepRef_staticField_keep_obj/TestDescription.java b/test/hotspot/jtreg/vmTestbase/gc/g1/unloading/tests/unloading_keepRef_staticField_keep_obj/TestDescription.java
new file mode 100644
index 0000000..110a41f
--- /dev/null
+++ b/test/hotspot/jtreg/vmTestbase/gc/g1/unloading/tests/unloading_keepRef_staticField_keep_obj/TestDescription.java
@@ -0,0 +1,65 @@
+/*
+ * 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.
+ */
+
+
+/*
+ * @test
+ * @key stress gc
+ *
+ * @summary converted from VM Testbase gc/g1/unloading/tests/unloading_keepRef_staticField_keep_obj.
+ * VM Testbase keywords: [gc, stress, stressopt, nonconcurrent, javac]
+ *
+ * @modules java.base/jdk.internal.misc
+ * @library /vmTestbase
+ * /test/lib
+ *
+ * @run driver jdk.test.lib.FileInstaller . .
+ *
+ * @comment generate HumongousTemplateClass and compile it to test.classes
+ * @run driver gc.g1.unloading.bytecode.GenClassesBuilder
+ *
+ * @build sun.hotspot.WhiteBox
+ * @run driver ClassFileInstaller sun.hotspot.WhiteBox
+ * sun.hotspot.WhiteBox$WhiteBoxPermission
+ * @run main/othervm
+ * -Xbootclasspath/a:.
+ * -XX:+UnlockDiagnosticVMOptions
+ * -XX:+WhiteBoxAPI
+ * -XX:+UseG1GC
+ * -XX:+ExplicitGCInvokesConcurrent
+ * -Xbootclasspath/a:.
+ * -XX:+UnlockDiagnosticVMOptions
+ * -XX:+WhiteBoxAPI
+ * -XX:+UseG1GC
+ * -XX:+ExplicitGCInvokesConcurrent
+ * -Xlog:gc:gc.log
+ * -XX:-UseGCOverheadLimit
+ * -Xlog:gc:gc.log
+ * -XX:-UseGCOverheadLimit
+ * gc.g1.unloading.UnloadingTest
+ * -keepRefMode STATIC_FIELD
+ * -keep object
+ * -numberOfChecksLimit 4
+ * -stressTime 180
+ */
+
diff --git a/test/hotspot/jtreg/vmTestbase/gc/g1/unloading/tests/unloading_keepRef_strongRef_inMemoryCompilation_keep_cl/TEST.properties b/test/hotspot/jtreg/vmTestbase/gc/g1/unloading/tests/unloading_keepRef_strongRef_inMemoryCompilation_keep_cl/TEST.properties
new file mode 100644
index 0000000..04b22a1
--- /dev/null
+++ b/test/hotspot/jtreg/vmTestbase/gc/g1/unloading/tests/unloading_keepRef_strongRef_inMemoryCompilation_keep_cl/TEST.properties
@@ -0,0 +1,23 @@
+#
+# 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/g1/unloading/tests/unloading_keepRef_strongRef_inMemoryCompilation_keep_cl/TestDescription.java b/test/hotspot/jtreg/vmTestbase/gc/g1/unloading/tests/unloading_keepRef_strongRef_inMemoryCompilation_keep_cl/TestDescription.java
new file mode 100644
index 0000000..2c8fba4
--- /dev/null
+++ b/test/hotspot/jtreg/vmTestbase/gc/g1/unloading/tests/unloading_keepRef_strongRef_inMemoryCompilation_keep_cl/TestDescription.java
@@ -0,0 +1,66 @@
+/*
+ * 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.
+ */
+
+
+/*
+ * @test
+ * @key stress gc
+ *
+ * @summary converted from VM Testbase gc/g1/unloading/tests/unloading_keepRef_strongRef_inMemoryCompilation_keep_cl.
+ * VM Testbase keywords: [gc, stress, stressopt, nonconcurrent, javac]
+ *
+ * @modules java.base/jdk.internal.misc
+ * @library /vmTestbase
+ * /test/lib
+ *
+ * @run driver jdk.test.lib.FileInstaller . .
+ *
+ * @comment generate HumongousTemplateClass and compile it to test.classes
+ * @run driver gc.g1.unloading.bytecode.GenClassesBuilder
+ *
+ * @build sun.hotspot.WhiteBox
+ * @run driver ClassFileInstaller sun.hotspot.WhiteBox
+ * sun.hotspot.WhiteBox$WhiteBoxPermission
+ * @run main/othervm
+ * -Xbootclasspath/a:.
+ * -XX:+UnlockDiagnosticVMOptions
+ * -XX:+WhiteBoxAPI
+ * -XX:+UseG1GC
+ * -XX:+ExplicitGCInvokesConcurrent
+ * -Xbootclasspath/a:.
+ * -XX:+UnlockDiagnosticVMOptions
+ * -XX:+WhiteBoxAPI
+ * -XX:+UseG1GC
+ * -XX:+ExplicitGCInvokesConcurrent
+ * -Xlog:gc:gc.log
+ * -XX:-UseGCOverheadLimit
+ * -Xlog:gc:gc.log
+ * -XX:-UseGCOverheadLimit
+ * gc.g1.unloading.UnloadingTest
+ * -keepRefMode STRONG_REFERENCE
+ * -inMemoryCompilation
+ * -keep classloader
+ * -numberOfChecksLimit 4
+ * -stressTime 180
+ */
+
diff --git a/test/hotspot/jtreg/vmTestbase/gc/g1/unloading/tests/unloading_keepRef_strongRef_inMemoryCompilation_keep_class/TEST.properties b/test/hotspot/jtreg/vmTestbase/gc/g1/unloading/tests/unloading_keepRef_strongRef_inMemoryCompilation_keep_class/TEST.properties
new file mode 100644
index 0000000..04b22a1
--- /dev/null
+++ b/test/hotspot/jtreg/vmTestbase/gc/g1/unloading/tests/unloading_keepRef_strongRef_inMemoryCompilation_keep_class/TEST.properties
@@ -0,0 +1,23 @@
+#
+# 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/g1/unloading/tests/unloading_keepRef_strongRef_inMemoryCompilation_keep_class/TestDescription.java b/test/hotspot/jtreg/vmTestbase/gc/g1/unloading/tests/unloading_keepRef_strongRef_inMemoryCompilation_keep_class/TestDescription.java
new file mode 100644
index 0000000..dc82f52
--- /dev/null
+++ b/test/hotspot/jtreg/vmTestbase/gc/g1/unloading/tests/unloading_keepRef_strongRef_inMemoryCompilation_keep_class/TestDescription.java
@@ -0,0 +1,66 @@
+/*
+ * 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.
+ */
+
+
+/*
+ * @test
+ * @key stress gc
+ *
+ * @summary converted from VM Testbase gc/g1/unloading/tests/unloading_keepRef_strongRef_inMemoryCompilation_keep_class.
+ * VM Testbase keywords: [gc, stress, stressopt, nonconcurrent, javac]
+ *
+ * @modules java.base/jdk.internal.misc
+ * @library /vmTestbase
+ * /test/lib
+ *
+ * @run driver jdk.test.lib.FileInstaller . .
+ *
+ * @comment generate HumongousTemplateClass and compile it to test.classes
+ * @run driver gc.g1.unloading.bytecode.GenClassesBuilder
+ *
+ * @build sun.hotspot.WhiteBox
+ * @run driver ClassFileInstaller sun.hotspot.WhiteBox
+ * sun.hotspot.WhiteBox$WhiteBoxPermission
+ * @run main/othervm
+ * -Xbootclasspath/a:.
+ * -XX:+UnlockDiagnosticVMOptions
+ * -XX:+WhiteBoxAPI
+ * -XX:+UseG1GC
+ * -XX:+ExplicitGCInvokesConcurrent
+ * -Xbootclasspath/a:.
+ * -XX:+UnlockDiagnosticVMOptions
+ * -XX:+WhiteBoxAPI
+ * -XX:+UseG1GC
+ * -XX:+ExplicitGCInvokesConcurrent
+ * -Xlog:gc:gc.log
+ * -XX:-UseGCOverheadLimit
+ * -Xlog:gc:gc.log
+ * -XX:-UseGCOverheadLimit
+ * gc.g1.unloading.UnloadingTest
+ * -keepRefMode STRONG_REFERENCE
+ * -inMemoryCompilation
+ * -keep class
+ * -numberOfChecksLimit 4
+ * -stressTime 180
+ */
+
diff --git a/test/hotspot/jtreg/vmTestbase/gc/g1/unloading/tests/unloading_keepRef_strongRef_inMemoryCompilation_keep_obj/TEST.properties b/test/hotspot/jtreg/vmTestbase/gc/g1/unloading/tests/unloading_keepRef_strongRef_inMemoryCompilation_keep_obj/TEST.properties
new file mode 100644
index 0000000..04b22a1
--- /dev/null
+++ b/test/hotspot/jtreg/vmTestbase/gc/g1/unloading/tests/unloading_keepRef_strongRef_inMemoryCompilation_keep_obj/TEST.properties
@@ -0,0 +1,23 @@
+#
+# 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/g1/unloading/tests/unloading_keepRef_strongRef_inMemoryCompilation_keep_obj/TestDescription.java b/test/hotspot/jtreg/vmTestbase/gc/g1/unloading/tests/unloading_keepRef_strongRef_inMemoryCompilation_keep_obj/TestDescription.java
new file mode 100644
index 0000000..0f5d703
--- /dev/null
+++ b/test/hotspot/jtreg/vmTestbase/gc/g1/unloading/tests/unloading_keepRef_strongRef_inMemoryCompilation_keep_obj/TestDescription.java
@@ -0,0 +1,66 @@
+/*
+ * 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.
+ */
+
+
+/*
+ * @test
+ * @key stress gc
+ *
+ * @summary converted from VM Testbase gc/g1/unloading/tests/unloading_keepRef_strongRef_inMemoryCompilation_keep_obj.
+ * VM Testbase keywords: [gc, stress, stressopt, nonconcurrent, javac]
+ *
+ * @modules java.base/jdk.internal.misc
+ * @library /vmTestbase
+ * /test/lib
+ *
+ * @run driver jdk.test.lib.FileInstaller . .
+ *
+ * @comment generate HumongousTemplateClass and compile it to test.classes
+ * @run driver gc.g1.unloading.bytecode.GenClassesBuilder
+ *
+ * @build sun.hotspot.WhiteBox
+ * @run driver ClassFileInstaller sun.hotspot.WhiteBox
+ * sun.hotspot.WhiteBox$WhiteBoxPermission
+ * @run main/othervm
+ * -Xbootclasspath/a:.
+ * -XX:+UnlockDiagnosticVMOptions
+ * -XX:+WhiteBoxAPI
+ * -XX:+UseG1GC
+ * -XX:+ExplicitGCInvokesConcurrent
+ * -Xbootclasspath/a:.
+ * -XX:+UnlockDiagnosticVMOptions
+ * -XX:+WhiteBoxAPI
+ * -XX:+UseG1GC
+ * -XX:+ExplicitGCInvokesConcurrent
+ * -Xlog:gc:gc.log
+ * -XX:-UseGCOverheadLimit
+ * -Xlog:gc:gc.log
+ * -XX:-UseGCOverheadLimit
+ * gc.g1.unloading.UnloadingTest
+ * -keepRefMode STRONG_REFERENCE
+ * -inMemoryCompilation
+ * -keep object
+ * -numberOfChecksLimit 4
+ * -stressTime 180
+ */
+
diff --git a/test/hotspot/jtreg/vmTestbase/gc/g1/unloading/tests/unloading_keepRef_strongRef_keep_cl/TEST.properties b/test/hotspot/jtreg/vmTestbase/gc/g1/unloading/tests/unloading_keepRef_strongRef_keep_cl/TEST.properties
new file mode 100644
index 0000000..04b22a1
--- /dev/null
+++ b/test/hotspot/jtreg/vmTestbase/gc/g1/unloading/tests/unloading_keepRef_strongRef_keep_cl/TEST.properties
@@ -0,0 +1,23 @@
+#
+# 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/g1/unloading/tests/unloading_keepRef_strongRef_keep_cl/TestDescription.java b/test/hotspot/jtreg/vmTestbase/gc/g1/unloading/tests/unloading_keepRef_strongRef_keep_cl/TestDescription.java
new file mode 100644
index 0000000..58fd37e
--- /dev/null
+++ b/test/hotspot/jtreg/vmTestbase/gc/g1/unloading/tests/unloading_keepRef_strongRef_keep_cl/TestDescription.java
@@ -0,0 +1,65 @@
+/*
+ * 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.
+ */
+
+
+/*
+ * @test
+ * @key stress gc
+ *
+ * @summary converted from VM Testbase gc/g1/unloading/tests/unloading_keepRef_strongRef_keep_cl.
+ * VM Testbase keywords: [gc, stress, stressopt, nonconcurrent, javac]
+ *
+ * @modules java.base/jdk.internal.misc
+ * @library /vmTestbase
+ * /test/lib
+ *
+ * @run driver jdk.test.lib.FileInstaller . .
+ *
+ * @comment generate HumongousTemplateClass and compile it to test.classes
+ * @run driver gc.g1.unloading.bytecode.GenClassesBuilder
+ *
+ * @build sun.hotspot.WhiteBox
+ * @run driver ClassFileInstaller sun.hotspot.WhiteBox
+ * sun.hotspot.WhiteBox$WhiteBoxPermission
+ * @run main/othervm
+ * -Xbootclasspath/a:.
+ * -XX:+UnlockDiagnosticVMOptions
+ * -XX:+WhiteBoxAPI
+ * -XX:+UseG1GC
+ * -XX:+ExplicitGCInvokesConcurrent
+ * -Xbootclasspath/a:.
+ * -XX:+UnlockDiagnosticVMOptions
+ * -XX:+WhiteBoxAPI
+ * -XX:+UseG1GC
+ * -XX:+ExplicitGCInvokesConcurrent
+ * -Xlog:gc:gc.log
+ * -XX:-UseGCOverheadLimit
+ * -Xlog:gc:gc.log
+ * -XX:-UseGCOverheadLimit
+ * gc.g1.unloading.UnloadingTest
+ * -keepRefMode STRONG_REFERENCE
+ * -keep classloader
+ * -numberOfChecksLimit 4
+ * -stressTime 180
+ */
+
diff --git a/test/hotspot/jtreg/vmTestbase/gc/g1/unloading/tests/unloading_keepRef_strongRef_keep_class/TEST.properties b/test/hotspot/jtreg/vmTestbase/gc/g1/unloading/tests/unloading_keepRef_strongRef_keep_class/TEST.properties
new file mode 100644
index 0000000..04b22a1
--- /dev/null
+++ b/test/hotspot/jtreg/vmTestbase/gc/g1/unloading/tests/unloading_keepRef_strongRef_keep_class/TEST.properties
@@ -0,0 +1,23 @@
+#
+# 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/g1/unloading/tests/unloading_keepRef_strongRef_keep_class/TestDescription.java b/test/hotspot/jtreg/vmTestbase/gc/g1/unloading/tests/unloading_keepRef_strongRef_keep_class/TestDescription.java
new file mode 100644
index 0000000..5f077ea
--- /dev/null
+++ b/test/hotspot/jtreg/vmTestbase/gc/g1/unloading/tests/unloading_keepRef_strongRef_keep_class/TestDescription.java
@@ -0,0 +1,65 @@
+/*
+ * 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.
+ */
+
+
+/*
+ * @test
+ * @key stress gc
+ *
+ * @summary converted from VM Testbase gc/g1/unloading/tests/unloading_keepRef_strongRef_keep_class.
+ * VM Testbase keywords: [gc, stress, stressopt, nonconcurrent, javac]
+ *
+ * @modules java.base/jdk.internal.misc
+ * @library /vmTestbase
+ * /test/lib
+ *
+ * @run driver jdk.test.lib.FileInstaller . .
+ *
+ * @comment generate HumongousTemplateClass and compile it to test.classes
+ * @run driver gc.g1.unloading.bytecode.GenClassesBuilder
+ *
+ * @build sun.hotspot.WhiteBox
+ * @run driver ClassFileInstaller sun.hotspot.WhiteBox
+ * sun.hotspot.WhiteBox$WhiteBoxPermission
+ * @run main/othervm
+ * -Xbootclasspath/a:.
+ * -XX:+UnlockDiagnosticVMOptions
+ * -XX:+WhiteBoxAPI
+ * -XX:+UseG1GC
+ * -XX:+ExplicitGCInvokesConcurrent
+ * -Xbootclasspath/a:.
+ * -XX:+UnlockDiagnosticVMOptions
+ * -XX:+WhiteBoxAPI
+ * -XX:+UseG1GC
+ * -XX:+ExplicitGCInvokesConcurrent
+ * -Xlog:gc:gc.log
+ * -XX:-UseGCOverheadLimit
+ * -Xlog:gc:gc.log
+ * -XX:-UseGCOverheadLimit
+ * gc.g1.unloading.UnloadingTest
+ * -keepRefMode STRONG_REFERENCE
+ * -keep class
+ * -numberOfChecksLimit 4
+ * -stressTime 180
+ */
+
diff --git a/test/hotspot/jtreg/vmTestbase/gc/g1/unloading/tests/unloading_keepRef_strongRef_keep_obj/TEST.properties b/test/hotspot/jtreg/vmTestbase/gc/g1/unloading/tests/unloading_keepRef_strongRef_keep_obj/TEST.properties
new file mode 100644
index 0000000..04b22a1
--- /dev/null
+++ b/test/hotspot/jtreg/vmTestbase/gc/g1/unloading/tests/unloading_keepRef_strongRef_keep_obj/TEST.properties
@@ -0,0 +1,23 @@
+#
+# 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/g1/unloading/tests/unloading_keepRef_strongRef_keep_obj/TestDescription.java b/test/hotspot/jtreg/vmTestbase/gc/g1/unloading/tests/unloading_keepRef_strongRef_keep_obj/TestDescription.java
new file mode 100644
index 0000000..00d42c1
--- /dev/null
+++ b/test/hotspot/jtreg/vmTestbase/gc/g1/unloading/tests/unloading_keepRef_strongRef_keep_obj/TestDescription.java
@@ -0,0 +1,65 @@
+/*
+ * 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.
+ */
+
+
+/*
+ * @test
+ * @key stress gc
+ *
+ * @summary converted from VM Testbase gc/g1/unloading/tests/unloading_keepRef_strongRef_keep_obj.
+ * VM Testbase keywords: [gc, stress, stressopt, nonconcurrent, javac]
+ *
+ * @modules java.base/jdk.internal.misc
+ * @library /vmTestbase
+ * /test/lib
+ *
+ * @run driver jdk.test.lib.FileInstaller . .
+ *
+ * @comment generate HumongousTemplateClass and compile it to test.classes
+ * @run driver gc.g1.unloading.bytecode.GenClassesBuilder
+ *
+ * @build sun.hotspot.WhiteBox
+ * @run driver ClassFileInstaller sun.hotspot.WhiteBox
+ * sun.hotspot.WhiteBox$WhiteBoxPermission
+ * @run main/othervm
+ * -Xbootclasspath/a:.
+ * -XX:+UnlockDiagnosticVMOptions
+ * -XX:+WhiteBoxAPI
+ * -XX:+UseG1GC
+ * -XX:+ExplicitGCInvokesConcurrent
+ * -Xbootclasspath/a:.
+ * -XX:+UnlockDiagnosticVMOptions
+ * -XX:+WhiteBoxAPI
+ * -XX:+UseG1GC
+ * -XX:+ExplicitGCInvokesConcurrent
+ * -Xlog:gc:gc.log
+ * -XX:-UseGCOverheadLimit
+ * -Xlog:gc:gc.log
+ * -XX:-UseGCOverheadLimit
+ * gc.g1.unloading.UnloadingTest
+ * -keepRefMode STRONG_REFERENCE
+ * -keep object
+ * -numberOfChecksLimit 4
+ * -stressTime 180
+ */
+
diff --git a/test/hotspot/jtreg/vmTestbase/gc/g1/unloading/tests/unloading_keepRef_threadItself_inMemoryCompilation_keep_cl/TEST.properties b/test/hotspot/jtreg/vmTestbase/gc/g1/unloading/tests/unloading_keepRef_threadItself_inMemoryCompilation_keep_cl/TEST.properties
new file mode 100644
index 0000000..04b22a1
--- /dev/null
+++ b/test/hotspot/jtreg/vmTestbase/gc/g1/unloading/tests/unloading_keepRef_threadItself_inMemoryCompilation_keep_cl/TEST.properties
@@ -0,0 +1,23 @@
+#
+# 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/g1/unloading/tests/unloading_keepRef_threadItself_inMemoryCompilation_keep_cl/TestDescription.java b/test/hotspot/jtreg/vmTestbase/gc/g1/unloading/tests/unloading_keepRef_threadItself_inMemoryCompilation_keep_cl/TestDescription.java
new file mode 100644
index 0000000..78d800f
--- /dev/null
+++ b/test/hotspot/jtreg/vmTestbase/gc/g1/unloading/tests/unloading_keepRef_threadItself_inMemoryCompilation_keep_cl/TestDescription.java
@@ -0,0 +1,66 @@
+/*
+ * 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.
+ */
+
+
+/*
+ * @test
+ * @key stress gc
+ *
+ * @summary converted from VM Testbase gc/g1/unloading/tests/unloading_keepRef_threadItself_inMemoryCompilation_keep_cl.
+ * VM Testbase keywords: [gc, stress, stressopt, nonconcurrent, javac]
+ *
+ * @modules java.base/jdk.internal.misc
+ * @library /vmTestbase
+ * /test/lib
+ *
+ * @run driver jdk.test.lib.FileInstaller . .
+ *
+ * @comment generate HumongousTemplateClass and compile it to test.classes
+ * @run driver gc.g1.unloading.bytecode.GenClassesBuilder
+ *
+ * @build sun.hotspot.WhiteBox
+ * @run driver ClassFileInstaller sun.hotspot.WhiteBox
+ * sun.hotspot.WhiteBox$WhiteBoxPermission
+ * @run main/othervm
+ * -Xbootclasspath/a:.
+ * -XX:+UnlockDiagnosticVMOptions
+ * -XX:+WhiteBoxAPI
+ * -XX:+UseG1GC
+ * -XX:+ExplicitGCInvokesConcurrent
+ * -Xbootclasspath/a:.
+ * -XX:+UnlockDiagnosticVMOptions
+ * -XX:+WhiteBoxAPI
+ * -XX:+UseG1GC
+ * -XX:+ExplicitGCInvokesConcurrent
+ * -Xlog:gc:gc.log
+ * -XX:-UseGCOverheadLimit
+ * -Xlog:gc:gc.log
+ * -XX:-UseGCOverheadLimit
+ * gc.g1.unloading.UnloadingTest
+ * -keepRefMode THREAD_ITSELF
+ * -inMemoryCompilation
+ * -keep classloader
+ * -numberOfChecksLimit 4
+ * -stressTime 180
+ */
+
diff --git a/test/hotspot/jtreg/vmTestbase/gc/g1/unloading/tests/unloading_keepRef_threadItself_inMemoryCompilation_keep_class/TEST.properties b/test/hotspot/jtreg/vmTestbase/gc/g1/unloading/tests/unloading_keepRef_threadItself_inMemoryCompilation_keep_class/TEST.properties
new file mode 100644
index 0000000..04b22a1
--- /dev/null
+++ b/test/hotspot/jtreg/vmTestbase/gc/g1/unloading/tests/unloading_keepRef_threadItself_inMemoryCompilation_keep_class/TEST.properties
@@ -0,0 +1,23 @@
+#
+# 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/g1/unloading/tests/unloading_keepRef_threadItself_inMemoryCompilation_keep_class/TestDescription.java b/test/hotspot/jtreg/vmTestbase/gc/g1/unloading/tests/unloading_keepRef_threadItself_inMemoryCompilation_keep_class/TestDescription.java
new file mode 100644
index 0000000..707235e
--- /dev/null
+++ b/test/hotspot/jtreg/vmTestbase/gc/g1/unloading/tests/unloading_keepRef_threadItself_inMemoryCompilation_keep_class/TestDescription.java
@@ -0,0 +1,66 @@
+/*
+ * 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.
+ */
+
+
+/*
+ * @test
+ * @key stress gc
+ *
+ * @summary converted from VM Testbase gc/g1/unloading/tests/unloading_keepRef_threadItself_inMemoryCompilation_keep_class.
+ * VM Testbase keywords: [gc, stress, stressopt, nonconcurrent, javac]
+ *
+ * @modules java.base/jdk.internal.misc
+ * @library /vmTestbase
+ * /test/lib
+ *
+ * @run driver jdk.test.lib.FileInstaller . .
+ *
+ * @comment generate HumongousTemplateClass and compile it to test.classes
+ * @run driver gc.g1.unloading.bytecode.GenClassesBuilder
+ *
+ * @build sun.hotspot.WhiteBox
+ * @run driver ClassFileInstaller sun.hotspot.WhiteBox
+ * sun.hotspot.WhiteBox$WhiteBoxPermission
+ * @run main/othervm
+ * -Xbootclasspath/a:.
+ * -XX:+UnlockDiagnosticVMOptions
+ * -XX:+WhiteBoxAPI
+ * -XX:+UseG1GC
+ * -XX:+ExplicitGCInvokesConcurrent
+ * -Xbootclasspath/a:.
+ * -XX:+UnlockDiagnosticVMOptions
+ * -XX:+WhiteBoxAPI
+ * -XX:+UseG1GC
+ * -XX:+ExplicitGCInvokesConcurrent
+ * -Xlog:gc:gc.log
+ * -XX:-UseGCOverheadLimit
+ * -Xlog:gc:gc.log
+ * -XX:-UseGCOverheadLimit
+ * gc.g1.unloading.UnloadingTest
+ * -keepRefMode THREAD_ITSELF
+ * -inMemoryCompilation
+ * -keep class
+ * -numberOfChecksLimit 4
+ * -stressTime 180
+ */
+
diff --git a/test/hotspot/jtreg/vmTestbase/gc/g1/unloading/tests/unloading_keepRef_threadItself_inMemoryCompilation_keep_obj/TEST.properties b/test/hotspot/jtreg/vmTestbase/gc/g1/unloading/tests/unloading_keepRef_threadItself_inMemoryCompilation_keep_obj/TEST.properties
new file mode 100644
index 0000000..04b22a1
--- /dev/null
+++ b/test/hotspot/jtreg/vmTestbase/gc/g1/unloading/tests/unloading_keepRef_threadItself_inMemoryCompilation_keep_obj/TEST.properties
@@ -0,0 +1,23 @@
+#
+# 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/g1/unloading/tests/unloading_keepRef_threadItself_inMemoryCompilation_keep_obj/TestDescription.java b/test/hotspot/jtreg/vmTestbase/gc/g1/unloading/tests/unloading_keepRef_threadItself_inMemoryCompilation_keep_obj/TestDescription.java
new file mode 100644
index 0000000..cb7220f
--- /dev/null
+++ b/test/hotspot/jtreg/vmTestbase/gc/g1/unloading/tests/unloading_keepRef_threadItself_inMemoryCompilation_keep_obj/TestDescription.java
@@ -0,0 +1,66 @@
+/*
+ * 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.
+ */
+
+
+/*
+ * @test
+ * @key stress gc
+ *
+ * @summary converted from VM Testbase gc/g1/unloading/tests/unloading_keepRef_threadItself_inMemoryCompilation_keep_obj.
+ * VM Testbase keywords: [gc, stress, stressopt, nonconcurrent, javac]
+ *
+ * @modules java.base/jdk.internal.misc
+ * @library /vmTestbase
+ * /test/lib
+ *
+ * @run driver jdk.test.lib.FileInstaller . .
+ *
+ * @comment generate HumongousTemplateClass and compile it to test.classes
+ * @run driver gc.g1.unloading.bytecode.GenClassesBuilder
+ *
+ * @build sun.hotspot.WhiteBox
+ * @run driver ClassFileInstaller sun.hotspot.WhiteBox
+ * sun.hotspot.WhiteBox$WhiteBoxPermission
+ * @run main/othervm
+ * -Xbootclasspath/a:.
+ * -XX:+UnlockDiagnosticVMOptions
+ * -XX:+WhiteBoxAPI
+ * -XX:+UseG1GC
+ * -XX:+ExplicitGCInvokesConcurrent
+ * -Xbootclasspath/a:.
+ * -XX:+UnlockDiagnosticVMOptions
+ * -XX:+WhiteBoxAPI
+ * -XX:+UseG1GC
+ * -XX:+ExplicitGCInvokesConcurrent
+ * -Xlog:gc:gc.log
+ * -XX:-UseGCOverheadLimit
+ * -Xlog:gc:gc.log
+ * -XX:-UseGCOverheadLimit
+ * gc.g1.unloading.UnloadingTest
+ * -keepRefMode THREAD_ITSELF
+ * -inMemoryCompilation
+ * -keep object
+ * -numberOfChecksLimit 4
+ * -stressTime 180
+ */
+
diff --git a/test/hotspot/jtreg/vmTestbase/gc/g1/unloading/tests/unloading_keepRef_threadItself_keep_cl/TEST.properties b/test/hotspot/jtreg/vmTestbase/gc/g1/unloading/tests/unloading_keepRef_threadItself_keep_cl/TEST.properties
new file mode 100644
index 0000000..04b22a1
--- /dev/null
+++ b/test/hotspot/jtreg/vmTestbase/gc/g1/unloading/tests/unloading_keepRef_threadItself_keep_cl/TEST.properties
@@ -0,0 +1,23 @@
+#
+# 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/g1/unloading/tests/unloading_keepRef_threadItself_keep_cl/TestDescription.java b/test/hotspot/jtreg/vmTestbase/gc/g1/unloading/tests/unloading_keepRef_threadItself_keep_cl/TestDescription.java
new file mode 100644
index 0000000..05d7a83
--- /dev/null
+++ b/test/hotspot/jtreg/vmTestbase/gc/g1/unloading/tests/unloading_keepRef_threadItself_keep_cl/TestDescription.java
@@ -0,0 +1,65 @@
+/*
+ * 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.
+ */
+
+
+/*
+ * @test
+ * @key stress gc
+ *
+ * @summary converted from VM Testbase gc/g1/unloading/tests/unloading_keepRef_threadItself_keep_cl.
+ * VM Testbase keywords: [gc, stress, stressopt, nonconcurrent, javac]
+ *
+ * @modules java.base/jdk.internal.misc
+ * @library /vmTestbase
+ * /test/lib
+ *
+ * @run driver jdk.test.lib.FileInstaller . .
+ *
+ * @comment generate HumongousTemplateClass and compile it to test.classes
+ * @run driver gc.g1.unloading.bytecode.GenClassesBuilder
+ *
+ * @build sun.hotspot.WhiteBox
+ * @run driver ClassFileInstaller sun.hotspot.WhiteBox
+ * sun.hotspot.WhiteBox$WhiteBoxPermission
+ * @run main/othervm
+ * -Xbootclasspath/a:.
+ * -XX:+UnlockDiagnosticVMOptions
+ * -XX:+WhiteBoxAPI
+ * -XX:+UseG1GC
+ * -XX:+ExplicitGCInvokesConcurrent
+ * -Xbootclasspath/a:.
+ * -XX:+UnlockDiagnosticVMOptions
+ * -XX:+WhiteBoxAPI
+ * -XX:+UseG1GC
+ * -XX:+ExplicitGCInvokesConcurrent
+ * -Xlog:gc:gc.log
+ * -XX:-UseGCOverheadLimit
+ * -Xlog:gc:gc.log
+ * -XX:-UseGCOverheadLimit
+ * gc.g1.unloading.UnloadingTest
+ * -keepRefMode THREAD_ITSELF
+ * -keep classloader
+ * -numberOfChecksLimit 4
+ * -stressTime 180
+ */
+
diff --git a/test/hotspot/jtreg/vmTestbase/gc/g1/unloading/tests/unloading_keepRef_threadItself_keep_class/TEST.properties b/test/hotspot/jtreg/vmTestbase/gc/g1/unloading/tests/unloading_keepRef_threadItself_keep_class/TEST.properties
new file mode 100644
index 0000000..04b22a1
--- /dev/null
+++ b/test/hotspot/jtreg/vmTestbase/gc/g1/unloading/tests/unloading_keepRef_threadItself_keep_class/TEST.properties
@@ -0,0 +1,23 @@
+#
+# 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/g1/unloading/tests/unloading_keepRef_threadItself_keep_class/TestDescription.java b/test/hotspot/jtreg/vmTestbase/gc/g1/unloading/tests/unloading_keepRef_threadItself_keep_class/TestDescription.java
new file mode 100644
index 0000000..585fff9
--- /dev/null
+++ b/test/hotspot/jtreg/vmTestbase/gc/g1/unloading/tests/unloading_keepRef_threadItself_keep_class/TestDescription.java
@@ -0,0 +1,65 @@
+/*
+ * 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.
+ */
+
+
+/*
+ * @test
+ * @key stress gc
+ *
+ * @summary converted from VM Testbase gc/g1/unloading/tests/unloading_keepRef_threadItself_keep_class.
+ * VM Testbase keywords: [gc, stress, stressopt, nonconcurrent, javac]
+ *
+ * @modules java.base/jdk.internal.misc
+ * @library /vmTestbase
+ * /test/lib
+ *
+ * @run driver jdk.test.lib.FileInstaller . .
+ *
+ * @comment generate HumongousTemplateClass and compile it to test.classes
+ * @run driver gc.g1.unloading.bytecode.GenClassesBuilder
+ *
+ * @build sun.hotspot.WhiteBox
+ * @run driver ClassFileInstaller sun.hotspot.WhiteBox
+ * sun.hotspot.WhiteBox$WhiteBoxPermission
+ * @run main/othervm
+ * -Xbootclasspath/a:.
+ * -XX:+UnlockDiagnosticVMOptions
+ * -XX:+WhiteBoxAPI
+ * -XX:+UseG1GC
+ * -XX:+ExplicitGCInvokesConcurrent
+ * -Xbootclasspath/a:.
+ * -XX:+UnlockDiagnosticVMOptions
+ * -XX:+WhiteBoxAPI
+ * -XX:+UseG1GC
+ * -XX:+ExplicitGCInvokesConcurrent
+ * -Xlog:gc:gc.log
+ * -XX:-UseGCOverheadLimit
+ * -Xlog:gc:gc.log
+ * -XX:-UseGCOverheadLimit
+ * gc.g1.unloading.UnloadingTest
+ * -keepRefMode THREAD_ITSELF
+ * -keep class
+ * -numberOfChecksLimit 4
+ * -stressTime 180
+ */
+
diff --git a/test/hotspot/jtreg/vmTestbase/gc/g1/unloading/tests/unloading_keepRef_threadItself_keep_obj/TEST.properties b/test/hotspot/jtreg/vmTestbase/gc/g1/unloading/tests/unloading_keepRef_threadItself_keep_obj/TEST.properties
new file mode 100644
index 0000000..04b22a1
--- /dev/null
+++ b/test/hotspot/jtreg/vmTestbase/gc/g1/unloading/tests/unloading_keepRef_threadItself_keep_obj/TEST.properties
@@ -0,0 +1,23 @@
+#
+# 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/g1/unloading/tests/unloading_keepRef_threadItself_keep_obj/TestDescription.java b/test/hotspot/jtreg/vmTestbase/gc/g1/unloading/tests/unloading_keepRef_threadItself_keep_obj/TestDescription.java
new file mode 100644
index 0000000..1fd2538
--- /dev/null
+++ b/test/hotspot/jtreg/vmTestbase/gc/g1/unloading/tests/unloading_keepRef_threadItself_keep_obj/TestDescription.java
@@ -0,0 +1,65 @@
+/*
+ * 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.
+ */
+
+
+/*
+ * @test
+ * @key stress gc
+ *
+ * @summary converted from VM Testbase gc/g1/unloading/tests/unloading_keepRef_threadItself_keep_obj.
+ * VM Testbase keywords: [gc, stress, stressopt, nonconcurrent, javac]
+ *
+ * @modules java.base/jdk.internal.misc
+ * @library /vmTestbase
+ * /test/lib
+ *
+ * @run driver jdk.test.lib.FileInstaller . .
+ *
+ * @comment generate HumongousTemplateClass and compile it to test.classes
+ * @run driver gc.g1.unloading.bytecode.GenClassesBuilder
+ *
+ * @build sun.hotspot.WhiteBox
+ * @run driver ClassFileInstaller sun.hotspot.WhiteBox
+ * sun.hotspot.WhiteBox$WhiteBoxPermission
+ * @run main/othervm
+ * -Xbootclasspath/a:.
+ * -XX:+UnlockDiagnosticVMOptions
+ * -XX:+WhiteBoxAPI
+ * -XX:+UseG1GC
+ * -XX:+ExplicitGCInvokesConcurrent
+ * -Xbootclasspath/a:.
+ * -XX:+UnlockDiagnosticVMOptions
+ * -XX:+WhiteBoxAPI
+ * -XX:+UseG1GC
+ * -XX:+ExplicitGCInvokesConcurrent
+ * -Xlog:gc:gc.log
+ * -XX:-UseGCOverheadLimit
+ * -Xlog:gc:gc.log
+ * -XX:-UseGCOverheadLimit
+ * gc.g1.unloading.UnloadingTest
+ * -keepRefMode THREAD_ITSELF
+ * -keep object
+ * -numberOfChecksLimit 4
+ * -stressTime 180
+ */
+
diff --git a/test/hotspot/jtreg/vmTestbase/gc/g1/unloading/tests/unloading_phantom_ref_inMemoryCompilation_keep_cl/TEST.properties b/test/hotspot/jtreg/vmTestbase/gc/g1/unloading/tests/unloading_phantom_ref_inMemoryCompilation_keep_cl/TEST.properties
new file mode 100644
index 0000000..04b22a1
--- /dev/null
+++ b/test/hotspot/jtreg/vmTestbase/gc/g1/unloading/tests/unloading_phantom_ref_inMemoryCompilation_keep_cl/TEST.properties
@@ -0,0 +1,23 @@
+#
+# 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/g1/unloading/tests/unloading_phantom_ref_inMemoryCompilation_keep_cl/TestDescription.java b/test/hotspot/jtreg/vmTestbase/gc/g1/unloading/tests/unloading_phantom_ref_inMemoryCompilation_keep_cl/TestDescription.java
new file mode 100644
index 0000000..976861a
--- /dev/null
+++ b/test/hotspot/jtreg/vmTestbase/gc/g1/unloading/tests/unloading_phantom_ref_inMemoryCompilation_keep_cl/TestDescription.java
@@ -0,0 +1,66 @@
+/*
+ * 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.
+ */
+
+
+/*
+ * @test
+ * @key stress gc
+ *
+ * @summary converted from VM Testbase gc/g1/unloading/tests/unloading_phantom_ref_inMemoryCompilation_keep_cl.
+ * VM Testbase keywords: [gc, stress, stressopt, nonconcurrent, javac]
+ *
+ * @modules java.base/jdk.internal.misc
+ * @library /vmTestbase
+ * /test/lib
+ *
+ * @run driver jdk.test.lib.FileInstaller . .
+ *
+ * @comment generate HumongousTemplateClass and compile it to test.classes
+ * @run driver gc.g1.unloading.bytecode.GenClassesBuilder
+ *
+ * @build sun.hotspot.WhiteBox
+ * @run driver ClassFileInstaller sun.hotspot.WhiteBox
+ * sun.hotspot.WhiteBox$WhiteBoxPermission
+ * @run main/othervm
+ * -Xbootclasspath/a:.
+ * -XX:+UnlockDiagnosticVMOptions
+ * -XX:+WhiteBoxAPI
+ * -XX:+UseG1GC
+ * -XX:+ExplicitGCInvokesConcurrent
+ * -Xbootclasspath/a:.
+ * -XX:+UnlockDiagnosticVMOptions
+ * -XX:+WhiteBoxAPI
+ * -XX:+UseG1GC
+ * -XX:+ExplicitGCInvokesConcurrent
+ * -Xlog:gc:gc.log
+ * -XX:-UseGCOverheadLimit
+ * -Xlog:gc:gc.log
+ * -XX:-UseGCOverheadLimit
+ * gc.g1.unloading.UnloadingTest
+ * -referenceMode phantom
+ * -inMemoryCompilation
+ * -keep classloader
+ * -numberOfChecksLimit 4
+ * -stressTime 180
+ */
+
diff --git a/test/hotspot/jtreg/vmTestbase/gc/g1/unloading/tests/unloading_phantom_ref_inMemoryCompilation_keep_class/TEST.properties b/test/hotspot/jtreg/vmTestbase/gc/g1/unloading/tests/unloading_phantom_ref_inMemoryCompilation_keep_class/TEST.properties
new file mode 100644
index 0000000..04b22a1
--- /dev/null
+++ b/test/hotspot/jtreg/vmTestbase/gc/g1/unloading/tests/unloading_phantom_ref_inMemoryCompilation_keep_class/TEST.properties
@@ -0,0 +1,23 @@
+#
+# 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/g1/unloading/tests/unloading_phantom_ref_inMemoryCompilation_keep_class/TestDescription.java b/test/hotspot/jtreg/vmTestbase/gc/g1/unloading/tests/unloading_phantom_ref_inMemoryCompilation_keep_class/TestDescription.java
new file mode 100644
index 0000000..f026708
--- /dev/null
+++ b/test/hotspot/jtreg/vmTestbase/gc/g1/unloading/tests/unloading_phantom_ref_inMemoryCompilation_keep_class/TestDescription.java
@@ -0,0 +1,66 @@
+/*
+ * 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.
+ */
+
+
+/*
+ * @test
+ * @key stress gc
+ *
+ * @summary converted from VM Testbase gc/g1/unloading/tests/unloading_phantom_ref_inMemoryCompilation_keep_class.
+ * VM Testbase keywords: [gc, stress, stressopt, nonconcurrent, javac]
+ *
+ * @modules java.base/jdk.internal.misc
+ * @library /vmTestbase
+ * /test/lib
+ *
+ * @run driver jdk.test.lib.FileInstaller . .
+ *
+ * @comment generate HumongousTemplateClass and compile it to test.classes
+ * @run driver gc.g1.unloading.bytecode.GenClassesBuilder
+ *
+ * @build sun.hotspot.WhiteBox
+ * @run driver ClassFileInstaller sun.hotspot.WhiteBox
+ * sun.hotspot.WhiteBox$WhiteBoxPermission
+ * @run main/othervm
+ * -Xbootclasspath/a:.
+ * -XX:+UnlockDiagnosticVMOptions
+ * -XX:+WhiteBoxAPI
+ * -XX:+UseG1GC
+ * -XX:+ExplicitGCInvokesConcurrent
+ * -Xbootclasspath/a:.
+ * -XX:+UnlockDiagnosticVMOptions
+ * -XX:+WhiteBoxAPI
+ * -XX:+UseG1GC
+ * -XX:+ExplicitGCInvokesConcurrent
+ * -Xlog:gc:gc.log
+ * -XX:-UseGCOverheadLimit
+ * -Xlog:gc:gc.log
+ * -XX:-UseGCOverheadLimit
+ * gc.g1.unloading.UnloadingTest
+ * -referenceMode phantom
+ * -inMemoryCompilation
+ * -keep class
+ * -numberOfChecksLimit 4
+ * -stressTime 180
+ */
+
diff --git a/test/hotspot/jtreg/vmTestbase/gc/g1/unloading/tests/unloading_phantom_ref_inMemoryCompilation_keep_obj/TEST.properties b/test/hotspot/jtreg/vmTestbase/gc/g1/unloading/tests/unloading_phantom_ref_inMemoryCompilation_keep_obj/TEST.properties
new file mode 100644
index 0000000..04b22a1
--- /dev/null
+++ b/test/hotspot/jtreg/vmTestbase/gc/g1/unloading/tests/unloading_phantom_ref_inMemoryCompilation_keep_obj/TEST.properties
@@ -0,0 +1,23 @@
+#
+# 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/g1/unloading/tests/unloading_phantom_ref_inMemoryCompilation_keep_obj/TestDescription.java b/test/hotspot/jtreg/vmTestbase/gc/g1/unloading/tests/unloading_phantom_ref_inMemoryCompilation_keep_obj/TestDescription.java
new file mode 100644
index 0000000..9c30484
--- /dev/null
+++ b/test/hotspot/jtreg/vmTestbase/gc/g1/unloading/tests/unloading_phantom_ref_inMemoryCompilation_keep_obj/TestDescription.java
@@ -0,0 +1,66 @@
+/*
+ * 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.
+ */
+
+
+/*
+ * @test
+ * @key stress gc
+ *
+ * @summary converted from VM Testbase gc/g1/unloading/tests/unloading_phantom_ref_inMemoryCompilation_keep_obj.
+ * VM Testbase keywords: [gc, stress, stressopt, nonconcurrent, javac]
+ *
+ * @modules java.base/jdk.internal.misc
+ * @library /vmTestbase
+ * /test/lib
+ *
+ * @run driver jdk.test.lib.FileInstaller . .
+ *
+ * @comment generate HumongousTemplateClass and compile it to test.classes
+ * @run driver gc.g1.unloading.bytecode.GenClassesBuilder
+ *
+ * @build sun.hotspot.WhiteBox
+ * @run driver ClassFileInstaller sun.hotspot.WhiteBox
+ * sun.hotspot.WhiteBox$WhiteBoxPermission
+ * @run main/othervm
+ * -Xbootclasspath/a:.
+ * -XX:+UnlockDiagnosticVMOptions
+ * -XX:+WhiteBoxAPI
+ * -XX:+UseG1GC
+ * -XX:+ExplicitGCInvokesConcurrent
+ * -Xbootclasspath/a:.
+ * -XX:+UnlockDiagnosticVMOptions
+ * -XX:+WhiteBoxAPI
+ * -XX:+UseG1GC
+ * -XX:+ExplicitGCInvokesConcurrent
+ * -Xlog:gc:gc.log
+ * -XX:-UseGCOverheadLimit
+ * -Xlog:gc:gc.log
+ * -XX:-UseGCOverheadLimit
+ * gc.g1.unloading.UnloadingTest
+ * -referenceMode phantom
+ * -inMemoryCompilation
+ * -keep object
+ * -numberOfChecksLimit 4
+ * -stressTime 180
+ */
+
diff --git a/test/hotspot/jtreg/vmTestbase/gc/g1/unloading/tests/unloading_phantom_ref_keep_cl/TEST.properties b/test/hotspot/jtreg/vmTestbase/gc/g1/unloading/tests/unloading_phantom_ref_keep_cl/TEST.properties
new file mode 100644
index 0000000..04b22a1
--- /dev/null
+++ b/test/hotspot/jtreg/vmTestbase/gc/g1/unloading/tests/unloading_phantom_ref_keep_cl/TEST.properties
@@ -0,0 +1,23 @@
+#
+# 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/g1/unloading/tests/unloading_phantom_ref_keep_cl/TestDescription.java b/test/hotspot/jtreg/vmTestbase/gc/g1/unloading/tests/unloading_phantom_ref_keep_cl/TestDescription.java
new file mode 100644
index 0000000..b880b8a
--- /dev/null
+++ b/test/hotspot/jtreg/vmTestbase/gc/g1/unloading/tests/unloading_phantom_ref_keep_cl/TestDescription.java
@@ -0,0 +1,65 @@
+/*
+ * 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.
+ */
+
+
+/*
+ * @test
+ * @key stress gc
+ *
+ * @summary converted from VM Testbase gc/g1/unloading/tests/unloading_phantom_ref_keep_cl.
+ * VM Testbase keywords: [gc, stress, stressopt, nonconcurrent, javac]
+ *
+ * @modules java.base/jdk.internal.misc
+ * @library /vmTestbase
+ * /test/lib
+ *
+ * @run driver jdk.test.lib.FileInstaller . .
+ *
+ * @comment generate HumongousTemplateClass and compile it to test.classes
+ * @run driver gc.g1.unloading.bytecode.GenClassesBuilder
+ *
+ * @build sun.hotspot.WhiteBox
+ * @run driver ClassFileInstaller sun.hotspot.WhiteBox
+ * sun.hotspot.WhiteBox$WhiteBoxPermission
+ * @run main/othervm
+ * -Xbootclasspath/a:.
+ * -XX:+UnlockDiagnosticVMOptions
+ * -XX:+WhiteBoxAPI
+ * -XX:+UseG1GC
+ * -XX:+ExplicitGCInvokesConcurrent
+ * -Xbootclasspath/a:.
+ * -XX:+UnlockDiagnosticVMOptions
+ * -XX:+WhiteBoxAPI
+ * -XX:+UseG1GC
+ * -XX:+ExplicitGCInvokesConcurrent
+ * -Xlog:gc:gc.log
+ * -XX:-UseGCOverheadLimit
+ * -Xlog:gc:gc.log
+ * -XX:-UseGCOverheadLimit
+ * gc.g1.unloading.UnloadingTest
+ * -referenceMode phantom
+ * -keep classloader
+ * -numberOfChecksLimit 4
+ * -stressTime 180
+ */
+
diff --git a/test/hotspot/jtreg/vmTestbase/gc/g1/unloading/tests/unloading_phantom_ref_keep_class/TEST.properties b/test/hotspot/jtreg/vmTestbase/gc/g1/unloading/tests/unloading_phantom_ref_keep_class/TEST.properties
new file mode 100644
index 0000000..04b22a1
--- /dev/null
+++ b/test/hotspot/jtreg/vmTestbase/gc/g1/unloading/tests/unloading_phantom_ref_keep_class/TEST.properties
@@ -0,0 +1,23 @@
+#
+# 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/g1/unloading/tests/unloading_phantom_ref_keep_class/TestDescription.java b/test/hotspot/jtreg/vmTestbase/gc/g1/unloading/tests/unloading_phantom_ref_keep_class/TestDescription.java
new file mode 100644
index 0000000..9319256
--- /dev/null
+++ b/test/hotspot/jtreg/vmTestbase/gc/g1/unloading/tests/unloading_phantom_ref_keep_class/TestDescription.java
@@ -0,0 +1,65 @@
+/*
+ * 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.
+ */
+
+
+/*
+ * @test
+ * @key stress gc
+ *
+ * @summary converted from VM Testbase gc/g1/unloading/tests/unloading_phantom_ref_keep_class.
+ * VM Testbase keywords: [gc, stress, stressopt, nonconcurrent, javac]
+ *
+ * @modules java.base/jdk.internal.misc
+ * @library /vmTestbase
+ * /test/lib
+ *
+ * @run driver jdk.test.lib.FileInstaller . .
+ *
+ * @comment generate HumongousTemplateClass and compile it to test.classes
+ * @run driver gc.g1.unloading.bytecode.GenClassesBuilder
+ *
+ * @build sun.hotspot.WhiteBox
+ * @run driver ClassFileInstaller sun.hotspot.WhiteBox
+ * sun.hotspot.WhiteBox$WhiteBoxPermission
+ * @run main/othervm
+ * -Xbootclasspath/a:.
+ * -XX:+UnlockDiagnosticVMOptions
+ * -XX:+WhiteBoxAPI
+ * -XX:+UseG1GC
+ * -XX:+ExplicitGCInvokesConcurrent
+ * -Xbootclasspath/a:.
+ * -XX:+UnlockDiagnosticVMOptions
+ * -XX:+WhiteBoxAPI
+ * -XX:+UseG1GC
+ * -XX:+ExplicitGCInvokesConcurrent
+ * -Xlog:gc:gc.log
+ * -XX:-UseGCOverheadLimit
+ * -Xlog:gc:gc.log
+ * -XX:-UseGCOverheadLimit
+ * gc.g1.unloading.UnloadingTest
+ * -referenceMode phantom
+ * -keep class
+ * -numberOfChecksLimit 4
+ * -stressTime 180
+ */
+
diff --git a/test/hotspot/jtreg/vmTestbase/gc/g1/unloading/tests/unloading_phantom_ref_keep_obj/TEST.properties b/test/hotspot/jtreg/vmTestbase/gc/g1/unloading/tests/unloading_phantom_ref_keep_obj/TEST.properties
new file mode 100644
index 0000000..04b22a1
--- /dev/null
+++ b/test/hotspot/jtreg/vmTestbase/gc/g1/unloading/tests/unloading_phantom_ref_keep_obj/TEST.properties
@@ -0,0 +1,23 @@
+#
+# 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/g1/unloading/tests/unloading_phantom_ref_keep_obj/TestDescription.java b/test/hotspot/jtreg/vmTestbase/gc/g1/unloading/tests/unloading_phantom_ref_keep_obj/TestDescription.java
new file mode 100644
index 0000000..dcb3989
--- /dev/null
+++ b/test/hotspot/jtreg/vmTestbase/gc/g1/unloading/tests/unloading_phantom_ref_keep_obj/TestDescription.java
@@ -0,0 +1,65 @@
+/*
+ * 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.
+ */
+
+
+/*
+ * @test
+ * @key stress gc
+ *
+ * @summary converted from VM Testbase gc/g1/unloading/tests/unloading_phantom_ref_keep_obj.
+ * VM Testbase keywords: [gc, stress, stressopt, nonconcurrent, javac]
+ *
+ * @modules java.base/jdk.internal.misc
+ * @library /vmTestbase
+ * /test/lib
+ *
+ * @run driver jdk.test.lib.FileInstaller . .
+ *
+ * @comment generate HumongousTemplateClass and compile it to test.classes
+ * @run driver gc.g1.unloading.bytecode.GenClassesBuilder
+ *
+ * @build sun.hotspot.WhiteBox
+ * @run driver ClassFileInstaller sun.hotspot.WhiteBox
+ * sun.hotspot.WhiteBox$WhiteBoxPermission
+ * @run main/othervm
+ * -Xbootclasspath/a:.
+ * -XX:+UnlockDiagnosticVMOptions
+ * -XX:+WhiteBoxAPI
+ * -XX:+UseG1GC
+ * -XX:+ExplicitGCInvokesConcurrent
+ * -Xbootclasspath/a:.
+ * -XX:+UnlockDiagnosticVMOptions
+ * -XX:+WhiteBoxAPI
+ * -XX:+UseG1GC
+ * -XX:+ExplicitGCInvokesConcurrent
+ * -Xlog:gc:gc.log
+ * -XX:-UseGCOverheadLimit
+ * -Xlog:gc:gc.log
+ * -XX:-UseGCOverheadLimit
+ * gc.g1.unloading.UnloadingTest
+ * -referenceMode phantom
+ * -keep object
+ * -numberOfChecksLimit 4
+ * -stressTime 180
+ */
+
diff --git a/test/hotspot/jtreg/vmTestbase/gc/g1/unloading/tests/unloading_prot_domains_inMemoryCompilation_keep_cl/TEST.properties b/test/hotspot/jtreg/vmTestbase/gc/g1/unloading/tests/unloading_prot_domains_inMemoryCompilation_keep_cl/TEST.properties
new file mode 100644
index 0000000..04b22a1
--- /dev/null
+++ b/test/hotspot/jtreg/vmTestbase/gc/g1/unloading/tests/unloading_prot_domains_inMemoryCompilation_keep_cl/TEST.properties
@@ -0,0 +1,23 @@
+#
+# 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/g1/unloading/tests/unloading_prot_domains_inMemoryCompilation_keep_cl/TestDescription.java b/test/hotspot/jtreg/vmTestbase/gc/g1/unloading/tests/unloading_prot_domains_inMemoryCompilation_keep_cl/TestDescription.java
new file mode 100644
index 0000000..7937d29
--- /dev/null
+++ b/test/hotspot/jtreg/vmTestbase/gc/g1/unloading/tests/unloading_prot_domains_inMemoryCompilation_keep_cl/TestDescription.java
@@ -0,0 +1,66 @@
+/*
+ * 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.
+ */
+
+
+/*
+ * @test
+ * @key stress gc
+ *
+ * @summary converted from VM Testbase gc/g1/unloading/tests/unloading_prot_domains_inMemoryCompilation_keep_cl.
+ * VM Testbase keywords: [gc, stress, stressopt, nonconcurrent, javac]
+ *
+ * @modules java.base/jdk.internal.misc
+ * @library /vmTestbase
+ * /test/lib
+ *
+ * @run driver jdk.test.lib.FileInstaller . .
+ *
+ * @comment generate HumongousTemplateClass and compile it to test.classes
+ * @run driver gc.g1.unloading.bytecode.GenClassesBuilder
+ *
+ * @build sun.hotspot.WhiteBox
+ * @run driver ClassFileInstaller sun.hotspot.WhiteBox
+ * sun.hotspot.WhiteBox$WhiteBoxPermission
+ * @run main/othervm
+ * -Xbootclasspath/a:.
+ * -XX:+UnlockDiagnosticVMOptions
+ * -XX:+WhiteBoxAPI
+ * -XX:+UseG1GC
+ * -XX:+ExplicitGCInvokesConcurrent
+ * -Xbootclasspath/a:.
+ * -XX:+UnlockDiagnosticVMOptions
+ * -XX:+WhiteBoxAPI
+ * -XX:+UseG1GC
+ * -XX:+ExplicitGCInvokesConcurrent
+ * -Xlog:gc:gc.log
+ * -XX:-UseGCOverheadLimit
+ * -Xlog:gc:gc.log
+ * -XX:-UseGCOverheadLimit
+ * gc.g1.unloading.UnloadingTest
+ * -classloadingMethod plain
+ * -inMemoryCompilation
+ * -keep classloader
+ * -numberOfChecksLimit 4
+ * -stressTime 180
+ */
+
diff --git a/test/hotspot/jtreg/vmTestbase/gc/g1/unloading/tests/unloading_prot_domains_inMemoryCompilation_keep_class/TEST.properties b/test/hotspot/jtreg/vmTestbase/gc/g1/unloading/tests/unloading_prot_domains_inMemoryCompilation_keep_class/TEST.properties
new file mode 100644
index 0000000..04b22a1
--- /dev/null
+++ b/test/hotspot/jtreg/vmTestbase/gc/g1/unloading/tests/unloading_prot_domains_inMemoryCompilation_keep_class/TEST.properties
@@ -0,0 +1,23 @@
+#
+# 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/g1/unloading/tests/unloading_prot_domains_inMemoryCompilation_keep_class/TestDescription.java b/test/hotspot/jtreg/vmTestbase/gc/g1/unloading/tests/unloading_prot_domains_inMemoryCompilation_keep_class/TestDescription.java
new file mode 100644
index 0000000..a407114
--- /dev/null
+++ b/test/hotspot/jtreg/vmTestbase/gc/g1/unloading/tests/unloading_prot_domains_inMemoryCompilation_keep_class/TestDescription.java
@@ -0,0 +1,66 @@
+/*
+ * 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.
+ */
+
+
+/*
+ * @test
+ * @key stress gc
+ *
+ * @summary converted from VM Testbase gc/g1/unloading/tests/unloading_prot_domains_inMemoryCompilation_keep_class.
+ * VM Testbase keywords: [gc, stress, stressopt, nonconcurrent, javac]
+ *
+ * @modules java.base/jdk.internal.misc
+ * @library /vmTestbase
+ * /test/lib
+ *
+ * @run driver jdk.test.lib.FileInstaller . .
+ *
+ * @comment generate HumongousTemplateClass and compile it to test.classes
+ * @run driver gc.g1.unloading.bytecode.GenClassesBuilder
+ *
+ * @build sun.hotspot.WhiteBox
+ * @run driver ClassFileInstaller sun.hotspot.WhiteBox
+ * sun.hotspot.WhiteBox$WhiteBoxPermission
+ * @run main/othervm
+ * -Xbootclasspath/a:.
+ * -XX:+UnlockDiagnosticVMOptions
+ * -XX:+WhiteBoxAPI
+ * -XX:+UseG1GC
+ * -XX:+ExplicitGCInvokesConcurrent
+ * -Xbootclasspath/a:.
+ * -XX:+UnlockDiagnosticVMOptions
+ * -XX:+WhiteBoxAPI
+ * -XX:+UseG1GC
+ * -XX:+ExplicitGCInvokesConcurrent
+ * -Xlog:gc:gc.log
+ * -XX:-UseGCOverheadLimit
+ * -Xlog:gc:gc.log
+ * -XX:-UseGCOverheadLimit
+ * gc.g1.unloading.UnloadingTest
+ * -classloadingMethod plain
+ * -inMemoryCompilation
+ * -keep class
+ * -numberOfChecksLimit 4
+ * -stressTime 180
+ */
+
diff --git a/test/hotspot/jtreg/vmTestbase/gc/g1/unloading/tests/unloading_prot_domains_inMemoryCompilation_keep_obj/TEST.properties b/test/hotspot/jtreg/vmTestbase/gc/g1/unloading/tests/unloading_prot_domains_inMemoryCompilation_keep_obj/TEST.properties
new file mode 100644
index 0000000..04b22a1
--- /dev/null
+++ b/test/hotspot/jtreg/vmTestbase/gc/g1/unloading/tests/unloading_prot_domains_inMemoryCompilation_keep_obj/TEST.properties
@@ -0,0 +1,23 @@
+#
+# 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/g1/unloading/tests/unloading_prot_domains_inMemoryCompilation_keep_obj/TestDescription.java b/test/hotspot/jtreg/vmTestbase/gc/g1/unloading/tests/unloading_prot_domains_inMemoryCompilation_keep_obj/TestDescription.java
new file mode 100644
index 0000000..a7cad5c
--- /dev/null
+++ b/test/hotspot/jtreg/vmTestbase/gc/g1/unloading/tests/unloading_prot_domains_inMemoryCompilation_keep_obj/TestDescription.java
@@ -0,0 +1,66 @@
+/*
+ * 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.
+ */
+
+
+/*
+ * @test
+ * @key stress gc
+ *
+ * @summary converted from VM Testbase gc/g1/unloading/tests/unloading_prot_domains_inMemoryCompilation_keep_obj.
+ * VM Testbase keywords: [gc, stress, stressopt, nonconcurrent, javac]
+ *
+ * @modules java.base/jdk.internal.misc
+ * @library /vmTestbase
+ * /test/lib
+ *
+ * @run driver jdk.test.lib.FileInstaller . .
+ *
+ * @comment generate HumongousTemplateClass and compile it to test.classes
+ * @run driver gc.g1.unloading.bytecode.GenClassesBuilder
+ *
+ * @build sun.hotspot.WhiteBox
+ * @run driver ClassFileInstaller sun.hotspot.WhiteBox
+ * sun.hotspot.WhiteBox$WhiteBoxPermission
+ * @run main/othervm
+ * -Xbootclasspath/a:.
+ * -XX:+UnlockDiagnosticVMOptions
+ * -XX:+WhiteBoxAPI
+ * -XX:+UseG1GC
+ * -XX:+ExplicitGCInvokesConcurrent
+ * -Xbootclasspath/a:.
+ * -XX:+UnlockDiagnosticVMOptions
+ * -XX:+WhiteBoxAPI
+ * -XX:+UseG1GC
+ * -XX:+ExplicitGCInvokesConcurrent
+ * -Xlog:gc:gc.log
+ * -XX:-UseGCOverheadLimit
+ * -Xlog:gc:gc.log
+ * -XX:-UseGCOverheadLimit
+ * gc.g1.unloading.UnloadingTest
+ * -classloadingMethod plain
+ * -inMemoryCompilation
+ * -keep object
+ * -numberOfChecksLimit 4
+ * -stressTime 180
+ */
+
diff --git a/test/hotspot/jtreg/vmTestbase/gc/g1/unloading/tests/unloading_prot_domains_keep_cl/TEST.properties b/test/hotspot/jtreg/vmTestbase/gc/g1/unloading/tests/unloading_prot_domains_keep_cl/TEST.properties
new file mode 100644
index 0000000..04b22a1
--- /dev/null
+++ b/test/hotspot/jtreg/vmTestbase/gc/g1/unloading/tests/unloading_prot_domains_keep_cl/TEST.properties
@@ -0,0 +1,23 @@
+#
+# 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/g1/unloading/tests/unloading_prot_domains_keep_cl/TestDescription.java b/test/hotspot/jtreg/vmTestbase/gc/g1/unloading/tests/unloading_prot_domains_keep_cl/TestDescription.java
new file mode 100644
index 0000000..cdcb939
--- /dev/null
+++ b/test/hotspot/jtreg/vmTestbase/gc/g1/unloading/tests/unloading_prot_domains_keep_cl/TestDescription.java
@@ -0,0 +1,65 @@
+/*
+ * 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.
+ */
+
+
+/*
+ * @test
+ * @key stress gc
+ *
+ * @summary converted from VM Testbase gc/g1/unloading/tests/unloading_prot_domains_keep_cl.
+ * VM Testbase keywords: [gc, stress, stressopt, nonconcurrent, javac]
+ *
+ * @modules java.base/jdk.internal.misc
+ * @library /vmTestbase
+ * /test/lib
+ *
+ * @run driver jdk.test.lib.FileInstaller . .
+ *
+ * @comment generate HumongousTemplateClass and compile it to test.classes
+ * @run driver gc.g1.unloading.bytecode.GenClassesBuilder
+ *
+ * @build sun.hotspot.WhiteBox
+ * @run driver ClassFileInstaller sun.hotspot.WhiteBox
+ * sun.hotspot.WhiteBox$WhiteBoxPermission
+ * @run main/othervm
+ * -Xbootclasspath/a:.
+ * -XX:+UnlockDiagnosticVMOptions
+ * -XX:+WhiteBoxAPI
+ * -XX:+UseG1GC
+ * -XX:+ExplicitGCInvokesConcurrent
+ * -Xbootclasspath/a:.
+ * -XX:+UnlockDiagnosticVMOptions
+ * -XX:+WhiteBoxAPI
+ * -XX:+UseG1GC
+ * -XX:+ExplicitGCInvokesConcurrent
+ * -Xlog:gc:gc.log
+ * -XX:-UseGCOverheadLimit
+ * -Xlog:gc:gc.log
+ * -XX:-UseGCOverheadLimit
+ * gc.g1.unloading.UnloadingTest
+ * -classloadingMethod plain
+ * -keep classloader
+ * -numberOfChecksLimit 4
+ * -stressTime 180
+ */
+
diff --git a/test/hotspot/jtreg/vmTestbase/gc/g1/unloading/tests/unloading_prot_domains_keep_class/TEST.properties b/test/hotspot/jtreg/vmTestbase/gc/g1/unloading/tests/unloading_prot_domains_keep_class/TEST.properties
new file mode 100644
index 0000000..04b22a1
--- /dev/null
+++ b/test/hotspot/jtreg/vmTestbase/gc/g1/unloading/tests/unloading_prot_domains_keep_class/TEST.properties
@@ -0,0 +1,23 @@
+#
+# 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/g1/unloading/tests/unloading_prot_domains_keep_class/TestDescription.java b/test/hotspot/jtreg/vmTestbase/gc/g1/unloading/tests/unloading_prot_domains_keep_class/TestDescription.java
new file mode 100644
index 0000000..89a25b4
--- /dev/null
+++ b/test/hotspot/jtreg/vmTestbase/gc/g1/unloading/tests/unloading_prot_domains_keep_class/TestDescription.java
@@ -0,0 +1,65 @@
+/*
+ * 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.
+ */
+
+
+/*
+ * @test
+ * @key stress gc
+ *
+ * @summary converted from VM Testbase gc/g1/unloading/tests/unloading_prot_domains_keep_class.
+ * VM Testbase keywords: [gc, stress, stressopt, nonconcurrent, javac]
+ *
+ * @modules java.base/jdk.internal.misc
+ * @library /vmTestbase
+ * /test/lib
+ *
+ * @run driver jdk.test.lib.FileInstaller . .
+ *
+ * @comment generate HumongousTemplateClass and compile it to test.classes
+ * @run driver gc.g1.unloading.bytecode.GenClassesBuilder
+ *
+ * @build sun.hotspot.WhiteBox
+ * @run driver ClassFileInstaller sun.hotspot.WhiteBox
+ * sun.hotspot.WhiteBox$WhiteBoxPermission
+ * @run main/othervm
+ * -Xbootclasspath/a:.
+ * -XX:+UnlockDiagnosticVMOptions
+ * -XX:+WhiteBoxAPI
+ * -XX:+UseG1GC
+ * -XX:+ExplicitGCInvokesConcurrent
+ * -Xbootclasspath/a:.
+ * -XX:+UnlockDiagnosticVMOptions
+ * -XX:+WhiteBoxAPI
+ * -XX:+UseG1GC
+ * -XX:+ExplicitGCInvokesConcurrent
+ * -Xlog:gc:gc.log
+ * -XX:-UseGCOverheadLimit
+ * -Xlog:gc:gc.log
+ * -XX:-UseGCOverheadLimit
+ * gc.g1.unloading.UnloadingTest
+ * -classloadingMethod plain
+ * -keep class
+ * -numberOfChecksLimit 4
+ * -stressTime 180
+ */
+
diff --git a/test/hotspot/jtreg/vmTestbase/gc/g1/unloading/tests/unloading_prot_domains_keep_obj/TEST.properties b/test/hotspot/jtreg/vmTestbase/gc/g1/unloading/tests/unloading_prot_domains_keep_obj/TEST.properties
new file mode 100644
index 0000000..04b22a1
--- /dev/null
+++ b/test/hotspot/jtreg/vmTestbase/gc/g1/unloading/tests/unloading_prot_domains_keep_obj/TEST.properties
@@ -0,0 +1,23 @@
+#
+# 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/g1/unloading/tests/unloading_prot_domains_keep_obj/TestDescription.java b/test/hotspot/jtreg/vmTestbase/gc/g1/unloading/tests/unloading_prot_domains_keep_obj/TestDescription.java
new file mode 100644
index 0000000..d9bb44b
--- /dev/null
+++ b/test/hotspot/jtreg/vmTestbase/gc/g1/unloading/tests/unloading_prot_domains_keep_obj/TestDescription.java
@@ -0,0 +1,65 @@
+/*
+ * 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.
+ */
+
+
+/*
+ * @test
+ * @key stress gc
+ *
+ * @summary converted from VM Testbase gc/g1/unloading/tests/unloading_prot_domains_keep_obj.
+ * VM Testbase keywords: [gc, stress, stressopt, nonconcurrent, javac]
+ *
+ * @modules java.base/jdk.internal.misc
+ * @library /vmTestbase
+ * /test/lib
+ *
+ * @run driver jdk.test.lib.FileInstaller . .
+ *
+ * @comment generate HumongousTemplateClass and compile it to test.classes
+ * @run driver gc.g1.unloading.bytecode.GenClassesBuilder
+ *
+ * @build sun.hotspot.WhiteBox
+ * @run driver ClassFileInstaller sun.hotspot.WhiteBox
+ * sun.hotspot.WhiteBox$WhiteBoxPermission
+ * @run main/othervm
+ * -Xbootclasspath/a:.
+ * -XX:+UnlockDiagnosticVMOptions
+ * -XX:+WhiteBoxAPI
+ * -XX:+UseG1GC
+ * -XX:+ExplicitGCInvokesConcurrent
+ * -Xbootclasspath/a:.
+ * -XX:+UnlockDiagnosticVMOptions
+ * -XX:+WhiteBoxAPI
+ * -XX:+UseG1GC
+ * -XX:+ExplicitGCInvokesConcurrent
+ * -Xlog:gc:gc.log
+ * -XX:-UseGCOverheadLimit
+ * -Xlog:gc:gc.log
+ * -XX:-UseGCOverheadLimit
+ * gc.g1.unloading.UnloadingTest
+ * -classloadingMethod plain
+ * -keep object
+ * -numberOfChecksLimit 4
+ * -stressTime 180
+ */
+
diff --git a/test/hotspot/jtreg/vmTestbase/gc/g1/unloading/tests/unloading_redefinition_inMemoryCompilation_keep_cl/TEST.properties b/test/hotspot/jtreg/vmTestbase/gc/g1/unloading/tests/unloading_redefinition_inMemoryCompilation_keep_cl/TEST.properties
new file mode 100644
index 0000000..04b22a1
--- /dev/null
+++ b/test/hotspot/jtreg/vmTestbase/gc/g1/unloading/tests/unloading_redefinition_inMemoryCompilation_keep_cl/TEST.properties
@@ -0,0 +1,23 @@
+#
+# 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/g1/unloading/tests/unloading_redefinition_inMemoryCompilation_keep_cl/TestDescription.java b/test/hotspot/jtreg/vmTestbase/gc/g1/unloading/tests/unloading_redefinition_inMemoryCompilation_keep_cl/TestDescription.java
new file mode 100644
index 0000000..5c999b7
--- /dev/null
+++ b/test/hotspot/jtreg/vmTestbase/gc/g1/unloading/tests/unloading_redefinition_inMemoryCompilation_keep_cl/TestDescription.java
@@ -0,0 +1,66 @@
+/*
+ * 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.
+ */
+
+
+/*
+ * @test
+ * @key stress gc
+ *
+ * @summary converted from VM Testbase gc/g1/unloading/tests/unloading_redefinition_inMemoryCompilation_keep_cl.
+ * VM Testbase keywords: [gc, stress, stressopt, nonconcurrent, javac]
+ *
+ * @modules java.base/jdk.internal.misc
+ * @library /vmTestbase
+ * /test/lib
+ *
+ * @run driver jdk.test.lib.FileInstaller . .
+ *
+ * @comment generate HumongousTemplateClass and compile it to test.classes
+ * @run driver gc.g1.unloading.bytecode.GenClassesBuilder
+ *
+ * @build sun.hotspot.WhiteBox
+ * @run driver ClassFileInstaller sun.hotspot.WhiteBox
+ * sun.hotspot.WhiteBox$WhiteBoxPermission
+ * @run main/othervm
+ * -Xbootclasspath/a:.
+ * -XX:+UnlockDiagnosticVMOptions
+ * -XX:+WhiteBoxAPI
+ * -XX:+UseG1GC
+ * -XX:+ExplicitGCInvokesConcurrent
+ * -Xbootclasspath/a:.
+ * -XX:+UnlockDiagnosticVMOptions
+ * -XX:+WhiteBoxAPI
+ * -XX:+UseG1GC
+ * -XX:+ExplicitGCInvokesConcurrent
+ * -Xlog:gc:gc.log
+ * -XX:-UseGCOverheadLimit
+ * -Xlog:gc:gc.log
+ * -XX:-UseGCOverheadLimit
+ * gc.g1.unloading.UnloadingTest
+ * -redefineClasses
+ * -inMemoryCompilation
+ * -keep classloader
+ * -numberOfChecksLimit 4
+ * -stressTime 180
+ */
+
diff --git a/test/hotspot/jtreg/vmTestbase/gc/g1/unloading/tests/unloading_redefinition_inMemoryCompilation_keep_class/TEST.properties b/test/hotspot/jtreg/vmTestbase/gc/g1/unloading/tests/unloading_redefinition_inMemoryCompilation_keep_class/TEST.properties
new file mode 100644
index 0000000..04b22a1
--- /dev/null
+++ b/test/hotspot/jtreg/vmTestbase/gc/g1/unloading/tests/unloading_redefinition_inMemoryCompilation_keep_class/TEST.properties
@@ -0,0 +1,23 @@
+#
+# 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/g1/unloading/tests/unloading_redefinition_inMemoryCompilation_keep_class/TestDescription.java b/test/hotspot/jtreg/vmTestbase/gc/g1/unloading/tests/unloading_redefinition_inMemoryCompilation_keep_class/TestDescription.java
new file mode 100644
index 0000000..39515ed
--- /dev/null
+++ b/test/hotspot/jtreg/vmTestbase/gc/g1/unloading/tests/unloading_redefinition_inMemoryCompilation_keep_class/TestDescription.java
@@ -0,0 +1,66 @@
+/*
+ * 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.
+ */
+
+
+/*
+ * @test
+ * @key stress gc
+ *
+ * @summary converted from VM Testbase gc/g1/unloading/tests/unloading_redefinition_inMemoryCompilation_keep_class.
+ * VM Testbase keywords: [gc, stress, stressopt, nonconcurrent, javac]
+ *
+ * @modules java.base/jdk.internal.misc
+ * @library /vmTestbase
+ * /test/lib
+ *
+ * @run driver jdk.test.lib.FileInstaller . .
+ *
+ * @comment generate HumongousTemplateClass and compile it to test.classes
+ * @run driver gc.g1.unloading.bytecode.GenClassesBuilder
+ *
+ * @build sun.hotspot.WhiteBox
+ * @run driver ClassFileInstaller sun.hotspot.WhiteBox
+ * sun.hotspot.WhiteBox$WhiteBoxPermission
+ * @run main/othervm
+ * -Xbootclasspath/a:.
+ * -XX:+UnlockDiagnosticVMOptions
+ * -XX:+WhiteBoxAPI
+ * -XX:+UseG1GC
+ * -XX:+ExplicitGCInvokesConcurrent
+ * -Xbootclasspath/a:.
+ * -XX:+UnlockDiagnosticVMOptions
+ * -XX:+WhiteBoxAPI
+ * -XX:+UseG1GC
+ * -XX:+ExplicitGCInvokesConcurrent
+ * -Xlog:gc:gc.log
+ * -XX:-UseGCOverheadLimit
+ * -Xlog:gc:gc.log
+ * -XX:-UseGCOverheadLimit
+ * gc.g1.unloading.UnloadingTest
+ * -redefineClasses
+ * -inMemoryCompilation
+ * -keep class
+ * -numberOfChecksLimit 4
+ * -stressTime 180
+ */
+
diff --git a/test/hotspot/jtreg/vmTestbase/gc/g1/unloading/tests/unloading_redefinition_inMemoryCompilation_keep_obj/TEST.properties b/test/hotspot/jtreg/vmTestbase/gc/g1/unloading/tests/unloading_redefinition_inMemoryCompilation_keep_obj/TEST.properties
new file mode 100644
index 0000000..04b22a1
--- /dev/null
+++ b/test/hotspot/jtreg/vmTestbase/gc/g1/unloading/tests/unloading_redefinition_inMemoryCompilation_keep_obj/TEST.properties
@@ -0,0 +1,23 @@
+#
+# 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/g1/unloading/tests/unloading_redefinition_inMemoryCompilation_keep_obj/TestDescription.java b/test/hotspot/jtreg/vmTestbase/gc/g1/unloading/tests/unloading_redefinition_inMemoryCompilation_keep_obj/TestDescription.java
new file mode 100644
index 0000000..35a8500
--- /dev/null
+++ b/test/hotspot/jtreg/vmTestbase/gc/g1/unloading/tests/unloading_redefinition_inMemoryCompilation_keep_obj/TestDescription.java
@@ -0,0 +1,66 @@
+/*
+ * 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.
+ */
+
+
+/*
+ * @test
+ * @key stress gc
+ *
+ * @summary converted from VM Testbase gc/g1/unloading/tests/unloading_redefinition_inMemoryCompilation_keep_obj.
+ * VM Testbase keywords: [gc, stress, stressopt, nonconcurrent, javac]
+ *
+ * @modules java.base/jdk.internal.misc
+ * @library /vmTestbase
+ * /test/lib
+ *
+ * @run driver jdk.test.lib.FileInstaller . .
+ *
+ * @comment generate HumongousTemplateClass and compile it to test.classes
+ * @run driver gc.g1.unloading.bytecode.GenClassesBuilder
+ *
+ * @build sun.hotspot.WhiteBox
+ * @run driver ClassFileInstaller sun.hotspot.WhiteBox
+ * sun.hotspot.WhiteBox$WhiteBoxPermission
+ * @run main/othervm
+ * -Xbootclasspath/a:.
+ * -XX:+UnlockDiagnosticVMOptions
+ * -XX:+WhiteBoxAPI
+ * -XX:+UseG1GC
+ * -XX:+ExplicitGCInvokesConcurrent
+ * -Xbootclasspath/a:.
+ * -XX:+UnlockDiagnosticVMOptions
+ * -XX:+WhiteBoxAPI
+ * -XX:+UseG1GC
+ * -XX:+ExplicitGCInvokesConcurrent
+ * -Xlog:gc:gc.log
+ * -XX:-UseGCOverheadLimit
+ * -Xlog:gc:gc.log
+ * -XX:-UseGCOverheadLimit
+ * gc.g1.unloading.UnloadingTest
+ * -redefineClasses
+ * -inMemoryCompilation
+ * -keep object
+ * -numberOfChecksLimit 4
+ * -stressTime 180
+ */
+
diff --git a/test/hotspot/jtreg/vmTestbase/gc/g1/unloading/tests/unloading_redefinition_keep_cl/TEST.properties b/test/hotspot/jtreg/vmTestbase/gc/g1/unloading/tests/unloading_redefinition_keep_cl/TEST.properties
new file mode 100644
index 0000000..04b22a1
--- /dev/null
+++ b/test/hotspot/jtreg/vmTestbase/gc/g1/unloading/tests/unloading_redefinition_keep_cl/TEST.properties
@@ -0,0 +1,23 @@
+#
+# 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/g1/unloading/tests/unloading_redefinition_keep_cl/TestDescription.java b/test/hotspot/jtreg/vmTestbase/gc/g1/unloading/tests/unloading_redefinition_keep_cl/TestDescription.java
new file mode 100644
index 0000000..fa5dc86
--- /dev/null
+++ b/test/hotspot/jtreg/vmTestbase/gc/g1/unloading/tests/unloading_redefinition_keep_cl/TestDescription.java
@@ -0,0 +1,65 @@
+/*
+ * 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.
+ */
+
+
+/*
+ * @test
+ * @key stress gc
+ *
+ * @summary converted from VM Testbase gc/g1/unloading/tests/unloading_redefinition_keep_cl.
+ * VM Testbase keywords: [gc, stress, stressopt, nonconcurrent, javac]
+ *
+ * @modules java.base/jdk.internal.misc
+ * @library /vmTestbase
+ * /test/lib
+ *
+ * @run driver jdk.test.lib.FileInstaller . .
+ *
+ * @comment generate HumongousTemplateClass and compile it to test.classes
+ * @run driver gc.g1.unloading.bytecode.GenClassesBuilder
+ *
+ * @build sun.hotspot.WhiteBox
+ * @run driver ClassFileInstaller sun.hotspot.WhiteBox
+ * sun.hotspot.WhiteBox$WhiteBoxPermission
+ * @run main/othervm
+ * -Xbootclasspath/a:.
+ * -XX:+UnlockDiagnosticVMOptions
+ * -XX:+WhiteBoxAPI
+ * -XX:+UseG1GC
+ * -XX:+ExplicitGCInvokesConcurrent
+ * -Xbootclasspath/a:.
+ * -XX:+UnlockDiagnosticVMOptions
+ * -XX:+WhiteBoxAPI
+ * -XX:+UseG1GC
+ * -XX:+ExplicitGCInvokesConcurrent
+ * -Xlog:gc:gc.log
+ * -XX:-UseGCOverheadLimit
+ * -Xlog:gc:gc.log
+ * -XX:-UseGCOverheadLimit
+ * gc.g1.unloading.UnloadingTest
+ * -redefineClasses
+ * -keep classloader
+ * -numberOfChecksLimit 4
+ * -stressTime 180
+ */
+
diff --git a/test/hotspot/jtreg/vmTestbase/gc/g1/unloading/tests/unloading_redefinition_keep_class/TEST.properties b/test/hotspot/jtreg/vmTestbase/gc/g1/unloading/tests/unloading_redefinition_keep_class/TEST.properties
new file mode 100644
index 0000000..04b22a1
--- /dev/null
+++ b/test/hotspot/jtreg/vmTestbase/gc/g1/unloading/tests/unloading_redefinition_keep_class/TEST.properties
@@ -0,0 +1,23 @@
+#
+# 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/g1/unloading/tests/unloading_redefinition_keep_class/TestDescription.java b/test/hotspot/jtreg/vmTestbase/gc/g1/unloading/tests/unloading_redefinition_keep_class/TestDescription.java
new file mode 100644
index 0000000..bd05067
--- /dev/null
+++ b/test/hotspot/jtreg/vmTestbase/gc/g1/unloading/tests/unloading_redefinition_keep_class/TestDescription.java
@@ -0,0 +1,65 @@
+/*
+ * 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.
+ */
+
+
+/*
+ * @test
+ * @key stress gc
+ *
+ * @summary converted from VM Testbase gc/g1/unloading/tests/unloading_redefinition_keep_class.
+ * VM Testbase keywords: [gc, stress, stressopt, nonconcurrent, javac]
+ *
+ * @modules java.base/jdk.internal.misc
+ * @library /vmTestbase
+ * /test/lib
+ *
+ * @run driver jdk.test.lib.FileInstaller . .
+ *
+ * @comment generate HumongousTemplateClass and compile it to test.classes
+ * @run driver gc.g1.unloading.bytecode.GenClassesBuilder
+ *
+ * @build sun.hotspot.WhiteBox
+ * @run driver ClassFileInstaller sun.hotspot.WhiteBox
+ * sun.hotspot.WhiteBox$WhiteBoxPermission
+ * @run main/othervm
+ * -Xbootclasspath/a:.
+ * -XX:+UnlockDiagnosticVMOptions
+ * -XX:+WhiteBoxAPI
+ * -XX:+UseG1GC
+ * -XX:+ExplicitGCInvokesConcurrent
+ * -Xbootclasspath/a:.
+ * -XX:+UnlockDiagnosticVMOptions
+ * -XX:+WhiteBoxAPI
+ * -XX:+UseG1GC
+ * -XX:+ExplicitGCInvokesConcurrent
+ * -Xlog:gc:gc.log
+ * -XX:-UseGCOverheadLimit
+ * -Xlog:gc:gc.log
+ * -XX:-UseGCOverheadLimit
+ * gc.g1.unloading.UnloadingTest
+ * -redefineClasses
+ * -keep class
+ * -numberOfChecksLimit 4
+ * -stressTime 180
+ */
+
diff --git a/test/hotspot/jtreg/vmTestbase/gc/g1/unloading/tests/unloading_redefinition_keep_obj/TEST.properties b/test/hotspot/jtreg/vmTestbase/gc/g1/unloading/tests/unloading_redefinition_keep_obj/TEST.properties
new file mode 100644
index 0000000..04b22a1
--- /dev/null
+++ b/test/hotspot/jtreg/vmTestbase/gc/g1/unloading/tests/unloading_redefinition_keep_obj/TEST.properties
@@ -0,0 +1,23 @@
+#
+# 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/g1/unloading/tests/unloading_redefinition_keep_obj/TestDescription.java b/test/hotspot/jtreg/vmTestbase/gc/g1/unloading/tests/unloading_redefinition_keep_obj/TestDescription.java
new file mode 100644
index 0000000..397c343
--- /dev/null
+++ b/test/hotspot/jtreg/vmTestbase/gc/g1/unloading/tests/unloading_redefinition_keep_obj/TestDescription.java
@@ -0,0 +1,65 @@
+/*
+ * 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.
+ */
+
+
+/*
+ * @test
+ * @key stress gc
+ *
+ * @summary converted from VM Testbase gc/g1/unloading/tests/unloading_redefinition_keep_obj.
+ * VM Testbase keywords: [gc, stress, stressopt, nonconcurrent, javac]
+ *
+ * @modules java.base/jdk.internal.misc
+ * @library /vmTestbase
+ * /test/lib
+ *
+ * @run driver jdk.test.lib.FileInstaller . .
+ *
+ * @comment generate HumongousTemplateClass and compile it to test.classes
+ * @run driver gc.g1.unloading.bytecode.GenClassesBuilder
+ *
+ * @build sun.hotspot.WhiteBox
+ * @run driver ClassFileInstaller sun.hotspot.WhiteBox
+ * sun.hotspot.WhiteBox$WhiteBoxPermission
+ * @run main/othervm
+ * -Xbootclasspath/a:.
+ * -XX:+UnlockDiagnosticVMOptions
+ * -XX:+WhiteBoxAPI
+ * -XX:+UseG1GC
+ * -XX:+ExplicitGCInvokesConcurrent
+ * -Xbootclasspath/a:.
+ * -XX:+UnlockDiagnosticVMOptions
+ * -XX:+WhiteBoxAPI
+ * -XX:+UseG1GC
+ * -XX:+ExplicitGCInvokesConcurrent
+ * -Xlog:gc:gc.log
+ * -XX:-UseGCOverheadLimit
+ * -Xlog:gc:gc.log
+ * -XX:-UseGCOverheadLimit
+ * gc.g1.unloading.UnloadingTest
+ * -redefineClasses
+ * -keep object
+ * -numberOfChecksLimit 4
+ * -stressTime 180
+ */
+
diff --git a/test/hotspot/jtreg/vmTestbase/gc/g1/unloading/tests/unloading_reflection_classloading_inMemoryCompilation_keep_cl/TEST.properties b/test/hotspot/jtreg/vmTestbase/gc/g1/unloading/tests/unloading_reflection_classloading_inMemoryCompilation_keep_cl/TEST.properties
new file mode 100644
index 0000000..04b22a1
--- /dev/null
+++ b/test/hotspot/jtreg/vmTestbase/gc/g1/unloading/tests/unloading_reflection_classloading_inMemoryCompilation_keep_cl/TEST.properties
@@ -0,0 +1,23 @@
+#
+# 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/g1/unloading/tests/unloading_reflection_classloading_inMemoryCompilation_keep_cl/TestDescription.java b/test/hotspot/jtreg/vmTestbase/gc/g1/unloading/tests/unloading_reflection_classloading_inMemoryCompilation_keep_cl/TestDescription.java
new file mode 100644
index 0000000..775fa2d
--- /dev/null
+++ b/test/hotspot/jtreg/vmTestbase/gc/g1/unloading/tests/unloading_reflection_classloading_inMemoryCompilation_keep_cl/TestDescription.java
@@ -0,0 +1,66 @@
+/*
+ * 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.
+ */
+
+
+/*
+ * @test
+ * @key stress gc
+ *
+ * @summary converted from VM Testbase gc/g1/unloading/tests/unloading_reflection_classloading_inMemoryCompilation_keep_cl.
+ * VM Testbase keywords: [gc, stress, stressopt, nonconcurrent, javac]
+ *
+ * @modules java.base/jdk.internal.misc
+ * @library /vmTestbase
+ * /test/lib
+ *
+ * @run driver jdk.test.lib.FileInstaller . .
+ *
+ * @comment generate HumongousTemplateClass and compile it to test.classes
+ * @run driver gc.g1.unloading.bytecode.GenClassesBuilder
+ *
+ * @build sun.hotspot.WhiteBox
+ * @run driver ClassFileInstaller sun.hotspot.WhiteBox
+ * sun.hotspot.WhiteBox$WhiteBoxPermission
+ * @run main/othervm
+ * -Xbootclasspath/a:.
+ * -XX:+UnlockDiagnosticVMOptions
+ * -XX:+WhiteBoxAPI
+ * -XX:+UseG1GC
+ * -XX:+ExplicitGCInvokesConcurrent
+ * -Xbootclasspath/a:.
+ * -XX:+UnlockDiagnosticVMOptions
+ * -XX:+WhiteBoxAPI
+ * -XX:+UseG1GC
+ * -XX:+ExplicitGCInvokesConcurrent
+ * -Xlog:gc:gc.log
+ * -XX:-UseGCOverheadLimit
+ * -Xlog:gc:gc.log
+ * -XX:-UseGCOverheadLimit
+ * gc.g1.unloading.UnloadingTest
+ * -classloadingMethod reflection
+ * -inMemoryCompilation
+ * -keep classloader
+ * -numberOfChecksLimit 4
+ * -stressTime 180
+ */
+
diff --git a/test/hotspot/jtreg/vmTestbase/gc/g1/unloading/tests/unloading_reflection_classloading_inMemoryCompilation_keep_class/TEST.properties b/test/hotspot/jtreg/vmTestbase/gc/g1/unloading/tests/unloading_reflection_classloading_inMemoryCompilation_keep_class/TEST.properties
new file mode 100644
index 0000000..04b22a1
--- /dev/null
+++ b/test/hotspot/jtreg/vmTestbase/gc/g1/unloading/tests/unloading_reflection_classloading_inMemoryCompilation_keep_class/TEST.properties
@@ -0,0 +1,23 @@
+#
+# 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/g1/unloading/tests/unloading_reflection_classloading_inMemoryCompilation_keep_class/TestDescription.java b/test/hotspot/jtreg/vmTestbase/gc/g1/unloading/tests/unloading_reflection_classloading_inMemoryCompilation_keep_class/TestDescription.java
new file mode 100644
index 0000000..1760169
--- /dev/null
+++ b/test/hotspot/jtreg/vmTestbase/gc/g1/unloading/tests/unloading_reflection_classloading_inMemoryCompilation_keep_class/TestDescription.java
@@ -0,0 +1,66 @@
+/*
+ * 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.
+ */
+
+
+/*
+ * @test
+ * @key stress gc
+ *
+ * @summary converted from VM Testbase gc/g1/unloading/tests/unloading_reflection_classloading_inMemoryCompilation_keep_class.
+ * VM Testbase keywords: [gc, stress, stressopt, nonconcurrent, javac]
+ *
+ * @modules java.base/jdk.internal.misc
+ * @library /vmTestbase
+ * /test/lib
+ *
+ * @run driver jdk.test.lib.FileInstaller . .
+ *
+ * @comment generate HumongousTemplateClass and compile it to test.classes
+ * @run driver gc.g1.unloading.bytecode.GenClassesBuilder
+ *
+ * @build sun.hotspot.WhiteBox
+ * @run driver ClassFileInstaller sun.hotspot.WhiteBox
+ * sun.hotspot.WhiteBox$WhiteBoxPermission
+ * @run main/othervm
+ * -Xbootclasspath/a:.
+ * -XX:+UnlockDiagnosticVMOptions
+ * -XX:+WhiteBoxAPI
+ * -XX:+UseG1GC
+ * -XX:+ExplicitGCInvokesConcurrent
+ * -Xbootclasspath/a:.
+ * -XX:+UnlockDiagnosticVMOptions
+ * -XX:+WhiteBoxAPI
+ * -XX:+UseG1GC
+ * -XX:+ExplicitGCInvokesConcurrent
+ * -Xlog:gc:gc.log
+ * -XX:-UseGCOverheadLimit
+ * -Xlog:gc:gc.log
+ * -XX:-UseGCOverheadLimit
+ * gc.g1.unloading.UnloadingTest
+ * -classloadingMethod reflection
+ * -inMemoryCompilation
+ * -keep class
+ * -numberOfChecksLimit 4
+ * -stressTime 180
+ */
+
diff --git a/test/hotspot/jtreg/vmTestbase/gc/g1/unloading/tests/unloading_reflection_classloading_inMemoryCompilation_keep_obj/TEST.properties b/test/hotspot/jtreg/vmTestbase/gc/g1/unloading/tests/unloading_reflection_classloading_inMemoryCompilation_keep_obj/TEST.properties
new file mode 100644
index 0000000..04b22a1
--- /dev/null
+++ b/test/hotspot/jtreg/vmTestbase/gc/g1/unloading/tests/unloading_reflection_classloading_inMemoryCompilation_keep_obj/TEST.properties
@@ -0,0 +1,23 @@
+#
+# 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/g1/unloading/tests/unloading_reflection_classloading_inMemoryCompilation_keep_obj/TestDescription.java b/test/hotspot/jtreg/vmTestbase/gc/g1/unloading/tests/unloading_reflection_classloading_inMemoryCompilation_keep_obj/TestDescription.java
new file mode 100644
index 0000000..07964a7
--- /dev/null
+++ b/test/hotspot/jtreg/vmTestbase/gc/g1/unloading/tests/unloading_reflection_classloading_inMemoryCompilation_keep_obj/TestDescription.java
@@ -0,0 +1,66 @@
+/*
+ * 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.
+ */
+
+
+/*
+ * @test
+ * @key stress gc
+ *
+ * @summary converted from VM Testbase gc/g1/unloading/tests/unloading_reflection_classloading_inMemoryCompilation_keep_obj.
+ * VM Testbase keywords: [gc, stress, stressopt, nonconcurrent, javac]
+ *
+ * @modules java.base/jdk.internal.misc
+ * @library /vmTestbase
+ * /test/lib
+ *
+ * @run driver jdk.test.lib.FileInstaller . .
+ *
+ * @comment generate HumongousTemplateClass and compile it to test.classes
+ * @run driver gc.g1.unloading.bytecode.GenClassesBuilder
+ *
+ * @build sun.hotspot.WhiteBox
+ * @run driver ClassFileInstaller sun.hotspot.WhiteBox
+ * sun.hotspot.WhiteBox$WhiteBoxPermission
+ * @run main/othervm
+ * -Xbootclasspath/a:.
+ * -XX:+UnlockDiagnosticVMOptions
+ * -XX:+WhiteBoxAPI
+ * -XX:+UseG1GC
+ * -XX:+ExplicitGCInvokesConcurrent
+ * -Xbootclasspath/a:.
+ * -XX:+UnlockDiagnosticVMOptions
+ * -XX:+WhiteBoxAPI
+ * -XX:+UseG1GC
+ * -XX:+ExplicitGCInvokesConcurrent
+ * -Xlog:gc:gc.log
+ * -XX:-UseGCOverheadLimit
+ * -Xlog:gc:gc.log
+ * -XX:-UseGCOverheadLimit
+ * gc.g1.unloading.UnloadingTest
+ * -classloadingMethod reflection
+ * -inMemoryCompilation
+ * -keep object
+ * -numberOfChecksLimit 4
+ * -stressTime 180
+ */
+
diff --git a/test/hotspot/jtreg/vmTestbase/gc/g1/unloading/tests/unloading_reflection_classloading_keep_cl/TEST.properties b/test/hotspot/jtreg/vmTestbase/gc/g1/unloading/tests/unloading_reflection_classloading_keep_cl/TEST.properties
new file mode 100644
index 0000000..04b22a1
--- /dev/null
+++ b/test/hotspot/jtreg/vmTestbase/gc/g1/unloading/tests/unloading_reflection_classloading_keep_cl/TEST.properties
@@ -0,0 +1,23 @@
+#
+# 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/g1/unloading/tests/unloading_reflection_classloading_keep_cl/TestDescription.java b/test/hotspot/jtreg/vmTestbase/gc/g1/unloading/tests/unloading_reflection_classloading_keep_cl/TestDescription.java
new file mode 100644
index 0000000..827a27a
--- /dev/null
+++ b/test/hotspot/jtreg/vmTestbase/gc/g1/unloading/tests/unloading_reflection_classloading_keep_cl/TestDescription.java
@@ -0,0 +1,65 @@
+/*
+ * 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.
+ */
+
+
+/*
+ * @test
+ * @key stress gc
+ *
+ * @summary converted from VM Testbase gc/g1/unloading/tests/unloading_reflection_classloading_keep_cl.
+ * VM Testbase keywords: [gc, stress, stressopt, nonconcurrent, javac]
+ *
+ * @modules java.base/jdk.internal.misc
+ * @library /vmTestbase
+ * /test/lib
+ *
+ * @run driver jdk.test.lib.FileInstaller . .
+ *
+ * @comment generate HumongousTemplateClass and compile it to test.classes
+ * @run driver gc.g1.unloading.bytecode.GenClassesBuilder
+ *
+ * @build sun.hotspot.WhiteBox
+ * @run driver ClassFileInstaller sun.hotspot.WhiteBox
+ * sun.hotspot.WhiteBox$WhiteBoxPermission
+ * @run main/othervm
+ * -Xbootclasspath/a:.
+ * -XX:+UnlockDiagnosticVMOptions
+ * -XX:+WhiteBoxAPI
+ * -XX:+UseG1GC
+ * -XX:+ExplicitGCInvokesConcurrent
+ * -Xbootclasspath/a:.
+ * -XX:+UnlockDiagnosticVMOptions
+ * -XX:+WhiteBoxAPI
+ * -XX:+UseG1GC
+ * -XX:+ExplicitGCInvokesConcurrent
+ * -Xlog:gc:gc.log
+ * -XX:-UseGCOverheadLimit
+ * -Xlog:gc:gc.log
+ * -XX:-UseGCOverheadLimit
+ * gc.g1.unloading.UnloadingTest
+ * -classloadingMethod reflection
+ * -keep classloader
+ * -numberOfChecksLimit 4
+ * -stressTime 180
+ */
+
diff --git a/test/hotspot/jtreg/vmTestbase/gc/g1/unloading/tests/unloading_reflection_classloading_keep_class/TEST.properties b/test/hotspot/jtreg/vmTestbase/gc/g1/unloading/tests/unloading_reflection_classloading_keep_class/TEST.properties
new file mode 100644
index 0000000..04b22a1
--- /dev/null
+++ b/test/hotspot/jtreg/vmTestbase/gc/g1/unloading/tests/unloading_reflection_classloading_keep_class/TEST.properties
@@ -0,0 +1,23 @@
+#
+# 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/g1/unloading/tests/unloading_reflection_classloading_keep_class/TestDescription.java b/test/hotspot/jtreg/vmTestbase/gc/g1/unloading/tests/unloading_reflection_classloading_keep_class/TestDescription.java
new file mode 100644
index 0000000..2877746
--- /dev/null
+++ b/test/hotspot/jtreg/vmTestbase/gc/g1/unloading/tests/unloading_reflection_classloading_keep_class/TestDescription.java
@@ -0,0 +1,65 @@
+/*
+ * 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.
+ */
+
+
+/*
+ * @test
+ * @key stress gc
+ *
+ * @summary converted from VM Testbase gc/g1/unloading/tests/unloading_reflection_classloading_keep_class.
+ * VM Testbase keywords: [gc, stress, stressopt, nonconcurrent, javac]
+ *
+ * @modules java.base/jdk.internal.misc
+ * @library /vmTestbase
+ * /test/lib
+ *
+ * @run driver jdk.test.lib.FileInstaller . .
+ *
+ * @comment generate HumongousTemplateClass and compile it to test.classes
+ * @run driver gc.g1.unloading.bytecode.GenClassesBuilder
+ *
+ * @build sun.hotspot.WhiteBox
+ * @run driver ClassFileInstaller sun.hotspot.WhiteBox
+ * sun.hotspot.WhiteBox$WhiteBoxPermission
+ * @run main/othervm
+ * -Xbootclasspath/a:.
+ * -XX:+UnlockDiagnosticVMOptions
+ * -XX:+WhiteBoxAPI
+ * -XX:+UseG1GC
+ * -XX:+ExplicitGCInvokesConcurrent
+ * -Xbootclasspath/a:.
+ * -XX:+UnlockDiagnosticVMOptions
+ * -XX:+WhiteBoxAPI
+ * -XX:+UseG1GC
+ * -XX:+ExplicitGCInvokesConcurrent
+ * -Xlog:gc:gc.log
+ * -XX:-UseGCOverheadLimit
+ * -Xlog:gc:gc.log
+ * -XX:-UseGCOverheadLimit
+ * gc.g1.unloading.UnloadingTest
+ * -classloadingMethod reflection
+ * -keep class
+ * -numberOfChecksLimit 4
+ * -stressTime 180
+ */
+
diff --git a/test/hotspot/jtreg/vmTestbase/gc/g1/unloading/tests/unloading_reflection_classloading_keep_obj/TEST.properties b/test/hotspot/jtreg/vmTestbase/gc/g1/unloading/tests/unloading_reflection_classloading_keep_obj/TEST.properties
new file mode 100644
index 0000000..04b22a1
--- /dev/null
+++ b/test/hotspot/jtreg/vmTestbase/gc/g1/unloading/tests/unloading_reflection_classloading_keep_obj/TEST.properties
@@ -0,0 +1,23 @@
+#
+# 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/g1/unloading/tests/unloading_reflection_classloading_keep_obj/TestDescription.java b/test/hotspot/jtreg/vmTestbase/gc/g1/unloading/tests/unloading_reflection_classloading_keep_obj/TestDescription.java
new file mode 100644
index 0000000..7892ea7
--- /dev/null
+++ b/test/hotspot/jtreg/vmTestbase/gc/g1/unloading/tests/unloading_reflection_classloading_keep_obj/TestDescription.java
@@ -0,0 +1,65 @@
+/*
+ * 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.
+ */
+
+
+/*
+ * @test
+ * @key stress gc
+ *
+ * @summary converted from VM Testbase gc/g1/unloading/tests/unloading_reflection_classloading_keep_obj.
+ * VM Testbase keywords: [gc, stress, stressopt, nonconcurrent, javac]
+ *
+ * @modules java.base/jdk.internal.misc
+ * @library /vmTestbase
+ * /test/lib
+ *
+ * @run driver jdk.test.lib.FileInstaller . .
+ *
+ * @comment generate HumongousTemplateClass and compile it to test.classes
+ * @run driver gc.g1.unloading.bytecode.GenClassesBuilder
+ *
+ * @build sun.hotspot.WhiteBox
+ * @run driver ClassFileInstaller sun.hotspot.WhiteBox
+ * sun.hotspot.WhiteBox$WhiteBoxPermission
+ * @run main/othervm
+ * -Xbootclasspath/a:.
+ * -XX:+UnlockDiagnosticVMOptions
+ * -XX:+WhiteBoxAPI
+ * -XX:+UseG1GC
+ * -XX:+ExplicitGCInvokesConcurrent
+ * -Xbootclasspath/a:.
+ * -XX:+UnlockDiagnosticVMOptions
+ * -XX:+WhiteBoxAPI
+ * -XX:+UseG1GC
+ * -XX:+ExplicitGCInvokesConcurrent
+ * -Xlog:gc:gc.log
+ * -XX:-UseGCOverheadLimit
+ * -Xlog:gc:gc.log
+ * -XX:-UseGCOverheadLimit
+ * gc.g1.unloading.UnloadingTest
+ * -classloadingMethod reflection
+ * -keep object
+ * -numberOfChecksLimit 4
+ * -stressTime 180
+ */
+
diff --git a/test/hotspot/jtreg/vmTestbase/gc/g1/unloading/tests/unloading_weak_ref_inMemoryCompilation_keep_cl/TEST.properties b/test/hotspot/jtreg/vmTestbase/gc/g1/unloading/tests/unloading_weak_ref_inMemoryCompilation_keep_cl/TEST.properties
new file mode 100644
index 0000000..04b22a1
--- /dev/null
+++ b/test/hotspot/jtreg/vmTestbase/gc/g1/unloading/tests/unloading_weak_ref_inMemoryCompilation_keep_cl/TEST.properties
@@ -0,0 +1,23 @@
+#
+# 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/g1/unloading/tests/unloading_weak_ref_inMemoryCompilation_keep_cl/TestDescription.java b/test/hotspot/jtreg/vmTestbase/gc/g1/unloading/tests/unloading_weak_ref_inMemoryCompilation_keep_cl/TestDescription.java
new file mode 100644
index 0000000..30db58c
--- /dev/null
+++ b/test/hotspot/jtreg/vmTestbase/gc/g1/unloading/tests/unloading_weak_ref_inMemoryCompilation_keep_cl/TestDescription.java
@@ -0,0 +1,66 @@
+/*
+ * 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.
+ */
+
+
+/*
+ * @test
+ * @key stress gc
+ *
+ * @summary converted from VM Testbase gc/g1/unloading/tests/unloading_weak_ref_inMemoryCompilation_keep_cl.
+ * VM Testbase keywords: [gc, stress, stressopt, nonconcurrent, javac]
+ *
+ * @modules java.base/jdk.internal.misc
+ * @library /vmTestbase
+ * /test/lib
+ *
+ * @run driver jdk.test.lib.FileInstaller . .
+ *
+ * @comment generate HumongousTemplateClass and compile it to test.classes
+ * @run driver gc.g1.unloading.bytecode.GenClassesBuilder
+ *
+ * @build sun.hotspot.WhiteBox
+ * @run driver ClassFileInstaller sun.hotspot.WhiteBox
+ * sun.hotspot.WhiteBox$WhiteBoxPermission
+ * @run main/othervm
+ * -Xbootclasspath/a:.
+ * -XX:+UnlockDiagnosticVMOptions
+ * -XX:+WhiteBoxAPI
+ * -XX:+UseG1GC
+ * -XX:+ExplicitGCInvokesConcurrent
+ * -Xbootclasspath/a:.
+ * -XX:+UnlockDiagnosticVMOptions
+ * -XX:+WhiteBoxAPI
+ * -XX:+UseG1GC
+ * -XX:+ExplicitGCInvokesConcurrent
+ * -Xlog:gc:gc.log
+ * -XX:-UseGCOverheadLimit
+ * -Xlog:gc:gc.log
+ * -XX:-UseGCOverheadLimit
+ * gc.g1.unloading.UnloadingTest
+ * -referenceMode weak
+ * -inMemoryCompilation
+ * -keep classloader
+ * -numberOfChecksLimit 4
+ * -stressTime 180
+ */
+
diff --git a/test/hotspot/jtreg/vmTestbase/gc/g1/unloading/tests/unloading_weak_ref_inMemoryCompilation_keep_class/TEST.properties b/test/hotspot/jtreg/vmTestbase/gc/g1/unloading/tests/unloading_weak_ref_inMemoryCompilation_keep_class/TEST.properties
new file mode 100644
index 0000000..04b22a1
--- /dev/null
+++ b/test/hotspot/jtreg/vmTestbase/gc/g1/unloading/tests/unloading_weak_ref_inMemoryCompilation_keep_class/TEST.properties
@@ -0,0 +1,23 @@
+#
+# 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/g1/unloading/tests/unloading_weak_ref_inMemoryCompilation_keep_class/TestDescription.java b/test/hotspot/jtreg/vmTestbase/gc/g1/unloading/tests/unloading_weak_ref_inMemoryCompilation_keep_class/TestDescription.java
new file mode 100644
index 0000000..eb72672
--- /dev/null
+++ b/test/hotspot/jtreg/vmTestbase/gc/g1/unloading/tests/unloading_weak_ref_inMemoryCompilation_keep_class/TestDescription.java
@@ -0,0 +1,66 @@
+/*
+ * 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.
+ */
+
+
+/*
+ * @test
+ * @key stress gc
+ *
+ * @summary converted from VM Testbase gc/g1/unloading/tests/unloading_weak_ref_inMemoryCompilation_keep_class.
+ * VM Testbase keywords: [gc, stress, stressopt, nonconcurrent, javac]
+ *
+ * @modules java.base/jdk.internal.misc
+ * @library /vmTestbase
+ * /test/lib
+ *
+ * @run driver jdk.test.lib.FileInstaller . .
+ *
+ * @comment generate HumongousTemplateClass and compile it to test.classes
+ * @run driver gc.g1.unloading.bytecode.GenClassesBuilder
+ *
+ * @build sun.hotspot.WhiteBox
+ * @run driver ClassFileInstaller sun.hotspot.WhiteBox
+ * sun.hotspot.WhiteBox$WhiteBoxPermission
+ * @run main/othervm
+ * -Xbootclasspath/a:.
+ * -XX:+UnlockDiagnosticVMOptions
+ * -XX:+WhiteBoxAPI
+ * -XX:+UseG1GC
+ * -XX:+ExplicitGCInvokesConcurrent
+ * -Xbootclasspath/a:.
+ * -XX:+UnlockDiagnosticVMOptions
+ * -XX:+WhiteBoxAPI
+ * -XX:+UseG1GC
+ * -XX:+ExplicitGCInvokesConcurrent
+ * -Xlog:gc:gc.log
+ * -XX:-UseGCOverheadLimit
+ * -Xlog:gc:gc.log
+ * -XX:-UseGCOverheadLimit
+ * gc.g1.unloading.UnloadingTest
+ * -referenceMode weak
+ * -inMemoryCompilation
+ * -keep class
+ * -numberOfChecksLimit 4
+ * -stressTime 180
+ */
+
diff --git a/test/hotspot/jtreg/vmTestbase/gc/g1/unloading/tests/unloading_weak_ref_inMemoryCompilation_keep_obj/TEST.properties b/test/hotspot/jtreg/vmTestbase/gc/g1/unloading/tests/unloading_weak_ref_inMemoryCompilation_keep_obj/TEST.properties
new file mode 100644
index 0000000..04b22a1
--- /dev/null
+++ b/test/hotspot/jtreg/vmTestbase/gc/g1/unloading/tests/unloading_weak_ref_inMemoryCompilation_keep_obj/TEST.properties
@@ -0,0 +1,23 @@
+#
+# 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/g1/unloading/tests/unloading_weak_ref_inMemoryCompilation_keep_obj/TestDescription.java b/test/hotspot/jtreg/vmTestbase/gc/g1/unloading/tests/unloading_weak_ref_inMemoryCompilation_keep_obj/TestDescription.java
new file mode 100644
index 0000000..2611076
--- /dev/null
+++ b/test/hotspot/jtreg/vmTestbase/gc/g1/unloading/tests/unloading_weak_ref_inMemoryCompilation_keep_obj/TestDescription.java
@@ -0,0 +1,66 @@
+/*
+ * 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.
+ */
+
+
+/*
+ * @test
+ * @key stress gc
+ *
+ * @summary converted from VM Testbase gc/g1/unloading/tests/unloading_weak_ref_inMemoryCompilation_keep_obj.
+ * VM Testbase keywords: [gc, stress, stressopt, nonconcurrent, javac]
+ *
+ * @modules java.base/jdk.internal.misc
+ * @library /vmTestbase
+ * /test/lib
+ *
+ * @run driver jdk.test.lib.FileInstaller . .
+ *
+ * @comment generate HumongousTemplateClass and compile it to test.classes
+ * @run driver gc.g1.unloading.bytecode.GenClassesBuilder
+ *
+ * @build sun.hotspot.WhiteBox
+ * @run driver ClassFileInstaller sun.hotspot.WhiteBox
+ * sun.hotspot.WhiteBox$WhiteBoxPermission
+ * @run main/othervm
+ * -Xbootclasspath/a:.
+ * -XX:+UnlockDiagnosticVMOptions
+ * -XX:+WhiteBoxAPI
+ * -XX:+UseG1GC
+ * -XX:+ExplicitGCInvokesConcurrent
+ * -Xbootclasspath/a:.
+ * -XX:+UnlockDiagnosticVMOptions
+ * -XX:+WhiteBoxAPI
+ * -XX:+UseG1GC
+ * -XX:+ExplicitGCInvokesConcurrent
+ * -Xlog:gc:gc.log
+ * -XX:-UseGCOverheadLimit
+ * -Xlog:gc:gc.log
+ * -XX:-UseGCOverheadLimit
+ * gc.g1.unloading.UnloadingTest
+ * -referenceMode weak
+ * -inMemoryCompilation
+ * -keep object
+ * -numberOfChecksLimit 4
+ * -stressTime 180
+ */
+
diff --git a/test/hotspot/jtreg/vmTestbase/gc/g1/unloading/tests/unloading_weak_ref_keep_cl/TEST.properties b/test/hotspot/jtreg/vmTestbase/gc/g1/unloading/tests/unloading_weak_ref_keep_cl/TEST.properties
new file mode 100644
index 0000000..04b22a1
--- /dev/null
+++ b/test/hotspot/jtreg/vmTestbase/gc/g1/unloading/tests/unloading_weak_ref_keep_cl/TEST.properties
@@ -0,0 +1,23 @@
+#
+# 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/g1/unloading/tests/unloading_weak_ref_keep_cl/TestDescription.java b/test/hotspot/jtreg/vmTestbase/gc/g1/unloading/tests/unloading_weak_ref_keep_cl/TestDescription.java
new file mode 100644
index 0000000..18dd805
--- /dev/null
+++ b/test/hotspot/jtreg/vmTestbase/gc/g1/unloading/tests/unloading_weak_ref_keep_cl/TestDescription.java
@@ -0,0 +1,65 @@
+/*
+ * 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.
+ */
+
+
+/*
+ * @test
+ * @key stress gc
+ *
+ * @summary converted from VM Testbase gc/g1/unloading/tests/unloading_weak_ref_keep_cl.
+ * VM Testbase keywords: [gc, stress, stressopt, nonconcurrent, javac]
+ *
+ * @modules java.base/jdk.internal.misc
+ * @library /vmTestbase
+ * /test/lib
+ *
+ * @run driver jdk.test.lib.FileInstaller . .
+ *
+ * @comment generate HumongousTemplateClass and compile it to test.classes
+ * @run driver gc.g1.unloading.bytecode.GenClassesBuilder
+ *
+ * @build sun.hotspot.WhiteBox
+ * @run driver ClassFileInstaller sun.hotspot.WhiteBox
+ * sun.hotspot.WhiteBox$WhiteBoxPermission
+ * @run main/othervm
+ * -Xbootclasspath/a:.
+ * -XX:+UnlockDiagnosticVMOptions
+ * -XX:+WhiteBoxAPI
+ * -XX:+UseG1GC
+ * -XX:+ExplicitGCInvokesConcurrent
+ * -Xbootclasspath/a:.
+ * -XX:+UnlockDiagnosticVMOptions
+ * -XX:+WhiteBoxAPI
+ * -XX:+UseG1GC
+ * -XX:+ExplicitGCInvokesConcurrent
+ * -Xlog:gc:gc.log
+ * -XX:-UseGCOverheadLimit
+ * -Xlog:gc:gc.log
+ * -XX:-UseGCOverheadLimit
+ * gc.g1.unloading.UnloadingTest
+ * -referenceMode weak
+ * -keep classloader
+ * -numberOfChecksLimit 4
+ * -stressTime 180
+ */
+
diff --git a/test/hotspot/jtreg/vmTestbase/gc/g1/unloading/tests/unloading_weak_ref_keep_class/TEST.properties b/test/hotspot/jtreg/vmTestbase/gc/g1/unloading/tests/unloading_weak_ref_keep_class/TEST.properties
new file mode 100644
index 0000000..04b22a1
--- /dev/null
+++ b/test/hotspot/jtreg/vmTestbase/gc/g1/unloading/tests/unloading_weak_ref_keep_class/TEST.properties
@@ -0,0 +1,23 @@
+#
+# 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/g1/unloading/tests/unloading_weak_ref_keep_class/TestDescription.java b/test/hotspot/jtreg/vmTestbase/gc/g1/unloading/tests/unloading_weak_ref_keep_class/TestDescription.java
new file mode 100644
index 0000000..2dc9bab
--- /dev/null
+++ b/test/hotspot/jtreg/vmTestbase/gc/g1/unloading/tests/unloading_weak_ref_keep_class/TestDescription.java
@@ -0,0 +1,65 @@
+/*
+ * 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.
+ */
+
+
+/*
+ * @test
+ * @key stress gc
+ *
+ * @summary converted from VM Testbase gc/g1/unloading/tests/unloading_weak_ref_keep_class.
+ * VM Testbase keywords: [gc, stress, stressopt, nonconcurrent, javac]
+ *
+ * @modules java.base/jdk.internal.misc
+ * @library /vmTestbase
+ * /test/lib
+ *
+ * @run driver jdk.test.lib.FileInstaller . .
+ *
+ * @comment generate HumongousTemplateClass and compile it to test.classes
+ * @run driver gc.g1.unloading.bytecode.GenClassesBuilder
+ *
+ * @build sun.hotspot.WhiteBox
+ * @run driver ClassFileInstaller sun.hotspot.WhiteBox
+ * sun.hotspot.WhiteBox$WhiteBoxPermission
+ * @run main/othervm
+ * -Xbootclasspath/a:.
+ * -XX:+UnlockDiagnosticVMOptions
+ * -XX:+WhiteBoxAPI
+ * -XX:+UseG1GC
+ * -XX:+ExplicitGCInvokesConcurrent
+ * -Xbootclasspath/a:.
+ * -XX:+UnlockDiagnosticVMOptions
+ * -XX:+WhiteBoxAPI
+ * -XX:+UseG1GC
+ * -XX:+ExplicitGCInvokesConcurrent
+ * -Xlog:gc:gc.log
+ * -XX:-UseGCOverheadLimit
+ * -Xlog:gc:gc.log
+ * -XX:-UseGCOverheadLimit
+ * gc.g1.unloading.UnloadingTest
+ * -referenceMode weak
+ * -keep class
+ * -numberOfChecksLimit 4
+ * -stressTime 180
+ */
+
diff --git a/test/hotspot/jtreg/vmTestbase/gc/g1/unloading/tests/unloading_weak_ref_keep_obj/TEST.properties b/test/hotspot/jtreg/vmTestbase/gc/g1/unloading/tests/unloading_weak_ref_keep_obj/TEST.properties
new file mode 100644
index 0000000..04b22a1
--- /dev/null
+++ b/test/hotspot/jtreg/vmTestbase/gc/g1/unloading/tests/unloading_weak_ref_keep_obj/TEST.properties
@@ -0,0 +1,23 @@
+#
+# 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/g1/unloading/tests/unloading_weak_ref_keep_obj/TestDescription.java b/test/hotspot/jtreg/vmTestbase/gc/g1/unloading/tests/unloading_weak_ref_keep_obj/TestDescription.java
new file mode 100644
index 0000000..e9e24ba
--- /dev/null
+++ b/test/hotspot/jtreg/vmTestbase/gc/g1/unloading/tests/unloading_weak_ref_keep_obj/TestDescription.java
@@ -0,0 +1,65 @@
+/*
+ * 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.
+ */
+
+
+/*
+ * @test
+ * @key stress gc
+ *
+ * @summary converted from VM Testbase gc/g1/unloading/tests/unloading_weak_ref_keep_obj.
+ * VM Testbase keywords: [gc, stress, stressopt, nonconcurrent, javac]
+ *
+ * @modules java.base/jdk.internal.misc
+ * @library /vmTestbase
+ * /test/lib
+ *
+ * @run driver jdk.test.lib.FileInstaller . .
+ *
+ * @comment generate HumongousTemplateClass and compile it to test.classes
+ * @run driver gc.g1.unloading.bytecode.GenClassesBuilder
+ *
+ * @build sun.hotspot.WhiteBox
+ * @run driver ClassFileInstaller sun.hotspot.WhiteBox
+ * sun.hotspot.WhiteBox$WhiteBoxPermission
+ * @run main/othervm
+ * -Xbootclasspath/a:.
+ * -XX:+UnlockDiagnosticVMOptions
+ * -XX:+WhiteBoxAPI
+ * -XX:+UseG1GC
+ * -XX:+ExplicitGCInvokesConcurrent
+ * -Xbootclasspath/a:.
+ * -XX:+UnlockDiagnosticVMOptions
+ * -XX:+WhiteBoxAPI
+ * -XX:+UseG1GC
+ * -XX:+ExplicitGCInvokesConcurrent
+ * -Xlog:gc:gc.log
+ * -XX:-UseGCOverheadLimit
+ * -Xlog:gc:gc.log
+ * -XX:-UseGCOverheadLimit
+ * gc.g1.unloading.UnloadingTest
+ * -referenceMode weak
+ * -keep object
+ * -numberOfChecksLimit 4
+ * -stressTime 180
+ */
+