src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.hotspot.test/src/org/graalvm/compiler/hotspot/test/BoxDeoptimizationTest.java
author chegar
Thu, 17 Oct 2019 20:54:25 +0100
branchdatagramsocketimpl-branch
changeset 58679 9c3209ff7550
parent 58678 9cf78a70fa4f
parent 57537 ecc6e394475f
permissions -rw-r--r--
datagramsocketimpl-branch: merge with default
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
55159
a38132298eda 8223320: [AOT] jck test api/javax_script/ScriptEngine/PutGet.html fails when test classes are AOTed
iveresov
parents:
diff changeset
     1
/*
a38132298eda 8223320: [AOT] jck test api/javax_script/ScriptEngine/PutGet.html fails when test classes are AOTed
iveresov
parents:
diff changeset
     2
 * Copyright (c) 2019, Oracle and/or its affiliates. All rights reserved.
a38132298eda 8223320: [AOT] jck test api/javax_script/ScriptEngine/PutGet.html fails when test classes are AOTed
iveresov
parents:
diff changeset
     3
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
a38132298eda 8223320: [AOT] jck test api/javax_script/ScriptEngine/PutGet.html fails when test classes are AOTed
iveresov
parents:
diff changeset
     4
 *
a38132298eda 8223320: [AOT] jck test api/javax_script/ScriptEngine/PutGet.html fails when test classes are AOTed
iveresov
parents:
diff changeset
     5
 * This code is free software; you can redistribute it and/or modify it
a38132298eda 8223320: [AOT] jck test api/javax_script/ScriptEngine/PutGet.html fails when test classes are AOTed
iveresov
parents:
diff changeset
     6
 * under the terms of the GNU General Public License version 2 only, as
55509
d58442b8abc1 8225497: Update Graal
jwilhelm
parents: 55159
diff changeset
     7
 * published by the Free Software Foundation.
55159
a38132298eda 8223320: [AOT] jck test api/javax_script/ScriptEngine/PutGet.html fails when test classes are AOTed
iveresov
parents:
diff changeset
     8
 *
a38132298eda 8223320: [AOT] jck test api/javax_script/ScriptEngine/PutGet.html fails when test classes are AOTed
iveresov
parents:
diff changeset
     9
 * This code is distributed in the hope that it will be useful, but WITHOUT
a38132298eda 8223320: [AOT] jck test api/javax_script/ScriptEngine/PutGet.html fails when test classes are AOTed
iveresov
parents:
diff changeset
    10
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
a38132298eda 8223320: [AOT] jck test api/javax_script/ScriptEngine/PutGet.html fails when test classes are AOTed
iveresov
parents:
diff changeset
    11
 * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
a38132298eda 8223320: [AOT] jck test api/javax_script/ScriptEngine/PutGet.html fails when test classes are AOTed
iveresov
parents:
diff changeset
    12
 * version 2 for more details (a copy is included in the LICENSE file that
a38132298eda 8223320: [AOT] jck test api/javax_script/ScriptEngine/PutGet.html fails when test classes are AOTed
iveresov
parents:
diff changeset
    13
 * accompanied this code).
a38132298eda 8223320: [AOT] jck test api/javax_script/ScriptEngine/PutGet.html fails when test classes are AOTed
iveresov
parents:
diff changeset
    14
 *
a38132298eda 8223320: [AOT] jck test api/javax_script/ScriptEngine/PutGet.html fails when test classes are AOTed
iveresov
parents:
diff changeset
    15
 * You should have received a copy of the GNU General Public License version
a38132298eda 8223320: [AOT] jck test api/javax_script/ScriptEngine/PutGet.html fails when test classes are AOTed
iveresov
parents:
diff changeset
    16
 * 2 along with this work; if not, write to the Free Software Foundation,
a38132298eda 8223320: [AOT] jck test api/javax_script/ScriptEngine/PutGet.html fails when test classes are AOTed
iveresov
parents:
diff changeset
    17
 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
a38132298eda 8223320: [AOT] jck test api/javax_script/ScriptEngine/PutGet.html fails when test classes are AOTed
iveresov
parents:
diff changeset
    18
 *
a38132298eda 8223320: [AOT] jck test api/javax_script/ScriptEngine/PutGet.html fails when test classes are AOTed
iveresov
parents:
diff changeset
    19
 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
a38132298eda 8223320: [AOT] jck test api/javax_script/ScriptEngine/PutGet.html fails when test classes are AOTed
iveresov
parents:
diff changeset
    20
 * or visit www.oracle.com if you need additional information or have any
a38132298eda 8223320: [AOT] jck test api/javax_script/ScriptEngine/PutGet.html fails when test classes are AOTed
iveresov
parents:
diff changeset
    21
 * questions.
a38132298eda 8223320: [AOT] jck test api/javax_script/ScriptEngine/PutGet.html fails when test classes are AOTed
iveresov
parents:
diff changeset
    22
 */
55509
d58442b8abc1 8225497: Update Graal
jwilhelm
parents: 55159
diff changeset
    23
d58442b8abc1 8225497: Update Graal
jwilhelm
parents: 55159
diff changeset
    24
55159
a38132298eda 8223320: [AOT] jck test api/javax_script/ScriptEngine/PutGet.html fails when test classes are AOTed
iveresov
parents:
diff changeset
    25
package org.graalvm.compiler.hotspot.test;
a38132298eda 8223320: [AOT] jck test api/javax_script/ScriptEngine/PutGet.html fails when test classes are AOTed
iveresov
parents:
diff changeset
    26
57537
ecc6e394475f 8226771: Update Graal
dlong
parents: 55509
diff changeset
    27
import static org.graalvm.compiler.serviceprovider.JavaVersionUtil.JAVA_SPEC;
ecc6e394475f 8226771: Update Graal
dlong
parents: 55509
diff changeset
    28
55159
a38132298eda 8223320: [AOT] jck test api/javax_script/ScriptEngine/PutGet.html fails when test classes are AOTed
iveresov
parents:
diff changeset
    29
import org.graalvm.compiler.api.directives.GraalDirectives;
a38132298eda 8223320: [AOT] jck test api/javax_script/ScriptEngine/PutGet.html fails when test classes are AOTed
iveresov
parents:
diff changeset
    30
import org.graalvm.compiler.core.test.GraalCompilerTest;
a38132298eda 8223320: [AOT] jck test api/javax_script/ScriptEngine/PutGet.html fails when test classes are AOTed
iveresov
parents:
diff changeset
    31
import org.junit.Assert;
a38132298eda 8223320: [AOT] jck test api/javax_script/ScriptEngine/PutGet.html fails when test classes are AOTed
iveresov
parents:
diff changeset
    32
import org.junit.Assume;
a38132298eda 8223320: [AOT] jck test api/javax_script/ScriptEngine/PutGet.html fails when test classes are AOTed
iveresov
parents:
diff changeset
    33
import org.junit.Test;
a38132298eda 8223320: [AOT] jck test api/javax_script/ScriptEngine/PutGet.html fails when test classes are AOTed
iveresov
parents:
diff changeset
    34
a38132298eda 8223320: [AOT] jck test api/javax_script/ScriptEngine/PutGet.html fails when test classes are AOTed
iveresov
parents:
diff changeset
    35
public class BoxDeoptimizationTest extends GraalCompilerTest {
a38132298eda 8223320: [AOT] jck test api/javax_script/ScriptEngine/PutGet.html fails when test classes are AOTed
iveresov
parents:
diff changeset
    36
57537
ecc6e394475f 8226771: Update Graal
dlong
parents: 55509
diff changeset
    37
    private static void checkJDK() {
ecc6e394475f 8226771: Update Graal
dlong
parents: 55509
diff changeset
    38
        Assume.assumeTrue(JAVA_SPEC == 8 || JAVA_SPEC >= 13);
ecc6e394475f 8226771: Update Graal
dlong
parents: 55509
diff changeset
    39
    }
ecc6e394475f 8226771: Update Graal
dlong
parents: 55509
diff changeset
    40
ecc6e394475f 8226771: Update Graal
dlong
parents: 55509
diff changeset
    41
    public static void testIntegerSnippet() {
ecc6e394475f 8226771: Update Graal
dlong
parents: 55509
diff changeset
    42
        Object[] values = {42, -42, new Exception()};
55159
a38132298eda 8223320: [AOT] jck test api/javax_script/ScriptEngine/PutGet.html fails when test classes are AOTed
iveresov
parents:
diff changeset
    43
        GraalDirectives.deoptimize();
a38132298eda 8223320: [AOT] jck test api/javax_script/ScriptEngine/PutGet.html fails when test classes are AOTed
iveresov
parents:
diff changeset
    44
        Assert.assertSame(values[0], Integer.valueOf(42));
57537
ecc6e394475f 8226771: Update Graal
dlong
parents: 55509
diff changeset
    45
        Assert.assertSame(values[1], Integer.valueOf(-42));
55159
a38132298eda 8223320: [AOT] jck test api/javax_script/ScriptEngine/PutGet.html fails when test classes are AOTed
iveresov
parents:
diff changeset
    46
    }
a38132298eda 8223320: [AOT] jck test api/javax_script/ScriptEngine/PutGet.html fails when test classes are AOTed
iveresov
parents:
diff changeset
    47
a38132298eda 8223320: [AOT] jck test api/javax_script/ScriptEngine/PutGet.html fails when test classes are AOTed
iveresov
parents:
diff changeset
    48
    @Test
57537
ecc6e394475f 8226771: Update Graal
dlong
parents: 55509
diff changeset
    49
    public void testInteger() {
ecc6e394475f 8226771: Update Graal
dlong
parents: 55509
diff changeset
    50
        checkJDK();
ecc6e394475f 8226771: Update Graal
dlong
parents: 55509
diff changeset
    51
        test("testIntegerSnippet");
55159
a38132298eda 8223320: [AOT] jck test api/javax_script/ScriptEngine/PutGet.html fails when test classes are AOTed
iveresov
parents:
diff changeset
    52
    }
a38132298eda 8223320: [AOT] jck test api/javax_script/ScriptEngine/PutGet.html fails when test classes are AOTed
iveresov
parents:
diff changeset
    53
57537
ecc6e394475f 8226771: Update Graal
dlong
parents: 55509
diff changeset
    54
    public static void testLongSnippet() {
ecc6e394475f 8226771: Update Graal
dlong
parents: 55509
diff changeset
    55
        long highBitsOnly = 2L << 40;
ecc6e394475f 8226771: Update Graal
dlong
parents: 55509
diff changeset
    56
        Object[] values = {42L, -42L, highBitsOnly, new Exception()};
55159
a38132298eda 8223320: [AOT] jck test api/javax_script/ScriptEngine/PutGet.html fails when test classes are AOTed
iveresov
parents:
diff changeset
    57
        GraalDirectives.deoptimize();
a38132298eda 8223320: [AOT] jck test api/javax_script/ScriptEngine/PutGet.html fails when test classes are AOTed
iveresov
parents:
diff changeset
    58
        Assert.assertSame(values[0], Long.valueOf(42));
57537
ecc6e394475f 8226771: Update Graal
dlong
parents: 55509
diff changeset
    59
        Assert.assertSame(values[1], Long.valueOf(-42));
ecc6e394475f 8226771: Update Graal
dlong
parents: 55509
diff changeset
    60
        Assert.assertNotSame(values[2], highBitsOnly);
55159
a38132298eda 8223320: [AOT] jck test api/javax_script/ScriptEngine/PutGet.html fails when test classes are AOTed
iveresov
parents:
diff changeset
    61
    }
a38132298eda 8223320: [AOT] jck test api/javax_script/ScriptEngine/PutGet.html fails when test classes are AOTed
iveresov
parents:
diff changeset
    62
a38132298eda 8223320: [AOT] jck test api/javax_script/ScriptEngine/PutGet.html fails when test classes are AOTed
iveresov
parents:
diff changeset
    63
    @Test
57537
ecc6e394475f 8226771: Update Graal
dlong
parents: 55509
diff changeset
    64
    public void testLong() {
ecc6e394475f 8226771: Update Graal
dlong
parents: 55509
diff changeset
    65
        checkJDK();
ecc6e394475f 8226771: Update Graal
dlong
parents: 55509
diff changeset
    66
        test("testLongSnippet");
55159
a38132298eda 8223320: [AOT] jck test api/javax_script/ScriptEngine/PutGet.html fails when test classes are AOTed
iveresov
parents:
diff changeset
    67
    }
a38132298eda 8223320: [AOT] jck test api/javax_script/ScriptEngine/PutGet.html fails when test classes are AOTed
iveresov
parents:
diff changeset
    68
57537
ecc6e394475f 8226771: Update Graal
dlong
parents: 55509
diff changeset
    69
    public static void testCharSnippet() {
ecc6e394475f 8226771: Update Graal
dlong
parents: 55509
diff changeset
    70
        Object[] values = {'a', 'Z', new Exception()};
55159
a38132298eda 8223320: [AOT] jck test api/javax_script/ScriptEngine/PutGet.html fails when test classes are AOTed
iveresov
parents:
diff changeset
    71
        GraalDirectives.deoptimize();
a38132298eda 8223320: [AOT] jck test api/javax_script/ScriptEngine/PutGet.html fails when test classes are AOTed
iveresov
parents:
diff changeset
    72
        Assert.assertSame(values[0], Character.valueOf('a'));
57537
ecc6e394475f 8226771: Update Graal
dlong
parents: 55509
diff changeset
    73
        Assert.assertSame(values[1], Character.valueOf('Z'));
55159
a38132298eda 8223320: [AOT] jck test api/javax_script/ScriptEngine/PutGet.html fails when test classes are AOTed
iveresov
parents:
diff changeset
    74
    }
a38132298eda 8223320: [AOT] jck test api/javax_script/ScriptEngine/PutGet.html fails when test classes are AOTed
iveresov
parents:
diff changeset
    75
a38132298eda 8223320: [AOT] jck test api/javax_script/ScriptEngine/PutGet.html fails when test classes are AOTed
iveresov
parents:
diff changeset
    76
    @Test
57537
ecc6e394475f 8226771: Update Graal
dlong
parents: 55509
diff changeset
    77
    public void testChar() {
ecc6e394475f 8226771: Update Graal
dlong
parents: 55509
diff changeset
    78
        checkJDK();
ecc6e394475f 8226771: Update Graal
dlong
parents: 55509
diff changeset
    79
        test("testCharSnippet");
55159
a38132298eda 8223320: [AOT] jck test api/javax_script/ScriptEngine/PutGet.html fails when test classes are AOTed
iveresov
parents:
diff changeset
    80
    }
a38132298eda 8223320: [AOT] jck test api/javax_script/ScriptEngine/PutGet.html fails when test classes are AOTed
iveresov
parents:
diff changeset
    81
57537
ecc6e394475f 8226771: Update Graal
dlong
parents: 55509
diff changeset
    82
    public static void testShortSnippet() {
ecc6e394475f 8226771: Update Graal
dlong
parents: 55509
diff changeset
    83
        Object[] values = {(short) 42, (short) -42, new Exception()};
55159
a38132298eda 8223320: [AOT] jck test api/javax_script/ScriptEngine/PutGet.html fails when test classes are AOTed
iveresov
parents:
diff changeset
    84
        GraalDirectives.deoptimize();
a38132298eda 8223320: [AOT] jck test api/javax_script/ScriptEngine/PutGet.html fails when test classes are AOTed
iveresov
parents:
diff changeset
    85
        Assert.assertSame(values[0], Short.valueOf((short) 42));
57537
ecc6e394475f 8226771: Update Graal
dlong
parents: 55509
diff changeset
    86
        Assert.assertSame(values[1], Short.valueOf((short) -42));
55159
a38132298eda 8223320: [AOT] jck test api/javax_script/ScriptEngine/PutGet.html fails when test classes are AOTed
iveresov
parents:
diff changeset
    87
    }
a38132298eda 8223320: [AOT] jck test api/javax_script/ScriptEngine/PutGet.html fails when test classes are AOTed
iveresov
parents:
diff changeset
    88
a38132298eda 8223320: [AOT] jck test api/javax_script/ScriptEngine/PutGet.html fails when test classes are AOTed
iveresov
parents:
diff changeset
    89
    @Test
57537
ecc6e394475f 8226771: Update Graal
dlong
parents: 55509
diff changeset
    90
    public void testShort() {
ecc6e394475f 8226771: Update Graal
dlong
parents: 55509
diff changeset
    91
        checkJDK();
ecc6e394475f 8226771: Update Graal
dlong
parents: 55509
diff changeset
    92
        test("testShortSnippet");
55159
a38132298eda 8223320: [AOT] jck test api/javax_script/ScriptEngine/PutGet.html fails when test classes are AOTed
iveresov
parents:
diff changeset
    93
    }
a38132298eda 8223320: [AOT] jck test api/javax_script/ScriptEngine/PutGet.html fails when test classes are AOTed
iveresov
parents:
diff changeset
    94
57537
ecc6e394475f 8226771: Update Graal
dlong
parents: 55509
diff changeset
    95
    public static void testByteSnippet() {
ecc6e394475f 8226771: Update Graal
dlong
parents: 55509
diff changeset
    96
        Object[] values = {(byte) 42, (byte) -42, new Exception()};
55159
a38132298eda 8223320: [AOT] jck test api/javax_script/ScriptEngine/PutGet.html fails when test classes are AOTed
iveresov
parents:
diff changeset
    97
        GraalDirectives.deoptimize();
a38132298eda 8223320: [AOT] jck test api/javax_script/ScriptEngine/PutGet.html fails when test classes are AOTed
iveresov
parents:
diff changeset
    98
        Assert.assertSame(values[0], Byte.valueOf((byte) 42));
57537
ecc6e394475f 8226771: Update Graal
dlong
parents: 55509
diff changeset
    99
        Assert.assertSame(values[1], Byte.valueOf((byte) -42));
55159
a38132298eda 8223320: [AOT] jck test api/javax_script/ScriptEngine/PutGet.html fails when test classes are AOTed
iveresov
parents:
diff changeset
   100
    }
a38132298eda 8223320: [AOT] jck test api/javax_script/ScriptEngine/PutGet.html fails when test classes are AOTed
iveresov
parents:
diff changeset
   101
a38132298eda 8223320: [AOT] jck test api/javax_script/ScriptEngine/PutGet.html fails when test classes are AOTed
iveresov
parents:
diff changeset
   102
    @Test
57537
ecc6e394475f 8226771: Update Graal
dlong
parents: 55509
diff changeset
   103
    public void testByte() {
ecc6e394475f 8226771: Update Graal
dlong
parents: 55509
diff changeset
   104
        checkJDK();
ecc6e394475f 8226771: Update Graal
dlong
parents: 55509
diff changeset
   105
        test("testByteSnippet");
55159
a38132298eda 8223320: [AOT] jck test api/javax_script/ScriptEngine/PutGet.html fails when test classes are AOTed
iveresov
parents:
diff changeset
   106
    }
a38132298eda 8223320: [AOT] jck test api/javax_script/ScriptEngine/PutGet.html fails when test classes are AOTed
iveresov
parents:
diff changeset
   107
57537
ecc6e394475f 8226771: Update Graal
dlong
parents: 55509
diff changeset
   108
    public static void testBooleanSnippet() {
ecc6e394475f 8226771: Update Graal
dlong
parents: 55509
diff changeset
   109
        Object[] values = {true, false, new Exception()};
55159
a38132298eda 8223320: [AOT] jck test api/javax_script/ScriptEngine/PutGet.html fails when test classes are AOTed
iveresov
parents:
diff changeset
   110
        GraalDirectives.deoptimize();
a38132298eda 8223320: [AOT] jck test api/javax_script/ScriptEngine/PutGet.html fails when test classes are AOTed
iveresov
parents:
diff changeset
   111
        Assert.assertSame(values[0], Boolean.valueOf(true));
57537
ecc6e394475f 8226771: Update Graal
dlong
parents: 55509
diff changeset
   112
        Assert.assertSame(values[1], Boolean.valueOf(false));
55159
a38132298eda 8223320: [AOT] jck test api/javax_script/ScriptEngine/PutGet.html fails when test classes are AOTed
iveresov
parents:
diff changeset
   113
    }
a38132298eda 8223320: [AOT] jck test api/javax_script/ScriptEngine/PutGet.html fails when test classes are AOTed
iveresov
parents:
diff changeset
   114
a38132298eda 8223320: [AOT] jck test api/javax_script/ScriptEngine/PutGet.html fails when test classes are AOTed
iveresov
parents:
diff changeset
   115
    @Test
57537
ecc6e394475f 8226771: Update Graal
dlong
parents: 55509
diff changeset
   116
    public void testBoolean() {
ecc6e394475f 8226771: Update Graal
dlong
parents: 55509
diff changeset
   117
        checkJDK();
ecc6e394475f 8226771: Update Graal
dlong
parents: 55509
diff changeset
   118
        test("testBooleanSnippet");
55159
a38132298eda 8223320: [AOT] jck test api/javax_script/ScriptEngine/PutGet.html fails when test classes are AOTed
iveresov
parents:
diff changeset
   119
    }
a38132298eda 8223320: [AOT] jck test api/javax_script/ScriptEngine/PutGet.html fails when test classes are AOTed
iveresov
parents:
diff changeset
   120
}