test/hotspot/jtreg/vmTestbase/jit/graph/test2.java
changeset 58564 218a1a642c6f
parent 50366 4d85990f9c4a
equal deleted inserted replaced
58563:78bbb5dde2a3 58564:218a1a642c6f
     1 /*
     1 /*
     2  * Copyright (c) 2008, 2018, Oracle and/or its affiliates. All rights reserved.
     2  * Copyright (c) 2008, 2019, Oracle and/or its affiliates. All rights reserved.
     3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
     3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
     4  *
     4  *
     5  * This code is free software; you can redistribute it and/or modify it
     5  * This code is free software; you can redistribute it and/or modify it
     6  * under the terms of the GNU General Public License version 2 only, as
     6  * under the terms of the GNU General Public License version 2 only, as
     7  * published by the Free Software Foundation.
     7  * published by the Free Software Foundation.
    18  *
    18  *
    19  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
    19  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
    20  * or visit www.oracle.com if you need additional information or have any
    20  * or visit www.oracle.com if you need additional information or have any
    21  * questions.
    21  * questions.
    22  */
    22  */
       
    23 
    23 package jit.graph;
    24 package jit.graph;
    24 
    25 
    25 import java.util.*;
       
    26 import java.lang.reflect.*;
       
    27 import nsk.share.TestFailure;
    26 import nsk.share.TestFailure;
    28 
    27 
    29 class test2
    28 import java.lang.reflect.InvocationTargetException;
    30 {
    29 import java.util.Vector;
    31     private final int[] MethodID = {Globals.MethodID_Array[1],Globals.MethodID_Array[2]};
    30 
       
    31 class test2 {
       
    32     private final int[] MethodID = {Globals.MethodID_Array[1], Globals.MethodID_Array[2]};
    32 
    33 
    33     public void CallCallMe(Vector summation, Vector ID, Long functionDepth, Integer staticFunctionDepth)
    34     public void CallCallMe(Vector summation, Vector ID, Long functionDepth, Integer staticFunctionDepth)
    34         throws InvocationTargetException
    35             throws InvocationTargetException {
       
    36         Globals.appendSumToSummationVector(MethodID[1], summation);
    35 
    37 
    36     {
    38         if (CGT.shouldFinish()) {
    37         Globals.appendSumToSumationVector(MethodID[1], summation);
    39             return;
       
    40         }
    38 
    41 
    39         if (CGT.shouldFinish())
    42         if (Globals.VERBOSE) {
       
    43             System.out.println("test2.CallCallMe");
       
    44         }
       
    45 
       
    46         if ((functionDepth.longValue() <= 0) && (staticFunctionDepth.intValue() <= 0)) {
    40             return;
    47             return;
       
    48         }
    41 
    49 
    42         if (Globals.VERBOSE)
    50         MethodData methodCallStr;
    43             System.out.println("test2.CallCallMe");
    51         Long numFcalls;
       
    52         Integer staticFcalls;
       
    53         if (staticFunctionDepth.intValue() > 0) {
       
    54             numFcalls = functionDepth;
       
    55             staticFcalls = new Integer(staticFunctionDepth.intValue() - 1);
       
    56             methodCallStr = Globals.returnNextStaticMethod(MethodID[1]);
    44 
    57 
    45                 if ((functionDepth.longValue() <= 0) && (staticFunctionDepth.intValue() <=  0))
    58             Globals.addFunctionIDToVector(methodCallStr.id, ID);
    46                     {
    59         } else {
    47                         return;
    60             numFcalls = new Long(functionDepth.longValue() - 1);
    48                     }
    61             staticFcalls = staticFunctionDepth;
    49 
    62             Globals.addFunctionIDToVector(MethodID[0], ID);
    50                 MethodData methodCallStr;
    63             callMe(summation, ID, numFcalls, staticFcalls);
    51                 Long numFcalls;
    64             return;
    52                 Integer staticFcalls;
    65         }
    53                 if (staticFunctionDepth.intValue() > 0)
       
    54                     {
       
    55                         numFcalls = functionDepth;
       
    56                         staticFcalls = new Integer(staticFunctionDepth.intValue()-1);
       
    57                         //methodCallStr = Globals.nextStaticMethod(Globals.getIndexFromID(MethodID[1]));
       
    58                         methodCallStr = Globals.returnNextStaticMethod(MethodID[1]);
       
    59 
       
    60                         Globals.addFunctionIDToVector(methodCallStr.id, ID);
       
    61                     }
       
    62                 else
       
    63                     {
       
    64                         numFcalls = new Long(functionDepth.longValue()-1);
       
    65                         staticFcalls = staticFunctionDepth;
       
    66                         Globals.addFunctionIDToVector(MethodID[0], ID);
       
    67                         callMe(summation, ID, numFcalls, staticFcalls);
       
    68                         return;
       
    69                     }
       
    70 
    66 
    71 
    67 
    72                 try
    68         try {
    73                     {
    69             methodCallStr.nextMethod.invoke(methodCallStr.instance,
    74                         methodCallStr.nextMethod.invoke(methodCallStr.instance,
    70                     new Object[]{summation, ID, numFcalls, staticFcalls});
    75                                                         new Object []{summation, ID, numFcalls, staticFcalls});
    71         } catch (IllegalAccessException iax) {
    76                     }
    72             throw new TestFailure("Illegal Access Exception");
    77                 catch (IllegalAccessException iax)
    73         }
    78                     {
       
    79                         throw new TestFailure("Illegal Access Exception");
       
    80                     }
       
    81                 /*
       
    82                 catch (InvocationTargetException itx)
       
    83                     {
       
    84                                 throw itx;
       
    85                     }
       
    86                 */
       
    87     }
    74     }
    88 
    75 
    89     public void callMe(Vector summation, Vector ID, Long functionDepth, Integer staticFunctionDepth)
    76     public void callMe(Vector summation, Vector ID, Long functionDepth, Integer staticFunctionDepth)
    90         throws InvocationTargetException
    77             throws InvocationTargetException {
    91     {
    78         Globals.appendSumToSummationVector(MethodID[0], summation);
    92         Globals.appendSumToSumationVector(MethodID[0], summation);
       
    93 
    79 
    94         if (CGT.shouldFinish())
    80         if (CGT.shouldFinish()) {
    95             return;
    81             return;
       
    82         }
    96 
    83 
    97         if (Globals.VERBOSE)
    84         if (Globals.VERBOSE) {
    98             System.out.println("test2.callMe");
    85             System.out.println("test2.callMe");
       
    86         }
    99 
    87 
   100                 if ((functionDepth.longValue() <= 0) && (staticFunctionDepth.intValue() <=  0))
    88         if ((functionDepth.longValue() <= 0) && (staticFunctionDepth.intValue() <= 0)) {
   101                     {
    89             return;
   102                         return;
    90         }
   103                     }
       
   104 
    91 
   105                 MethodData methodCallStr;
    92         MethodData methodCallStr;
   106                 Long numFcalls;
    93         Long numFcalls;
   107                 Integer staticFcalls;
    94         Integer staticFcalls;
   108                 if (staticFunctionDepth.intValue() > 0)
    95         if (staticFunctionDepth.intValue() > 0) {
   109             {
    96             numFcalls = functionDepth;
   110                         numFcalls = functionDepth;
    97             staticFcalls = new Integer(staticFunctionDepth.intValue() - 1);
   111                         staticFcalls = new Integer(staticFunctionDepth.intValue()-1);
    98             methodCallStr = Globals.returnNextStaticMethod(MethodID[0]);
   112                         //methodCallStr = Globals.nextStaticMethod(Globals.getIndexFromID(MethodID[0]));
       
   113                         methodCallStr = Globals.returnNextStaticMethod(MethodID[0]);
       
   114 
    99 
   115             }
   100         } else {
   116                 else
   101             numFcalls = new Long(functionDepth.longValue() - 1);
   117             {
   102             staticFcalls = staticFunctionDepth;
   118                         numFcalls = new Long(functionDepth.longValue() -1);
   103             methodCallStr = Globals.nextRandomMethod();
   119                         staticFcalls = staticFunctionDepth;
   104         }
   120                         methodCallStr = Globals.nextRandomMethod();
       
   121             }
       
   122 
   105 
   123                 Globals.addFunctionIDToVector(methodCallStr.id, ID);
   106         Globals.addFunctionIDToVector(methodCallStr.id, ID);
   124 
   107 
   125 
   108 
   126                 try
   109         try {
   127             {
   110             methodCallStr.nextMethod.invoke(methodCallStr.instance,
   128                         methodCallStr.nextMethod.invoke(methodCallStr.instance,
   111                     new Object[]{summation, ID, numFcalls, staticFcalls});
   129                                 new Object []{summation, ID, numFcalls, staticFcalls});
   112         } catch (IllegalAccessException iax) {
   130             }
   113             throw new TestFailure("Illegal Access Exception");
   131                 catch (IllegalAccessException iax)
   114         }
   132             {
       
   133                         throw new TestFailure("Illegal Access Exception");
       
   134             }
       
   135 /*
       
   136                 catch (InvocationTargetException itx)
       
   137                     {
       
   138                                 System.out.println("itx test 2");
       
   139 
       
   140                                 throw itx;
       
   141                     }
       
   142                     */
       
   143 
   115 
   144     }
   116     }
   145 }
   117 }