Esempio n. 1
0
 private Function createFieldGetter(SootField field) {
   Function fn = FunctionBuilder.getter(field);
   Value fieldPtr = null;
   if (field.isStatic()) {
     fieldPtr = getClassFieldPtr(fn, field);
   } else {
     fieldPtr = getInstanceFieldPtr(fn, fn.getParameterRef(1), field);
   }
   Variable result = fn.newVariable(getType(field.getType()));
   if (Modifier.isVolatile(field.getModifiers())) {
     fn.add(new Fence(Ordering.seq_cst));
     if (LongType.v().equals(field.getType())) {
       fn.add(new Load(result, fieldPtr, false, Ordering.unordered, 8));
     } else {
       fn.add(new Load(result, fieldPtr));
     }
   } else {
     fn.add(new Load(result, fieldPtr));
   }
   fn.add(new Ret(new VariableRef(result)));
   return fn;
 }