1 package gov.nasa.jpf.jvm; 20 21 import gov.nasa.jpf.JPFException; 22 import gov.nasa.jpf.jvm.bytecode.Instruction; 23 24 25 28 class JPF_java_io_PrintStream$ extends NativePeer { 29 boolean isMethodCondDeterministic (ThreadInfo ti, MethodInfo mi) { 30 boolean ret = false; 31 int mid = mi.getUniqueName().hashCode(); 32 33 MJIEnv env = ti.getMJIEnv(); 34 int rThis = (mi.isStatic()) 35 ? ci.getClassObjectRef() : ti.getCalleeThis(mi); 36 37 env.setCallEnvironment(mi); 38 39 try { 40 switch (mid) { 41 default: 42 throw new JPFException("no isDeterministic() condition: " + 43 mi.getName()); 44 } 45 } catch (Throwable x) { 46 x.printStackTrace(); 47 } 48 49 return ret; 50 } 51 52 boolean isMethodCondExecutable (ThreadInfo ti, MethodInfo mi) { 53 boolean ret = false; 54 int mid = mi.getUniqueName().hashCode(); 55 56 MJIEnv env = ti.getMJIEnv(); 57 int rThis = (mi.isStatic()) 58 ? ci.getClassObjectRef() : ti.getCalleeThis(mi); 59 60 env.setCallEnvironment(mi); 61 62 try { 63 switch (mid) { 64 default: 65 throw new JPFException("no isExecutable() condition: " + 66 mi.getName()); 67 } 68 } catch (Throwable x) { 69 x.printStackTrace(); 70 } 71 72 return ret; 73 } 74 75 Instruction executeMethod (ThreadInfo ti, MethodInfo mi) { 76 int iret = 0; 77 long lret = 0; 78 int retSize = 0; 79 String exception = null; 80 int mid = mi.getUniqueName().hashCode(); 81 82 MJIEnv env = ti.getMJIEnv(); 83 int rThis = (mi.isStatic()) ? ci.getClassObjectRef() : ti.getCalleeThis( 84 mi); 85 env.setCallEnvironment(mi); 86 87 try { 88 switch (mid) { 89 case -1796256208: retSize = 0; 91 gov.nasa.jpf.jvm.JPF_java_io_PrintStream.println__(env, rThis); 92 93 break; 94 95 case 628854628: retSize = 0; 97 gov.nasa.jpf.jvm.JPF_java_io_PrintStream.print__Ljava_lang_String_2(env, 98 rThis, 99 ti.peek(0)); 100 101 break; 102 103 case 1440870566: retSize = 0; 105 gov.nasa.jpf.jvm.JPF_java_io_PrintStream.println__Ljava_lang_String_2( 106 env, rThis, ti.peek(0)); 107 108 break; 109 110 case -1166388901: retSize = 0; 112 gov.nasa.jpf.jvm.JPF_java_io_PrintStream.print__I(env, rThis, 113 ti.peek(0)); 114 115 break; 116 117 case 150633433: retSize = 0; 119 gov.nasa.jpf.jvm.JPF_java_io_PrintStream.println__I(env, rThis, 120 ti.peek(0)); 121 122 break; 123 124 case -1166388994: retSize = 0; 126 gov.nasa.jpf.jvm.JPF_java_io_PrintStream.print__F(env, rThis, 127 Types.intToFloat( 128 ti.peek(0))); 129 130 break; 131 132 case 150633340: retSize = 0; 134 gov.nasa.jpf.jvm.JPF_java_io_PrintStream.println__F(env, rThis, 135 Types.intToFloat( 136 ti.peek(0))); 137 138 break; 139 140 case -1166388870: retSize = 0; 142 gov.nasa.jpf.jvm.JPF_java_io_PrintStream.print__J(env, rThis, 143 ti.longPeek(0)); 144 145 break; 146 147 case 150633464: retSize = 0; 149 gov.nasa.jpf.jvm.JPF_java_io_PrintStream.println__J(env, rThis, 150 ti.longPeek(0)); 151 152 break; 153 154 case -1166389056: retSize = 0; 156 gov.nasa.jpf.jvm.JPF_java_io_PrintStream.print__D(env, rThis, 157 Types.longToDouble( 158 ti.longPeek(0))); 159 160 break; 161 162 case 150633278: retSize = 0; 164 gov.nasa.jpf.jvm.JPF_java_io_PrintStream.println__D(env, rThis, 165 Types.longToDouble( 166 ti.longPeek(0))); 167 168 break; 169 170 case -1166388374: retSize = 0; 172 gov.nasa.jpf.jvm.JPF_java_io_PrintStream.print__Z(env, rThis, 173 Types.intToBoolean( 174 ti.peek(0))); 175 176 break; 177 178 case 150633960: retSize = 0; 180 gov.nasa.jpf.jvm.JPF_java_io_PrintStream.println__Z(env, rThis, 181 Types.intToBoolean( 182 ti.peek(0))); 183 184 break; 185 186 case 150633247: retSize = 0; 188 gov.nasa.jpf.jvm.JPF_java_io_PrintStream.println__C(env, rThis, 189 (char) ti.peek(0)); 190 191 break; 192 193 case -1166389087: retSize = 0; 195 gov.nasa.jpf.jvm.JPF_java_io_PrintStream.print__C(env, rThis, 196 (char) ti.peek(0)); 197 198 break; 199 200 case 754558870: retSize = 0; 202 gov.nasa.jpf.jvm.JPF_java_io_PrintStream.write__Ljava_lang_String_2(env, 203 rThis, 204 ti.peek(0)); 205 206 break; 207 208 default: 209 return ti.createAndThrowException("java.lang.UnsatisfiedLinkError", 210 "cannot find: " + ci.getName() + 211 '.' + mi.getName()); 212 } 213 } catch (Throwable x) { 214 x.printStackTrace(); 215 216 return ti.createAndThrowException( 217 "java.lang.reflect.InvocationTargetException", 218 ci.getName() + '.' + mi.getName()); 219 } 220 221 if ((exception = env.getException()) != null) { 222 return ti.createAndThrowException(exception); 223 } 224 225 if (env.getRepeat()) { 226 return ti.getPC(); 227 } 228 229 ti.removeArguments(mi); 230 231 switch (retSize) { 232 case 0: 233 break; 235 case 1: 236 ti.push(iret, mi.isReferenceReturnType()); 237 238 break; 239 240 case 2: 241 ti.longPush(lret); 242 243 break; 244 } 245 246 return ti.getPC().getNext(); 247 } 248 } | Popular Tags |