< prev index next >

test/hotspot/jtreg/compiler/arraycopy/TestEliminateArrayCopy.java

Print this page
rev 53300 : 8246153: TestEliminateArrayCopy fails with -XX:+StressReflectiveCode
Summary: Use the memory input instead of the control input to find the membar.
Reviewed-by: kvn, neliasso
   1 /*
   2  * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
   3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
   4  *
   5  * This code is free software; you can redistribute it and/or modify it
   6  * under the terms of the GNU General Public License version 2 only, as
   7  * published by the Free Software Foundation.
   8  *
   9  * This code is distributed in the hope that it will be useful, but WITHOUT
  10  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  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 8076188
  27  * @summary arraycopy to non escaping destination may be eliminated
  28  * @library /
  29  *
  30  * @run main/othervm -ea -XX:-BackgroundCompilation -XX:-UseOnStackReplacement
  31  *                   -XX:CompileCommand=dontinline,compiler.arraycopy.TestEliminateArrayCopy*::m*
  32  *                   compiler.arraycopy.TestEliminateArrayCopy
  33  *



  34  */
  35 
  36 package compiler.arraycopy;
  37 
  38 public class TestEliminateArrayCopy {
  39 
  40     static class CloneTests extends TestInstanceCloneUtils {
  41         // object allocation and ArrayCopyNode should be eliminated
  42         static void m1(E src) throws CloneNotSupportedException {
  43             src.clone();
  44         }
  45 
  46         // both object allocations and ArrayCopyNode should be eliminated
  47         static void m2(Object dummy) throws CloneNotSupportedException {
  48             E src = new E(false);
  49             src.clone();
  50         }
  51 
  52         // object allocation and ArrayCopyNode should be eliminated. Fields should be loaded from src.
  53         static int m3(E src) throws CloneNotSupportedException {


   1 /*
   2  * Copyright (c) 2015, 2020, Oracle and/or its affiliates. All rights reserved.
   3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
   4  *
   5  * This code is free software; you can redistribute it and/or modify it
   6  * under the terms of the GNU General Public License version 2 only, as
   7  * published by the Free Software Foundation.
   8  *
   9  * This code is distributed in the hope that it will be useful, but WITHOUT
  10  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  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 8076188 8246153
  27  * @summary arraycopy to non escaping destination may be eliminated
  28  * @library /
  29  *
  30  * @run main/othervm -ea -XX:-BackgroundCompilation -XX:-UseOnStackReplacement
  31  *                   -XX:CompileCommand=dontinline,compiler.arraycopy.TestEliminateArrayCopy*::m*
  32  *                   compiler.arraycopy.TestEliminateArrayCopy
  33  * @run main/othervm -ea -XX:-BackgroundCompilation -XX:-UseOnStackReplacement
  34  *                   -XX:+IgnoreUnrecognizedVMOptions -XX:+StressReflectiveCode
  35  *                   -XX:CompileCommand=dontinline,compiler.arraycopy.TestEliminateArrayCopy*::m*
  36  *                   compiler.arraycopy.TestEliminateArrayCopy
  37  */
  38 
  39 package compiler.arraycopy;
  40 
  41 public class TestEliminateArrayCopy {
  42 
  43     static class CloneTests extends TestInstanceCloneUtils {
  44         // object allocation and ArrayCopyNode should be eliminated
  45         static void m1(E src) throws CloneNotSupportedException {
  46             src.clone();
  47         }
  48 
  49         // both object allocations and ArrayCopyNode should be eliminated
  50         static void m2(Object dummy) throws CloneNotSupportedException {
  51             E src = new E(false);
  52             src.clone();
  53         }
  54 
  55         // object allocation and ArrayCopyNode should be eliminated. Fields should be loaded from src.
  56         static int m3(E src) throws CloneNotSupportedException {


< prev index next >