Fri, 04 Oct 2013 09:19:13 +0200
8025656: compiler/8013496/Test8013496.sh fails on assert
Summary: Ensure the thread is in correct state; rewrote test in Java
Reviewed-by: kvn, twisti
1.1 --- a/src/share/vm/compiler/compileBroker.cpp Wed Oct 02 06:17:10 2013 -0700 1.2 +++ b/src/share/vm/compiler/compileBroker.cpp Fri Oct 04 09:19:13 2013 +0200 1.3 @@ -1953,6 +1953,10 @@ 1.4 // Since code cache is full, immediately stop new compiles 1.5 if (CompileBroker::set_should_compile_new_jobs(CompileBroker::stop_compilation)) { 1.6 NMethodSweeper::log_sweep("disable_compiler"); 1.7 + 1.8 + // Switch to 'vm_state'. This ensures that possibly_sweep() can be called 1.9 + // without having to consider the state in which the current thread is. 1.10 + ThreadInVMfromUnknown in_vm; 1.11 NMethodSweeper::possibly_sweep(); 1.12 } 1.13 } else {
2.1 --- a/test/compiler/8013496/Test8013496.sh Wed Oct 02 06:17:10 2013 -0700 2.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 2.3 @@ -1,55 +0,0 @@ 2.4 -#!/bin/sh 2.5 -# 2.6 -# Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved. 2.7 -# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 2.8 -# 2.9 -# This code is free software; you can redistribute it and/or modify it 2.10 -# under the terms of the GNU General Public License version 2 only, as 2.11 -# published by the Free Software Foundation. 2.12 -# 2.13 -# This code is distributed in the hope that it will be useful, but WITHOUT 2.14 -# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 2.15 -# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 2.16 -# version 2 for more details (a copy is included in the LICENSE file that 2.17 -# accompanied this code). 2.18 -# 2.19 -# You should have received a copy of the GNU General Public License version 2.20 -# 2 along with this work; if not, write to the Free Software Foundation, 2.21 -# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 2.22 -# 2.23 -# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 2.24 -# or visit www.oracle.com if you need additional information or have any 2.25 -# questions. 2.26 -# 2.27 -# 2.28 -# @test 2.29 -# @bug 8013496 2.30 -# @summary Test checks that the order in which ReversedCodeCacheSize and 2.31 -# InitialCodeCacheSize are passed to the VM is irrelevant. 2.32 -# @run shell Test8013496.sh 2.33 -# 2.34 -# 2.35 -## some tests require path to find test source dir 2.36 -if [ "${TESTSRC}" = "" ] 2.37 -then 2.38 - TESTSRC=${PWD} 2.39 - echo "TESTSRC not set. Using "${TESTSRC}" as default" 2.40 -fi 2.41 -echo "TESTSRC=${TESTSRC}" 2.42 -## Adding common setup Variables for running shell tests. 2.43 -. ${TESTSRC}/../../test_env.sh 2.44 -set -x 2.45 - 2.46 -${TESTJAVA}/bin/java ${TESTVMOPTS} -XX:ReservedCodeCacheSize=2m -XX:InitialCodeCacheSize=500K -version > 1.out 2>&1 2.47 -${TESTJAVA}/bin/java ${TESTVMOPTS} -XX:InitialCodeCacheSize=500K -XX:ReservedCodeCacheSize=2m -version > 2.out 2>&1 2.48 - 2.49 -diff 1.out 2.out 2.50 - 2.51 -result=$? 2.52 -if [ $result -eq 0 ] ; then 2.53 - echo "Test Passed" 2.54 - exit 0 2.55 -else 2.56 - echo "Test Failed" 2.57 - exit 1 2.58 -fi
3.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 3.2 +++ b/test/compiler/codecache/CheckReservedInitialCodeCacheSizeArgOrder.java Fri Oct 04 09:19:13 2013 +0200 3.3 @@ -0,0 +1,53 @@ 3.4 +/* 3.5 + * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved. 3.6 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 3.7 + * 3.8 + * This code is free software; you can redistribute it and/or modify it 3.9 + * under the terms of the GNU General Public License version 2 only, as 3.10 + * published by the Free Software Foundation. 3.11 + * 3.12 + * This code is distributed in the hope that it will be useful, but WITHOUT 3.13 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 3.14 + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 3.15 + * version 2 for more details (a copy is included in the LICENSE file that 3.16 + * accompanied this code). 3.17 + * 3.18 + * You should have received a copy of the GNU General Public License version 3.19 + * 2 along with this work; if not, write to the Free Software Foundation, 3.20 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 3.21 + * 3.22 + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 3.23 + * or visit www.oracle.com if you need additional information or have any 3.24 + * questions. 3.25 + */ 3.26 + 3.27 +/* 3.28 + * @test 3.29 + * @bug 8013496 3.30 + * @summary Test checks that the order in which ReversedCodeCacheSize and 3.31 + * InitialCodeCacheSize are passed to the VM is irrelevant. 3.32 + * @library /testlibrary 3.33 + * 3.34 + */ 3.35 +import com.oracle.java.testlibrary.*; 3.36 + 3.37 +public class CheckReservedInitialCodeCacheSizeArgOrder { 3.38 + public static void main(String[] args) throws Exception { 3.39 + ProcessBuilder pb1, pb2; 3.40 + OutputAnalyzer out1, out2; 3.41 + 3.42 + pb1 = ProcessTools.createJavaProcessBuilder("-XX:InitialCodeCacheSize=4m", "-XX:ReservedCodeCacheSize=8m", "-version"); 3.43 + pb2 = ProcessTools.createJavaProcessBuilder("-XX:ReservedCodeCacheSize=8m", "-XX:InitialCodeCacheSize=4m", "-version"); 3.44 + 3.45 + out1 = new OutputAnalyzer(pb1.start()); 3.46 + out2 = new OutputAnalyzer(pb2.start()); 3.47 + 3.48 + // Check that the outputs are equal 3.49 + if (out1.getStdout().compareTo(out2.getStdout()) != 0) { 3.50 + throw new RuntimeException("Test failed"); 3.51 + } 3.52 + 3.53 + out1.shouldHaveExitValue(0); 3.54 + out2.shouldHaveExitValue(0); 3.55 + } 3.56 +}