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.InvocationTargetException; |
26 import java.lang.reflect.*; |
27 import java.util.Vector; |
27 import nsk.share.TestFailure; |
|
28 |
28 |
|
29 class test4 extends test2 { |
|
30 private final int[] MethodID = {Globals.MethodID_Array[1], Globals.MethodID_Array[5], Globals.MethodID_Array[6]}; |
29 |
31 |
30 class test4 extends test2 |
32 // this method verifies that a child can make a call to its parent |
31 { |
33 public void CallCallMe(Vector summation, Vector ID, Long functionDepth, Integer staticFunctionDepth) |
32 private final int[] MethodID = {Globals.MethodID_Array[1],Globals.MethodID_Array[5], Globals.MethodID_Array[6]}; |
34 throws InvocationTargetException { |
|
35 Globals.appendSumToSummationVector(MethodID[1], summation); |
33 |
36 |
34 //this method verifies that a child can make a call to its parent |
37 if (CGT.shouldFinish()) { |
35 public void CallCallMe(Vector summation, Vector ID, Long functionDepth, Integer staticFunctionDepth) |
38 return; |
36 throws InvocationTargetException |
39 } |
37 { |
|
38 Globals.appendSumToSumationVector(MethodID[1], summation); |
|
39 |
40 |
40 if (CGT.shouldFinish()) |
41 if (Globals.VERBOSE) { |
|
42 System.out.println("test4.CallCallMe"); |
|
43 } |
|
44 |
|
45 if ((functionDepth.longValue() <= 0) && (staticFunctionDepth.intValue() <= 0)) { |
41 return; |
46 return; |
42 |
47 } |
43 if (Globals.VERBOSE) |
|
44 System.out.println("test4.CallCallMe"); |
|
45 |
|
46 if ((functionDepth.longValue() <= 0) && (staticFunctionDepth.intValue() <= 0)) |
|
47 { |
|
48 return; |
|
49 } |
|
50 |
48 |
51 MethodData methodCallStr; |
49 MethodData methodCallStr; |
52 Long numFcalls; |
50 Long numFcalls; |
53 Integer staticFcalls; |
51 Integer staticFcalls; |
54 if (staticFunctionDepth.intValue() > 0) |
52 if (staticFunctionDepth.intValue() > 0) { |
55 { |
53 numFcalls = functionDepth; |
56 numFcalls = functionDepth; |
54 staticFcalls = new Integer(staticFunctionDepth.intValue() - 1); |
57 staticFcalls = new Integer(staticFunctionDepth.intValue()-1); |
55 methodCallStr = Globals.returnNextStaticMethod(MethodID[1]); |
58 //methodCallStr = Globals.nextStaticMethod(Globals.getIndexFromID(MethodID[1])); |
|
59 methodCallStr = Globals.returnNextStaticMethod(MethodID[1]); |
|
60 |
56 |
61 Globals.addFunctionIDToVector(methodCallStr.id, ID); |
57 Globals.addFunctionIDToVector(methodCallStr.id, ID); |
62 } |
58 } else { |
63 else |
59 numFcalls = new Long(functionDepth.longValue() - 1); |
64 { |
60 staticFcalls = staticFunctionDepth; |
65 numFcalls = new Long(functionDepth.longValue()-1); |
61 Globals.addFunctionIDToVector(MethodID[0], ID); |
66 staticFcalls = staticFunctionDepth; |
62 super.callMe(summation, ID, numFcalls, staticFcalls); |
67 Globals.addFunctionIDToVector(MethodID[0], ID); |
63 return; |
68 super.callMe(summation, ID, numFcalls, staticFcalls); |
64 } |
69 return; |
|
70 } |
|
71 |
65 |
72 |
66 |
73 Globals.callMethod(methodCallStr, summation, ID, numFcalls, staticFcalls); |
67 Globals.callMethod(methodCallStr, summation, ID, numFcalls, staticFcalls); |
74 } |
68 } |
75 |
69 |
76 //this method makes a Y fork in the method call structure |
70 // this method makes a Y fork in the method call structure |
77 public void callMe(Vector summation, Vector ID, Long functionDepth, Integer staticFunctionDepth) |
71 public void callMe(Vector summation, Vector ID, Long functionDepth, Integer staticFunctionDepth) |
78 throws InvocationTargetException |
72 throws InvocationTargetException { |
79 { |
73 Globals.appendSumToSummationVector(MethodID[2], summation); |
80 Globals.appendSumToSumationVector(MethodID[2], summation); |
|
81 |
74 |
82 if (CGT.shouldFinish()) |
75 if (CGT.shouldFinish()) { |
83 return; |
76 return; |
|
77 } |
84 |
78 |
85 if (Globals.VERBOSE) |
79 if (Globals.VERBOSE) { |
86 System.out.println("test4.callMe"); |
80 System.out.println("test4.callMe"); |
|
81 } |
87 |
82 |
88 if ((functionDepth.longValue() <= 0) && (staticFunctionDepth.intValue() <= 0)) |
83 if ((functionDepth.longValue() <= 0) && (staticFunctionDepth.intValue() <= 0)) { |
89 { |
84 return; |
90 return; |
85 } |
91 } |
|
92 |
86 |
93 MethodData methodCallStr; |
87 MethodData methodCallStr; |
94 Long numFcalls; |
88 Long numFcalls; |
95 Integer staticFcalls; |
89 Integer staticFcalls; |
96 if (staticFunctionDepth.intValue() > 0) |
90 if (staticFunctionDepth.intValue() > 0) { |
97 { |
91 numFcalls = functionDepth; |
98 numFcalls = functionDepth; |
92 staticFcalls = new Integer(staticFunctionDepth.intValue() - 1); |
99 staticFcalls = new Integer(staticFunctionDepth.intValue()-1); |
93 methodCallStr = Globals.returnNextStaticMethod(MethodID[2]); |
100 //methodCallStr = Globals.nextStaticMethod(Globals.getIndexFromID(MethodID[2])); |
94 } else { |
101 methodCallStr = Globals.returnNextStaticMethod(MethodID[2]); |
95 long temp = functionDepth.longValue() - 2; |
|
96 numFcalls = new Long(temp / 2); |
|
97 staticFcalls = staticFunctionDepth; |
102 |
98 |
|
99 if (Globals.VERBOSE) { |
|
100 System.out.println(" test4.callMe - Starting Branch 1"); |
103 } |
101 } |
104 else |
102 methodCallStr = Globals.nextRandomMethod(); |
105 { |
103 Globals.addFunctionIDToVector(methodCallStr.id, ID); |
106 long temp = functionDepth.longValue()-2; |
104 Globals.callMethod(methodCallStr, summation, ID, numFcalls, staticFcalls); |
107 numFcalls = new Long(temp/2); |
|
108 staticFcalls = staticFunctionDepth; |
|
109 |
105 |
110 if (Globals.VERBOSE) |
106 if (CGT.shouldFinish()) { |
111 System.out.println(" test4.callMe - Starting Branch 1"); |
107 return; |
112 methodCallStr = Globals.nextRandomMethod(); |
108 } |
113 Globals.addFunctionIDToVector(methodCallStr.id, ID); |
|
114 Globals.callMethod(methodCallStr, summation, ID, numFcalls, staticFcalls); |
|
115 |
109 |
116 if (CGT.shouldFinish()) |
110 temp -= temp / 2; |
117 return; |
111 if (temp < 0) { |
118 |
112 if (Globals.VERBOSE) { |
119 temp -= temp/2; |
113 System.out.println(" test4.callMe - Skipping Branch 2"); |
120 if (temp <0) |
114 } |
121 { |
115 return; |
122 if (Globals.VERBOSE) |
|
123 System.out.println(" test4.callMe - Skipping Branch 2"); |
|
124 return; |
|
125 } |
|
126 if (Globals.VERBOSE) |
|
127 System.out.println(" test4.callMe - Starting Branch 2"); |
|
128 numFcalls = new Long(temp); |
|
129 methodCallStr = Globals.nextRandomMethod(); |
|
130 } |
116 } |
|
117 if (Globals.VERBOSE) { |
|
118 System.out.println(" test4.callMe - Starting Branch 2"); |
|
119 } |
|
120 numFcalls = new Long(temp); |
|
121 methodCallStr = Globals.nextRandomMethod(); |
|
122 } |
131 Globals.addFunctionIDToVector(methodCallStr.id, ID); |
123 Globals.addFunctionIDToVector(methodCallStr.id, ID); |
132 Globals.callMethod(methodCallStr, summation, ID, numFcalls, staticFcalls); |
124 Globals.callMethod(methodCallStr, summation, ID, numFcalls, staticFcalls); |
133 } |
125 } |
134 |
126 |
135 } |
127 } |