Path: blob/master/test/hotspot/jtreg/vmTestbase/jit/graph/test4.java
40948 views
/*1* Copyright (c) 2008, 2021, Oracle and/or its affiliates. All rights reserved.2* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.3*4* This code is free software; you can redistribute it and/or modify it5* under the terms of the GNU General Public License version 2 only, as6* published by the Free Software Foundation.7*8* This code is distributed in the hope that it will be useful, but WITHOUT9* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or10* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License11* version 2 for more details (a copy is included in the LICENSE file that12* accompanied this code).13*14* You should have received a copy of the GNU General Public License version15* 2 along with this work; if not, write to the Free Software Foundation,16* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.17*18* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA19* or visit www.oracle.com if you need additional information or have any20* questions.21*/2223package jit.graph;2425import java.lang.reflect.InvocationTargetException;26import java.util.Vector;2728class test4 extends test2 {29private final int[] MethodID = {Globals.MethodID_Array[1], Globals.MethodID_Array[5], Globals.MethodID_Array[6]};3031// this method verifies that a child can make a call to its parent32public void CallCallMe(Vector summation, Vector ID, Long functionDepth, Integer staticFunctionDepth)33throws InvocationTargetException {34Globals.appendSumToSummationVector(MethodID[1], summation);3536if (CGT.shouldFinish()) {37return;38}3940if (Globals.VERBOSE) {41System.out.println("test4.CallCallMe");42}4344if ((functionDepth.longValue() <= 0) && (staticFunctionDepth.intValue() <= 0)) {45return;46}4748MethodData methodCallStr;49Long numFcalls;50Integer staticFcalls;51if (staticFunctionDepth.intValue() > 0) {52numFcalls = functionDepth;53staticFcalls = Integer.valueOf(staticFunctionDepth.intValue() - 1);54methodCallStr = Globals.returnNextStaticMethod(MethodID[1]);5556Globals.addFunctionIDToVector(methodCallStr.id, ID);57} else {58numFcalls = Long.valueOf(functionDepth.longValue() - 1);59staticFcalls = staticFunctionDepth;60Globals.addFunctionIDToVector(MethodID[0], ID);61super.callMe(summation, ID, numFcalls, staticFcalls);62return;63}646566Globals.callMethod(methodCallStr, summation, ID, numFcalls, staticFcalls);67}6869// this method makes a Y fork in the method call structure70public void callMe(Vector summation, Vector ID, Long functionDepth, Integer staticFunctionDepth)71throws InvocationTargetException {72Globals.appendSumToSummationVector(MethodID[2], summation);7374if (CGT.shouldFinish()) {75return;76}7778if (Globals.VERBOSE) {79System.out.println("test4.callMe");80}8182if ((functionDepth.longValue() <= 0) && (staticFunctionDepth.intValue() <= 0)) {83return;84}8586MethodData methodCallStr;87Long numFcalls;88Integer staticFcalls;89if (staticFunctionDepth.intValue() > 0) {90numFcalls = functionDepth;91staticFcalls = Integer.valueOf(staticFunctionDepth.intValue() - 1);92methodCallStr = Globals.returnNextStaticMethod(MethodID[2]);93} else {94long temp = functionDepth.longValue() - 2;95numFcalls = Long.valueOf(temp / 2);96staticFcalls = staticFunctionDepth;9798if (Globals.VERBOSE) {99System.out.println(" test4.callMe - Starting Branch 1");100}101methodCallStr = Globals.nextRandomMethod();102Globals.addFunctionIDToVector(methodCallStr.id, ID);103Globals.callMethod(methodCallStr, summation, ID, numFcalls, staticFcalls);104105if (CGT.shouldFinish()) {106return;107}108109temp -= temp / 2;110if (temp < 0) {111if (Globals.VERBOSE) {112System.out.println(" test4.callMe - Skipping Branch 2");113}114return;115}116if (Globals.VERBOSE) {117System.out.println(" test4.callMe - Starting Branch 2");118}119numFcalls = Long.valueOf(temp);120methodCallStr = Globals.nextRandomMethod();121}122Globals.addFunctionIDToVector(methodCallStr.id, ID);123Globals.callMethod(methodCallStr, summation, ID, numFcalls, staticFcalls);124}125126}127128129