test/hotspot/jtreg/compiler/types/TestMeetExactConstantArrays.java
author iignatyev
Mon, 18 Feb 2019 09:31:07 -0800
changeset 53791 bec6c8739833
parent 47216 71c04702a3d5
permissions -rw-r--r--
8219157: vm/mlvm/mixed/stress/java/findDeadlock should be problem-listed only on mac Reviewed-by: thartmann
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
30210
507826ef56fd 8075587: Compilation of constant array containing different sub classes crashes the JVM
roland
parents:
diff changeset
     1
/*
507826ef56fd 8075587: Compilation of constant array containing different sub classes crashes the JVM
roland
parents:
diff changeset
     2
 * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
507826ef56fd 8075587: Compilation of constant array containing different sub classes crashes the JVM
roland
parents:
diff changeset
     3
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
507826ef56fd 8075587: Compilation of constant array containing different sub classes crashes the JVM
roland
parents:
diff changeset
     4
 *
507826ef56fd 8075587: Compilation of constant array containing different sub classes crashes the JVM
roland
parents:
diff changeset
     5
 * This code is free software; you can redistribute it and/or modify it
507826ef56fd 8075587: Compilation of constant array containing different sub classes crashes the JVM
roland
parents:
diff changeset
     6
 * under the terms of the GNU General Public License version 2 only, as
507826ef56fd 8075587: Compilation of constant array containing different sub classes crashes the JVM
roland
parents:
diff changeset
     7
 * published by the Free Software Foundation.
507826ef56fd 8075587: Compilation of constant array containing different sub classes crashes the JVM
roland
parents:
diff changeset
     8
 *
507826ef56fd 8075587: Compilation of constant array containing different sub classes crashes the JVM
roland
parents:
diff changeset
     9
 * This code is distributed in the hope that it will be useful, but WITHOUT
507826ef56fd 8075587: Compilation of constant array containing different sub classes crashes the JVM
roland
parents:
diff changeset
    10
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
507826ef56fd 8075587: Compilation of constant array containing different sub classes crashes the JVM
roland
parents:
diff changeset
    11
 * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
507826ef56fd 8075587: Compilation of constant array containing different sub classes crashes the JVM
roland
parents:
diff changeset
    12
 * version 2 for more details (a copy is included in the LICENSE file that
507826ef56fd 8075587: Compilation of constant array containing different sub classes crashes the JVM
roland
parents:
diff changeset
    13
 * accompanied this code).
507826ef56fd 8075587: Compilation of constant array containing different sub classes crashes the JVM
roland
parents:
diff changeset
    14
 *
507826ef56fd 8075587: Compilation of constant array containing different sub classes crashes the JVM
roland
parents:
diff changeset
    15
 * You should have received a copy of the GNU General Public License version
507826ef56fd 8075587: Compilation of constant array containing different sub classes crashes the JVM
roland
parents:
diff changeset
    16
 * 2 along with this work; if not, write to the Free Software Foundation,
507826ef56fd 8075587: Compilation of constant array containing different sub classes crashes the JVM
roland
parents:
diff changeset
    17
 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
507826ef56fd 8075587: Compilation of constant array containing different sub classes crashes the JVM
roland
parents:
diff changeset
    18
 *
507826ef56fd 8075587: Compilation of constant array containing different sub classes crashes the JVM
roland
parents:
diff changeset
    19
 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
507826ef56fd 8075587: Compilation of constant array containing different sub classes crashes the JVM
roland
parents:
diff changeset
    20
 * or visit www.oracle.com if you need additional information or have any
507826ef56fd 8075587: Compilation of constant array containing different sub classes crashes the JVM
roland
parents:
diff changeset
    21
 * questions.
507826ef56fd 8075587: Compilation of constant array containing different sub classes crashes the JVM
roland
parents:
diff changeset
    22
 */
507826ef56fd 8075587: Compilation of constant array containing different sub classes crashes the JVM
roland
parents:
diff changeset
    23
507826ef56fd 8075587: Compilation of constant array containing different sub classes crashes the JVM
roland
parents:
diff changeset
    24
/*
507826ef56fd 8075587: Compilation of constant array containing different sub classes crashes the JVM
roland
parents:
diff changeset
    25
 * @test
507826ef56fd 8075587: Compilation of constant array containing different sub classes crashes the JVM
roland
parents:
diff changeset
    26
 * @bug 8075587
507826ef56fd 8075587: Compilation of constant array containing different sub classes crashes the JVM
roland
parents:
diff changeset
    27
 * @summary meet of 2 constant arrays result in bottom
507826ef56fd 8075587: Compilation of constant array containing different sub classes crashes the JVM
roland
parents:
diff changeset
    28
 *
40059
c2304140ed64 8132919: Put compiler tests in packages
tpivovarova
parents: 30210
diff changeset
    29
 * @run main/othervm compiler.types.TestMeetExactConstantArrays
30210
507826ef56fd 8075587: Compilation of constant array containing different sub classes crashes the JVM
roland
parents:
diff changeset
    30
 */
507826ef56fd 8075587: Compilation of constant array containing different sub classes crashes the JVM
roland
parents:
diff changeset
    31
40059
c2304140ed64 8132919: Put compiler tests in packages
tpivovarova
parents: 30210
diff changeset
    32
package compiler.types;
c2304140ed64 8132919: Put compiler tests in packages
tpivovarova
parents: 30210
diff changeset
    33
30210
507826ef56fd 8075587: Compilation of constant array containing different sub classes crashes the JVM
roland
parents:
diff changeset
    34
public class TestMeetExactConstantArrays {
507826ef56fd 8075587: Compilation of constant array containing different sub classes crashes the JVM
roland
parents:
diff changeset
    35
    public abstract static class NumbersHolder {
507826ef56fd 8075587: Compilation of constant array containing different sub classes crashes the JVM
roland
parents:
diff changeset
    36
        public Number[] getNumbers() {
507826ef56fd 8075587: Compilation of constant array containing different sub classes crashes the JVM
roland
parents:
diff changeset
    37
            return null;
507826ef56fd 8075587: Compilation of constant array containing different sub classes crashes the JVM
roland
parents:
diff changeset
    38
        }
507826ef56fd 8075587: Compilation of constant array containing different sub classes crashes the JVM
roland
parents:
diff changeset
    39
    }
507826ef56fd 8075587: Compilation of constant array containing different sub classes crashes the JVM
roland
parents:
diff changeset
    40
507826ef56fd 8075587: Compilation of constant array containing different sub classes crashes the JVM
roland
parents:
diff changeset
    41
    public static class IntegersHolder extends NumbersHolder {
507826ef56fd 8075587: Compilation of constant array containing different sub classes crashes the JVM
roland
parents:
diff changeset
    42
        private final static Integer integers[] = { new Integer(1) };
507826ef56fd 8075587: Compilation of constant array containing different sub classes crashes the JVM
roland
parents:
diff changeset
    43
507826ef56fd 8075587: Compilation of constant array containing different sub classes crashes the JVM
roland
parents:
diff changeset
    44
        public Number[] getNumbers() {
507826ef56fd 8075587: Compilation of constant array containing different sub classes crashes the JVM
roland
parents:
diff changeset
    45
            return integers;
507826ef56fd 8075587: Compilation of constant array containing different sub classes crashes the JVM
roland
parents:
diff changeset
    46
        }
507826ef56fd 8075587: Compilation of constant array containing different sub classes crashes the JVM
roland
parents:
diff changeset
    47
    }
507826ef56fd 8075587: Compilation of constant array containing different sub classes crashes the JVM
roland
parents:
diff changeset
    48
507826ef56fd 8075587: Compilation of constant array containing different sub classes crashes the JVM
roland
parents:
diff changeset
    49
    public static class LongsHolder extends NumbersHolder {
507826ef56fd 8075587: Compilation of constant array containing different sub classes crashes the JVM
roland
parents:
diff changeset
    50
        private final static Long longs[] = { new Long(1) };
507826ef56fd 8075587: Compilation of constant array containing different sub classes crashes the JVM
roland
parents:
diff changeset
    51
507826ef56fd 8075587: Compilation of constant array containing different sub classes crashes the JVM
roland
parents:
diff changeset
    52
        public Number[] getNumbers() {
507826ef56fd 8075587: Compilation of constant array containing different sub classes crashes the JVM
roland
parents:
diff changeset
    53
            return longs;
507826ef56fd 8075587: Compilation of constant array containing different sub classes crashes the JVM
roland
parents:
diff changeset
    54
        }
507826ef56fd 8075587: Compilation of constant array containing different sub classes crashes the JVM
roland
parents:
diff changeset
    55
    }
507826ef56fd 8075587: Compilation of constant array containing different sub classes crashes the JVM
roland
parents:
diff changeset
    56
507826ef56fd 8075587: Compilation of constant array containing different sub classes crashes the JVM
roland
parents:
diff changeset
    57
    public static final void loopNumbers(NumbersHolder numbersHolder) {
507826ef56fd 8075587: Compilation of constant array containing different sub classes crashes the JVM
roland
parents:
diff changeset
    58
        Number[] numbers = numbersHolder.getNumbers();
507826ef56fd 8075587: Compilation of constant array containing different sub classes crashes the JVM
roland
parents:
diff changeset
    59
        for (int i = 0; i < numbers.length; i++) {
507826ef56fd 8075587: Compilation of constant array containing different sub classes crashes the JVM
roland
parents:
diff changeset
    60
            numbers[i].longValue();
507826ef56fd 8075587: Compilation of constant array containing different sub classes crashes the JVM
roland
parents:
diff changeset
    61
        }
507826ef56fd 8075587: Compilation of constant array containing different sub classes crashes the JVM
roland
parents:
diff changeset
    62
    }
507826ef56fd 8075587: Compilation of constant array containing different sub classes crashes the JVM
roland
parents:
diff changeset
    63
507826ef56fd 8075587: Compilation of constant array containing different sub classes crashes the JVM
roland
parents:
diff changeset
    64
    public static void main(String[] args) throws Exception {
507826ef56fd 8075587: Compilation of constant array containing different sub classes crashes the JVM
roland
parents:
diff changeset
    65
        for (int i = 0; i < 10000; i++) {
507826ef56fd 8075587: Compilation of constant array containing different sub classes crashes the JVM
roland
parents:
diff changeset
    66
            IntegersHolder integersHolder = new IntegersHolder();
507826ef56fd 8075587: Compilation of constant array containing different sub classes crashes the JVM
roland
parents:
diff changeset
    67
            LongsHolder longsHolder = new LongsHolder();
507826ef56fd 8075587: Compilation of constant array containing different sub classes crashes the JVM
roland
parents:
diff changeset
    68
            loopNumbers(integersHolder);
507826ef56fd 8075587: Compilation of constant array containing different sub classes crashes the JVM
roland
parents:
diff changeset
    69
            loopNumbers(longsHolder);
507826ef56fd 8075587: Compilation of constant array containing different sub classes crashes the JVM
roland
parents:
diff changeset
    70
        }
507826ef56fd 8075587: Compilation of constant array containing different sub classes crashes the JVM
roland
parents:
diff changeset
    71
    }
507826ef56fd 8075587: Compilation of constant array containing different sub classes crashes the JVM
roland
parents:
diff changeset
    72
}