1 /*
   2  * Copyright (c) 2008, 2018, Oracle and/or its affiliates. All rights reserved.
   3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
   4  *
   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
   7  * published by the Free Software Foundation.
   8  *
   9  * This code is distributed in the hope that it will be useful, but WITHOUT
  10  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  11  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  12  * version 2 for more details (a copy is included in the LICENSE file that
  13  * accompanied this code).
  14  *
  15  * You should have received a copy of the GNU General Public License version
  16  * 2 along with this work; if not, write to the Free Software Foundation,
  17  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  18  *
  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
  21  * questions.
  22  */
  23 package jit.graph;
  24 
  25 
  26 
  27 import java.util.*;
  28 import java.lang.reflect.*;
  29 import nsk.share.TestFailure;
  30 
  31 class test1
  32 {
  33     private final int classID = Globals.MethodID_Array[0];
  34 
  35     public void callMe(Vector summation, Vector ID, Long functionDepth, Integer staticFunctionDepth)
  36         throws InvocationTargetException
  37     {
  38         Globals.appendSumToSumationVector(classID, summation);
  39 
  40         if (CGT.shouldFinish())
  41             return;
  42 
  43         if (Globals.VERBOSE)
  44             System.out.println("test1.callMe");
  45 
  46         if ((functionDepth.longValue() <= 0) && (staticFunctionDepth.intValue() <=  0))
  47         {
  48             return;
  49         }
  50 
  51         MethodData methodCallStr;
  52         Long numFcalls;
  53         Integer staticFcalls;
  54 
  55         if (staticFunctionDepth.intValue() > 0)
  56         {
  57             numFcalls = functionDepth;
  58             staticFcalls = new Integer(staticFunctionDepth.intValue()-1);
  59             //methodCallStr = Globals.nextStaticMethod(Globals.getIndexFromID(classID));
  60             methodCallStr = Globals.returnNextStaticMethod(classID);
  61         }
  62         else
  63         {
  64             numFcalls = new Long(functionDepth.longValue() -1);
  65             staticFcalls = staticFunctionDepth;
  66             methodCallStr = Globals.nextRandomMethod();
  67         }
  68 
  69         Globals.addFunctionIDToVector(methodCallStr.id, ID);
  70 
  71         try {
  72                                 methodCallStr.nextMethod.invoke(methodCallStr.instance,
  73                                         new Object []{summation, ID, numFcalls, staticFcalls});
  74         } catch (IllegalAccessException iax) {
  75                                 throw new TestFailure("Illegal Access Exception");
  76         }
  77     }
  78 }