< prev index next >

test/compiler/arraycopy/TestArrayCopyMacro.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 7173584
  27  * @summary arraycopy as macro node
  28  * @run main/othervm -XX:-BackgroundCompilation -XX:-UseOnStackReplacement TestArrayCopyMacro
  29  *


  30  */
  31 


  32 public class TestArrayCopyMacro {
  33     static class A {
  34     }
  35 
  36     // In its own method so profiling reports both branches taken
  37     static Object m2(Object o1, Object o2, int i) {
  38         if (i == 4) {
  39             return o1;
  40         }
  41         return o2;
  42     }
  43 
  44     static Object m1(A[] src, Object dest) {
  45         int i = 1;
  46 
  47         // won't be optimized out until after parsing
  48         for (; i < 3; i *= 4) {
  49         }
  50         dest = m2(new A[10], dest, i);
  51 




   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 7173584
  27  * @summary arraycopy as macro node

  28  *
  29  * @run main/othervm -XX:-BackgroundCompilation -XX:-UseOnStackReplacement
  30  *                   compiler.arraycopy.TestArrayCopyMacro
  31  */
  32 
  33 package compiler.arraycopy;
  34 
  35 public class TestArrayCopyMacro {
  36     static class A {
  37     }
  38 
  39     // In its own method so profiling reports both branches taken
  40     static Object m2(Object o1, Object o2, int i) {
  41         if (i == 4) {
  42             return o1;
  43         }
  44         return o2;
  45     }
  46 
  47     static Object m1(A[] src, Object dest) {
  48         int i = 1;
  49 
  50         // won't be optimized out until after parsing
  51         for (; i < 3; i *= 4) {
  52         }
  53         dest = m2(new A[10], dest, i);
  54 


< prev index next >