< prev index next >

test/compiler/codecache/cli/TestSegmentedCodeCacheOption.java

Print this page




  11  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  12  * version 2 for more details (a copy is included in the LICENSE file that
  13  * accompanied this code).
  14  *
  15  * You should have received a copy of the GNU General Public License version
  16  * 2 along with this work; if not, write to the Free Software Foundation,
  17  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  18  *
  19  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  20  * or visit www.oracle.com if you need additional information or have any
  21  * questions.
  22  */
  23 import com.oracle.java.testlibrary.ExitCode;
  24 import com.oracle.java.testlibrary.Platform;
  25 import com.oracle.java.testlibrary.cli.CommandLineOptionTest;
  26 import common.CodeCacheOptions;
  27 import sun.hotspot.code.BlobType;
  28 
  29 /**
  30  * @test

  31  * @summary Verify SegmentedCodeCache option's processing
  32  * @library /testlibrary /testlibrary/whitebox
  33  * @build TestSegmentedCodeCacheOption com.oracle.java.testlibrary.*
  34  * @run main TestSegmentedCodeCacheOption
  35  */
  36 public class TestSegmentedCodeCacheOption {
  37     private static final String INT_MODE = "-Xint";
  38     private static final String TIERED_COMPILATION = "TieredCompilation";
  39     private static final String SEGMENTED_CODE_CACHE = "SegmentedCodeCache";
  40     private static final String USE_SEGMENTED_CODE_CACHE
  41             = CommandLineOptionTest.prepareBooleanFlag(SEGMENTED_CODE_CACHE,
  42                     true);
  43     private static final long THRESHOLD_CC_SIZE_VALUE
  44             = CodeCacheOptions.mB(240);
  45     private static final long BELOW_THRESHOLD_CC_SIZE
  46             = THRESHOLD_CC_SIZE_VALUE - CodeCacheOptions.mB(1);
  47     private static final String[] UNEXPECTED_MESSAGES = new String[] {
  48             ".*" + SEGMENTED_CODE_CACHE + ".*"
  49     };
  50 
  51 
  52     private static enum TestCase {


  64                         testCaseExitCodeMessage, testCaseWarningMessage,
  65                         ExitCode.OK, USE_SEGMENTED_CODE_CACHE);
  66                 // ... and when we're trying to enable it w/o TieredCompilation
  67                 testCaseExitCodeMessage = "Disabled tiered compilation should "
  68                         + "not cause startup failure w/ "
  69                         + USE_SEGMENTED_CODE_CACHE;
  70 
  71                 CommandLineOptionTest.verifySameJVMStartup(
  72                         /* expectedMessages */ null, UNEXPECTED_MESSAGES,
  73                         testCaseExitCodeMessage, testCaseWarningMessage,
  74                         ExitCode.OK, USE_SEGMENTED_CODE_CACHE,
  75                         CommandLineOptionTest.prepareBooleanFlag(
  76                                 TIERED_COMPILATION, false));
  77                 // ... and even w/ Xint.
  78                 testCaseExitCodeMessage = "It should be possible to use "
  79                         + USE_SEGMENTED_CODE_CACHE + " in interpreted mode "
  80                         + "without any errors.";
  81 
  82                 CommandLineOptionTest.verifyJVMStartup(
  83                         /* expected messages */ null, UNEXPECTED_MESSAGES,
  84                         ExitCode.OK, testCaseExitCodeMessage,
  85                         testCaseWarningMessage, false, INT_MODE,
  86                         USE_SEGMENTED_CODE_CACHE);
  87             }
  88         },
  89         OPTION_VALUES_GENERIC {
  90             @Override
  91             public void run() throws Throwable {
  92                 // SCC is disabled w/o TieredCompilation by default
  93                 String errorMessage = SEGMENTED_CODE_CACHE
  94                         + " should be disabled by default  when tiered "
  95                         + "compilation is disabled";
  96 
  97                 CommandLineOptionTest.verifyOptionValueForSameVM(
  98                         SEGMENTED_CODE_CACHE, "false", errorMessage,
  99                         CommandLineOptionTest.prepareBooleanFlag(
 100                                 TIERED_COMPILATION, false));
 101                 // SCC is disabled by default when ReservedCodeCacheSize is too
 102                 // small
 103                 errorMessage = String.format("%s should be disabled bu default "
 104                         + "when %s value is too small.", SEGMENTED_CODE_CACHE,
 105                         BlobType.All.sizeOptionName);
 106 




  11  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  12  * version 2 for more details (a copy is included in the LICENSE file that
  13  * accompanied this code).
  14  *
  15  * You should have received a copy of the GNU General Public License version
  16  * 2 along with this work; if not, write to the Free Software Foundation,
  17  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  18  *
  19  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  20  * or visit www.oracle.com if you need additional information or have any
  21  * questions.
  22  */
  23 import com.oracle.java.testlibrary.ExitCode;
  24 import com.oracle.java.testlibrary.Platform;
  25 import com.oracle.java.testlibrary.cli.CommandLineOptionTest;
  26 import common.CodeCacheOptions;
  27 import sun.hotspot.code.BlobType;
  28 
  29 /**
  30  * @test
  31  * @bug 8015774
  32  * @summary Verify SegmentedCodeCache option's processing
  33  * @library /testlibrary /../../test/lib
  34  * @build TestSegmentedCodeCacheOption com.oracle.java.testlibrary.*
  35  * @run main TestSegmentedCodeCacheOption
  36  */
  37 public class TestSegmentedCodeCacheOption {
  38     private static final String INT_MODE = "-Xint";
  39     private static final String TIERED_COMPILATION = "TieredCompilation";
  40     private static final String SEGMENTED_CODE_CACHE = "SegmentedCodeCache";
  41     private static final String USE_SEGMENTED_CODE_CACHE
  42             = CommandLineOptionTest.prepareBooleanFlag(SEGMENTED_CODE_CACHE,
  43                     true);
  44     private static final long THRESHOLD_CC_SIZE_VALUE
  45             = CodeCacheOptions.mB(240);
  46     private static final long BELOW_THRESHOLD_CC_SIZE
  47             = THRESHOLD_CC_SIZE_VALUE - CodeCacheOptions.mB(1);
  48     private static final String[] UNEXPECTED_MESSAGES = new String[] {
  49             ".*" + SEGMENTED_CODE_CACHE + ".*"
  50     };
  51 
  52 
  53     private static enum TestCase {


  65                         testCaseExitCodeMessage, testCaseWarningMessage,
  66                         ExitCode.OK, USE_SEGMENTED_CODE_CACHE);
  67                 // ... and when we're trying to enable it w/o TieredCompilation
  68                 testCaseExitCodeMessage = "Disabled tiered compilation should "
  69                         + "not cause startup failure w/ "
  70                         + USE_SEGMENTED_CODE_CACHE;
  71 
  72                 CommandLineOptionTest.verifySameJVMStartup(
  73                         /* expectedMessages */ null, UNEXPECTED_MESSAGES,
  74                         testCaseExitCodeMessage, testCaseWarningMessage,
  75                         ExitCode.OK, USE_SEGMENTED_CODE_CACHE,
  76                         CommandLineOptionTest.prepareBooleanFlag(
  77                                 TIERED_COMPILATION, false));
  78                 // ... and even w/ Xint.
  79                 testCaseExitCodeMessage = "It should be possible to use "
  80                         + USE_SEGMENTED_CODE_CACHE + " in interpreted mode "
  81                         + "without any errors.";
  82 
  83                 CommandLineOptionTest.verifyJVMStartup(
  84                         /* expected messages */ null, UNEXPECTED_MESSAGES,
  85                         testCaseExitCodeMessage, testCaseWarningMessage,
  86                         ExitCode.OK, false, INT_MODE, USE_SEGMENTED_CODE_CACHE);

  87             }
  88         },
  89         OPTION_VALUES_GENERIC {
  90             @Override
  91             public void run() throws Throwable {
  92                 // SCC is disabled w/o TieredCompilation by default
  93                 String errorMessage = SEGMENTED_CODE_CACHE
  94                         + " should be disabled by default  when tiered "
  95                         + "compilation is disabled";
  96 
  97                 CommandLineOptionTest.verifyOptionValueForSameVM(
  98                         SEGMENTED_CODE_CACHE, "false", errorMessage,
  99                         CommandLineOptionTest.prepareBooleanFlag(
 100                                 TIERED_COMPILATION, false));
 101                 // SCC is disabled by default when ReservedCodeCacheSize is too
 102                 // small
 103                 errorMessage = String.format("%s should be disabled bu default "
 104                         + "when %s value is too small.", SEGMENTED_CODE_CACHE,
 105                         BlobType.All.sizeOptionName);
 106 


< prev index next >