Esempio n. 1
0
 private Function createFieldSetter(SootField field) {
   Function fn = FunctionBuilder.setter(field);
   Value fieldPtr = null;
   Value value = null;
   if (field.isStatic()) {
     fieldPtr = getClassFieldPtr(fn, field);
     value = fn.getParameterRef(1);
   } else {
     fieldPtr = getInstanceFieldPtr(fn, fn.getParameterRef(1), field);
     value = fn.getParameterRef(2);
   }
   if (Modifier.isVolatile(field.getModifiers())
       || !field.isStatic() && Modifier.isFinal(field.getModifiers())) {
     if (LongType.v().equals(field.getType())) {
       fn.add(new Store(value, fieldPtr, false, Ordering.unordered, 8));
     } else {
       fn.add(new Store(value, fieldPtr));
     }
     fn.add(new Fence(Ordering.seq_cst));
   } else {
     fn.add(new Store(value, fieldPtr));
   }
   fn.add(new Ret());
   return fn;
 }