hotspot/test/compiler/loopopts/TestCountedLoopSafepointBackedge.java
author dpochepk
Thu, 28 Jul 2016 16:09:31 +0300
changeset 40092 50da4636cb1c
parent 40087 33cbd46c3241
child 43455 96560cffef4d
permissions -rw-r--r--
8162603: Unrecognized VM option 'UseCountedLoopSafepoints' Reviewed-by: kvn
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
40087
33cbd46c3241 8161147: jvm crashes when -XX:+UseCountedLoopSafepoints is enabled
roland
parents:
diff changeset
     1
/*
33cbd46c3241 8161147: jvm crashes when -XX:+UseCountedLoopSafepoints is enabled
roland
parents:
diff changeset
     2
 * Copyright (c) 2016, Red Hat, Inc. All rights reserved.
33cbd46c3241 8161147: jvm crashes when -XX:+UseCountedLoopSafepoints is enabled
roland
parents:
diff changeset
     3
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
33cbd46c3241 8161147: jvm crashes when -XX:+UseCountedLoopSafepoints is enabled
roland
parents:
diff changeset
     4
 *
33cbd46c3241 8161147: jvm crashes when -XX:+UseCountedLoopSafepoints is enabled
roland
parents:
diff changeset
     5
 * This code is free software; you can redistribute it and/or modify it
33cbd46c3241 8161147: jvm crashes when -XX:+UseCountedLoopSafepoints is enabled
roland
parents:
diff changeset
     6
 * under the terms of the GNU General Public License version 2 only, as
33cbd46c3241 8161147: jvm crashes when -XX:+UseCountedLoopSafepoints is enabled
roland
parents:
diff changeset
     7
 * published by the Free Software Foundation.
33cbd46c3241 8161147: jvm crashes when -XX:+UseCountedLoopSafepoints is enabled
roland
parents:
diff changeset
     8
 *
33cbd46c3241 8161147: jvm crashes when -XX:+UseCountedLoopSafepoints is enabled
roland
parents:
diff changeset
     9
 * This code is distributed in the hope that it will be useful, but WITHOUT
33cbd46c3241 8161147: jvm crashes when -XX:+UseCountedLoopSafepoints is enabled
roland
parents:
diff changeset
    10
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
33cbd46c3241 8161147: jvm crashes when -XX:+UseCountedLoopSafepoints is enabled
roland
parents:
diff changeset
    11
 * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
33cbd46c3241 8161147: jvm crashes when -XX:+UseCountedLoopSafepoints is enabled
roland
parents:
diff changeset
    12
 * version 2 for more details (a copy is included in the LICENSE file that
33cbd46c3241 8161147: jvm crashes when -XX:+UseCountedLoopSafepoints is enabled
roland
parents:
diff changeset
    13
 * accompanied this code).
33cbd46c3241 8161147: jvm crashes when -XX:+UseCountedLoopSafepoints is enabled
roland
parents:
diff changeset
    14
 *
33cbd46c3241 8161147: jvm crashes when -XX:+UseCountedLoopSafepoints is enabled
roland
parents:
diff changeset
    15
 * You should have received a copy of the GNU General Public License version
33cbd46c3241 8161147: jvm crashes when -XX:+UseCountedLoopSafepoints is enabled
roland
parents:
diff changeset
    16
 * 2 along with this work; if not, write to the Free Software Foundation,
33cbd46c3241 8161147: jvm crashes when -XX:+UseCountedLoopSafepoints is enabled
roland
parents:
diff changeset
    17
 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
33cbd46c3241 8161147: jvm crashes when -XX:+UseCountedLoopSafepoints is enabled
roland
parents:
diff changeset
    18
 *
33cbd46c3241 8161147: jvm crashes when -XX:+UseCountedLoopSafepoints is enabled
roland
parents:
diff changeset
    19
 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
33cbd46c3241 8161147: jvm crashes when -XX:+UseCountedLoopSafepoints is enabled
roland
parents:
diff changeset
    20
 * or visit www.oracle.com if you need additional information or have any
33cbd46c3241 8161147: jvm crashes when -XX:+UseCountedLoopSafepoints is enabled
roland
parents:
diff changeset
    21
 * questions.
33cbd46c3241 8161147: jvm crashes when -XX:+UseCountedLoopSafepoints is enabled
roland
parents:
diff changeset
    22
 */
33cbd46c3241 8161147: jvm crashes when -XX:+UseCountedLoopSafepoints is enabled
roland
parents:
diff changeset
    23
33cbd46c3241 8161147: jvm crashes when -XX:+UseCountedLoopSafepoints is enabled
roland
parents:
diff changeset
    24
/**
33cbd46c3241 8161147: jvm crashes when -XX:+UseCountedLoopSafepoints is enabled
roland
parents:
diff changeset
    25
 * @test
33cbd46c3241 8161147: jvm crashes when -XX:+UseCountedLoopSafepoints is enabled
roland
parents:
diff changeset
    26
 * @bug 8161147
40092
50da4636cb1c 8162603: Unrecognized VM option 'UseCountedLoopSafepoints'
dpochepk
parents: 40087
diff changeset
    27
 * @requires vm.flavor == "server"
40087
33cbd46c3241 8161147: jvm crashes when -XX:+UseCountedLoopSafepoints is enabled
roland
parents:
diff changeset
    28
 * @summary Safepoint on backedge breaks UseCountedLoopSafepoints
33cbd46c3241 8161147: jvm crashes when -XX:+UseCountedLoopSafepoints is enabled
roland
parents:
diff changeset
    29
 * @run main/othervm -XX:-BackgroundCompilation -XX:-UseOnStackReplacement -XX:+UseCountedLoopSafepoints TestCountedLoopSafepointBackedge
33cbd46c3241 8161147: jvm crashes when -XX:+UseCountedLoopSafepoints is enabled
roland
parents:
diff changeset
    30
 *
33cbd46c3241 8161147: jvm crashes when -XX:+UseCountedLoopSafepoints is enabled
roland
parents:
diff changeset
    31
 */
33cbd46c3241 8161147: jvm crashes when -XX:+UseCountedLoopSafepoints is enabled
roland
parents:
diff changeset
    32
33cbd46c3241 8161147: jvm crashes when -XX:+UseCountedLoopSafepoints is enabled
roland
parents:
diff changeset
    33
public class TestCountedLoopSafepointBackedge {
33cbd46c3241 8161147: jvm crashes when -XX:+UseCountedLoopSafepoints is enabled
roland
parents:
diff changeset
    34
    static void test(int[] arr, int inc) {
33cbd46c3241 8161147: jvm crashes when -XX:+UseCountedLoopSafepoints is enabled
roland
parents:
diff changeset
    35
        int i = 0;
33cbd46c3241 8161147: jvm crashes when -XX:+UseCountedLoopSafepoints is enabled
roland
parents:
diff changeset
    36
        for (;;) {
33cbd46c3241 8161147: jvm crashes when -XX:+UseCountedLoopSafepoints is enabled
roland
parents:
diff changeset
    37
            for (int j = 0; j < 10; j++);
33cbd46c3241 8161147: jvm crashes when -XX:+UseCountedLoopSafepoints is enabled
roland
parents:
diff changeset
    38
            arr[i] = i;
33cbd46c3241 8161147: jvm crashes when -XX:+UseCountedLoopSafepoints is enabled
roland
parents:
diff changeset
    39
            i++;
33cbd46c3241 8161147: jvm crashes when -XX:+UseCountedLoopSafepoints is enabled
roland
parents:
diff changeset
    40
            if (i >= 100) {
33cbd46c3241 8161147: jvm crashes when -XX:+UseCountedLoopSafepoints is enabled
roland
parents:
diff changeset
    41
                break;
33cbd46c3241 8161147: jvm crashes when -XX:+UseCountedLoopSafepoints is enabled
roland
parents:
diff changeset
    42
            }
33cbd46c3241 8161147: jvm crashes when -XX:+UseCountedLoopSafepoints is enabled
roland
parents:
diff changeset
    43
            for (int j = 0; j < 10; j++);
33cbd46c3241 8161147: jvm crashes when -XX:+UseCountedLoopSafepoints is enabled
roland
parents:
diff changeset
    44
        }
33cbd46c3241 8161147: jvm crashes when -XX:+UseCountedLoopSafepoints is enabled
roland
parents:
diff changeset
    45
    }
33cbd46c3241 8161147: jvm crashes when -XX:+UseCountedLoopSafepoints is enabled
roland
parents:
diff changeset
    46
33cbd46c3241 8161147: jvm crashes when -XX:+UseCountedLoopSafepoints is enabled
roland
parents:
diff changeset
    47
    static public void main(String[] args) {
33cbd46c3241 8161147: jvm crashes when -XX:+UseCountedLoopSafepoints is enabled
roland
parents:
diff changeset
    48
        int[] arr = new int[100];
33cbd46c3241 8161147: jvm crashes when -XX:+UseCountedLoopSafepoints is enabled
roland
parents:
diff changeset
    49
        for (int i = 0; i < 20000; i++) {
33cbd46c3241 8161147: jvm crashes when -XX:+UseCountedLoopSafepoints is enabled
roland
parents:
diff changeset
    50
             test(arr, 1);
33cbd46c3241 8161147: jvm crashes when -XX:+UseCountedLoopSafepoints is enabled
roland
parents:
diff changeset
    51
        }
33cbd46c3241 8161147: jvm crashes when -XX:+UseCountedLoopSafepoints is enabled
roland
parents:
diff changeset
    52
    }
33cbd46c3241 8161147: jvm crashes when -XX:+UseCountedLoopSafepoints is enabled
roland
parents:
diff changeset
    53
}