Search in sources :

Example 6 with BitVector

use of soot.util.BitVector in project soot by Sable.

the class TypeResolverBV method merge_primitive_types.

private void merge_primitive_types() throws TypeException {
    // merge primitive types with all parents/children
    compute_solved();
    BitSetIterator varIt = solved.iterator();
    while (varIt.hasNext()) {
        TypeVariableBV var = typeVariableForId(varIt.next());
        if (var.type().type() instanceof IntType || var.type().type() instanceof LongType || var.type().type() instanceof FloatType || var.type().type() instanceof DoubleType) {
            BitVector parents;
            BitVector children;
            boolean finished;
            do {
                finished = true;
                parents = var.parents();
                if (parents.length() != 0) {
                    finished = false;
                    for (BitSetIterator j = parents.iterator(); j.hasNext(); ) {
                        if (DEBUG) {
                            logger.debug(".");
                        }
                        TypeVariableBV parent = typeVariableForId(j.next());
                        var = var.union(parent);
                    }
                }
                children = var.children();
                if (children.length() != 0) {
                    finished = false;
                    for (BitSetIterator j = children.iterator(); j.hasNext(); ) {
                        if (DEBUG) {
                            logger.debug(".");
                        }
                        TypeVariableBV child = typeVariableForId(j.next());
                        var = var.union(child);
                    }
                }
            } while (!finished);
        }
    }
}
Also used : BitSetIterator(soot.util.BitSetIterator) BitVector(soot.util.BitVector) LongType(soot.LongType) DoubleType(soot.DoubleType) IntType(soot.IntType) FloatType(soot.FloatType)

Example 7 with BitVector

use of soot.util.BitVector in project soot by Sable.

the class TypeManager method makeMaskOfInterface.

private final BitVector makeMaskOfInterface(SootClass interf) {
    if (!(interf.isInterface()))
        throw new RuntimeException();
    BitVector ret = new BitVector(pag.getAllocNodeNumberer().size());
    typeMask.put(interf.getType(), ret);
    Collection<SootClass> implementers = fh.getAllImplementersOfInterface(interf);
    for (SootClass impl : implementers) {
        BitVector other = (BitVector) typeMask.get(impl.getType());
        if (other == null)
            other = makeClassTypeMask(impl);
        ret.or(other);
    }
    // type-masks exactly the same as the original type-masks
    if (implementers.size() == 0) {
        for (AllocNode an : anySubtypeAllocs) ret.set(an.getNumber());
    }
    return ret;
}
Also used : BitVector(soot.util.BitVector) AllocNode(soot.jimple.spark.pag.AllocNode) SootClass(soot.SootClass)

Example 8 with BitVector

use of soot.util.BitVector in project soot by Sable.

the class BitVector_intersects_Test method testNotEquallySizedEmptyBitVectorsDontIntersects.

public void testNotEquallySizedEmptyBitVectorsDontIntersects() {
    BitVector a = new BitVector(2048);
    BitVector b = new BitVector(1024);
    assertFalse(a.intersects(b));
    assertFalse(b.intersects(a));
}
Also used : BitVector(soot.util.BitVector)

Example 9 with BitVector

use of soot.util.BitVector in project soot by Sable.

the class BitVector_intersects_Test method testNonEmptyBitVectorIntersectsItself.

public void testNonEmptyBitVectorIntersectsItself() {
    BitVector a = new BitVector();
    a.set(337);
    assertTrue(a.intersects(a));
}
Also used : BitVector(soot.util.BitVector)

Example 10 with BitVector

use of soot.util.BitVector in project soot by Sable.

the class BitVector_intersects_Test method testEquallySizedEmptyBitVectorsDontIntersects.

public void testEquallySizedEmptyBitVectorsDontIntersects() {
    BitVector a = new BitVector(1024);
    BitVector b = new BitVector(1024);
    assertFalse(a.intersects(b));
    assertFalse(b.intersects(a));
}
Also used : BitVector(soot.util.BitVector)

Aggregations

BitVector (soot.util.BitVector)24 SootClass (soot.SootClass)4 AllocNode (soot.jimple.spark.pag.AllocNode)4 BitSetIterator (soot.util.BitSetIterator)4 Node (soot.jimple.spark.pag.Node)3 AnySubType (soot.AnySubType)2 ArrayType (soot.ArrayType)2 NullType (soot.NullType)2 RefLikeType (soot.RefLikeType)2 RefType (soot.RefType)2 Type (soot.Type)2 TypeManager (soot.jimple.spark.internal.TypeManager)2 Iterator (java.util.Iterator)1 LinkedList (java.util.LinkedList)1 DoubleType (soot.DoubleType)1 FloatType (soot.FloatType)1 IntType (soot.IntType)1 LongType (soot.LongType)1