test/compiler/arraycopy/TestArrayCopyNoInit.java
Index Unified diffs Context diffs Sdiffs Patch New Old Previous File Next File hotspot Sdiff test/compiler/arraycopy

test/compiler/arraycopy/TestArrayCopyNoInit.java

Print this page
rev 8008 : 8073866: Fix for 8064703 is not sufficient
Summary: side effects between allocation and arraycopy can be reexecuted, unreachable uninitialized array can be seen by GCs
Reviewed-by:


  59         try {
  60             System.arraycopy(src, src_offset, dest, 0, 10);
  61         } catch (IndexOutOfBoundsException npe) {
  62         }
  63         return dest;
  64     }
  65 
  66     static int[] m4(int[] src, int length) {
  67         int tmp = src[0];
  68         int[] dest = new int[10];
  69         try {
  70             System.arraycopy(src, 0, dest, 0, length);
  71         } catch (IndexOutOfBoundsException npe) {
  72         }
  73         return dest;
  74     }
  75 
  76     static TestArrayCopyNoInit[] m5(Object[] src) {
  77         Object tmp = src[0];
  78         TestArrayCopyNoInit[] dest = new TestArrayCopyNoInit[10];
  79         System.arraycopy(src, 0, dest, 0, 0);
  80         return dest;
  81     }
  82 
  83     static class A {
  84     }
  85 
  86     static class B extends A {
  87     }
  88 
  89     static class C extends B {
  90     }
  91 
  92     static class D extends C {
  93     }
  94 
  95     static class E extends D {
  96     }
  97 
  98     static class F extends E {
  99     }
 100 
 101     static class G extends F {
 102     }
 103 
 104     static class H extends G {
 105     }
 106 
 107     static class I extends H {
 108     }
 109 
 110     static H[] m6(Object[] src) {
 111         Object tmp = src[0];
 112         H[] dest = new H[10];
 113         System.arraycopy(src, 0, dest, 0, 0);
 114         return dest;
 115     }
 116 
 117     static Object m7_src(Object src) {
 118         return src;
 119     }
 120 
 121     static int[] m7(Object src, boolean flag) {
 122         Class tmp = src.getClass();
 123         if (flag) {
 124             return null;
 125         }
 126         src = m7_src(src);
 127         int[] dest = new int[10];
 128         try {
 129             System.arraycopy(src, 0, dest, 0, 10);
 130         } catch (ArrayStoreException npe) {
 131         }
 132         return dest;
 133     }




  59         try {
  60             System.arraycopy(src, src_offset, dest, 0, 10);
  61         } catch (IndexOutOfBoundsException npe) {
  62         }
  63         return dest;
  64     }
  65 
  66     static int[] m4(int[] src, int length) {
  67         int tmp = src[0];
  68         int[] dest = new int[10];
  69         try {
  70             System.arraycopy(src, 0, dest, 0, length);
  71         } catch (IndexOutOfBoundsException npe) {
  72         }
  73         return dest;
  74     }
  75 
  76     static TestArrayCopyNoInit[] m5(Object[] src) {
  77         Object tmp = src[0];
  78         TestArrayCopyNoInit[] dest = new TestArrayCopyNoInit[10];
  79         System.arraycopy(src, 0, dest, 0, 10);
  80         return dest;
  81     }
  82 
  83     static class A {
  84     }
  85 
  86     static class B extends A {
  87     }
  88 
  89     static class C extends B {
  90     }
  91 
  92     static class D extends C {
  93     }
  94 
  95     static class E extends D {
  96     }
  97 
  98     static class F extends E {
  99     }
 100 
 101     static class G extends F {
 102     }
 103 
 104     static class H extends G {
 105     }
 106 
 107     static class I extends H {
 108     }
 109 
 110     static H[] m6(Object[] src) {
 111         Object tmp = src[0];
 112         H[] dest = new H[10];
 113         System.arraycopy(src, 0, dest, 0, 10);
 114         return dest;
 115     }
 116 
 117     static Object m7_src(Object src) {
 118         return src;
 119     }
 120 
 121     static int[] m7(Object src, boolean flag) {
 122         Class tmp = src.getClass();
 123         if (flag) {
 124             return null;
 125         }
 126         src = m7_src(src);
 127         int[] dest = new int[10];
 128         try {
 129             System.arraycopy(src, 0, dest, 0, 10);
 130         } catch (ArrayStoreException npe) {
 131         }
 132         return dest;
 133     }


test/compiler/arraycopy/TestArrayCopyNoInit.java
Index Unified diffs Context diffs Sdiffs Patch New Old Previous File Next File