Search in sources :

Example 1 with JBTROptions

use of soot.options.JBTROptions in project soot by Sable.

the class TypeAssigner method internalTransform.

/**
 * Assign types to local variables. *
 */
@Override
protected void internalTransform(Body b, String phaseName, Map<String, String> options) {
    if (b == null) {
        throw new NullPointerException();
    }
    Date start = new Date();
    if (Options.v().verbose())
        logger.debug("[TypeAssigner] typing system started on " + start);
    JBTROptions opt = new JBTROptions(options);
    /*
		 * Setting this guard to true enables comparison of the original and new
		 * type assigners. This will be slow since type assignment will always
		 * happen twice. The actual types used for Jimple are determined by the
		 * use-old-type-assigner option.
		 * 
		 * Each comparison is written as a separate semicolon-delimited line to
		 * the standard output, and the first field is always 'cmp' for use in
		 * grep. The format is:
		 * 
		 * cmp;Method Name;Stmt Count;Old Inference Time (ms); New Inference
		 * Time (ms);Typing Comparison
		 * 
		 * The Typing Comparison field compares the old and new typings: -2 -
		 * Old typing contains fewer variables (BAD!) -1 - Old typing is tighter
		 * (BAD!) 0 - Typings are equal 1 - New typing is tighter 2 - New typing
		 * contains fewer variables 3 - Typings are incomparable (inspect
		 * manually)
		 * 
		 * In a final release this guard, and anything in the first branch,
		 * would probably be removed.
		 */
    if (opt.compare_type_assigners()) {
        compareTypeAssigners(b, opt.use_older_type_assigner());
    } else {
        if (opt.use_older_type_assigner())
            TypeResolver.resolve((JimpleBody) b, Scene.v());
        else
            (new soot.jimple.toolkits.typing.fast.TypeResolver((JimpleBody) b)).inferTypes();
    }
    Date finish = new Date();
    if (Options.v().verbose()) {
        long runtime = finish.getTime() - start.getTime();
        long mins = runtime / 60000;
        long secs = (runtime % 60000) / 1000;
        logger.debug("[TypeAssigner] typing system ended. It took " + mins + " mins and " + secs + " secs.");
    }
    if (!opt.ignore_nullpointer_dereferences())
        replaceNullType(b);
    if (typingFailed((JimpleBody) b))
        throw new RuntimeException("type inference failed!");
}
Also used : JBTROptions(soot.options.JBTROptions) JimpleBody(soot.jimple.JimpleBody) Date(java.util.Date)

Aggregations

Date (java.util.Date)1 JimpleBody (soot.jimple.JimpleBody)1 JBTROptions (soot.options.JBTROptions)1