Package soot

Examples of soot.Type


                    ValueBox box = (ValueBox) boxes.next();
                    Value value = box.getValue();

                    if (value instanceof InstanceOfExpr) {
                        InstanceOfExpr expr = (InstanceOfExpr) value;
                        Type checkType = expr.getCheckType();

                        if (checkType instanceof RefType) {
                            nodes.add(((RefType) checkType).getSootClass());
                        }
                    }
View Full Code Here


            for (Iterator types = typeMap.keySet().iterator(); types.hasNext();) {
                ptolemy.data.type.Type type = (ptolemy.data.type.Type) typeMap
                        .get(types.next());
                RefType tokenType = PtolemyUtilities
                        .getSootTypeForTokenType(type);
                Type arrayType = ArrayType.v(tokenType, 1);
                String fieldName = relation.getName() + "_bufferLocal";

                for (int i = 0; i < relation.getWidth(); i++) {
                    SootField field = new SootField(InlinePortTransformer
                            .getBufferFieldName(relation, i, type), arrayType,
View Full Code Here

            code.append(_indent(1) + "/* DUMMY METHOD STUB */\n");

            if (!cReturnType.equals("void")) {
                code.append(_indent(1) + cReturnType + " dummy;\n");

                Type returnType = method.getReturnType();

                if (returnType instanceof RefLikeType) {
                    code.append(_indent(1) + "dummy = NULL;\n");
                }
                // Initializing the variable prevents warnings from gcc -
View Full Code Here

     *
     *  @return The code for the header of the method.
     */
    protected static String _getHeaderCode(SootMethod method) {
        StringBuffer code = new StringBuffer();
        Type returnType = method.getReturnType();
        int numParameters = method.getParameterCount();

        code.append(CNames.typeNameOf(returnType) + " ");
        code.append(CNames.functionNameOf(method));

        code.append("( ");

        // The first parameter is an instance of the class the
        // method belongs to, if the method is non-static.
        if (!method.isStatic()) {
            code.append(CNames.instanceNameOf(method.getDeclaringClass())
                    + " instance");

            // Put a comma if there are more parameters.
            if (numParameters > 0) {
                code.append(", ");
            }
        }

        Iterator i = method.getParameterTypes().iterator();
        int parameterIndex = 0;
        Type parameterType;

        while (i.hasNext()) {
            parameterType = (Type) i.next();
            code.append(CNames.typeNameOf(parameterType));
            code.append(" p" + parameterIndex);
View Full Code Here

                        SootMethod target = hierarchy.resolveSpecialDispatch(
                                (SpecialInvokeExpr) expr, invokedMethod);
                        Scene.v().releaseActiveHierarchy();
                        _mergeFlow(out, target);
                    } else if (expr instanceof InstanceInvokeExpr) {
                        Type baseType = ((InstanceInvokeExpr) expr).getBase()
                                .getType();

                        if (!(baseType instanceof RefType)) {
                            // We can invoke methods on arrays...
                            // Ignore them here.
View Full Code Here

                    + theClass);
        }

        SootClass stringClass = Scene.v().loadClassAndSupport(
                "java.lang.String");
        Type stringType = RefType.v(stringClass);

        for (Iterator attributes = container.attributeList().iterator(); attributes
                .hasNext();) {
            Attribute attribute = (Attribute) attributes.next();

            if (attributeToValueFieldMap.get(attribute) != null) {
                throw new RuntimeException(
                        "already created field for attribute" + attribute);
            }

            if (attribute instanceof Settable) {
                Settable settable = (Settable) attribute;

                if (debug) {
                    System.out.println("creating field for " + settable);
                }

                String fieldName = StringUtilities.sanitizeName(attribute
                        .getName(context));
                SootField field;

                // Create a field to contain the value of the attribute.
                if (settable instanceof Variable) {
                    Variable variable = (Variable) settable;
                    ptolemy.data.type.Type type = variable.getType();
                    Type tokenType = PtolemyUtilities
                            .getSootTypeForTokenType(type);

                    boolean isConstant = constantAnalysis.getConstVariables(
                            context).contains(attribute);
View Full Code Here

        // them here.
        portInliner.createBuffers();

        System.out.println("Inlining director for " + model.getFullName());

        Type actorType = RefType.v(PtolemyUtilities.actorClass);

        //         SootField postfireReturnsField = new SootField("_postfireReturns",
        //                 BooleanType.v(), Modifier.PRIVATE);
        //         modelClass.addField(postfireReturnsField);
        // First, write out Giotto Code for the model.
View Full Code Here

        // Check to see if we have anything to do.
        if (attributeList.size() == 0) {
            return;
        }

        Type variableType = RefType.v(PtolemyUtilities.variableClass);

        // A local that we will use to set the value of our
        // settable attributes.
        Local attributeLocal = Jimple.v().newLocal("attribute",
                PtolemyUtilities.attributeType);
View Full Code Here

        // Check to see if we have anything to do.
        if (namedObj.attributeList().size() == 0) {
            return;
        }

        Type variableType = RefType.v(PtolemyUtilities.variableClass);

        // A local that we will use to set the value of our
        // settable attributes.
        Local attributeLocal = Jimple.v().newLocal("attribute",
                PtolemyUtilities.attributeType);
        body.getLocals().add(attributeLocal);

        Local settableLocal = Jimple.v().newLocal("settable",
                PtolemyUtilities.settableType);
        body.getLocals().add(settableLocal);

        Local variableLocal = Jimple.v().newLocal("variable", variableType);
        body.getLocals().add(variableLocal);

        for (Iterator attributes = namedObj.attributeList().iterator(); attributes
                .hasNext();) {
            Attribute attribute = (Attribute) attributes.next();

            if (_isIgnorableAttribute(attribute)) {
                continue;
            }

            SootClass attributeClass = (SootClass) _objectToClassMap
                    .get(attribute);

            if (attributeClass == null) {
                attributeClass = Scene.v().loadClassAndSupport(
                        attribute.getClass().getName());
            }

            String className = attributeClass.getName();
            Type attributeType = RefType.v(className);
            String attributeName = attribute.getName(context);
            String fieldName = getFieldNameForAttribute(attribute, context);

            Local local;
View Full Code Here

            }

            SootMethod method = new SootMethod(
                    getAttributeComputationFunctionName(attribute, context),
                    Collections.EMPTY_LIST, VoidType.v(), Modifier.PUBLIC);
            Type variableType = RefType.v(PtolemyUtilities.variableClass);
            theClass.addMethod(method);

            JimpleBody body = Jimple.v().newBody(method);
            method.setActiveBody(body);
            body.insertIdentityStmts();
View Full Code Here

TOP

Related Classes of soot.Type

Copyright © 2018 www.massapicom. 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.