1 2 package measurements.suites; 3 4 5 public class TestClass4 extends TestClass implements TestInterface 6 { 7 8 public static boolean scallDummyMethod = false; 9 public boolean callDummyMethod = false; 10 public void dummyMethod(boolean callRecursively) 11 { 12 if (callRecursively) 13 dummyMethod(callRecursively); 14 } 15 public static void sdummyMethod(boolean callRecursively) 16 { 17 if (callRecursively) 18 sdummyMethod(callRecursively); 19 } 20 21 static int staticInt; 23 static long staticLong; 24 static Object staticObj; 25 26 private static int privateStaticInt; 27 private static long privateStaticLong; 28 private static Object privateStaticObj; 29 30 public int instanceInt; 31 public long instanceLong; 32 public Object instanceObj; 33 34 private int privateInstanceInt; 35 private long privateInstanceLong; 36 private Object privateInstanceObj; 37 38 39 40 41 public void interfaceMethodShort() { if (callDummyMethod) dummyMethod(callDummyMethod);} 43 public void interfaceMethodLong(Object x, Object o) { if (callDummyMethod) dummyMethod(callDummyMethod);} 44 public void instanceMethodShort() { if (callDummyMethod) dummyMethod(callDummyMethod);} 45 public void instanceMethodLong(Object x, Object o) { if (callDummyMethod) dummyMethod(callDummyMethod);} 46 public static void staticMethodShort() { if (scallDummyMethod) sdummyMethod(scallDummyMethod);} 47 public static void staticMethodLong(Object x, Object o) { if (scallDummyMethod) sdummyMethod(scallDummyMethod);} 48 private static void privateStaticMethodShort() { if (scallDummyMethod) sdummyMethod(scallDummyMethod);} 49 private static void privateStaticMethodLong(Object x, Object o) { if (scallDummyMethod) sdummyMethod(scallDummyMethod);} 50 public synchronized void syncInstanceMethodShort() { if (callDummyMethod) dummyMethod(callDummyMethod);} 51 public synchronized void syncInstanceMethodLong(Object x, Object o) { if (callDummyMethod) dummyMethod(callDummyMethod);} 52 private void privateInstanceMethodShort() { if (callDummyMethod) dummyMethod(callDummyMethod);} 53 private void privateInstanceMethodLong(Object x, Object o) { if (callDummyMethod) dummyMethod(callDummyMethod);} 54 55 public void testPutField(int runs) 56 { 57 58 for (int i=0; i < runs; i++) 59 this.instanceInt = 1; 60 } 61 62 public void testGetField(int runs) 63 { 64 65 int localInt=0; 66 for (int i=0; i < runs; i++) 67 localInt=this.instanceInt; 68 } 69 70 71 public void testNonJPOperations() 72 { 73 int i = 1; 74 int ii = 1; 75 int localInt = 1; 76 long localLong = 1; 77 Object localObj = new Object (); 78 int[] localArr = new int[10]; 79 Object oo = new TestClass4(); 80 81 byte b1 = 1; 82 byte b2 = 1; 83 short s1 = 1; 84 short s2 = 1; 85 int i1 = 1; 86 int i2 = 1; 87 long l1 = 1; 88 long l2 = 1; 89 90 final Object tcObject = new TestClass4(); 91 final int[] aa = new int[10]; 92 93 for (ii = 0; ii < TestFrequency.LOCALLOOP; ii++) 95 ; 96 for (ii = TestFrequency.LOCALLOOP; --ii >= 0; ) 97 ; 98 99 for(i=TestFrequency.CHECKCAST;--i >= 0;) 101 { 102 oo=(TestClass4)oo; 103 } 104 105 for(i=TestFrequency.LOCALVAR;--i >= 0;) 107 { 108 localInt = localInt; 109 localLong = localLong; 110 localObj = localObj; 111 localArr[0] = localArr[0]; 112 } 113 114 for (i=TestFrequency.LOCALADD;--i >= 0;) 116 { 117 i1+=i2; 118 s1+=s2; 119 l1+=s2; 120 b1+=b2; 121 } 122 123 131 } 132 133 public void testFieldOperations() 134 { 135 int i; 136 int localInt = 1; 137 long localLong = 1; 138 Object localObj = new Object (); 139 TestClass4 obj = new TestClass4(); 140 141 for(i=TestFrequency.PUTSTATIC/6;--i >= 0;) 143 { 144 staticInt = localInt; 146 staticObj = localObj; 147 staticLong = localLong; 148 149 privateStaticInt = localInt; 151 privateStaticObj = localObj; 152 privateStaticLong = localLong; 153 } 154 155 156 for(i=TestFrequency.GET_ARGSSTATIC/6;--i >= 0;) 158 { 159 localInt = staticInt; 161 localObj = staticObj; 162 localLong = staticLong; 163 164 localInt = privateStaticInt; 166 localObj = privateStaticObj; 167 localLong = privateStaticLong; 168 } 169 170 171 for(i=TestFrequency.PUTFIELD/9;--i >= 0;) 173 { 174 instanceInt = localInt; 176 instanceObj = localObj; 177 instanceLong = localLong; 178 179 privateInstanceInt = localInt; 181 privateInstanceObj = localObj; 182 privateInstanceLong = localLong; 183 184 obj.instanceInt = localInt; 186 obj.instanceLong = localLong; 187 obj.instanceObj = localObj; 188 189 } 190 191 192 for(i=TestFrequency.GET_ARGSFIELD/9;--i >= 0;) 194 { 195 localInt = instanceInt; 197 localObj = instanceObj; 198 localLong = instanceLong; 199 200 localInt = privateInstanceInt; 202 localObj = privateInstanceObj; 203 localLong = privateInstanceLong; 204 205 localInt = obj.instanceInt; 207 localObj = obj.instanceObj; 208 localLong = obj.instanceLong; 209 } 210 } 211 212 213 public void testMethodOperations() 214 { 215 TestInterface localInterface = new TestClass4(); 216 TestClass4 obj = new TestClass4(); 217 int localInt = 1; 218 Object localObj = new Object (); 219 int i; 220 221 for(i=TestFrequency.INVOKEINTERFACE/2;--i >= 0;) 223 { 224 localInterface.interfaceMethodShort(); 225 localInterface.interfaceMethodLong(localObj,localObj); 226 } 227 228 for(i=TestFrequency.INVOKESPECIAL/2;--i >= 0;) 229 { 230 privateInstanceMethodShort(); 232 privateInstanceMethodLong(localObj,localObj); 233 } 234 235 for(i=TestFrequency.INVOKEVIRTUAL/6;--i >= 0;) 237 { 238 instanceMethodShort(); 239 instanceMethodLong(localObj,localObj); 240 241 syncInstanceMethodShort(); 242 syncInstanceMethodLong(localObj,localObj); 243 244 obj.instanceMethodShort(); 245 obj.instanceMethodLong(localObj,localObj); 246 } 247 248 for(i=TestFrequency.INVOKESTATIC/4;--i >= 0;) 250 { 251 staticMethodShort(); 252 staticMethodLong(localObj,localObj); 253 254 privateStaticMethodShort(); 255 privateStaticMethodLong(localObj,localObj); 256 } 257 258 } 259 260 } 261 | Popular Tags |