test/hotspot/jtreg/compiler/interpreter/TestVerifyStackAfterDeopt.java
author iignatyev
Mon, 18 Feb 2019 09:31:07 -0800
changeset 53791 bec6c8739833
parent 53247 3fc330702246
permissions -rw-r--r--
8219157: vm/mlvm/mixed/stress/java/findDeadlock should be problem-listed only on mac Reviewed-by: thartmann
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
49189
41e570d862b4 8148871: Possible wrong expression stack depth at deopt point
thartmann
parents:
diff changeset
     1
/*
53247
3fc330702246 8216316: Tests fail due to too low specified TLAB size
tschatzl
parents: 51522
diff changeset
     2
 * Copyright (c) 2018, 2019, Oracle and/or its affiliates. All rights reserved.
49189
41e570d862b4 8148871: Possible wrong expression stack depth at deopt point
thartmann
parents:
diff changeset
     3
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
41e570d862b4 8148871: Possible wrong expression stack depth at deopt point
thartmann
parents:
diff changeset
     4
 *
41e570d862b4 8148871: Possible wrong expression stack depth at deopt point
thartmann
parents:
diff changeset
     5
 * This code is free software; you can redistribute it and/or modify it
41e570d862b4 8148871: Possible wrong expression stack depth at deopt point
thartmann
parents:
diff changeset
     6
 * under the terms of the GNU General Public License version 2 only, as
41e570d862b4 8148871: Possible wrong expression stack depth at deopt point
thartmann
parents:
diff changeset
     7
 * published by the Free Software Foundation.
41e570d862b4 8148871: Possible wrong expression stack depth at deopt point
thartmann
parents:
diff changeset
     8
 *
41e570d862b4 8148871: Possible wrong expression stack depth at deopt point
thartmann
parents:
diff changeset
     9
 * This code is distributed in the hope that it will be useful, but WITHOUT
41e570d862b4 8148871: Possible wrong expression stack depth at deopt point
thartmann
parents:
diff changeset
    10
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
41e570d862b4 8148871: Possible wrong expression stack depth at deopt point
thartmann
parents:
diff changeset
    11
 * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
41e570d862b4 8148871: Possible wrong expression stack depth at deopt point
thartmann
parents:
diff changeset
    12
 * version 2 for more details (a copy is included in the LICENSE file that
41e570d862b4 8148871: Possible wrong expression stack depth at deopt point
thartmann
parents:
diff changeset
    13
 * accompanied this code).
41e570d862b4 8148871: Possible wrong expression stack depth at deopt point
thartmann
parents:
diff changeset
    14
 *
41e570d862b4 8148871: Possible wrong expression stack depth at deopt point
thartmann
parents:
diff changeset
    15
 * You should have received a copy of the GNU General Public License version
41e570d862b4 8148871: Possible wrong expression stack depth at deopt point
thartmann
parents:
diff changeset
    16
 * 2 along with this work; if not, write to the Free Software Foundation,
41e570d862b4 8148871: Possible wrong expression stack depth at deopt point
thartmann
parents:
diff changeset
    17
 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
41e570d862b4 8148871: Possible wrong expression stack depth at deopt point
thartmann
parents:
diff changeset
    18
 *
41e570d862b4 8148871: Possible wrong expression stack depth at deopt point
thartmann
parents:
diff changeset
    19
 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
41e570d862b4 8148871: Possible wrong expression stack depth at deopt point
thartmann
parents:
diff changeset
    20
 * or visit www.oracle.com if you need additional information or have any
41e570d862b4 8148871: Possible wrong expression stack depth at deopt point
thartmann
parents:
diff changeset
    21
 * questions.
41e570d862b4 8148871: Possible wrong expression stack depth at deopt point
thartmann
parents:
diff changeset
    22
 */
41e570d862b4 8148871: Possible wrong expression stack depth at deopt point
thartmann
parents:
diff changeset
    23
41e570d862b4 8148871: Possible wrong expression stack depth at deopt point
thartmann
parents:
diff changeset
    24
41e570d862b4 8148871: Possible wrong expression stack depth at deopt point
thartmann
parents:
diff changeset
    25
/*
41e570d862b4 8148871: Possible wrong expression stack depth at deopt point
thartmann
parents:
diff changeset
    26
 * @test TestVerifyStackAfterDeopt
41e570d862b4 8148871: Possible wrong expression stack depth at deopt point
thartmann
parents:
diff changeset
    27
 * @bug 8148871
51522
b426c75da4b9 8209825: guarantee(false) failed: wrong number of expression stack elements during deopt
dlong
parents: 49189
diff changeset
    28
 * @bug 8209825
49189
41e570d862b4 8148871: Possible wrong expression stack depth at deopt point
thartmann
parents:
diff changeset
    29
 * @summary Checks VerifyStack after deoptimization of array allocation slow call
41e570d862b4 8148871: Possible wrong expression stack depth at deopt point
thartmann
parents:
diff changeset
    30
 * @run main/othervm -XX:+IgnoreUnrecognizedVMOptions -XX:TieredStopAtLevel=1
53247
3fc330702246 8216316: Tests fail due to too low specified TLAB size
tschatzl
parents: 51522
diff changeset
    31
 *                   -XX:AllocatePrefetchLines=1 -XX:AllocateInstancePrefetchLines=1 -XX:AllocatePrefetchStepSize=16 -XX:AllocatePrefetchDistance=1
51522
b426c75da4b9 8209825: guarantee(false) failed: wrong number of expression stack elements during deopt
dlong
parents: 49189
diff changeset
    32
 *                   -XX:MinTLABSize=1k -XX:TLABSize=1k
49189
41e570d862b4 8148871: Possible wrong expression stack depth at deopt point
thartmann
parents:
diff changeset
    33
 *                   -XX:+DeoptimizeALot -XX:+VerifyStack
41e570d862b4 8148871: Possible wrong expression stack depth at deopt point
thartmann
parents:
diff changeset
    34
 *                   compiler.interpreter.TestVerifyStackAfterDeopt
41e570d862b4 8148871: Possible wrong expression stack depth at deopt point
thartmann
parents:
diff changeset
    35
 */
41e570d862b4 8148871: Possible wrong expression stack depth at deopt point
thartmann
parents:
diff changeset
    36
41e570d862b4 8148871: Possible wrong expression stack depth at deopt point
thartmann
parents:
diff changeset
    37
package compiler.interpreter;
41e570d862b4 8148871: Possible wrong expression stack depth at deopt point
thartmann
parents:
diff changeset
    38
41e570d862b4 8148871: Possible wrong expression stack depth at deopt point
thartmann
parents:
diff changeset
    39
public class TestVerifyStackAfterDeopt {
41e570d862b4 8148871: Possible wrong expression stack depth at deopt point
thartmann
parents:
diff changeset
    40
51522
b426c75da4b9 8209825: guarantee(false) failed: wrong number of expression stack elements during deopt
dlong
parents: 49189
diff changeset
    41
    private long method(long l1, long l2, Object[] a) {
b426c75da4b9 8209825: guarantee(false) failed: wrong number of expression stack elements during deopt
dlong
parents: 49189
diff changeset
    42
        return l1 + l2;
b426c75da4b9 8209825: guarantee(false) failed: wrong number of expression stack elements during deopt
dlong
parents: 49189
diff changeset
    43
    }
49189
41e570d862b4 8148871: Possible wrong expression stack depth at deopt point
thartmann
parents:
diff changeset
    44
51522
b426c75da4b9 8209825: guarantee(false) failed: wrong number of expression stack elements during deopt
dlong
parents: 49189
diff changeset
    45
    private long result[] = new long[1];
49189
41e570d862b4 8148871: Possible wrong expression stack depth at deopt point
thartmann
parents:
diff changeset
    46
41e570d862b4 8148871: Possible wrong expression stack depth at deopt point
thartmann
parents:
diff changeset
    47
    private void test() {
41e570d862b4 8148871: Possible wrong expression stack depth at deopt point
thartmann
parents:
diff changeset
    48
        // For the array allocation, C1 emits a slow call into the runtime
41e570d862b4 8148871: Possible wrong expression stack depth at deopt point
thartmann
parents:
diff changeset
    49
        // that deoptimizes the caller frame due to -XX:+DeoptimizeALot.
41e570d862b4 8148871: Possible wrong expression stack depth at deopt point
thartmann
parents:
diff changeset
    50
        // The VerifyStack code then gets confused because the following
41e570d862b4 8148871: Possible wrong expression stack depth at deopt point
thartmann
parents:
diff changeset
    51
        // bytecode instruction is an invoke and the interpreter oop map
41e570d862b4 8148871: Possible wrong expression stack depth at deopt point
thartmann
parents:
diff changeset
    52
        // generator reports the oop map after execution of that invoke.
51522
b426c75da4b9 8209825: guarantee(false) failed: wrong number of expression stack elements during deopt
dlong
parents: 49189
diff changeset
    53
        this.result[0] = method(1L, 2L, new Object[0]);
49189
41e570d862b4 8148871: Possible wrong expression stack depth at deopt point
thartmann
parents:
diff changeset
    54
    }
41e570d862b4 8148871: Possible wrong expression stack depth at deopt point
thartmann
parents:
diff changeset
    55
41e570d862b4 8148871: Possible wrong expression stack depth at deopt point
thartmann
parents:
diff changeset
    56
    public static void main(String[] args) {
41e570d862b4 8148871: Possible wrong expression stack depth at deopt point
thartmann
parents:
diff changeset
    57
        TestVerifyStackAfterDeopt t = new TestVerifyStackAfterDeopt();
41e570d862b4 8148871: Possible wrong expression stack depth at deopt point
thartmann
parents:
diff changeset
    58
        // Run long enough for C1 compilation to trigger and TLAB to fill up
41e570d862b4 8148871: Possible wrong expression stack depth at deopt point
thartmann
parents:
diff changeset
    59
        for (int i = 0; i < 100_000; ++i) {
41e570d862b4 8148871: Possible wrong expression stack depth at deopt point
thartmann
parents:
diff changeset
    60
            t.test();
41e570d862b4 8148871: Possible wrong expression stack depth at deopt point
thartmann
parents:
diff changeset
    61
        }
41e570d862b4 8148871: Possible wrong expression stack depth at deopt point
thartmann
parents:
diff changeset
    62
    }
41e570d862b4 8148871: Possible wrong expression stack depth at deopt point
thartmann
parents:
diff changeset
    63
}