< prev index next >

test/compiler/arraycopy/TestArrayCopyNoInit.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 8064703
  27  * @summary Deoptimization between array allocation and arraycopy may result in non initialized array
  28  * @run main/othervm -XX:-BackgroundCompilation -XX:-UseOnStackReplacement -XX:TypeProfileLevel=020 TestArrayCopyNoInit
  29  *


  30  */
  31 


  32 public class TestArrayCopyNoInit {
  33 
  34     static int[] m1(int[] src) {
  35         int[] dest = new int[10];
  36         try {
  37             System.arraycopy(src, 0, dest, 0, 10);
  38         } catch (NullPointerException npe) {
  39         }
  40         return dest;
  41     }
  42 
  43     static int[] m2(Object src, boolean flag) {
  44         Class tmp = src.getClass();
  45         if (flag) {
  46             return null;
  47         }
  48         int[] dest = new int[10];
  49         try {
  50             System.arraycopy(src, 0, dest, 0, 10);
  51         } catch (ArrayStoreException npe) {




   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 8064703
  27  * @summary Deoptimization between array allocation and arraycopy may result in non initialized array

  28  *
  29  * @run main/othervm -XX:-BackgroundCompilation -XX:-UseOnStackReplacement -XX:TypeProfileLevel=020
  30  *                   compiler.arraycopy.TestArrayCopyNoInit
  31  */
  32 
  33 package compiler.arraycopy;
  34 
  35 public class TestArrayCopyNoInit {
  36 
  37     static int[] m1(int[] src) {
  38         int[] dest = new int[10];
  39         try {
  40             System.arraycopy(src, 0, dest, 0, 10);
  41         } catch (NullPointerException npe) {
  42         }
  43         return dest;
  44     }
  45 
  46     static int[] m2(Object src, boolean flag) {
  47         Class tmp = src.getClass();
  48         if (flag) {
  49             return null;
  50         }
  51         int[] dest = new int[10];
  52         try {
  53             System.arraycopy(src, 0, dest, 0, 10);
  54         } catch (ArrayStoreException npe) {


< prev index next >