hotspot/test/compiler/inlining/InlineAccessors.java
author duke
Wed, 05 Jul 2017 22:24:41 +0200
changeset 41867 d62173b931bf
parent 41705 332239c052cc
permissions -rw-r--r--
Merge
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
34169
b0b7187852b7 8140650: Method::is_accessor should cover getters and setters for all types
shade
parents:
diff changeset
     1
/*
40631
ed82623d7831 8157957: ClassNotFoundException: jdk.test.lib.JDKToolFinder
ctornqvi
parents: 40059
diff changeset
     2
 * Copyright (c) 2015, 2016, Oracle and/or its affiliates. All rights reserved.
34169
b0b7187852b7 8140650: Method::is_accessor should cover getters and setters for all types
shade
parents:
diff changeset
     3
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
b0b7187852b7 8140650: Method::is_accessor should cover getters and setters for all types
shade
parents:
diff changeset
     4
 *
b0b7187852b7 8140650: Method::is_accessor should cover getters and setters for all types
shade
parents:
diff changeset
     5
 * This code is free software; you can redistribute it and/or modify it
b0b7187852b7 8140650: Method::is_accessor should cover getters and setters for all types
shade
parents:
diff changeset
     6
 * under the terms of the GNU General Public License version 2 only, as
b0b7187852b7 8140650: Method::is_accessor should cover getters and setters for all types
shade
parents:
diff changeset
     7
 * published by the Free Software Foundation.
b0b7187852b7 8140650: Method::is_accessor should cover getters and setters for all types
shade
parents:
diff changeset
     8
 *
b0b7187852b7 8140650: Method::is_accessor should cover getters and setters for all types
shade
parents:
diff changeset
     9
 * This code is distributed in the hope that it will be useful, but WITHOUT
b0b7187852b7 8140650: Method::is_accessor should cover getters and setters for all types
shade
parents:
diff changeset
    10
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
b0b7187852b7 8140650: Method::is_accessor should cover getters and setters for all types
shade
parents:
diff changeset
    11
 * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
b0b7187852b7 8140650: Method::is_accessor should cover getters and setters for all types
shade
parents:
diff changeset
    12
 * version 2 for more details (a copy is included in the LICENSE file that
b0b7187852b7 8140650: Method::is_accessor should cover getters and setters for all types
shade
parents:
diff changeset
    13
 * accompanied this code).
b0b7187852b7 8140650: Method::is_accessor should cover getters and setters for all types
shade
parents:
diff changeset
    14
 *
b0b7187852b7 8140650: Method::is_accessor should cover getters and setters for all types
shade
parents:
diff changeset
    15
 * You should have received a copy of the GNU General Public License version
b0b7187852b7 8140650: Method::is_accessor should cover getters and setters for all types
shade
parents:
diff changeset
    16
 * 2 along with this work; if not, write to the Free Software Foundation,
b0b7187852b7 8140650: Method::is_accessor should cover getters and setters for all types
shade
parents:
diff changeset
    17
 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
b0b7187852b7 8140650: Method::is_accessor should cover getters and setters for all types
shade
parents:
diff changeset
    18
 *
b0b7187852b7 8140650: Method::is_accessor should cover getters and setters for all types
shade
parents:
diff changeset
    19
 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
b0b7187852b7 8140650: Method::is_accessor should cover getters and setters for all types
shade
parents:
diff changeset
    20
 * or visit www.oracle.com if you need additional information or have any
b0b7187852b7 8140650: Method::is_accessor should cover getters and setters for all types
shade
parents:
diff changeset
    21
 * questions.
b0b7187852b7 8140650: Method::is_accessor should cover getters and setters for all types
shade
parents:
diff changeset
    22
 */
41705
332239c052cc 8165687: Fix license and copyright headers in jd9 under hotspot/test
stsmirno
parents: 40631
diff changeset
    23
34169
b0b7187852b7 8140650: Method::is_accessor should cover getters and setters for all types
shade
parents:
diff changeset
    24
/**
b0b7187852b7 8140650: Method::is_accessor should cover getters and setters for all types
shade
parents:
diff changeset
    25
 * @test
b0b7187852b7 8140650: Method::is_accessor should cover getters and setters for all types
shade
parents:
diff changeset
    26
 * @bug 8140650
b0b7187852b7 8140650: Method::is_accessor should cover getters and setters for all types
shade
parents:
diff changeset
    27
 * @summary Method::is_accessor should cover getters and setters for all types
38152
80e5da81fb2c 8154258: [TESTBUG] Various serviceability tests fail compilation
dsamersoff
parents: 34169
diff changeset
    28
 * @modules java.base/jdk.internal.misc
40631
ed82623d7831 8157957: ClassNotFoundException: jdk.test.lib.JDKToolFinder
ctornqvi
parents: 40059
diff changeset
    29
 * @library /test/lib
40059
c2304140ed64 8132919: Put compiler tests in packages
tpivovarova
parents: 38152
diff changeset
    30
 *
c2304140ed64 8132919: Put compiler tests in packages
tpivovarova
parents: 38152
diff changeset
    31
 * @run driver compiler.inlining.InlineAccessors
34169
b0b7187852b7 8140650: Method::is_accessor should cover getters and setters for all types
shade
parents:
diff changeset
    32
 */
40059
c2304140ed64 8132919: Put compiler tests in packages
tpivovarova
parents: 38152
diff changeset
    33
c2304140ed64 8132919: Put compiler tests in packages
tpivovarova
parents: 38152
diff changeset
    34
package compiler.inlining;
c2304140ed64 8132919: Put compiler tests in packages
tpivovarova
parents: 38152
diff changeset
    35
40631
ed82623d7831 8157957: ClassNotFoundException: jdk.test.lib.JDKToolFinder
ctornqvi
parents: 40059
diff changeset
    36
import jdk.test.lib.process.OutputAnalyzer;
ed82623d7831 8157957: ClassNotFoundException: jdk.test.lib.JDKToolFinder
ctornqvi
parents: 40059
diff changeset
    37
import jdk.test.lib.process.ProcessTools;
34169
b0b7187852b7 8140650: Method::is_accessor should cover getters and setters for all types
shade
parents:
diff changeset
    38
b0b7187852b7 8140650: Method::is_accessor should cover getters and setters for all types
shade
parents:
diff changeset
    39
public class InlineAccessors {
b0b7187852b7 8140650: Method::is_accessor should cover getters and setters for all types
shade
parents:
diff changeset
    40
    public static void main(String[] args) throws Exception {
b0b7187852b7 8140650: Method::is_accessor should cover getters and setters for all types
shade
parents:
diff changeset
    41
        // try some sanity checks first
b0b7187852b7 8140650: Method::is_accessor should cover getters and setters for all types
shade
parents:
diff changeset
    42
        doTest();
b0b7187852b7 8140650: Method::is_accessor should cover getters and setters for all types
shade
parents:
diff changeset
    43
b0b7187852b7 8140650: Method::is_accessor should cover getters and setters for all types
shade
parents:
diff changeset
    44
        ProcessBuilder pb = ProcessTools.createJavaProcessBuilder(
b0b7187852b7 8140650: Method::is_accessor should cover getters and setters for all types
shade
parents:
diff changeset
    45
                "-XX:+IgnoreUnrecognizedVMOptions", "-showversion",
b0b7187852b7 8140650: Method::is_accessor should cover getters and setters for all types
shade
parents:
diff changeset
    46
                "-server", "-XX:-TieredCompilation", "-Xbatch", "-Xcomp",
b0b7187852b7 8140650: Method::is_accessor should cover getters and setters for all types
shade
parents:
diff changeset
    47
                "-XX:+PrintCompilation", "-XX:+UnlockDiagnosticVMOptions", "-XX:+PrintInlining",
40059
c2304140ed64 8132919: Put compiler tests in packages
tpivovarova
parents: 38152
diff changeset
    48
                    Launcher.class.getName());
34169
b0b7187852b7 8140650: Method::is_accessor should cover getters and setters for all types
shade
parents:
diff changeset
    49
b0b7187852b7 8140650: Method::is_accessor should cover getters and setters for all types
shade
parents:
diff changeset
    50
        OutputAnalyzer analyzer = new OutputAnalyzer(pb.start());
b0b7187852b7 8140650: Method::is_accessor should cover getters and setters for all types
shade
parents:
diff changeset
    51
b0b7187852b7 8140650: Method::is_accessor should cover getters and setters for all types
shade
parents:
diff changeset
    52
        analyzer.shouldHaveExitValue(0);
b0b7187852b7 8140650: Method::is_accessor should cover getters and setters for all types
shade
parents:
diff changeset
    53
b0b7187852b7 8140650: Method::is_accessor should cover getters and setters for all types
shade
parents:
diff changeset
    54
        // The test is applicable only to C2 (present in Server VM).
b0b7187852b7 8140650: Method::is_accessor should cover getters and setters for all types
shade
parents:
diff changeset
    55
        if (analyzer.getStderr().contains("Server VM")) {
b0b7187852b7 8140650: Method::is_accessor should cover getters and setters for all types
shade
parents:
diff changeset
    56
            analyzer.shouldContain("InlineAccessors::setBool (6 bytes)   accessor");
b0b7187852b7 8140650: Method::is_accessor should cover getters and setters for all types
shade
parents:
diff changeset
    57
            analyzer.shouldContain("InlineAccessors::setByte (6 bytes)   accessor");
b0b7187852b7 8140650: Method::is_accessor should cover getters and setters for all types
shade
parents:
diff changeset
    58
            analyzer.shouldContain("InlineAccessors::setChar (6 bytes)   accessor");
b0b7187852b7 8140650: Method::is_accessor should cover getters and setters for all types
shade
parents:
diff changeset
    59
            analyzer.shouldContain("InlineAccessors::setShort (6 bytes)   accessor");
b0b7187852b7 8140650: Method::is_accessor should cover getters and setters for all types
shade
parents:
diff changeset
    60
            analyzer.shouldContain("InlineAccessors::setInt (6 bytes)   accessor");
b0b7187852b7 8140650: Method::is_accessor should cover getters and setters for all types
shade
parents:
diff changeset
    61
            analyzer.shouldContain("InlineAccessors::setFloat (6 bytes)   accessor");
b0b7187852b7 8140650: Method::is_accessor should cover getters and setters for all types
shade
parents:
diff changeset
    62
            analyzer.shouldContain("InlineAccessors::setLong (6 bytes)   accessor");
b0b7187852b7 8140650: Method::is_accessor should cover getters and setters for all types
shade
parents:
diff changeset
    63
            analyzer.shouldContain("InlineAccessors::setDouble (6 bytes)   accessor");
b0b7187852b7 8140650: Method::is_accessor should cover getters and setters for all types
shade
parents:
diff changeset
    64
            analyzer.shouldContain("InlineAccessors::setObject (6 bytes)   accessor");
b0b7187852b7 8140650: Method::is_accessor should cover getters and setters for all types
shade
parents:
diff changeset
    65
            analyzer.shouldContain("InlineAccessors::setArray (6 bytes)   accessor");
b0b7187852b7 8140650: Method::is_accessor should cover getters and setters for all types
shade
parents:
diff changeset
    66
b0b7187852b7 8140650: Method::is_accessor should cover getters and setters for all types
shade
parents:
diff changeset
    67
            analyzer.shouldContain("InlineAccessors::getBool (5 bytes)   accessor");
b0b7187852b7 8140650: Method::is_accessor should cover getters and setters for all types
shade
parents:
diff changeset
    68
            analyzer.shouldContain("InlineAccessors::getByte (5 bytes)   accessor");
b0b7187852b7 8140650: Method::is_accessor should cover getters and setters for all types
shade
parents:
diff changeset
    69
            analyzer.shouldContain("InlineAccessors::getChar (5 bytes)   accessor");
b0b7187852b7 8140650: Method::is_accessor should cover getters and setters for all types
shade
parents:
diff changeset
    70
            analyzer.shouldContain("InlineAccessors::getShort (5 bytes)   accessor");
b0b7187852b7 8140650: Method::is_accessor should cover getters and setters for all types
shade
parents:
diff changeset
    71
            analyzer.shouldContain("InlineAccessors::getInt (5 bytes)   accessor");
b0b7187852b7 8140650: Method::is_accessor should cover getters and setters for all types
shade
parents:
diff changeset
    72
            analyzer.shouldContain("InlineAccessors::getFloat (5 bytes)   accessor");
b0b7187852b7 8140650: Method::is_accessor should cover getters and setters for all types
shade
parents:
diff changeset
    73
            analyzer.shouldContain("InlineAccessors::getLong (5 bytes)   accessor");
b0b7187852b7 8140650: Method::is_accessor should cover getters and setters for all types
shade
parents:
diff changeset
    74
            analyzer.shouldContain("InlineAccessors::getDouble (5 bytes)   accessor");
b0b7187852b7 8140650: Method::is_accessor should cover getters and setters for all types
shade
parents:
diff changeset
    75
            analyzer.shouldContain("InlineAccessors::getObject (5 bytes)   accessor");
b0b7187852b7 8140650: Method::is_accessor should cover getters and setters for all types
shade
parents:
diff changeset
    76
            analyzer.shouldContain("InlineAccessors::getArray (5 bytes)   accessor");
b0b7187852b7 8140650: Method::is_accessor should cover getters and setters for all types
shade
parents:
diff changeset
    77
        }
b0b7187852b7 8140650: Method::is_accessor should cover getters and setters for all types
shade
parents:
diff changeset
    78
    }
b0b7187852b7 8140650: Method::is_accessor should cover getters and setters for all types
shade
parents:
diff changeset
    79
b0b7187852b7 8140650: Method::is_accessor should cover getters and setters for all types
shade
parents:
diff changeset
    80
    boolean bool;
b0b7187852b7 8140650: Method::is_accessor should cover getters and setters for all types
shade
parents:
diff changeset
    81
    byte b;
b0b7187852b7 8140650: Method::is_accessor should cover getters and setters for all types
shade
parents:
diff changeset
    82
    char c;
b0b7187852b7 8140650: Method::is_accessor should cover getters and setters for all types
shade
parents:
diff changeset
    83
    short s;
b0b7187852b7 8140650: Method::is_accessor should cover getters and setters for all types
shade
parents:
diff changeset
    84
    int i;
b0b7187852b7 8140650: Method::is_accessor should cover getters and setters for all types
shade
parents:
diff changeset
    85
    float f;
b0b7187852b7 8140650: Method::is_accessor should cover getters and setters for all types
shade
parents:
diff changeset
    86
    long l;
b0b7187852b7 8140650: Method::is_accessor should cover getters and setters for all types
shade
parents:
diff changeset
    87
    double d;
b0b7187852b7 8140650: Method::is_accessor should cover getters and setters for all types
shade
parents:
diff changeset
    88
    Object o;
b0b7187852b7 8140650: Method::is_accessor should cover getters and setters for all types
shade
parents:
diff changeset
    89
    Object[] a;
b0b7187852b7 8140650: Method::is_accessor should cover getters and setters for all types
shade
parents:
diff changeset
    90
b0b7187852b7 8140650: Method::is_accessor should cover getters and setters for all types
shade
parents:
diff changeset
    91
    public void setBool(boolean v)   { bool = v; }
b0b7187852b7 8140650: Method::is_accessor should cover getters and setters for all types
shade
parents:
diff changeset
    92
    public void setByte(byte v)      { b = v; }
b0b7187852b7 8140650: Method::is_accessor should cover getters and setters for all types
shade
parents:
diff changeset
    93
    public void setChar(char v)      { c = v; }
b0b7187852b7 8140650: Method::is_accessor should cover getters and setters for all types
shade
parents:
diff changeset
    94
    public void setShort(short v)    { s = v; }
b0b7187852b7 8140650: Method::is_accessor should cover getters and setters for all types
shade
parents:
diff changeset
    95
    public void setInt(int v)        { i = v; }
b0b7187852b7 8140650: Method::is_accessor should cover getters and setters for all types
shade
parents:
diff changeset
    96
    public void setFloat(float v)    { f = v; }
b0b7187852b7 8140650: Method::is_accessor should cover getters and setters for all types
shade
parents:
diff changeset
    97
    public void setLong(long v)      { l = v; }
b0b7187852b7 8140650: Method::is_accessor should cover getters and setters for all types
shade
parents:
diff changeset
    98
    public void setDouble(double v)  { d = v; }
b0b7187852b7 8140650: Method::is_accessor should cover getters and setters for all types
shade
parents:
diff changeset
    99
    public void setObject(Object v)  { o = v; }
b0b7187852b7 8140650: Method::is_accessor should cover getters and setters for all types
shade
parents:
diff changeset
   100
    public void setArray(Object[] v) { a = v; }
b0b7187852b7 8140650: Method::is_accessor should cover getters and setters for all types
shade
parents:
diff changeset
   101
b0b7187852b7 8140650: Method::is_accessor should cover getters and setters for all types
shade
parents:
diff changeset
   102
    public boolean  getBool()        { return bool; }
b0b7187852b7 8140650: Method::is_accessor should cover getters and setters for all types
shade
parents:
diff changeset
   103
    public byte     getByte()        { return b; }
b0b7187852b7 8140650: Method::is_accessor should cover getters and setters for all types
shade
parents:
diff changeset
   104
    public char     getChar()        { return c; }
b0b7187852b7 8140650: Method::is_accessor should cover getters and setters for all types
shade
parents:
diff changeset
   105
    public short    getShort()       { return s; }
b0b7187852b7 8140650: Method::is_accessor should cover getters and setters for all types
shade
parents:
diff changeset
   106
    public int      getInt()         { return i; }
b0b7187852b7 8140650: Method::is_accessor should cover getters and setters for all types
shade
parents:
diff changeset
   107
    public float    getFloat()       { return f; }
b0b7187852b7 8140650: Method::is_accessor should cover getters and setters for all types
shade
parents:
diff changeset
   108
    public long     getLong()        { return l; }
b0b7187852b7 8140650: Method::is_accessor should cover getters and setters for all types
shade
parents:
diff changeset
   109
    public double   getDouble()      { return d; }
b0b7187852b7 8140650: Method::is_accessor should cover getters and setters for all types
shade
parents:
diff changeset
   110
    public Object   getObject()      { return o; }
b0b7187852b7 8140650: Method::is_accessor should cover getters and setters for all types
shade
parents:
diff changeset
   111
    public Object[] getArray()       { return a; }
b0b7187852b7 8140650: Method::is_accessor should cover getters and setters for all types
shade
parents:
diff changeset
   112
b0b7187852b7 8140650: Method::is_accessor should cover getters and setters for all types
shade
parents:
diff changeset
   113
    static void doTest() {
b0b7187852b7 8140650: Method::is_accessor should cover getters and setters for all types
shade
parents:
diff changeset
   114
        InlineAccessors o = new InlineAccessors();
b0b7187852b7 8140650: Method::is_accessor should cover getters and setters for all types
shade
parents:
diff changeset
   115
        o.setBool(false);
b0b7187852b7 8140650: Method::is_accessor should cover getters and setters for all types
shade
parents:
diff changeset
   116
        o.setByte((byte)0);
b0b7187852b7 8140650: Method::is_accessor should cover getters and setters for all types
shade
parents:
diff changeset
   117
        o.setChar('a');
b0b7187852b7 8140650: Method::is_accessor should cover getters and setters for all types
shade
parents:
diff changeset
   118
        o.setShort((short)0);
b0b7187852b7 8140650: Method::is_accessor should cover getters and setters for all types
shade
parents:
diff changeset
   119
        o.setInt(0);
b0b7187852b7 8140650: Method::is_accessor should cover getters and setters for all types
shade
parents:
diff changeset
   120
        o.setFloat(0F);
b0b7187852b7 8140650: Method::is_accessor should cover getters and setters for all types
shade
parents:
diff changeset
   121
        o.setLong(0L);
b0b7187852b7 8140650: Method::is_accessor should cover getters and setters for all types
shade
parents:
diff changeset
   122
        o.setDouble(0D);
b0b7187852b7 8140650: Method::is_accessor should cover getters and setters for all types
shade
parents:
diff changeset
   123
        o.setObject(new Object());
b0b7187852b7 8140650: Method::is_accessor should cover getters and setters for all types
shade
parents:
diff changeset
   124
        o.setArray(new Object[1]);
b0b7187852b7 8140650: Method::is_accessor should cover getters and setters for all types
shade
parents:
diff changeset
   125
b0b7187852b7 8140650: Method::is_accessor should cover getters and setters for all types
shade
parents:
diff changeset
   126
        o.getBool();
b0b7187852b7 8140650: Method::is_accessor should cover getters and setters for all types
shade
parents:
diff changeset
   127
        o.getByte();
b0b7187852b7 8140650: Method::is_accessor should cover getters and setters for all types
shade
parents:
diff changeset
   128
        o.getChar();
b0b7187852b7 8140650: Method::is_accessor should cover getters and setters for all types
shade
parents:
diff changeset
   129
        o.getShort();
b0b7187852b7 8140650: Method::is_accessor should cover getters and setters for all types
shade
parents:
diff changeset
   130
        o.getInt();
b0b7187852b7 8140650: Method::is_accessor should cover getters and setters for all types
shade
parents:
diff changeset
   131
        o.getFloat();
b0b7187852b7 8140650: Method::is_accessor should cover getters and setters for all types
shade
parents:
diff changeset
   132
        o.getLong();
b0b7187852b7 8140650: Method::is_accessor should cover getters and setters for all types
shade
parents:
diff changeset
   133
        o.getDouble();
b0b7187852b7 8140650: Method::is_accessor should cover getters and setters for all types
shade
parents:
diff changeset
   134
        o.getObject();
b0b7187852b7 8140650: Method::is_accessor should cover getters and setters for all types
shade
parents:
diff changeset
   135
        o.getArray();
b0b7187852b7 8140650: Method::is_accessor should cover getters and setters for all types
shade
parents:
diff changeset
   136
    }
b0b7187852b7 8140650: Method::is_accessor should cover getters and setters for all types
shade
parents:
diff changeset
   137
b0b7187852b7 8140650: Method::is_accessor should cover getters and setters for all types
shade
parents:
diff changeset
   138
    static class Launcher {
b0b7187852b7 8140650: Method::is_accessor should cover getters and setters for all types
shade
parents:
diff changeset
   139
        public static void main(String[] args) throws Exception {
b0b7187852b7 8140650: Method::is_accessor should cover getters and setters for all types
shade
parents:
diff changeset
   140
            for (int c = 0; c < 20_000; c++) {
b0b7187852b7 8140650: Method::is_accessor should cover getters and setters for all types
shade
parents:
diff changeset
   141
              doTest();
b0b7187852b7 8140650: Method::is_accessor should cover getters and setters for all types
shade
parents:
diff changeset
   142
            }
b0b7187852b7 8140650: Method::is_accessor should cover getters and setters for all types
shade
parents:
diff changeset
   143
        }
b0b7187852b7 8140650: Method::is_accessor should cover getters and setters for all types
shade
parents:
diff changeset
   144
    }
b0b7187852b7 8140650: Method::is_accessor should cover getters and setters for all types
shade
parents:
diff changeset
   145
}