hotspot/test/compiler/stable/TestStableDouble.java
author alanb
Tue, 03 May 2016 09:09:20 +0100
changeset 37773 e5b3e9732c3c
parent 36616 5172e3dd60f2
child 38207 2ed792c9481d
permissions -rw-r--r--
8154956: Module system implementation refresh (4/2016) Reviewed-by: acorn, jiangli, ccheung, hseigel Contributed-by: alan.bateman@oracle.com, lois.foltan@oracle.com, harold.seigel@oracle.com
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
23192
f6a1c8866065 8035828: Turn on @Stable support in VM
vlivanov
parents:
diff changeset
     1
/*
37773
e5b3e9732c3c 8154956: Module system implementation refresh (4/2016)
alanb
parents: 36616
diff changeset
     2
 * Copyright (c) 2014, 2016, Oracle and/or its affiliates. All rights reserved.
23192
f6a1c8866065 8035828: Turn on @Stable support in VM
vlivanov
parents:
diff changeset
     3
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
f6a1c8866065 8035828: Turn on @Stable support in VM
vlivanov
parents:
diff changeset
     4
 *
f6a1c8866065 8035828: Turn on @Stable support in VM
vlivanov
parents:
diff changeset
     5
 * This code is free software; you can redistribute it and/or modify it
f6a1c8866065 8035828: Turn on @Stable support in VM
vlivanov
parents:
diff changeset
     6
 * under the terms of the GNU General Public License version 2 only, as
f6a1c8866065 8035828: Turn on @Stable support in VM
vlivanov
parents:
diff changeset
     7
 * published by the Free Software Foundation.  Oracle designates this
f6a1c8866065 8035828: Turn on @Stable support in VM
vlivanov
parents:
diff changeset
     8
 * particular file as subject to the "Classpath" exception as provided
f6a1c8866065 8035828: Turn on @Stable support in VM
vlivanov
parents:
diff changeset
     9
 * by Oracle in the LICENSE file that accompanied this code.
f6a1c8866065 8035828: Turn on @Stable support in VM
vlivanov
parents:
diff changeset
    10
 *
f6a1c8866065 8035828: Turn on @Stable support in VM
vlivanov
parents:
diff changeset
    11
 * This code is distributed in the hope that it will be useful, but WITHOUT
f6a1c8866065 8035828: Turn on @Stable support in VM
vlivanov
parents:
diff changeset
    12
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
f6a1c8866065 8035828: Turn on @Stable support in VM
vlivanov
parents:
diff changeset
    13
 * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
f6a1c8866065 8035828: Turn on @Stable support in VM
vlivanov
parents:
diff changeset
    14
 * version 2 for more details (a copy is included in the LICENSE file that
f6a1c8866065 8035828: Turn on @Stable support in VM
vlivanov
parents:
diff changeset
    15
 * accompanied this code).
f6a1c8866065 8035828: Turn on @Stable support in VM
vlivanov
parents:
diff changeset
    16
 *
f6a1c8866065 8035828: Turn on @Stable support in VM
vlivanov
parents:
diff changeset
    17
 * You should have received a copy of the GNU General Public License version
f6a1c8866065 8035828: Turn on @Stable support in VM
vlivanov
parents:
diff changeset
    18
 * 2 along with this work; if not, write to the Free Software Foundation,
f6a1c8866065 8035828: Turn on @Stable support in VM
vlivanov
parents:
diff changeset
    19
 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
f6a1c8866065 8035828: Turn on @Stable support in VM
vlivanov
parents:
diff changeset
    20
 *
f6a1c8866065 8035828: Turn on @Stable support in VM
vlivanov
parents:
diff changeset
    21
 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
f6a1c8866065 8035828: Turn on @Stable support in VM
vlivanov
parents:
diff changeset
    22
 * or visit www.oracle.com if you need additional information or have any
f6a1c8866065 8035828: Turn on @Stable support in VM
vlivanov
parents:
diff changeset
    23
 * questions.
f6a1c8866065 8035828: Turn on @Stable support in VM
vlivanov
parents:
diff changeset
    24
 */
f6a1c8866065 8035828: Turn on @Stable support in VM
vlivanov
parents:
diff changeset
    25
f6a1c8866065 8035828: Turn on @Stable support in VM
vlivanov
parents:
diff changeset
    26
/*
f6a1c8866065 8035828: Turn on @Stable support in VM
vlivanov
parents:
diff changeset
    27
 * @test TestStableDouble
f6a1c8866065 8035828: Turn on @Stable support in VM
vlivanov
parents:
diff changeset
    28
 * @summary tests on stable fields and arrays
36508
5f9eee6b383b 8142968: Module System implementation
alanb
parents: 35099
diff changeset
    29
 * @library /testlibrary /test/lib /
5f9eee6b383b 8142968: Module System implementation
alanb
parents: 35099
diff changeset
    30
 * @modules java.base/jdk.internal.vm.annotation
5f9eee6b383b 8142968: Module System implementation
alanb
parents: 35099
diff changeset
    31
 * @build sun.hotspot.WhiteBox
5f9eee6b383b 8142968: Module System implementation
alanb
parents: 35099
diff changeset
    32
 * @build compiler.stable.TestStableDouble
23192
f6a1c8866065 8035828: Turn on @Stable support in VM
vlivanov
parents:
diff changeset
    33
 *
37773
e5b3e9732c3c 8154956: Module system implementation refresh (4/2016)
alanb
parents: 36616
diff changeset
    34
 * @run main/bootclasspath/othervm -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI -Xcomp
36508
5f9eee6b383b 8142968: Module System implementation
alanb
parents: 35099
diff changeset
    35
 *                         -XX:CompileOnly=::get,::get1,::get2,::get3,::get4
5f9eee6b383b 8142968: Module System implementation
alanb
parents: 35099
diff changeset
    36
 *                         -XX:-TieredCompilation
5f9eee6b383b 8142968: Module System implementation
alanb
parents: 35099
diff changeset
    37
 *                         -XX:+FoldStableValues
5f9eee6b383b 8142968: Module System implementation
alanb
parents: 35099
diff changeset
    38
 *                         compiler.stable.TestStableDouble
37773
e5b3e9732c3c 8154956: Module system implementation refresh (4/2016)
alanb
parents: 36616
diff changeset
    39
 * @run main/bootclasspath/othervm -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI -Xcomp
36508
5f9eee6b383b 8142968: Module System implementation
alanb
parents: 35099
diff changeset
    40
 *                         -XX:CompileOnly=::get,::get1,::get2,::get3,::get4
5f9eee6b383b 8142968: Module System implementation
alanb
parents: 35099
diff changeset
    41
 *                         -XX:-TieredCompilation
5f9eee6b383b 8142968: Module System implementation
alanb
parents: 35099
diff changeset
    42
 *                         -XX:+FoldStableValues
5f9eee6b383b 8142968: Module System implementation
alanb
parents: 35099
diff changeset
    43
 *                         compiler.stable.TestStableDouble
23192
f6a1c8866065 8035828: Turn on @Stable support in VM
vlivanov
parents:
diff changeset
    44
 *
37773
e5b3e9732c3c 8154956: Module system implementation refresh (4/2016)
alanb
parents: 36616
diff changeset
    45
 * @run main/bootclasspath/othervm -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI -Xcomp
36508
5f9eee6b383b 8142968: Module System implementation
alanb
parents: 35099
diff changeset
    46
 *                         -XX:CompileOnly=::get,::get1,::get2,::get3,::get4
5f9eee6b383b 8142968: Module System implementation
alanb
parents: 35099
diff changeset
    47
 *                         -XX:-TieredCompilation
5f9eee6b383b 8142968: Module System implementation
alanb
parents: 35099
diff changeset
    48
 *                         -XX:+FoldStableValues
5f9eee6b383b 8142968: Module System implementation
alanb
parents: 35099
diff changeset
    49
 *                         compiler.stable.TestStableDouble
37773
e5b3e9732c3c 8154956: Module system implementation refresh (4/2016)
alanb
parents: 36616
diff changeset
    50
 * @run main/bootclasspath/othervm -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI -Xcomp
36508
5f9eee6b383b 8142968: Module System implementation
alanb
parents: 35099
diff changeset
    51
 *                         -XX:CompileOnly=::get,::get1,::get2,::get3,::get4
5f9eee6b383b 8142968: Module System implementation
alanb
parents: 35099
diff changeset
    52
 *                         -XX:-TieredCompilation
5f9eee6b383b 8142968: Module System implementation
alanb
parents: 35099
diff changeset
    53
 *                         -XX:+FoldStableValues
5f9eee6b383b 8142968: Module System implementation
alanb
parents: 35099
diff changeset
    54
 *                         compiler.stable.TestStableDouble
23192
f6a1c8866065 8035828: Turn on @Stable support in VM
vlivanov
parents:
diff changeset
    55
 */
f6a1c8866065 8035828: Turn on @Stable support in VM
vlivanov
parents:
diff changeset
    56
36508
5f9eee6b383b 8142968: Module System implementation
alanb
parents: 35099
diff changeset
    57
package compiler.stable;
35099
982950884444 8144223: Move j.l.invoke.{ForceInline, DontInline, Stable} to jdk.internal.vm.annotation package
psandoz
parents: 33730
diff changeset
    58
23192
f6a1c8866065 8035828: Turn on @Stable support in VM
vlivanov
parents:
diff changeset
    59
import java.lang.reflect.InvocationTargetException;
36508
5f9eee6b383b 8142968: Module System implementation
alanb
parents: 35099
diff changeset
    60
import jdk.internal.vm.annotation.Stable;
23192
f6a1c8866065 8035828: Turn on @Stable support in VM
vlivanov
parents:
diff changeset
    61
f6a1c8866065 8035828: Turn on @Stable support in VM
vlivanov
parents:
diff changeset
    62
public class TestStableDouble {
25641
d99065e4572b 8043546: C1 optimizes @Stable instance fields with default values
vlivanov
parents: 23192
diff changeset
    63
    static final boolean isStableEnabled    = StableConfiguration.isStableEnabled;
d99065e4572b 8043546: C1 optimizes @Stable instance fields with default values
vlivanov
parents: 23192
diff changeset
    64
23192
f6a1c8866065 8035828: Turn on @Stable support in VM
vlivanov
parents:
diff changeset
    65
    public static void main(String[] args) throws Exception {
f6a1c8866065 8035828: Turn on @Stable support in VM
vlivanov
parents:
diff changeset
    66
        run(DefaultValue.class);
f6a1c8866065 8035828: Turn on @Stable support in VM
vlivanov
parents:
diff changeset
    67
        run(DoubleStable.class);
25641
d99065e4572b 8043546: C1 optimizes @Stable instance fields with default values
vlivanov
parents: 23192
diff changeset
    68
        run(DefaultStaticValue.class);
23192
f6a1c8866065 8035828: Turn on @Stable support in VM
vlivanov
parents:
diff changeset
    69
        run(StaticDoubleStable.class);
f6a1c8866065 8035828: Turn on @Stable support in VM
vlivanov
parents:
diff changeset
    70
        run(VolatileDoubleStable.class);
f6a1c8866065 8035828: Turn on @Stable support in VM
vlivanov
parents:
diff changeset
    71
f6a1c8866065 8035828: Turn on @Stable support in VM
vlivanov
parents:
diff changeset
    72
        // @Stable arrays: Dim 1-4
f6a1c8866065 8035828: Turn on @Stable support in VM
vlivanov
parents:
diff changeset
    73
        run(DoubleArrayDim1.class);
f6a1c8866065 8035828: Turn on @Stable support in VM
vlivanov
parents:
diff changeset
    74
        run(DoubleArrayDim2.class);
f6a1c8866065 8035828: Turn on @Stable support in VM
vlivanov
parents:
diff changeset
    75
        run(DoubleArrayDim3.class);
f6a1c8866065 8035828: Turn on @Stable support in VM
vlivanov
parents:
diff changeset
    76
        run(DoubleArrayDim4.class);
f6a1c8866065 8035828: Turn on @Stable support in VM
vlivanov
parents:
diff changeset
    77
f6a1c8866065 8035828: Turn on @Stable support in VM
vlivanov
parents:
diff changeset
    78
        // @Stable Object field: dynamic arrays
f6a1c8866065 8035828: Turn on @Stable support in VM
vlivanov
parents:
diff changeset
    79
        run(ObjectArrayLowerDim0.class);
f6a1c8866065 8035828: Turn on @Stable support in VM
vlivanov
parents:
diff changeset
    80
        run(ObjectArrayLowerDim1.class);
f6a1c8866065 8035828: Turn on @Stable support in VM
vlivanov
parents:
diff changeset
    81
        run(ObjectArrayLowerDim2.class);
f6a1c8866065 8035828: Turn on @Stable support in VM
vlivanov
parents:
diff changeset
    82
f6a1c8866065 8035828: Turn on @Stable support in VM
vlivanov
parents:
diff changeset
    83
        // Nested @Stable fields
f6a1c8866065 8035828: Turn on @Stable support in VM
vlivanov
parents:
diff changeset
    84
        run(NestedStableField.class);
f6a1c8866065 8035828: Turn on @Stable support in VM
vlivanov
parents:
diff changeset
    85
        run(NestedStableField1.class);
f6a1c8866065 8035828: Turn on @Stable support in VM
vlivanov
parents:
diff changeset
    86
        run(NestedStableField2.class);
f6a1c8866065 8035828: Turn on @Stable support in VM
vlivanov
parents:
diff changeset
    87
        run(NestedStableField3.class);
f6a1c8866065 8035828: Turn on @Stable support in VM
vlivanov
parents:
diff changeset
    88
f6a1c8866065 8035828: Turn on @Stable support in VM
vlivanov
parents:
diff changeset
    89
        if (failed) {
f6a1c8866065 8035828: Turn on @Stable support in VM
vlivanov
parents:
diff changeset
    90
            throw new Error("TEST FAILED");
f6a1c8866065 8035828: Turn on @Stable support in VM
vlivanov
parents:
diff changeset
    91
        }
f6a1c8866065 8035828: Turn on @Stable support in VM
vlivanov
parents:
diff changeset
    92
    }
f6a1c8866065 8035828: Turn on @Stable support in VM
vlivanov
parents:
diff changeset
    93
f6a1c8866065 8035828: Turn on @Stable support in VM
vlivanov
parents:
diff changeset
    94
    /* ==================================================== */
f6a1c8866065 8035828: Turn on @Stable support in VM
vlivanov
parents:
diff changeset
    95
f6a1c8866065 8035828: Turn on @Stable support in VM
vlivanov
parents:
diff changeset
    96
    static class DefaultValue {
f6a1c8866065 8035828: Turn on @Stable support in VM
vlivanov
parents:
diff changeset
    97
        public @Stable double v;
f6a1c8866065 8035828: Turn on @Stable support in VM
vlivanov
parents:
diff changeset
    98
f6a1c8866065 8035828: Turn on @Stable support in VM
vlivanov
parents:
diff changeset
    99
        public static final DefaultValue c = new DefaultValue();
f6a1c8866065 8035828: Turn on @Stable support in VM
vlivanov
parents:
diff changeset
   100
        public static double get() { return c.v; }
f6a1c8866065 8035828: Turn on @Stable support in VM
vlivanov
parents:
diff changeset
   101
        public static void test() throws Exception {
36508
5f9eee6b383b 8142968: Module System implementation
alanb
parents: 35099
diff changeset
   102
            double val1 = get();
23192
f6a1c8866065 8035828: Turn on @Stable support in VM
vlivanov
parents:
diff changeset
   103
            c.v = 1.0; double val2 = get();
f6a1c8866065 8035828: Turn on @Stable support in VM
vlivanov
parents:
diff changeset
   104
            assertEquals(val1, 0);
f6a1c8866065 8035828: Turn on @Stable support in VM
vlivanov
parents:
diff changeset
   105
            assertEquals(val2, 1.0);
f6a1c8866065 8035828: Turn on @Stable support in VM
vlivanov
parents:
diff changeset
   106
        }
f6a1c8866065 8035828: Turn on @Stable support in VM
vlivanov
parents:
diff changeset
   107
    }
f6a1c8866065 8035828: Turn on @Stable support in VM
vlivanov
parents:
diff changeset
   108
f6a1c8866065 8035828: Turn on @Stable support in VM
vlivanov
parents:
diff changeset
   109
    /* ==================================================== */
f6a1c8866065 8035828: Turn on @Stable support in VM
vlivanov
parents:
diff changeset
   110
f6a1c8866065 8035828: Turn on @Stable support in VM
vlivanov
parents:
diff changeset
   111
    static class DoubleStable {
f6a1c8866065 8035828: Turn on @Stable support in VM
vlivanov
parents:
diff changeset
   112
        public @Stable double v;
f6a1c8866065 8035828: Turn on @Stable support in VM
vlivanov
parents:
diff changeset
   113
f6a1c8866065 8035828: Turn on @Stable support in VM
vlivanov
parents:
diff changeset
   114
        public static final DoubleStable c = new DoubleStable();
f6a1c8866065 8035828: Turn on @Stable support in VM
vlivanov
parents:
diff changeset
   115
        public static double get() { return c.v; }
f6a1c8866065 8035828: Turn on @Stable support in VM
vlivanov
parents:
diff changeset
   116
        public static void test() throws Exception {
f6a1c8866065 8035828: Turn on @Stable support in VM
vlivanov
parents:
diff changeset
   117
            c.v = 1.0; double val1 = get();
f6a1c8866065 8035828: Turn on @Stable support in VM
vlivanov
parents:
diff changeset
   118
            c.v = Double.MAX_VALUE; double val2 = get();
f6a1c8866065 8035828: Turn on @Stable support in VM
vlivanov
parents:
diff changeset
   119
            assertEquals(val1, 1.0);
f6a1c8866065 8035828: Turn on @Stable support in VM
vlivanov
parents:
diff changeset
   120
            assertEquals(val2, (isStableEnabled ? 1.0 : Double.MAX_VALUE));
f6a1c8866065 8035828: Turn on @Stable support in VM
vlivanov
parents:
diff changeset
   121
        }
f6a1c8866065 8035828: Turn on @Stable support in VM
vlivanov
parents:
diff changeset
   122
    }
f6a1c8866065 8035828: Turn on @Stable support in VM
vlivanov
parents:
diff changeset
   123
f6a1c8866065 8035828: Turn on @Stable support in VM
vlivanov
parents:
diff changeset
   124
    /* ==================================================== */
f6a1c8866065 8035828: Turn on @Stable support in VM
vlivanov
parents:
diff changeset
   125
25641
d99065e4572b 8043546: C1 optimizes @Stable instance fields with default values
vlivanov
parents: 23192
diff changeset
   126
    static class DefaultStaticValue {
d99065e4572b 8043546: C1 optimizes @Stable instance fields with default values
vlivanov
parents: 23192
diff changeset
   127
        public static @Stable double v;
d99065e4572b 8043546: C1 optimizes @Stable instance fields with default values
vlivanov
parents: 23192
diff changeset
   128
d99065e4572b 8043546: C1 optimizes @Stable instance fields with default values
vlivanov
parents: 23192
diff changeset
   129
        public static final DefaultStaticValue c = new DefaultStaticValue();
d99065e4572b 8043546: C1 optimizes @Stable instance fields with default values
vlivanov
parents: 23192
diff changeset
   130
        public static double get() { return c.v; }
d99065e4572b 8043546: C1 optimizes @Stable instance fields with default values
vlivanov
parents: 23192
diff changeset
   131
        public static void test() throws Exception {
36508
5f9eee6b383b 8142968: Module System implementation
alanb
parents: 35099
diff changeset
   132
            double val1 = get();
25641
d99065e4572b 8043546: C1 optimizes @Stable instance fields with default values
vlivanov
parents: 23192
diff changeset
   133
            c.v = 1.0; double val2 = get();
d99065e4572b 8043546: C1 optimizes @Stable instance fields with default values
vlivanov
parents: 23192
diff changeset
   134
            assertEquals(val1, 0);
d99065e4572b 8043546: C1 optimizes @Stable instance fields with default values
vlivanov
parents: 23192
diff changeset
   135
            assertEquals(val2, 1.0);
d99065e4572b 8043546: C1 optimizes @Stable instance fields with default values
vlivanov
parents: 23192
diff changeset
   136
        }
d99065e4572b 8043546: C1 optimizes @Stable instance fields with default values
vlivanov
parents: 23192
diff changeset
   137
    }
d99065e4572b 8043546: C1 optimizes @Stable instance fields with default values
vlivanov
parents: 23192
diff changeset
   138
d99065e4572b 8043546: C1 optimizes @Stable instance fields with default values
vlivanov
parents: 23192
diff changeset
   139
    /* ==================================================== */
d99065e4572b 8043546: C1 optimizes @Stable instance fields with default values
vlivanov
parents: 23192
diff changeset
   140
23192
f6a1c8866065 8035828: Turn on @Stable support in VM
vlivanov
parents:
diff changeset
   141
    static class StaticDoubleStable {
f6a1c8866065 8035828: Turn on @Stable support in VM
vlivanov
parents:
diff changeset
   142
        public static @Stable double v;
f6a1c8866065 8035828: Turn on @Stable support in VM
vlivanov
parents:
diff changeset
   143
f6a1c8866065 8035828: Turn on @Stable support in VM
vlivanov
parents:
diff changeset
   144
        public static final StaticDoubleStable c = new StaticDoubleStable();
f6a1c8866065 8035828: Turn on @Stable support in VM
vlivanov
parents:
diff changeset
   145
        public static double get() { return c.v; }
f6a1c8866065 8035828: Turn on @Stable support in VM
vlivanov
parents:
diff changeset
   146
        public static void test() throws Exception {
f6a1c8866065 8035828: Turn on @Stable support in VM
vlivanov
parents:
diff changeset
   147
            c.v = 1.0; double val1 = get();
f6a1c8866065 8035828: Turn on @Stable support in VM
vlivanov
parents:
diff changeset
   148
            c.v = Double.MAX_VALUE; double val2 = get();
f6a1c8866065 8035828: Turn on @Stable support in VM
vlivanov
parents:
diff changeset
   149
            assertEquals(val1, 1.0);
f6a1c8866065 8035828: Turn on @Stable support in VM
vlivanov
parents:
diff changeset
   150
            assertEquals(val2, (isStableEnabled ? 1.0 : Double.MAX_VALUE));
f6a1c8866065 8035828: Turn on @Stable support in VM
vlivanov
parents:
diff changeset
   151
        }
f6a1c8866065 8035828: Turn on @Stable support in VM
vlivanov
parents:
diff changeset
   152
    }
f6a1c8866065 8035828: Turn on @Stable support in VM
vlivanov
parents:
diff changeset
   153
f6a1c8866065 8035828: Turn on @Stable support in VM
vlivanov
parents:
diff changeset
   154
    /* ==================================================== */
f6a1c8866065 8035828: Turn on @Stable support in VM
vlivanov
parents:
diff changeset
   155
f6a1c8866065 8035828: Turn on @Stable support in VM
vlivanov
parents:
diff changeset
   156
    static class VolatileDoubleStable {
f6a1c8866065 8035828: Turn on @Stable support in VM
vlivanov
parents:
diff changeset
   157
        public @Stable double v;
f6a1c8866065 8035828: Turn on @Stable support in VM
vlivanov
parents:
diff changeset
   158
f6a1c8866065 8035828: Turn on @Stable support in VM
vlivanov
parents:
diff changeset
   159
        public static final VolatileDoubleStable c = new VolatileDoubleStable();
f6a1c8866065 8035828: Turn on @Stable support in VM
vlivanov
parents:
diff changeset
   160
        public static double get() { return c.v; }
f6a1c8866065 8035828: Turn on @Stable support in VM
vlivanov
parents:
diff changeset
   161
        public static void test() throws Exception {
f6a1c8866065 8035828: Turn on @Stable support in VM
vlivanov
parents:
diff changeset
   162
            c.v = 1.0; double val1 = get();
f6a1c8866065 8035828: Turn on @Stable support in VM
vlivanov
parents:
diff changeset
   163
            c.v = Double.MAX_VALUE; double val2 = get();
f6a1c8866065 8035828: Turn on @Stable support in VM
vlivanov
parents:
diff changeset
   164
            assertEquals(val1, 1.0);
f6a1c8866065 8035828: Turn on @Stable support in VM
vlivanov
parents:
diff changeset
   165
            assertEquals(val2, (isStableEnabled ? 1.0 : Double.MAX_VALUE));
f6a1c8866065 8035828: Turn on @Stable support in VM
vlivanov
parents:
diff changeset
   166
        }
f6a1c8866065 8035828: Turn on @Stable support in VM
vlivanov
parents:
diff changeset
   167
    }
f6a1c8866065 8035828: Turn on @Stable support in VM
vlivanov
parents:
diff changeset
   168
f6a1c8866065 8035828: Turn on @Stable support in VM
vlivanov
parents:
diff changeset
   169
    /* ==================================================== */
f6a1c8866065 8035828: Turn on @Stable support in VM
vlivanov
parents:
diff changeset
   170
    // @Stable array == field && all components are stable
f6a1c8866065 8035828: Turn on @Stable support in VM
vlivanov
parents:
diff changeset
   171
f6a1c8866065 8035828: Turn on @Stable support in VM
vlivanov
parents:
diff changeset
   172
    static class DoubleArrayDim1 {
f6a1c8866065 8035828: Turn on @Stable support in VM
vlivanov
parents:
diff changeset
   173
        public @Stable double[] v;
f6a1c8866065 8035828: Turn on @Stable support in VM
vlivanov
parents:
diff changeset
   174
f6a1c8866065 8035828: Turn on @Stable support in VM
vlivanov
parents:
diff changeset
   175
        public static final DoubleArrayDim1 c = new DoubleArrayDim1();
f6a1c8866065 8035828: Turn on @Stable support in VM
vlivanov
parents:
diff changeset
   176
        public static double get() { return c.v[0]; }
f6a1c8866065 8035828: Turn on @Stable support in VM
vlivanov
parents:
diff changeset
   177
        public static double get1() { return c.v[10]; }
f6a1c8866065 8035828: Turn on @Stable support in VM
vlivanov
parents:
diff changeset
   178
        public static double[] get2() { return c.v; }
f6a1c8866065 8035828: Turn on @Stable support in VM
vlivanov
parents:
diff changeset
   179
        public static void test() throws Exception {
f6a1c8866065 8035828: Turn on @Stable support in VM
vlivanov
parents:
diff changeset
   180
            {
f6a1c8866065 8035828: Turn on @Stable support in VM
vlivanov
parents:
diff changeset
   181
                c.v = new double[1]; c.v[0] = 1.0; double val1 = get();
36508
5f9eee6b383b 8142968: Module System implementation
alanb
parents: 35099
diff changeset
   182
                c.v[0] = 2.0; double val2 = get();
23192
f6a1c8866065 8035828: Turn on @Stable support in VM
vlivanov
parents:
diff changeset
   183
                assertEquals(val1, 1.0);
36604
e9c073b0c19e 8143407: C1: @Stable array support
vlivanov
parents: 35099
diff changeset
   184
                assertEquals(val2, (isStableEnabled ? 1.0 : 2.0));
23192
f6a1c8866065 8035828: Turn on @Stable support in VM
vlivanov
parents:
diff changeset
   185
f6a1c8866065 8035828: Turn on @Stable support in VM
vlivanov
parents:
diff changeset
   186
                c.v = new double[1]; c.v[0] = 3.0; double val3 = get();
36604
e9c073b0c19e 8143407: C1: @Stable array support
vlivanov
parents: 35099
diff changeset
   187
                assertEquals(val3, (isStableEnabled ? (isStableEnabled ? 1.0 : 2.0)
36508
5f9eee6b383b 8142968: Module System implementation
alanb
parents: 35099
diff changeset
   188
                        : 3.0));
23192
f6a1c8866065 8035828: Turn on @Stable support in VM
vlivanov
parents:
diff changeset
   189
            }
f6a1c8866065 8035828: Turn on @Stable support in VM
vlivanov
parents:
diff changeset
   190
f6a1c8866065 8035828: Turn on @Stable support in VM
vlivanov
parents:
diff changeset
   191
            {
f6a1c8866065 8035828: Turn on @Stable support in VM
vlivanov
parents:
diff changeset
   192
                c.v = new double[20]; c.v[10] = 1.0; double val1 = get1();
36508
5f9eee6b383b 8142968: Module System implementation
alanb
parents: 35099
diff changeset
   193
                c.v[10] = 2.0; double val2 = get1();
23192
f6a1c8866065 8035828: Turn on @Stable support in VM
vlivanov
parents:
diff changeset
   194
                assertEquals(val1, 1.0);
36604
e9c073b0c19e 8143407: C1: @Stable array support
vlivanov
parents: 35099
diff changeset
   195
                assertEquals(val2, (isStableEnabled ? 1.0 : 2.0));
23192
f6a1c8866065 8035828: Turn on @Stable support in VM
vlivanov
parents:
diff changeset
   196
f6a1c8866065 8035828: Turn on @Stable support in VM
vlivanov
parents:
diff changeset
   197
                c.v = new double[20]; c.v[10] = 3.0; double val3 = get1();
36604
e9c073b0c19e 8143407: C1: @Stable array support
vlivanov
parents: 35099
diff changeset
   198
                assertEquals(val3, (isStableEnabled ? (isStableEnabled ? 1.0 : 2.0)
36508
5f9eee6b383b 8142968: Module System implementation
alanb
parents: 35099
diff changeset
   199
                        : 3.0));
23192
f6a1c8866065 8035828: Turn on @Stable support in VM
vlivanov
parents:
diff changeset
   200
            }
f6a1c8866065 8035828: Turn on @Stable support in VM
vlivanov
parents:
diff changeset
   201
f6a1c8866065 8035828: Turn on @Stable support in VM
vlivanov
parents:
diff changeset
   202
            {
f6a1c8866065 8035828: Turn on @Stable support in VM
vlivanov
parents:
diff changeset
   203
                c.v = new double[1]; double[] val1 = get2();
f6a1c8866065 8035828: Turn on @Stable support in VM
vlivanov
parents:
diff changeset
   204
                c.v = new double[1]; double[] val2 = get2();
f6a1c8866065 8035828: Turn on @Stable support in VM
vlivanov
parents:
diff changeset
   205
                assertTrue((isStableEnabled ? (val1 == val2) : (val1 != val2)));
f6a1c8866065 8035828: Turn on @Stable support in VM
vlivanov
parents:
diff changeset
   206
            }
f6a1c8866065 8035828: Turn on @Stable support in VM
vlivanov
parents:
diff changeset
   207
        }
f6a1c8866065 8035828: Turn on @Stable support in VM
vlivanov
parents:
diff changeset
   208
    }
f6a1c8866065 8035828: Turn on @Stable support in VM
vlivanov
parents:
diff changeset
   209
f6a1c8866065 8035828: Turn on @Stable support in VM
vlivanov
parents:
diff changeset
   210
    /* ==================================================== */
f6a1c8866065 8035828: Turn on @Stable support in VM
vlivanov
parents:
diff changeset
   211
f6a1c8866065 8035828: Turn on @Stable support in VM
vlivanov
parents:
diff changeset
   212
    static class DoubleArrayDim2 {
f6a1c8866065 8035828: Turn on @Stable support in VM
vlivanov
parents:
diff changeset
   213
        public @Stable double[][] v;
f6a1c8866065 8035828: Turn on @Stable support in VM
vlivanov
parents:
diff changeset
   214
f6a1c8866065 8035828: Turn on @Stable support in VM
vlivanov
parents:
diff changeset
   215
        public static final DoubleArrayDim2 c = new DoubleArrayDim2();
f6a1c8866065 8035828: Turn on @Stable support in VM
vlivanov
parents:
diff changeset
   216
        public static double get() { return c.v[0][0]; }
f6a1c8866065 8035828: Turn on @Stable support in VM
vlivanov
parents:
diff changeset
   217
        public static double[] get1() { return c.v[0]; }
f6a1c8866065 8035828: Turn on @Stable support in VM
vlivanov
parents:
diff changeset
   218
        public static double[][] get2() { return c.v; }
f6a1c8866065 8035828: Turn on @Stable support in VM
vlivanov
parents:
diff changeset
   219
        public static void test() throws Exception {
f6a1c8866065 8035828: Turn on @Stable support in VM
vlivanov
parents:
diff changeset
   220
            {
f6a1c8866065 8035828: Turn on @Stable support in VM
vlivanov
parents:
diff changeset
   221
                c.v = new double[1][1]; c.v[0][0] = 1.0; double val1 = get();
36508
5f9eee6b383b 8142968: Module System implementation
alanb
parents: 35099
diff changeset
   222
                c.v[0][0] = 2.0; double val2 = get();
23192
f6a1c8866065 8035828: Turn on @Stable support in VM
vlivanov
parents:
diff changeset
   223
                assertEquals(val1, 1.0);
36604
e9c073b0c19e 8143407: C1: @Stable array support
vlivanov
parents: 35099
diff changeset
   224
                assertEquals(val2, (isStableEnabled ? 1.0 : 2.0));
23192
f6a1c8866065 8035828: Turn on @Stable support in VM
vlivanov
parents:
diff changeset
   225
f6a1c8866065 8035828: Turn on @Stable support in VM
vlivanov
parents:
diff changeset
   226
                c.v = new double[1][1]; c.v[0][0] = 3.0; double val3 = get();
36604
e9c073b0c19e 8143407: C1: @Stable array support
vlivanov
parents: 35099
diff changeset
   227
                assertEquals(val3, (isStableEnabled ? (isStableEnabled ? 1.0 : 2.0)
36508
5f9eee6b383b 8142968: Module System implementation
alanb
parents: 35099
diff changeset
   228
                        : 3.0));
23192
f6a1c8866065 8035828: Turn on @Stable support in VM
vlivanov
parents:
diff changeset
   229
f6a1c8866065 8035828: Turn on @Stable support in VM
vlivanov
parents:
diff changeset
   230
                c.v[0] = new double[1]; c.v[0][0] = 4.0; double val4 = get();
36604
e9c073b0c19e 8143407: C1: @Stable array support
vlivanov
parents: 35099
diff changeset
   231
                assertEquals(val4, (isStableEnabled ? (isStableEnabled ? 1.0 : 2.0)
36508
5f9eee6b383b 8142968: Module System implementation
alanb
parents: 35099
diff changeset
   232
                        : 4.0));
23192
f6a1c8866065 8035828: Turn on @Stable support in VM
vlivanov
parents:
diff changeset
   233
            }
f6a1c8866065 8035828: Turn on @Stable support in VM
vlivanov
parents:
diff changeset
   234
f6a1c8866065 8035828: Turn on @Stable support in VM
vlivanov
parents:
diff changeset
   235
            {
f6a1c8866065 8035828: Turn on @Stable support in VM
vlivanov
parents:
diff changeset
   236
                c.v = new double[1][1]; double[] val1 = get1();
f6a1c8866065 8035828: Turn on @Stable support in VM
vlivanov
parents:
diff changeset
   237
                c.v[0] = new double[1]; double[] val2 = get1();
36604
e9c073b0c19e 8143407: C1: @Stable array support
vlivanov
parents: 35099
diff changeset
   238
                assertTrue((isStableEnabled ? (val1 == val2) : (val1 != val2)));
23192
f6a1c8866065 8035828: Turn on @Stable support in VM
vlivanov
parents:
diff changeset
   239
            }
f6a1c8866065 8035828: Turn on @Stable support in VM
vlivanov
parents:
diff changeset
   240
f6a1c8866065 8035828: Turn on @Stable support in VM
vlivanov
parents:
diff changeset
   241
            {
f6a1c8866065 8035828: Turn on @Stable support in VM
vlivanov
parents:
diff changeset
   242
                c.v = new double[1][1]; double[][] val1 = get2();
f6a1c8866065 8035828: Turn on @Stable support in VM
vlivanov
parents:
diff changeset
   243
                c.v = new double[1][1]; double[][] val2 = get2();
f6a1c8866065 8035828: Turn on @Stable support in VM
vlivanov
parents:
diff changeset
   244
                assertTrue((isStableEnabled ? (val1 == val2) : (val1 != val2)));
f6a1c8866065 8035828: Turn on @Stable support in VM
vlivanov
parents:
diff changeset
   245
            }
f6a1c8866065 8035828: Turn on @Stable support in VM
vlivanov
parents:
diff changeset
   246
        }
f6a1c8866065 8035828: Turn on @Stable support in VM
vlivanov
parents:
diff changeset
   247
    }
f6a1c8866065 8035828: Turn on @Stable support in VM
vlivanov
parents:
diff changeset
   248
f6a1c8866065 8035828: Turn on @Stable support in VM
vlivanov
parents:
diff changeset
   249
    /* ==================================================== */
f6a1c8866065 8035828: Turn on @Stable support in VM
vlivanov
parents:
diff changeset
   250
f6a1c8866065 8035828: Turn on @Stable support in VM
vlivanov
parents:
diff changeset
   251
    static class DoubleArrayDim3 {
f6a1c8866065 8035828: Turn on @Stable support in VM
vlivanov
parents:
diff changeset
   252
        public @Stable double[][][] v;
f6a1c8866065 8035828: Turn on @Stable support in VM
vlivanov
parents:
diff changeset
   253
f6a1c8866065 8035828: Turn on @Stable support in VM
vlivanov
parents:
diff changeset
   254
        public static final DoubleArrayDim3 c = new DoubleArrayDim3();
f6a1c8866065 8035828: Turn on @Stable support in VM
vlivanov
parents:
diff changeset
   255
        public static double get() { return c.v[0][0][0]; }
f6a1c8866065 8035828: Turn on @Stable support in VM
vlivanov
parents:
diff changeset
   256
        public static double[] get1() { return c.v[0][0]; }
f6a1c8866065 8035828: Turn on @Stable support in VM
vlivanov
parents:
diff changeset
   257
        public static double[][] get2() { return c.v[0]; }
f6a1c8866065 8035828: Turn on @Stable support in VM
vlivanov
parents:
diff changeset
   258
        public static double[][][] get3() { return c.v; }
f6a1c8866065 8035828: Turn on @Stable support in VM
vlivanov
parents:
diff changeset
   259
        public static void test() throws Exception {
f6a1c8866065 8035828: Turn on @Stable support in VM
vlivanov
parents:
diff changeset
   260
            {
f6a1c8866065 8035828: Turn on @Stable support in VM
vlivanov
parents:
diff changeset
   261
                c.v = new double[1][1][1]; c.v[0][0][0] = 1.0; double val1 = get();
36508
5f9eee6b383b 8142968: Module System implementation
alanb
parents: 35099
diff changeset
   262
                c.v[0][0][0] = 2.0; double val2 = get();
23192
f6a1c8866065 8035828: Turn on @Stable support in VM
vlivanov
parents:
diff changeset
   263
                assertEquals(val1, 1.0);
36604
e9c073b0c19e 8143407: C1: @Stable array support
vlivanov
parents: 35099
diff changeset
   264
                assertEquals(val2, (isStableEnabled ? 1.0 : 2.0));
23192
f6a1c8866065 8035828: Turn on @Stable support in VM
vlivanov
parents:
diff changeset
   265
f6a1c8866065 8035828: Turn on @Stable support in VM
vlivanov
parents:
diff changeset
   266
                c.v = new double[1][1][1]; c.v[0][0][0] = 3.0; double val3 = get();
36604
e9c073b0c19e 8143407: C1: @Stable array support
vlivanov
parents: 35099
diff changeset
   267
                assertEquals(val3, (isStableEnabled ? (isStableEnabled ? 1.0 : 2.0)
36508
5f9eee6b383b 8142968: Module System implementation
alanb
parents: 35099
diff changeset
   268
                        : 3.0));
23192
f6a1c8866065 8035828: Turn on @Stable support in VM
vlivanov
parents:
diff changeset
   269
f6a1c8866065 8035828: Turn on @Stable support in VM
vlivanov
parents:
diff changeset
   270
                c.v[0] = new double[1][1]; c.v[0][0][0] = 4.0; double val4 = get();
36604
e9c073b0c19e 8143407: C1: @Stable array support
vlivanov
parents: 35099
diff changeset
   271
                assertEquals(val4, (isStableEnabled ? (isStableEnabled ? 1.0 : 2.0)
36508
5f9eee6b383b 8142968: Module System implementation
alanb
parents: 35099
diff changeset
   272
                        : 4.0));
23192
f6a1c8866065 8035828: Turn on @Stable support in VM
vlivanov
parents:
diff changeset
   273
f6a1c8866065 8035828: Turn on @Stable support in VM
vlivanov
parents:
diff changeset
   274
                c.v[0][0] = new double[1]; c.v[0][0][0] = 5.0; double val5 = get();
36604
e9c073b0c19e 8143407: C1: @Stable array support
vlivanov
parents: 35099
diff changeset
   275
                assertEquals(val5, (isStableEnabled ? (isStableEnabled ? 1.0 : 2.0)
36508
5f9eee6b383b 8142968: Module System implementation
alanb
parents: 35099
diff changeset
   276
                        : 5.0));
23192
f6a1c8866065 8035828: Turn on @Stable support in VM
vlivanov
parents:
diff changeset
   277
            }
f6a1c8866065 8035828: Turn on @Stable support in VM
vlivanov
parents:
diff changeset
   278
f6a1c8866065 8035828: Turn on @Stable support in VM
vlivanov
parents:
diff changeset
   279
            {
f6a1c8866065 8035828: Turn on @Stable support in VM
vlivanov
parents:
diff changeset
   280
                c.v = new double[1][1][1]; double[] val1 = get1();
f6a1c8866065 8035828: Turn on @Stable support in VM
vlivanov
parents:
diff changeset
   281
                c.v[0][0] = new double[1]; double[] val2 = get1();
36604
e9c073b0c19e 8143407: C1: @Stable array support
vlivanov
parents: 35099
diff changeset
   282
                assertTrue((isStableEnabled ? (val1 == val2) : (val1 != val2)));
23192
f6a1c8866065 8035828: Turn on @Stable support in VM
vlivanov
parents:
diff changeset
   283
            }
f6a1c8866065 8035828: Turn on @Stable support in VM
vlivanov
parents:
diff changeset
   284
f6a1c8866065 8035828: Turn on @Stable support in VM
vlivanov
parents:
diff changeset
   285
            {
f6a1c8866065 8035828: Turn on @Stable support in VM
vlivanov
parents:
diff changeset
   286
                c.v = new double[1][1][1]; double[][] val1 = get2();
f6a1c8866065 8035828: Turn on @Stable support in VM
vlivanov
parents:
diff changeset
   287
                c.v[0] = new double[1][1]; double[][] val2 = get2();
36604
e9c073b0c19e 8143407: C1: @Stable array support
vlivanov
parents: 35099
diff changeset
   288
                assertTrue((isStableEnabled ? (val1 == val2) : (val1 != val2)));
23192
f6a1c8866065 8035828: Turn on @Stable support in VM
vlivanov
parents:
diff changeset
   289
            }
f6a1c8866065 8035828: Turn on @Stable support in VM
vlivanov
parents:
diff changeset
   290
f6a1c8866065 8035828: Turn on @Stable support in VM
vlivanov
parents:
diff changeset
   291
            {
f6a1c8866065 8035828: Turn on @Stable support in VM
vlivanov
parents:
diff changeset
   292
                c.v = new double[1][1][1]; double[][][] val1 = get3();
f6a1c8866065 8035828: Turn on @Stable support in VM
vlivanov
parents:
diff changeset
   293
                c.v = new double[1][1][1]; double[][][] val2 = get3();
f6a1c8866065 8035828: Turn on @Stable support in VM
vlivanov
parents:
diff changeset
   294
                assertTrue((isStableEnabled ? (val1 == val2) : (val1 != val2)));
f6a1c8866065 8035828: Turn on @Stable support in VM
vlivanov
parents:
diff changeset
   295
            }
f6a1c8866065 8035828: Turn on @Stable support in VM
vlivanov
parents:
diff changeset
   296
        }
f6a1c8866065 8035828: Turn on @Stable support in VM
vlivanov
parents:
diff changeset
   297
    }
f6a1c8866065 8035828: Turn on @Stable support in VM
vlivanov
parents:
diff changeset
   298
f6a1c8866065 8035828: Turn on @Stable support in VM
vlivanov
parents:
diff changeset
   299
    /* ==================================================== */
f6a1c8866065 8035828: Turn on @Stable support in VM
vlivanov
parents:
diff changeset
   300
f6a1c8866065 8035828: Turn on @Stable support in VM
vlivanov
parents:
diff changeset
   301
    static class DoubleArrayDim4 {
f6a1c8866065 8035828: Turn on @Stable support in VM
vlivanov
parents:
diff changeset
   302
        public @Stable double[][][][] v;
f6a1c8866065 8035828: Turn on @Stable support in VM
vlivanov
parents:
diff changeset
   303
f6a1c8866065 8035828: Turn on @Stable support in VM
vlivanov
parents:
diff changeset
   304
        public static final DoubleArrayDim4 c = new DoubleArrayDim4();
f6a1c8866065 8035828: Turn on @Stable support in VM
vlivanov
parents:
diff changeset
   305
        public static double get() { return c.v[0][0][0][0]; }
f6a1c8866065 8035828: Turn on @Stable support in VM
vlivanov
parents:
diff changeset
   306
        public static double[] get1() { return c.v[0][0][0]; }
f6a1c8866065 8035828: Turn on @Stable support in VM
vlivanov
parents:
diff changeset
   307
        public static double[][] get2() { return c.v[0][0]; }
f6a1c8866065 8035828: Turn on @Stable support in VM
vlivanov
parents:
diff changeset
   308
        public static double[][][] get3() { return c.v[0]; }
f6a1c8866065 8035828: Turn on @Stable support in VM
vlivanov
parents:
diff changeset
   309
        public static double[][][][] get4() { return c.v; }
f6a1c8866065 8035828: Turn on @Stable support in VM
vlivanov
parents:
diff changeset
   310
        public static void test() throws Exception {
f6a1c8866065 8035828: Turn on @Stable support in VM
vlivanov
parents:
diff changeset
   311
            {
f6a1c8866065 8035828: Turn on @Stable support in VM
vlivanov
parents:
diff changeset
   312
                c.v = new double[1][1][1][1]; c.v[0][0][0][0] = 1.0; double val1 = get();
36508
5f9eee6b383b 8142968: Module System implementation
alanb
parents: 35099
diff changeset
   313
                c.v[0][0][0][0] = 2.0; double val2 = get();
23192
f6a1c8866065 8035828: Turn on @Stable support in VM
vlivanov
parents:
diff changeset
   314
                assertEquals(val1, 1.0);
36604
e9c073b0c19e 8143407: C1: @Stable array support
vlivanov
parents: 35099
diff changeset
   315
                assertEquals(val2, (isStableEnabled ? 1.0 : 2.0));
23192
f6a1c8866065 8035828: Turn on @Stable support in VM
vlivanov
parents:
diff changeset
   316
f6a1c8866065 8035828: Turn on @Stable support in VM
vlivanov
parents:
diff changeset
   317
                c.v = new double[1][1][1][1]; c.v[0][0][0][0] = 3.0; double val3 = get();
36604
e9c073b0c19e 8143407: C1: @Stable array support
vlivanov
parents: 35099
diff changeset
   318
                assertEquals(val3, (isStableEnabled ? (isStableEnabled ? 1.0 : 2.0)
36508
5f9eee6b383b 8142968: Module System implementation
alanb
parents: 35099
diff changeset
   319
                        : 3.0));
23192
f6a1c8866065 8035828: Turn on @Stable support in VM
vlivanov
parents:
diff changeset
   320
f6a1c8866065 8035828: Turn on @Stable support in VM
vlivanov
parents:
diff changeset
   321
                c.v[0] = new double[1][1][1]; c.v[0][0][0][0] = 4.0; double val4 = get();
36604
e9c073b0c19e 8143407: C1: @Stable array support
vlivanov
parents: 35099
diff changeset
   322
                assertEquals(val4, (isStableEnabled ? (isStableEnabled ? 1.0 : 2.0)
36508
5f9eee6b383b 8142968: Module System implementation
alanb
parents: 35099
diff changeset
   323
                        : 4.0));
23192
f6a1c8866065 8035828: Turn on @Stable support in VM
vlivanov
parents:
diff changeset
   324
f6a1c8866065 8035828: Turn on @Stable support in VM
vlivanov
parents:
diff changeset
   325
                c.v[0][0] = new double[1][1]; c.v[0][0][0][0] = 5.0; double val5 = get();
36604
e9c073b0c19e 8143407: C1: @Stable array support
vlivanov
parents: 35099
diff changeset
   326
                assertEquals(val5, (isStableEnabled ? (isStableEnabled ? 1.0 : 2.0)
36508
5f9eee6b383b 8142968: Module System implementation
alanb
parents: 35099
diff changeset
   327
                        : 5.0));
23192
f6a1c8866065 8035828: Turn on @Stable support in VM
vlivanov
parents:
diff changeset
   328
f6a1c8866065 8035828: Turn on @Stable support in VM
vlivanov
parents:
diff changeset
   329
                c.v[0][0][0] = new double[1]; c.v[0][0][0][0] = 6.0; double val6 = get();
36604
e9c073b0c19e 8143407: C1: @Stable array support
vlivanov
parents: 35099
diff changeset
   330
                assertEquals(val6, (isStableEnabled ? (isStableEnabled ? 1.0 : 2.0)
36508
5f9eee6b383b 8142968: Module System implementation
alanb
parents: 35099
diff changeset
   331
                        : 6.0));
23192
f6a1c8866065 8035828: Turn on @Stable support in VM
vlivanov
parents:
diff changeset
   332
            }
f6a1c8866065 8035828: Turn on @Stable support in VM
vlivanov
parents:
diff changeset
   333
f6a1c8866065 8035828: Turn on @Stable support in VM
vlivanov
parents:
diff changeset
   334
            {
f6a1c8866065 8035828: Turn on @Stable support in VM
vlivanov
parents:
diff changeset
   335
                c.v = new double[1][1][1][1]; double[] val1 = get1();
f6a1c8866065 8035828: Turn on @Stable support in VM
vlivanov
parents:
diff changeset
   336
                c.v[0][0][0] = new double[1]; double[] val2 = get1();
36604
e9c073b0c19e 8143407: C1: @Stable array support
vlivanov
parents: 35099
diff changeset
   337
                assertTrue((isStableEnabled ? (val1 == val2) : (val1 != val2)));
23192
f6a1c8866065 8035828: Turn on @Stable support in VM
vlivanov
parents:
diff changeset
   338
            }
f6a1c8866065 8035828: Turn on @Stable support in VM
vlivanov
parents:
diff changeset
   339
f6a1c8866065 8035828: Turn on @Stable support in VM
vlivanov
parents:
diff changeset
   340
            {
f6a1c8866065 8035828: Turn on @Stable support in VM
vlivanov
parents:
diff changeset
   341
                c.v = new double[1][1][1][1]; double[][] val1 = get2();
f6a1c8866065 8035828: Turn on @Stable support in VM
vlivanov
parents:
diff changeset
   342
                c.v[0][0] = new double[1][1]; double[][] val2 = get2();
36604
e9c073b0c19e 8143407: C1: @Stable array support
vlivanov
parents: 35099
diff changeset
   343
                assertTrue((isStableEnabled ? (val1 == val2) : (val1 != val2)));
23192
f6a1c8866065 8035828: Turn on @Stable support in VM
vlivanov
parents:
diff changeset
   344
            }
f6a1c8866065 8035828: Turn on @Stable support in VM
vlivanov
parents:
diff changeset
   345
f6a1c8866065 8035828: Turn on @Stable support in VM
vlivanov
parents:
diff changeset
   346
            {
f6a1c8866065 8035828: Turn on @Stable support in VM
vlivanov
parents:
diff changeset
   347
                c.v = new double[1][1][1][1]; double[][][] val1 = get3();
f6a1c8866065 8035828: Turn on @Stable support in VM
vlivanov
parents:
diff changeset
   348
                c.v[0] = new double[1][1][1]; double[][][] val2 = get3();
36604
e9c073b0c19e 8143407: C1: @Stable array support
vlivanov
parents: 35099
diff changeset
   349
                assertTrue((isStableEnabled ? (val1 == val2) : (val1 != val2)));
23192
f6a1c8866065 8035828: Turn on @Stable support in VM
vlivanov
parents:
diff changeset
   350
            }
f6a1c8866065 8035828: Turn on @Stable support in VM
vlivanov
parents:
diff changeset
   351
f6a1c8866065 8035828: Turn on @Stable support in VM
vlivanov
parents:
diff changeset
   352
            {
f6a1c8866065 8035828: Turn on @Stable support in VM
vlivanov
parents:
diff changeset
   353
                c.v = new double[1][1][1][1]; double[][][][] val1 = get4();
f6a1c8866065 8035828: Turn on @Stable support in VM
vlivanov
parents:
diff changeset
   354
                c.v = new double[1][1][1][1]; double[][][][] val2 = get4();
f6a1c8866065 8035828: Turn on @Stable support in VM
vlivanov
parents:
diff changeset
   355
                assertTrue((isStableEnabled ? (val1 == val2) : (val1 != val2)));
f6a1c8866065 8035828: Turn on @Stable support in VM
vlivanov
parents:
diff changeset
   356
            }
f6a1c8866065 8035828: Turn on @Stable support in VM
vlivanov
parents:
diff changeset
   357
        }
f6a1c8866065 8035828: Turn on @Stable support in VM
vlivanov
parents:
diff changeset
   358
    }
f6a1c8866065 8035828: Turn on @Stable support in VM
vlivanov
parents:
diff changeset
   359
f6a1c8866065 8035828: Turn on @Stable support in VM
vlivanov
parents:
diff changeset
   360
    /* ==================================================== */
f6a1c8866065 8035828: Turn on @Stable support in VM
vlivanov
parents:
diff changeset
   361
    // Dynamic Dim is higher than static
f6a1c8866065 8035828: Turn on @Stable support in VM
vlivanov
parents:
diff changeset
   362
    static class ObjectArrayLowerDim0 {
f6a1c8866065 8035828: Turn on @Stable support in VM
vlivanov
parents:
diff changeset
   363
        public @Stable Object v;
f6a1c8866065 8035828: Turn on @Stable support in VM
vlivanov
parents:
diff changeset
   364
f6a1c8866065 8035828: Turn on @Stable support in VM
vlivanov
parents:
diff changeset
   365
        public static final ObjectArrayLowerDim0 c = new ObjectArrayLowerDim0();
f6a1c8866065 8035828: Turn on @Stable support in VM
vlivanov
parents:
diff changeset
   366
        public static double get() { return ((double[])c.v)[0]; }
f6a1c8866065 8035828: Turn on @Stable support in VM
vlivanov
parents:
diff changeset
   367
        public static double[] get1() { return (double[])c.v; }
f6a1c8866065 8035828: Turn on @Stable support in VM
vlivanov
parents:
diff changeset
   368
f6a1c8866065 8035828: Turn on @Stable support in VM
vlivanov
parents:
diff changeset
   369
        public static void test() throws Exception {
f6a1c8866065 8035828: Turn on @Stable support in VM
vlivanov
parents:
diff changeset
   370
            {
f6a1c8866065 8035828: Turn on @Stable support in VM
vlivanov
parents:
diff changeset
   371
                c.v = new double[1]; ((double[])c.v)[0] = 1.0; double val1 = get();
36508
5f9eee6b383b 8142968: Module System implementation
alanb
parents: 35099
diff changeset
   372
                ((double[])c.v)[0] = 2.0; double val2 = get();
23192
f6a1c8866065 8035828: Turn on @Stable support in VM
vlivanov
parents:
diff changeset
   373
f6a1c8866065 8035828: Turn on @Stable support in VM
vlivanov
parents:
diff changeset
   374
                assertEquals(val1, 1.0);
f6a1c8866065 8035828: Turn on @Stable support in VM
vlivanov
parents:
diff changeset
   375
                assertEquals(val2, 2.0);
f6a1c8866065 8035828: Turn on @Stable support in VM
vlivanov
parents:
diff changeset
   376
            }
f6a1c8866065 8035828: Turn on @Stable support in VM
vlivanov
parents:
diff changeset
   377
f6a1c8866065 8035828: Turn on @Stable support in VM
vlivanov
parents:
diff changeset
   378
            {
f6a1c8866065 8035828: Turn on @Stable support in VM
vlivanov
parents:
diff changeset
   379
                c.v = new double[1]; double[] val1 = get1();
f6a1c8866065 8035828: Turn on @Stable support in VM
vlivanov
parents:
diff changeset
   380
                c.v = new double[1]; double[] val2 = get1();
f6a1c8866065 8035828: Turn on @Stable support in VM
vlivanov
parents:
diff changeset
   381
                assertTrue((isStableEnabled ? (val1 == val2) : (val1 != val2)));
f6a1c8866065 8035828: Turn on @Stable support in VM
vlivanov
parents:
diff changeset
   382
            }
f6a1c8866065 8035828: Turn on @Stable support in VM
vlivanov
parents:
diff changeset
   383
        }
f6a1c8866065 8035828: Turn on @Stable support in VM
vlivanov
parents:
diff changeset
   384
    }
f6a1c8866065 8035828: Turn on @Stable support in VM
vlivanov
parents:
diff changeset
   385
f6a1c8866065 8035828: Turn on @Stable support in VM
vlivanov
parents:
diff changeset
   386
    /* ==================================================== */
f6a1c8866065 8035828: Turn on @Stable support in VM
vlivanov
parents:
diff changeset
   387
f6a1c8866065 8035828: Turn on @Stable support in VM
vlivanov
parents:
diff changeset
   388
    static class ObjectArrayLowerDim1 {
f6a1c8866065 8035828: Turn on @Stable support in VM
vlivanov
parents:
diff changeset
   389
        public @Stable Object[] v;
f6a1c8866065 8035828: Turn on @Stable support in VM
vlivanov
parents:
diff changeset
   390
f6a1c8866065 8035828: Turn on @Stable support in VM
vlivanov
parents:
diff changeset
   391
        public static final ObjectArrayLowerDim1 c = new ObjectArrayLowerDim1();
f6a1c8866065 8035828: Turn on @Stable support in VM
vlivanov
parents:
diff changeset
   392
        public static double get() { return ((double[][])c.v)[0][0]; }
f6a1c8866065 8035828: Turn on @Stable support in VM
vlivanov
parents:
diff changeset
   393
        public static double[] get1() { return (double[])(c.v[0]); }
f6a1c8866065 8035828: Turn on @Stable support in VM
vlivanov
parents:
diff changeset
   394
        public static Object[] get2() { return c.v; }
f6a1c8866065 8035828: Turn on @Stable support in VM
vlivanov
parents:
diff changeset
   395
f6a1c8866065 8035828: Turn on @Stable support in VM
vlivanov
parents:
diff changeset
   396
        public static void test() throws Exception {
f6a1c8866065 8035828: Turn on @Stable support in VM
vlivanov
parents:
diff changeset
   397
            {
f6a1c8866065 8035828: Turn on @Stable support in VM
vlivanov
parents:
diff changeset
   398
                c.v = new double[1][1]; ((double[][])c.v)[0][0] = 1.0; double val1 = get();
36508
5f9eee6b383b 8142968: Module System implementation
alanb
parents: 35099
diff changeset
   399
                ((double[][])c.v)[0][0] = 2.0; double val2 = get();
23192
f6a1c8866065 8035828: Turn on @Stable support in VM
vlivanov
parents:
diff changeset
   400
f6a1c8866065 8035828: Turn on @Stable support in VM
vlivanov
parents:
diff changeset
   401
                assertEquals(val1, 1.0);
f6a1c8866065 8035828: Turn on @Stable support in VM
vlivanov
parents:
diff changeset
   402
                assertEquals(val2, 2.0);
f6a1c8866065 8035828: Turn on @Stable support in VM
vlivanov
parents:
diff changeset
   403
            }
f6a1c8866065 8035828: Turn on @Stable support in VM
vlivanov
parents:
diff changeset
   404
f6a1c8866065 8035828: Turn on @Stable support in VM
vlivanov
parents:
diff changeset
   405
            {
f6a1c8866065 8035828: Turn on @Stable support in VM
vlivanov
parents:
diff changeset
   406
                c.v = new double[1][1]; c.v[0] = new double[0]; double[] val1 = get1();
36508
5f9eee6b383b 8142968: Module System implementation
alanb
parents: 35099
diff changeset
   407
                c.v[0] = new double[0]; double[] val2 = get1();
23192
f6a1c8866065 8035828: Turn on @Stable support in VM
vlivanov
parents:
diff changeset
   408
36604
e9c073b0c19e 8143407: C1: @Stable array support
vlivanov
parents: 35099
diff changeset
   409
                assertTrue((isStableEnabled ? (val1 == val2) : (val1 != val2)));
23192
f6a1c8866065 8035828: Turn on @Stable support in VM
vlivanov
parents:
diff changeset
   410
            }
f6a1c8866065 8035828: Turn on @Stable support in VM
vlivanov
parents:
diff changeset
   411
f6a1c8866065 8035828: Turn on @Stable support in VM
vlivanov
parents:
diff changeset
   412
            {
f6a1c8866065 8035828: Turn on @Stable support in VM
vlivanov
parents:
diff changeset
   413
                c.v = new double[0][0]; Object[] val1 = get2();
f6a1c8866065 8035828: Turn on @Stable support in VM
vlivanov
parents:
diff changeset
   414
                c.v = new double[0][0]; Object[] val2 = get2();
f6a1c8866065 8035828: Turn on @Stable support in VM
vlivanov
parents:
diff changeset
   415
f6a1c8866065 8035828: Turn on @Stable support in VM
vlivanov
parents:
diff changeset
   416
                assertTrue((isStableEnabled ? (val1 == val2) : (val1 != val2)));
f6a1c8866065 8035828: Turn on @Stable support in VM
vlivanov
parents:
diff changeset
   417
            }
f6a1c8866065 8035828: Turn on @Stable support in VM
vlivanov
parents:
diff changeset
   418
        }
f6a1c8866065 8035828: Turn on @Stable support in VM
vlivanov
parents:
diff changeset
   419
    }
f6a1c8866065 8035828: Turn on @Stable support in VM
vlivanov
parents:
diff changeset
   420
f6a1c8866065 8035828: Turn on @Stable support in VM
vlivanov
parents:
diff changeset
   421
    /* ==================================================== */
f6a1c8866065 8035828: Turn on @Stable support in VM
vlivanov
parents:
diff changeset
   422
f6a1c8866065 8035828: Turn on @Stable support in VM
vlivanov
parents:
diff changeset
   423
    static class ObjectArrayLowerDim2 {
f6a1c8866065 8035828: Turn on @Stable support in VM
vlivanov
parents:
diff changeset
   424
        public @Stable Object[][] v;
f6a1c8866065 8035828: Turn on @Stable support in VM
vlivanov
parents:
diff changeset
   425
f6a1c8866065 8035828: Turn on @Stable support in VM
vlivanov
parents:
diff changeset
   426
        public static final ObjectArrayLowerDim2 c = new ObjectArrayLowerDim2();
f6a1c8866065 8035828: Turn on @Stable support in VM
vlivanov
parents:
diff changeset
   427
        public static double get() { return ((double[][][])c.v)[0][0][0]; }
f6a1c8866065 8035828: Turn on @Stable support in VM
vlivanov
parents:
diff changeset
   428
        public static double[] get1() { return (double[])(c.v[0][0]); }
f6a1c8866065 8035828: Turn on @Stable support in VM
vlivanov
parents:
diff changeset
   429
        public static double[][] get2() { return (double[][])(c.v[0]); }
f6a1c8866065 8035828: Turn on @Stable support in VM
vlivanov
parents:
diff changeset
   430
        public static Object[][] get3() { return c.v; }
f6a1c8866065 8035828: Turn on @Stable support in VM
vlivanov
parents:
diff changeset
   431
f6a1c8866065 8035828: Turn on @Stable support in VM
vlivanov
parents:
diff changeset
   432
        public static void test() throws Exception {
f6a1c8866065 8035828: Turn on @Stable support in VM
vlivanov
parents:
diff changeset
   433
            {
f6a1c8866065 8035828: Turn on @Stable support in VM
vlivanov
parents:
diff changeset
   434
                c.v = new double[1][1][1]; ((double[][][])c.v)[0][0][0] = 1.0; double val1 = get();
36508
5f9eee6b383b 8142968: Module System implementation
alanb
parents: 35099
diff changeset
   435
                ((double[][][])c.v)[0][0][0] = 2.0; double val2 = get();
23192
f6a1c8866065 8035828: Turn on @Stable support in VM
vlivanov
parents:
diff changeset
   436
f6a1c8866065 8035828: Turn on @Stable support in VM
vlivanov
parents:
diff changeset
   437
                assertEquals(val1, 1.0);
f6a1c8866065 8035828: Turn on @Stable support in VM
vlivanov
parents:
diff changeset
   438
                assertEquals(val2, 2.0);
f6a1c8866065 8035828: Turn on @Stable support in VM
vlivanov
parents:
diff changeset
   439
            }
f6a1c8866065 8035828: Turn on @Stable support in VM
vlivanov
parents:
diff changeset
   440
f6a1c8866065 8035828: Turn on @Stable support in VM
vlivanov
parents:
diff changeset
   441
            {
f6a1c8866065 8035828: Turn on @Stable support in VM
vlivanov
parents:
diff changeset
   442
                c.v = new double[1][1][1]; c.v[0][0] = new double[0]; double[] val1 = get1();
36508
5f9eee6b383b 8142968: Module System implementation
alanb
parents: 35099
diff changeset
   443
                c.v[0][0] = new double[0]; double[] val2 = get1();
23192
f6a1c8866065 8035828: Turn on @Stable support in VM
vlivanov
parents:
diff changeset
   444
36604
e9c073b0c19e 8143407: C1: @Stable array support
vlivanov
parents: 35099
diff changeset
   445
                assertTrue((isStableEnabled ? (val1 == val2) : (val1 != val2)));
23192
f6a1c8866065 8035828: Turn on @Stable support in VM
vlivanov
parents:
diff changeset
   446
            }
f6a1c8866065 8035828: Turn on @Stable support in VM
vlivanov
parents:
diff changeset
   447
f6a1c8866065 8035828: Turn on @Stable support in VM
vlivanov
parents:
diff changeset
   448
            {
f6a1c8866065 8035828: Turn on @Stable support in VM
vlivanov
parents:
diff changeset
   449
                c.v = new double[1][1][1]; c.v[0] = new double[0][0]; double[][] val1 = get2();
36508
5f9eee6b383b 8142968: Module System implementation
alanb
parents: 35099
diff changeset
   450
                c.v[0] = new double[0][0]; double[][] val2 = get2();
23192
f6a1c8866065 8035828: Turn on @Stable support in VM
vlivanov
parents:
diff changeset
   451
36604
e9c073b0c19e 8143407: C1: @Stable array support
vlivanov
parents: 35099
diff changeset
   452
                assertTrue((isStableEnabled ? (val1 == val2) : (val1 != val2)));
23192
f6a1c8866065 8035828: Turn on @Stable support in VM
vlivanov
parents:
diff changeset
   453
            }
f6a1c8866065 8035828: Turn on @Stable support in VM
vlivanov
parents:
diff changeset
   454
f6a1c8866065 8035828: Turn on @Stable support in VM
vlivanov
parents:
diff changeset
   455
            {
f6a1c8866065 8035828: Turn on @Stable support in VM
vlivanov
parents:
diff changeset
   456
                c.v = new double[0][0][0]; Object[][] val1 = get3();
f6a1c8866065 8035828: Turn on @Stable support in VM
vlivanov
parents:
diff changeset
   457
                c.v = new double[0][0][0]; Object[][] val2 = get3();
f6a1c8866065 8035828: Turn on @Stable support in VM
vlivanov
parents:
diff changeset
   458
f6a1c8866065 8035828: Turn on @Stable support in VM
vlivanov
parents:
diff changeset
   459
                assertTrue((isStableEnabled ? (val1 == val2) : (val1 != val2)));
f6a1c8866065 8035828: Turn on @Stable support in VM
vlivanov
parents:
diff changeset
   460
            }
f6a1c8866065 8035828: Turn on @Stable support in VM
vlivanov
parents:
diff changeset
   461
        }
f6a1c8866065 8035828: Turn on @Stable support in VM
vlivanov
parents:
diff changeset
   462
    }
f6a1c8866065 8035828: Turn on @Stable support in VM
vlivanov
parents:
diff changeset
   463
f6a1c8866065 8035828: Turn on @Stable support in VM
vlivanov
parents:
diff changeset
   464
    /* ==================================================== */
f6a1c8866065 8035828: Turn on @Stable support in VM
vlivanov
parents:
diff changeset
   465
f6a1c8866065 8035828: Turn on @Stable support in VM
vlivanov
parents:
diff changeset
   466
    static class NestedStableField {
f6a1c8866065 8035828: Turn on @Stable support in VM
vlivanov
parents:
diff changeset
   467
        static class A {
f6a1c8866065 8035828: Turn on @Stable support in VM
vlivanov
parents:
diff changeset
   468
            public @Stable double a;
f6a1c8866065 8035828: Turn on @Stable support in VM
vlivanov
parents:
diff changeset
   469
f6a1c8866065 8035828: Turn on @Stable support in VM
vlivanov
parents:
diff changeset
   470
        }
f6a1c8866065 8035828: Turn on @Stable support in VM
vlivanov
parents:
diff changeset
   471
        public @Stable A v;
f6a1c8866065 8035828: Turn on @Stable support in VM
vlivanov
parents:
diff changeset
   472
f6a1c8866065 8035828: Turn on @Stable support in VM
vlivanov
parents:
diff changeset
   473
        public static final NestedStableField c = new NestedStableField();
f6a1c8866065 8035828: Turn on @Stable support in VM
vlivanov
parents:
diff changeset
   474
        public static A get() { return c.v; }
f6a1c8866065 8035828: Turn on @Stable support in VM
vlivanov
parents:
diff changeset
   475
        public static double get1() { return get().a; }
f6a1c8866065 8035828: Turn on @Stable support in VM
vlivanov
parents:
diff changeset
   476
f6a1c8866065 8035828: Turn on @Stable support in VM
vlivanov
parents:
diff changeset
   477
        public static void test() throws Exception {
f6a1c8866065 8035828: Turn on @Stable support in VM
vlivanov
parents:
diff changeset
   478
            {
f6a1c8866065 8035828: Turn on @Stable support in VM
vlivanov
parents:
diff changeset
   479
                c.v = new A(); c.v.a = 1.0; A val1 = get();
36508
5f9eee6b383b 8142968: Module System implementation
alanb
parents: 35099
diff changeset
   480
                c.v.a = 2.0; A val2 = get();
23192
f6a1c8866065 8035828: Turn on @Stable support in VM
vlivanov
parents:
diff changeset
   481
f6a1c8866065 8035828: Turn on @Stable support in VM
vlivanov
parents:
diff changeset
   482
                assertEquals(val1.a, 2.0);
f6a1c8866065 8035828: Turn on @Stable support in VM
vlivanov
parents:
diff changeset
   483
                assertEquals(val2.a, 2.0);
f6a1c8866065 8035828: Turn on @Stable support in VM
vlivanov
parents:
diff changeset
   484
            }
f6a1c8866065 8035828: Turn on @Stable support in VM
vlivanov
parents:
diff changeset
   485
f6a1c8866065 8035828: Turn on @Stable support in VM
vlivanov
parents:
diff changeset
   486
            {
f6a1c8866065 8035828: Turn on @Stable support in VM
vlivanov
parents:
diff changeset
   487
                c.v = new A(); c.v.a = 1.0; double val1 = get1();
36508
5f9eee6b383b 8142968: Module System implementation
alanb
parents: 35099
diff changeset
   488
                c.v.a = 2.0; double val2 = get1();
23192
f6a1c8866065 8035828: Turn on @Stable support in VM
vlivanov
parents:
diff changeset
   489
                c.v = new A(); c.v.a = 3.0; double val3 = get1();
f6a1c8866065 8035828: Turn on @Stable support in VM
vlivanov
parents:
diff changeset
   490
f6a1c8866065 8035828: Turn on @Stable support in VM
vlivanov
parents:
diff changeset
   491
                assertEquals(val1, 1.0);
f6a1c8866065 8035828: Turn on @Stable support in VM
vlivanov
parents:
diff changeset
   492
                assertEquals(val2, (isStableEnabled ? 1.0 : 2.0));
f6a1c8866065 8035828: Turn on @Stable support in VM
vlivanov
parents:
diff changeset
   493
                assertEquals(val3, (isStableEnabled ? 1.0 : 3.0));
f6a1c8866065 8035828: Turn on @Stable support in VM
vlivanov
parents:
diff changeset
   494
            }
f6a1c8866065 8035828: Turn on @Stable support in VM
vlivanov
parents:
diff changeset
   495
        }
f6a1c8866065 8035828: Turn on @Stable support in VM
vlivanov
parents:
diff changeset
   496
    }
f6a1c8866065 8035828: Turn on @Stable support in VM
vlivanov
parents:
diff changeset
   497
f6a1c8866065 8035828: Turn on @Stable support in VM
vlivanov
parents:
diff changeset
   498
    /* ==================================================== */
f6a1c8866065 8035828: Turn on @Stable support in VM
vlivanov
parents:
diff changeset
   499
f6a1c8866065 8035828: Turn on @Stable support in VM
vlivanov
parents:
diff changeset
   500
    static class NestedStableField1 {
f6a1c8866065 8035828: Turn on @Stable support in VM
vlivanov
parents:
diff changeset
   501
        static class A {
f6a1c8866065 8035828: Turn on @Stable support in VM
vlivanov
parents:
diff changeset
   502
            public @Stable double a;
f6a1c8866065 8035828: Turn on @Stable support in VM
vlivanov
parents:
diff changeset
   503
            public @Stable A next;
f6a1c8866065 8035828: Turn on @Stable support in VM
vlivanov
parents:
diff changeset
   504
        }
f6a1c8866065 8035828: Turn on @Stable support in VM
vlivanov
parents:
diff changeset
   505
        public @Stable A v;
f6a1c8866065 8035828: Turn on @Stable support in VM
vlivanov
parents:
diff changeset
   506
f6a1c8866065 8035828: Turn on @Stable support in VM
vlivanov
parents:
diff changeset
   507
        public static final NestedStableField1 c = new NestedStableField1();
f6a1c8866065 8035828: Turn on @Stable support in VM
vlivanov
parents:
diff changeset
   508
        public static A get() { return c.v.next.next.next.next.next.next.next; }
f6a1c8866065 8035828: Turn on @Stable support in VM
vlivanov
parents:
diff changeset
   509
        public static double get1() { return get().a; }
f6a1c8866065 8035828: Turn on @Stable support in VM
vlivanov
parents:
diff changeset
   510
f6a1c8866065 8035828: Turn on @Stable support in VM
vlivanov
parents:
diff changeset
   511
        public static void test() throws Exception {
f6a1c8866065 8035828: Turn on @Stable support in VM
vlivanov
parents:
diff changeset
   512
            {
f6a1c8866065 8035828: Turn on @Stable support in VM
vlivanov
parents:
diff changeset
   513
                c.v = new A(); c.v.next = new A();   c.v.next.next  = c.v;
36508
5f9eee6b383b 8142968: Module System implementation
alanb
parents: 35099
diff changeset
   514
                c.v.a = 1.0; c.v.next.a = 1.0; A val1 = get();
5f9eee6b383b 8142968: Module System implementation
alanb
parents: 35099
diff changeset
   515
                c.v.a = 2.0; c.v.next.a = 2.0; A val2 = get();
23192
f6a1c8866065 8035828: Turn on @Stable support in VM
vlivanov
parents:
diff changeset
   516
f6a1c8866065 8035828: Turn on @Stable support in VM
vlivanov
parents:
diff changeset
   517
                assertEquals(val1.a, 2.0);
f6a1c8866065 8035828: Turn on @Stable support in VM
vlivanov
parents:
diff changeset
   518
                assertEquals(val2.a, 2.0);
f6a1c8866065 8035828: Turn on @Stable support in VM
vlivanov
parents:
diff changeset
   519
            }
f6a1c8866065 8035828: Turn on @Stable support in VM
vlivanov
parents:
diff changeset
   520
f6a1c8866065 8035828: Turn on @Stable support in VM
vlivanov
parents:
diff changeset
   521
            {
f6a1c8866065 8035828: Turn on @Stable support in VM
vlivanov
parents:
diff changeset
   522
                c.v = new A(); c.v.next = c.v;
36508
5f9eee6b383b 8142968: Module System implementation
alanb
parents: 35099
diff changeset
   523
                c.v.a = 1.0; double val1 = get1();
5f9eee6b383b 8142968: Module System implementation
alanb
parents: 35099
diff changeset
   524
                c.v.a = 2.0; double val2 = get1();
23192
f6a1c8866065 8035828: Turn on @Stable support in VM
vlivanov
parents:
diff changeset
   525
                c.v = new A(); c.v.next = c.v;
36508
5f9eee6b383b 8142968: Module System implementation
alanb
parents: 35099
diff changeset
   526
                c.v.a = 3.0; double val3 = get1();
23192
f6a1c8866065 8035828: Turn on @Stable support in VM
vlivanov
parents:
diff changeset
   527
f6a1c8866065 8035828: Turn on @Stable support in VM
vlivanov
parents:
diff changeset
   528
                assertEquals(val1, 1.0);
f6a1c8866065 8035828: Turn on @Stable support in VM
vlivanov
parents:
diff changeset
   529
                assertEquals(val2, (isStableEnabled ? 1.0 : 2.0));
f6a1c8866065 8035828: Turn on @Stable support in VM
vlivanov
parents:
diff changeset
   530
                assertEquals(val3, (isStableEnabled ? 1.0 : 3.0));
f6a1c8866065 8035828: Turn on @Stable support in VM
vlivanov
parents:
diff changeset
   531
            }
f6a1c8866065 8035828: Turn on @Stable support in VM
vlivanov
parents:
diff changeset
   532
        }
f6a1c8866065 8035828: Turn on @Stable support in VM
vlivanov
parents:
diff changeset
   533
    }
f6a1c8866065 8035828: Turn on @Stable support in VM
vlivanov
parents:
diff changeset
   534
   /* ==================================================== */
f6a1c8866065 8035828: Turn on @Stable support in VM
vlivanov
parents:
diff changeset
   535
f6a1c8866065 8035828: Turn on @Stable support in VM
vlivanov
parents:
diff changeset
   536
    static class NestedStableField2 {
f6a1c8866065 8035828: Turn on @Stable support in VM
vlivanov
parents:
diff changeset
   537
        static class A {
f6a1c8866065 8035828: Turn on @Stable support in VM
vlivanov
parents:
diff changeset
   538
            public @Stable double a;
f6a1c8866065 8035828: Turn on @Stable support in VM
vlivanov
parents:
diff changeset
   539
            public @Stable A left;
f6a1c8866065 8035828: Turn on @Stable support in VM
vlivanov
parents:
diff changeset
   540
            public         A right;
f6a1c8866065 8035828: Turn on @Stable support in VM
vlivanov
parents:
diff changeset
   541
        }
f6a1c8866065 8035828: Turn on @Stable support in VM
vlivanov
parents:
diff changeset
   542
f6a1c8866065 8035828: Turn on @Stable support in VM
vlivanov
parents:
diff changeset
   543
        public @Stable A v;
f6a1c8866065 8035828: Turn on @Stable support in VM
vlivanov
parents:
diff changeset
   544
f6a1c8866065 8035828: Turn on @Stable support in VM
vlivanov
parents:
diff changeset
   545
        public static final NestedStableField2 c = new NestedStableField2();
f6a1c8866065 8035828: Turn on @Stable support in VM
vlivanov
parents:
diff changeset
   546
        public static double get() { return c.v.left.left.left.a; }
f6a1c8866065 8035828: Turn on @Stable support in VM
vlivanov
parents:
diff changeset
   547
        public static double get1() { return c.v.left.left.right.left.a; }
f6a1c8866065 8035828: Turn on @Stable support in VM
vlivanov
parents:
diff changeset
   548
f6a1c8866065 8035828: Turn on @Stable support in VM
vlivanov
parents:
diff changeset
   549
        public static void test() throws Exception {
f6a1c8866065 8035828: Turn on @Stable support in VM
vlivanov
parents:
diff changeset
   550
            {
f6a1c8866065 8035828: Turn on @Stable support in VM
vlivanov
parents:
diff changeset
   551
                c.v = new A(); c.v.left = c.v.right = c.v;
36508
5f9eee6b383b 8142968: Module System implementation
alanb
parents: 35099
diff changeset
   552
                c.v.a = 1.0; double val1 = get(); double val2 = get1();
5f9eee6b383b 8142968: Module System implementation
alanb
parents: 35099
diff changeset
   553
                c.v.a = 2.0; double val3 = get(); double val4 = get1();
23192
f6a1c8866065 8035828: Turn on @Stable support in VM
vlivanov
parents:
diff changeset
   554
f6a1c8866065 8035828: Turn on @Stable support in VM
vlivanov
parents:
diff changeset
   555
                assertEquals(val1, 1.0);
f6a1c8866065 8035828: Turn on @Stable support in VM
vlivanov
parents:
diff changeset
   556
                assertEquals(val3, (isStableEnabled ? 1.0 : 2.0));
f6a1c8866065 8035828: Turn on @Stable support in VM
vlivanov
parents:
diff changeset
   557
f6a1c8866065 8035828: Turn on @Stable support in VM
vlivanov
parents:
diff changeset
   558
                assertEquals(val2, 1.0);
f6a1c8866065 8035828: Turn on @Stable support in VM
vlivanov
parents:
diff changeset
   559
                assertEquals(val4, 2.0);
f6a1c8866065 8035828: Turn on @Stable support in VM
vlivanov
parents:
diff changeset
   560
            }
f6a1c8866065 8035828: Turn on @Stable support in VM
vlivanov
parents:
diff changeset
   561
        }
f6a1c8866065 8035828: Turn on @Stable support in VM
vlivanov
parents:
diff changeset
   562
    }
f6a1c8866065 8035828: Turn on @Stable support in VM
vlivanov
parents:
diff changeset
   563
f6a1c8866065 8035828: Turn on @Stable support in VM
vlivanov
parents:
diff changeset
   564
    /* ==================================================== */
f6a1c8866065 8035828: Turn on @Stable support in VM
vlivanov
parents:
diff changeset
   565
f6a1c8866065 8035828: Turn on @Stable support in VM
vlivanov
parents:
diff changeset
   566
    static class NestedStableField3 {
f6a1c8866065 8035828: Turn on @Stable support in VM
vlivanov
parents:
diff changeset
   567
        static class A {
f6a1c8866065 8035828: Turn on @Stable support in VM
vlivanov
parents:
diff changeset
   568
            public @Stable double a;
f6a1c8866065 8035828: Turn on @Stable support in VM
vlivanov
parents:
diff changeset
   569
            public @Stable A[] left;
f6a1c8866065 8035828: Turn on @Stable support in VM
vlivanov
parents:
diff changeset
   570
            public         A[] right;
f6a1c8866065 8035828: Turn on @Stable support in VM
vlivanov
parents:
diff changeset
   571
        }
f6a1c8866065 8035828: Turn on @Stable support in VM
vlivanov
parents:
diff changeset
   572
f6a1c8866065 8035828: Turn on @Stable support in VM
vlivanov
parents:
diff changeset
   573
        public @Stable A[] v;
f6a1c8866065 8035828: Turn on @Stable support in VM
vlivanov
parents:
diff changeset
   574
f6a1c8866065 8035828: Turn on @Stable support in VM
vlivanov
parents:
diff changeset
   575
        public static final NestedStableField3 c = new NestedStableField3();
f6a1c8866065 8035828: Turn on @Stable support in VM
vlivanov
parents:
diff changeset
   576
        public static double get() { return c.v[0].left[1].left[0].left[1].a; }
f6a1c8866065 8035828: Turn on @Stable support in VM
vlivanov
parents:
diff changeset
   577
        public static double get1() { return c.v[1].left[0].left[1].right[0].left[1].a; }
f6a1c8866065 8035828: Turn on @Stable support in VM
vlivanov
parents:
diff changeset
   578
f6a1c8866065 8035828: Turn on @Stable support in VM
vlivanov
parents:
diff changeset
   579
        public static void test() throws Exception {
f6a1c8866065 8035828: Turn on @Stable support in VM
vlivanov
parents:
diff changeset
   580
            {
f6a1c8866065 8035828: Turn on @Stable support in VM
vlivanov
parents:
diff changeset
   581
                A elem = new A();
f6a1c8866065 8035828: Turn on @Stable support in VM
vlivanov
parents:
diff changeset
   582
                c.v = new A[] { elem, elem }; c.v[0].left = c.v[0].right = c.v;
36508
5f9eee6b383b 8142968: Module System implementation
alanb
parents: 35099
diff changeset
   583
                elem.a = 1.0; double val1 = get(); double val2 = get1();
5f9eee6b383b 8142968: Module System implementation
alanb
parents: 35099
diff changeset
   584
                elem.a = 2.0; double val3 = get(); double val4 = get1();
23192
f6a1c8866065 8035828: Turn on @Stable support in VM
vlivanov
parents:
diff changeset
   585
f6a1c8866065 8035828: Turn on @Stable support in VM
vlivanov
parents:
diff changeset
   586
                assertEquals(val1, 1.0);
36604
e9c073b0c19e 8143407: C1: @Stable array support
vlivanov
parents: 35099
diff changeset
   587
                assertEquals(val3, (isStableEnabled ? 1.0 : 2.0));
23192
f6a1c8866065 8035828: Turn on @Stable support in VM
vlivanov
parents:
diff changeset
   588
f6a1c8866065 8035828: Turn on @Stable support in VM
vlivanov
parents:
diff changeset
   589
                assertEquals(val2, 1.0);
f6a1c8866065 8035828: Turn on @Stable support in VM
vlivanov
parents:
diff changeset
   590
                assertEquals(val4, 2.0);
f6a1c8866065 8035828: Turn on @Stable support in VM
vlivanov
parents:
diff changeset
   591
            }
f6a1c8866065 8035828: Turn on @Stable support in VM
vlivanov
parents:
diff changeset
   592
        }
f6a1c8866065 8035828: Turn on @Stable support in VM
vlivanov
parents:
diff changeset
   593
    }
f6a1c8866065 8035828: Turn on @Stable support in VM
vlivanov
parents:
diff changeset
   594
f6a1c8866065 8035828: Turn on @Stable support in VM
vlivanov
parents:
diff changeset
   595
    /* ==================================================== */
f6a1c8866065 8035828: Turn on @Stable support in VM
vlivanov
parents:
diff changeset
   596
    // Auxiliary methods
f6a1c8866065 8035828: Turn on @Stable support in VM
vlivanov
parents:
diff changeset
   597
    static void assertEquals(double i, double j) { if (i != j)  throw new AssertionError(i + " != " + j); }
f6a1c8866065 8035828: Turn on @Stable support in VM
vlivanov
parents:
diff changeset
   598
    static void assertTrue(boolean b) { if (!b)  throw new AssertionError(); }
f6a1c8866065 8035828: Turn on @Stable support in VM
vlivanov
parents:
diff changeset
   599
f6a1c8866065 8035828: Turn on @Stable support in VM
vlivanov
parents:
diff changeset
   600
    static boolean failed = false;
f6a1c8866065 8035828: Turn on @Stable support in VM
vlivanov
parents:
diff changeset
   601
f6a1c8866065 8035828: Turn on @Stable support in VM
vlivanov
parents:
diff changeset
   602
    public static void run(Class<?> test) {
f6a1c8866065 8035828: Turn on @Stable support in VM
vlivanov
parents:
diff changeset
   603
        Throwable ex = null;
f6a1c8866065 8035828: Turn on @Stable support in VM
vlivanov
parents:
diff changeset
   604
        System.out.print(test.getName()+": ");
f6a1c8866065 8035828: Turn on @Stable support in VM
vlivanov
parents:
diff changeset
   605
        try {
f6a1c8866065 8035828: Turn on @Stable support in VM
vlivanov
parents:
diff changeset
   606
            test.getMethod("test").invoke(null);
f6a1c8866065 8035828: Turn on @Stable support in VM
vlivanov
parents:
diff changeset
   607
        } catch (InvocationTargetException e) {
f6a1c8866065 8035828: Turn on @Stable support in VM
vlivanov
parents:
diff changeset
   608
            ex = e.getCause();
f6a1c8866065 8035828: Turn on @Stable support in VM
vlivanov
parents:
diff changeset
   609
        } catch (Throwable e) {
f6a1c8866065 8035828: Turn on @Stable support in VM
vlivanov
parents:
diff changeset
   610
            ex = e;
f6a1c8866065 8035828: Turn on @Stable support in VM
vlivanov
parents:
diff changeset
   611
        } finally {
f6a1c8866065 8035828: Turn on @Stable support in VM
vlivanov
parents:
diff changeset
   612
            if (ex == null) {
f6a1c8866065 8035828: Turn on @Stable support in VM
vlivanov
parents:
diff changeset
   613
                System.out.println("PASSED");
f6a1c8866065 8035828: Turn on @Stable support in VM
vlivanov
parents:
diff changeset
   614
            } else {
f6a1c8866065 8035828: Turn on @Stable support in VM
vlivanov
parents:
diff changeset
   615
                failed = true;
f6a1c8866065 8035828: Turn on @Stable support in VM
vlivanov
parents:
diff changeset
   616
                System.out.println("FAILED");
f6a1c8866065 8035828: Turn on @Stable support in VM
vlivanov
parents:
diff changeset
   617
                ex.printStackTrace(System.out);
f6a1c8866065 8035828: Turn on @Stable support in VM
vlivanov
parents:
diff changeset
   618
            }
f6a1c8866065 8035828: Turn on @Stable support in VM
vlivanov
parents:
diff changeset
   619
        }
f6a1c8866065 8035828: Turn on @Stable support in VM
vlivanov
parents:
diff changeset
   620
    }
f6a1c8866065 8035828: Turn on @Stable support in VM
vlivanov
parents:
diff changeset
   621
}