Examples of EffectSet


Examples of joust.tree.annotatedtree.treeinfo.EffectSet

            if (refsToArg.size() <= 1) {
                continue;
            }

            // If the argument has the wrong sort of side effects, we've got no choice but to extract it.
            EffectSet argEffects = args[i].effects.getEffectSet();

            // If it has IO effects, or both escaping reads or writes, it's not safe to do it repeatedly.
            if ((!argEffects.contains(EffectSet.EffectType.READ_ESCAPING)
              || !argEffects.contains(EffectSet.EffectType.WRITE_ESCAPING))
              && !argEffects.contains(EffectSet.EffectType.IO)) {
                 // Since you don't *have* to extract it, check if this one is expensive enough for it to be worth it.
                 ExpressionComplexityClassifier classifier = new ExpressionComplexityClassifier();
                 classifier.visitTree(args[i]);

                 log.info("Score for {} is {}", args[i], classifier.getScore());
View Full Code Here

Examples of joust.tree.annotatedtree.treeinfo.EffectSet

    private static final int INVAR_COMPLEXITY_THRESHOLD = 5;

    private SetHashMap<AJCComparableExpressionTree, AJCTree> getInvariants(AJCEffectAnnotatedTree loop) {
        log.debug("Invar for: {}", loop);

        EffectSet loopEffects = loop.effects.getEffectSet();

        // The local variables written by the loop. Expressions that depend on these aren't loop invariants. (Usually)
        SymbolSet writtenInLoop = loopEffects.writeInternal;
        SymbolSet readInLoop = loopEffects.readInternal;
View Full Code Here

Examples of joust.tree.annotatedtree.treeinfo.EffectSet

            log.debug("Score too low - stop.");
            return;
        }

        // Determine if this tree holds side effects that prevent us from being able to consider it for CSE.
        EffectSet effects = that.wrappedNode.effects.getEffectSet();
        if (effects.contains(EffectSet.EffectType.WRITE_ESCAPING)
         || effects.contains(EffectSet.EffectType.READ_ESCAPING) // Concurrency...
         || effects.contains(EffectSet.EffectType.IO)) {
            log.debug("Effects problematic - stop.");
            return;
        }

        // Do we have an AvailableExpression for this already?
View Full Code Here

Examples of joust.tree.annotatedtree.treeinfo.EffectSet

            if (tree.lhs instanceof AJCArrayAccess) {
                return;
            }

            // Determine if the assignment's RHS has meaningful side-effects...
            EffectSet rhsEffects = tree.rhs.effects.getEffectSet();

            if (shouldCull(rhsEffects, live)) {
                log.info("Killing redundant assignment: {}", tree);
                log.info("Live: {}", Arrays.toString(live.toArray()));
                log.info("Target: {}", target);
View Full Code Here

Examples of joust.tree.annotatedtree.treeinfo.EffectSet

    /**
     * General visitor method for handling updates - strips from the availableExpressions map anything invalidated by
     * this tree. (Using effect information).
     */
    private void visitUpdate(AJCEffectAnnotatedTree tree) {
        EffectSet effects = tree.effects.getEffectSet();
        SymbolSet internalWrites = effects.writeInternal;

        // If this tree writes anything that is read by an availableExpression, it has to go.
        // TODO: Make this more efficient.
        Set<AJCComparableExpressionTree> keysCopy = new HashSet<AJCComparableExpressionTree>(availableExpressions.keySet());
        for (AJCComparableExpressionTree t : keysCopy) {
            if (t.wrappedNode instanceof AJCEffectAnnotatedTree) {
                AJCEffectAnnotatedTree effectTree = (AJCEffectAnnotatedTree) t.wrappedNode;

                EffectSet availEffects = effectTree.effects.getEffectSet();
                for (Symbol.VarSymbol sym : availEffects.readInternal) {
                    if (internalWrites.contains(sym)) {
                        log.debug("Dropping {} because {} wrote {}", t, tree, sym);
                        finaliseAvailableExpression(availableExpressions.get(t));
                        availableExpressions.remove(t);
View Full Code Here

Examples of joust.tree.annotatedtree.treeinfo.EffectSet

            if (tree.lhs instanceof AJCArrayAccess) {
                return;
            }

            // Determine if the assignment's RHS has meaningful side-effects...
            EffectSet rhsEffects = tree.rhs.effects.getEffectSet();

            if (shouldCull(rhsEffects, live)) {
                log.info("Killing redundant assignment: {}", tree);
                log.info("Live: {}", Arrays.toString(live.toArray()));
                log.info("Target: {}", target);
View Full Code Here

Examples of joust.tree.annotatedtree.treeinfo.EffectSet

                return;
            }

            // Check if the assignment has interesting side effects.
            EffectSet rhsEffects = tree.getInit().effects.getEffectSet();
            boolean cull = shouldCull(rhsEffects, live);

            if (everLive.contains(target)) {
                // We need the variable declaration.
                if (cull) {
View Full Code Here

Examples of joust.tree.annotatedtree.treeinfo.EffectSet

        if (detector.failureInducing) {
            return;
        }

        log.debug("Considering invariance of {}", that);
        EffectSet exprEffects = ((AJCEffectAnnotatedTree) that.wrappedNode).effects.getEffectSet();
        log.debug("Effects: {}", exprEffects);

        // Escaping symbol uses are omitted to avoid concurrency problems.
        // Write effects cause something to be omitted from moving out of the loop.
        if (exprEffects.contains(EffectSet.EffectType.READ_ESCAPING)
         || exprEffects.contains(EffectSet.EffectType.WRITE_ESCAPING)
         || exprEffects.contains(EffectSet.EffectType.IO)) {
            log.debug("No good - contains unacceptable writes of escaping reads.");
            return;
        }

        if (exprEffects.contains(EffectSet.EffectType.READ_INTERNAL)) {
            // Determine if this expression reads any symbols that are written in the loop.
            SymbolSet readSymbols = new SymbolSet(exprEffects.readInternal);

            log.debug("ReadSymbols: {}", readSymbols);
            readSymbols.retainAll(writtenInLoop);
            log.debug("After dropping: {}", readSymbols);

            if (!readSymbols.isEmpty()) {
                log.debug("No good - reads symbols written in the loop.");
                return;
            }
        }

        if (exprEffects.contains(EffectSet.EffectType.WRITE_INTERNAL)) {
            // Determine if this expression writes any symbols that are read in the loop.
            SymbolSet writeSymbols = new SymbolSet(exprEffects.writeInternal);

            log.debug("ReadSymbols: {}", writeSymbols);
            writeSymbols.retainAll(readInLoop);
View Full Code Here

Examples of joust.tree.annotatedtree.treeinfo.EffectSet

    @Override
    public void visitForLoop(AJCForLoop tree) {
        super.visitForLoop(tree);
        log.debug("unroll consideration for {}", tree);

        EffectSet condEffects = tree.cond.effects.getEffectSet();
        SymbolSet condReads = condEffects.readInternal;
        SymbolSet condWrites = condEffects.writeInternal;

        // Find the effects for the statements in the repeat steps...
        SymbolSet repeatReads = new SymbolSet();
        SymbolSet repeatWrites = new SymbolSet();
        for (AJCExpressionStatement stat : tree.step) {
            EffectSet stepEffects = stat.effects.getEffectSet();
            repeatReads.addAll(stepEffects.readInternal);
            repeatWrites.addAll(stepEffects.writeInternal);
        }

        // Determine if any of the symbols depended on by the condition or repeat are global.
        if (containsGlobal(condReads) || containsGlobal(condWrites)
         || containsGlobal(repeatReads) || containsGlobal(repeatWrites)) {
            log.debug("Aborting unrolling - global symbol deps!");
            return;
        }

        EffectSet bodyEffects = tree.body.effects.getEffectSet();
        // If the body writes anything read by the cond or repeat, abort. (That shit's complicated.).
        SymbolSet bodyWrites = bodyEffects.writeInternal;

        // TODO: can *sometimes* deal with this. Sort of tricky, and implies very retarded code.
        if (!bodyWrites.intersect(condReads).isEmpty() || !bodyWrites.intersect(repeatReads).isEmpty()) {
View Full Code Here

Examples of joust.tree.annotatedtree.treeinfo.EffectSet

//        depsF = deps;
    }

    @Override
    public void write(Kryo kryo, Output output, Effects effects) {
        EffectSet directPart;
        EffectSet computedPart;
        Set<Effects> backwardDeps;
        Set<Effects> deps;
        try {
            directPart = (EffectSet) directPartF.get(effects);
            computedPart = (EffectSet) computedPartF.get(effects);
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.