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 8159016 27 * @requires vm.gc == "Parallel" | vm.gc == "null" 28 * @summary Tests correct dominator information after over-unrolling a loop. 29 * @run main/othervm -XX:+IgnoreUnrecognizedVMOptions -Xcomp -XX:-TieredCompilation 30 * -XX:-UseG1GC -XX:+UseParallelGC TestOverunrolling 31 */ 32 public class TestOverunrolling { 33 34 public static Object test(int arg) { 35 Object arr[] = new Object[3]; 36 int lim = (arg & 3); 37 // The pre loop is executed for one iteration, initializing p[0]. 38 // The main loop is unrolled twice, initializing p[1], p[2], p[3] and p[4]. 39 // The p[3] and p[4] stores are always out of bounds and removed. However, 40 // C2 is unable to remove the "over-unrolled", dead main loop. As a result, 41 // there is a control path from the main loop to the post loop without a 42 // memory path (because the last store was replaced by TOP). We crash 43 // because we use a memory edge from a non-dominating region. 44 for (int i = 0; i < lim; ++i) { 45 arr[i] = new Object(); 46 } 47 // Avoid EA 48 return arr; 49 } 50 51 public static void main(String args[]) { | 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 8159016 27 * @summary Tests correct dominator information after over-unrolling a loop. 28 * @requires vm.gc == "Parallel" | vm.gc == "null" 29 * 30 * @run main/othervm -XX:+IgnoreUnrecognizedVMOptions -Xcomp -XX:-TieredCompilation 31 * -XX:-UseG1GC -XX:+UseParallelGC 32 * compiler.loopopts.TestOverunrolling 33 */ 34 35 package compiler.loopopts; 36 37 public class TestOverunrolling { 38 39 public static Object test(int arg) { 40 Object arr[] = new Object[3]; 41 int lim = (arg & 3); 42 // The pre loop is executed for one iteration, initializing p[0]. 43 // The main loop is unrolled twice, initializing p[1], p[2], p[3] and p[4]. 44 // The p[3] and p[4] stores are always out of bounds and removed. However, 45 // C2 is unable to remove the "over-unrolled", dead main loop. As a result, 46 // there is a control path from the main loop to the post loop without a 47 // memory path (because the last store was replaced by TOP). We crash 48 // because we use a memory edge from a non-dominating region. 49 for (int i = 0; i < lim; ++i) { 50 arr[i] = new Object(); 51 } 52 // Avoid EA 53 return arr; 54 } 55 56 public static void main(String args[]) { |