test/hotspot/jtreg/compiler/loopopts/superword/TestFuzzPreLoop.java
author chegar
Thu, 17 Oct 2019 20:53:35 +0100
branchdatagramsocketimpl-branch
changeset 58678 9cf78a70fa4f
child 58679 9c3209ff7550
permissions -rw-r--r--
datagramsocketimpl-branch: update to default
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
58678
9cf78a70fa4f datagramsocketimpl-branch: update to default
chegar
parents:
diff changeset
     1
/*
9cf78a70fa4f datagramsocketimpl-branch: update to default
chegar
parents:
diff changeset
     2
 * Copyright (c) 2019, Red Hat, Inc. All rights reserved.
9cf78a70fa4f datagramsocketimpl-branch: update to default
chegar
parents:
diff changeset
     3
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
9cf78a70fa4f datagramsocketimpl-branch: update to default
chegar
parents:
diff changeset
     4
 *
9cf78a70fa4f datagramsocketimpl-branch: update to default
chegar
parents:
diff changeset
     5
 * This code is free software; you can redistribute it and/or modify it
9cf78a70fa4f datagramsocketimpl-branch: update to default
chegar
parents:
diff changeset
     6
 * under the terms of the GNU General Public License version 2 only, as
9cf78a70fa4f datagramsocketimpl-branch: update to default
chegar
parents:
diff changeset
     7
 * published by the Free Software Foundation.
9cf78a70fa4f datagramsocketimpl-branch: update to default
chegar
parents:
diff changeset
     8
 *
9cf78a70fa4f datagramsocketimpl-branch: update to default
chegar
parents:
diff changeset
     9
 * This code is distributed in the hope that it will be useful, but WITHOUT
9cf78a70fa4f datagramsocketimpl-branch: update to default
chegar
parents:
diff changeset
    10
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
9cf78a70fa4f datagramsocketimpl-branch: update to default
chegar
parents:
diff changeset
    11
 * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
9cf78a70fa4f datagramsocketimpl-branch: update to default
chegar
parents:
diff changeset
    12
 * version 2 for more details (a copy is included in the LICENSE file that
9cf78a70fa4f datagramsocketimpl-branch: update to default
chegar
parents:
diff changeset
    13
 * accompanied this code).
9cf78a70fa4f datagramsocketimpl-branch: update to default
chegar
parents:
diff changeset
    14
 *
9cf78a70fa4f datagramsocketimpl-branch: update to default
chegar
parents:
diff changeset
    15
 * You should have received a copy of the GNU General Public License version
9cf78a70fa4f datagramsocketimpl-branch: update to default
chegar
parents:
diff changeset
    16
 * 2 along with this work; if not, write to the Free Software Foundation,
9cf78a70fa4f datagramsocketimpl-branch: update to default
chegar
parents:
diff changeset
    17
 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
9cf78a70fa4f datagramsocketimpl-branch: update to default
chegar
parents:
diff changeset
    18
 *
9cf78a70fa4f datagramsocketimpl-branch: update to default
chegar
parents:
diff changeset
    19
 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
9cf78a70fa4f datagramsocketimpl-branch: update to default
chegar
parents:
diff changeset
    20
 * or visit www.oracle.com if you need additional information or have any
9cf78a70fa4f datagramsocketimpl-branch: update to default
chegar
parents:
diff changeset
    21
 * questions.
9cf78a70fa4f datagramsocketimpl-branch: update to default
chegar
parents:
diff changeset
    22
 */
9cf78a70fa4f datagramsocketimpl-branch: update to default
chegar
parents:
diff changeset
    23
9cf78a70fa4f datagramsocketimpl-branch: update to default
chegar
parents:
diff changeset
    24
/*
9cf78a70fa4f datagramsocketimpl-branch: update to default
chegar
parents:
diff changeset
    25
 * @test
9cf78a70fa4f datagramsocketimpl-branch: update to default
chegar
parents:
diff changeset
    26
 * @bug 8134739 8010500
9cf78a70fa4f datagramsocketimpl-branch: update to default
chegar
parents:
diff changeset
    27
 * @summary SEGV in SuperWord::get_pre_loop_end
9cf78a70fa4f datagramsocketimpl-branch: update to default
chegar
parents:
diff changeset
    28
 * @run main/othervm compiler.loopopts.superword.TestFuzzPreLoop
9cf78a70fa4f datagramsocketimpl-branch: update to default
chegar
parents:
diff changeset
    29
 */
9cf78a70fa4f datagramsocketimpl-branch: update to default
chegar
parents:
diff changeset
    30
9cf78a70fa4f datagramsocketimpl-branch: update to default
chegar
parents:
diff changeset
    31
package compiler.loopopts.superword;
9cf78a70fa4f datagramsocketimpl-branch: update to default
chegar
parents:
diff changeset
    32
9cf78a70fa4f datagramsocketimpl-branch: update to default
chegar
parents:
diff changeset
    33
public class TestFuzzPreLoop {
9cf78a70fa4f datagramsocketimpl-branch: update to default
chegar
parents:
diff changeset
    34
    static Object sink;
9cf78a70fa4f datagramsocketimpl-branch: update to default
chegar
parents:
diff changeset
    35
    short sFld = -19206;
9cf78a70fa4f datagramsocketimpl-branch: update to default
chegar
parents:
diff changeset
    36
9cf78a70fa4f datagramsocketimpl-branch: update to default
chegar
parents:
diff changeset
    37
    void doTest() {
9cf78a70fa4f datagramsocketimpl-branch: update to default
chegar
parents:
diff changeset
    38
        int[] arr = new int[400];
9cf78a70fa4f datagramsocketimpl-branch: update to default
chegar
parents:
diff changeset
    39
9cf78a70fa4f datagramsocketimpl-branch: update to default
chegar
parents:
diff changeset
    40
        for (int i1 = 0; i1 < 200; i1++) {
9cf78a70fa4f datagramsocketimpl-branch: update to default
chegar
parents:
diff changeset
    41
            for (int i2 = 0; i2 < 100; i2++) {
9cf78a70fa4f datagramsocketimpl-branch: update to default
chegar
parents:
diff changeset
    42
                sink = new int[400];
9cf78a70fa4f datagramsocketimpl-branch: update to default
chegar
parents:
diff changeset
    43
            }
9cf78a70fa4f datagramsocketimpl-branch: update to default
chegar
parents:
diff changeset
    44
            arr[i1] = 0;
9cf78a70fa4f datagramsocketimpl-branch: update to default
chegar
parents:
diff changeset
    45
        }
9cf78a70fa4f datagramsocketimpl-branch: update to default
chegar
parents:
diff changeset
    46
9cf78a70fa4f datagramsocketimpl-branch: update to default
chegar
parents:
diff changeset
    47
        float f1 = 0;
9cf78a70fa4f datagramsocketimpl-branch: update to default
chegar
parents:
diff changeset
    48
        for (int i3 = 0; i3 < 200; i3++) {
9cf78a70fa4f datagramsocketimpl-branch: update to default
chegar
parents:
diff changeset
    49
            f1 += i3 * i3;
9cf78a70fa4f datagramsocketimpl-branch: update to default
chegar
parents:
diff changeset
    50
        }
9cf78a70fa4f datagramsocketimpl-branch: update to default
chegar
parents:
diff changeset
    51
        for (int i4 = 0; i4 < 200; i4++) {
9cf78a70fa4f datagramsocketimpl-branch: update to default
chegar
parents:
diff changeset
    52
            f1 += i4 - sFld;
9cf78a70fa4f datagramsocketimpl-branch: update to default
chegar
parents:
diff changeset
    53
        }
9cf78a70fa4f datagramsocketimpl-branch: update to default
chegar
parents:
diff changeset
    54
9cf78a70fa4f datagramsocketimpl-branch: update to default
chegar
parents:
diff changeset
    55
        System.out.println(arr);
9cf78a70fa4f datagramsocketimpl-branch: update to default
chegar
parents:
diff changeset
    56
        System.out.println(f1);
9cf78a70fa4f datagramsocketimpl-branch: update to default
chegar
parents:
diff changeset
    57
    }
9cf78a70fa4f datagramsocketimpl-branch: update to default
chegar
parents:
diff changeset
    58
9cf78a70fa4f datagramsocketimpl-branch: update to default
chegar
parents:
diff changeset
    59
    public static void main(String... args) throws Exception {
9cf78a70fa4f datagramsocketimpl-branch: update to default
chegar
parents:
diff changeset
    60
        TestFuzzPreLoop test = new TestFuzzPreLoop();
9cf78a70fa4f datagramsocketimpl-branch: update to default
chegar
parents:
diff changeset
    61
        for (int i = 0; i < 100; i++) {
9cf78a70fa4f datagramsocketimpl-branch: update to default
chegar
parents:
diff changeset
    62
            test.doTest();
9cf78a70fa4f datagramsocketimpl-branch: update to default
chegar
parents:
diff changeset
    63
        }
9cf78a70fa4f datagramsocketimpl-branch: update to default
chegar
parents:
diff changeset
    64
    }
9cf78a70fa4f datagramsocketimpl-branch: update to default
chegar
parents:
diff changeset
    65
}