hotspot/test/compiler/types/TestMeetExactConstantArrays.java
author stuefe
Thu, 28 Apr 2016 15:40:45 +0200
changeset 38215 fe1677e95252
parent 30210 507826ef56fd
child 40059 c2304140ed64
permissions -rw-r--r--
8155639: Remove STEP numbers from error reporting Reviewed-by: coleenp, twisti
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
 * @run main/othervm TestMeetExactConstantArrays
507826ef56fd 8075587: Compilation of constant array containing different sub classes crashes the JVM
roland
parents:
diff changeset
    29
 *
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
507826ef56fd 8075587: Compilation of constant array containing different sub classes crashes the JVM
roland
parents:
diff changeset
    32
public class TestMeetExactConstantArrays {
507826ef56fd 8075587: Compilation of constant array containing different sub classes crashes the JVM
roland
parents:
diff changeset
    33
    public abstract static class NumbersHolder {
507826ef56fd 8075587: Compilation of constant array containing different sub classes crashes the JVM
roland
parents:
diff changeset
    34
        public Number[] getNumbers() {
507826ef56fd 8075587: Compilation of constant array containing different sub classes crashes the JVM
roland
parents:
diff changeset
    35
            return null;
507826ef56fd 8075587: Compilation of constant array containing different sub classes crashes the JVM
roland
parents:
diff changeset
    36
        }
507826ef56fd 8075587: Compilation of constant array containing different sub classes crashes the JVM
roland
parents:
diff changeset
    37
    }
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
    public static class IntegersHolder extends NumbersHolder {
507826ef56fd 8075587: Compilation of constant array containing different sub classes crashes the JVM
roland
parents:
diff changeset
    40
        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
    41
507826ef56fd 8075587: Compilation of constant array containing different sub classes crashes the JVM
roland
parents:
diff changeset
    42
        public Number[] getNumbers() {
507826ef56fd 8075587: Compilation of constant array containing different sub classes crashes the JVM
roland
parents:
diff changeset
    43
            return integers;
507826ef56fd 8075587: Compilation of constant array containing different sub classes crashes the JVM
roland
parents:
diff changeset
    44
        }
507826ef56fd 8075587: Compilation of constant array containing different sub classes crashes the JVM
roland
parents:
diff changeset
    45
    }
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
    public static class LongsHolder extends NumbersHolder {
507826ef56fd 8075587: Compilation of constant array containing different sub classes crashes the JVM
roland
parents:
diff changeset
    48
        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
    49
507826ef56fd 8075587: Compilation of constant array containing different sub classes crashes the JVM
roland
parents:
diff changeset
    50
        public Number[] getNumbers() {
507826ef56fd 8075587: Compilation of constant array containing different sub classes crashes the JVM
roland
parents:
diff changeset
    51
            return longs;
507826ef56fd 8075587: Compilation of constant array containing different sub classes crashes the JVM
roland
parents:
diff changeset
    52
        }
507826ef56fd 8075587: Compilation of constant array containing different sub classes crashes the JVM
roland
parents:
diff changeset
    53
    }
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
    public static final void loopNumbers(NumbersHolder numbersHolder) {
507826ef56fd 8075587: Compilation of constant array containing different sub classes crashes the JVM
roland
parents:
diff changeset
    56
        Number[] numbers = numbersHolder.getNumbers();
507826ef56fd 8075587: Compilation of constant array containing different sub classes crashes the JVM
roland
parents:
diff changeset
    57
        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
    58
            numbers[i].longValue();
507826ef56fd 8075587: Compilation of constant array containing different sub classes crashes the JVM
roland
parents:
diff changeset
    59
        }
507826ef56fd 8075587: Compilation of constant array containing different sub classes crashes the JVM
roland
parents:
diff changeset
    60
    }
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
    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
    63
        for (int i = 0; i < 10000; i++) {
507826ef56fd 8075587: Compilation of constant array containing different sub classes crashes the JVM
roland
parents:
diff changeset
    64
            IntegersHolder integersHolder = new IntegersHolder();
507826ef56fd 8075587: Compilation of constant array containing different sub classes crashes the JVM
roland
parents:
diff changeset
    65
            LongsHolder longsHolder = new LongsHolder();
507826ef56fd 8075587: Compilation of constant array containing different sub classes crashes the JVM
roland
parents:
diff changeset
    66
            loopNumbers(integersHolder);
507826ef56fd 8075587: Compilation of constant array containing different sub classes crashes the JVM
roland
parents:
diff changeset
    67
            loopNumbers(longsHolder);
507826ef56fd 8075587: Compilation of constant array containing different sub classes crashes the JVM
roland
parents:
diff changeset
    68
        }
507826ef56fd 8075587: Compilation of constant array containing different sub classes crashes the JVM
roland
parents:
diff changeset
    69
    }
507826ef56fd 8075587: Compilation of constant array containing different sub classes crashes the JVM
roland
parents:
diff changeset
    70
}