< prev index next >

test/compiler/arraycopy/TestLoadBypassArrayCopy.java

Print this page
rev 11557 : 8132919: use package in compiler tests
Reviewed-by: duke


   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 8086046
  27  * @summary load bypasses arraycopy that sets the value after the ArrayCopyNode is expanded
  28  * @run main/othervm -XX:-BackgroundCompilation  -XX:-UseOnStackReplacement -XX:CompileCommand=dontinline,TestLoadBypassArrayCopy::test_helper -XX:-TieredCompilation TestLoadBypassArrayCopy
  29  *




  30  */
  31 


  32 public class TestLoadBypassArrayCopy {
  33 
  34     static long i;
  35     static boolean test_helper() {
  36         i++;
  37         if ((i%10) == 0) {
  38             return false;
  39         }
  40         return true;
  41     }
  42 
  43     static int test(int[] src, int len, boolean flag) {
  44         int[] dest = new int[10];
  45         int res = 0;
  46         while (test_helper()) {
  47             System.arraycopy(src, 0, dest, 0, len);
  48             // predicate moved out of loop so control of following
  49             // load is not the ArrayCopyNode. Otherwise, if the memory
  50             // of the load is changed and the control is set to the
  51             // ArrayCopyNode the graph is unschedulable and the test


   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 8086046
  27  * @summary load bypasses arraycopy that sets the value after the ArrayCopyNode is expanded

  28  *
  29  * @run main/othervm -XX:-BackgroundCompilation  -XX:-UseOnStackReplacement
  30  *                   -XX:CompileCommand=dontinline,compiler.arraycopy.TestLoadBypassArrayCopy::test_helper
  31  *                   -XX:-TieredCompilation
  32  *                   compiler.arraycopy.TestLoadBypassArrayCopy
  33  */
  34 
  35 package compiler.arraycopy;
  36 
  37 public class TestLoadBypassArrayCopy {
  38 
  39     static long i;
  40     static boolean test_helper() {
  41         i++;
  42         if ((i%10) == 0) {
  43             return false;
  44         }
  45         return true;
  46     }
  47 
  48     static int test(int[] src, int len, boolean flag) {
  49         int[] dest = new int[10];
  50         int res = 0;
  51         while (test_helper()) {
  52             System.arraycopy(src, 0, dest, 0, len);
  53             // predicate moved out of loop so control of following
  54             // load is not the ArrayCopyNode. Otherwise, if the memory
  55             // of the load is changed and the control is set to the
  56             // ArrayCopyNode the graph is unschedulable and the test
< prev index next >