< prev index next >

test/compiler/arraycopy/TestArrayCopyNoInitDeopt.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 
  24 /*
  25  * @test
  26  * @bug 8072016
  27  * @summary Infinite deoptimization/recompilation cycles in case of arraycopy with tightly coupled allocation
  28  * @library /testlibrary /test/lib /
  29  * @modules java.base/jdk.internal.misc
  30  *          java.management
  31  * @build TestArrayCopyNoInitDeopt
  32  * @run driver ClassFileInstaller sun.hotspot.WhiteBox

  33  *                                jdk.test.lib.Platform
  34  * @run main/othervm -Xmixed -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI
  35  *                   -XX:-BackgroundCompilation -XX:-UseOnStackReplacement -XX:TypeProfileLevel=020
  36  *                   TestArrayCopyNoInitDeopt
  37  */
  38 
  39 import sun.hotspot.WhiteBox;
  40 import sun.hotspot.code.NMethod;
  41 import jdk.test.lib.Platform;
  42 import java.lang.reflect.*;
  43 import compiler.whitebox.CompilerWhiteBoxTest;




  44 
  45 public class TestArrayCopyNoInitDeopt {
  46 
  47     public static int[] m1(Object src) {
  48         if (src == null) return null;
  49         int[] dest = new int[10];
  50         try {
  51             System.arraycopy(src, 0, dest, 0, 10);
  52         } catch (ArrayStoreException npe) {
  53         }
  54         return dest;
  55     }
  56 
  57     static Object m2_src(Object src) {
  58         return src;
  59     }
  60 
  61     public static int[] m2(Object src) {
  62         if (src == null) return null;
  63         src = m2_src(src);




  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 
  24 /*
  25  * @test
  26  * @bug 8072016
  27  * @summary Infinite deoptimization/recompilation cycles in case of arraycopy with tightly coupled allocation
  28  * @library /testlibrary /test/lib /
  29  * @modules java.base/jdk.internal.misc
  30  *          java.management
  31  *
  32  * @build compiler.arraycopy.TestArrayCopyNoInitDeopt
  33  * @run driver ClassFileInstaller sun.hotspot.WhiteBox sun.hotspot.WhiteBox$WhiteBoxPermission
  34  *                                jdk.test.lib.Platform
  35  * @run main/othervm -Xmixed -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI
  36  *                   -XX:-BackgroundCompilation -XX:-UseOnStackReplacement -XX:TypeProfileLevel=020
  37  *                   compiler.arraycopy.TestArrayCopyNoInitDeopt
  38  */
  39 
  40 package compiler.arraycopy;
  41 


  42 import compiler.whitebox.CompilerWhiteBoxTest;
  43 import jdk.test.lib.Platform;
  44 import sun.hotspot.WhiteBox;
  45 
  46 import java.lang.reflect.Method;
  47 
  48 public class TestArrayCopyNoInitDeopt {
  49 
  50     public static int[] m1(Object src) {
  51         if (src == null) return null;
  52         int[] dest = new int[10];
  53         try {
  54             System.arraycopy(src, 0, dest, 0, 10);
  55         } catch (ArrayStoreException npe) {
  56         }
  57         return dest;
  58     }
  59 
  60     static Object m2_src(Object src) {
  61         return src;
  62     }
  63 
  64     public static int[] m2(Object src) {
  65         if (src == null) return null;
  66         src = m2_src(src);


< prev index next >