1 package org.ibex.arenaj;
8 public class Main extends SceneTransformer {
10 public static final int initialSize = 10000;
12 private static Main instance = new Main();
14 public static Main v() { return instance; }
16 public static void main(String[] args) throws Exception {
17 if(args.length == 0) {
18 System.out.println("Syntax: java " + v().getClass().getName() + " [soot options]");
21 PackManager.v().getPack("wjtp").add(new Transform("wjtp.tx", Main.v()));
22 String[] args2 = new String[args.length + 14];
23 System.arraycopy(args, 0, args2, 0, args.length-1);
25 System.getProperty("java.class.path") +
27 System.getProperty("sun.boot.class.path");
28 String extDirs = System.getProperty("java.ext.dirs");
29 if (extDirs != null) {
30 StringTokenizer st = new StringTokenizer(extDirs, File.pathSeparatorChar+"");
31 while(st.hasMoreTokens()) {
32 String goo = st.nextToken();
33 System.out.println("goo " + goo);
34 File f = new File(goo);
35 if (!f.exists() || !f.isDirectory()) continue;
36 String[] jars = f.list();
37 for(int i=0; i<jars.length; i++)
38 sootcp += File.pathSeparator + f.getPath() + File.separatorChar + jars[i];
41 args2[args.length - 1] = "-w";
42 args2[args.length + 0] = "-p";
43 args2[args.length + 1] = "cg";
44 args2[args.length + 2] = "enabled:false";
45 args2[args.length + 3] = "-p";
46 args2[args.length + 4] = "wjap";
47 args2[args.length + 5] = "enabled:false";
48 args2[args.length + 6] = "-p";
49 args2[args.length + 7] = "jtp";
50 args2[args.length + 8] = "enabled:false";
51 //args2[args.length + 9] = "-keep-line-number";
52 args2[args.length + 9] = "-allow-phantom-refs";
53 args2[args.length + 10] = "-allow-phantom-refs";
54 args2[args.length + 11] = "-cp";
55 args2[args.length + 12] = sootcp;
56 System.out.println("sootcp => " + sootcp);
57 args2[args.length + 13] = args[args.length-1];
58 for(int i=0; i<args2.length; i++) System.out.println("args2["+i+"] = " + args2[i]);
59 soot.Main.main(args2);
63 public static Local viaLocal(Value v, Body b) {
64 Local l = Jimple.v().newLocal("tmpRef" + (tfr++), v.getType());
66 if (v instanceof IdentityRef) {
67 b.getUnits().addFirst(Jimple.v().newIdentityStmt(l, v));
69 b.getUnits().addFirst(Jimple.v().newAssignStmt(l, v));
73 public static Local viaLocal(Value v, Body b, Unit u) {
74 Local l = Jimple.v().newLocal("tmpRef" + (tfr++), v.getType());
76 if (v instanceof IdentityRef) {
77 b.getUnits().insertBefore(Jimple.v().newIdentityStmt(l, v), u);
79 b.getUnits().insertBefore(Jimple.v().newAssignStmt(l, v), u);
84 HashMap map = new HashMap();
85 HashSet size_added = new HashSet();
87 public boolean isGladiator(SootClass c) { return c.implementsInterface("org.ibex.arenaj.Gladiator"); }
88 public boolean isGladiatorField(SootField f)
89 { return isGladiator(f.getDeclaringClass()) && !f.getName().equals("this") && f.getName().indexOf('$')==-1; }
90 public boolean isGladiatorFieldRef(SootFieldRef f) {
91 return isGladiator(f.declaringClass()) && !f.name().equals("this") && f.name().indexOf('$')==-1;
93 public SootField getGladiatorField(SootField f) { return getGladiatorField(f.makeRef()); }
94 public SootField getGladiatorField(SootFieldRef f) {
95 SootClass c = f.declaringClass();
96 SootClass oc = Scene.v().getSootClass(c.getName().substring(0, c.getName().lastIndexOf('$')));
97 String sig = f.declaringClass().getName()+"."+f.name();
98 if (map.get(sig) != null) return (SootField)map.get(sig);
100 if (t instanceof RefType && isGladiator(((RefType)t).getSootClass())) t = IntType.v();
101 SootField nf = new SootField(c.getShortName().substring(c.getShortName().lastIndexOf('$')+1) + "$" + f.name(),
106 Body body = getInitBody(oc);
107 Expr newArr = Jimple.v().newNewArrayExpr(t, IntConstant.v(initialSize));
108 Local newArrLocal = Jimple.v().newLocal("tmpRef" + (tfr++), f.type().makeArrayType());
109 body.getLocals().add(newArrLocal);
110 InstanceFieldRef ifr = Jimple.v().newInstanceFieldRef(thisLocal(c,body), nf.makeRef());
111 body.getUnits().addFirst(Jimple.v().newAssignStmt(ifr, newArrLocal));
112 body.getUnits().addFirst(Jimple.v().newAssignStmt(newArrLocal, newArr));
118 public Body getInitBody(SootClass c) {
119 c.setApplicationClass();
120 List list = new LinkedList();
121 SootMethod m = c.getMethod("<init>", list);
122 if (!m.hasActiveBody()) {
123 JimpleBody b = (JimpleBody)Jimple.v().newBody(m);
126 return m.getActiveBody();
129 public Local thisLocal(SootClass c, Body b) { return b.getThisLocal(); }
130 public SootFieldRef getGladiatorFieldSizeRef(SootClass c) {
131 SootClass mc = getParent(c);
132 String name = c.getShortName().substring(c.getShortName().lastIndexOf('$')+1) + "$$size";
133 if (map.get(name) == null) {
134 SootField f = new SootField(name, IntType.v());
137 Body body = getInitBody(mc);
138 InstanceFieldRef ifr = Jimple.v().newInstanceFieldRef(thisLocal(c,body), f.makeRef());
139 body.getUnits().addFirst(Jimple.v().newAssignStmt(ifr, IntConstant.v(0)));
143 return Scene.v().makeFieldRef(mc, name, IntType.v(), false);
145 public SootFieldRef getGladiatorFieldMaxRef(SootClass c) {
146 SootClass mc = getParent(c);
147 String name = c.getShortName().substring(c.getShortName().lastIndexOf('$')+1) + "$$max";
148 if (map.get(name) == null) {
149 SootField f = new SootField(name, IntType.v());
152 Body body = getInitBody(mc);
153 InstanceFieldRef ifr = Jimple.v().newInstanceFieldRef(thisLocal(c,body), f.makeRef());
154 body.getUnits().addFirst(Jimple.v().newAssignStmt(ifr, IntConstant.v(initialSize)));
158 return Scene.v().makeFieldRef(mc, name, IntType.v(), false);
161 public boolean isGladiatorType(Type t) { return (t instanceof RefType) && isGladiator(((RefType)t).getSootClass()); }
166 boolean done = false;
167 public void internalTransform(String phaseName, Map options) {
168 System.out.println("begun");
169 List ac = new LinkedList();
170 for(Iterator it = Scene.v().getClasses().iterator(); it.hasNext();) {
171 SootClass sc = (SootClass)it.next();
172 sc.setLibraryClass();
174 for(Iterator it = Scene.v().getClasses().iterator(); it.hasNext();) {
175 SootClass sc = (SootClass)it.next();
176 if (isGladiator(sc)) {
177 System.out.println(" application class: " + sc.getName());
178 System.out.println(" application class: " + getParent(sc).getName());
179 sc.setApplicationClass();
180 getParent(sc).setApplicationClass();
182 ac.add(getParent(sc));
183 for(Iterator i2 = sc.getMethods().iterator(); i2.hasNext();) {
184 SootMethod m = (SootMethod)i2.next();
185 if (m.isConcrete()) m.retrieveActiveBody();
187 for(Iterator i2 = getParent(sc).getMethods().iterator(); i2.hasNext();) {
188 SootMethod m = (SootMethod)i2.next();
189 if (m.isConcrete()) m.retrieveActiveBody();
193 for(Iterator it = ac.iterator(); it.hasNext();) {
194 SootClass sc = (SootClass)it.next();
195 if (sc.isInterface()) continue;
196 if (!isGladiator(sc)) continue;
197 System.out.println("fixing Gladiator class: " + sc);
200 for(Iterator it = ac.iterator(); it.hasNext();) {
201 SootClass sc = (SootClass)it.next();
202 if (sc.isInterface()) continue;
203 System.out.println(" updating class: " + sc);
208 public SootClass getParent(SootClass sc) {
209 return Scene.v().getSootClass(sc.getName().substring(0, sc.getName().lastIndexOf('$')));
212 public void fixClass(SootClass sc) {
213 SootClass mc = getParent(sc);
214 String incFuncName = sc.getShortName().substring(sc.getShortName().lastIndexOf('$')+1) + "$$inc";
215 SootMethod method = new SootMethod(incFuncName, new LinkedList(),
216 IntType.v(), Modifier.PRIVATE,
218 mc.addMethod(method);
219 Body body = Jimple.v().newBody(method);
220 method.setActiveBody(body);
221 ((JimpleBody)body).insertIdentityStmts();
222 Local l = Jimple.v().newLocal("tmpRef" + (tfr++), IntType.v());
223 body.getLocals().add(l);
224 Local l2 = Jimple.v().newLocal("tmpRef" + (tfr++), IntType.v());
225 body.getLocals().add(l2);
226 Local l3 = Jimple.v().newLocal("tmpRef" + (tfr++), IntType.v());
227 body.getLocals().add(l3);
228 InstanceFieldRef sfr = Jimple.v().newInstanceFieldRef(body.getThisLocal(), getGladiatorFieldSizeRef(sc));
229 InstanceFieldRef maxField = Jimple.v().newInstanceFieldRef(body.getThisLocal(), getGladiatorFieldMaxRef(sc));
230 body.getUnits().add(Jimple.v().newAssignStmt(l, sfr));
231 body.getUnits().add(Jimple.v().newAssignStmt(l2, Jimple.v().newAddExpr(l, IntConstant.v(1))));
232 body.getUnits().add(Jimple.v().newAssignStmt(sfr, l2));
233 body.getUnits().add(Jimple.v().newAssignStmt(l3, maxField));
234 Stmt stmt = Jimple.v().newReturnStmt(l2);
235 body.getUnits().add(Jimple.v().newIfStmt(Jimple.v().newLtExpr(l2, l3), stmt));
237 Local l4 = Jimple.v().newLocal("tmpRef" + (tfr++), IntType.v());
238 body.getLocals().add(l4);
239 body.getUnits().add(Jimple.v().newAssignStmt(l4, Jimple.v().newShlExpr(l3, IntConstant.v(1))));
240 body.getUnits().add(Jimple.v().newAssignStmt(maxField, l4));
242 for(Iterator it = sc.getFields().iterator(); it.hasNext();) {
243 SootField f = getGladiatorField((SootField)it.next());
244 InstanceFieldRef ifr = Jimple.v().newInstanceFieldRef(body.getThisLocal(), f.makeRef());
245 Local ll0 = Jimple.v().newLocal("tmpRef" + (tfr++), f.getType());
246 body.getLocals().add(ll0);
247 body.getUnits().add(Jimple.v().newAssignStmt(ll0, ifr));
248 Local ll = Jimple.v().newLocal("tmpRef" + (tfr++), f.getType());
249 body.getLocals().add(ll);
250 body.getUnits().add(Jimple.v().newAssignStmt(ll,
251 Jimple.v().newNewArrayExpr(((ArrayType)f.getType()).getElementType(),
253 Type ot = Scene.v().getSootClass("java.lang.Object").getType();
254 List types = new LinkedList();
256 types.add(IntType.v());
258 types.add(IntType.v());
259 types.add(IntType.v());
260 SootMethodRef arrayCopy =
261 Scene.v().makeMethodRef(Scene.v().getSootClass("java.lang.System"),
266 List args = new LinkedList();
268 args.add(IntConstant.v(0));
270 args.add(IntConstant.v(0));
272 body.getUnits().add(Jimple.v().newInvokeStmt(Jimple.v().newStaticInvokeExpr(arrayCopy, args)));
273 body.getUnits().add(Jimple.v().newAssignStmt(ifr,ll));
275 for(Iterator it = sc.getMethods().iterator(); it.hasNext();) {
276 SootMethod m = (SootMethod)it.next();
277 if (!m.isConcrete()) continue;
278 boolean doremove = true;
279 Body mbody = m.getActiveBody();
280 if (isGladiator(m.getDeclaringClass()) && m.getName().equals("<init>")) {
282 SootClass c = m.getDeclaringClass();
283 String name = /*c.getShortName().substring(c.getShortName().lastIndexOf('$')+1) + */"$init";
284 List li = m.getParameterTypes();
285 //li.add(IntType.v());
287 SootMethod nm = new SootMethod(name, li, isGladiatorType(m.getReturnType()) ? IntType.v() : m.getReturnType());
288 JimpleBody bod = Jimple.v().newBody(nm);
289 bod.importBodyContentsFrom(m.getActiveBody());
290 nm.setActiveBody(bod);
293 mbody.getUnits().remove(((JimpleBody)mbody).getFirstNonIdentityStmt());
294 mbody.getUnits().remove(((JimpleBody)mbody).getFirstNonIdentityStmt());
296 System.out.println("examining " + sc.getName() + "." + m.getSignature());
297 m.retrieveActiveBody();
299 if (m.isStatic()) continue;
301 String name = sc.getShortName().substring(sc.getShortName().lastIndexOf('$')+1) + "$$" + m.getName();
302 List list = new LinkedList();
303 list.addAll(m.getParameterTypes());
304 list.add(IntType.v());
305 for(Iterator i = list.iterator(); i.hasNext();) System.out.println(i.next());
306 SootMethod m2 = new SootMethod(name, list, m.getReturnType());
307 getParent(sc).addMethod(m2);
309 JimpleBody ab = (JimpleBody)Jimple.v().newBody(m2);
310 ab.importBodyContentsFrom(mbody);
311 m2.setActiveBody(ab);
312 Local loc = Jimple.v().newLocal("tmpRef" + (tfr++), getParent(sc).getType());
313 ab.getLocals().add(loc);
314 // FIXME: insert assignment to this
316 for(Iterator z = ab.getLocals().iterator(); z.hasNext();) {
317 Local loc2 = (Local)z.next();
318 if (isGladiatorType(loc2.getType())) {
319 loc2.setType(IntType.v());
323 Chain units = ab.getUnits();
324 boolean touched = false;
325 Local loc0 = Jimple.v().newLocal("tmpRef" + (tfr++), getParent(sc).getType());
326 ab.getLocals().add(loc0);
327 for(Iterator stmtIt = units.snapshotIterator(); stmtIt.hasNext();) {
328 Stmt s = (Stmt) stmtIt.next();
329 if (s instanceof IdentityStmt) {
330 IdentityStmt is = (IdentityStmt)s;
331 Local left = (Local)is.getLeftOp();
332 if (is.getRightOp() instanceof ThisRef) {
333 left.setType(IntType.v());
334 is.getRightOpBox().setValue(Jimple.v().newParameterRef(IntType.v(), m.getParameterCount()));
336 units.addFirst(Jimple.v().newIdentityStmt(loc0, Jimple.v().newThisRef(getParent(sc).getType())));
342 for(Iterator i = s.getUseAndDefBoxes().iterator(); i.hasNext();) {
344 if (o instanceof ValueBox) {
345 ValueBox vb = (ValueBox)o;
348 if (o instanceof Local && isGladiatorType(((Local)o).getType())) {
349 System.out.println("thunking");
353 if (vb.getValue() instanceof ThisRef) {
354 System.out.println(s);
362 if (doremove) sc.removeMethod(m);
365 body.getUnits().add(stmt);
368 public void nuke(SootClass c) {
369 for(Iterator it = c.getFields().iterator(); it.hasNext();) {
370 SootField f = (SootField)it.next();
371 Type t = f.getType();
372 if (t instanceof RefType) {
373 RefType rt = (RefType)t;
374 SootClass sc = rt.getSootClass();
375 if (isGladiator(sc)) f.setType(IntType.v());
376 } else if (t instanceof ArrayType) {
377 ArrayType at = (ArrayType)t;
378 t = at.getElementType();
379 if (!(t instanceof RefType)) continue;
380 RefType rt = (RefType)t;
381 SootClass sc = rt.getSootClass();
382 if (isGladiator(sc)) f.setType(IntType.v().makeArrayType());
386 List list = new LinkedList(); list.addAll(c.getMethods());
387 for(Iterator it = list.iterator(); it.hasNext();) {
388 SootMethod m = (SootMethod)it.next();
390 if (m.hasActiveBody()) b = fixBody(m.getActiveBody(), c, m);
391 List l2 = new LinkedList();
392 List l = m.getParameterTypes();
393 for(Iterator it2 = l.iterator(); it2.hasNext();) {
394 Type t = (Type)it2.next();
395 l2.add(isGladiatorType(t) ? IntType.v() : t);
397 Type t = m.getReturnType();
398 if (isGladiatorType(t)) {
400 if (m.hasActiveBody()) {
401 Body bod = m.getActiveBody();
402 for(Iterator stmtIt = bod.getUnits().snapshotIterator(); stmtIt.hasNext();) {
403 Stmt s = (Stmt) stmtIt.next();
404 if (s instanceof ReturnStmt) {
405 if (((ReturnStmt)s).getOp().getType() instanceof NullType) {
406 ((ReturnStmt)s).getOpBox().setValue(IntConstant.v(-1));
412 String name = m.getName();
413 SootMethod meth = new SootMethod(name, l2, isGladiatorType(t) ? IntType.v() : t, m.getModifiers());
415 JimpleBody b2 = Jimple.v().newBody(meth);
416 b2.importBodyContentsFrom(b);
417 meth.setActiveBody(b2);
425 protected Body fixBody(Body body, SootClass ownerClass, SootMethod smeth) {
426 if (body instanceof JimpleBody) {
427 JimpleBody b2 = Jimple.v().newBody(smeth);
428 b2.importBodyContentsFrom(body);
431 Chain units = body.getUnits();
432 System.out.println("fixBody("+body.getMethod()+")");
433 for(Iterator it = body.getLocals().snapshotIterator(); it.hasNext();) {
434 Local l = (Local)it.next();
435 if (isGladiatorType(l.getType())) l.setType(IntType.v());
437 for(int qq=0; qq<2; qq++) for(Iterator stmtIt = units.snapshotIterator(); stmtIt.hasNext();) {
438 Stmt s = (Stmt) stmtIt.next();
439 if (s instanceof DefinitionStmt) {
440 DefinitionStmt ds = (DefinitionStmt)s;
441 if (ds.getLeftOp().getType() instanceof PrimType && ds.getRightOp().getType() instanceof NullType) {
442 ds.getRightOpBox().setValue(IntConstant.v(-1));
445 if (isGladiatorType(smeth.getReturnType()) && s instanceof ReturnStmt) {
446 if (((ReturnStmt)s).getOp().getType() instanceof NullType) {
447 ((ReturnStmt)s).getOpBox().setValue(IntConstant.v(-1));
450 List l = s.getUseAndDefBoxes();
451 for(Iterator it = l.iterator(); it.hasNext();) {
452 Object o = it.next();
453 if (o instanceof ValueBox) {
454 ValueBox vb = (ValueBox)o;
455 Value v = vb.getValue();
457 if (v instanceof BinopExpr) {
458 BinopExpr boe = (BinopExpr)v;
459 if (boe.getOp1().getType() instanceof PrimType && boe.getOp2().getType() instanceof NullType) {
460 boe.setOp2(IntConstant.v(-1));
462 if (boe.getOp2().getType() instanceof PrimType && boe.getOp1().getType() instanceof NullType) {
463 boe.setOp1(IntConstant.v(-1));
467 if (v instanceof NewExpr) {
468 NewExpr ne = (NewExpr)v;
469 if (isGladiatorType(ne.getBaseType())) {
470 SootClass sc = ((RefType)ne.getBaseType()).getSootClass();
471 SootClass mc = getParent(sc);
472 String incFuncName = sc.getShortName().substring(sc.getShortName().lastIndexOf('$')+1) + "$$inc";
473 SootMethodRef smr = Scene.v().makeMethodRef(mc, incFuncName, new LinkedList(), IntType.v(), false);
474 Expr invokeExpr = Jimple.v().newSpecialInvokeExpr(thisLocal(mc,body), smr);
475 Local ll = viaLocal(invokeExpr, body, s);
482 if (v instanceof InvokeExpr) {
483 InvokeExpr ie = (InvokeExpr)v;
484 SootMethodRef mr = ie.getMethodRef();
485 String name = mr.name();
486 if (v instanceof InstanceInvokeExpr && isGladiator(mr.declaringClass())) {
487 InstanceInvokeExpr iie = (InstanceInvokeExpr)v;
488 List li = new LinkedList();
489 li.addAll(iie.getArgs());
490 LinkedList pl = new LinkedList();
491 for(Iterator it2 = mr.parameterTypes().iterator(); it2.hasNext();) {
492 Type t = (Type)it2.next();
493 pl.add(isGladiatorType(t) ? IntType.v() : t);
495 if (mr.name().equals("<init>") && isGladiator(mr.declaringClass())) {
501 li.add(viaLocal(iie.getBase(),body,s));
502 SootClass sc = mr.declaringClass();
503 name = sc.getShortName().substring(sc.getShortName().lastIndexOf('$')+1) + "$$" + name;
504 mr = Scene.v().makeMethodRef(getParent(sc),
507 isGladiatorType(mr.returnType()) ? IntType.v() : mr.returnType(),
509 ie = Jimple.v().newVirtualInvokeExpr(body.getThisLocal(), mr, li);
512 } else if (!(v instanceof StaticInvokeExpr)) {
513 List l0 = mr.parameterTypes();
514 List l2 = new LinkedList();
515 for(Iterator it2 = l0.iterator(); it2.hasNext();) {
516 Type t = (Type)it2.next();
517 l2.add(isGladiatorType(t) ? IntType.v() : t);
519 mr = Scene.v().makeMethodRef(mr.declaringClass(),
522 isGladiatorType(mr.returnType()) ? IntType.v() : mr.returnType(),
528 for(int i=0; i<ie.getArgCount(); i++) {
529 ValueBox b = ie.getArgBox(i);
530 Value val = b.getValue();
531 if (mr.parameterType(i) instanceof RefType && val.getType() instanceof PrimType) {
532 SootClass intClass = Scene.v().getSootClass("java.lang.Integer");
533 List typelist = new LinkedList();
534 typelist.add(IntType.v());
535 SootMethod intMethod = intClass.getMethod("<init>", typelist);
536 Local loc = viaLocal(Jimple.v().newNewExpr(RefType.v(intClass)), body, s);
537 List list = new LinkedList();
539 units.insertBefore(Jimple.v().newInvokeStmt(Jimple.v().newSpecialInvokeExpr(loc,
545 if (val != null && val.getType() instanceof NullType && mr.parameterType(i) instanceof IntType) {
546 b.setValue(IntConstant.v(-1));
551 } else if (v instanceof CastExpr) {
552 CastExpr ce = (CastExpr)v;
553 if (isGladiatorType(ce.getCastType())) {
554 SootClass mc = getParent(((RefType)ce.getCastType()).getSootClass());
555 SootClass ic = Scene.v().getSootClass("java.lang.Integer");
556 ce.setCastType(ic.getType());
558 Local l1 = Jimple.v().newLocal("tmpRef" + (tfr++), ic.getType()); body.getLocals().add(l1);
559 Local l2 = Jimple.v().newLocal("tmpRef" + (tfr++), IntType.v()); body.getLocals().add(l2);
561 Stmt s2 = Jimple.v().newAssignStmt(l1, Jimple.v().newCastExpr(ce.getOp(), ic.getType()));
562 body.getUnits().insertBefore(s2, s);
564 Stmt isNull = Jimple.v().newAssignStmt(l2, IntConstant.v(-1));
565 body.getUnits().insertAfter(isNull, s2);
567 Stmt ifStmt = Jimple.v().newIfStmt(Jimple.v().newEqExpr(l1, NullConstant.v()), s);
568 body.getUnits().insertAfter(ifStmt, isNull);
570 SootMethodRef mr = Scene.v().makeMethodRef(ic, "intValue", new LinkedList(), IntType.v(), false);
572 Jimple.v().newAssignStmt(l2, Jimple.v().newVirtualInvokeExpr(l1, mr, new LinkedList()));
573 body.getUnits().insertAfter(isNotNull, ifStmt);
580 } else if (v instanceof InstanceFieldRef) {
581 InstanceFieldRef ifr = (InstanceFieldRef)v;
582 SootFieldRef fr = ifr.getFieldRef();
584 if (isGladiator(fr.declaringClass()) && fr.name().equals("this$0")) {
585 System.out.println("******************");
586 vb.setValue(body.getThisLocal());
587 } else if (isGladiatorFieldRef(fr)) {
588 SootClass mc = getParent(fr.declaringClass());
589 SootFieldRef sf = getGladiatorField(fr).makeRef();
590 InstanceFieldRef sfr = Jimple.v().newInstanceFieldRef(thisLocal(mc, body), sf);
591 System.out.println("s is " + s);
592 ArrayRef ar = Jimple.v().newArrayRef(viaLocal(sfr, body, s), ifr.getBase());
595 if ((t instanceof RefType) && isGladiator(((RefType)t).getSootClass())) {
596 SootClass tc = ((RefType)t).getSootClass();
597 SootClass mc = getParent(tc);
598 ifr.setFieldRef(Scene.v().makeFieldRef(mc, fr.name(), IntType.v(), false));