test/hotspot/jtreg/vmTestbase/jit/graph/test4.java
author iignatyev
Fri, 11 Oct 2019 09:43:41 -0700
changeset 58564 218a1a642c6f
parent 50366 4d85990f9c4a
permissions -rw-r--r--
8225654: rework vmTestbase/jit/graph Reviewed-by: thartmann, neliasso
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
50366
4d85990f9c4a 8202812: [TESTBUG] Open source VM testbase compiler tests
iignatyev
parents:
diff changeset
     1
/*
58564
218a1a642c6f 8225654: rework vmTestbase/jit/graph
iignatyev
parents: 50366
diff changeset
     2
 * Copyright (c) 2008, 2019, Oracle and/or its affiliates. All rights reserved.
50366
4d85990f9c4a 8202812: [TESTBUG] Open source VM testbase compiler tests
iignatyev
parents:
diff changeset
     3
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4d85990f9c4a 8202812: [TESTBUG] Open source VM testbase compiler tests
iignatyev
parents:
diff changeset
     4
 *
4d85990f9c4a 8202812: [TESTBUG] Open source VM testbase compiler tests
iignatyev
parents:
diff changeset
     5
 * This code is free software; you can redistribute it and/or modify it
4d85990f9c4a 8202812: [TESTBUG] Open source VM testbase compiler tests
iignatyev
parents:
diff changeset
     6
 * under the terms of the GNU General Public License version 2 only, as
4d85990f9c4a 8202812: [TESTBUG] Open source VM testbase compiler tests
iignatyev
parents:
diff changeset
     7
 * published by the Free Software Foundation.
4d85990f9c4a 8202812: [TESTBUG] Open source VM testbase compiler tests
iignatyev
parents:
diff changeset
     8
 *
4d85990f9c4a 8202812: [TESTBUG] Open source VM testbase compiler tests
iignatyev
parents:
diff changeset
     9
 * This code is distributed in the hope that it will be useful, but WITHOUT
4d85990f9c4a 8202812: [TESTBUG] Open source VM testbase compiler tests
iignatyev
parents:
diff changeset
    10
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
4d85990f9c4a 8202812: [TESTBUG] Open source VM testbase compiler tests
iignatyev
parents:
diff changeset
    11
 * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
4d85990f9c4a 8202812: [TESTBUG] Open source VM testbase compiler tests
iignatyev
parents:
diff changeset
    12
 * version 2 for more details (a copy is included in the LICENSE file that
4d85990f9c4a 8202812: [TESTBUG] Open source VM testbase compiler tests
iignatyev
parents:
diff changeset
    13
 * accompanied this code).
4d85990f9c4a 8202812: [TESTBUG] Open source VM testbase compiler tests
iignatyev
parents:
diff changeset
    14
 *
4d85990f9c4a 8202812: [TESTBUG] Open source VM testbase compiler tests
iignatyev
parents:
diff changeset
    15
 * You should have received a copy of the GNU General Public License version
4d85990f9c4a 8202812: [TESTBUG] Open source VM testbase compiler tests
iignatyev
parents:
diff changeset
    16
 * 2 along with this work; if not, write to the Free Software Foundation,
4d85990f9c4a 8202812: [TESTBUG] Open source VM testbase compiler tests
iignatyev
parents:
diff changeset
    17
 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
4d85990f9c4a 8202812: [TESTBUG] Open source VM testbase compiler tests
iignatyev
parents:
diff changeset
    18
 *
4d85990f9c4a 8202812: [TESTBUG] Open source VM testbase compiler tests
iignatyev
parents:
diff changeset
    19
 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
4d85990f9c4a 8202812: [TESTBUG] Open source VM testbase compiler tests
iignatyev
parents:
diff changeset
    20
 * or visit www.oracle.com if you need additional information or have any
4d85990f9c4a 8202812: [TESTBUG] Open source VM testbase compiler tests
iignatyev
parents:
diff changeset
    21
 * questions.
4d85990f9c4a 8202812: [TESTBUG] Open source VM testbase compiler tests
iignatyev
parents:
diff changeset
    22
 */
58564
218a1a642c6f 8225654: rework vmTestbase/jit/graph
iignatyev
parents: 50366
diff changeset
    23
50366
4d85990f9c4a 8202812: [TESTBUG] Open source VM testbase compiler tests
iignatyev
parents:
diff changeset
    24
package jit.graph;
4d85990f9c4a 8202812: [TESTBUG] Open source VM testbase compiler tests
iignatyev
parents:
diff changeset
    25
58564
218a1a642c6f 8225654: rework vmTestbase/jit/graph
iignatyev
parents: 50366
diff changeset
    26
import java.lang.reflect.InvocationTargetException;
218a1a642c6f 8225654: rework vmTestbase/jit/graph
iignatyev
parents: 50366
diff changeset
    27
import java.util.Vector;
50366
4d85990f9c4a 8202812: [TESTBUG] Open source VM testbase compiler tests
iignatyev
parents:
diff changeset
    28
58564
218a1a642c6f 8225654: rework vmTestbase/jit/graph
iignatyev
parents: 50366
diff changeset
    29
class test4 extends test2 {
218a1a642c6f 8225654: rework vmTestbase/jit/graph
iignatyev
parents: 50366
diff changeset
    30
    private final int[] MethodID = {Globals.MethodID_Array[1], Globals.MethodID_Array[5], Globals.MethodID_Array[6]};
50366
4d85990f9c4a 8202812: [TESTBUG] Open source VM testbase compiler tests
iignatyev
parents:
diff changeset
    31
58564
218a1a642c6f 8225654: rework vmTestbase/jit/graph
iignatyev
parents: 50366
diff changeset
    32
    // this method verifies that a child can make a call to its parent
50366
4d85990f9c4a 8202812: [TESTBUG] Open source VM testbase compiler tests
iignatyev
parents:
diff changeset
    33
    public void CallCallMe(Vector summation, Vector ID, Long functionDepth, Integer staticFunctionDepth)
58564
218a1a642c6f 8225654: rework vmTestbase/jit/graph
iignatyev
parents: 50366
diff changeset
    34
            throws InvocationTargetException {
218a1a642c6f 8225654: rework vmTestbase/jit/graph
iignatyev
parents: 50366
diff changeset
    35
        Globals.appendSumToSummationVector(MethodID[1], summation);
50366
4d85990f9c4a 8202812: [TESTBUG] Open source VM testbase compiler tests
iignatyev
parents:
diff changeset
    36
58564
218a1a642c6f 8225654: rework vmTestbase/jit/graph
iignatyev
parents: 50366
diff changeset
    37
        if (CGT.shouldFinish()) {
50366
4d85990f9c4a 8202812: [TESTBUG] Open source VM testbase compiler tests
iignatyev
parents:
diff changeset
    38
            return;
58564
218a1a642c6f 8225654: rework vmTestbase/jit/graph
iignatyev
parents: 50366
diff changeset
    39
        }
50366
4d85990f9c4a 8202812: [TESTBUG] Open source VM testbase compiler tests
iignatyev
parents:
diff changeset
    40
58564
218a1a642c6f 8225654: rework vmTestbase/jit/graph
iignatyev
parents: 50366
diff changeset
    41
        if (Globals.VERBOSE) {
50366
4d85990f9c4a 8202812: [TESTBUG] Open source VM testbase compiler tests
iignatyev
parents:
diff changeset
    42
            System.out.println("test4.CallCallMe");
58564
218a1a642c6f 8225654: rework vmTestbase/jit/graph
iignatyev
parents: 50366
diff changeset
    43
        }
50366
4d85990f9c4a 8202812: [TESTBUG] Open source VM testbase compiler tests
iignatyev
parents:
diff changeset
    44
58564
218a1a642c6f 8225654: rework vmTestbase/jit/graph
iignatyev
parents: 50366
diff changeset
    45
        if ((functionDepth.longValue() <= 0) && (staticFunctionDepth.intValue() <= 0)) {
218a1a642c6f 8225654: rework vmTestbase/jit/graph
iignatyev
parents: 50366
diff changeset
    46
            return;
218a1a642c6f 8225654: rework vmTestbase/jit/graph
iignatyev
parents: 50366
diff changeset
    47
        }
50366
4d85990f9c4a 8202812: [TESTBUG] Open source VM testbase compiler tests
iignatyev
parents:
diff changeset
    48
4d85990f9c4a 8202812: [TESTBUG] Open source VM testbase compiler tests
iignatyev
parents:
diff changeset
    49
        MethodData methodCallStr;
4d85990f9c4a 8202812: [TESTBUG] Open source VM testbase compiler tests
iignatyev
parents:
diff changeset
    50
        Long numFcalls;
4d85990f9c4a 8202812: [TESTBUG] Open source VM testbase compiler tests
iignatyev
parents:
diff changeset
    51
        Integer staticFcalls;
58564
218a1a642c6f 8225654: rework vmTestbase/jit/graph
iignatyev
parents: 50366
diff changeset
    52
        if (staticFunctionDepth.intValue() > 0) {
218a1a642c6f 8225654: rework vmTestbase/jit/graph
iignatyev
parents: 50366
diff changeset
    53
            numFcalls = functionDepth;
218a1a642c6f 8225654: rework vmTestbase/jit/graph
iignatyev
parents: 50366
diff changeset
    54
            staticFcalls = new Integer(staticFunctionDepth.intValue() - 1);
218a1a642c6f 8225654: rework vmTestbase/jit/graph
iignatyev
parents: 50366
diff changeset
    55
            methodCallStr = Globals.returnNextStaticMethod(MethodID[1]);
50366
4d85990f9c4a 8202812: [TESTBUG] Open source VM testbase compiler tests
iignatyev
parents:
diff changeset
    56
58564
218a1a642c6f 8225654: rework vmTestbase/jit/graph
iignatyev
parents: 50366
diff changeset
    57
            Globals.addFunctionIDToVector(methodCallStr.id, ID);
218a1a642c6f 8225654: rework vmTestbase/jit/graph
iignatyev
parents: 50366
diff changeset
    58
        } else {
218a1a642c6f 8225654: rework vmTestbase/jit/graph
iignatyev
parents: 50366
diff changeset
    59
            numFcalls = new Long(functionDepth.longValue() - 1);
218a1a642c6f 8225654: rework vmTestbase/jit/graph
iignatyev
parents: 50366
diff changeset
    60
            staticFcalls = staticFunctionDepth;
218a1a642c6f 8225654: rework vmTestbase/jit/graph
iignatyev
parents: 50366
diff changeset
    61
            Globals.addFunctionIDToVector(MethodID[0], ID);
218a1a642c6f 8225654: rework vmTestbase/jit/graph
iignatyev
parents: 50366
diff changeset
    62
            super.callMe(summation, ID, numFcalls, staticFcalls);
218a1a642c6f 8225654: rework vmTestbase/jit/graph
iignatyev
parents: 50366
diff changeset
    63
            return;
218a1a642c6f 8225654: rework vmTestbase/jit/graph
iignatyev
parents: 50366
diff changeset
    64
        }
50366
4d85990f9c4a 8202812: [TESTBUG] Open source VM testbase compiler tests
iignatyev
parents:
diff changeset
    65
4d85990f9c4a 8202812: [TESTBUG] Open source VM testbase compiler tests
iignatyev
parents:
diff changeset
    66
4d85990f9c4a 8202812: [TESTBUG] Open source VM testbase compiler tests
iignatyev
parents:
diff changeset
    67
        Globals.callMethod(methodCallStr, summation, ID, numFcalls, staticFcalls);
4d85990f9c4a 8202812: [TESTBUG] Open source VM testbase compiler tests
iignatyev
parents:
diff changeset
    68
    }
4d85990f9c4a 8202812: [TESTBUG] Open source VM testbase compiler tests
iignatyev
parents:
diff changeset
    69
58564
218a1a642c6f 8225654: rework vmTestbase/jit/graph
iignatyev
parents: 50366
diff changeset
    70
    // this method makes a Y fork in the method call structure
50366
4d85990f9c4a 8202812: [TESTBUG] Open source VM testbase compiler tests
iignatyev
parents:
diff changeset
    71
    public void callMe(Vector summation, Vector ID, Long functionDepth, Integer staticFunctionDepth)
58564
218a1a642c6f 8225654: rework vmTestbase/jit/graph
iignatyev
parents: 50366
diff changeset
    72
            throws InvocationTargetException {
218a1a642c6f 8225654: rework vmTestbase/jit/graph
iignatyev
parents: 50366
diff changeset
    73
        Globals.appendSumToSummationVector(MethodID[2], summation);
50366
4d85990f9c4a 8202812: [TESTBUG] Open source VM testbase compiler tests
iignatyev
parents:
diff changeset
    74
58564
218a1a642c6f 8225654: rework vmTestbase/jit/graph
iignatyev
parents: 50366
diff changeset
    75
        if (CGT.shouldFinish()) {
50366
4d85990f9c4a 8202812: [TESTBUG] Open source VM testbase compiler tests
iignatyev
parents:
diff changeset
    76
            return;
58564
218a1a642c6f 8225654: rework vmTestbase/jit/graph
iignatyev
parents: 50366
diff changeset
    77
        }
50366
4d85990f9c4a 8202812: [TESTBUG] Open source VM testbase compiler tests
iignatyev
parents:
diff changeset
    78
58564
218a1a642c6f 8225654: rework vmTestbase/jit/graph
iignatyev
parents: 50366
diff changeset
    79
        if (Globals.VERBOSE) {
218a1a642c6f 8225654: rework vmTestbase/jit/graph
iignatyev
parents: 50366
diff changeset
    80
            System.out.println("test4.callMe");
218a1a642c6f 8225654: rework vmTestbase/jit/graph
iignatyev
parents: 50366
diff changeset
    81
        }
218a1a642c6f 8225654: rework vmTestbase/jit/graph
iignatyev
parents: 50366
diff changeset
    82
218a1a642c6f 8225654: rework vmTestbase/jit/graph
iignatyev
parents: 50366
diff changeset
    83
        if ((functionDepth.longValue() <= 0) && (staticFunctionDepth.intValue() <= 0)) {
218a1a642c6f 8225654: rework vmTestbase/jit/graph
iignatyev
parents: 50366
diff changeset
    84
            return;
218a1a642c6f 8225654: rework vmTestbase/jit/graph
iignatyev
parents: 50366
diff changeset
    85
        }
50366
4d85990f9c4a 8202812: [TESTBUG] Open source VM testbase compiler tests
iignatyev
parents:
diff changeset
    86
4d85990f9c4a 8202812: [TESTBUG] Open source VM testbase compiler tests
iignatyev
parents:
diff changeset
    87
        MethodData methodCallStr;
4d85990f9c4a 8202812: [TESTBUG] Open source VM testbase compiler tests
iignatyev
parents:
diff changeset
    88
        Long numFcalls;
4d85990f9c4a 8202812: [TESTBUG] Open source VM testbase compiler tests
iignatyev
parents:
diff changeset
    89
        Integer staticFcalls;
58564
218a1a642c6f 8225654: rework vmTestbase/jit/graph
iignatyev
parents: 50366
diff changeset
    90
        if (staticFunctionDepth.intValue() > 0) {
218a1a642c6f 8225654: rework vmTestbase/jit/graph
iignatyev
parents: 50366
diff changeset
    91
            numFcalls = functionDepth;
218a1a642c6f 8225654: rework vmTestbase/jit/graph
iignatyev
parents: 50366
diff changeset
    92
            staticFcalls = new Integer(staticFunctionDepth.intValue() - 1);
218a1a642c6f 8225654: rework vmTestbase/jit/graph
iignatyev
parents: 50366
diff changeset
    93
            methodCallStr = Globals.returnNextStaticMethod(MethodID[2]);
218a1a642c6f 8225654: rework vmTestbase/jit/graph
iignatyev
parents: 50366
diff changeset
    94
        } else {
218a1a642c6f 8225654: rework vmTestbase/jit/graph
iignatyev
parents: 50366
diff changeset
    95
            long temp = functionDepth.longValue() - 2;
218a1a642c6f 8225654: rework vmTestbase/jit/graph
iignatyev
parents: 50366
diff changeset
    96
            numFcalls = new Long(temp / 2);
218a1a642c6f 8225654: rework vmTestbase/jit/graph
iignatyev
parents: 50366
diff changeset
    97
            staticFcalls = staticFunctionDepth;
50366
4d85990f9c4a 8202812: [TESTBUG] Open source VM testbase compiler tests
iignatyev
parents:
diff changeset
    98
58564
218a1a642c6f 8225654: rework vmTestbase/jit/graph
iignatyev
parents: 50366
diff changeset
    99
            if (Globals.VERBOSE) {
218a1a642c6f 8225654: rework vmTestbase/jit/graph
iignatyev
parents: 50366
diff changeset
   100
                System.out.println(" test4.callMe - Starting Branch 1");
50366
4d85990f9c4a 8202812: [TESTBUG] Open source VM testbase compiler tests
iignatyev
parents:
diff changeset
   101
            }
58564
218a1a642c6f 8225654: rework vmTestbase/jit/graph
iignatyev
parents: 50366
diff changeset
   102
            methodCallStr = Globals.nextRandomMethod();
218a1a642c6f 8225654: rework vmTestbase/jit/graph
iignatyev
parents: 50366
diff changeset
   103
            Globals.addFunctionIDToVector(methodCallStr.id, ID);
218a1a642c6f 8225654: rework vmTestbase/jit/graph
iignatyev
parents: 50366
diff changeset
   104
            Globals.callMethod(methodCallStr, summation, ID, numFcalls, staticFcalls);
50366
4d85990f9c4a 8202812: [TESTBUG] Open source VM testbase compiler tests
iignatyev
parents:
diff changeset
   105
58564
218a1a642c6f 8225654: rework vmTestbase/jit/graph
iignatyev
parents: 50366
diff changeset
   106
            if (CGT.shouldFinish()) {
218a1a642c6f 8225654: rework vmTestbase/jit/graph
iignatyev
parents: 50366
diff changeset
   107
                return;
218a1a642c6f 8225654: rework vmTestbase/jit/graph
iignatyev
parents: 50366
diff changeset
   108
            }
50366
4d85990f9c4a 8202812: [TESTBUG] Open source VM testbase compiler tests
iignatyev
parents:
diff changeset
   109
58564
218a1a642c6f 8225654: rework vmTestbase/jit/graph
iignatyev
parents: 50366
diff changeset
   110
            temp -= temp / 2;
218a1a642c6f 8225654: rework vmTestbase/jit/graph
iignatyev
parents: 50366
diff changeset
   111
            if (temp < 0) {
218a1a642c6f 8225654: rework vmTestbase/jit/graph
iignatyev
parents: 50366
diff changeset
   112
                if (Globals.VERBOSE) {
218a1a642c6f 8225654: rework vmTestbase/jit/graph
iignatyev
parents: 50366
diff changeset
   113
                    System.out.println(" test4.callMe - Skipping Branch 2");
218a1a642c6f 8225654: rework vmTestbase/jit/graph
iignatyev
parents: 50366
diff changeset
   114
                }
218a1a642c6f 8225654: rework vmTestbase/jit/graph
iignatyev
parents: 50366
diff changeset
   115
                return;
50366
4d85990f9c4a 8202812: [TESTBUG] Open source VM testbase compiler tests
iignatyev
parents:
diff changeset
   116
            }
58564
218a1a642c6f 8225654: rework vmTestbase/jit/graph
iignatyev
parents: 50366
diff changeset
   117
            if (Globals.VERBOSE) {
218a1a642c6f 8225654: rework vmTestbase/jit/graph
iignatyev
parents: 50366
diff changeset
   118
                System.out.println(" test4.callMe - Starting Branch 2");
218a1a642c6f 8225654: rework vmTestbase/jit/graph
iignatyev
parents: 50366
diff changeset
   119
            }
218a1a642c6f 8225654: rework vmTestbase/jit/graph
iignatyev
parents: 50366
diff changeset
   120
            numFcalls = new Long(temp);
218a1a642c6f 8225654: rework vmTestbase/jit/graph
iignatyev
parents: 50366
diff changeset
   121
            methodCallStr = Globals.nextRandomMethod();
218a1a642c6f 8225654: rework vmTestbase/jit/graph
iignatyev
parents: 50366
diff changeset
   122
        }
50366
4d85990f9c4a 8202812: [TESTBUG] Open source VM testbase compiler tests
iignatyev
parents:
diff changeset
   123
        Globals.addFunctionIDToVector(methodCallStr.id, ID);
4d85990f9c4a 8202812: [TESTBUG] Open source VM testbase compiler tests
iignatyev
parents:
diff changeset
   124
        Globals.callMethod(methodCallStr, summation, ID, numFcalls, staticFcalls);
4d85990f9c4a 8202812: [TESTBUG] Open source VM testbase compiler tests
iignatyev
parents:
diff changeset
   125
    }
4d85990f9c4a 8202812: [TESTBUG] Open source VM testbase compiler tests
iignatyev
parents:
diff changeset
   126
4d85990f9c4a 8202812: [TESTBUG] Open source VM testbase compiler tests
iignatyev
parents:
diff changeset
   127
}